mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2025-09-12 18:50:22 -07:00
vkd3d-shader/spirv: Emit OpLine instructions.
This commit is contained in:
Notes:
Henri Verbeet
2025-07-28 16:38:28 +02:00
Approved-by: Giovanni Mascellani (@giomasce) Approved-by: Henri Verbeet (@hverbeet) Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/1649
@@ -982,6 +982,7 @@ struct vkd3d_spirv_builder
|
|||||||
SpvExecutionModel execution_model;
|
SpvExecutionModel execution_model;
|
||||||
|
|
||||||
uint32_t current_id;
|
uint32_t current_id;
|
||||||
|
uint32_t source_name_id;
|
||||||
uint32_t main_function_id;
|
uint32_t main_function_id;
|
||||||
struct rb_tree declarations;
|
struct rb_tree declarations;
|
||||||
uint32_t type_sampler_id;
|
uint32_t type_sampler_id;
|
||||||
@@ -1568,10 +1569,15 @@ static uint32_t vkd3d_spirv_build_op_string(struct vkd3d_spirv_builder *builder,
|
|||||||
static void vkd3d_spirv_build_op_source(struct vkd3d_spirv_builder *builder, const char *source_name)
|
static void vkd3d_spirv_build_op_source(struct vkd3d_spirv_builder *builder, const char *source_name)
|
||||||
{
|
{
|
||||||
struct vkd3d_spirv_stream *stream = &builder->debug_stream;
|
struct vkd3d_spirv_stream *stream = &builder->debug_stream;
|
||||||
uint32_t source_id;
|
|
||||||
|
|
||||||
source_id = vkd3d_spirv_build_op_string(builder, source_name ? source_name : "<anonymous>");
|
builder->source_name_id = vkd3d_spirv_build_op_string(builder, source_name ? source_name : "<anonymous>");
|
||||||
vkd3d_spirv_build_op3(stream, SpvOpSource, 0, 0, source_id);
|
vkd3d_spirv_build_op3(stream, SpvOpSource, 0, 0, builder->source_name_id);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void vkd3d_spirv_build_op_line(struct vkd3d_spirv_builder *builder, const struct vkd3d_shader_location *location)
|
||||||
|
{
|
||||||
|
vkd3d_spirv_build_op3(&builder->function_stream, SpvOpLine,
|
||||||
|
builder->source_name_id, location->line, location->column);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void vkd3d_spirv_build_op_member_name(struct vkd3d_spirv_builder *builder,
|
static void vkd3d_spirv_build_op_member_name(struct vkd3d_spirv_builder *builder,
|
||||||
@@ -10548,6 +10554,17 @@ static int spirv_compiler_handle_instruction(struct spirv_compiler *compiler,
|
|||||||
int ret = VKD3D_OK;
|
int ret = VKD3D_OK;
|
||||||
|
|
||||||
compiler->location = instruction->location;
|
compiler->location = instruction->location;
|
||||||
|
/* radeonsi from Mesa 20.3.5 seems to get confused by OpLine instructions
|
||||||
|
* before OpFunction, seemingly causing it to fail to find the entry
|
||||||
|
* point. As far as I can tell that's not prohibited, and the validation
|
||||||
|
* layers don't seem to mind either, but perhaps it's best avoided.
|
||||||
|
* Notably, radv from the same Mesa version doesn't mind either.
|
||||||
|
*
|
||||||
|
* This is an issue for hull shaders in particular, because we don't go
|
||||||
|
* through vkd3d_spirv_builder_begin_main_function() before getting here
|
||||||
|
* in that case. */
|
||||||
|
if (!compiler->strip_debug && compiler->spirv_builder.function_stream.word_count)
|
||||||
|
vkd3d_spirv_build_op_line(&compiler->spirv_builder, &instruction->location);
|
||||||
|
|
||||||
switch (instruction->opcode)
|
switch (instruction->opcode)
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user