mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-16 00:17:03 +00:00
Implement External Texture Crop Functionality
Adds to the External Texture shader transform to allow cropping. Tests included. Bug: chromium:1316671 Change-Id: Id0ec9acac22a0968ba6847d6ead9cf5084eaca88 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/113281 Commit-Queue: Austin Eng <enga@chromium.org> Reviewed-by: Ben Clayton <bclayton@google.com> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Kokoro: Kokoro <noreply+kokoro@google.com>
This commit is contained in:
committed by
Dawn LUCI CQ
parent
0be08d8b88
commit
183df9d24e
@@ -1,7 +1,7 @@
|
||||
; SPIR-V
|
||||
; Version: 1.3
|
||||
; Generator: Google Tint Compiler; 0
|
||||
; Bound: 163
|
||||
; Bound: 147
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
%29 = OpExtInstImport "GLSL.std.450"
|
||||
@@ -14,13 +14,13 @@
|
||||
OpName %value "value"
|
||||
OpName %vertex_point_size "vertex_point_size"
|
||||
OpName %ext_tex_plane_1 "ext_tex_plane_1"
|
||||
OpName %ext_tex_params_block_std140 "ext_tex_params_block_std140"
|
||||
OpMemberName %ext_tex_params_block_std140 0 "inner"
|
||||
OpName %ExternalTextureParams_std140 "ExternalTextureParams_std140"
|
||||
OpMemberName %ExternalTextureParams_std140 0 "numPlanes"
|
||||
OpMemberName %ExternalTextureParams_std140 1 "doYuvToRgbConversionOnly"
|
||||
OpMemberName %ExternalTextureParams_std140 2 "yuvToRgbConversionMatrix"
|
||||
OpMemberName %ExternalTextureParams_std140 3 "gammaDecodeParams"
|
||||
OpName %ext_tex_params_block "ext_tex_params_block"
|
||||
OpMemberName %ext_tex_params_block 0 "inner"
|
||||
OpName %ExternalTextureParams "ExternalTextureParams"
|
||||
OpMemberName %ExternalTextureParams 0 "numPlanes"
|
||||
OpMemberName %ExternalTextureParams 1 "doYuvToRgbConversionOnly"
|
||||
OpMemberName %ExternalTextureParams 2 "yuvToRgbConversionMatrix"
|
||||
OpMemberName %ExternalTextureParams 3 "gammaDecodeParams"
|
||||
OpName %GammaTransferParams "GammaTransferParams"
|
||||
OpMemberName %GammaTransferParams 0 "G"
|
||||
OpMemberName %GammaTransferParams 1 "A"
|
||||
@@ -30,23 +30,14 @@
|
||||
OpMemberName %GammaTransferParams 5 "E"
|
||||
OpMemberName %GammaTransferParams 6 "F"
|
||||
OpMemberName %GammaTransferParams 7 "padding"
|
||||
OpMemberName %ExternalTextureParams_std140 4 "gammaEncodeParams"
|
||||
OpMemberName %ExternalTextureParams_std140 5 "gamutConversionMatrix"
|
||||
OpMemberName %ExternalTextureParams_std140 6 "rotationMatrix_0"
|
||||
OpMemberName %ExternalTextureParams_std140 7 "rotationMatrix_1"
|
||||
OpMemberName %ExternalTextureParams 4 "gammaEncodeParams"
|
||||
OpMemberName %ExternalTextureParams 5 "gamutConversionMatrix"
|
||||
OpMemberName %ExternalTextureParams 6 "coordTransformationMatrix"
|
||||
OpName %ext_tex_params "ext_tex_params"
|
||||
OpName %arg_0 "arg_0"
|
||||
OpName %gammaCorrection "gammaCorrection"
|
||||
OpName %v "v"
|
||||
OpName %params "params"
|
||||
OpName %ExternalTextureParams "ExternalTextureParams"
|
||||
OpMemberName %ExternalTextureParams 0 "numPlanes"
|
||||
OpMemberName %ExternalTextureParams 1 "doYuvToRgbConversionOnly"
|
||||
OpMemberName %ExternalTextureParams 2 "yuvToRgbConversionMatrix"
|
||||
OpMemberName %ExternalTextureParams 3 "gammaDecodeParams"
|
||||
OpMemberName %ExternalTextureParams 4 "gammaEncodeParams"
|
||||
OpMemberName %ExternalTextureParams 5 "gamutConversionMatrix"
|
||||
OpMemberName %ExternalTextureParams 6 "rotationMatrix"
|
||||
OpName %textureLoadExternal "textureLoadExternal"
|
||||
OpName %plane0 "plane0"
|
||||
OpName %plane1 "plane1"
|
||||
@@ -58,8 +49,6 @@
|
||||
OpName %ext_tex_plane_1_1 "ext_tex_plane_1_1"
|
||||
OpName %ext_tex_params_1 "ext_tex_params_1"
|
||||
OpName %coords "coords"
|
||||
OpName %conv_ExternalTextureParams "conv_ExternalTextureParams"
|
||||
OpName %val "val"
|
||||
OpName %doTextureLoad "doTextureLoad"
|
||||
OpName %res "res"
|
||||
OpName %vertex_main_inner "vertex_main_inner"
|
||||
@@ -70,14 +59,14 @@
|
||||
OpDecorate %vertex_point_size BuiltIn PointSize
|
||||
OpDecorate %ext_tex_plane_1 DescriptorSet 1
|
||||
OpDecorate %ext_tex_plane_1 Binding 1
|
||||
OpDecorate %ext_tex_params_block_std140 Block
|
||||
OpMemberDecorate %ext_tex_params_block_std140 0 Offset 0
|
||||
OpMemberDecorate %ExternalTextureParams_std140 0 Offset 0
|
||||
OpMemberDecorate %ExternalTextureParams_std140 1 Offset 4
|
||||
OpMemberDecorate %ExternalTextureParams_std140 2 Offset 16
|
||||
OpMemberDecorate %ExternalTextureParams_std140 2 ColMajor
|
||||
OpMemberDecorate %ExternalTextureParams_std140 2 MatrixStride 16
|
||||
OpMemberDecorate %ExternalTextureParams_std140 3 Offset 64
|
||||
OpDecorate %ext_tex_params_block Block
|
||||
OpMemberDecorate %ext_tex_params_block 0 Offset 0
|
||||
OpMemberDecorate %ExternalTextureParams 0 Offset 0
|
||||
OpMemberDecorate %ExternalTextureParams 1 Offset 4
|
||||
OpMemberDecorate %ExternalTextureParams 2 Offset 16
|
||||
OpMemberDecorate %ExternalTextureParams 2 ColMajor
|
||||
OpMemberDecorate %ExternalTextureParams 2 MatrixStride 16
|
||||
OpMemberDecorate %ExternalTextureParams 3 Offset 64
|
||||
OpMemberDecorate %GammaTransferParams 0 Offset 0
|
||||
OpMemberDecorate %GammaTransferParams 1 Offset 4
|
||||
OpMemberDecorate %GammaTransferParams 2 Offset 8
|
||||
@@ -86,30 +75,18 @@
|
||||
OpMemberDecorate %GammaTransferParams 5 Offset 20
|
||||
OpMemberDecorate %GammaTransferParams 6 Offset 24
|
||||
OpMemberDecorate %GammaTransferParams 7 Offset 28
|
||||
OpMemberDecorate %ExternalTextureParams_std140 4 Offset 96
|
||||
OpMemberDecorate %ExternalTextureParams_std140 5 Offset 128
|
||||
OpMemberDecorate %ExternalTextureParams_std140 5 ColMajor
|
||||
OpMemberDecorate %ExternalTextureParams_std140 5 MatrixStride 16
|
||||
OpMemberDecorate %ExternalTextureParams_std140 6 Offset 176
|
||||
OpMemberDecorate %ExternalTextureParams_std140 7 Offset 184
|
||||
OpDecorate %ext_tex_params NonWritable
|
||||
OpDecorate %ext_tex_params DescriptorSet 1
|
||||
OpDecorate %ext_tex_params Binding 2
|
||||
OpDecorate %arg_0 DescriptorSet 1
|
||||
OpDecorate %arg_0 Binding 0
|
||||
OpMemberDecorate %ExternalTextureParams 0 Offset 0
|
||||
OpMemberDecorate %ExternalTextureParams 1 Offset 4
|
||||
OpMemberDecorate %ExternalTextureParams 2 Offset 16
|
||||
OpMemberDecorate %ExternalTextureParams 2 ColMajor
|
||||
OpMemberDecorate %ExternalTextureParams 2 MatrixStride 16
|
||||
OpMemberDecorate %ExternalTextureParams 3 Offset 64
|
||||
OpMemberDecorate %ExternalTextureParams 4 Offset 96
|
||||
OpMemberDecorate %ExternalTextureParams 5 Offset 128
|
||||
OpMemberDecorate %ExternalTextureParams 5 ColMajor
|
||||
OpMemberDecorate %ExternalTextureParams 5 MatrixStride 16
|
||||
OpMemberDecorate %ExternalTextureParams 6 Offset 176
|
||||
OpMemberDecorate %ExternalTextureParams 6 ColMajor
|
||||
OpMemberDecorate %ExternalTextureParams 6 MatrixStride 8
|
||||
OpMemberDecorate %ExternalTextureParams 6 MatrixStride 16
|
||||
OpDecorate %ext_tex_params NonWritable
|
||||
OpDecorate %ext_tex_params DescriptorSet 1
|
||||
OpDecorate %ext_tex_params Binding 2
|
||||
OpDecorate %arg_0 DescriptorSet 1
|
||||
OpDecorate %arg_0 Binding 0
|
||||
%float = OpTypeFloat 32
|
||||
%v4float = OpTypeVector %float 4
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
@@ -126,11 +103,11 @@
|
||||
%GammaTransferParams = OpTypeStruct %float %float %float %float %float %float %float %uint
|
||||
%v3float = OpTypeVector %float 3
|
||||
%mat3v3float = OpTypeMatrix %v3float 3
|
||||
%v2float = OpTypeVector %float 2
|
||||
%ExternalTextureParams_std140 = OpTypeStruct %uint %uint %mat3v4float %GammaTransferParams %GammaTransferParams %mat3v3float %v2float %v2float
|
||||
%ext_tex_params_block_std140 = OpTypeStruct %ExternalTextureParams_std140
|
||||
%_ptr_Uniform_ext_tex_params_block_std140 = OpTypePointer Uniform %ext_tex_params_block_std140
|
||||
%ext_tex_params = OpVariable %_ptr_Uniform_ext_tex_params_block_std140 Uniform
|
||||
%mat2v3float = OpTypeMatrix %v3float 2
|
||||
%ExternalTextureParams = OpTypeStruct %uint %uint %mat3v4float %GammaTransferParams %GammaTransferParams %mat3v3float %mat2v3float
|
||||
%ext_tex_params_block = OpTypeStruct %ExternalTextureParams
|
||||
%_ptr_Uniform_ext_tex_params_block = OpTypePointer Uniform %ext_tex_params_block
|
||||
%ext_tex_params = OpVariable %_ptr_Uniform_ext_tex_params_block Uniform
|
||||
%arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
|
||||
%23 = OpTypeFunction %v3float %v3float %GammaTransferParams
|
||||
%bool = OpTypeBool
|
||||
@@ -139,22 +116,20 @@
|
||||
%43 = OpConstantNull %v3float
|
||||
%int = OpTypeInt 32 1
|
||||
%v2int = OpTypeVector %int 2
|
||||
%mat2v2float = OpTypeMatrix %v2float 2
|
||||
%ExternalTextureParams = OpTypeStruct %uint %uint %mat3v4float %GammaTransferParams %GammaTransferParams %mat3v3float %mat2v2float
|
||||
%63 = OpTypeFunction %v4float %11 %11 %v2int %ExternalTextureParams
|
||||
%uint_1 = OpConstant %uint 1
|
||||
%82 = OpConstantNull %int
|
||||
%80 = OpConstantNull %int
|
||||
%v2float = OpTypeVector %float 2
|
||||
%float_1 = OpConstant %float 1
|
||||
%95 = OpConstantNull %uint
|
||||
%113 = OpTypeFunction %v4float %11 %11 %ExternalTextureParams %v2int
|
||||
%121 = OpTypeFunction %ExternalTextureParams %ExternalTextureParams_std140
|
||||
%94 = OpConstantNull %uint
|
||||
%112 = OpTypeFunction %v4float %11 %11 %ExternalTextureParams %v2int
|
||||
%void = OpTypeVoid
|
||||
%135 = OpTypeFunction %void
|
||||
%120 = OpTypeFunction %void
|
||||
%uint_0 = OpConstant %uint 0
|
||||
%_ptr_Uniform_ExternalTextureParams_std140 = OpTypePointer Uniform %ExternalTextureParams_std140
|
||||
%147 = OpConstantNull %v2int
|
||||
%_ptr_Uniform_ExternalTextureParams = OpTypePointer Uniform %ExternalTextureParams
|
||||
%131 = OpConstantNull %v2int
|
||||
%_ptr_Function_v4float = OpTypePointer Function %v4float
|
||||
%150 = OpTypeFunction %v4float
|
||||
%134 = OpTypeFunction %v4float
|
||||
%gammaCorrection = OpFunction %v3float None %23
|
||||
%v = OpFunctionParameter %v3float
|
||||
%params = OpFunctionParameter %GammaTransferParams
|
||||
@@ -196,111 +171,95 @@
|
||||
%plane1 = OpFunctionParameter %11
|
||||
%coord = OpFunctionParameter %v2int
|
||||
%params_0 = OpFunctionParameter %ExternalTextureParams
|
||||
%73 = OpLabel
|
||||
%71 = OpLabel
|
||||
%color = OpVariable %_ptr_Function_v3float Function %43
|
||||
%75 = OpCompositeExtract %uint %params_0 0
|
||||
%77 = OpIEqual %bool %75 %uint_1
|
||||
OpSelectionMerge %78 None
|
||||
OpBranchConditional %77 %79 %80
|
||||
%79 = OpLabel
|
||||
%81 = OpImageFetch %v4float %plane0 %coord Lod %82
|
||||
%83 = OpVectorShuffle %v3float %81 %81 0 1 2
|
||||
OpStore %color %83
|
||||
OpBranch %78
|
||||
%80 = OpLabel
|
||||
%84 = OpImageFetch %v4float %plane0 %coord Lod %82
|
||||
%85 = OpCompositeExtract %float %84 0
|
||||
%86 = OpImageFetch %v4float %plane1 %coord Lod %82
|
||||
%87 = OpVectorShuffle %v2float %86 %86 0 1
|
||||
%88 = OpCompositeExtract %float %87 0
|
||||
%89 = OpCompositeExtract %float %87 1
|
||||
%91 = OpCompositeConstruct %v4float %85 %88 %89 %float_1
|
||||
%92 = OpCompositeExtract %mat3v4float %params_0 2
|
||||
%93 = OpVectorTimesMatrix %v3float %91 %92
|
||||
OpStore %color %93
|
||||
OpBranch %78
|
||||
%73 = OpCompositeExtract %uint %params_0 0
|
||||
%75 = OpIEqual %bool %73 %uint_1
|
||||
OpSelectionMerge %76 None
|
||||
OpBranchConditional %75 %77 %78
|
||||
%77 = OpLabel
|
||||
%79 = OpImageFetch %v4float %plane0 %coord Lod %80
|
||||
%81 = OpVectorShuffle %v3float %79 %79 0 1 2
|
||||
OpStore %color %81
|
||||
OpBranch %76
|
||||
%78 = OpLabel
|
||||
%94 = OpCompositeExtract %uint %params_0 1
|
||||
%96 = OpIEqual %bool %94 %95
|
||||
OpSelectionMerge %97 None
|
||||
OpBranchConditional %96 %98 %97
|
||||
%98 = OpLabel
|
||||
%100 = OpLoad %v3float %color
|
||||
%101 = OpCompositeExtract %GammaTransferParams %params_0 3
|
||||
%99 = OpFunctionCall %v3float %gammaCorrection %100 %101
|
||||
OpStore %color %99
|
||||
%102 = OpCompositeExtract %mat3v3float %params_0 5
|
||||
%103 = OpLoad %v3float %color
|
||||
%104 = OpMatrixTimesVector %v3float %102 %103
|
||||
OpStore %color %104
|
||||
%106 = OpLoad %v3float %color
|
||||
%107 = OpCompositeExtract %GammaTransferParams %params_0 4
|
||||
%105 = OpFunctionCall %v3float %gammaCorrection %106 %107
|
||||
OpStore %color %105
|
||||
OpBranch %97
|
||||
%82 = OpImageFetch %v4float %plane0 %coord Lod %80
|
||||
%83 = OpCompositeExtract %float %82 0
|
||||
%84 = OpImageFetch %v4float %plane1 %coord Lod %80
|
||||
%86 = OpVectorShuffle %v2float %84 %84 0 1
|
||||
%87 = OpCompositeExtract %float %86 0
|
||||
%88 = OpCompositeExtract %float %86 1
|
||||
%90 = OpCompositeConstruct %v4float %83 %87 %88 %float_1
|
||||
%91 = OpCompositeExtract %mat3v4float %params_0 2
|
||||
%92 = OpVectorTimesMatrix %v3float %90 %91
|
||||
OpStore %color %92
|
||||
OpBranch %76
|
||||
%76 = OpLabel
|
||||
%93 = OpCompositeExtract %uint %params_0 1
|
||||
%95 = OpIEqual %bool %93 %94
|
||||
OpSelectionMerge %96 None
|
||||
OpBranchConditional %95 %97 %96
|
||||
%97 = OpLabel
|
||||
%108 = OpLoad %v3float %color
|
||||
%109 = OpCompositeExtract %float %108 0
|
||||
%110 = OpCompositeExtract %float %108 1
|
||||
%111 = OpCompositeExtract %float %108 2
|
||||
%112 = OpCompositeConstruct %v4float %109 %110 %111 %float_1
|
||||
OpReturnValue %112
|
||||
%99 = OpLoad %v3float %color
|
||||
%100 = OpCompositeExtract %GammaTransferParams %params_0 3
|
||||
%98 = OpFunctionCall %v3float %gammaCorrection %99 %100
|
||||
OpStore %color %98
|
||||
%101 = OpCompositeExtract %mat3v3float %params_0 5
|
||||
%102 = OpLoad %v3float %color
|
||||
%103 = OpMatrixTimesVector %v3float %101 %102
|
||||
OpStore %color %103
|
||||
%105 = OpLoad %v3float %color
|
||||
%106 = OpCompositeExtract %GammaTransferParams %params_0 4
|
||||
%104 = OpFunctionCall %v3float %gammaCorrection %105 %106
|
||||
OpStore %color %104
|
||||
OpBranch %96
|
||||
%96 = OpLabel
|
||||
%107 = OpLoad %v3float %color
|
||||
%108 = OpCompositeExtract %float %107 0
|
||||
%109 = OpCompositeExtract %float %107 1
|
||||
%110 = OpCompositeExtract %float %107 2
|
||||
%111 = OpCompositeConstruct %v4float %108 %109 %110 %float_1
|
||||
OpReturnValue %111
|
||||
OpFunctionEnd
|
||||
%textureLoad2d = OpFunction %v4float None %113
|
||||
%textureLoad2d = OpFunction %v4float None %112
|
||||
%texture = OpFunctionParameter %11
|
||||
%ext_tex_plane_1_1 = OpFunctionParameter %11
|
||||
%ext_tex_params_1 = OpFunctionParameter %ExternalTextureParams
|
||||
%coords = OpFunctionParameter %v2int
|
||||
%119 = OpLabel
|
||||
%120 = OpFunctionCall %v4float %textureLoadExternal %texture %ext_tex_plane_1_1 %coords %ext_tex_params_1
|
||||
OpReturnValue %120
|
||||
%118 = OpLabel
|
||||
%119 = OpFunctionCall %v4float %textureLoadExternal %texture %ext_tex_plane_1_1 %coords %ext_tex_params_1
|
||||
OpReturnValue %119
|
||||
OpFunctionEnd
|
||||
%conv_ExternalTextureParams = OpFunction %ExternalTextureParams None %121
|
||||
%val = OpFunctionParameter %ExternalTextureParams_std140
|
||||
%124 = OpLabel
|
||||
%125 = OpCompositeExtract %uint %val 0
|
||||
%126 = OpCompositeExtract %uint %val 1
|
||||
%127 = OpCompositeExtract %mat3v4float %val 2
|
||||
%128 = OpCompositeExtract %GammaTransferParams %val 3
|
||||
%129 = OpCompositeExtract %GammaTransferParams %val 4
|
||||
%130 = OpCompositeExtract %mat3v3float %val 5
|
||||
%131 = OpCompositeExtract %v2float %val 6
|
||||
%132 = OpCompositeExtract %v2float %val 7
|
||||
%133 = OpCompositeConstruct %mat2v2float %131 %132
|
||||
%134 = OpCompositeConstruct %ExternalTextureParams %125 %126 %127 %128 %129 %130 %133
|
||||
OpReturnValue %134
|
||||
OpFunctionEnd
|
||||
%doTextureLoad = OpFunction %void None %135
|
||||
%138 = OpLabel
|
||||
%doTextureLoad = OpFunction %void None %120
|
||||
%123 = OpLabel
|
||||
%res = OpVariable %_ptr_Function_v4float Function %5
|
||||
%140 = OpLoad %11 %arg_0
|
||||
%141 = OpLoad %11 %ext_tex_plane_1
|
||||
%145 = OpAccessChain %_ptr_Uniform_ExternalTextureParams_std140 %ext_tex_params %uint_0
|
||||
%146 = OpLoad %ExternalTextureParams_std140 %145
|
||||
%142 = OpFunctionCall %ExternalTextureParams %conv_ExternalTextureParams %146
|
||||
%139 = OpFunctionCall %v4float %textureLoad2d %140 %141 %142 %147
|
||||
OpStore %res %139
|
||||
%125 = OpLoad %11 %arg_0
|
||||
%126 = OpLoad %11 %ext_tex_plane_1
|
||||
%129 = OpAccessChain %_ptr_Uniform_ExternalTextureParams %ext_tex_params %uint_0
|
||||
%130 = OpLoad %ExternalTextureParams %129
|
||||
%124 = OpFunctionCall %v4float %textureLoad2d %125 %126 %130 %131
|
||||
OpStore %res %124
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%vertex_main_inner = OpFunction %v4float None %150
|
||||
%152 = OpLabel
|
||||
%153 = OpFunctionCall %void %doTextureLoad
|
||||
%vertex_main_inner = OpFunction %v4float None %134
|
||||
%136 = OpLabel
|
||||
%137 = OpFunctionCall %void %doTextureLoad
|
||||
OpReturnValue %5
|
||||
OpFunctionEnd
|
||||
%vertex_main = OpFunction %void None %135
|
||||
%155 = OpLabel
|
||||
%156 = OpFunctionCall %v4float %vertex_main_inner
|
||||
OpStore %value %156
|
||||
%vertex_main = OpFunction %void None %120
|
||||
%139 = OpLabel
|
||||
%140 = OpFunctionCall %v4float %vertex_main_inner
|
||||
OpStore %value %140
|
||||
OpStore %vertex_point_size %float_1
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%fragment_main = OpFunction %void None %135
|
||||
%158 = OpLabel
|
||||
%159 = OpFunctionCall %void %doTextureLoad
|
||||
%fragment_main = OpFunction %void None %120
|
||||
%142 = OpLabel
|
||||
%143 = OpFunctionCall %void %doTextureLoad
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%compute_main = OpFunction %void None %135
|
||||
%161 = OpLabel
|
||||
%162 = OpFunctionCall %void %doTextureLoad
|
||||
%compute_main = OpFunction %void None %120
|
||||
%145 = OpLabel
|
||||
%146 = OpFunctionCall %void %doTextureLoad
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
|
||||
Reference in New Issue
Block a user