Signed-off-by: Atharva Nimbalkar atharvakn@gmail.com --- include/vkd3d_shader.h | 4 ++++ libs/vkd3d-shader/vkd3d_shader_main.c | 10 ++++++++++ libs/vkd3d-shader/vkd3d_shader_private.h | 2 ++ programs/vkd3d-compiler/main.c | 3 +++ 4 files changed, 19 insertions(+)
diff --git a/include/vkd3d_shader.h b/include/vkd3d_shader.h index 5092fac..58e507b 100644 --- a/include/vkd3d_shader.h +++ b/include/vkd3d_shader.h @@ -491,6 +491,10 @@ enum vkd3d_shader_target_type * the format used for Direct3D shader model 4 and 5 shaders. */ VKD3D_SHADER_TARGET_DXBC_TPF, + /** + * An 'OpenGL Shading Language' shader. + */ + VKD3D_SHADER_TARGET_GLSL,
VKD3D_FORCE_32_BIT_ENUM(VKD3D_SHADER_TARGET_TYPE), }; diff --git a/libs/vkd3d-shader/vkd3d_shader_main.c b/libs/vkd3d-shader/vkd3d_shader_main.c index 78312a1..a9b5d0a 100644 --- a/libs/vkd3d-shader/vkd3d_shader_main.c +++ b/libs/vkd3d-shader/vkd3d_shader_main.c @@ -1032,6 +1032,15 @@ static int compile_dxbc_tpf(const struct vkd3d_shader_compile_info *compile_info return ret; }
+ if (compile_info->target_type == VKD3D_SHADER_TARGET_GLSL) + { + vkd3d_shader_error(message_context, NULL, VKD3D_SHADER_ERROR_GLSL_INTERNAL, + "Internal compiler error: Unhandled instruction."); + vkd3d_shader_parser_destroy(&parser); + vkd3d_shader_free_scan_descriptor_info(&scan_descriptor_info); + return VKD3D_ERROR; + } + if (!(spirv_compiler = vkd3d_dxbc_compiler_create(&parser.shader_version, &parser.shader_desc, compile_info, &scan_descriptor_info, message_context))) { @@ -1280,6 +1289,7 @@ const enum vkd3d_shader_target_type *vkd3d_shader_get_supported_target_types( VKD3D_SHADER_TARGET_SPIRV_TEXT, #endif VKD3D_SHADER_TARGET_D3D_ASM, + VKD3D_SHADER_TARGET_GLSL, };
static const enum vkd3d_shader_target_type hlsl_types[] = diff --git a/libs/vkd3d-shader/vkd3d_shader_private.h b/libs/vkd3d-shader/vkd3d_shader_private.h index 8550380..b490b9c 100644 --- a/libs/vkd3d-shader/vkd3d_shader_private.h +++ b/libs/vkd3d-shader/vkd3d_shader_private.h @@ -115,6 +115,8 @@ enum vkd3d_shader_error VKD3D_SHADER_ERROR_HLSL_NOT_IMPLEMENTED = 5017,
VKD3D_SHADER_WARNING_HLSL_IMPLICIT_TRUNCATION = 5300, + + VKD3D_SHADER_ERROR_GLSL_INTERNAL = 6000, };
enum vkd3d_shader_opcode diff --git a/programs/vkd3d-compiler/main.c b/programs/vkd3d-compiler/main.c index fb19a70..71f90f8 100644 --- a/programs/vkd3d-compiler/main.c +++ b/programs/vkd3d-compiler/main.c @@ -90,6 +90,9 @@ target_type_info[] = "dxbc-tpf", "A 'Tokenized Program Format' shader embedded in a DXBC container.\n" " This is the format used for Direct3D shader model 4 and 5 shaders.\n", true}, + {VKD3D_SHADER_TARGET_GLSL, + "glsl", "An 'OpenGL Shading Language' shader.\n", + false} };
static bool read_shader(struct vkd3d_shader_code *shader, FILE *f)