Signed-off-by: Conor McCarthy cmccarthy@codeweavers.com --- libs/vkd3d-shader/dxbc.c | 12 ++---------- libs/vkd3d-shader/spirv.c | 16 +++++++--------- libs/vkd3d-shader/trace.c | 2 +- libs/vkd3d-shader/vkd3d_shader_main.c | 4 ++-- libs/vkd3d-shader/vkd3d_shader_private.h | 2 +- 5 files changed, 13 insertions(+), 23 deletions(-)
diff --git a/libs/vkd3d-shader/dxbc.c b/libs/vkd3d-shader/dxbc.c index ef5cf6d4..fed00141 100644 --- a/libs/vkd3d-shader/dxbc.c +++ b/libs/vkd3d-shader/dxbc.c @@ -622,14 +622,6 @@ static void shader_sm4_read_shader_data(struct vkd3d_shader_instruction *ins, ins->declaration.icb = &priv->icb; }
-static unsigned int shader_sm4_map_resource_idx(struct vkd3d_shader_register *reg, const struct vkd3d_sm4_data *priv) -{ - if (shader_is_sm_5_1(priv)) - return reg->idx[1].offset; - else - return reg->idx[0].offset; -} - static void shader_sm4_read_descriptor_register_range(struct vkd3d_sm4_data *priv, const DWORD **ptr, const DWORD *end, struct vkd3d_shader_register *reg, struct vkd3d_descriptor_register_range *range) { @@ -726,8 +718,8 @@ static void shader_sm4_read_dcl_sampler(struct vkd3d_shader_instruction *ins, if (ins->flags & ~VKD3D_SM4_SAMPLER_COMPARISON) FIXME("Unhandled sampler mode %#x.\n", ins->flags); shader_sm4_read_src_param(priv, &tokens, end, VKD3D_DATA_SAMPLER, &ins->declaration.sampler.src); - ins->declaration.sampler.register_index = shader_sm4_map_resource_idx(&ins->declaration.sampler.src.reg, priv); - shader_sm4_read_register_space(priv, &tokens, end, &ins->declaration.sampler.register_space); + shader_sm4_read_descriptor_register_range(priv, &tokens, end, &ins->declaration.sampler.src.reg, + &ins->declaration.sampler.range); }
static void shader_sm4_read_dcl_index_range(struct vkd3d_shader_instruction *ins, diff --git a/libs/vkd3d-shader/spirv.c b/libs/vkd3d-shader/spirv.c index 97737043..01b245eb 100644 --- a/libs/vkd3d-shader/spirv.c +++ b/libs/vkd3d-shader/spirv.c @@ -1943,8 +1943,7 @@ struct vkd3d_symbol_resource_data
struct vkd3d_symbol_sampler_data { - unsigned int register_space; - unsigned int register_index; + struct vkd3d_descriptor_register_range range; };
struct vkd3d_symbol @@ -2442,8 +2441,8 @@ static bool vkd3d_dxbc_compiler_has_combined_sampler(const struct vkd3d_dxbc_com
if ((!resource || (combined_sampler->resource_space == resource->range.space && combined_sampler->resource_index == resource->range.first)) - && (!sampler || (combined_sampler->sampler_space == sampler->register_space - && combined_sampler->sampler_index == sampler->register_index))) + && (!sampler || (combined_sampler->sampler_space == sampler->range.space + && combined_sampler->sampler_index == sampler->range.first))) return true; }
@@ -5362,8 +5361,7 @@ static void vkd3d_dxbc_compiler_emit_dcl_sampler(struct vkd3d_dxbc_compiler *com struct vkd3d_symbol reg_symbol;
vkd3d_symbol_make_sampler(®_symbol, reg); - reg_symbol.info.sampler.register_space = sampler->register_space; - reg_symbol.info.sampler.register_index = sampler->register_index; + reg_symbol.info.sampler.range = sampler->range; vkd3d_dxbc_compiler_put_symbol(compiler, ®_symbol);
if (vkd3d_dxbc_compiler_has_combined_sampler(compiler, NULL, sampler)) @@ -5375,7 +5373,7 @@ static void vkd3d_dxbc_compiler_emit_dcl_sampler(struct vkd3d_dxbc_compiler *com ptr_type_id, storage_class, 0);
vkd3d_dxbc_compiler_emit_descriptor_binding_for_reg(compiler, var_id, reg, - sampler->register_space, sampler->register_index, VKD3D_SHADER_RESOURCE_NONE, false); + sampler->range.space, sampler->range.first, VKD3D_SHADER_RESOURCE_NONE, false);
vkd3d_dxbc_compiler_emit_register_debug_name(builder, var_id, reg);
@@ -7618,8 +7616,8 @@ static const struct vkd3d_symbol *vkd3d_dxbc_compiler_find_combined_sampler(stru if (!(entry = rb_get(&compiler->symbol_table, &key))) return NULL; sampler_symbol = RB_ENTRY_VALUE(entry, struct vkd3d_symbol, entry); - sampler_space = sampler_symbol->info.sampler.register_space; - sampler_index = sampler_symbol->info.sampler.register_index; + sampler_space = sampler_symbol->info.sampler.range.space; + sampler_index = sampler_symbol->info.sampler.range.first; } else { diff --git a/libs/vkd3d-shader/trace.c b/libs/vkd3d-shader/trace.c index a0cb1162..2d16714b 100644 --- a/libs/vkd3d-shader/trace.c +++ b/libs/vkd3d-shader/trace.c @@ -1546,7 +1546,7 @@ static void shader_dump_instruction(struct vkd3d_d3d_asm_compiler *compiler, shader_dump_register(compiler, &ins->declaration.sampler.src.reg); if (ins->flags == VKD3DSI_SAMPLER_COMPARISON_MODE) shader_addline(buffer, ", comparisonMode"); - shader_dump_register_space(compiler, ins->declaration.sampler.register_space); + shader_dump_register_space(compiler, ins->declaration.sampler.range.space); break;
case VKD3DSIH_DCL_TEMPS: diff --git a/libs/vkd3d-shader/vkd3d_shader_main.c b/libs/vkd3d-shader/vkd3d_shader_main.c index 5b5ea7ec..a8dc3bfa 100644 --- a/libs/vkd3d-shader/vkd3d_shader_main.c +++ b/libs/vkd3d-shader/vkd3d_shader_main.c @@ -649,8 +649,8 @@ static void vkd3d_shader_scan_sampler_declaration(struct vkd3d_shader_scan_conte flags = VKD3D_SHADER_DESCRIPTOR_INFO_FLAG_SAMPLER_COMPARISON_MODE; else flags = 0; - vkd3d_shader_scan_add_descriptor(context, VKD3D_SHADER_DESCRIPTOR_TYPE_SAMPLER, sampler->register_space, - sampler->register_index, VKD3D_SHADER_RESOURCE_NONE, VKD3D_SHADER_RESOURCE_DATA_UINT, flags); + vkd3d_shader_scan_add_descriptor(context, VKD3D_SHADER_DESCRIPTOR_TYPE_SAMPLER, sampler->range.space, + sampler->range.first, VKD3D_SHADER_RESOURCE_NONE, VKD3D_SHADER_RESOURCE_DATA_UINT, flags); }
static void vkd3d_shader_scan_resource_declaration(struct vkd3d_shader_scan_context *context, diff --git a/libs/vkd3d-shader/vkd3d_shader_private.h b/libs/vkd3d-shader/vkd3d_shader_private.h index 025e09b6..9ec8fa59 100644 --- a/libs/vkd3d-shader/vkd3d_shader_private.h +++ b/libs/vkd3d-shader/vkd3d_shader_private.h @@ -720,7 +720,7 @@ struct vkd3d_shader_register_semantic struct vkd3d_shader_sampler { struct vkd3d_shader_src_param src; - unsigned int register_space, register_index; + struct vkd3d_descriptor_register_range range; };
struct vkd3d_shader_constant_buffer