[PATCH vkd3d v2 2/8] vkd3d-shader: Read constant buffer offsets from the second index for SM5.1.
Zebediah Figura
zfigura at codeweavers.com
Tue May 26 15:16:42 CDT 2020
Signed-off-by: Zebediah Figura <zfigura at codeweavers.com>
---
v2: Normalize the parsed DXBC to SM5.1 instead of adding a new field.
libs/vkd3d-shader/dxbc.c | 7 +++++++
libs/vkd3d-shader/spirv.c | 2 +-
2 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/libs/vkd3d-shader/dxbc.c b/libs/vkd3d-shader/dxbc.c
index 5156074..a46118e 100644
--- a/libs/vkd3d-shader/dxbc.c
+++ b/libs/vkd3d-shader/dxbc.c
@@ -1603,6 +1603,13 @@ 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] = param->idx[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