mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-17 08:57:26 +00:00
Tint/transform: make AddBlockAttribute always do wrapping if possible
This CL make transform AddBlockAttribute always try to wrap types used by buffer variables into a struct, in order to generate valid GLSL code for assigning one buffer struct variable to another buffer struct variable. Fixed: tint:1735 Change-Id: I009d8a9ca7ecea1dc0ad6164275c964a18acb33f Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/108023 Kokoro: Kokoro <noreply+kokoro@google.com> Reviewed-by: Ben Clayton <bclayton@google.com> Commit-Queue: Zhaoming Jiang <zhaoming.jiang@intel.com>
This commit is contained in:
committed by
Dawn LUCI CQ
parent
2bea9055f4
commit
6ab5d3c151
@@ -1,14 +1,18 @@
|
||||
#version 310 es
|
||||
precision mediump float;
|
||||
|
||||
layout(binding = 0, std140) uniform S_ubo {
|
||||
struct S {
|
||||
mat4x3 matrix;
|
||||
vec3 vector;
|
||||
uint pad;
|
||||
};
|
||||
|
||||
layout(binding = 0, std140) uniform data_block_ubo {
|
||||
S inner;
|
||||
} data;
|
||||
|
||||
void tint_symbol() {
|
||||
vec4 x = (data.vector * data.matrix);
|
||||
vec4 x = (data.inner.vector * data.inner.matrix);
|
||||
}
|
||||
|
||||
void main() {
|
||||
|
||||
@@ -1,18 +1,21 @@
|
||||
; SPIR-V
|
||||
; Version: 1.3
|
||||
; Generator: Google Tint Compiler; 0
|
||||
; Bound: 22
|
||||
; Bound: 23
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Fragment %main "main"
|
||||
OpExecutionMode %main OriginUpperLeft
|
||||
OpName %data_block "data_block"
|
||||
OpMemberName %data_block 0 "inner"
|
||||
OpName %S "S"
|
||||
OpMemberName %S 0 "matrix"
|
||||
OpMemberName %S 1 "vector"
|
||||
OpName %data "data"
|
||||
OpName %main "main"
|
||||
OpDecorate %S Block
|
||||
OpDecorate %data_block Block
|
||||
OpMemberDecorate %data_block 0 Offset 0
|
||||
OpMemberDecorate %S 0 Offset 0
|
||||
OpMemberDecorate %S 0 ColMajor
|
||||
OpMemberDecorate %S 0 MatrixStride 16
|
||||
@@ -24,22 +27,23 @@
|
||||
%v3float = OpTypeVector %float 3
|
||||
%mat4v3float = OpTypeMatrix %v3float 4
|
||||
%S = OpTypeStruct %mat4v3float %v3float
|
||||
%_ptr_Uniform_S = OpTypePointer Uniform %S
|
||||
%data = OpVariable %_ptr_Uniform_S Uniform
|
||||
%data_block = OpTypeStruct %S
|
||||
%_ptr_Uniform_data_block = OpTypePointer Uniform %data_block
|
||||
%data = OpVariable %_ptr_Uniform_data_block Uniform
|
||||
%void = OpTypeVoid
|
||||
%7 = OpTypeFunction %void
|
||||
%8 = OpTypeFunction %void
|
||||
%uint = OpTypeInt 32 0
|
||||
%uint_0 = OpConstant %uint 0
|
||||
%uint_1 = OpConstant %uint 1
|
||||
%_ptr_Uniform_v3float = OpTypePointer Uniform %v3float
|
||||
%uint_0 = OpConstant %uint 0
|
||||
%_ptr_Uniform_mat4v3float = OpTypePointer Uniform %mat4v3float
|
||||
%v4float = OpTypeVector %float 4
|
||||
%main = OpFunction %void None %7
|
||||
%10 = OpLabel
|
||||
%14 = OpAccessChain %_ptr_Uniform_v3float %data %uint_1
|
||||
%15 = OpLoad %v3float %14
|
||||
%18 = OpAccessChain %_ptr_Uniform_mat4v3float %data %uint_0
|
||||
%19 = OpLoad %mat4v3float %18
|
||||
%20 = OpVectorTimesMatrix %v4float %15 %19
|
||||
%main = OpFunction %void None %8
|
||||
%11 = OpLabel
|
||||
%16 = OpAccessChain %_ptr_Uniform_v3float %data %uint_0 %uint_1
|
||||
%17 = OpLoad %v3float %16
|
||||
%19 = OpAccessChain %_ptr_Uniform_mat4v3float %data %uint_0 %uint_0
|
||||
%20 = OpLoad %mat4v3float %19
|
||||
%21 = OpVectorTimesMatrix %v4float %17 %20
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
|
||||
Reference in New Issue
Block a user