diff --git a/libs/vkd3d-shader/glsl.c b/libs/vkd3d-shader/glsl.c index 1fe3f258..f8d68b5a 100644 --- a/libs/vkd3d-shader/glsl.c +++ b/libs/vkd3d-shader/glsl.c @@ -22,7 +22,7 @@ struct vkd3d_glsl_generator { struct vkd3d_shader_version version; struct vkd3d_string_buffer buffer; - const struct vkd3d_shader_location *location; + struct vkd3d_shader_location location; struct vkd3d_shader_message_context *message_context; bool failed; }; @@ -38,7 +38,7 @@ struct vkd3d_glsl_generator *vkd3d_glsl_generator_create(const struct vkd3d_shad memset(generator, 0, sizeof(*generator)); generator->version = *version; vkd3d_string_buffer_init(&generator->buffer); - generator->location = location; + generator->location = *location; generator->message_context = message_context; return generator; } @@ -50,7 +50,7 @@ static void VKD3D_PRINTF_FUNC(3, 4) vkd3d_glsl_compiler_error( va_list args; va_start(args, fmt); - vkd3d_shader_verror(generator->message_context, generator->location, error, fmt, args); + vkd3d_shader_verror(generator->message_context, &generator->location, error, fmt, args); va_end(args); generator->failed = true; } @@ -99,8 +99,10 @@ int vkd3d_glsl_generator_generate(struct vkd3d_glsl_generator *generator, vkd3d_string_buffer_printf(&generator->buffer, "#version 440\n\n"); vkd3d_string_buffer_printf(&generator->buffer, "void main()\n{\n"); + generator->location.column = 0; for (i = 0; i < parser->instructions.count; ++i) { + generator->location.line = i + 1; vkd3d_glsl_handle_instruction(generator, &parser->instructions.elements[i]); }