Signed-off-by: Conor McCarthy cmccarthy@codeweavers.com --- libs/vkd3d-shader/dxbc.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-)
diff --git a/libs/vkd3d-shader/dxbc.c b/libs/vkd3d-shader/dxbc.c index 70ab70aa..181f7567 100644 --- a/libs/vkd3d-shader/dxbc.c +++ b/libs/vkd3d-shader/dxbc.c @@ -630,6 +630,16 @@ static unsigned int shader_sm4_map_resource_idx(struct vkd3d_shader_register *re 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_shader_register_range *range) +{ + shader_sm4_read_register_space(priv, ptr, end, &range->space); + range->first = reg->idx[shader_is_sm_5_1(priv) ? 1 : 0].offset; + range->last = reg->idx[shader_is_sm_5_1(priv) ? 2 : 0].offset; + if (range->last < range->first) + FIXME("Invalid register range [%u:%u].\n", range->first, range->last); +} + static void shader_sm4_read_dcl_resource(struct vkd3d_shader_instruction *ins, DWORD opcode, DWORD opcode_token, const DWORD *tokens, unsigned int token_count, struct vkd3d_sm4_data *priv) @@ -654,8 +664,6 @@ static void shader_sm4_read_dcl_resource(struct vkd3d_shader_instruction *ins, } reg_data_type = opcode == VKD3D_SM4_OP_DCL_RESOURCE ? VKD3D_DATA_RESOURCE : VKD3D_DATA_UAV; shader_sm4_read_dst_param(priv, &tokens, end, reg_data_type, &semantic->resource.reg); - semantic->resource.range.first = shader_sm4_map_resource_idx(&semantic->resource.reg.reg, priv); - semantic->resource.range.last = semantic->resource.range.first;
components = *tokens++; for (i = 0; i < VKD3D_VEC4_SIZE; i++) @@ -676,7 +684,8 @@ static void shader_sm4_read_dcl_resource(struct vkd3d_shader_instruction *ins, if (reg_data_type == VKD3D_DATA_UAV) ins->flags = (opcode_token & VKD3D_SM5_UAV_FLAGS_MASK) >> VKD3D_SM5_UAV_FLAGS_SHIFT;
- shader_sm4_read_register_space(priv, &tokens, end, &semantic->resource.range.space); + shader_sm4_read_descriptor_register_range(priv, &tokens, end, &semantic->resource.reg.reg, + &semantic->resource.range); }
static void shader_sm4_read_dcl_constant_buffer(struct vkd3d_shader_instruction *ins,