mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2024-11-21 16:46:41 -08:00
vkd3d-shader/hlsl: Support offset argument for the texture Load() method.
This commit is contained in:
parent
7a7b17d0e1
commit
cf17882189
Notes:
Alexandre Julliard
2023-01-24 22:27:58 +01:00
Approved-by: Giovanni Mascellani (@giomasce) Approved-by: Zebediah Figura (@zfigura) Approved-by: Henri Verbeet (@hverbeet) Approved-by: Alexandre Julliard (@julliard) Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/51
@ -1441,7 +1441,8 @@ static void write_sm4_constant(struct hlsl_ctx *ctx,
|
||||
|
||||
static void write_sm4_ld(struct hlsl_ctx *ctx, struct vkd3d_bytecode_buffer *buffer,
|
||||
const struct hlsl_type *resource_type, const struct hlsl_ir_node *dst,
|
||||
const struct hlsl_deref *resource, const struct hlsl_ir_node *coords)
|
||||
const struct hlsl_deref *resource, const struct hlsl_ir_node *coords,
|
||||
const struct hlsl_ir_node *texel_offset)
|
||||
{
|
||||
bool uav = (resource_type->base_type == HLSL_TYPE_UAV);
|
||||
struct sm4_instruction instr;
|
||||
@ -1450,6 +1451,16 @@ static void write_sm4_ld(struct hlsl_ctx *ctx, struct vkd3d_bytecode_buffer *buf
|
||||
memset(&instr, 0, sizeof(instr));
|
||||
instr.opcode = uav ? VKD3D_SM5_OP_LD_UAV_TYPED : VKD3D_SM4_OP_LD;
|
||||
|
||||
if (texel_offset)
|
||||
{
|
||||
if (!encode_texel_offset_as_aoffimmi(&instr, texel_offset))
|
||||
{
|
||||
hlsl_error(ctx, &texel_offset->loc, VKD3D_SHADER_ERROR_HLSL_INVALID_TEXEL_OFFSET,
|
||||
"Offset must resolve to integer literal in the range -8 to 7.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
sm4_dst_from_node(&instr.dsts[0], dst);
|
||||
instr.dst_count = 1;
|
||||
|
||||
@ -2204,7 +2215,8 @@ static void write_sm4_resource_load(struct hlsl_ctx *ctx,
|
||||
switch (load->load_type)
|
||||
{
|
||||
case HLSL_RESOURCE_LOAD:
|
||||
write_sm4_ld(ctx, buffer, resource_type, &load->node, &load->resource, coords);
|
||||
write_sm4_ld(ctx, buffer, resource_type, &load->node, &load->resource,
|
||||
coords, texel_offset);
|
||||
break;
|
||||
|
||||
case HLSL_RESOURCE_SAMPLE:
|
||||
|
@ -8,7 +8,7 @@ size (3, 3)
|
||||
0 2 0 1 1 2 0 1 2 2 0 1
|
||||
|
||||
|
||||
[pixel shader]
|
||||
[pixel shader todo]
|
||||
Texture2D t;
|
||||
|
||||
float4 main(float4 pos : sv_position) : sv_target
|
||||
@ -18,14 +18,14 @@ float4 main(float4 pos : sv_position) : sv_target
|
||||
|
||||
|
||||
[test]
|
||||
draw quad
|
||||
todo draw quad
|
||||
todo probe (0, 0) rgba (0, 1, 0, 1)
|
||||
todo probe (1, 0) rgba (1, 1, 0, 1)
|
||||
todo probe (0, 1) rgba (0, 2, 0, 1)
|
||||
todo probe (1, 1) rgba (1, 2, 0, 1)
|
||||
|
||||
|
||||
[pixel shader]
|
||||
[pixel shader todo]
|
||||
Texture2D t;
|
||||
|
||||
float4 main(float4 pos : sv_position) : sv_target
|
||||
@ -35,14 +35,14 @@ float4 main(float4 pos : sv_position) : sv_target
|
||||
|
||||
|
||||
[test]
|
||||
draw quad
|
||||
todo draw quad
|
||||
todo probe (3, 0) rgba (1, 0, 0, 1)
|
||||
todo probe (4, 0) rgba (2, 0, 0, 1)
|
||||
todo probe (3, 1) rgba (1, 1, 0, 1)
|
||||
todo probe (4, 1) rgba (2, 1, 0, 1)
|
||||
|
||||
|
||||
[pixel shader fail todo]
|
||||
[pixel shader fail]
|
||||
Texture2D t;
|
||||
|
||||
float4 main(float4 pos : sv_position) : sv_target
|
||||
|
Loading…
Reference in New Issue
Block a user