mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2024-11-21 16:46:41 -08:00
vkd3d-shader/glsl: Implement VKD3DSIH_RET.
Signed-off-by: Atharva Nimbalkar <atharvakn@gmail.com> Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
ebe3bf0c00
commit
d71483d0e5
@ -20,13 +20,15 @@
|
||||
|
||||
struct vkd3d_glsl_generator
|
||||
{
|
||||
struct vkd3d_shader_version version;
|
||||
struct vkd3d_string_buffer buffer;
|
||||
struct vkd3d_shader_location location;
|
||||
struct vkd3d_shader_message_context *message_context;
|
||||
bool failed;
|
||||
};
|
||||
|
||||
struct vkd3d_glsl_generator *vkd3d_glsl_generator_create(const struct vkd3d_shader_compile_info *compile_info,
|
||||
struct vkd3d_glsl_generator *vkd3d_glsl_generator_create(const struct vkd3d_shader_version *version,
|
||||
const struct vkd3d_shader_compile_info *compile_info,
|
||||
struct vkd3d_shader_message_context *message_context)
|
||||
{
|
||||
struct vkd3d_glsl_generator *generator;
|
||||
@ -35,6 +37,7 @@ struct vkd3d_glsl_generator *vkd3d_glsl_generator_create(const struct vkd3d_shad
|
||||
return NULL;
|
||||
|
||||
memset(generator, 0, sizeof(*generator));
|
||||
generator->version = *version;
|
||||
generator->location.source_name = compile_info->source_name;
|
||||
generator->location.line = 2; /* Line 1 is the version token. */
|
||||
generator->message_context = message_context;
|
||||
@ -54,6 +57,21 @@ static void VKD3D_PRINTF_FUNC(3, 4) vkd3d_glsl_compiler_error(
|
||||
return;
|
||||
}
|
||||
|
||||
static void shader_glsl_ret(struct vkd3d_glsl_generator *generator,
|
||||
const struct vkd3d_shader_instruction *ins)
|
||||
{
|
||||
const struct vkd3d_shader_version *version = &generator->version;
|
||||
|
||||
/*
|
||||
* TODO: Implement in_subroutine
|
||||
* TODO: shader_glsl_generate_shader_epilogue(generator);
|
||||
*/
|
||||
if (version->major >= 4)
|
||||
{
|
||||
vkd3d_string_buffer_printf(&generator->buffer, "return;\n");
|
||||
}
|
||||
}
|
||||
|
||||
static void vkd3d_glsl_handle_instruction(struct vkd3d_glsl_generator *generator,
|
||||
const struct vkd3d_shader_instruction *instruction)
|
||||
{
|
||||
@ -62,6 +80,9 @@ static void vkd3d_glsl_handle_instruction(struct vkd3d_glsl_generator *generator
|
||||
case VKD3DSIH_DCL_INPUT:
|
||||
case VKD3DSIH_DCL_OUTPUT_SIV:
|
||||
break;
|
||||
case VKD3DSIH_RET:
|
||||
shader_glsl_ret(generator, instruction);
|
||||
break;
|
||||
default:
|
||||
vkd3d_glsl_compiler_error(generator,
|
||||
VKD3D_SHADER_ERROR_GLSL_INTERNAL,
|
||||
|
@ -1036,7 +1036,7 @@ static int compile_dxbc_tpf(const struct vkd3d_shader_compile_info *compile_info
|
||||
{
|
||||
struct vkd3d_glsl_generator *glsl_generator;
|
||||
|
||||
if (!(glsl_generator = vkd3d_glsl_generator_create(compile_info, message_context)))
|
||||
if (!(glsl_generator = vkd3d_glsl_generator_create(&parser.shader_version, compile_info, message_context)))
|
||||
{
|
||||
ERR("Failed to create GLSL generator.\n");
|
||||
vkd3d_shader_parser_destroy(&parser);
|
||||
|
@ -986,7 +986,8 @@ int shader_parse_input_signature(const void *dxbc, size_t dxbc_length,
|
||||
|
||||
struct vkd3d_glsl_generator;
|
||||
|
||||
struct vkd3d_glsl_generator *vkd3d_glsl_generator_create(const struct vkd3d_shader_compile_info *compile_info,
|
||||
struct vkd3d_glsl_generator *vkd3d_glsl_generator_create(const struct vkd3d_shader_version *version,
|
||||
const struct vkd3d_shader_compile_info *compile_info,
|
||||
struct vkd3d_shader_message_context *message_context);
|
||||
int vkd3d_glsl_generator_generate(void *parser_data, const uint32_t *parser_ptr,
|
||||
struct vkd3d_glsl_generator *generator,
|
||||
|
Loading…
Reference in New Issue
Block a user