From 7c4d60286396e997a49e20cea9dc77ed464159ad Mon Sep 17 00:00:00 2001 From: Philip Rebohle Date: Thu, 30 Jun 2022 20:47:50 +0200 Subject: [PATCH] [dxvk] Change spec constant IDs We no longer support per-resource spec constants, so there is no good reason not to use a 1:1 mapping for user-defined constants. --- src/d3d9/shaders/d3d9_convert_yuy2_uyvy.comp | 2 +- src/dxvk/dxvk_graphics.cpp | 1 - src/dxvk/dxvk_shader.h | 8 ++------ src/dxvk/hud/shaders/hud_graph_frag.frag | 2 +- src/dxvk/hud/shaders/hud_text_frag.frag | 2 +- src/dxvk/shaders/dxvk_present_frag.frag | 2 +- src/dxvk/shaders/dxvk_present_frag_blit.frag | 2 +- src/dxvk/shaders/dxvk_present_frag_ms.frag | 4 ++-- src/dxvk/shaders/dxvk_present_frag_ms_amd.frag | 4 ++-- 9 files changed, 11 insertions(+), 16 deletions(-) diff --git a/src/d3d9/shaders/d3d9_convert_yuy2_uyvy.comp b/src/d3d9/shaders/d3d9_convert_yuy2_uyvy.comp index 8f38c9bac..bbcf8e283 100644 --- a/src/d3d9/shaders/d3d9_convert_yuy2_uyvy.comp +++ b/src/d3d9/shaders/d3d9_convert_yuy2_uyvy.comp @@ -3,7 +3,7 @@ #include "d3d9_convert_common.h" -layout(constant_id = 1225) const bool s_is_uyvy = false; +layout(constant_id = 0) const bool s_is_uyvy = false; layout( local_size_x = 8, diff --git a/src/dxvk/dxvk_graphics.cpp b/src/dxvk/dxvk_graphics.cpp index 3d7feca05..b611059a4 100644 --- a/src/dxvk/dxvk_graphics.cpp +++ b/src/dxvk/dxvk_graphics.cpp @@ -152,7 +152,6 @@ namespace dxvk { // Set up some specialization constants DxvkSpecConstants specData; - specData.set(uint32_t(DxvkSpecConstantId::RasterizerSampleCount), sampleCount, VK_SAMPLE_COUNT_1_BIT); for (uint32_t i = 0; i < MaxNumRenderTargets; i++) { if ((m_fsOut & (1 << i)) != 0) { diff --git a/src/dxvk/dxvk_shader.h b/src/dxvk/dxvk_shader.h index 0267e6467..ba798aea5 100644 --- a/src/dxvk/dxvk_shader.h +++ b/src/dxvk/dxvk_shader.h @@ -24,14 +24,10 @@ namespace dxvk { * implementation at pipeline compilation time. */ enum class DxvkSpecConstantId : uint32_t { + FirstPipelineConstant = 0, /// Special constant ranges that do not count /// towards the spec constant min/max values - ColorComponentMappings = MaxNumResourceSlots, - - // Specialization constants for pipeline state - SpecConstantRangeStart = ColorComponentMappings + MaxNumRenderTargets, - RasterizerSampleCount = SpecConstantRangeStart + 0, - FirstPipelineConstant + ColorComponentMappings = DxvkLimits::MaxNumSpecConstants, }; /** diff --git a/src/dxvk/hud/shaders/hud_graph_frag.frag b/src/dxvk/hud/shaders/hud_graph_frag.frag index b45aa43ef..224eb061c 100644 --- a/src/dxvk/hud/shaders/hud_graph_frag.frag +++ b/src/dxvk/hud/shaders/hud_graph_frag.frag @@ -1,6 +1,6 @@ #version 450 -layout(constant_id = 1225) const bool srgbSwapchain = false; +layout(constant_id = 0) const bool srgbSwapchain = false; layout(location = 0) in vec2 v_coord; layout(location = 0) out vec4 o_color; diff --git a/src/dxvk/hud/shaders/hud_text_frag.frag b/src/dxvk/hud/shaders/hud_text_frag.frag index 56a2823ce..86d3a9093 100644 --- a/src/dxvk/hud/shaders/hud_text_frag.frag +++ b/src/dxvk/hud/shaders/hud_text_frag.frag @@ -1,6 +1,6 @@ #version 450 -layout(constant_id = 1225) const bool srgbSwapchain = false; +layout(constant_id = 0) const bool srgbSwapchain = false; layout(binding = 2) uniform sampler2D s_font; diff --git a/src/dxvk/shaders/dxvk_present_frag.frag b/src/dxvk/shaders/dxvk_present_frag.frag index fb7e0c414..3501a4f27 100644 --- a/src/dxvk/shaders/dxvk_present_frag.frag +++ b/src/dxvk/shaders/dxvk_present_frag.frag @@ -1,6 +1,6 @@ #version 450 -layout(constant_id = 1226) const bool s_gamma_bound = false; +layout(constant_id = 1) const bool s_gamma_bound = false; layout(binding = 0) uniform sampler2D s_image; layout(binding = 1) uniform sampler1D s_gamma; diff --git a/src/dxvk/shaders/dxvk_present_frag_blit.frag b/src/dxvk/shaders/dxvk_present_frag_blit.frag index f85d86060..e14ae311a 100644 --- a/src/dxvk/shaders/dxvk_present_frag_blit.frag +++ b/src/dxvk/shaders/dxvk_present_frag_blit.frag @@ -1,6 +1,6 @@ #version 450 -layout(constant_id = 1226) const bool s_gamma_bound = false; +layout(constant_id = 1) const bool s_gamma_bound = false; layout(binding = 0) uniform sampler2D s_image; layout(binding = 1) uniform sampler1D s_gamma; diff --git a/src/dxvk/shaders/dxvk_present_frag_ms.frag b/src/dxvk/shaders/dxvk_present_frag_ms.frag index 119516673..18771d38b 100644 --- a/src/dxvk/shaders/dxvk_present_frag_ms.frag +++ b/src/dxvk/shaders/dxvk_present_frag_ms.frag @@ -1,7 +1,7 @@ #version 450 -layout(constant_id = 1225) const uint c_samples = 0; -layout(constant_id = 1226) const bool s_gamma_bound = false; +layout(constant_id = 0) const uint c_samples = 0; +layout(constant_id = 1) const bool s_gamma_bound = false; layout(binding = 0) uniform sampler2DMS s_image; layout(binding = 1) uniform sampler1D s_gamma; diff --git a/src/dxvk/shaders/dxvk_present_frag_ms_amd.frag b/src/dxvk/shaders/dxvk_present_frag_ms_amd.frag index 23773310f..df391fb11 100644 --- a/src/dxvk/shaders/dxvk_present_frag_ms_amd.frag +++ b/src/dxvk/shaders/dxvk_present_frag_ms_amd.frag @@ -2,8 +2,8 @@ #extension GL_AMD_shader_fragment_mask: enable -layout(constant_id = 1225) const uint c_samples = 0; -layout(constant_id = 1226) const bool s_gamma_bound = false; +layout(constant_id = 0) const uint c_samples = 0; +layout(constant_id = 1) const bool s_gamma_bound = false; layout(binding = 0) uniform sampler2DMS s_image; layout(binding = 1) uniform sampler1D s_gamma;