Signed-off-by: Zebediah Figura zfigura@codeweavers.com --- include/vkd3d_shader.h | 14 ++++++-------- libs/vkd3d-shader/dxbc.c | 3 +-- libs/vkd3d/state.c | 3 +-- 3 files changed, 8 insertions(+), 12 deletions(-)
diff --git a/include/vkd3d_shader.h b/include/vkd3d_shader.h index 7c7b727..88eca85 100644 --- a/include/vkd3d_shader.h +++ b/include/vkd3d_shader.h @@ -818,14 +818,12 @@ struct vkd3d_shader_signature #define VKD3D_SHADER_SWIZZLE_SHIFT(idx) (2u * (idx))
#define VKD3D_SHADER_SWIZZLE(x, y, z, w) \ - (((x & VKD3D_SHADER_SWIZZLE_MASK) << VKD3D_SHADER_SWIZZLE_SHIFT(0)) \ - | ((y & VKD3D_SHADER_SWIZZLE_MASK) << VKD3D_SHADER_SWIZZLE_SHIFT(1)) \ - | ((z & VKD3D_SHADER_SWIZZLE_MASK) << VKD3D_SHADER_SWIZZLE_SHIFT(2)) \ - | ((w & VKD3D_SHADER_SWIZZLE_MASK) << VKD3D_SHADER_SWIZZLE_SHIFT(3))) - -#define VKD3D_SHADER_NO_SWIZZLE \ - VKD3D_SHADER_SWIZZLE(VKD3D_SHADER_SWIZZLE_X, VKD3D_SHADER_SWIZZLE_Y, \ - VKD3D_SHADER_SWIZZLE_Z, VKD3D_SHADER_SWIZZLE_W) + (((VKD3D_SHADER_SWIZZLE_ ## x) << VKD3D_SHADER_SWIZZLE_SHIFT(0)) \ + | ((VKD3D_SHADER_SWIZZLE_ ## y) << VKD3D_SHADER_SWIZZLE_SHIFT(1)) \ + | ((VKD3D_SHADER_SWIZZLE_ ## z) << VKD3D_SHADER_SWIZZLE_SHIFT(2)) \ + | ((VKD3D_SHADER_SWIZZLE_ ## w) << VKD3D_SHADER_SWIZZLE_SHIFT(3))) + +#define VKD3D_SHADER_NO_SWIZZLE VKD3D_SHADER_SWIZZLE(X, Y, Z, W)
typedef void (*PFN_vkd3d_shader_free_blob_data)(void *);
diff --git a/libs/vkd3d-shader/dxbc.c b/libs/vkd3d-shader/dxbc.c index 1aa8a5c..81c1f48 100644 --- a/libs/vkd3d-shader/dxbc.c +++ b/libs/vkd3d-shader/dxbc.c @@ -1669,8 +1669,7 @@ static bool shader_sm4_read_src_param(struct vkd3d_sm4_data *priv, const DWORD * { case VKD3D_SM4_SWIZZLE_NONE: if (shader_sm4_is_scalar_register(&src_param->reg)) - src_param->swizzle = VKD3D_SHADER_SWIZZLE(VKD3D_SHADER_SWIZZLE_X, - VKD3D_SHADER_SWIZZLE_X, VKD3D_SHADER_SWIZZLE_X, VKD3D_SHADER_SWIZZLE_X); + src_param->swizzle = VKD3D_SHADER_SWIZZLE(X, X, X, X); else src_param->swizzle = VKD3D_SHADER_NO_SWIZZLE; break; diff --git a/libs/vkd3d/state.c b/libs/vkd3d/state.c index 449f242..a64d17f 100644 --- a/libs/vkd3d/state.c +++ b/libs/vkd3d/state.c @@ -1971,8 +1971,7 @@ static HRESULT compute_input_layout_offsets(const struct d3d12_device *device, static unsigned int vkd3d_get_rt_format_swizzle(const struct vkd3d_format *format) { if (format->dxgi_format == DXGI_FORMAT_A8_UNORM) - return VKD3D_SHADER_SWIZZLE(VKD3D_SHADER_SWIZZLE_W, VKD3D_SHADER_SWIZZLE_X, - VKD3D_SHADER_SWIZZLE_Y, VKD3D_SHADER_SWIZZLE_Z); + return VKD3D_SHADER_SWIZZLE(W, X, Y, Z);
return VKD3D_SHADER_NO_SWIZZLE; }
This would break anyone wanting to use VKD3D_SHADER_SWIZZLE programmatically.
- Josh 🐸
On Fri, 7 Aug 2020 at 18:12, Zebediah Figura zfigura@codeweavers.com wrote:
Signed-off-by: Zebediah Figura zfigura@codeweavers.com
include/vkd3d_shader.h | 14 ++++++-------- libs/vkd3d-shader/dxbc.c | 3 +-- libs/vkd3d/state.c | 3 +-- 3 files changed, 8 insertions(+), 12 deletions(-)
diff --git a/include/vkd3d_shader.h b/include/vkd3d_shader.h index 7c7b727..88eca85 100644 --- a/include/vkd3d_shader.h +++ b/include/vkd3d_shader.h @@ -818,14 +818,12 @@ struct vkd3d_shader_signature #define VKD3D_SHADER_SWIZZLE_SHIFT(idx) (2u * (idx))
#define VKD3D_SHADER_SWIZZLE(x, y, z, w) \
(((x & VKD3D_SHADER_SWIZZLE_MASK) << VKD3D_SHADER_SWIZZLE_SHIFT(0)) \
| ((y & VKD3D_SHADER_SWIZZLE_MASK) << VKD3D_SHADER_SWIZZLE_SHIFT(1)) \
| ((z & VKD3D_SHADER_SWIZZLE_MASK) << VKD3D_SHADER_SWIZZLE_SHIFT(2)) \
| ((w & VKD3D_SHADER_SWIZZLE_MASK) << VKD3D_SHADER_SWIZZLE_SHIFT(3)))
-#define VKD3D_SHADER_NO_SWIZZLE \
VKD3D_SHADER_SWIZZLE(VKD3D_SHADER_SWIZZLE_X, VKD3D_SHADER_SWIZZLE_Y, \
VKD3D_SHADER_SWIZZLE_Z, VKD3D_SHADER_SWIZZLE_W)
(((VKD3D_SHADER_SWIZZLE_ ## x) << VKD3D_SHADER_SWIZZLE_SHIFT(0)) \
| ((VKD3D_SHADER_SWIZZLE_ ## y) << VKD3D_SHADER_SWIZZLE_SHIFT(1)) \
| ((VKD3D_SHADER_SWIZZLE_ ## z) << VKD3D_SHADER_SWIZZLE_SHIFT(2)) \
| ((VKD3D_SHADER_SWIZZLE_ ## w) << VKD3D_SHADER_SWIZZLE_SHIFT(3)))
+#define VKD3D_SHADER_NO_SWIZZLE VKD3D_SHADER_SWIZZLE(X, Y, Z, W)
typedef void (*PFN_vkd3d_shader_free_blob_data)(void *);
diff --git a/libs/vkd3d-shader/dxbc.c b/libs/vkd3d-shader/dxbc.c index 1aa8a5c..81c1f48 100644 --- a/libs/vkd3d-shader/dxbc.c +++ b/libs/vkd3d-shader/dxbc.c @@ -1669,8 +1669,7 @@ static bool shader_sm4_read_src_param(struct vkd3d_sm4_data *priv, const DWORD * { case VKD3D_SM4_SWIZZLE_NONE: if (shader_sm4_is_scalar_register(&src_param->reg))
src_param->swizzle = VKD3D_SHADER_SWIZZLE(VKD3D_SHADER_SWIZZLE_X,
VKD3D_SHADER_SWIZZLE_X, VKD3D_SHADER_SWIZZLE_X, VKD3D_SHADER_SWIZZLE_X);
src_param->swizzle = VKD3D_SHADER_SWIZZLE(X, X, X, X); else src_param->swizzle = VKD3D_SHADER_NO_SWIZZLE; break;
diff --git a/libs/vkd3d/state.c b/libs/vkd3d/state.c index 449f242..a64d17f 100644 --- a/libs/vkd3d/state.c +++ b/libs/vkd3d/state.c @@ -1971,8 +1971,7 @@ static HRESULT compute_input_layout_offsets(const struct d3d12_device *device, static unsigned int vkd3d_get_rt_format_swizzle(const struct vkd3d_format *format) { if (format->dxgi_format == DXGI_FORMAT_A8_UNORM)
return VKD3D_SHADER_SWIZZLE(VKD3D_SHADER_SWIZZLE_W, VKD3D_SHADER_SWIZZLE_X,
VKD3D_SHADER_SWIZZLE_Y, VKD3D_SHADER_SWIZZLE_Z);
return VKD3D_SHADER_SWIZZLE(W, X, Y, Z);
return VKD3D_SHADER_NO_SWIZZLE;
}
2.27.0