vkd3d-shader/glsl: Handle SV_TARGET outputs.

This commit is contained in:
Henri Verbeet 2024-04-14 14:10:04 +02:00
parent 6cae2d006c
commit e9f0c6fef3
Notes: Henri Verbeet 2024-09-18 15:14:12 +02:00
Approved-by: Giovanni Mascellani (@giomasce)
Approved-by: Henri Verbeet (@hverbeet)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/1083

View File

@ -267,11 +267,12 @@ static void shader_glsl_mov(struct vkd3d_glsl_generator *gen, const struct vkd3d
static void shader_glsl_print_sysval_name(struct vkd3d_string_buffer *buffer, struct vkd3d_glsl_generator *gen, static void shader_glsl_print_sysval_name(struct vkd3d_string_buffer *buffer, struct vkd3d_glsl_generator *gen,
enum vkd3d_shader_sysval_semantic sysval, unsigned int idx) enum vkd3d_shader_sysval_semantic sysval, unsigned int idx)
{ {
const struct vkd3d_shader_version *version = &gen->program->shader_version;
switch (sysval) switch (sysval)
{ {
case VKD3D_SHADER_SV_POSITION: case VKD3D_SHADER_SV_POSITION:
if (gen->program->shader_version.type == VKD3D_SHADER_TYPE_PIXEL if (version->type == VKD3D_SHADER_TYPE_PIXEL || version->type == VKD3D_SHADER_TYPE_COMPUTE)
|| gen->program->shader_version.type == VKD3D_SHADER_TYPE_COMPUTE)
{ {
vkd3d_string_buffer_printf(buffer, "<unhandled sysval %#x>", sysval); vkd3d_string_buffer_printf(buffer, "<unhandled sysval %#x>", sysval);
vkd3d_glsl_compiler_error(gen, VKD3D_SHADER_ERROR_GLSL_INTERNAL, vkd3d_glsl_compiler_error(gen, VKD3D_SHADER_ERROR_GLSL_INTERNAL,
@ -286,6 +287,13 @@ static void shader_glsl_print_sysval_name(struct vkd3d_string_buffer *buffer, st
} }
break; break;
case VKD3D_SHADER_SV_TARGET:
if (version->type != VKD3D_SHADER_TYPE_PIXEL)
vkd3d_glsl_compiler_error(gen, VKD3D_SHADER_ERROR_GLSL_INTERNAL,
"Internal compiler error: Unhandled SV_TARGET in shader type #%x.", version->type);
vkd3d_string_buffer_printf(buffer, "shader_out_%u", idx);
break;
default: default:
vkd3d_string_buffer_printf(buffer, "<unhandled sysval %#x>", sysval); vkd3d_string_buffer_printf(buffer, "<unhandled sysval %#x>", sysval);
vkd3d_glsl_compiler_error(gen, VKD3D_SHADER_ERROR_GLSL_INTERNAL, vkd3d_glsl_compiler_error(gen, VKD3D_SHADER_ERROR_GLSL_INTERNAL,