From: Józef Kucia jkucia@codeweavers.com
Signed-off-by: Józef Kucia jkucia@codeweavers.com --- AUTHORS | 1 + 1 file changed, 1 insertion(+)
diff --git a/AUTHORS b/AUTHORS index 3d0c470046bd..1991bdf8081d 100644 --- a/AUTHORS +++ b/AUTHORS @@ -1,2 +1,3 @@ Henri Verbeet Józef Kucia +Sven Hesse
From: Józef Kucia jkucia@codeweavers.com
We may need to swizzle components in pixel shader based on render target formats because Vulkan doesn't support swizzles for framebuffer attachment image views.
Signed-off-by: Józef Kucia jkucia@codeweavers.com --- libs/vkd3d/state.c | 174 ++++++++++++++++++++++++++--------------------------- 1 file changed, 87 insertions(+), 87 deletions(-)
diff --git a/libs/vkd3d/state.c b/libs/vkd3d/state.c index b89f854601b8..4841b0de92b8 100644 --- a/libs/vkd3d/state.c +++ b/libs/vkd3d/state.c @@ -1837,6 +1837,93 @@ static HRESULT d3d12_pipeline_state_init_graphics(struct d3d12_pipeline_state *s return E_INVALIDARG; }
+ rt_count = desc->NumRenderTargets; + if (rt_count > ARRAY_SIZE(graphics->attachments) - 1) + { + FIXME("NumRenderTargets %zu > %zu, ignoring extra formats.\n", + rt_count, ARRAY_SIZE(graphics->attachments) - 1); + rt_count = ARRAY_SIZE(graphics->attachments) - 1; + } + + graphics->rt_idx = 0; + if (desc->DepthStencilState.DepthEnable || desc->DepthStencilState.StencilEnable) + { + const D3D12_DEPTH_STENCIL_DESC *ds_desc = &desc->DepthStencilState; + VkImageLayout depth_layout; + + if (!(format = vkd3d_get_format(desc->DSVFormat, true))) + { + WARN("Invalid DXGI format %#x.\n", desc->DSVFormat); + hr = E_FAIL; + goto fail; + } + + if ((ds_desc->DepthEnable && ds_desc->DepthWriteMask) + || (ds_desc->StencilEnable && ds_desc->StencilWriteMask)) + depth_layout = VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL; + else + depth_layout = VK_IMAGE_LAYOUT_DEPTH_STENCIL_READ_ONLY_OPTIMAL; + + graphics->attachments[0].flags = 0; + graphics->attachments[0].format = format->vk_format; + graphics->attachments[0].samples = VK_SAMPLE_COUNT_1_BIT; + if (desc->DepthStencilState.DepthEnable) + { + graphics->attachments[0].loadOp = VK_ATTACHMENT_LOAD_OP_LOAD; + graphics->attachments[0].storeOp = VK_ATTACHMENT_STORE_OP_STORE; + } + else + { + graphics->attachments[0].loadOp = VK_ATTACHMENT_LOAD_OP_DONT_CARE; + graphics->attachments[0].storeOp = VK_ATTACHMENT_STORE_OP_DONT_CARE; + } + if (desc->DepthStencilState.StencilEnable) + { + graphics->attachments[0].stencilLoadOp = VK_ATTACHMENT_LOAD_OP_LOAD; + graphics->attachments[0].stencilStoreOp = VK_ATTACHMENT_STORE_OP_STORE; + } + else + { + graphics->attachments[0].stencilLoadOp = VK_ATTACHMENT_LOAD_OP_DONT_CARE; + graphics->attachments[0].stencilStoreOp = VK_ATTACHMENT_STORE_OP_DONT_CARE; + } + graphics->attachments[0].initialLayout = depth_layout; + graphics->attachments[0].finalLayout = depth_layout; + + graphics->attachment_references[0].attachment = 0; + graphics->attachment_references[0].layout = depth_layout; + ++graphics->rt_idx; + } + + for (i = 0; i < rt_count; ++i) + { + unsigned int blend_idx = desc->BlendState.IndependentBlendEnable ? i : 0; + size_t idx = graphics->rt_idx + i; + + if (!(format = vkd3d_get_format(desc->RTVFormats[i], false))) + { + WARN("Invalid DXGI format %#x.\n", desc->RTVFormats[i]); + hr = E_FAIL; + goto fail; + } + + graphics->attachments[idx].flags = 0; + graphics->attachments[idx].format = format->vk_format; + graphics->attachments[idx].samples = VK_SAMPLE_COUNT_1_BIT; + graphics->attachments[idx].loadOp = VK_ATTACHMENT_LOAD_OP_LOAD; + graphics->attachments[idx].storeOp = VK_ATTACHMENT_STORE_OP_STORE; + graphics->attachments[idx].stencilLoadOp = VK_ATTACHMENT_LOAD_OP_DONT_CARE; + graphics->attachments[idx].stencilStoreOp = VK_ATTACHMENT_STORE_OP_DONT_CARE; + graphics->attachments[idx].initialLayout = VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL; + graphics->attachments[idx].finalLayout = VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL; + + graphics->attachment_references[idx].attachment = idx; + graphics->attachment_references[idx].layout = VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL; + + blend_attachment_from_d3d12(&graphics->blend_attachments[i], &desc->BlendState.RenderTarget[blend_idx]); + } + graphics->attachment_count = graphics->rt_idx + rt_count; + shader_interface.bindings = root_signature->descriptor_mapping; shader_interface.binding_count = root_signature->descriptor_count; shader_interface.push_constant_buffers = root_signature->root_constants; @@ -1956,93 +2043,6 @@ static HRESULT d3d12_pipeline_state_init_graphics(struct d3d12_pipeline_state *s graphics->attribute_count = j; vkd3d_shader_free_shader_signature(&input_signature);
- rt_count = desc->NumRenderTargets; - if (rt_count > ARRAY_SIZE(graphics->attachments) - 1) - { - FIXME("NumRenderTargets %zu > %zu, ignoring extra formats.\n", - rt_count, ARRAY_SIZE(graphics->attachments) - 1); - rt_count = ARRAY_SIZE(graphics->attachments) - 1; - } - - graphics->rt_idx = 0; - if (desc->DepthStencilState.DepthEnable || desc->DepthStencilState.StencilEnable) - { - const D3D12_DEPTH_STENCIL_DESC *ds_desc = &desc->DepthStencilState; - VkImageLayout depth_layout; - - if (!(format = vkd3d_get_format(desc->DSVFormat, true))) - { - WARN("Invalid DXGI format %#x.\n", desc->DSVFormat); - hr = E_FAIL; - goto fail; - } - - if ((ds_desc->DepthEnable && ds_desc->DepthWriteMask) - || (ds_desc->StencilEnable && ds_desc->StencilWriteMask)) - depth_layout = VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL; - else - depth_layout = VK_IMAGE_LAYOUT_DEPTH_STENCIL_READ_ONLY_OPTIMAL; - - graphics->attachments[0].flags = 0; - graphics->attachments[0].format = format->vk_format; - graphics->attachments[0].samples = VK_SAMPLE_COUNT_1_BIT; - if (desc->DepthStencilState.DepthEnable) - { - graphics->attachments[0].loadOp = VK_ATTACHMENT_LOAD_OP_LOAD; - graphics->attachments[0].storeOp = VK_ATTACHMENT_STORE_OP_STORE; - } - else - { - graphics->attachments[0].loadOp = VK_ATTACHMENT_LOAD_OP_DONT_CARE; - graphics->attachments[0].storeOp = VK_ATTACHMENT_STORE_OP_DONT_CARE; - } - if (desc->DepthStencilState.StencilEnable) - { - graphics->attachments[0].stencilLoadOp = VK_ATTACHMENT_LOAD_OP_LOAD; - graphics->attachments[0].stencilStoreOp = VK_ATTACHMENT_STORE_OP_STORE; - } - else - { - graphics->attachments[0].stencilLoadOp = VK_ATTACHMENT_LOAD_OP_DONT_CARE; - graphics->attachments[0].stencilStoreOp = VK_ATTACHMENT_STORE_OP_DONT_CARE; - } - graphics->attachments[0].initialLayout = depth_layout; - graphics->attachments[0].finalLayout = depth_layout; - - graphics->attachment_references[0].attachment = 0; - graphics->attachment_references[0].layout = depth_layout; - ++graphics->rt_idx; - } - - for (i = 0; i < rt_count; ++i) - { - unsigned int blend_idx = desc->BlendState.IndependentBlendEnable ? i : 0; - size_t idx = graphics->rt_idx + i; - - if (!(format = vkd3d_get_format(desc->RTVFormats[i], false))) - { - WARN("Invalid DXGI format %#x.\n", desc->RTVFormats[i]); - hr = E_FAIL; - goto fail; - } - - graphics->attachments[idx].flags = 0; - graphics->attachments[idx].format = format->vk_format; - graphics->attachments[idx].samples = VK_SAMPLE_COUNT_1_BIT; - graphics->attachments[idx].loadOp = VK_ATTACHMENT_LOAD_OP_LOAD; - graphics->attachments[idx].storeOp = VK_ATTACHMENT_STORE_OP_STORE; - graphics->attachments[idx].stencilLoadOp = VK_ATTACHMENT_LOAD_OP_DONT_CARE; - graphics->attachments[idx].stencilStoreOp = VK_ATTACHMENT_STORE_OP_DONT_CARE; - graphics->attachments[idx].initialLayout = VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL; - graphics->attachments[idx].finalLayout = VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL; - - graphics->attachment_references[idx].attachment = idx; - graphics->attachment_references[idx].layout = VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL; - - blend_attachment_from_d3d12(&graphics->blend_attachments[i], &desc->BlendState.RenderTarget[blend_idx]); - } - graphics->attachment_count = graphics->rt_idx + rt_count; - sub_pass_desc.flags = 0; sub_pass_desc.pipelineBindPoint = VK_PIPELINE_BIND_POINT_GRAPHICS; sub_pass_desc.inputAttachmentCount = 0;
Signed-off-by: Henri Verbeet hverbeet@codeweavers.com
From: Józef Kucia jkucia@codeweavers.com
Signed-off-by: Józef Kucia jkucia@codeweavers.com --- libs/vkd3d-shader/dxbc.c | 4 ++-- libs/vkd3d-shader/spirv.c | 8 ++++---- libs/vkd3d-shader/vkd3d_shader_private.h | 17 +++++++++++++---- 3 files changed, 19 insertions(+), 10 deletions(-)
diff --git a/libs/vkd3d-shader/dxbc.c b/libs/vkd3d-shader/dxbc.c index 5f87eae55f7d..87b2d718ce78 100644 --- a/libs/vkd3d-shader/dxbc.c +++ b/libs/vkd3d-shader/dxbc.c @@ -1521,7 +1521,7 @@ static BOOL shader_sm4_read_src_param(struct vkd3d_sm4_data *priv, const DWORD *
if (src_param->reg.type == VKD3DSPR_IMMCONST) { - src_param->swizzle = VKD3DSP_NOSWIZZLE; + src_param->swizzle = VKD3D_NO_SWIZZLE; } else { @@ -1531,7 +1531,7 @@ static BOOL shader_sm4_read_src_param(struct vkd3d_sm4_data *priv, const DWORD * switch (swizzle_type) { case VKD3D_SM4_SWIZZLE_NONE: - src_param->swizzle = VKD3DSP_NOSWIZZLE; + src_param->swizzle = VKD3D_NO_SWIZZLE; break;
case VKD3D_SM4_SWIZZLE_SCALAR: diff --git a/libs/vkd3d-shader/spirv.c b/libs/vkd3d-shader/spirv.c index f646d540297f..53ddd44596cd 100644 --- a/libs/vkd3d-shader/spirv.c +++ b/libs/vkd3d-shader/spirv.c @@ -2349,7 +2349,7 @@ static uint32_t vkd3d_dxbc_compiler_emit_swizzle(struct vkd3d_dxbc_compiler *com unsigned int i, component_idx, component_count; uint32_t type_id, components[VKD3D_VEC4_SIZE];
- if (swizzle == VKD3DSP_NOSWIZZLE && write_mask == VKD3DSP_WRITEMASK_ALL) + if (swizzle == VKD3D_NO_SWIZZLE && write_mask == VKD3DSP_WRITEMASK_ALL) return val_id;
component_count = vkd3d_write_mask_component_count(write_mask); @@ -2972,7 +2972,7 @@ static uint32_t vkd3d_dxbc_compiler_emit_input(struct vkd3d_dxbc_compiler *compi
if (val_id && input_component_count != component_count) val_id = vkd3d_dxbc_compiler_emit_swizzle(compiler, - val_id, VKD3D_TYPE_FLOAT, VKD3DSP_NOSWIZZLE, dst->write_mask); + val_id, VKD3D_TYPE_FLOAT, VKD3D_NO_SWIZZLE, dst->write_mask);
vkd3d_symbol_make_register(®_symbol, reg);
@@ -4601,7 +4601,7 @@ static void vkd3d_dxbc_compiler_emit_control_flow_instruction(struct vkd3d_dxbc_ assert(compiler->control_flow_depth); assert(cf_info->current_block == VKD3D_BLOCK_SWITCH);
- assert(src->swizzle == VKD3DSP_NOSWIZZLE && src->reg.type == VKD3DSPR_IMMCONST); + assert(src->swizzle == VKD3D_NO_SWIZZLE && src->reg.type == VKD3DSPR_IMMCONST); value = *src->reg.u.immconst_data;
if (!vkd3d_array_reserve((void **)&cf_info->u.switch_.case_blocks, &cf_info->u.switch_.case_blocks_size, @@ -5946,7 +5946,7 @@ static void vkd3d_dxbc_compiler_emit_output_setup_function(struct vkd3d_dxbc_com
write_mask = signature->elements[i].mask & 0xff; val_id = vkd3d_dxbc_compiler_emit_swizzle(compiler, - param_id[variable_idx], VKD3D_TYPE_FLOAT, VKD3DSP_NOSWIZZLE, write_mask); + param_id[variable_idx], VKD3D_TYPE_FLOAT, VKD3D_NO_SWIZZLE, write_mask);
if (compiler->output_info[i].component_type != VKD3D_TYPE_FLOAT) { diff --git a/libs/vkd3d-shader/vkd3d_shader_private.h b/libs/vkd3d-shader/vkd3d_shader_private.h index 09c2e1dc4381..45af2db438c3 100644 --- a/libs/vkd3d-shader/vkd3d_shader_private.h +++ b/libs/vkd3d-shader/vkd3d_shader_private.h @@ -390,8 +390,6 @@ enum vkd3d_immconst_type VKD3D_IMMCONST_VEC4, };
-#define VKD3DSP_NOSWIZZLE (0u | (1u << 2) | (2u << 4) | (3u << 6)) - enum vkd3d_shader_src_modifier { VKD3DSPSM_NONE = 0, @@ -852,11 +850,22 @@ static inline unsigned int vkd3d_write_mask_component_count(DWORD write_mask) return count; }
+/* swizzle bits fields: wwzzyyxx */ +#define VKD3D_SWIZZLE_X (0u) +#define VKD3D_SWIZZLE_Y (1u) +#define VKD3D_SWIZZLE_Z (2u) +#define VKD3D_SWIZZLE_W (3u) +#define VKD3D_SWIZZLE_MASK (0x3u) +#define VKD3D_SWIZZLE_SHIFT(idx) (2u * (idx)) +#define VKD3D_NO_SWIZZLE ((VKD3D_SWIZZLE_X << VKD3D_SWIZZLE_SHIFT(0)) \ + | (VKD3D_SWIZZLE_Y << VKD3D_SWIZZLE_SHIFT(1)) \ + | (VKD3D_SWIZZLE_Z << VKD3D_SWIZZLE_SHIFT(2)) \ + | (VKD3D_SWIZZLE_W << VKD3D_SWIZZLE_SHIFT(3))) + static inline unsigned int vkd3d_swizzle_get_component(DWORD swizzle, unsigned int idx) { - /* swizzle bits fields: wwzzyyxx */ - return (swizzle >> (2 * idx)) & 0x3; + return (swizzle >> VKD3D_SWIZZLE_SHIFT(idx)) & VKD3D_SWIZZLE_MASK; }
#define VKD3D_DXBC_MAX_SOURCE_COUNT 6
Signed-off-by: Henri Verbeet hverbeet@codeweavers.com
From: Józef Kucia jkucia@codeweavers.com
Signed-off-by: Józef Kucia jkucia@codeweavers.com --- include/private/vkd3d_shader.h | 23 ++++++++++++++++++++++- libs/vkd3d-shader/spirv.c | 25 ++++++++++++++++++++++--- libs/vkd3d-shader/vkd3d_shader_main.c | 9 +++++---- libs/vkd3d-shader/vkd3d_shader_private.h | 13 +------------ libs/vkd3d/state.c | 2 +- programs/vkd3d-compiler/main.c | 2 +- 6 files changed, 52 insertions(+), 22 deletions(-)
diff --git a/include/private/vkd3d_shader.h b/include/private/vkd3d_shader.h index ed2fc8908263..1f8fa39765df 100644 --- a/include/private/vkd3d_shader.h +++ b/include/private/vkd3d_shader.h @@ -125,9 +125,16 @@ struct vkd3d_shader_interface unsigned int uav_counter_count; };
+struct vkd3d_shader_compile_arguments +{ + unsigned int *output_swizzles; + unsigned int output_swizzle_count; +}; + int vkd3d_shader_compile_dxbc(const struct vkd3d_shader_code *dxbc, struct vkd3d_shader_code *spirv, uint32_t compiler_options, - const struct vkd3d_shader_interface *shader_interface); + const struct vkd3d_shader_interface *shader_interface, + const struct vkd3d_shader_compile_arguments *compile_args); void vkd3d_shader_free_shader_code(struct vkd3d_shader_code *code);
enum vkd3d_filter @@ -390,6 +397,20 @@ struct vkd3d_shader_signature_element *vkd3d_shader_find_signature_element( unsigned int semantic_index, unsigned int stream_index); void vkd3d_shader_free_shader_signature(struct vkd3d_shader_signature *signature);
+/* swizzle bits fields: wwzzyyxx */ +#define VKD3D_SWIZZLE_X (0u) +#define VKD3D_SWIZZLE_Y (1u) +#define VKD3D_SWIZZLE_Z (2u) +#define VKD3D_SWIZZLE_W (3u) +#define VKD3D_SWIZZLE_MASK (0x3u) +#define VKD3D_SWIZZLE_SHIFT(idx) (2u * (idx)) +#define VKD3D_SWIZZLE(x, y, z, w) (((x & VKD3D_SWIZZLE_MASK) << VKD3D_SWIZZLE_SHIFT(0)) \ + | ((y & VKD3D_SWIZZLE_MASK) << VKD3D_SWIZZLE_SHIFT(1)) \ + | ((z & VKD3D_SWIZZLE_MASK) << VKD3D_SWIZZLE_SHIFT(2)) \ + | ((w & VKD3D_SWIZZLE_MASK) << VKD3D_SWIZZLE_SHIFT(3))) +#define VKD3D_NO_SWIZZLE \ + VKD3D_SWIZZLE(VKD3D_SWIZZLE_X, VKD3D_SWIZZLE_Y, VKD3D_SWIZZLE_Z, VKD3D_SWIZZLE_W) + #ifdef __cplusplus } #endif /* __cplusplus */ diff --git a/libs/vkd3d-shader/spirv.c b/libs/vkd3d-shader/spirv.c index 53ddd44596cd..4b2b46c3b092 100644 --- a/libs/vkd3d-shader/spirv.c +++ b/libs/vkd3d-shader/spirv.c @@ -1839,6 +1839,7 @@ struct vkd3d_dxbc_compiler
struct vkd3d_shader_interface shader_interface; struct vkd3d_push_constant_buffer_binding *push_constants; + const struct vkd3d_shader_compile_arguments *compile_args;
bool after_declarations_section; const struct vkd3d_shader_signature *input_signature; @@ -1860,6 +1861,7 @@ struct vkd3d_dxbc_compiler struct vkd3d_dxbc_compiler *vkd3d_dxbc_compiler_create(const struct vkd3d_shader_version *shader_version, const struct vkd3d_shader_desc *shader_desc, uint32_t compiler_options, const struct vkd3d_shader_interface *shader_interface, + const struct vkd3d_shader_compile_arguments *compile_args, const struct vkd3d_shader_scan_info *scan_info) { const struct vkd3d_shader_signature *output_signature = &shader_desc->output_signature; @@ -1926,6 +1928,7 @@ struct vkd3d_dxbc_compiler *vkd3d_dxbc_compiler_create(const struct vkd3d_shader compiler->push_constants[i].pc = shader_interface->push_constant_buffers[i]; } } + compiler->compile_args = compile_args;
compiler->scan_info = scan_info;
@@ -3013,6 +3016,18 @@ static unsigned int vkd3d_dxbc_compiler_get_output_variable_index( return register_idx; }
+static unsigned int get_shader_output_swizzle(struct vkd3d_dxbc_compiler *compiler, + unsigned int register_idx) +{ + const struct vkd3d_shader_compile_arguments *compile_args; + + if (!(compile_args = compiler->compile_args)) + return VKD3D_NO_SWIZZLE; + if (register_idx >= compile_args->output_swizzle_count) + return VKD3D_NO_SWIZZLE; + return compile_args->output_swizzles[register_idx]; +} + static uint32_t vkd3d_dxbc_compiler_emit_output(struct vkd3d_dxbc_compiler *compiler, const struct vkd3d_shader_dst_param *dst, enum vkd3d_shader_input_sysval_semantic sysval) { @@ -3069,7 +3084,10 @@ static uint32_t vkd3d_dxbc_compiler_emit_output(struct vkd3d_dxbc_compiler *comp compiler->output_info[signature_idx].component_type = component_type; }
- if ((use_private_variable = component_type != VKD3D_TYPE_FLOAT || component_count != VKD3D_VEC4_SIZE)) + use_private_variable = component_type != VKD3D_TYPE_FLOAT || component_count != VKD3D_VEC4_SIZE + || (signature_element + && get_shader_output_swizzle(compiler, signature_element->register_index) != VKD3D_NO_SWIZZLE); + if (use_private_variable) storage_class = SpvStorageClassPrivate;
vkd3d_symbol_make_register(®_symbol, reg); @@ -5900,7 +5918,7 @@ static void vkd3d_dxbc_compiler_emit_output_setup_function(struct vkd3d_dxbc_com uint32_t param_type_id[MAX_REG_OUTPUT + 1], param_id[MAX_REG_OUTPUT + 1] = {}; const struct vkd3d_shader_signature *signature = compiler->output_signature; struct vkd3d_spirv_builder *builder = &compiler->spirv_builder; - DWORD write_mask, variable_idx; + DWORD write_mask, swizzle, variable_idx; unsigned int i, count;
function_id = compiler->output_setup_function_id; @@ -5945,8 +5963,9 @@ static void vkd3d_dxbc_compiler_emit_output_setup_function(struct vkd3d_dxbc_com continue;
write_mask = signature->elements[i].mask & 0xff; + swizzle = get_shader_output_swizzle(compiler, signature->elements[i].register_index); val_id = vkd3d_dxbc_compiler_emit_swizzle(compiler, - param_id[variable_idx], VKD3D_TYPE_FLOAT, VKD3D_NO_SWIZZLE, write_mask); + param_id[variable_idx], VKD3D_TYPE_FLOAT, swizzle, write_mask);
if (compiler->output_info[i].component_type != VKD3D_TYPE_FLOAT) { diff --git a/libs/vkd3d-shader/vkd3d_shader_main.c b/libs/vkd3d-shader/vkd3d_shader_main.c index 9db8b56946f2..1de56ac935a2 100644 --- a/libs/vkd3d-shader/vkd3d_shader_main.c +++ b/libs/vkd3d-shader/vkd3d_shader_main.c @@ -58,7 +58,8 @@ static void vkd3d_shader_parser_destroy(struct vkd3d_shader_parser *parser)
int vkd3d_shader_compile_dxbc(const struct vkd3d_shader_code *dxbc, struct vkd3d_shader_code *spirv, uint32_t compiler_options, - const struct vkd3d_shader_interface *shader_interface) + const struct vkd3d_shader_interface *shader_interface, + const struct vkd3d_shader_compile_arguments *compile_args) { struct vkd3d_shader_instruction instruction; struct vkd3d_dxbc_compiler *spirv_compiler; @@ -66,8 +67,8 @@ int vkd3d_shader_compile_dxbc(const struct vkd3d_shader_code *dxbc, struct vkd3d_shader_parser parser; int ret;
- TRACE("dxbc {%p, %zu}, spirv %p, compiler_options %#x, shader_interface %p.\n", - dxbc->code, dxbc->size, spirv, compiler_options, shader_interface); + TRACE("dxbc {%p, %zu}, spirv %p, compiler_options %#x, shader_interface %p, compile_args %p.\n", + dxbc->code, dxbc->size, spirv, compiler_options, shader_interface, compile_args);
if ((ret = vkd3d_shader_scan_dxbc(dxbc, &scan_info)) < 0) return ret; @@ -76,7 +77,7 @@ int vkd3d_shader_compile_dxbc(const struct vkd3d_shader_code *dxbc, return ret;
if (!(spirv_compiler = vkd3d_dxbc_compiler_create(&parser.shader_version, - &parser.shader_desc, compiler_options, shader_interface, &scan_info))) + &parser.shader_desc, compiler_options, shader_interface, compile_args, &scan_info))) { ERR("Failed to create DXBC compiler.\n"); vkd3d_shader_parser_destroy(&parser); diff --git a/libs/vkd3d-shader/vkd3d_shader_private.h b/libs/vkd3d-shader/vkd3d_shader_private.h index 45af2db438c3..4aeeb50e8817 100644 --- a/libs/vkd3d-shader/vkd3d_shader_private.h +++ b/libs/vkd3d-shader/vkd3d_shader_private.h @@ -780,6 +780,7 @@ struct vkd3d_dxbc_compiler; struct vkd3d_dxbc_compiler *vkd3d_dxbc_compiler_create(const struct vkd3d_shader_version *shader_version, const struct vkd3d_shader_desc *shader_desc, uint32_t compiler_options, const struct vkd3d_shader_interface *shader_interface, + const struct vkd3d_shader_compile_arguments *compile_args, const struct vkd3d_shader_scan_info *scan_info) DECLSPEC_HIDDEN; void vkd3d_dxbc_compiler_handle_instruction(struct vkd3d_dxbc_compiler *compiler, const struct vkd3d_shader_instruction *instruction) DECLSPEC_HIDDEN; @@ -850,18 +851,6 @@ static inline unsigned int vkd3d_write_mask_component_count(DWORD write_mask) return count; }
-/* swizzle bits fields: wwzzyyxx */ -#define VKD3D_SWIZZLE_X (0u) -#define VKD3D_SWIZZLE_Y (1u) -#define VKD3D_SWIZZLE_Z (2u) -#define VKD3D_SWIZZLE_W (3u) -#define VKD3D_SWIZZLE_MASK (0x3u) -#define VKD3D_SWIZZLE_SHIFT(idx) (2u * (idx)) -#define VKD3D_NO_SWIZZLE ((VKD3D_SWIZZLE_X << VKD3D_SWIZZLE_SHIFT(0)) \ - | (VKD3D_SWIZZLE_Y << VKD3D_SWIZZLE_SHIFT(1)) \ - | (VKD3D_SWIZZLE_Z << VKD3D_SWIZZLE_SHIFT(2)) \ - | (VKD3D_SWIZZLE_W << VKD3D_SWIZZLE_SHIFT(3))) - static inline unsigned int vkd3d_swizzle_get_component(DWORD swizzle, unsigned int idx) { diff --git a/libs/vkd3d/state.c b/libs/vkd3d/state.c index 4841b0de92b8..826d68f6f63c 100644 --- a/libs/vkd3d/state.c +++ b/libs/vkd3d/state.c @@ -1284,7 +1284,7 @@ static HRESULT create_shader_stage(struct d3d12_device *device, shader_desc.flags = 0;
dump_shader_stage(stage, code->pShaderBytecode, code->BytecodeLength); - if ((ret = vkd3d_shader_compile_dxbc(&dxbc, &spirv, 0, shader_interface)) < 0) + if ((ret = vkd3d_shader_compile_dxbc(&dxbc, &spirv, 0, shader_interface, NULL)) < 0) { WARN("Failed to compile shader, vkd3d result %d.\n", ret); return hresult_from_vkd3d_result(ret); diff --git a/programs/vkd3d-compiler/main.c b/programs/vkd3d-compiler/main.c index 2e6566882a66..83ccd3d65a4a 100644 --- a/programs/vkd3d-compiler/main.c +++ b/programs/vkd3d-compiler/main.c @@ -163,7 +163,7 @@ int main(int argc, char **argv) return 1; }
- hr = vkd3d_shader_compile_dxbc(&dxbc, &spirv, options.compiler_options, NULL); + hr = vkd3d_shader_compile_dxbc(&dxbc, &spirv, options.compiler_options, NULL, NULL); vkd3d_shader_free_shader_code(&dxbc); if (FAILED(hr)) {
Signed-off-by: Henri Verbeet hverbeet@codeweavers.com
From: Józef Kucia jkucia@codeweavers.com
In Direct3D alpha is taken from the .r component.
Signed-off-by: Józef Kucia jkucia@codeweavers.com --- libs/vkd3d/state.c | 30 ++++++++++++++++++++++++++---- tests/d3d12.c | 2 +- 2 files changed, 27 insertions(+), 5 deletions(-)
diff --git a/libs/vkd3d/state.c b/libs/vkd3d/state.c index 826d68f6f63c..9129d1214d46 100644 --- a/libs/vkd3d/state.c +++ b/libs/vkd3d/state.c @@ -1263,7 +1263,8 @@ static void dump_shader_stage(VkShaderStageFlagBits stage, const void *data, siz
static HRESULT create_shader_stage(struct d3d12_device *device, struct VkPipelineShaderStageCreateInfo *stage_desc, enum VkShaderStageFlagBits stage, - const D3D12_SHADER_BYTECODE *code, const struct vkd3d_shader_interface *shader_interface) + const D3D12_SHADER_BYTECODE *code, const struct vkd3d_shader_interface *shader_interface, + const struct vkd3d_shader_compile_arguments *compile_args) { struct vkd3d_shader_code dxbc = {code->pShaderBytecode, code->BytecodeLength}; const struct vkd3d_vk_device_procs *vk_procs = &device->vk_procs; @@ -1284,7 +1285,7 @@ static HRESULT create_shader_stage(struct d3d12_device *device, shader_desc.flags = 0;
dump_shader_stage(stage, code->pShaderBytecode, code->BytecodeLength); - if ((ret = vkd3d_shader_compile_dxbc(&dxbc, &spirv, 0, shader_interface, NULL)) < 0) + if ((ret = vkd3d_shader_compile_dxbc(&dxbc, &spirv, 0, shader_interface, compile_args)) < 0) { WARN("Failed to compile shader, vkd3d result %d.\n", ret); return hresult_from_vkd3d_result(ret); @@ -1436,7 +1437,7 @@ static HRESULT d3d12_pipeline_state_init_compute(struct d3d12_pipeline_state *st pipeline_info.pNext = NULL; pipeline_info.flags = 0; if (FAILED(hr = create_shader_stage(device, &pipeline_info.stage, - VK_SHADER_STAGE_COMPUTE_BIT, &desc->CS, &shader_interface))) + VK_SHADER_STAGE_COMPUTE_BIT, &desc->CS, &shader_interface, NULL))) { if (state->vk_set_layout) VK_CALL(vkDestroyDescriptorSetLayout(device->vk_device, state->vk_set_layout, NULL)); @@ -1789,12 +1790,23 @@ static HRESULT compute_input_layout_offsets(const D3D12_INPUT_LAYOUT_DESC *input return S_OK; }
+static unsigned int vkd3d_get_rt_format_swizzle(const struct vkd3d_format *format) +{ + if (format->dxgi_format == DXGI_FORMAT_A8_UNORM) + return VKD3D_SWIZZLE(VKD3D_SWIZZLE_W, VKD3D_SWIZZLE_X, VKD3D_SWIZZLE_Y, VKD3D_SWIZZLE_Z); + + return VKD3D_NO_SWIZZLE; +} + static HRESULT d3d12_pipeline_state_init_graphics(struct d3d12_pipeline_state *state, struct d3d12_device *device, const D3D12_GRAPHICS_PIPELINE_STATE_DESC *desc) { + unsigned int ps_output_swizzle[D3D12_SIMULTANEOUS_RENDER_TARGET_COUNT]; struct d3d12_graphics_pipeline_state *graphics = &state->u.graphics; const struct vkd3d_vk_device_procs *vk_procs = &device->vk_procs; + const struct vkd3d_shader_compile_arguments *compile_args; uint32_t aligned_offsets[D3D12_VS_INPUT_REGISTER_COUNT]; + struct vkd3d_shader_compile_arguments ps_compile_args; const struct d3d12_root_signature *root_signature; struct vkd3d_shader_interface shader_interface; struct vkd3d_shader_signature input_signature; @@ -1907,6 +1919,8 @@ static HRESULT d3d12_pipeline_state_init_graphics(struct d3d12_pipeline_state *s goto fail; }
+ ps_output_swizzle[i] = vkd3d_get_rt_format_swizzle(format); + graphics->attachments[idx].flags = 0; graphics->attachments[idx].format = format->vk_format; graphics->attachments[idx].samples = VK_SAMPLE_COUNT_1_BIT; @@ -1924,6 +1938,9 @@ static HRESULT d3d12_pipeline_state_init_graphics(struct d3d12_pipeline_state *s } graphics->attachment_count = graphics->rt_idx + rt_count;
+ ps_compile_args.output_swizzles = ps_output_swizzle; + ps_compile_args.output_swizzle_count = rt_count; + shader_interface.bindings = root_signature->descriptor_mapping; shader_interface.binding_count = root_signature->descriptor_count; shader_interface.push_constant_buffers = root_signature->root_constants; @@ -1952,8 +1969,13 @@ static HRESULT d3d12_pipeline_state_init_graphics(struct d3d12_pipeline_state *s if (shader_info.uav_counter_mask) FIXME("UAV counters not implemented for graphics pipelines.\n");
+ if (shader_stages[i].stage == VK_SHADER_STAGE_FRAGMENT_BIT) + compile_args = &ps_compile_args; + else + compile_args = NULL; + if (FAILED(hr = create_shader_stage(device, &graphics->stages[graphics->stage_count], - shader_stages[i].stage, b, &shader_interface))) + shader_stages[i].stage, b, &shader_interface, compile_args))) goto fail;
if (shader_stages[i].stage == VK_SHADER_STAGE_VERTEX_BIT diff --git a/tests/d3d12.c b/tests/d3d12.c index c7303f8d7ab9..0e35fc866bbc 100644 --- a/tests/d3d12.c +++ b/tests/d3d12.c @@ -694,7 +694,7 @@ static void check_readback_data_uint8_(unsigned int line, struct resource_readba if (!all_match) break; } - todo_(line)(all_match, "Got 0x%02x, expected 0x%02x at (%u, %u).\n", got, expected, x, y); + ok_(line)(all_match, "Got 0x%02x, expected 0x%02x at (%u, %u).\n", got, expected, x, y); }
#define check_sub_resource_uint8(a, b, c, d, e, f) check_sub_resource_uint8_(__LINE__, a, b, c, d, e, f)
Signed-off-by: Henri Verbeet hverbeet@codeweavers.com
From: Józef Kucia jkucia@codeweavers.com
Signed-off-by: Józef Kucia jkucia@codeweavers.com --- include/private/vkd3d_shader.h | 2 +- libs/vkd3d-shader/spirv.c | 26 +++++++++++++------------- libs/vkd3d/state.c | 4 ++-- 3 files changed, 16 insertions(+), 16 deletions(-)
diff --git a/include/private/vkd3d_shader.h b/include/private/vkd3d_shader.h index 1f8fa39765df..61789d63e246 100644 --- a/include/private/vkd3d_shader.h +++ b/include/private/vkd3d_shader.h @@ -119,7 +119,7 @@ struct vkd3d_shader_interface * * In Vulkan OpImageFetch must be used with a sampled image. */ - struct vkd3d_shader_descriptor_binding default_sampler; + struct vkd3d_shader_descriptor_binding dummy_sampler;
const struct vkd3d_shader_uav_counter_binding *uav_counters; unsigned int uav_counter_count; diff --git a/libs/vkd3d-shader/spirv.c b/libs/vkd3d-shader/spirv.c index 4b2b46c3b092..f4c942133db5 100644 --- a/libs/vkd3d-shader/spirv.c +++ b/libs/vkd3d-shader/spirv.c @@ -1851,7 +1851,7 @@ struct vkd3d_dxbc_compiler } *output_info; uint32_t private_output_variable[MAX_REG_OUTPUT + 1]; /* 1 entry for oDepth */ uint32_t output_setup_function_id; - uint32_t default_sampler_id; + uint32_t dummy_sampler_id;
uint32_t binding_idx;
@@ -3340,15 +3340,15 @@ static void vkd3d_dxbc_compiler_emit_dcl_sampler(struct vkd3d_dxbc_compiler *com vkd3d_dxbc_compiler_put_symbol(compiler, ®_symbol); }
-static uint32_t vkd3d_dxbc_compiler_get_default_sampler_id(struct vkd3d_dxbc_compiler *compiler) +static uint32_t vkd3d_dxbc_compiler_get_dummy_sampler_id(struct vkd3d_dxbc_compiler *compiler) { const struct vkd3d_shader_interface *shader_interface = &compiler->shader_interface; const SpvStorageClass storage_class = SpvStorageClassUniformConstant; struct vkd3d_spirv_builder *builder = &compiler->spirv_builder; uint32_t type_id, ptr_type_id, var_id;
- if (compiler->default_sampler_id) - return compiler->default_sampler_id; + if (compiler->dummy_sampler_id) + return compiler->dummy_sampler_id;
type_id = vkd3d_spirv_get_op_type_sampler(builder); ptr_type_id = vkd3d_spirv_get_op_type_pointer(builder, storage_class, type_id); @@ -3356,14 +3356,14 @@ static uint32_t vkd3d_dxbc_compiler_get_default_sampler_id(struct vkd3d_dxbc_com ptr_type_id, storage_class, 0);
vkd3d_spirv_build_op_decorate1(builder, var_id, - SpvDecorationDescriptorSet, shader_interface->default_sampler.set); + SpvDecorationDescriptorSet, shader_interface->dummy_sampler.set); vkd3d_spirv_build_op_decorate1(builder, var_id, - SpvDecorationBinding, shader_interface->default_sampler.binding); + SpvDecorationBinding, shader_interface->dummy_sampler.binding);
- vkd3d_spirv_build_op_name(builder, var_id, "default_sampler"); + vkd3d_spirv_build_op_name(builder, var_id, "dummy_sampler");
- compiler->default_sampler_id = var_id; - return compiler->default_sampler_id; + compiler->dummy_sampler_id = var_id; + return compiler->dummy_sampler_id; }
static const struct vkd3d_spirv_resource_type *vkd3d_dxbc_compiler_enable_resource_type( @@ -4781,11 +4781,11 @@ static void vkd3d_dxbc_compiler_prepare_sampled_image_for_sampler(struct vkd3d_d sampled_image_type_id, image->image_id, image->sampler_id); }
-static void vkd3d_dxbc_compiler_prepare_default_sampled_image(struct vkd3d_dxbc_compiler *compiler, +static void vkd3d_dxbc_compiler_prepare_dummy_sampled_image(struct vkd3d_dxbc_compiler *compiler, struct vkd3d_shader_image *image, const struct vkd3d_shader_register *resource_reg) { vkd3d_dxbc_compiler_prepare_sampled_image_for_sampler(compiler, image, resource_reg, - vkd3d_dxbc_compiler_get_default_sampler_id(compiler), false); + vkd3d_dxbc_compiler_get_dummy_sampler_id(compiler), false); }
static void vkd3d_dxbc_compiler_prepare_sampled_image(struct vkd3d_dxbc_compiler *compiler, @@ -4813,7 +4813,7 @@ static void vkd3d_dxbc_compiler_emit_ld(struct vkd3d_dxbc_compiler *compiler, FIXME("Texel offset not supported.\n");
/* OpImageFetch must be used with a sampled image. */ - vkd3d_dxbc_compiler_prepare_default_sampled_image(compiler, &image, &src[1].reg); + vkd3d_dxbc_compiler_prepare_dummy_sampled_image(compiler, &image, &src[1].reg); image_id = vkd3d_spirv_build_op_image(builder, image.image_type_id, image.sampled_image_id);
type_id = vkd3d_spirv_get_type_id(builder, image.sampled_type, VKD3D_VEC4_SIZE); @@ -5023,7 +5023,7 @@ static void vkd3d_dxbc_compiler_emit_ld_raw_structured_srv_uav(struct vkd3d_dxbc { /* OpImageFetch must be used with a sampled image. */ op = SpvOpImageFetch; - vkd3d_dxbc_compiler_prepare_default_sampled_image(compiler, &image, &resource->reg); + vkd3d_dxbc_compiler_prepare_dummy_sampled_image(compiler, &image, &resource->reg); image_id = vkd3d_spirv_build_op_image(builder, image.image_type_id, image.sampled_image_id); } else diff --git a/libs/vkd3d/state.c b/libs/vkd3d/state.c index 9129d1214d46..2e01263a04a6 100644 --- a/libs/vkd3d/state.c +++ b/libs/vkd3d/state.c @@ -1429,7 +1429,7 @@ static HRESULT d3d12_pipeline_state_init_compute(struct d3d12_pipeline_state *st shader_interface.binding_count = root_signature->descriptor_count; shader_interface.push_constant_buffers = root_signature->root_constants; shader_interface.push_constant_buffer_count = root_signature->root_constant_count; - shader_interface.default_sampler = root_signature->default_sampler; + shader_interface.dummy_sampler = root_signature->default_sampler; shader_interface.uav_counters = state->uav_counters; shader_interface.uav_counter_count = vkd3d_popcount(state->uav_counter_mask);
@@ -1945,7 +1945,7 @@ static HRESULT d3d12_pipeline_state_init_graphics(struct d3d12_pipeline_state *s shader_interface.binding_count = root_signature->descriptor_count; shader_interface.push_constant_buffers = root_signature->root_constants; shader_interface.push_constant_buffer_count = root_signature->root_constant_count; - shader_interface.default_sampler = root_signature->default_sampler; + shader_interface.dummy_sampler = root_signature->default_sampler; shader_interface.uav_counters = NULL; shader_interface.uav_counter_count = 0;
Signed-off-by: Henri Verbeet hverbeet@codeweavers.com
From: Józef Kucia jkucia@codeweavers.com
Signed-off-by: Józef Kucia jkucia@codeweavers.com --- libs/vkd3d/device.c | 12 ++++++------ libs/vkd3d/state.c | 22 +++++++++++----------- libs/vkd3d/vkd3d_private.h | 4 ++-- 3 files changed, 19 insertions(+), 19 deletions(-)
diff --git a/libs/vkd3d/device.c b/libs/vkd3d/device.c index 48ad7c506c34..e4c4d5211d61 100644 --- a/libs/vkd3d/device.c +++ b/libs/vkd3d/device.c @@ -1075,7 +1075,7 @@ static HRESULT vkd3d_create_vk_device(struct d3d12_device *device, return S_OK; }
-static HRESULT d3d12_device_create_default_sampler(struct d3d12_device *device) +static HRESULT d3d12_device_create_dummy_sampler(struct d3d12_device *device) { D3D12_STATIC_SAMPLER_DESC sampler_desc;
@@ -1084,7 +1084,7 @@ static HRESULT d3d12_device_create_default_sampler(struct d3d12_device *device) sampler_desc.AddressU = D3D12_TEXTURE_ADDRESS_MODE_CLAMP; sampler_desc.AddressV = D3D12_TEXTURE_ADDRESS_MODE_CLAMP; sampler_desc.AddressW = D3D12_TEXTURE_ADDRESS_MODE_CLAMP; - return vkd3d_create_static_sampler(device, &sampler_desc, &device->vk_default_sampler); + return vkd3d_create_static_sampler(device, &sampler_desc, &device->vk_dummy_sampler); }
static void d3d12_device_init_pipeline_cache(struct d3d12_device *device) @@ -1273,7 +1273,7 @@ static ULONG STDMETHODCALLTYPE d3d12_device_Release(ID3D12Device *iface)
vkd3d_gpu_va_allocator_cleanup(&device->gpu_va_allocator); vkd3d_fence_worker_stop(&device->fence_worker, device); - VK_CALL(vkDestroySampler(device->vk_device, device->vk_default_sampler, NULL)); + VK_CALL(vkDestroySampler(device->vk_device, device->vk_dummy_sampler, NULL)); if (device->vk_pipeline_cache) VK_CALL(vkDestroyPipelineCache(device->vk_device, device->vk_pipeline_cache, NULL)); d3d12_device_destroy_vkd3d_queues(device); @@ -2222,10 +2222,10 @@ static HRESULT d3d12_device_init(struct d3d12_device *device, return hr; }
- if (FAILED(hr = d3d12_device_create_default_sampler(device))) + if (FAILED(hr = d3d12_device_create_dummy_sampler(device))) { const struct vkd3d_vk_device_procs *vk_procs = &device->vk_procs; - ERR("Failed to create default sampler, hr %#x.\n", hr); + ERR("Failed to create dummy sampler, hr %#x.\n", hr); VK_CALL(vkDestroyDevice(device->vk_device, NULL)); vkd3d_instance_decref(device->vkd3d_instance); return hr; @@ -2234,7 +2234,7 @@ static HRESULT d3d12_device_init(struct d3d12_device *device, if (FAILED(hr = vkd3d_fence_worker_start(&device->fence_worker, device))) { const struct vkd3d_vk_device_procs *vk_procs = &device->vk_procs; - VK_CALL(vkDestroySampler(device->vk_device, device->vk_default_sampler, NULL)); + VK_CALL(vkDestroySampler(device->vk_device, device->vk_dummy_sampler, NULL)); VK_CALL(vkDestroyDevice(device->vk_device, NULL)); vkd3d_instance_decref(device->vkd3d_instance); return hr; diff --git a/libs/vkd3d/state.c b/libs/vkd3d/state.c index 2e01263a04a6..19e6549171e8 100644 --- a/libs/vkd3d/state.c +++ b/libs/vkd3d/state.c @@ -769,19 +769,19 @@ static HRESULT d3d12_root_signature_init_root_descriptors(struct d3d12_root_sign return S_OK; }
-static HRESULT d3d12_root_signature_init_default_sampler(struct d3d12_root_signature *root_signature, +static HRESULT d3d12_root_signature_init_dummy_sampler(struct d3d12_root_signature *root_signature, struct d3d12_device *device, struct vkd3d_descriptor_set_context *context) { VkDescriptorSetLayoutBinding *binding = context->current_binding;
- root_signature->default_sampler.set = context->set_index; - root_signature->default_sampler.binding = context->descriptor_binding++; + root_signature->dummy_sampler.set = context->set_index; + root_signature->dummy_sampler.binding = context->descriptor_binding++;
- binding->binding = root_signature->default_sampler.binding; + binding->binding = root_signature->dummy_sampler.binding; binding->descriptorType = VK_DESCRIPTOR_TYPE_SAMPLER; binding->descriptorCount = 1; binding->stageFlags = VK_SHADER_STAGE_ALL; - binding->pImmutableSamplers = &device->vk_default_sampler; + binding->pImmutableSamplers = &device->vk_dummy_sampler;
++context->current_binding; return S_OK; @@ -877,7 +877,7 @@ static HRESULT d3d12_root_signature_init(struct d3d12_root_signature *root_signa VkDescriptorSetLayoutBinding *binding_desc; struct d3d12_root_signature_info info; VkDescriptorSetLayout set_layouts[2]; - bool needs_default_sampler; + bool needs_dummy_sampler; HRESULT hr;
memset(&context, 0, sizeof(context)); @@ -917,8 +917,8 @@ static HRESULT d3d12_root_signature_init(struct d3d12_root_signature *root_signa root_signature->root_descriptor_count = info.root_descriptor_count;
/* An additional sampler is created for SpvOpImageFetch. */ - needs_default_sampler = info.srv_count || info.buffer_srv_count; - if (needs_default_sampler) + needs_dummy_sampler = info.srv_count || info.buffer_srv_count; + if (needs_dummy_sampler) { ++info.sampler_count; ++info.descriptor_count; @@ -970,7 +970,7 @@ static HRESULT d3d12_root_signature_init(struct d3d12_root_signature *root_signa goto fail; if (FAILED(hr = d3d12_root_signature_init_static_samplers(root_signature, device, desc, &context))) goto fail; - if (needs_default_sampler && FAILED(hr = d3d12_root_signature_init_default_sampler(root_signature, + if (needs_dummy_sampler && FAILED(hr = d3d12_root_signature_init_dummy_sampler(root_signature, device, &context))) goto fail;
@@ -1429,7 +1429,7 @@ static HRESULT d3d12_pipeline_state_init_compute(struct d3d12_pipeline_state *st shader_interface.binding_count = root_signature->descriptor_count; shader_interface.push_constant_buffers = root_signature->root_constants; shader_interface.push_constant_buffer_count = root_signature->root_constant_count; - shader_interface.dummy_sampler = root_signature->default_sampler; + shader_interface.dummy_sampler = root_signature->dummy_sampler; shader_interface.uav_counters = state->uav_counters; shader_interface.uav_counter_count = vkd3d_popcount(state->uav_counter_mask);
@@ -1945,7 +1945,7 @@ static HRESULT d3d12_pipeline_state_init_graphics(struct d3d12_pipeline_state *s shader_interface.binding_count = root_signature->descriptor_count; shader_interface.push_constant_buffers = root_signature->root_constants; shader_interface.push_constant_buffer_count = root_signature->root_constant_count; - shader_interface.dummy_sampler = root_signature->default_sampler; + shader_interface.dummy_sampler = root_signature->dummy_sampler; shader_interface.uav_counters = NULL; shader_interface.uav_counter_count = 0;
diff --git a/libs/vkd3d/vkd3d_private.h b/libs/vkd3d/vkd3d_private.h index 4a359dbf7632..7506471fbe6c 100644 --- a/libs/vkd3d/vkd3d_private.h +++ b/libs/vkd3d/vkd3d_private.h @@ -426,7 +426,7 @@ struct d3d12_root_signature
unsigned int descriptor_count; struct vkd3d_shader_resource_binding *descriptor_mapping; - struct vkd3d_shader_descriptor_binding default_sampler; + struct vkd3d_shader_descriptor_binding dummy_sampler;
unsigned int root_constant_count; struct vkd3d_shader_push_constant_buffer *root_constants; @@ -664,7 +664,7 @@ struct d3d12_device VkPipelineCache vk_pipeline_cache;
/* A sampler used for SpvOpImageFetch. */ - VkSampler vk_default_sampler; + VkSampler vk_dummy_sampler;
VkPhysicalDeviceMemoryProperties memory_properties;
Signed-off-by: Henri Verbeet hverbeet@codeweavers.com