mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2024-11-21 16:46:41 -08:00
vkd3d-shader/hlsl: Use the writemask to map the coords swizzle for load instructions.
Instead of modifying the swizzle after calling sm4_src_from_node().
This fixes the case where sm4_src_from_node() returns an immediate constant.
Fixes: a471c5567a
This commit is contained in:
parent
ebf7573571
commit
7b476573ff
Notes:
Alexandre Julliard
2023-06-08 23:22:36 +02:00
Approved-by: Giovanni Mascellani (@giomasce) Approved-by: Henri Verbeet (@hverbeet) Approved-by: Alexandre Julliard (@julliard) Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/223
@ -4012,8 +4012,8 @@ static void write_sm4_ld(struct hlsl_ctx *ctx, struct vkd3d_bytecode_buffer *buf
|
||||
bool multisampled = resource_type->base_type == HLSL_TYPE_TEXTURE
|
||||
&& (resource_type->sampler_dim == HLSL_SAMPLER_DIM_2DMS || resource_type->sampler_dim == HLSL_SAMPLER_DIM_2DMSARRAY);
|
||||
bool uav = (hlsl_type_get_regset(resource_type) == HLSL_REGSET_UAVS);
|
||||
unsigned int coords_writemask = VKD3DSP_WRITEMASK_ALL;
|
||||
struct sm4_instruction instr;
|
||||
unsigned int dim_count;
|
||||
|
||||
memset(&instr, 0, sizeof(instr));
|
||||
if (uav)
|
||||
@ -4034,19 +4034,20 @@ static void write_sm4_ld(struct hlsl_ctx *ctx, struct vkd3d_bytecode_buffer *buf
|
||||
sm4_dst_from_node(&instr.dsts[0], dst);
|
||||
instr.dst_count = 1;
|
||||
|
||||
sm4_src_from_node(&instr.srcs[0], coords, VKD3DSP_WRITEMASK_ALL);
|
||||
|
||||
if (!uav)
|
||||
{
|
||||
/* Mipmap level is in the last component in the IR, but needs to be in the W
|
||||
* component in the instruction. */
|
||||
dim_count = hlsl_sampler_dim_count(dim);
|
||||
unsigned int dim_count = hlsl_sampler_dim_count(dim);
|
||||
|
||||
if (dim_count == 1)
|
||||
instr.srcs[0].swizzle = hlsl_combine_swizzles(instr.srcs[0].swizzle, HLSL_SWIZZLE(X, X, X, Y), 4);
|
||||
coords_writemask = VKD3DSP_WRITEMASK_0 | VKD3DSP_WRITEMASK_3;
|
||||
if (dim_count == 2)
|
||||
instr.srcs[0].swizzle = hlsl_combine_swizzles(instr.srcs[0].swizzle, HLSL_SWIZZLE(X, Y, X, Z), 4);
|
||||
coords_writemask = VKD3DSP_WRITEMASK_0 | VKD3DSP_WRITEMASK_1 | VKD3DSP_WRITEMASK_3;
|
||||
}
|
||||
|
||||
sm4_src_from_node(&instr.srcs[0], coords, coords_writemask);
|
||||
|
||||
sm4_src_from_deref(ctx, &instr.srcs[1], resource, resource_type, instr.dsts[0].writemask);
|
||||
|
||||
instr.src_count = 2;
|
||||
|
Loading…
Reference in New Issue
Block a user