mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-09 13:38:00 +00:00
writer[spirv,hlsl]: Call UnwrapRef() for splats
The TypeConstructorExpression logic that tested for splats was not considering references. This led to broken emission for the SPIR-V and HLSL backends. Fixed: tint:992 Change-Id: I9824b71f526997f91d380c09b459f4fd73065b19 Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/58397 Auto-Submit: Ben Clayton <bclayton@google.com> Commit-Queue: David Neto <dneto@google.com> Kokoro: Kokoro <noreply+kokoro@google.com> Reviewed-by: David Neto <dneto@google.com>
This commit is contained in:
committed by
Tint LUCI CQ
parent
76feb6b626
commit
595b0547d4
6
test/bug/tint/992.wgsl
Normal file
6
test/bug/tint/992.wgsl
Normal file
@@ -0,0 +1,6 @@
|
||||
[[stage(fragment)]]
|
||||
fn frag_main() -> [[location(0)]] vec4<f32> {
|
||||
var b: f32 = 0.0;
|
||||
var v: vec3<f32> = vec3<f32>(b);
|
||||
return vec4<f32>(v, 1.0);
|
||||
}
|
||||
10
test/bug/tint/992.wgsl.expected.hlsl
Normal file
10
test/bug/tint/992.wgsl.expected.hlsl
Normal file
@@ -0,0 +1,10 @@
|
||||
struct tint_symbol {
|
||||
float4 value : SV_Target0;
|
||||
};
|
||||
|
||||
tint_symbol frag_main() {
|
||||
float b = 0.0f;
|
||||
float3 v = float3((b).xxx);
|
||||
const tint_symbol tint_symbol_1 = {float4(v, 1.0f)};
|
||||
return tint_symbol_1;
|
||||
}
|
||||
14
test/bug/tint/992.wgsl.expected.msl
Normal file
14
test/bug/tint/992.wgsl.expected.msl
Normal file
@@ -0,0 +1,14 @@
|
||||
#include <metal_stdlib>
|
||||
|
||||
using namespace metal;
|
||||
struct tint_symbol {
|
||||
float4 value [[color(0)]];
|
||||
};
|
||||
|
||||
fragment tint_symbol frag_main() {
|
||||
float b = 0.0f;
|
||||
float3 v = float3(b);
|
||||
tint_symbol const tint_symbol_1 = {.value=float4(v, 1.0f)};
|
||||
return tint_symbol_1;
|
||||
}
|
||||
|
||||
53
test/bug/tint/992.wgsl.expected.spvasm
Normal file
53
test/bug/tint/992.wgsl.expected.spvasm
Normal file
@@ -0,0 +1,53 @@
|
||||
; SPIR-V
|
||||
; Version: 1.3
|
||||
; Generator: Google Tint Compiler; 0
|
||||
; Bound: 31
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %frag_main "frag_main" %tint_symbol_1
|
||||
OpExecutionMode %frag_main OriginUpperLeft
|
||||
OpName %tint_symbol_1 "tint_symbol_1"
|
||||
OpName %tint_symbol_2 "tint_symbol_2"
|
||||
OpName %tint_symbol "tint_symbol"
|
||||
OpName %frag_main "frag_main"
|
||||
OpName %b "b"
|
||||
OpName %v "v"
|
||||
OpDecorate %tint_symbol_1 Location 0
|
||||
%float = OpTypeFloat 32
|
||||
%v4float = OpTypeVector %float 4
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%5 = OpConstantNull %v4float
|
||||
%tint_symbol_1 = OpVariable %_ptr_Output_v4float Output %5
|
||||
%void = OpTypeVoid
|
||||
%6 = OpTypeFunction %void %v4float
|
||||
%11 = OpTypeFunction %void
|
||||
%float_0 = OpConstant %float 0
|
||||
%_ptr_Function_float = OpTypePointer Function %float
|
||||
%17 = OpConstantNull %float
|
||||
%v3float = OpTypeVector %float 3
|
||||
%_ptr_Function_v3float = OpTypePointer Function %v3float
|
||||
%23 = OpConstantNull %v3float
|
||||
%float_1 = OpConstant %float 1
|
||||
%tint_symbol_2 = OpFunction %void None %6
|
||||
%tint_symbol = OpFunctionParameter %v4float
|
||||
%10 = OpLabel
|
||||
OpStore %tint_symbol_1 %tint_symbol
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%frag_main = OpFunction %void None %11
|
||||
%13 = OpLabel
|
||||
%b = OpVariable %_ptr_Function_float Function %17
|
||||
%v = OpVariable %_ptr_Function_v3float Function %23
|
||||
OpStore %b %float_0
|
||||
%19 = OpLoad %float %b
|
||||
%20 = OpCompositeConstruct %v3float %19 %19 %19
|
||||
OpStore %v %20
|
||||
%25 = OpLoad %v3float %v
|
||||
%26 = OpCompositeExtract %float %25 0
|
||||
%27 = OpCompositeExtract %float %25 1
|
||||
%28 = OpCompositeExtract %float %25 2
|
||||
%30 = OpCompositeConstruct %v4float %26 %27 %28 %float_1
|
||||
%24 = OpFunctionCall %void %tint_symbol_2 %30
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
6
test/bug/tint/992.wgsl.expected.wgsl
Normal file
6
test/bug/tint/992.wgsl.expected.wgsl
Normal file
@@ -0,0 +1,6 @@
|
||||
[[stage(fragment)]]
|
||||
fn frag_main() -> [[location(0)]] vec4<f32> {
|
||||
var b : f32 = 0.0;
|
||||
var v : vec3<f32> = vec3<f32>(b);
|
||||
return vec4<f32>(v, 1.0);
|
||||
}
|
||||
Reference in New Issue
Block a user