Skip to content

Commit

Permalink
[spv-out] Write function arguments names (gfx-rs#1472)
Browse files Browse the repository at this point in the history
  • Loading branch information
JCapucho authored Oct 24, 2021
1 parent 70ad084 commit c3a0d71
Show file tree
Hide file tree
Showing 9 changed files with 71 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/back/spv/writer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,11 @@ impl Writer {
} else {
let argument_id = self.id_gen.next();
let instruction = Instruction::function_parameter(argument_type_id, argument_id);
if self.flags.contains(WriterFlags::DEBUG) {
if let Some(ref name) = argument.name {
self.debugs.push(Instruction::name(argument_id, name));
}
}
function.parameters.push(FunctionArgument {
instruction,
handle_id: if handle_ty {
Expand Down
1 change: 1 addition & 0 deletions tests/out/spv/access.spvasm
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ OpMemberName %26 2 "arr"
OpMemberName %26 3 "data"
OpName %26 "Bar"
OpName %30 "bar"
OpName %33 "foo"
OpName %34 "read_from_private"
OpName %38 "foo"
OpName %39 "c"
Expand Down
27 changes: 27 additions & 0 deletions tests/out/spv/bounds-check-image-restrict.spvasm
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,44 @@ OpName %36 "image_storage_1d"
OpName %38 "image_storage_2d"
OpName %40 "image_storage_2d_array"
OpName %42 "image_storage_3d"
OpName %45 "coords"
OpName %46 "level"
OpName %47 "test_textureLoad_1d"
OpName %60 "coords"
OpName %61 "level"
OpName %62 "test_textureLoad_2d"
OpName %75 "coords"
OpName %76 "index"
OpName %77 "level"
OpName %78 "test_textureLoad_2d_array"
OpName %92 "coords"
OpName %93 "level"
OpName %94 "test_textureLoad_3d"
OpName %107 "coords"
OpName %108 "sample"
OpName %109 "test_textureLoad_multisampled_2d"
OpName %121 "coords"
OpName %122 "level"
OpName %123 "test_textureLoad_depth_2d"
OpName %137 "coords"
OpName %138 "index"
OpName %139 "level"
OpName %140 "test_textureLoad_depth_2d_array"
OpName %155 "coords"
OpName %156 "sample"
OpName %157 "test_textureLoad_depth_multisampled_2d"
OpName %170 "coords"
OpName %171 "value"
OpName %172 "test_textureStore_1d"
OpName %180 "coords"
OpName %181 "value"
OpName %182 "test_textureStore_2d"
OpName %191 "coords"
OpName %192 "array_index"
OpName %193 "value"
OpName %194 "test_textureStore_2d_array"
OpName %204 "coords"
OpName %205 "value"
OpName %206 "test_textureStore_3d"
OpDecorate %20 DescriptorSet 0
OpDecorate %20 Binding 0
Expand Down
27 changes: 27 additions & 0 deletions tests/out/spv/bounds-check-image-rzsw.spvasm
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,44 @@ OpName %36 "image_storage_1d"
OpName %38 "image_storage_2d"
OpName %40 "image_storage_2d_array"
OpName %42 "image_storage_3d"
OpName %45 "coords"
OpName %46 "level"
OpName %47 "test_textureLoad_1d"
OpName %63 "coords"
OpName %64 "level"
OpName %65 "test_textureLoad_2d"
OpName %82 "coords"
OpName %83 "index"
OpName %84 "level"
OpName %85 "test_textureLoad_2d_array"
OpName %103 "coords"
OpName %104 "level"
OpName %105 "test_textureLoad_3d"
OpName %121 "coords"
OpName %122 "sample"
OpName %123 "test_textureLoad_multisampled_2d"
OpName %138 "coords"
OpName %139 "level"
OpName %140 "test_textureLoad_depth_2d"
OpName %157 "coords"
OpName %158 "index"
OpName %159 "level"
OpName %160 "test_textureLoad_depth_2d_array"
OpName %178 "coords"
OpName %179 "sample"
OpName %180 "test_textureLoad_depth_multisampled_2d"
OpName %196 "coords"
OpName %197 "value"
OpName %198 "test_textureStore_1d"
OpName %207 "coords"
OpName %208 "value"
OpName %209 "test_textureStore_2d"
OpName %219 "coords"
OpName %220 "array_index"
OpName %221 "value"
OpName %222 "test_textureStore_2d_array"
OpName %233 "coords"
OpName %234 "value"
OpName %235 "test_textureStore_3d"
OpDecorate %20 DescriptorSet 0
OpDecorate %20 Binding 0
Expand Down
1 change: 1 addition & 0 deletions tests/out/spv/collatz.spvasm
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ OpName %9 "PrimeIndices"
OpName %11 "v_indices"
OpName %13 "n"
OpName %15 "i"
OpName %17 "n_base"
OpName %18 "collatz_iterations"
OpName %45 "global_id"
OpName %48 "main"
Expand Down
3 changes: 3 additions & 0 deletions tests/out/spv/pointers.spvasm
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ OpMemberName %8 0 "array"
OpName %8 "DynamicArray"
OpName %10 "v"
OpName %13 "f"
OpName %20 "p"
OpName %21 "i"
OpName %22 "v"
OpName %23 "index_dynamic_array"
OpDecorate %7 ArrayStride 4
OpDecorate %8 Block
Expand Down
3 changes: 3 additions & 0 deletions tests/out/spv/policy-mix.spvasm
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ OpName %27 "image_2d_array"
OpName %29 "in_workgroup"
OpName %31 "in_private"
OpName %33 "in_function"
OpName %36 "c"
OpName %37 "i"
OpName %38 "l"
OpName %39 "mock_function"
OpDecorate %14 ArrayStride 16
OpDecorate %15 Block
Expand Down
2 changes: 2 additions & 0 deletions tests/out/spv/shadow.spvasm
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ OpName %25 "u_globals"
OpName %27 "s_lights"
OpName %29 "t_shadow"
OpName %31 "sampler_shadow"
OpName %34 "light_id"
OpName %35 "homogeneous_coords"
OpName %36 "fetch_shadow"
OpName %64 "color"
OpName %66 "i"
Expand Down
2 changes: 2 additions & 0 deletions tests/out/spv/texture-arg.spvasm
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ OpExecutionMode %28 OriginUpperLeft
OpSource GLSL 450
OpName %9 "Texture"
OpName %11 "Sampler"
OpName %14 "Passed_Texture"
OpName %16 "Passed_Sampler"
OpName %18 "test"
OpName %28 "main"
OpDecorate %9 DescriptorSet 0
Expand Down

0 comments on commit c3a0d71

Please sign in to comment.