mirror of
https://github.com/storytold/wgpu.git
synced 2026-11-29 09:34:09 +01:00
Tweak access.wgsl to avoid #913 and make SPIR-V more distinctive.
This commit is contained in:
1 parent
8376bab562
commit
b8724eb1fd
4 files changed
+18
-17
No files matched your search
@@ -19,7 +19,7 @@ fn foo([[builtin(vertex_index)]] vi: u32) -> [[builtin(position)]] vec4<f32> {
|
||||
let index = 3u;
|
||||
let b = bar.matrix[index].x;
|
||||
|
||||
let a = bar.data[arrayLength(&bar.data) - 1u];
|
||||
let a = bar.data[arrayLength(&bar.data) - 2u];
|
||||
|
||||
var c: array<i32, 5> = array<i32, 5>(a, i32(b), 3, 4, 5);
|
||||
let value = c[vi];
|
||||
|
||||
@@ -30,7 +30,7 @@ vertex fooOutput foo(
|
||||
foo1 = 1.0;
|
||||
metal::float4 _e9 = bar.matrix[3];
|
||||
float b = _e9.x;
|
||||
int a = bar.data[(1 + (_buffer_sizes.size0 - 64 - 4) / 4) - 1u];
|
||||
int a = bar.data[(1 + (_buffer_sizes.size0 - 64 - 4) / 4) - 2u];
|
||||
for(int _i=0; _i<5; ++_i) c.inner[_i] = type6 {a, static_cast<int>(b), 3, 4, 5}.inner[_i];
|
||||
int value = c.inner[vi];
|
||||
return fooOutput { static_cast<float4>(metal::int4(value)) };
|
||||
|
||||
+15
-14
@@ -1,7 +1,7 @@
|
||||
; SPIR-V
|
||||
; Version: 1.1
|
||||
; Generator: rspirv
|
||||
; Bound: 54
|
||||
; Bound: 55
|
||||
OpCapability Shader
|
||||
OpExtension "SPV_KHR_storage_buffer_storage_class"
|
||||
%1 = OpExtInstImport "GLSL.std.450"
|
||||
@@ -33,7 +33,7 @@ OpDecorate %28 BuiltIn Position
|
||||
%5 = OpConstant %4 1.0
|
||||
%7 = OpTypeInt 32 0
|
||||
%6 = OpConstant %7 3
|
||||
%8 = OpConstant %7 1
|
||||
%8 = OpConstant %7 2
|
||||
%10 = OpTypeInt 32 1
|
||||
%9 = OpConstant %10 5
|
||||
%11 = OpConstant %10 3
|
||||
@@ -57,8 +57,9 @@ OpDecorate %28 BuiltIn Position
|
||||
%36 = OpConstant %7 0
|
||||
%40 = OpTypePointer StorageBuffer %15
|
||||
%43 = OpTypePointer StorageBuffer %10
|
||||
%48 = OpTypePointer Function %10
|
||||
%51 = OpTypeVector %10 4
|
||||
%44 = OpConstant %7 1
|
||||
%49 = OpTypePointer Function %10
|
||||
%52 = OpTypeVector %10 4
|
||||
%30 = OpFunction %2 None %31
|
||||
%24 = OpLabel
|
||||
%20 = OpVariable %21 Function %3
|
||||
@@ -73,15 +74,15 @@ OpStore %20 %5
|
||||
%39 = OpCompositeExtract %4 %38 0
|
||||
%41 = OpArrayLength %7 %18 1
|
||||
%42 = OpISub %7 %41 %8
|
||||
%44 = OpAccessChain %43 %18 %8 %42
|
||||
%45 = OpLoad %10 %44
|
||||
%46 = OpConvertFToS %10 %39
|
||||
%47 = OpCompositeConstruct %17 %45 %46 %11 %12 %9
|
||||
OpStore %22 %47
|
||||
%49 = OpAccessChain %48 %22 %27
|
||||
%50 = OpLoad %10 %49
|
||||
%52 = OpCompositeConstruct %51 %50 %50 %50 %50
|
||||
%53 = OpConvertSToF %14 %52
|
||||
OpStore %28 %53
|
||||
%45 = OpAccessChain %43 %18 %44 %42
|
||||
%46 = OpLoad %10 %45
|
||||
%47 = OpConvertFToS %10 %39
|
||||
%48 = OpCompositeConstruct %17 %46 %47 %11 %12 %9
|
||||
OpStore %22 %48
|
||||
%50 = OpAccessChain %49 %22 %27
|
||||
%51 = OpLoad %10 %50
|
||||
%53 = OpCompositeConstruct %52 %51 %51 %51 %51
|
||||
%54 = OpConvertSToF %14 %53
|
||||
OpStore %28 %54
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
@@ -16,7 +16,7 @@ fn foo([[builtin(vertex_index)]] vi: u32) -> [[builtin(position)]] vec4<f32> {
|
||||
foo1 = 1.0;
|
||||
let _e9: vec4<f32> = bar.matrix[3];
|
||||
let b: f32 = _e9.x;
|
||||
let a: i32 = bar.data[(arrayLength(&bar.data) - 1u)];
|
||||
let a: i32 = bar.data[(arrayLength(&bar.data) - 2u)];
|
||||
c = array<i32,5>(a, i32(b), 3, 4, 5);
|
||||
let value: i32 = c[vi];
|
||||
return vec4<f32>(vec4<i32>(value));
|
||||
|
||||
Reference in new issue
Block a user