mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2024-11-21 16:46:41 -08:00
vkd3d-shader/glsl: Implement VKD3DSIH_SAMPLE_C_LZ.
This commit is contained in:
parent
5958e527e5
commit
21e9029177
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
@ -919,7 +919,7 @@ static void shader_glsl_sample(struct vkd3d_glsl_generator *gen, const struct vk
|
||||
sampler_space = d->register_space;
|
||||
shadow = d->flags & VKD3D_SHADER_DESCRIPTOR_INFO_FLAG_SAMPLER_COMPARISON_MODE;
|
||||
|
||||
if (ins->opcode == VKD3DSIH_SAMPLE_C)
|
||||
if (ins->opcode == VKD3DSIH_SAMPLE_C || ins->opcode == VKD3DSIH_SAMPLE_C_LZ)
|
||||
{
|
||||
if (!shadow)
|
||||
vkd3d_glsl_compiler_error(gen, VKD3D_SHADER_ERROR_GLSL_INTERNAL,
|
||||
@ -942,10 +942,13 @@ static void shader_glsl_sample(struct vkd3d_glsl_generator *gen, const struct vk
|
||||
glsl_dst_init(&dst, gen, ins, &ins->dst[0]);
|
||||
sample = vkd3d_string_buffer_get(&gen->string_buffers);
|
||||
|
||||
vkd3d_string_buffer_printf(sample, "texture(");
|
||||
if (ins->opcode == VKD3DSIH_SAMPLE_C_LZ)
|
||||
vkd3d_string_buffer_printf(sample, "textureLod(");
|
||||
else
|
||||
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, ", ");
|
||||
if (ins->opcode == VKD3DSIH_SAMPLE_C)
|
||||
if (ins->opcode == VKD3DSIH_SAMPLE_C || ins->opcode == VKD3DSIH_SAMPLE_C_LZ)
|
||||
shader_glsl_print_shadow_coord(sample, gen, &ins->src[0], &ins->src[3], coord_size);
|
||||
else
|
||||
shader_glsl_print_src(sample, gen, &ins->src[0],
|
||||
@ -955,6 +958,10 @@ static void shader_glsl_sample(struct vkd3d_glsl_generator *gen, const struct vk
|
||||
vkd3d_string_buffer_printf(sample, ", ");
|
||||
shader_glsl_print_src(sample, gen, &ins->src[3], VKD3DSP_WRITEMASK_0, ins->src[3].reg.data_type);
|
||||
}
|
||||
else if (ins->opcode == VKD3DSIH_SAMPLE_C_LZ)
|
||||
{
|
||||
vkd3d_string_buffer_printf(sample, ", 0.0");
|
||||
}
|
||||
vkd3d_string_buffer_printf(sample, ")");
|
||||
shader_glsl_print_swizzle(sample, ins->src[1].swizzle, ins->dst[0].write_mask);
|
||||
|
||||
@ -1549,6 +1556,7 @@ static void vkd3d_glsl_handle_instruction(struct vkd3d_glsl_generator *gen,
|
||||
case VKD3DSIH_SAMPLE:
|
||||
case VKD3DSIH_SAMPLE_B:
|
||||
case VKD3DSIH_SAMPLE_C:
|
||||
case VKD3DSIH_SAMPLE_C_LZ:
|
||||
shader_glsl_sample(gen, ins);
|
||||
break;
|
||||
case VKD3DSIH_SQRT:
|
||||
|
@ -27,7 +27,7 @@ float4 main() : sv_target
|
||||
}
|
||||
|
||||
[test]
|
||||
todo(glsl) draw quad
|
||||
draw quad
|
||||
probe (0, 0) rgba (0.0, 0.0, 0.0, 1.0)
|
||||
|
||||
[sampler 0]
|
||||
@ -36,7 +36,7 @@ address clamp clamp clamp
|
||||
comparison less
|
||||
|
||||
[test]
|
||||
todo(glsl) draw quad
|
||||
draw quad
|
||||
probe (0, 0) rgba (1.0, 0.0, 0.0, 1.0)
|
||||
|
||||
[sampler 0]
|
||||
@ -45,7 +45,7 @@ address clamp clamp clamp
|
||||
comparison equal
|
||||
|
||||
[test]
|
||||
todo(glsl) draw quad
|
||||
draw quad
|
||||
probe (0, 0) rgba (0.0, 1.0, 0.0, 1.0)
|
||||
|
||||
[sampler 0]
|
||||
@ -54,7 +54,7 @@ address clamp clamp clamp
|
||||
comparison less equal
|
||||
|
||||
[test]
|
||||
todo(glsl) draw quad
|
||||
draw quad
|
||||
probe (0, 0) rgba (1.0, 1.0, 0.0, 1.0)
|
||||
|
||||
[sampler 0]
|
||||
@ -63,7 +63,7 @@ address clamp clamp clamp
|
||||
comparison greater
|
||||
|
||||
[test]
|
||||
todo(glsl) draw quad
|
||||
draw quad
|
||||
probe (0, 0) rgba (0.0, 0.0, 1.0, 1.0)
|
||||
|
||||
[sampler 0]
|
||||
@ -72,7 +72,7 @@ address clamp clamp clamp
|
||||
comparison not equal
|
||||
|
||||
[test]
|
||||
todo(glsl) draw quad
|
||||
draw quad
|
||||
probe (0, 0) rgba (1.0, 0.0, 1.0, 1.0)
|
||||
|
||||
[sampler 0]
|
||||
@ -81,7 +81,7 @@ address clamp clamp clamp
|
||||
comparison greater equal
|
||||
|
||||
[test]
|
||||
todo(glsl) draw quad
|
||||
draw quad
|
||||
probe (0, 0) rgba (0.0, 1.0, 1.0, 1.0)
|
||||
|
||||
[sampler 0]
|
||||
@ -90,7 +90,7 @@ address clamp clamp clamp
|
||||
comparison always
|
||||
|
||||
[test]
|
||||
todo(glsl) draw quad
|
||||
draw quad
|
||||
probe (0, 0) rgba (1.0, 1.0, 1.0, 1.0)
|
||||
|
||||
|
||||
@ -118,7 +118,7 @@ float4 main() : sv_target
|
||||
[test]
|
||||
uniform 0 float 0.5
|
||||
uniform 1 float 0.00000007
|
||||
todo(glsl) draw quad
|
||||
draw quad
|
||||
probe (0, 0) rgba (0.0, 0.0, 1.0, 1.0)
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user