test: Fix type of vertex_index builtin
This should be a u32, but we are missing validation rules for builtin types (opened crbug.com/tint/861 for this). This meant that we were generating invalid HLSL for this test. Change-Id: Ib2189d98e5e515e41374372c0f8963df04eb1b01 Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/53001 Auto-Submit: James Price <jrprice@google.com> Kokoro: Kokoro <noreply+kokoro@google.com> Commit-Queue: Antonio Maiorano <amaiorano@google.com> Reviewed-by: Antonio Maiorano <amaiorano@google.com>
This commit is contained in:
parent
815cfd14e7
commit
a7a23eaa9e
|
@ -19,7 +19,7 @@ let pos : array<vec2<f32>, 3> = array<vec2<f32>, 3>(
|
||||||
vec2<f32>(0.5, -0.5));
|
vec2<f32>(0.5, -0.5));
|
||||||
|
|
||||||
[[stage(vertex)]]
|
[[stage(vertex)]]
|
||||||
fn vtx_main([[builtin(vertex_index)]] VertexIndex : i32)
|
fn vtx_main([[builtin(vertex_index)]] VertexIndex : u32)
|
||||||
-> [[builtin(position)]] vec4<f32> {
|
-> [[builtin(position)]] vec4<f32> {
|
||||||
return vec4<f32>(pos[VertexIndex], 0.0, 1.0);
|
return vec4<f32>(pos[VertexIndex], 0.0, 1.0);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
struct tint_symbol_1 {
|
struct tint_symbol_1 {
|
||||||
int VertexIndex : SV_VertexID;
|
uint VertexIndex : SV_VertexID;
|
||||||
};
|
};
|
||||||
struct tint_symbol_2 {
|
struct tint_symbol_2 {
|
||||||
float4 value : SV_Position;
|
float4 value : SV_Position;
|
||||||
|
@ -10,7 +10,7 @@ struct tint_symbol_3 {
|
||||||
|
|
||||||
static const float2 pos[3] = {float2(0.0f, 0.5f), float2(-0.5f, -0.5f), float2(0.5f, -0.5f)};
|
static const float2 pos[3] = {float2(0.0f, 0.5f), float2(-0.5f, -0.5f), float2(0.5f, -0.5f)};
|
||||||
tint_symbol_2 vtx_main(tint_symbol_1 tint_symbol) {
|
tint_symbol_2 vtx_main(tint_symbol_1 tint_symbol) {
|
||||||
const int VertexIndex = tint_symbol.VertexIndex;
|
const uint VertexIndex = tint_symbol.VertexIndex;
|
||||||
const tint_symbol_2 tint_symbol_4 = {float4(pos[VertexIndex], 0.0f, 1.0f)};
|
const tint_symbol_2 tint_symbol_4 = {float4(pos[VertexIndex], 0.0f, 1.0f)};
|
||||||
return tint_symbol_4;
|
return tint_symbol_4;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
; SPIR-V
|
; SPIR-V
|
||||||
; Version: 1.3
|
; Version: 1.3
|
||||||
; Generator: Google Tint Compiler; 0
|
; Generator: Google Tint Compiler; 0
|
||||||
; Bound: 51
|
; Bound: 50
|
||||||
; Schema: 0
|
; Schema: 0
|
||||||
OpCapability Shader
|
OpCapability Shader
|
||||||
OpMemoryModel Logical GLSL450
|
OpMemoryModel Logical GLSL450
|
||||||
|
@ -40,50 +40,49 @@
|
||||||
%13 = OpConstantComposite %v2float %float_n0_5 %float_n0_5
|
%13 = OpConstantComposite %v2float %float_n0_5 %float_n0_5
|
||||||
%14 = OpConstantComposite %v2float %float_0_5 %float_n0_5
|
%14 = OpConstantComposite %v2float %float_0_5 %float_n0_5
|
||||||
%pos = OpConstantComposite %_arr_v2float_uint_3 %11 %13 %14
|
%pos = OpConstantComposite %_arr_v2float_uint_3 %11 %13 %14
|
||||||
%int = OpTypeInt 32 1
|
%_ptr_Input_uint = OpTypePointer Input %uint
|
||||||
%_ptr_Input_int = OpTypePointer Input %int
|
%tint_symbol = OpVariable %_ptr_Input_uint Input
|
||||||
%tint_symbol = OpVariable %_ptr_Input_int Input
|
|
||||||
%v4float = OpTypeVector %float 4
|
%v4float = OpTypeVector %float 4
|
||||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||||
%22 = OpConstantNull %v4float
|
%21 = OpConstantNull %v4float
|
||||||
%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %22
|
%tint_symbol_2 = OpVariable %_ptr_Output_v4float Output %21
|
||||||
%tint_symbol_5 = OpVariable %_ptr_Output_v4float Output %22
|
%tint_symbol_5 = OpVariable %_ptr_Output_v4float Output %21
|
||||||
%void = OpTypeVoid
|
%void = OpTypeVoid
|
||||||
%24 = OpTypeFunction %void %v4float
|
%23 = OpTypeFunction %void %v4float
|
||||||
%29 = OpTypeFunction %void
|
%28 = OpTypeFunction %void
|
||||||
%float_1 = OpConstant %float 1
|
%float_1 = OpConstant %float 1
|
||||||
%_ptr_Function__arr_v2float_uint_3 = OpTypePointer Function %_arr_v2float_uint_3
|
%_ptr_Function__arr_v2float_uint_3 = OpTypePointer Function %_arr_v2float_uint_3
|
||||||
%35 = OpConstantNull %_arr_v2float_uint_3
|
%34 = OpConstantNull %_arr_v2float_uint_3
|
||||||
%_ptr_Function_v2float = OpTypePointer Function %v2float
|
%_ptr_Function_v2float = OpTypePointer Function %v2float
|
||||||
%50 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1
|
%49 = OpConstantComposite %v4float %float_1 %float_0 %float_0 %float_1
|
||||||
%tint_symbol_3 = OpFunction %void None %24
|
%tint_symbol_3 = OpFunction %void None %23
|
||||||
%tint_symbol_1 = OpFunctionParameter %v4float
|
%tint_symbol_1 = OpFunctionParameter %v4float
|
||||||
%28 = OpLabel
|
%27 = OpLabel
|
||||||
OpStore %tint_symbol_2 %tint_symbol_1
|
OpStore %tint_symbol_2 %tint_symbol_1
|
||||||
OpReturn
|
OpReturn
|
||||||
OpFunctionEnd
|
OpFunctionEnd
|
||||||
%vtx_main = OpFunction %void None %29
|
%vtx_main = OpFunction %void None %28
|
||||||
%31 = OpLabel
|
%30 = OpLabel
|
||||||
%var_for_index = OpVariable %_ptr_Function__arr_v2float_uint_3 Function %35
|
%var_for_index = OpVariable %_ptr_Function__arr_v2float_uint_3 Function %34
|
||||||
OpStore %tint_pointsize %float_1
|
OpStore %tint_pointsize %float_1
|
||||||
OpStore %var_for_index %pos
|
OpStore %var_for_index %pos
|
||||||
%37 = OpLoad %int %tint_symbol
|
%36 = OpLoad %uint %tint_symbol
|
||||||
%39 = OpAccessChain %_ptr_Function_v2float %var_for_index %37
|
%38 = OpAccessChain %_ptr_Function_v2float %var_for_index %36
|
||||||
%40 = OpLoad %v2float %39
|
%39 = OpLoad %v2float %38
|
||||||
%41 = OpCompositeExtract %float %40 0
|
%40 = OpCompositeExtract %float %39 0
|
||||||
%42 = OpCompositeExtract %float %40 1
|
%41 = OpCompositeExtract %float %39 1
|
||||||
%43 = OpCompositeConstruct %v4float %41 %42 %float_0 %float_1
|
%42 = OpCompositeConstruct %v4float %40 %41 %float_0 %float_1
|
||||||
%36 = OpFunctionCall %void %tint_symbol_3 %43
|
%35 = OpFunctionCall %void %tint_symbol_3 %42
|
||||||
OpReturn
|
OpReturn
|
||||||
OpFunctionEnd
|
OpFunctionEnd
|
||||||
%tint_symbol_6 = OpFunction %void None %24
|
%tint_symbol_6 = OpFunction %void None %23
|
||||||
%tint_symbol_4 = OpFunctionParameter %v4float
|
%tint_symbol_4 = OpFunctionParameter %v4float
|
||||||
%46 = OpLabel
|
%45 = OpLabel
|
||||||
OpStore %tint_symbol_5 %tint_symbol_4
|
OpStore %tint_symbol_5 %tint_symbol_4
|
||||||
OpReturn
|
OpReturn
|
||||||
OpFunctionEnd
|
OpFunctionEnd
|
||||||
%frag_main = OpFunction %void None %29
|
%frag_main = OpFunction %void None %28
|
||||||
%48 = OpLabel
|
%47 = OpLabel
|
||||||
%49 = OpFunctionCall %void %tint_symbol_6 %50
|
%48 = OpFunctionCall %void %tint_symbol_6 %49
|
||||||
OpReturn
|
OpReturn
|
||||||
OpFunctionEnd
|
OpFunctionEnd
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
let pos : array<vec2<f32>, 3> = array<vec2<f32>, 3>(vec2<f32>(0.0, 0.5), vec2<f32>(-0.5, -0.5), vec2<f32>(0.5, -0.5));
|
let pos : array<vec2<f32>, 3> = array<vec2<f32>, 3>(vec2<f32>(0.0, 0.5), vec2<f32>(-0.5, -0.5), vec2<f32>(0.5, -0.5));
|
||||||
|
|
||||||
[[stage(vertex)]]
|
[[stage(vertex)]]
|
||||||
fn vtx_main([[builtin(vertex_index)]] VertexIndex : i32) -> [[builtin(position)]] vec4<f32> {
|
fn vtx_main([[builtin(vertex_index)]] VertexIndex : u32) -> [[builtin(position)]] vec4<f32> {
|
||||||
return vec4<f32>(pos[VertexIndex], 0.0, 1.0);
|
return vec4<f32>(pos[VertexIndex], 0.0, 1.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue