[spv-out] annotate function and constant names

This commit is contained in:
Dzmitry Malyshau 2021-02-13 14:04:58 -05:00 committed by Dzmitry Malyshau
parent 94bd97c0fb
commit 8183f4ff6f
9 changed files with 123 additions and 1 deletions

View File

@ -413,6 +413,12 @@ impl Writer {
};
let function_id = self.generate_id();
if self.flags.contains(WriterFlags::DEBUG) {
if let Some(ref name) = ir_function.name {
self.debugs.push(Instruction::name(function_id, name));
}
}
let function_type = self.get_function_type(lookup_function_type);
function.signature = Some(Instruction::function(
return_type_id,
@ -2023,6 +2029,11 @@ impl Writer {
for (handle, constant) in ir_module.constants.iter() {
let id = self.generate_id();
self.lookup_constant.insert(handle, id);
if self.flags.contains(WriterFlags::DEBUG) {
if let Some(ref name) = constant.name {
self.debugs.push(Instruction::name(id, name));
}
}
self.write_constant_type(id, &constant.inner, &ir_module.types)?;
}

View File

@ -11,6 +11,37 @@ OpCapability Shader
OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %29 "main" %36
OpExecutionMode %29 LocalSize 64 1 1
OpSource GLSL 450
OpName %3 "NUM_PARTICLES"
OpName %15 "vPos"
OpName %18 "vVel"
OpName %19 "cMass"
OpName %20 "cVel"
OpName %21 "colVel"
OpName %22 "cMassCount"
OpName %24 "cVelCount"
OpName %25 "pos"
OpName %26 "vel"
OpName %27 "i"
OpName %29 "main"
OpName %36 "gl_GlobalInvocationID"
OpName %45 "Particle"
OpMemberName %45 0 "pos"
OpMemberName %45 1 "vel"
OpName %49 "Particles"
OpMemberName %49 0 "particles"
OpName %50 "particlesSrc"
OpName %121 "SimParams"
OpMemberName %121 0 "deltaT"
OpMemberName %121 1 "rule1Distance"
OpMemberName %121 2 "rule2Distance"
OpMemberName %121 3 "rule3Distance"
OpMemberName %121 4 "rule1Scale"
OpMemberName %121 5 "rule2Scale"
OpMemberName %121 6 "rule3Scale"
OpName %122 "params"
OpName %274 "particlesDst"
OpName %29 "main"
OpDecorate %36 BuiltIn GlobalInvocationId
OpMemberDecorate %45 0 Offset 0
OpMemberDecorate %45 1 Offset 8

View File

@ -11,6 +11,16 @@ OpCapability Shader
OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %39 "main" %53
OpExecutionMode %39 LocalSize 1 1 1
OpSource GLSL 450
OpName %8 "n"
OpName %10 "i"
OpName %12 "collatz_iterations"
OpName %39 "main"
OpName %45 "PrimeIndices"
OpMemberName %45 0 "data"
OpName %46 "v_indices"
OpName %53 "global_id"
OpName %39 "main"
OpDecorate %43 ArrayStride 4
OpDecorate %45 BufferBlock
OpMemberDecorate %45 0 Offset 0

View File

@ -11,6 +11,9 @@ OpCapability Shader
OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %3 "main"
OpExecutionMode %3 LocalSize 1 1 1
OpSource GLSL 450
OpName %3 "main"
OpName %3 "main"
%2 = OpTypeVoid
%4 = OpTypeFunction %2
%3 = OpFunction %2 None %4

View File

@ -12,6 +12,20 @@ OpMemoryModel Logical GLSL450
OpEntryPoint Vertex %7 "main" %20 %13 %11 %17
OpEntryPoint Fragment %23 "main" %35 %25
OpExecutionMode %23 OriginUpperLeft
OpSource GLSL 450
OpName %3 "c_scale"
OpName %7 "main"
OpName %11 "v_uv"
OpName %13 "a_uv"
OpName %17 "o_position"
OpName %20 "a_pos"
OpName %7 "main"
OpName %23 "main"
OpName %25 "o_color"
OpName %27 "u_texture"
OpName %32 "u_sampler"
OpName %35 "v_uv"
OpName %23 "main"
OpDecorate %11 Location 0
OpDecorate %13 Location 1
OpDecorate %17 BuiltIn Position

View File

@ -11,6 +11,29 @@ OpCapability Shader
OpMemoryModel Logical GLSL450
OpEntryPoint Fragment %64 "fs_main" %114 %111 %217
OpExecutionMode %64 OriginUpperLeft
OpSource GLSL 450
OpName %9 "c_ambient"
OpName %11 "c_max_lights"
OpName %18 "fetch_shadow"
OpName %28 "t_shadow"
OpName %33 "sampler_shadow"
OpName %60 "color"
OpName %62 "i"
OpName %64 "fs_main"
OpName %76 "Globals"
OpMemberName %76 0 "num_lights"
OpName %77 "u_globals"
OpName %97 "Light"
OpMemberName %97 0 "proj"
OpMemberName %97 1 "pos"
OpMemberName %97 2 "color"
OpName %101 "Lights"
OpMemberName %101 0 "data"
OpName %102 "s_lights"
OpName %111 "in_position_fs"
OpName %114 "in_normal_fs"
OpName %217 "out_color_fs"
OpName %64 "fs_main"
OpDecorate %28 DescriptorSet 0
OpDecorate %28 Binding 2
OpDecorate %33 DescriptorSet 0

View File

@ -12,6 +12,25 @@ OpMemoryModel Logical GLSL450
OpEntryPoint Vertex %16 "vs_main" %159 %47 %21
OpEntryPoint Fragment %170 "fs_main" %182 %172
OpExecutionMode %170 OriginUpperLeft
OpSource GLSL 450
OpName %10 "tmp1"
OpName %12 "tmp2"
OpName %13 "unprojected"
OpName %16 "vs_main"
OpName %21 "in_vertex_index"
OpName %31 "Data"
OpMemberName %31 0 "proj_inv"
OpMemberName %31 1 "view"
OpName %32 "r_data"
OpName %47 "out_uv"
OpName %159 "out_position"
OpName %16 "vs_main"
OpName %170 "fs_main"
OpName %172 "out_color"
OpName %174 "r_texture"
OpName %179 "r_sampler"
OpName %182 "in_uv"
OpName %170 "fs_main"
OpDecorate %21 BuiltIn VertexIndex
OpDecorate %31 Block
OpMemberDecorate %31 0 Offset 0

View File

@ -11,6 +11,17 @@ OpCapability Shader
OpMemoryModel Logical GLSL450
OpEntryPoint Fragment %5 "main" %35 %23
OpExecutionMode %5 OriginUpperLeft
OpSource GLSL 450
OpName %5 "main"
OpName %12 "PushConstants"
OpMemberName %12 0 "index"
OpName %13 "pc"
OpName %23 "color"
OpName %26 "texture0"
OpName %31 "sampler"
OpName %35 "tex_coord"
OpName %40 "texture1"
OpName %5 "main"
OpDecorate %12 Block
OpMemberDecorate %12 0 Offset 0
OpDecorate %23 Location 1

View File

@ -61,7 +61,7 @@ fn check_output_spv(module: &naga::Module, name: &str, params: &Parameters) {
let spv = spv::write_vec(
&module,
spv::WriterFlags::NONE,
spv::WriterFlags::DEBUG,
params.spv_capabilities.clone(),
)
.unwrap();