Signed-off-by: Zebediah Figura zfigura@codeweavers.com --- v4: also change shader_sm4_read_dcl_constant_buffer()...
libs/vkd3d-shader/dxbc.c | 10 +++++++++- libs/vkd3d-shader/spirv.c | 2 +- 2 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/libs/vkd3d-shader/dxbc.c b/libs/vkd3d-shader/dxbc.c index 5156074..de6aea3 100644 --- a/libs/vkd3d-shader/dxbc.c +++ b/libs/vkd3d-shader/dxbc.c @@ -646,7 +646,7 @@ static void shader_sm4_read_dcl_constant_buffer(struct vkd3d_shader_instruction if (opcode_token & VKD3D_SM4_INDEX_TYPE_MASK) ins->flags |= VKD3DSI_INDEXED_DYNAMIC;
- ins->declaration.cb.size = ins->declaration.cb.src.reg.idx[1].offset; + ins->declaration.cb.size = ins->declaration.cb.src.reg.idx[2].offset; ins->declaration.cb.register_space = 0;
if (shader_is_sm_5_1(priv)) @@ -1603,6 +1603,14 @@ static bool shader_sm4_read_param(struct vkd3d_sm4_data *priv, const DWORD **ptr break; } } + else if (register_type == VKD3D_SM4_RT_CONSTBUFFER && order == 2) + { + /* SM5.1 places the buffer offset in idx[2]; earlier versions place it + * in idx[1]. Normalize to SM5.1. */ + param->idx[2] = param->idx[1]; + param->idx[1].rel_addr = NULL; + param->idx[1].offset = 0; + }
map_register(priv, param);
diff --git a/libs/vkd3d-shader/spirv.c b/libs/vkd3d-shader/spirv.c index 0d4812b..a3cc5f9 100644 --- a/libs/vkd3d-shader/spirv.c +++ b/libs/vkd3d-shader/spirv.c @@ -2832,7 +2832,7 @@ static void vkd3d_dxbc_compiler_emit_dereference_register(struct vkd3d_dxbc_comp { assert(!reg->idx[0].rel_addr); indexes[index_count++] = vkd3d_dxbc_compiler_get_constant_uint(compiler, register_info->member_idx); - indexes[index_count++] = vkd3d_dxbc_compiler_emit_register_addressing(compiler, ®->idx[1]); + indexes[index_count++] = vkd3d_dxbc_compiler_emit_register_addressing(compiler, ®->idx[2]); } else if (reg->type == VKD3DSPR_IMMCONSTBUFFER) {