vkd3d-shader/glsl: Implement VKD3DSIH_SAMPLE_B.

This commit is contained in:
Henri Verbeet 2024-10-18 15:21:27 +02:00
parent e408f1d984
commit 19c493722e
Notes: Henri Verbeet 2024-10-22 20:55:33 +02:00
Approved-by: Giovanni Mascellani (@giomasce)
Approved-by: Henri Verbeet (@hverbeet)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/1206
2 changed files with 14 additions and 7 deletions

View File

@ -900,7 +900,13 @@ static void shader_glsl_sample(struct vkd3d_glsl_generator *gen, const struct vk
vkd3d_string_buffer_printf(sample, "texture(");
shader_glsl_print_combined_sampler_name(sample, gen, resource_idx, resource_space, sampler_idx, sampler_space);
vkd3d_string_buffer_printf(sample, ", %s)", coord.str->buffer);
vkd3d_string_buffer_printf(sample, ", %s", coord.str->buffer);
if (ins->opcode == VKD3DSIH_SAMPLE_B)
{
vkd3d_string_buffer_printf(sample, ", ");
shader_glsl_print_src(sample, gen, &ins->src[3], VKD3DSP_WRITEMASK_0, ins->src[3].reg.data_type);
}
vkd3d_string_buffer_printf(sample, ")");
shader_glsl_print_swizzle(sample, ins->src[1].swizzle, ins->dst[0].write_mask);
shader_glsl_print_assignment_ext(gen, &dst, data_type, "%s", sample->buffer);
@ -1493,6 +1499,7 @@ static void vkd3d_glsl_handle_instruction(struct vkd3d_glsl_generator *gen,
shader_glsl_intrinsic(gen, ins, "inversesqrt");
break;
case VKD3DSIH_SAMPLE:
case VKD3DSIH_SAMPLE_B:
shader_glsl_sample(gen, ins);
break;
case VKD3DSIH_SQRT:

View File

@ -32,15 +32,15 @@ float4 main(float2 coord : texcoord) : sv_target
[test]
uniform 0 float4 6.5 0.0 0.0 0.0
todo(sm<4 | glsl) draw quad
todo(sm<4) draw quad
probe (0, 0) rgba (10.0, 0.0, 10.0, 0.0)
uniform 0 float4 7.5 0.0 0.0 0.0
todo(sm<4 | glsl) draw quad
todo(sm<4) draw quad
probe (0, 0) rgba (4.0, 0.0, 10.0, 0.0)
uniform 0 float4 8.5 0.0 0.0 0.0
todo(sm<4 | glsl) draw quad
todo(sm<4) draw quad
probe (0, 0) rgba (0.0, 0.0, 10.0, 0.0)
[require]
@ -60,13 +60,13 @@ float4 main(float2 coord : texcoord) : sv_target
[test]
uniform 0 float4 6.5 0.0 0.0 0.0
todo(glsl) draw quad
draw quad
probe (0, 0) rgba (10.0, 0.0, 10.0, 0.0)
uniform 0 float4 7.5 0.0 0.0 0.0
todo(glsl) draw quad
draw quad
todo(sm<4) probe (0,0) rgba (4.0, 0.0, 10.0, 0.0)
uniform 0 float4 8.5 0.0 0.0 0.0
todo(glsl) draw quad
draw quad
todo(sm<4) probe (0,0) rgba (0.0, 0.0, 10.0, 0.0)