[PATCH vkd3d v3 2/8] vkd3d-shader: Read constant buffer offsets from the second index.
Zebediah Figura
zfigura at codeweavers.com
Wed May 27 10:05:37 CDT 2020
Signed-off-by: Zebediah Figura <zfigura at codeweavers.com>
---
v3: Emit 0 for idx[1], instead of copying idx[0].
libs/vkd3d-shader/dxbc.c | 8 ++++++++
libs/vkd3d-shader/spirv.c | 2 +-
2 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/libs/vkd3d-shader/dxbc.c b/libs/vkd3d-shader/dxbc.c
index 5156074..7f56019 100644
--- a/libs/vkd3d-shader/dxbc.c
+++ b/libs/vkd3d-shader/dxbc.c
@@ -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)
{
--
2.26.2
More information about the wine-devel
mailing list