use srgb for openxr, linear for openvr

This commit is contained in:
galister
2025-04-11 02:13:02 +09:00
parent f12d151abf
commit a8ecc973a4
7 changed files with 17 additions and 21 deletions

View File

@@ -13,7 +13,7 @@ use vulkano::command_buffer::CommandBufferUsage;
use crate::{
backend::openxr::helpers,
graphics::{CommandBuffers, WlxGraphics, WlxPipeline, SWAPCHAIN_FORMAT},
graphics::{CommandBuffers, WlxGraphics, WlxPipeline},
};
use super::{
@@ -49,7 +49,7 @@ impl LinePool {
let pipeline = graphics.create_pipeline(
shaders.get("vert_common").unwrap().clone(), // want panic
shaders.get("frag_color").unwrap().clone(), // want panic
SWAPCHAIN_FORMAT,
graphics.native_format,
None,
)?;

View File

@@ -14,7 +14,7 @@ use vulkano::{
use crate::{
backend::openxr::{helpers::translation_rotation_to_posef, swapchain::SwapchainOpts},
config_io,
graphics::{dds::WlxCommandBufferDds, CommandBuffers, SWAPCHAIN_FORMAT},
graphics::{dds::WlxCommandBufferDds, CommandBuffers},
state::AppState,
};
@@ -102,7 +102,7 @@ impl Skybox {
let pipeline = app.graphics.create_pipeline(
shaders.get("vert_common").unwrap().clone(), // want panic
shaders.get("frag_srgb").unwrap().clone(), // want panic
SWAPCHAIN_FORMAT,
app.graphics.native_format,
None,
)?;
@@ -149,7 +149,7 @@ impl Skybox {
let pipeline = app.graphics.create_pipeline(
shaders.get("vert_common").unwrap().clone(), // want panic
shaders.get("frag_grid").unwrap().clone(), // want panic
SWAPCHAIN_FORMAT,
app.graphics.native_format,
Some(AttachmentBlend::alpha()),
)?;

View File

@@ -9,7 +9,7 @@ use vulkano::{
Handle,
};
use crate::graphics::{WlxGraphics, SWAPCHAIN_FORMAT};
use crate::graphics::WlxGraphics;
use super::XrState;
@@ -43,7 +43,7 @@ pub(super) fn create_swapchain(
let swapchain = xr.session.create_swapchain(&xr::SwapchainCreateInfo {
create_flags,
usage_flags: xr::SwapchainUsageFlags::COLOR_ATTACHMENT | xr::SwapchainUsageFlags::SAMPLED,
format: SWAPCHAIN_FORMAT as _,
format: graphics.native_format as _,
sample_count: 1,
width: extent[0],
height: extent[1],
@@ -63,7 +63,7 @@ pub(super) fn create_swapchain(
graphics.device.clone(),
vk_image,
ImageCreateInfo {
format: SWAPCHAIN_FORMAT as _,
format: graphics.native_format as _,
extent,
usage: ImageUsage::COLOR_ATTACHMENT,
..Default::default()

View File

@@ -99,8 +99,6 @@ pub struct Vert2Uv {
pub in_uv: [f32; 2],
}
pub const SWAPCHAIN_FORMAT: Format = Format::R8G8B8A8_SRGB;
pub const INDICES: [u16; 6] = [2, 1, 0, 1, 2, 3];
pub const BLEND_ALPHA: AttachmentBlend = AttachmentBlend {
@@ -377,7 +375,7 @@ impl WlxGraphics {
graphics_queue,
transfer_queue,
capture_queue,
native_format: Format::R8G8B8A8_UNORM,
native_format: Format::R8G8B8A8_SRGB,
texture_filtering,
memory_allocator,
command_buffer_allocator,

View File

@@ -11,7 +11,7 @@ use crate::{
input::{Haptics, InteractionHandler, PointerHit},
overlay::{FrameMeta, OverlayBackend, OverlayRenderer, ShouldRender},
},
graphics::{CommandBuffers, WlxGraphics, WlxPipeline, BLEND_ALPHA, SWAPCHAIN_FORMAT},
graphics::{CommandBuffers, WlxGraphics, WlxPipeline, BLEND_ALPHA},
state::AppState,
};
@@ -105,21 +105,21 @@ impl<D, S> Canvas<D, S> {
let pipeline_hl_color = graphics.create_pipeline(
vert.clone(),
shaders.get("frag_color").unwrap().clone(), // want panic
SWAPCHAIN_FORMAT,
graphics.native_format,
Some(BLEND_ALPHA),
)?;
let pipeline_hl_sprite = graphics.create_pipeline(
vert.clone(),
shaders.get("frag_sprite2_hl").unwrap().clone(), // want panic
SWAPCHAIN_FORMAT,
graphics.native_format,
Some(BLEND_ALPHA),
)?;
let pipeline_final = graphics.create_pipeline(
vert,
shaders.get("frag_srgb").unwrap().clone(), // want panic
SWAPCHAIN_FORMAT,
graphics.native_format,
Some(BLEND_ALPHA),
)?;

View File

@@ -53,9 +53,7 @@ use crate::{
overlay::{FrameMeta, OverlayRenderer, OverlayState, ShouldRender, SplitOverlayBackend},
},
config::{def_pw_tokens, GeneralConfig, PwTokenMap},
graphics::{
fourcc_to_vk, CommandBuffers, WlxGraphics, WlxPipeline, WlxUploadsBuffer, SWAPCHAIN_FORMAT,
},
graphics::{fourcc_to_vk, CommandBuffers, WlxGraphics, WlxPipeline, WlxUploadsBuffer},
hid::{MOUSE_LEFT, MOUSE_MIDDLE, MOUSE_RIGHT},
state::{AppSession, AppState, KeyboardFocus, ScreenMeta},
};
@@ -168,7 +166,7 @@ impl ScreenPipeline {
let pipeline = app.graphics.create_pipeline(
shaders.get("vert_common").unwrap().clone(), // want panic
shaders.get("frag_screen").unwrap().clone(), // want panic
SWAPCHAIN_FORMAT,
app.graphics.native_format,
Some(AttachmentBlend::default()),
)?;

View File

@@ -23,7 +23,7 @@ use crate::{
},
},
config_wayvr,
graphics::{CommandBuffers, WlxGraphics, WlxPipeline, SWAPCHAIN_FORMAT},
graphics::{CommandBuffers, WlxGraphics, WlxPipeline},
gui::modular::button::{WayVRAction, WayVRDisplayClickAction},
state::{self, AppState, KeyboardFocus},
};
@@ -190,7 +190,7 @@ impl WayVRRenderer {
let pipeline = app.graphics.create_pipeline(
shaders.get("vert_common").unwrap().clone(), // want panic
shaders.get("frag_srgb").unwrap().clone(), // want panic
SWAPCHAIN_FORMAT,
app.graphics.native_format,
None,
)?;