Fix UV coord for TextureLoad

UV plane's coord should be half of that of Y plane for NV12.

Bug: chromium:1415832
Change-Id: Icee851e61eca1f7da291285100f8edcce482b511
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/119860
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Jie A Chen <jie.a.chen@intel.com>
Commit-Queue: Jie A Chen <jie.a.chen@intel.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
This commit is contained in:
jchen10 2023-02-23 13:03:52 +00:00 committed by Dawn LUCI CQ
parent d8a13ee60c
commit 39b7330b5b
33 changed files with 665 additions and 610 deletions

View File

@ -351,8 +351,10 @@ struct MultiplanarExternalTexture::State {
single_plane_call = b.Call("textureLoad", "plane0", "coord", 0_a); single_plane_call = b.Call("textureLoad", "plane0", "coord", 0_a);
// textureLoad(plane0, coord, 0); // textureLoad(plane0, coord, 0);
plane_0_call = b.Call("textureLoad", "plane0", "coord", 0_a); plane_0_call = b.Call("textureLoad", "plane0", "coord", 0_a);
// textureLoad(plane1, coord, 0); // let coord1 = coord >> 1;
plane_1_call = b.Call("textureLoad", "plane1", "coord", 0_a); stmts.Push(b.Decl(b.Let("coord1", b.Shr("coord", b.vec2<u32>(1_a)))));
// textureLoad(plane1, coord1, 0);
plane_1_call = b.Call("textureLoad", "plane1", "coord1", 0_a);
break; break;
default: default:
TINT_ICE(Transform, b.Diagnostics()) << "unhandled builtin: " << call_type; TINT_ICE(Transform, b.Diagnostics()) << "unhandled builtin: " << call_type;

View File

@ -435,11 +435,12 @@ fn gammaCorrection(v : vec3<f32>, params : GammaTransferParams) -> vec3<f32> {
} }
fn textureLoadExternal(plane0 : texture_2d<f32>, plane1 : texture_2d<f32>, coord : vec2<i32>, params : ExternalTextureParams) -> vec4<f32> { fn textureLoadExternal(plane0 : texture_2d<f32>, plane1 : texture_2d<f32>, coord : vec2<i32>, params : ExternalTextureParams) -> vec4<f32> {
let coord1 = (coord >> vec2<u32>(1));
var color : vec3<f32>; var color : vec3<f32>;
if ((params.numPlanes == 1)) { if ((params.numPlanes == 1)) {
color = textureLoad(plane0, coord, 0).rgb; color = textureLoad(plane0, coord, 0).rgb;
} else { } else {
color = (vec4<f32>(textureLoad(plane0, coord, 0).r, textureLoad(plane1, coord, 0).rg, 1) * params.yuvToRgbConversionMatrix); color = (vec4<f32>(textureLoad(plane0, coord, 0).r, textureLoad(plane1, coord1, 0).rg, 1) * params.yuvToRgbConversionMatrix);
} }
if ((params.doYuvToRgbConversionOnly == 0)) { if ((params.doYuvToRgbConversionOnly == 0)) {
color = gammaCorrection(color, params.gammaDecodeParams); color = gammaCorrection(color, params.gammaDecodeParams);
@ -450,11 +451,12 @@ fn textureLoadExternal(plane0 : texture_2d<f32>, plane1 : texture_2d<f32>, coord
} }
fn textureLoadExternal_1(plane0 : texture_2d<f32>, plane1 : texture_2d<f32>, coord : vec2<u32>, params : ExternalTextureParams) -> vec4<f32> { fn textureLoadExternal_1(plane0 : texture_2d<f32>, plane1 : texture_2d<f32>, coord : vec2<u32>, params : ExternalTextureParams) -> vec4<f32> {
let coord1 = (coord >> vec2<u32>(1));
var color : vec3<f32>; var color : vec3<f32>;
if ((params.numPlanes == 1)) { if ((params.numPlanes == 1)) {
color = textureLoad(plane0, coord, 0).rgb; color = textureLoad(plane0, coord, 0).rgb;
} else { } else {
color = (vec4<f32>(textureLoad(plane0, coord, 0).r, textureLoad(plane1, coord, 0).rg, 1) * params.yuvToRgbConversionMatrix); color = (vec4<f32>(textureLoad(plane0, coord, 0).r, textureLoad(plane1, coord1, 0).rg, 1) * params.yuvToRgbConversionMatrix);
} }
if ((params.doYuvToRgbConversionOnly == 0)) { if ((params.doYuvToRgbConversionOnly == 0)) {
color = gammaCorrection(color, params.gammaDecodeParams); color = gammaCorrection(color, params.gammaDecodeParams);
@ -526,11 +528,12 @@ fn gammaCorrection(v : vec3<f32>, params : GammaTransferParams) -> vec3<f32> {
} }
fn textureLoadExternal(plane0 : texture_2d<f32>, plane1 : texture_2d<f32>, coord : vec2<i32>, params : ExternalTextureParams) -> vec4<f32> { fn textureLoadExternal(plane0 : texture_2d<f32>, plane1 : texture_2d<f32>, coord : vec2<i32>, params : ExternalTextureParams) -> vec4<f32> {
let coord1 = (coord >> vec2<u32>(1));
var color : vec3<f32>; var color : vec3<f32>;
if ((params.numPlanes == 1)) { if ((params.numPlanes == 1)) {
color = textureLoad(plane0, coord, 0).rgb; color = textureLoad(plane0, coord, 0).rgb;
} else { } else {
color = (vec4<f32>(textureLoad(plane0, coord, 0).r, textureLoad(plane1, coord, 0).rg, 1) * params.yuvToRgbConversionMatrix); color = (vec4<f32>(textureLoad(plane0, coord, 0).r, textureLoad(plane1, coord1, 0).rg, 1) * params.yuvToRgbConversionMatrix);
} }
if ((params.doYuvToRgbConversionOnly == 0)) { if ((params.doYuvToRgbConversionOnly == 0)) {
color = gammaCorrection(color, params.gammaDecodeParams); color = gammaCorrection(color, params.gammaDecodeParams);
@ -541,11 +544,12 @@ fn textureLoadExternal(plane0 : texture_2d<f32>, plane1 : texture_2d<f32>, coord
} }
fn textureLoadExternal_1(plane0 : texture_2d<f32>, plane1 : texture_2d<f32>, coord : vec2<u32>, params : ExternalTextureParams) -> vec4<f32> { fn textureLoadExternal_1(plane0 : texture_2d<f32>, plane1 : texture_2d<f32>, coord : vec2<u32>, params : ExternalTextureParams) -> vec4<f32> {
let coord1 = (coord >> vec2<u32>(1));
var color : vec3<f32>; var color : vec3<f32>;
if ((params.numPlanes == 1)) { if ((params.numPlanes == 1)) {
color = textureLoad(plane0, coord, 0).rgb; color = textureLoad(plane0, coord, 0).rgb;
} else { } else {
color = (vec4<f32>(textureLoad(plane0, coord, 0).r, textureLoad(plane1, coord, 0).rg, 1) * params.yuvToRgbConversionMatrix); color = (vec4<f32>(textureLoad(plane0, coord, 0).r, textureLoad(plane1, coord1, 0).rg, 1) * params.yuvToRgbConversionMatrix);
} }
if ((params.doYuvToRgbConversionOnly == 0)) { if ((params.doYuvToRgbConversionOnly == 0)) {
color = gammaCorrection(color, params.gammaDecodeParams); color = gammaCorrection(color, params.gammaDecodeParams);
@ -644,11 +648,12 @@ fn textureSampleExternal(plane0 : texture_2d<f32>, plane1 : texture_2d<f32>, smp
} }
fn textureLoadExternal(plane0 : texture_2d<f32>, plane1 : texture_2d<f32>, coord : vec2<i32>, params : ExternalTextureParams) -> vec4<f32> { fn textureLoadExternal(plane0 : texture_2d<f32>, plane1 : texture_2d<f32>, coord : vec2<i32>, params : ExternalTextureParams) -> vec4<f32> {
let coord1 = (coord >> vec2<u32>(1));
var color : vec3<f32>; var color : vec3<f32>;
if ((params.numPlanes == 1)) { if ((params.numPlanes == 1)) {
color = textureLoad(plane0, coord, 0).rgb; color = textureLoad(plane0, coord, 0).rgb;
} else { } else {
color = (vec4<f32>(textureLoad(plane0, coord, 0).r, textureLoad(plane1, coord, 0).rg, 1) * params.yuvToRgbConversionMatrix); color = (vec4<f32>(textureLoad(plane0, coord, 0).r, textureLoad(plane1, coord1, 0).rg, 1) * params.yuvToRgbConversionMatrix);
} }
if ((params.doYuvToRgbConversionOnly == 0)) { if ((params.doYuvToRgbConversionOnly == 0)) {
color = gammaCorrection(color, params.gammaDecodeParams); color = gammaCorrection(color, params.gammaDecodeParams);
@ -739,11 +744,12 @@ fn textureSampleExternal(plane0 : texture_2d<f32>, plane1 : texture_2d<f32>, smp
} }
fn textureLoadExternal(plane0 : texture_2d<f32>, plane1 : texture_2d<f32>, coord : vec2<i32>, params : ExternalTextureParams) -> vec4<f32> { fn textureLoadExternal(plane0 : texture_2d<f32>, plane1 : texture_2d<f32>, coord : vec2<i32>, params : ExternalTextureParams) -> vec4<f32> {
let coord1 = (coord >> vec2<u32>(1));
var color : vec3<f32>; var color : vec3<f32>;
if ((params.numPlanes == 1)) { if ((params.numPlanes == 1)) {
color = textureLoad(plane0, coord, 0).rgb; color = textureLoad(plane0, coord, 0).rgb;
} else { } else {
color = (vec4<f32>(textureLoad(plane0, coord, 0).r, textureLoad(plane1, coord, 0).rg, 1) * params.yuvToRgbConversionMatrix); color = (vec4<f32>(textureLoad(plane0, coord, 0).r, textureLoad(plane1, coord1, 0).rg, 1) * params.yuvToRgbConversionMatrix);
} }
if ((params.doYuvToRgbConversionOnly == 0)) { if ((params.doYuvToRgbConversionOnly == 0)) {
color = gammaCorrection(color, params.gammaDecodeParams); color = gammaCorrection(color, params.gammaDecodeParams);

View File

@ -37,11 +37,12 @@ float3 gammaCorrection(float3 v, GammaTransferParams params) {
} }
float4 textureLoadExternal(Texture2D<float4> plane0, Texture2D<float4> plane1, int2 coord, ExternalTextureParams params) { float4 textureLoadExternal(Texture2D<float4> plane0, Texture2D<float4> plane1, int2 coord, ExternalTextureParams params) {
const int2 coord1 = (coord >> (1u).xx);
float3 color = float3(0.0f, 0.0f, 0.0f); float3 color = float3(0.0f, 0.0f, 0.0f);
if ((params.numPlanes == 1u)) { if ((params.numPlanes == 1u)) {
color = plane0.Load(int3(coord, 0)).rgb; color = plane0.Load(int3(coord, 0)).rgb;
} else { } else {
color = mul(params.yuvToRgbConversionMatrix, float4(plane0.Load(int3(coord, 0)).r, plane1.Load(int3(coord, 0)).rg, 1.0f)); color = mul(params.yuvToRgbConversionMatrix, float4(plane0.Load(int3(coord, 0)).r, plane1.Load(int3(coord1, 0)).rg, 1.0f));
} }
if ((params.doYuvToRgbConversionOnly == 0u)) { if ((params.doYuvToRgbConversionOnly == 0u)) {
color = gammaCorrection(color, params.gammaDecodeParams); color = gammaCorrection(color, params.gammaDecodeParams);

View File

@ -37,11 +37,12 @@ float3 gammaCorrection(float3 v, GammaTransferParams params) {
} }
float4 textureLoadExternal(Texture2D<float4> plane0, Texture2D<float4> plane1, int2 coord, ExternalTextureParams params) { float4 textureLoadExternal(Texture2D<float4> plane0, Texture2D<float4> plane1, int2 coord, ExternalTextureParams params) {
const int2 coord1 = (coord >> (1u).xx);
float3 color = float3(0.0f, 0.0f, 0.0f); float3 color = float3(0.0f, 0.0f, 0.0f);
if ((params.numPlanes == 1u)) { if ((params.numPlanes == 1u)) {
color = plane0.Load(int3(coord, 0)).rgb; color = plane0.Load(int3(coord, 0)).rgb;
} else { } else {
color = mul(params.yuvToRgbConversionMatrix, float4(plane0.Load(int3(coord, 0)).r, plane1.Load(int3(coord, 0)).rg, 1.0f)); color = mul(params.yuvToRgbConversionMatrix, float4(plane0.Load(int3(coord, 0)).r, plane1.Load(int3(coord1, 0)).rg, 1.0f));
} }
if ((params.doYuvToRgbConversionOnly == 0u)) { if ((params.doYuvToRgbConversionOnly == 0u)) {
color = gammaCorrection(color, params.gammaDecodeParams); color = gammaCorrection(color, params.gammaDecodeParams);

View File

@ -54,11 +54,12 @@ vec3 gammaCorrection(vec3 v, GammaTransferParams params) {
} }
vec4 textureLoadExternal(highp sampler2D plane0_1, highp sampler2D plane1_1, ivec2 coord, ExternalTextureParams params) { vec4 textureLoadExternal(highp sampler2D plane0_1, highp sampler2D plane1_1, ivec2 coord, ExternalTextureParams params) {
ivec2 coord1 = (coord >> uvec2(1u));
vec3 color = vec3(0.0f, 0.0f, 0.0f); vec3 color = vec3(0.0f, 0.0f, 0.0f);
if ((params.numPlanes == 1u)) { if ((params.numPlanes == 1u)) {
color = texelFetch(plane0_1, coord, 0).rgb; color = texelFetch(plane0_1, coord, 0).rgb;
} else { } else {
color = (vec4(texelFetch(plane0_1, coord, 0).r, texelFetch(plane1_1, coord, 0).rg, 1.0f) * params.yuvToRgbConversionMatrix); color = (vec4(texelFetch(plane0_1, coord, 0).r, texelFetch(plane1_1, coord1, 0).rg, 1.0f) * params.yuvToRgbConversionMatrix);
} }
if ((params.doYuvToRgbConversionOnly == 0u)) { if ((params.doYuvToRgbConversionOnly == 0u)) {
color = gammaCorrection(color, params.gammaDecodeParams); color = gammaCorrection(color, params.gammaDecodeParams);

View File

@ -49,11 +49,12 @@ float3 gammaCorrection(float3 v, GammaTransferParams params) {
} }
float4 textureLoadExternal(texture2d<float, access::sample> plane0, texture2d<float, access::sample> plane1, int2 coord, ExternalTextureParams params) { float4 textureLoadExternal(texture2d<float, access::sample> plane0, texture2d<float, access::sample> plane1, int2 coord, ExternalTextureParams params) {
int2 const coord1 = (coord >> uint2(1u));
float3 color = 0.0f; float3 color = 0.0f;
if ((params.numPlanes == 1u)) { if ((params.numPlanes == 1u)) {
color = float4(plane0.read(uint2(coord), 0)).rgb; color = float4(plane0.read(uint2(coord), 0)).rgb;
} else { } else {
color = (float4(plane0.read(uint2(coord), 0)[0], float4(plane1.read(uint2(coord), 0)).rg, 1.0f) * params.yuvToRgbConversionMatrix); color = (float4(plane0.read(uint2(coord), 0)[0], float4(plane1.read(uint2(coord1), 0)).rg, 1.0f) * params.yuvToRgbConversionMatrix);
} }
if ((params.doYuvToRgbConversionOnly == 0u)) { if ((params.doYuvToRgbConversionOnly == 0u)) {
color = gammaCorrection(color, params.gammaDecodeParams); color = gammaCorrection(color, params.gammaDecodeParams);

View File

@ -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: 196 ; Bound: 197
; Schema: 0 ; Schema: 0
OpCapability Shader OpCapability Shader
OpCapability ImageQuery OpCapability ImageQuery
@ -136,28 +136,28 @@
%mat3v2float = OpTypeMatrix %v2float 3 %mat3v2float = OpTypeMatrix %v2float 3
%ExternalTextureParams = OpTypeStruct %uint %uint %mat3v4float %GammaTransferParams %GammaTransferParams %mat3v3float %mat3v2float %ExternalTextureParams = OpTypeStruct %uint %uint %mat3v4float %GammaTransferParams %GammaTransferParams %mat3v3float %mat3v2float
%70 = OpTypeFunction %v4float %3 %3 %v2int %ExternalTextureParams %70 = OpTypeFunction %v4float %3 %3 %v2int %ExternalTextureParams
%uint_1 = OpConstant %uint 1
%87 = OpConstantNull %int
%float_1 = OpConstant %float 1
%100 = OpConstantNull %uint
%118 = OpTypeFunction %ExternalTextureParams %ExternalTextureParams_std140
%void = OpTypeVoid
%133 = OpTypeFunction %void
%int_10 = OpConstant %int 10
%139 = OpConstantComposite %v2int %int_10 %int_10
%140 = OpConstantNull %v2int
%v2uint = OpTypeVector %uint 2 %v2uint = OpTypeVector %uint 2
%uint_1 = OpConstant %uint 1
%81 = OpConstantComposite %v2uint %uint_1 %uint_1
%90 = OpConstantNull %int
%float_1 = OpConstant %float 1
%103 = OpConstantNull %uint
%121 = OpTypeFunction %ExternalTextureParams %ExternalTextureParams_std140
%void = OpTypeVoid
%136 = OpTypeFunction %void
%int_10 = OpConstant %int 10
%142 = OpConstantComposite %v2int %int_10 %int_10
%143 = OpConstantNull %v2int
%int_0 = OpConstant %int 0 %int_0 = OpConstant %int 0
%147 = OpConstantComposite %v2uint %uint_1 %uint_1
%uint_0 = OpConstant %uint 0 %uint_0 = OpConstant %uint 0
%_ptr_Uniform_ExternalTextureParams_std140 = OpTypePointer Uniform %ExternalTextureParams_std140 %_ptr_Uniform_ExternalTextureParams_std140 = OpTypePointer Uniform %ExternalTextureParams_std140
%_ptr_Function_v4float = OpTypePointer Function %v4float %_ptr_Function_v4float = OpTypePointer Function %v4float
%159 = OpConstantNull %v4float %160 = OpConstantNull %v4float
%int_70 = OpConstant %int 70 %int_70 = OpConstant %int 70
%int_118 = OpConstant %int 118 %int_118 = OpConstant %int 118
%172 = OpConstantComposite %v2int %int_70 %int_118 %173 = OpConstantComposite %v2int %int_70 %int_118
%int_1 = OpConstant %int 1 %int_1 = OpConstant %int 1
%187 = OpConstantComposite %v2int %int_1 %87 %188 = OpConstantComposite %v2int %int_1 %90
%tint_clamp = OpFunction %v2int None %20 %tint_clamp = OpFunction %v2int None %20
%e = OpFunctionParameter %v2int %e = OpFunctionParameter %v2int
%low = OpFunctionParameter %v2int %low = OpFunctionParameter %v2int
@ -210,113 +210,114 @@
%params_0 = OpFunctionParameter %ExternalTextureParams %params_0 = OpFunctionParameter %ExternalTextureParams
%78 = OpLabel %78 = OpLabel
%color = OpVariable %_ptr_Function_v3float Function %50 %color = OpVariable %_ptr_Function_v3float Function %50
%80 = OpCompositeExtract %uint %params_0 0 %82 = OpShiftRightArithmetic %v2int %coord %81
%82 = OpIEqual %bool %80 %uint_1 %84 = OpCompositeExtract %uint %params_0 0
OpSelectionMerge %83 None %85 = OpIEqual %bool %84 %uint_1
OpBranchConditional %82 %84 %85 OpSelectionMerge %86 None
%84 = OpLabel OpBranchConditional %85 %87 %88
%86 = OpImageFetch %v4float %plane0 %coord Lod %87 %87 = OpLabel
%88 = OpVectorShuffle %v3float %86 %86 0 1 2 %89 = OpImageFetch %v4float %plane0 %coord Lod %90
OpStore %color %88 %91 = OpVectorShuffle %v3float %89 %89 0 1 2
OpBranch %83 OpStore %color %91
%85 = OpLabel OpBranch %86
%89 = OpImageFetch %v4float %plane0 %coord Lod %87 %88 = OpLabel
%90 = OpCompositeExtract %float %89 0 %92 = OpImageFetch %v4float %plane0 %coord Lod %90
%91 = OpImageFetch %v4float %plane1 %coord Lod %87
%92 = OpVectorShuffle %v2float %91 %91 0 1
%93 = OpCompositeExtract %float %92 0 %93 = OpCompositeExtract %float %92 0
%94 = OpCompositeExtract %float %92 1 %94 = OpImageFetch %v4float %plane1 %82 Lod %90
%96 = OpCompositeConstruct %v4float %90 %93 %94 %float_1 %95 = OpVectorShuffle %v2float %94 %94 0 1
%97 = OpCompositeExtract %mat3v4float %params_0 2 %96 = OpCompositeExtract %float %95 0
%98 = OpVectorTimesMatrix %v3float %96 %97 %97 = OpCompositeExtract %float %95 1
OpStore %color %98 %99 = OpCompositeConstruct %v4float %93 %96 %97 %float_1
OpBranch %83 %100 = OpCompositeExtract %mat3v4float %params_0 2
%83 = OpLabel %101 = OpVectorTimesMatrix %v3float %99 %100
%99 = OpCompositeExtract %uint %params_0 1 OpStore %color %101
%101 = OpIEqual %bool %99 %100 OpBranch %86
OpSelectionMerge %102 None %86 = OpLabel
OpBranchConditional %101 %103 %102 %102 = OpCompositeExtract %uint %params_0 1
%103 = OpLabel %104 = OpIEqual %bool %102 %103
%105 = OpLoad %v3float %color OpSelectionMerge %105 None
%106 = OpCompositeExtract %GammaTransferParams %params_0 3 OpBranchConditional %104 %106 %105
%104 = OpFunctionCall %v3float %gammaCorrection %105 %106 %106 = OpLabel
OpStore %color %104
%107 = OpCompositeExtract %mat3v3float %params_0 5
%108 = OpLoad %v3float %color %108 = OpLoad %v3float %color
%109 = OpMatrixTimesVector %v3float %107 %108 %109 = OpCompositeExtract %GammaTransferParams %params_0 3
OpStore %color %109 %107 = OpFunctionCall %v3float %gammaCorrection %108 %109
OpStore %color %107
%110 = OpCompositeExtract %mat3v3float %params_0 5
%111 = OpLoad %v3float %color %111 = OpLoad %v3float %color
%112 = OpCompositeExtract %GammaTransferParams %params_0 4 %112 = OpMatrixTimesVector %v3float %110 %111
%110 = OpFunctionCall %v3float %gammaCorrection %111 %112 OpStore %color %112
OpStore %color %110 %114 = OpLoad %v3float %color
OpBranch %102 %115 = OpCompositeExtract %GammaTransferParams %params_0 4
%102 = OpLabel %113 = OpFunctionCall %v3float %gammaCorrection %114 %115
%113 = OpLoad %v3float %color OpStore %color %113
%114 = OpCompositeExtract %float %113 0 OpBranch %105
%115 = OpCompositeExtract %float %113 1 %105 = OpLabel
%116 = OpCompositeExtract %float %113 2 %116 = OpLoad %v3float %color
%117 = OpCompositeConstruct %v4float %114 %115 %116 %float_1 %117 = OpCompositeExtract %float %116 0
OpReturnValue %117 %118 = OpCompositeExtract %float %116 1
%119 = OpCompositeExtract %float %116 2
%120 = OpCompositeConstruct %v4float %117 %118 %119 %float_1
OpReturnValue %120
OpFunctionEnd OpFunctionEnd
%conv_ExternalTextureParams = OpFunction %ExternalTextureParams None %118 %conv_ExternalTextureParams = OpFunction %ExternalTextureParams None %121
%val = OpFunctionParameter %ExternalTextureParams_std140 %val = OpFunctionParameter %ExternalTextureParams_std140
%121 = OpLabel %124 = OpLabel
%122 = OpCompositeExtract %uint %val 0 %125 = OpCompositeExtract %uint %val 0
%123 = OpCompositeExtract %uint %val 1 %126 = OpCompositeExtract %uint %val 1
%124 = OpCompositeExtract %mat3v4float %val 2 %127 = OpCompositeExtract %mat3v4float %val 2
%125 = OpCompositeExtract %GammaTransferParams %val 3 %128 = OpCompositeExtract %GammaTransferParams %val 3
%126 = OpCompositeExtract %GammaTransferParams %val 4 %129 = OpCompositeExtract %GammaTransferParams %val 4
%127 = OpCompositeExtract %mat3v3float %val 5 %130 = OpCompositeExtract %mat3v3float %val 5
%128 = OpCompositeExtract %v2float %val 6 %131 = OpCompositeExtract %v2float %val 6
%129 = OpCompositeExtract %v2float %val 7 %132 = OpCompositeExtract %v2float %val 7
%130 = OpCompositeExtract %v2float %val 8 %133 = OpCompositeExtract %v2float %val 8
%131 = OpCompositeConstruct %mat3v2float %128 %129 %130 %134 = OpCompositeConstruct %mat3v2float %131 %132 %133
%132 = OpCompositeConstruct %ExternalTextureParams %122 %123 %124 %125 %126 %127 %131 %135 = OpCompositeConstruct %ExternalTextureParams %125 %126 %127 %128 %129 %130 %134
OpReturnValue %132 OpReturnValue %135
OpFunctionEnd OpFunctionEnd
%main = OpFunction %void None %133 %main = OpFunction %void None %136
%136 = OpLabel %139 = OpLabel
%red = OpVariable %_ptr_Function_v4float Function %159 %red = OpVariable %_ptr_Function_v4float Function %160
%green = OpVariable %_ptr_Function_v4float Function %159 %green = OpVariable %_ptr_Function_v4float Function %160
%145 = OpLoad %3 %t %147 = OpLoad %3 %t
%144 = OpImageQuerySizeLod %v2uint %145 %int_0 %146 = OpImageQuerySizeLod %v2uint %147 %int_0
%148 = OpISub %v2uint %144 %147 %149 = OpISub %v2uint %146 %81
%141 = OpBitcast %v2int %148 %144 = OpBitcast %v2int %149
%137 = OpFunctionCall %v2int %tint_clamp %139 %140 %141 %140 = OpFunctionCall %v2int %tint_clamp %142 %143 %144
%150 = OpLoad %3 %t %151 = OpLoad %3 %t
%151 = OpLoad %3 %ext_tex_plane_1 %152 = OpLoad %3 %ext_tex_plane_1
%155 = OpAccessChain %_ptr_Uniform_ExternalTextureParams_std140 %ext_tex_params %uint_0 %156 = OpAccessChain %_ptr_Uniform_ExternalTextureParams_std140 %ext_tex_params %uint_0
%156 = OpLoad %ExternalTextureParams_std140 %155 %157 = OpLoad %ExternalTextureParams_std140 %156
%152 = OpFunctionCall %ExternalTextureParams %conv_ExternalTextureParams %156 %153 = OpFunctionCall %ExternalTextureParams %conv_ExternalTextureParams %157
%149 = OpFunctionCall %v4float %textureLoadExternal %150 %151 %137 %152 %150 = OpFunctionCall %v4float %textureLoadExternal %151 %152 %140 %153
OpStore %red %149 OpStore %red %150
%164 = OpLoad %19 %outImage %165 = OpLoad %19 %outImage
%163 = OpImageQuerySize %v2uint %164 %164 = OpImageQuerySize %v2uint %165
%165 = OpISub %v2uint %163 %147 %166 = OpISub %v2uint %164 %81
%161 = OpBitcast %v2int %165 %162 = OpBitcast %v2int %166
%160 = OpFunctionCall %v2int %tint_clamp %140 %140 %161 %161 = OpFunctionCall %v2int %tint_clamp %143 %143 %162
%167 = OpLoad %19 %outImage %168 = OpLoad %19 %outImage
%168 = OpLoad %v4float %red %169 = OpLoad %v4float %red
OpImageWrite %167 %160 %168 OpImageWrite %168 %161 %169
%176 = OpLoad %3 %t %177 = OpLoad %3 %t
%175 = OpImageQuerySizeLod %v2uint %176 %int_0 %176 = OpImageQuerySizeLod %v2uint %177 %int_0
%177 = OpISub %v2uint %175 %147 %178 = OpISub %v2uint %176 %81
%173 = OpBitcast %v2int %177 %174 = OpBitcast %v2int %178
%169 = OpFunctionCall %v2int %tint_clamp %172 %140 %173 %170 = OpFunctionCall %v2int %tint_clamp %173 %143 %174
%179 = OpLoad %3 %t %180 = OpLoad %3 %t
%180 = OpLoad %3 %ext_tex_plane_1 %181 = OpLoad %3 %ext_tex_plane_1
%182 = OpAccessChain %_ptr_Uniform_ExternalTextureParams_std140 %ext_tex_params %uint_0 %183 = OpAccessChain %_ptr_Uniform_ExternalTextureParams_std140 %ext_tex_params %uint_0
%183 = OpLoad %ExternalTextureParams_std140 %182 %184 = OpLoad %ExternalTextureParams_std140 %183
%181 = OpFunctionCall %ExternalTextureParams %conv_ExternalTextureParams %183 %182 = OpFunctionCall %ExternalTextureParams %conv_ExternalTextureParams %184
%178 = OpFunctionCall %v4float %textureLoadExternal %179 %180 %169 %181 %179 = OpFunctionCall %v4float %textureLoadExternal %180 %181 %170 %182
OpStore %green %178 OpStore %green %179
%191 = OpLoad %19 %outImage %192 = OpLoad %19 %outImage
%190 = OpImageQuerySize %v2uint %191 %191 = OpImageQuerySize %v2uint %192
%192 = OpISub %v2uint %190 %147 %193 = OpISub %v2uint %191 %81
%188 = OpBitcast %v2int %192 %189 = OpBitcast %v2int %193
%185 = OpFunctionCall %v2int %tint_clamp %187 %140 %188 %186 = OpFunctionCall %v2int %tint_clamp %188 %143 %189
%194 = OpLoad %19 %outImage %195 = OpLoad %19 %outImage
%195 = OpLoad %v4float %green %196 = OpLoad %v4float %green
OpImageWrite %194 %185 %195 OpImageWrite %195 %186 %196
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd

View File

@ -35,11 +35,12 @@ fn gammaCorrection(v : vec3<f32>, params : GammaTransferParams) -> vec3<f32> {
} }
fn textureLoadExternal(plane0 : texture_2d<f32>, plane1 : texture_2d<f32>, coord : vec2<i32>, params : ExternalTextureParams) -> vec4<f32> { fn textureLoadExternal(plane0 : texture_2d<f32>, plane1 : texture_2d<f32>, coord : vec2<i32>, params : ExternalTextureParams) -> vec4<f32> {
let coord1 = (coord >> vec2<u32>(1));
var color : vec3<f32>; var color : vec3<f32>;
if ((params.numPlanes == 1)) { if ((params.numPlanes == 1)) {
color = textureLoad(plane0, coord, 0).rgb; color = textureLoad(plane0, coord, 0).rgb;
} else { } else {
color = (vec4<f32>(textureLoad(plane0, coord, 0).r, textureLoad(plane1, coord, 0).rg, 1) * params.yuvToRgbConversionMatrix); color = (vec4<f32>(textureLoad(plane0, coord, 0).r, textureLoad(plane1, coord1, 0).rg, 1) * params.yuvToRgbConversionMatrix);
} }
if ((params.doYuvToRgbConversionOnly == 0)) { if ((params.doYuvToRgbConversionOnly == 0)) {
color = gammaCorrection(color, params.gammaDecodeParams); color = gammaCorrection(color, params.gammaDecodeParams);

View File

@ -32,11 +32,12 @@ float3 gammaCorrection(float3 v, GammaTransferParams params) {
} }
float4 textureLoadExternal(Texture2D<float4> plane0, Texture2D<float4> plane1, uint2 coord, ExternalTextureParams params) { float4 textureLoadExternal(Texture2D<float4> plane0, Texture2D<float4> plane1, uint2 coord, ExternalTextureParams params) {
const uint2 coord1 = (coord >> (1u).xx);
float3 color = float3(0.0f, 0.0f, 0.0f); float3 color = float3(0.0f, 0.0f, 0.0f);
if ((params.numPlanes == 1u)) { if ((params.numPlanes == 1u)) {
color = plane0.Load(uint3(coord, uint(0))).rgb; color = plane0.Load(uint3(coord, uint(0))).rgb;
} else { } else {
color = mul(params.yuvToRgbConversionMatrix, float4(plane0.Load(uint3(coord, uint(0))).r, plane1.Load(uint3(coord, uint(0))).rg, 1.0f)); color = mul(params.yuvToRgbConversionMatrix, float4(plane0.Load(uint3(coord, uint(0))).r, plane1.Load(uint3(coord1, uint(0))).rg, 1.0f));
} }
if ((params.doYuvToRgbConversionOnly == 0u)) { if ((params.doYuvToRgbConversionOnly == 0u)) {
color = gammaCorrection(color, params.gammaDecodeParams); color = gammaCorrection(color, params.gammaDecodeParams);

View File

@ -32,11 +32,12 @@ float3 gammaCorrection(float3 v, GammaTransferParams params) {
} }
float4 textureLoadExternal(Texture2D<float4> plane0, Texture2D<float4> plane1, uint2 coord, ExternalTextureParams params) { float4 textureLoadExternal(Texture2D<float4> plane0, Texture2D<float4> plane1, uint2 coord, ExternalTextureParams params) {
const uint2 coord1 = (coord >> (1u).xx);
float3 color = float3(0.0f, 0.0f, 0.0f); float3 color = float3(0.0f, 0.0f, 0.0f);
if ((params.numPlanes == 1u)) { if ((params.numPlanes == 1u)) {
color = plane0.Load(uint3(coord, uint(0))).rgb; color = plane0.Load(uint3(coord, uint(0))).rgb;
} else { } else {
color = mul(params.yuvToRgbConversionMatrix, float4(plane0.Load(uint3(coord, uint(0))).r, plane1.Load(uint3(coord, uint(0))).rg, 1.0f)); color = mul(params.yuvToRgbConversionMatrix, float4(plane0.Load(uint3(coord, uint(0))).r, plane1.Load(uint3(coord1, uint(0))).rg, 1.0f));
} }
if ((params.doYuvToRgbConversionOnly == 0u)) { if ((params.doYuvToRgbConversionOnly == 0u)) {
color = gammaCorrection(color, params.gammaDecodeParams); color = gammaCorrection(color, params.gammaDecodeParams);

View File

@ -45,11 +45,12 @@ vec3 gammaCorrection(vec3 v, GammaTransferParams params) {
} }
vec4 textureLoadExternal(highp sampler2D plane0_1, highp sampler2D plane1_1, uvec2 coord, ExternalTextureParams params) { vec4 textureLoadExternal(highp sampler2D plane0_1, highp sampler2D plane1_1, uvec2 coord, ExternalTextureParams params) {
uvec2 coord1 = (coord >> uvec2(1u));
vec3 color = vec3(0.0f, 0.0f, 0.0f); vec3 color = vec3(0.0f, 0.0f, 0.0f);
if ((params.numPlanes == 1u)) { if ((params.numPlanes == 1u)) {
color = texelFetch(plane0_1, ivec2(coord), 0).rgb; color = texelFetch(plane0_1, ivec2(coord), 0).rgb;
} else { } else {
color = (vec4(texelFetch(plane0_1, ivec2(coord), 0).r, texelFetch(plane1_1, ivec2(coord), 0).rg, 1.0f) * params.yuvToRgbConversionMatrix); color = (vec4(texelFetch(plane0_1, ivec2(coord), 0).r, texelFetch(plane1_1, ivec2(coord1), 0).rg, 1.0f) * params.yuvToRgbConversionMatrix);
} }
if ((params.doYuvToRgbConversionOnly == 0u)) { if ((params.doYuvToRgbConversionOnly == 0u)) {
color = gammaCorrection(color, params.gammaDecodeParams); color = gammaCorrection(color, params.gammaDecodeParams);
@ -130,11 +131,12 @@ vec3 gammaCorrection(vec3 v, GammaTransferParams params) {
} }
vec4 textureLoadExternal(highp sampler2D plane0_1, highp sampler2D plane1_1, uvec2 coord, ExternalTextureParams params) { vec4 textureLoadExternal(highp sampler2D plane0_1, highp sampler2D plane1_1, uvec2 coord, ExternalTextureParams params) {
uvec2 coord1 = (coord >> uvec2(1u));
vec3 color = vec3(0.0f, 0.0f, 0.0f); vec3 color = vec3(0.0f, 0.0f, 0.0f);
if ((params.numPlanes == 1u)) { if ((params.numPlanes == 1u)) {
color = texelFetch(plane0_1, ivec2(coord), 0).rgb; color = texelFetch(plane0_1, ivec2(coord), 0).rgb;
} else { } else {
color = (vec4(texelFetch(plane0_1, ivec2(coord), 0).r, texelFetch(plane1_1, ivec2(coord), 0).rg, 1.0f) * params.yuvToRgbConversionMatrix); color = (vec4(texelFetch(plane0_1, ivec2(coord), 0).r, texelFetch(plane1_1, ivec2(coord1), 0).rg, 1.0f) * params.yuvToRgbConversionMatrix);
} }
if ((params.doYuvToRgbConversionOnly == 0u)) { if ((params.doYuvToRgbConversionOnly == 0u)) {
color = gammaCorrection(color, params.gammaDecodeParams); color = gammaCorrection(color, params.gammaDecodeParams);
@ -209,11 +211,12 @@ vec3 gammaCorrection(vec3 v, GammaTransferParams params) {
} }
vec4 textureLoadExternal(highp sampler2D plane0_1, highp sampler2D plane1_1, uvec2 coord, ExternalTextureParams params) { vec4 textureLoadExternal(highp sampler2D plane0_1, highp sampler2D plane1_1, uvec2 coord, ExternalTextureParams params) {
uvec2 coord1 = (coord >> uvec2(1u));
vec3 color = vec3(0.0f, 0.0f, 0.0f); vec3 color = vec3(0.0f, 0.0f, 0.0f);
if ((params.numPlanes == 1u)) { if ((params.numPlanes == 1u)) {
color = texelFetch(plane0_1, ivec2(coord), 0).rgb; color = texelFetch(plane0_1, ivec2(coord), 0).rgb;
} else { } else {
color = (vec4(texelFetch(plane0_1, ivec2(coord), 0).r, texelFetch(plane1_1, ivec2(coord), 0).rg, 1.0f) * params.yuvToRgbConversionMatrix); color = (vec4(texelFetch(plane0_1, ivec2(coord), 0).r, texelFetch(plane1_1, ivec2(coord1), 0).rg, 1.0f) * params.yuvToRgbConversionMatrix);
} }
if ((params.doYuvToRgbConversionOnly == 0u)) { if ((params.doYuvToRgbConversionOnly == 0u)) {
color = gammaCorrection(color, params.gammaDecodeParams); color = gammaCorrection(color, params.gammaDecodeParams);

View File

@ -45,11 +45,12 @@ float3 gammaCorrection(float3 v, GammaTransferParams params) {
} }
float4 textureLoadExternal(texture2d<float, access::sample> plane0, texture2d<float, access::sample> plane1, uint2 coord, ExternalTextureParams params) { float4 textureLoadExternal(texture2d<float, access::sample> plane0, texture2d<float, access::sample> plane1, uint2 coord, ExternalTextureParams params) {
uint2 const coord1 = (coord >> uint2(1u));
float3 color = 0.0f; float3 color = 0.0f;
if ((params.numPlanes == 1u)) { if ((params.numPlanes == 1u)) {
color = float4(plane0.read(uint2(coord), 0)).rgb; color = float4(plane0.read(uint2(coord), 0)).rgb;
} else { } else {
color = (float4(plane0.read(uint2(coord), 0)[0], float4(plane1.read(uint2(coord), 0)).rg, 1.0f) * params.yuvToRgbConversionMatrix); color = (float4(plane0.read(uint2(coord), 0)[0], float4(plane1.read(uint2(coord1), 0)).rg, 1.0f) * params.yuvToRgbConversionMatrix);
} }
if ((params.doYuvToRgbConversionOnly == 0u)) { if ((params.doYuvToRgbConversionOnly == 0u)) {
color = gammaCorrection(color, params.gammaDecodeParams); color = gammaCorrection(color, params.gammaDecodeParams);

View File

@ -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: 156 ; Bound: 157
; Schema: 0 ; Schema: 0
OpCapability Shader OpCapability Shader
%29 = OpExtInstImport "GLSL.std.450" %29 = OpExtInstImport "GLSL.std.450"
@ -139,18 +139,18 @@
%ExternalTextureParams = OpTypeStruct %uint %uint %mat3v4float %GammaTransferParams %GammaTransferParams %mat3v3float %mat3v2float %ExternalTextureParams = OpTypeStruct %uint %uint %mat3v4float %GammaTransferParams %GammaTransferParams %mat3v3float %mat3v2float
%63 = OpTypeFunction %v4float %11 %11 %v2uint %ExternalTextureParams %63 = OpTypeFunction %v4float %11 %11 %v2uint %ExternalTextureParams
%uint_1 = OpConstant %uint 1 %uint_1 = OpConstant %uint 1
%74 = OpConstantComposite %v2uint %uint_1 %uint_1
%int = OpTypeInt 32 1 %int = OpTypeInt 32 1
%82 = OpConstantNull %int %84 = OpConstantNull %int
%float_1 = OpConstant %float 1 %float_1 = OpConstant %float 1
%95 = OpConstantNull %uint %97 = OpConstantNull %uint
%113 = OpTypeFunction %ExternalTextureParams %ExternalTextureParams_std140 %115 = OpTypeFunction %ExternalTextureParams %ExternalTextureParams_std140
%void = OpTypeVoid %void = OpTypeVoid
%128 = OpTypeFunction %void %130 = OpTypeFunction %void
%135 = OpConstantComposite %v2uint %uint_1 %uint_1
%uint_0 = OpConstant %uint 0 %uint_0 = OpConstant %uint 0
%_ptr_Uniform_ExternalTextureParams_std140 = OpTypePointer Uniform %ExternalTextureParams_std140 %_ptr_Uniform_ExternalTextureParams_std140 = OpTypePointer Uniform %ExternalTextureParams_std140
%_ptr_Function_v4float = OpTypePointer Function %v4float %_ptr_Function_v4float = OpTypePointer Function %v4float
%143 = OpTypeFunction %v4float %144 = OpTypeFunction %v4float
%gammaCorrection = OpFunction %v3float None %23 %gammaCorrection = OpFunction %v3float None %23
%v = OpFunctionParameter %v3float %v = OpFunctionParameter %v3float
%params = OpFunctionParameter %GammaTransferParams %params = OpFunctionParameter %GammaTransferParams
@ -194,101 +194,102 @@
%params_0 = OpFunctionParameter %ExternalTextureParams %params_0 = OpFunctionParameter %ExternalTextureParams
%72 = OpLabel %72 = OpLabel
%color = OpVariable %_ptr_Function_v3float Function %43 %color = OpVariable %_ptr_Function_v3float Function %43
%74 = OpCompositeExtract %uint %params_0 0 %75 = OpShiftRightLogical %v2uint %coord %74
%76 = OpIEqual %bool %74 %uint_1 %77 = OpCompositeExtract %uint %params_0 0
OpSelectionMerge %77 None %78 = OpIEqual %bool %77 %uint_1
OpBranchConditional %76 %78 %79 OpSelectionMerge %79 None
%78 = OpLabel OpBranchConditional %78 %80 %81
%80 = OpImageFetch %v4float %plane0 %coord Lod %82 %80 = OpLabel
%83 = OpVectorShuffle %v3float %80 %80 0 1 2 %82 = OpImageFetch %v4float %plane0 %coord Lod %84
OpStore %color %83 %85 = OpVectorShuffle %v3float %82 %82 0 1 2
OpBranch %77 OpStore %color %85
OpBranch %79
%81 = OpLabel
%86 = OpImageFetch %v4float %plane0 %coord Lod %84
%87 = OpCompositeExtract %float %86 0
%88 = OpImageFetch %v4float %plane1 %75 Lod %84
%89 = OpVectorShuffle %v2float %88 %88 0 1
%90 = OpCompositeExtract %float %89 0
%91 = OpCompositeExtract %float %89 1
%93 = OpCompositeConstruct %v4float %87 %90 %91 %float_1
%94 = OpCompositeExtract %mat3v4float %params_0 2
%95 = OpVectorTimesMatrix %v3float %93 %94
OpStore %color %95
OpBranch %79
%79 = OpLabel %79 = OpLabel
%84 = OpImageFetch %v4float %plane0 %coord Lod %82 %96 = OpCompositeExtract %uint %params_0 1
%85 = OpCompositeExtract %float %84 0 %98 = OpIEqual %bool %96 %97
%86 = OpImageFetch %v4float %plane1 %coord Lod %82 OpSelectionMerge %99 None
%87 = OpVectorShuffle %v2float %86 %86 0 1 OpBranchConditional %98 %100 %99
%88 = OpCompositeExtract %float %87 0 %100 = OpLabel
%89 = OpCompositeExtract %float %87 1 %102 = OpLoad %v3float %color
%91 = OpCompositeConstruct %v4float %85 %88 %89 %float_1 %103 = OpCompositeExtract %GammaTransferParams %params_0 3
%92 = OpCompositeExtract %mat3v4float %params_0 2 %101 = OpFunctionCall %v3float %gammaCorrection %102 %103
%93 = OpVectorTimesMatrix %v3float %91 %92 OpStore %color %101
OpStore %color %93 %104 = OpCompositeExtract %mat3v3float %params_0 5
OpBranch %77 %105 = OpLoad %v3float %color
%77 = OpLabel %106 = OpMatrixTimesVector %v3float %104 %105
%94 = OpCompositeExtract %uint %params_0 1 OpStore %color %106
%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
%97 = OpLabel
%108 = OpLoad %v3float %color %108 = OpLoad %v3float %color
%109 = OpCompositeExtract %float %108 0 %109 = OpCompositeExtract %GammaTransferParams %params_0 4
%110 = OpCompositeExtract %float %108 1 %107 = OpFunctionCall %v3float %gammaCorrection %108 %109
%111 = OpCompositeExtract %float %108 2 OpStore %color %107
%112 = OpCompositeConstruct %v4float %109 %110 %111 %float_1 OpBranch %99
OpReturnValue %112 %99 = OpLabel
%110 = OpLoad %v3float %color
%111 = OpCompositeExtract %float %110 0
%112 = OpCompositeExtract %float %110 1
%113 = OpCompositeExtract %float %110 2
%114 = OpCompositeConstruct %v4float %111 %112 %113 %float_1
OpReturnValue %114
OpFunctionEnd OpFunctionEnd
%conv_ExternalTextureParams = OpFunction %ExternalTextureParams None %113 %conv_ExternalTextureParams = OpFunction %ExternalTextureParams None %115
%val = OpFunctionParameter %ExternalTextureParams_std140 %val = OpFunctionParameter %ExternalTextureParams_std140
%116 = OpLabel %118 = OpLabel
%117 = OpCompositeExtract %uint %val 0 %119 = OpCompositeExtract %uint %val 0
%118 = OpCompositeExtract %uint %val 1 %120 = OpCompositeExtract %uint %val 1
%119 = OpCompositeExtract %mat3v4float %val 2 %121 = OpCompositeExtract %mat3v4float %val 2
%120 = OpCompositeExtract %GammaTransferParams %val 3 %122 = OpCompositeExtract %GammaTransferParams %val 3
%121 = OpCompositeExtract %GammaTransferParams %val 4 %123 = OpCompositeExtract %GammaTransferParams %val 4
%122 = OpCompositeExtract %mat3v3float %val 5 %124 = OpCompositeExtract %mat3v3float %val 5
%123 = OpCompositeExtract %v2float %val 6 %125 = OpCompositeExtract %v2float %val 6
%124 = OpCompositeExtract %v2float %val 7 %126 = OpCompositeExtract %v2float %val 7
%125 = OpCompositeExtract %v2float %val 8 %127 = OpCompositeExtract %v2float %val 8
%126 = OpCompositeConstruct %mat3v2float %123 %124 %125 %128 = OpCompositeConstruct %mat3v2float %125 %126 %127
%127 = OpCompositeConstruct %ExternalTextureParams %117 %118 %119 %120 %121 %122 %126 %129 = OpCompositeConstruct %ExternalTextureParams %119 %120 %121 %122 %123 %124 %128
OpReturnValue %127 OpReturnValue %129
OpFunctionEnd OpFunctionEnd
%textureLoad_1bfdfb = OpFunction %void None %128 %textureLoad_1bfdfb = OpFunction %void None %130
%131 = OpLabel %133 = OpLabel
%res = OpVariable %_ptr_Function_v4float Function %5 %res = OpVariable %_ptr_Function_v4float Function %5
%133 = OpLoad %11 %arg_0 %135 = OpLoad %11 %arg_0
%134 = OpLoad %11 %ext_tex_plane_1 %136 = OpLoad %11 %ext_tex_plane_1
%139 = OpAccessChain %_ptr_Uniform_ExternalTextureParams_std140 %ext_tex_params %uint_0 %140 = OpAccessChain %_ptr_Uniform_ExternalTextureParams_std140 %ext_tex_params %uint_0
%140 = OpLoad %ExternalTextureParams_std140 %139 %141 = OpLoad %ExternalTextureParams_std140 %140
%136 = OpFunctionCall %ExternalTextureParams %conv_ExternalTextureParams %140 %137 = OpFunctionCall %ExternalTextureParams %conv_ExternalTextureParams %141
%132 = OpFunctionCall %v4float %textureLoadExternal %133 %134 %135 %136 %134 = OpFunctionCall %v4float %textureLoadExternal %135 %136 %74 %137
OpStore %res %132 OpStore %res %134
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd
%vertex_main_inner = OpFunction %v4float None %143 %vertex_main_inner = OpFunction %v4float None %144
%145 = OpLabel %146 = OpLabel
%146 = OpFunctionCall %void %textureLoad_1bfdfb %147 = OpFunctionCall %void %textureLoad_1bfdfb
OpReturnValue %5 OpReturnValue %5
OpFunctionEnd OpFunctionEnd
%vertex_main = OpFunction %void None %128 %vertex_main = OpFunction %void None %130
%148 = OpLabel %149 = OpLabel
%149 = OpFunctionCall %v4float %vertex_main_inner %150 = OpFunctionCall %v4float %vertex_main_inner
OpStore %value %149 OpStore %value %150
OpStore %vertex_point_size %float_1 OpStore %vertex_point_size %float_1
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd
%fragment_main = OpFunction %void None %128 %fragment_main = OpFunction %void None %130
%151 = OpLabel %152 = OpLabel
%152 = OpFunctionCall %void %textureLoad_1bfdfb %153 = OpFunctionCall %void %textureLoad_1bfdfb
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd
%compute_main = OpFunction %void None %128 %compute_main = OpFunction %void None %130
%154 = OpLabel %155 = OpLabel
%155 = OpFunctionCall %void %textureLoad_1bfdfb %156 = OpFunctionCall %void %textureLoad_1bfdfb
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd

View File

@ -32,11 +32,12 @@ float3 gammaCorrection(float3 v, GammaTransferParams params) {
} }
float4 textureLoadExternal(Texture2D<float4> plane0, Texture2D<float4> plane1, int2 coord, ExternalTextureParams params) { float4 textureLoadExternal(Texture2D<float4> plane0, Texture2D<float4> plane1, int2 coord, ExternalTextureParams params) {
const int2 coord1 = (coord >> (1u).xx);
float3 color = float3(0.0f, 0.0f, 0.0f); float3 color = float3(0.0f, 0.0f, 0.0f);
if ((params.numPlanes == 1u)) { if ((params.numPlanes == 1u)) {
color = plane0.Load(int3(coord, 0)).rgb; color = plane0.Load(int3(coord, 0)).rgb;
} else { } else {
color = mul(params.yuvToRgbConversionMatrix, float4(plane0.Load(int3(coord, 0)).r, plane1.Load(int3(coord, 0)).rg, 1.0f)); color = mul(params.yuvToRgbConversionMatrix, float4(plane0.Load(int3(coord, 0)).r, plane1.Load(int3(coord1, 0)).rg, 1.0f));
} }
if ((params.doYuvToRgbConversionOnly == 0u)) { if ((params.doYuvToRgbConversionOnly == 0u)) {
color = gammaCorrection(color, params.gammaDecodeParams); color = gammaCorrection(color, params.gammaDecodeParams);

View File

@ -32,11 +32,12 @@ float3 gammaCorrection(float3 v, GammaTransferParams params) {
} }
float4 textureLoadExternal(Texture2D<float4> plane0, Texture2D<float4> plane1, int2 coord, ExternalTextureParams params) { float4 textureLoadExternal(Texture2D<float4> plane0, Texture2D<float4> plane1, int2 coord, ExternalTextureParams params) {
const int2 coord1 = (coord >> (1u).xx);
float3 color = float3(0.0f, 0.0f, 0.0f); float3 color = float3(0.0f, 0.0f, 0.0f);
if ((params.numPlanes == 1u)) { if ((params.numPlanes == 1u)) {
color = plane0.Load(int3(coord, 0)).rgb; color = plane0.Load(int3(coord, 0)).rgb;
} else { } else {
color = mul(params.yuvToRgbConversionMatrix, float4(plane0.Load(int3(coord, 0)).r, plane1.Load(int3(coord, 0)).rg, 1.0f)); color = mul(params.yuvToRgbConversionMatrix, float4(plane0.Load(int3(coord, 0)).r, plane1.Load(int3(coord1, 0)).rg, 1.0f));
} }
if ((params.doYuvToRgbConversionOnly == 0u)) { if ((params.doYuvToRgbConversionOnly == 0u)) {
color = gammaCorrection(color, params.gammaDecodeParams); color = gammaCorrection(color, params.gammaDecodeParams);

View File

@ -45,11 +45,12 @@ vec3 gammaCorrection(vec3 v, GammaTransferParams params) {
} }
vec4 textureLoadExternal(highp sampler2D plane0_1, highp sampler2D plane1_1, ivec2 coord, ExternalTextureParams params) { vec4 textureLoadExternal(highp sampler2D plane0_1, highp sampler2D plane1_1, ivec2 coord, ExternalTextureParams params) {
ivec2 coord1 = (coord >> uvec2(1u));
vec3 color = vec3(0.0f, 0.0f, 0.0f); vec3 color = vec3(0.0f, 0.0f, 0.0f);
if ((params.numPlanes == 1u)) { if ((params.numPlanes == 1u)) {
color = texelFetch(plane0_1, coord, 0).rgb; color = texelFetch(plane0_1, coord, 0).rgb;
} else { } else {
color = (vec4(texelFetch(plane0_1, coord, 0).r, texelFetch(plane1_1, coord, 0).rg, 1.0f) * params.yuvToRgbConversionMatrix); color = (vec4(texelFetch(plane0_1, coord, 0).r, texelFetch(plane1_1, coord1, 0).rg, 1.0f) * params.yuvToRgbConversionMatrix);
} }
if ((params.doYuvToRgbConversionOnly == 0u)) { if ((params.doYuvToRgbConversionOnly == 0u)) {
color = gammaCorrection(color, params.gammaDecodeParams); color = gammaCorrection(color, params.gammaDecodeParams);
@ -130,11 +131,12 @@ vec3 gammaCorrection(vec3 v, GammaTransferParams params) {
} }
vec4 textureLoadExternal(highp sampler2D plane0_1, highp sampler2D plane1_1, ivec2 coord, ExternalTextureParams params) { vec4 textureLoadExternal(highp sampler2D plane0_1, highp sampler2D plane1_1, ivec2 coord, ExternalTextureParams params) {
ivec2 coord1 = (coord >> uvec2(1u));
vec3 color = vec3(0.0f, 0.0f, 0.0f); vec3 color = vec3(0.0f, 0.0f, 0.0f);
if ((params.numPlanes == 1u)) { if ((params.numPlanes == 1u)) {
color = texelFetch(plane0_1, coord, 0).rgb; color = texelFetch(plane0_1, coord, 0).rgb;
} else { } else {
color = (vec4(texelFetch(plane0_1, coord, 0).r, texelFetch(plane1_1, coord, 0).rg, 1.0f) * params.yuvToRgbConversionMatrix); color = (vec4(texelFetch(plane0_1, coord, 0).r, texelFetch(plane1_1, coord1, 0).rg, 1.0f) * params.yuvToRgbConversionMatrix);
} }
if ((params.doYuvToRgbConversionOnly == 0u)) { if ((params.doYuvToRgbConversionOnly == 0u)) {
color = gammaCorrection(color, params.gammaDecodeParams); color = gammaCorrection(color, params.gammaDecodeParams);
@ -209,11 +211,12 @@ vec3 gammaCorrection(vec3 v, GammaTransferParams params) {
} }
vec4 textureLoadExternal(highp sampler2D plane0_1, highp sampler2D plane1_1, ivec2 coord, ExternalTextureParams params) { vec4 textureLoadExternal(highp sampler2D plane0_1, highp sampler2D plane1_1, ivec2 coord, ExternalTextureParams params) {
ivec2 coord1 = (coord >> uvec2(1u));
vec3 color = vec3(0.0f, 0.0f, 0.0f); vec3 color = vec3(0.0f, 0.0f, 0.0f);
if ((params.numPlanes == 1u)) { if ((params.numPlanes == 1u)) {
color = texelFetch(plane0_1, coord, 0).rgb; color = texelFetch(plane0_1, coord, 0).rgb;
} else { } else {
color = (vec4(texelFetch(plane0_1, coord, 0).r, texelFetch(plane1_1, coord, 0).rg, 1.0f) * params.yuvToRgbConversionMatrix); color = (vec4(texelFetch(plane0_1, coord, 0).r, texelFetch(plane1_1, coord1, 0).rg, 1.0f) * params.yuvToRgbConversionMatrix);
} }
if ((params.doYuvToRgbConversionOnly == 0u)) { if ((params.doYuvToRgbConversionOnly == 0u)) {
color = gammaCorrection(color, params.gammaDecodeParams); color = gammaCorrection(color, params.gammaDecodeParams);

View File

@ -45,11 +45,12 @@ float3 gammaCorrection(float3 v, GammaTransferParams params) {
} }
float4 textureLoadExternal(texture2d<float, access::sample> plane0, texture2d<float, access::sample> plane1, int2 coord, ExternalTextureParams params) { float4 textureLoadExternal(texture2d<float, access::sample> plane0, texture2d<float, access::sample> plane1, int2 coord, ExternalTextureParams params) {
int2 const coord1 = (coord >> uint2(1u));
float3 color = 0.0f; float3 color = 0.0f;
if ((params.numPlanes == 1u)) { if ((params.numPlanes == 1u)) {
color = float4(plane0.read(uint2(coord), 0)).rgb; color = float4(plane0.read(uint2(coord), 0)).rgb;
} else { } else {
color = (float4(plane0.read(uint2(coord), 0)[0], float4(plane1.read(uint2(coord), 0)).rg, 1.0f) * params.yuvToRgbConversionMatrix); color = (float4(plane0.read(uint2(coord), 0)[0], float4(plane1.read(uint2(coord1), 0)).rg, 1.0f) * params.yuvToRgbConversionMatrix);
} }
if ((params.doYuvToRgbConversionOnly == 0u)) { if ((params.doYuvToRgbConversionOnly == 0u)) {
color = gammaCorrection(color, params.gammaDecodeParams); color = gammaCorrection(color, params.gammaDecodeParams);

View File

@ -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: 157 ; Bound: 160
; Schema: 0 ; Schema: 0
OpCapability Shader OpCapability Shader
%29 = OpExtInstImport "GLSL.std.450" %29 = OpExtInstImport "GLSL.std.450"
@ -139,19 +139,21 @@
%mat3v2float = OpTypeMatrix %v2float 3 %mat3v2float = OpTypeMatrix %v2float 3
%ExternalTextureParams = OpTypeStruct %uint %uint %mat3v4float %GammaTransferParams %GammaTransferParams %mat3v3float %mat3v2float %ExternalTextureParams = OpTypeStruct %uint %uint %mat3v4float %GammaTransferParams %GammaTransferParams %mat3v3float %mat3v2float
%63 = OpTypeFunction %v4float %11 %11 %v2int %ExternalTextureParams %63 = OpTypeFunction %v4float %11 %11 %v2int %ExternalTextureParams
%v2uint = OpTypeVector %uint 2
%uint_1 = OpConstant %uint 1 %uint_1 = OpConstant %uint 1
%82 = OpConstantNull %int %76 = OpConstantComposite %v2uint %uint_1 %uint_1
%85 = OpConstantNull %int
%float_1 = OpConstant %float 1 %float_1 = OpConstant %float 1
%95 = OpConstantNull %uint %98 = OpConstantNull %uint
%113 = OpTypeFunction %ExternalTextureParams %ExternalTextureParams_std140 %116 = OpTypeFunction %ExternalTextureParams %ExternalTextureParams_std140
%void = OpTypeVoid %void = OpTypeVoid
%128 = OpTypeFunction %void %131 = OpTypeFunction %void
%int_1 = OpConstant %int 1 %int_1 = OpConstant %int 1
%136 = OpConstantComposite %v2int %int_1 %int_1 %139 = OpConstantComposite %v2int %int_1 %int_1
%uint_0 = OpConstant %uint 0 %uint_0 = OpConstant %uint 0
%_ptr_Uniform_ExternalTextureParams_std140 = OpTypePointer Uniform %ExternalTextureParams_std140 %_ptr_Uniform_ExternalTextureParams_std140 = OpTypePointer Uniform %ExternalTextureParams_std140
%_ptr_Function_v4float = OpTypePointer Function %v4float %_ptr_Function_v4float = OpTypePointer Function %v4float
%144 = OpTypeFunction %v4float %147 = OpTypeFunction %v4float
%gammaCorrection = OpFunction %v3float None %23 %gammaCorrection = OpFunction %v3float None %23
%v = OpFunctionParameter %v3float %v = OpFunctionParameter %v3float
%params = OpFunctionParameter %GammaTransferParams %params = OpFunctionParameter %GammaTransferParams
@ -195,101 +197,102 @@
%params_0 = OpFunctionParameter %ExternalTextureParams %params_0 = OpFunctionParameter %ExternalTextureParams
%73 = OpLabel %73 = OpLabel
%color = OpVariable %_ptr_Function_v3float Function %43 %color = OpVariable %_ptr_Function_v3float Function %43
%75 = OpCompositeExtract %uint %params_0 0 %77 = OpShiftRightArithmetic %v2int %coord %76
%77 = OpIEqual %bool %75 %uint_1 %79 = OpCompositeExtract %uint %params_0 0
OpSelectionMerge %78 None %80 = OpIEqual %bool %79 %uint_1
OpBranchConditional %77 %79 %80 OpSelectionMerge %81 None
%79 = OpLabel OpBranchConditional %80 %82 %83
%81 = OpImageFetch %v4float %plane0 %coord Lod %82 %82 = OpLabel
%83 = OpVectorShuffle %v3float %81 %81 0 1 2 %84 = OpImageFetch %v4float %plane0 %coord Lod %85
OpStore %color %83 %86 = OpVectorShuffle %v3float %84 %84 0 1 2
OpBranch %78 OpStore %color %86
%80 = OpLabel OpBranch %81
%84 = OpImageFetch %v4float %plane0 %coord Lod %82 %83 = OpLabel
%85 = OpCompositeExtract %float %84 0 %87 = OpImageFetch %v4float %plane0 %coord Lod %85
%86 = OpImageFetch %v4float %plane1 %coord Lod %82
%87 = OpVectorShuffle %v2float %86 %86 0 1
%88 = OpCompositeExtract %float %87 0 %88 = OpCompositeExtract %float %87 0
%89 = OpCompositeExtract %float %87 1 %89 = OpImageFetch %v4float %plane1 %77 Lod %85
%91 = OpCompositeConstruct %v4float %85 %88 %89 %float_1 %90 = OpVectorShuffle %v2float %89 %89 0 1
%92 = OpCompositeExtract %mat3v4float %params_0 2 %91 = OpCompositeExtract %float %90 0
%93 = OpVectorTimesMatrix %v3float %91 %92 %92 = OpCompositeExtract %float %90 1
OpStore %color %93 %94 = OpCompositeConstruct %v4float %88 %91 %92 %float_1
OpBranch %78 %95 = OpCompositeExtract %mat3v4float %params_0 2
%78 = OpLabel %96 = OpVectorTimesMatrix %v3float %94 %95
%94 = OpCompositeExtract %uint %params_0 1 OpStore %color %96
%96 = OpIEqual %bool %94 %95 OpBranch %81
OpSelectionMerge %97 None %81 = OpLabel
OpBranchConditional %96 %98 %97 %97 = OpCompositeExtract %uint %params_0 1
%98 = OpLabel %99 = OpIEqual %bool %97 %98
%100 = OpLoad %v3float %color OpSelectionMerge %100 None
%101 = OpCompositeExtract %GammaTransferParams %params_0 3 OpBranchConditional %99 %101 %100
%99 = OpFunctionCall %v3float %gammaCorrection %100 %101 %101 = OpLabel
OpStore %color %99
%102 = OpCompositeExtract %mat3v3float %params_0 5
%103 = OpLoad %v3float %color %103 = OpLoad %v3float %color
%104 = OpMatrixTimesVector %v3float %102 %103 %104 = OpCompositeExtract %GammaTransferParams %params_0 3
OpStore %color %104 %102 = OpFunctionCall %v3float %gammaCorrection %103 %104
OpStore %color %102
%105 = OpCompositeExtract %mat3v3float %params_0 5
%106 = OpLoad %v3float %color %106 = OpLoad %v3float %color
%107 = OpCompositeExtract %GammaTransferParams %params_0 4 %107 = OpMatrixTimesVector %v3float %105 %106
%105 = OpFunctionCall %v3float %gammaCorrection %106 %107 OpStore %color %107
OpStore %color %105 %109 = OpLoad %v3float %color
OpBranch %97 %110 = OpCompositeExtract %GammaTransferParams %params_0 4
%97 = OpLabel %108 = OpFunctionCall %v3float %gammaCorrection %109 %110
%108 = OpLoad %v3float %color OpStore %color %108
%109 = OpCompositeExtract %float %108 0 OpBranch %100
%110 = OpCompositeExtract %float %108 1 %100 = OpLabel
%111 = OpCompositeExtract %float %108 2 %111 = OpLoad %v3float %color
%112 = OpCompositeConstruct %v4float %109 %110 %111 %float_1 %112 = OpCompositeExtract %float %111 0
OpReturnValue %112 %113 = OpCompositeExtract %float %111 1
%114 = OpCompositeExtract %float %111 2
%115 = OpCompositeConstruct %v4float %112 %113 %114 %float_1
OpReturnValue %115
OpFunctionEnd OpFunctionEnd
%conv_ExternalTextureParams = OpFunction %ExternalTextureParams None %113 %conv_ExternalTextureParams = OpFunction %ExternalTextureParams None %116
%val = OpFunctionParameter %ExternalTextureParams_std140 %val = OpFunctionParameter %ExternalTextureParams_std140
%116 = OpLabel %119 = OpLabel
%117 = OpCompositeExtract %uint %val 0 %120 = OpCompositeExtract %uint %val 0
%118 = OpCompositeExtract %uint %val 1 %121 = OpCompositeExtract %uint %val 1
%119 = OpCompositeExtract %mat3v4float %val 2 %122 = OpCompositeExtract %mat3v4float %val 2
%120 = OpCompositeExtract %GammaTransferParams %val 3 %123 = OpCompositeExtract %GammaTransferParams %val 3
%121 = OpCompositeExtract %GammaTransferParams %val 4 %124 = OpCompositeExtract %GammaTransferParams %val 4
%122 = OpCompositeExtract %mat3v3float %val 5 %125 = OpCompositeExtract %mat3v3float %val 5
%123 = OpCompositeExtract %v2float %val 6 %126 = OpCompositeExtract %v2float %val 6
%124 = OpCompositeExtract %v2float %val 7 %127 = OpCompositeExtract %v2float %val 7
%125 = OpCompositeExtract %v2float %val 8 %128 = OpCompositeExtract %v2float %val 8
%126 = OpCompositeConstruct %mat3v2float %123 %124 %125 %129 = OpCompositeConstruct %mat3v2float %126 %127 %128
%127 = OpCompositeConstruct %ExternalTextureParams %117 %118 %119 %120 %121 %122 %126 %130 = OpCompositeConstruct %ExternalTextureParams %120 %121 %122 %123 %124 %125 %129
OpReturnValue %127 OpReturnValue %130
OpFunctionEnd OpFunctionEnd
%textureLoad_8acf41 = OpFunction %void None %128 %textureLoad_8acf41 = OpFunction %void None %131
%131 = OpLabel %134 = OpLabel
%res = OpVariable %_ptr_Function_v4float Function %5 %res = OpVariable %_ptr_Function_v4float Function %5
%133 = OpLoad %11 %arg_0 %136 = OpLoad %11 %arg_0
%134 = OpLoad %11 %ext_tex_plane_1 %137 = OpLoad %11 %ext_tex_plane_1
%140 = OpAccessChain %_ptr_Uniform_ExternalTextureParams_std140 %ext_tex_params %uint_0 %143 = OpAccessChain %_ptr_Uniform_ExternalTextureParams_std140 %ext_tex_params %uint_0
%141 = OpLoad %ExternalTextureParams_std140 %140 %144 = OpLoad %ExternalTextureParams_std140 %143
%137 = OpFunctionCall %ExternalTextureParams %conv_ExternalTextureParams %141 %140 = OpFunctionCall %ExternalTextureParams %conv_ExternalTextureParams %144
%132 = OpFunctionCall %v4float %textureLoadExternal %133 %134 %136 %137 %135 = OpFunctionCall %v4float %textureLoadExternal %136 %137 %139 %140
OpStore %res %132 OpStore %res %135
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd
%vertex_main_inner = OpFunction %v4float None %144 %vertex_main_inner = OpFunction %v4float None %147
%146 = OpLabel %149 = OpLabel
%147 = OpFunctionCall %void %textureLoad_8acf41 %150 = OpFunctionCall %void %textureLoad_8acf41
OpReturnValue %5 OpReturnValue %5
OpFunctionEnd OpFunctionEnd
%vertex_main = OpFunction %void None %128 %vertex_main = OpFunction %void None %131
%149 = OpLabel %152 = OpLabel
%150 = OpFunctionCall %v4float %vertex_main_inner %153 = OpFunctionCall %v4float %vertex_main_inner
OpStore %value %150 OpStore %value %153
OpStore %vertex_point_size %float_1 OpStore %vertex_point_size %float_1
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd
%fragment_main = OpFunction %void None %128 %fragment_main = OpFunction %void None %131
%152 = OpLabel
%153 = OpFunctionCall %void %textureLoad_8acf41
OpReturn
OpFunctionEnd
%compute_main = OpFunction %void None %128
%155 = OpLabel %155 = OpLabel
%156 = OpFunctionCall %void %textureLoad_8acf41 %156 = OpFunctionCall %void %textureLoad_8acf41
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd
%compute_main = OpFunction %void None %131
%158 = OpLabel
%159 = OpFunctionCall %void %textureLoad_8acf41
OpReturn
OpFunctionEnd

View File

@ -32,11 +32,12 @@ float3 gammaCorrection(float3 v, GammaTransferParams params) {
} }
float4 textureLoadExternal(Texture2D<float4> plane0, Texture2D<float4> plane1, uint2 coord, ExternalTextureParams params) { float4 textureLoadExternal(Texture2D<float4> plane0, Texture2D<float4> plane1, uint2 coord, ExternalTextureParams params) {
const uint2 coord1 = (coord >> (1u).xx);
float3 color = float3(0.0f, 0.0f, 0.0f); float3 color = float3(0.0f, 0.0f, 0.0f);
if ((params.numPlanes == 1u)) { if ((params.numPlanes == 1u)) {
color = plane0.Load(uint3(coord, uint(0))).rgb; color = plane0.Load(uint3(coord, uint(0))).rgb;
} else { } else {
color = mul(params.yuvToRgbConversionMatrix, float4(plane0.Load(uint3(coord, uint(0))).r, plane1.Load(uint3(coord, uint(0))).rg, 1.0f)); color = mul(params.yuvToRgbConversionMatrix, float4(plane0.Load(uint3(coord, uint(0))).r, plane1.Load(uint3(coord1, uint(0))).rg, 1.0f));
} }
if ((params.doYuvToRgbConversionOnly == 0u)) { if ((params.doYuvToRgbConversionOnly == 0u)) {
color = gammaCorrection(color, params.gammaDecodeParams); color = gammaCorrection(color, params.gammaDecodeParams);

View File

@ -32,11 +32,12 @@ float3 gammaCorrection(float3 v, GammaTransferParams params) {
} }
float4 textureLoadExternal(Texture2D<float4> plane0, Texture2D<float4> plane1, uint2 coord, ExternalTextureParams params) { float4 textureLoadExternal(Texture2D<float4> plane0, Texture2D<float4> plane1, uint2 coord, ExternalTextureParams params) {
const uint2 coord1 = (coord >> (1u).xx);
float3 color = float3(0.0f, 0.0f, 0.0f); float3 color = float3(0.0f, 0.0f, 0.0f);
if ((params.numPlanes == 1u)) { if ((params.numPlanes == 1u)) {
color = plane0.Load(uint3(coord, uint(0))).rgb; color = plane0.Load(uint3(coord, uint(0))).rgb;
} else { } else {
color = mul(params.yuvToRgbConversionMatrix, float4(plane0.Load(uint3(coord, uint(0))).r, plane1.Load(uint3(coord, uint(0))).rg, 1.0f)); color = mul(params.yuvToRgbConversionMatrix, float4(plane0.Load(uint3(coord, uint(0))).r, plane1.Load(uint3(coord1, uint(0))).rg, 1.0f));
} }
if ((params.doYuvToRgbConversionOnly == 0u)) { if ((params.doYuvToRgbConversionOnly == 0u)) {
color = gammaCorrection(color, params.gammaDecodeParams); color = gammaCorrection(color, params.gammaDecodeParams);

View File

@ -45,11 +45,12 @@ vec3 gammaCorrection(vec3 v, GammaTransferParams params) {
} }
vec4 textureLoadExternal(highp sampler2D plane0_1, highp sampler2D plane1_1, uvec2 coord, ExternalTextureParams params) { vec4 textureLoadExternal(highp sampler2D plane0_1, highp sampler2D plane1_1, uvec2 coord, ExternalTextureParams params) {
uvec2 coord1 = (coord >> uvec2(1u));
vec3 color = vec3(0.0f, 0.0f, 0.0f); vec3 color = vec3(0.0f, 0.0f, 0.0f);
if ((params.numPlanes == 1u)) { if ((params.numPlanes == 1u)) {
color = texelFetch(plane0_1, ivec2(coord), 0).rgb; color = texelFetch(plane0_1, ivec2(coord), 0).rgb;
} else { } else {
color = (vec4(texelFetch(plane0_1, ivec2(coord), 0).r, texelFetch(plane1_1, ivec2(coord), 0).rg, 1.0f) * params.yuvToRgbConversionMatrix); color = (vec4(texelFetch(plane0_1, ivec2(coord), 0).r, texelFetch(plane1_1, ivec2(coord1), 0).rg, 1.0f) * params.yuvToRgbConversionMatrix);
} }
if ((params.doYuvToRgbConversionOnly == 0u)) { if ((params.doYuvToRgbConversionOnly == 0u)) {
color = gammaCorrection(color, params.gammaDecodeParams); color = gammaCorrection(color, params.gammaDecodeParams);
@ -131,11 +132,12 @@ vec3 gammaCorrection(vec3 v, GammaTransferParams params) {
} }
vec4 textureLoadExternal(highp sampler2D plane0_1, highp sampler2D plane1_1, uvec2 coord, ExternalTextureParams params) { vec4 textureLoadExternal(highp sampler2D plane0_1, highp sampler2D plane1_1, uvec2 coord, ExternalTextureParams params) {
uvec2 coord1 = (coord >> uvec2(1u));
vec3 color = vec3(0.0f, 0.0f, 0.0f); vec3 color = vec3(0.0f, 0.0f, 0.0f);
if ((params.numPlanes == 1u)) { if ((params.numPlanes == 1u)) {
color = texelFetch(plane0_1, ivec2(coord), 0).rgb; color = texelFetch(plane0_1, ivec2(coord), 0).rgb;
} else { } else {
color = (vec4(texelFetch(plane0_1, ivec2(coord), 0).r, texelFetch(plane1_1, ivec2(coord), 0).rg, 1.0f) * params.yuvToRgbConversionMatrix); color = (vec4(texelFetch(plane0_1, ivec2(coord), 0).r, texelFetch(plane1_1, ivec2(coord1), 0).rg, 1.0f) * params.yuvToRgbConversionMatrix);
} }
if ((params.doYuvToRgbConversionOnly == 0u)) { if ((params.doYuvToRgbConversionOnly == 0u)) {
color = gammaCorrection(color, params.gammaDecodeParams); color = gammaCorrection(color, params.gammaDecodeParams);
@ -211,11 +213,12 @@ vec3 gammaCorrection(vec3 v, GammaTransferParams params) {
} }
vec4 textureLoadExternal(highp sampler2D plane0_1, highp sampler2D plane1_1, uvec2 coord, ExternalTextureParams params) { vec4 textureLoadExternal(highp sampler2D plane0_1, highp sampler2D plane1_1, uvec2 coord, ExternalTextureParams params) {
uvec2 coord1 = (coord >> uvec2(1u));
vec3 color = vec3(0.0f, 0.0f, 0.0f); vec3 color = vec3(0.0f, 0.0f, 0.0f);
if ((params.numPlanes == 1u)) { if ((params.numPlanes == 1u)) {
color = texelFetch(plane0_1, ivec2(coord), 0).rgb; color = texelFetch(plane0_1, ivec2(coord), 0).rgb;
} else { } else {
color = (vec4(texelFetch(plane0_1, ivec2(coord), 0).r, texelFetch(plane1_1, ivec2(coord), 0).rg, 1.0f) * params.yuvToRgbConversionMatrix); color = (vec4(texelFetch(plane0_1, ivec2(coord), 0).r, texelFetch(plane1_1, ivec2(coord1), 0).rg, 1.0f) * params.yuvToRgbConversionMatrix);
} }
if ((params.doYuvToRgbConversionOnly == 0u)) { if ((params.doYuvToRgbConversionOnly == 0u)) {
color = gammaCorrection(color, params.gammaDecodeParams); color = gammaCorrection(color, params.gammaDecodeParams);

View File

@ -45,11 +45,12 @@ float3 gammaCorrection(float3 v, GammaTransferParams params) {
} }
float4 textureLoadExternal(texture2d<float, access::sample> plane0, texture2d<float, access::sample> plane1, uint2 coord, ExternalTextureParams params) { float4 textureLoadExternal(texture2d<float, access::sample> plane0, texture2d<float, access::sample> plane1, uint2 coord, ExternalTextureParams params) {
uint2 const coord1 = (coord >> uint2(1u));
float3 color = 0.0f; float3 color = 0.0f;
if ((params.numPlanes == 1u)) { if ((params.numPlanes == 1u)) {
color = float4(plane0.read(uint2(coord), 0)).rgb; color = float4(plane0.read(uint2(coord), 0)).rgb;
} else { } else {
color = (float4(plane0.read(uint2(coord), 0)[0], float4(plane1.read(uint2(coord), 0)).rg, 1.0f) * params.yuvToRgbConversionMatrix); color = (float4(plane0.read(uint2(coord), 0)[0], float4(plane1.read(uint2(coord1), 0)).rg, 1.0f) * params.yuvToRgbConversionMatrix);
} }
if ((params.doYuvToRgbConversionOnly == 0u)) { if ((params.doYuvToRgbConversionOnly == 0u)) {
color = gammaCorrection(color, params.gammaDecodeParams); color = gammaCorrection(color, params.gammaDecodeParams);

View File

@ -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: 160 ; Bound: 161
; Schema: 0 ; Schema: 0
OpCapability Shader OpCapability Shader
%29 = OpExtInstImport "GLSL.std.450" %29 = OpExtInstImport "GLSL.std.450"
@ -140,20 +140,20 @@
%ExternalTextureParams = OpTypeStruct %uint %uint %mat3v4float %GammaTransferParams %GammaTransferParams %mat3v3float %mat3v2float %ExternalTextureParams = OpTypeStruct %uint %uint %mat3v4float %GammaTransferParams %GammaTransferParams %mat3v3float %mat3v2float
%63 = OpTypeFunction %v4float %11 %11 %v2uint %ExternalTextureParams %63 = OpTypeFunction %v4float %11 %11 %v2uint %ExternalTextureParams
%uint_1 = OpConstant %uint 1 %uint_1 = OpConstant %uint 1
%74 = OpConstantComposite %v2uint %uint_1 %uint_1
%int = OpTypeInt 32 1 %int = OpTypeInt 32 1
%82 = OpConstantNull %int %84 = OpConstantNull %int
%float_1 = OpConstant %float 1 %float_1 = OpConstant %float 1
%95 = OpConstantNull %uint %97 = OpConstantNull %uint
%113 = OpTypeFunction %ExternalTextureParams %ExternalTextureParams_std140 %115 = OpTypeFunction %ExternalTextureParams %ExternalTextureParams_std140
%void = OpTypeVoid %void = OpTypeVoid
%128 = OpTypeFunction %void %130 = OpTypeFunction %void
%132 = OpConstantComposite %v2uint %uint_1 %uint_1
%_ptr_Function_v2uint = OpTypePointer Function %v2uint %_ptr_Function_v2uint = OpTypePointer Function %v2uint
%135 = OpConstantNull %v2uint %136 = OpConstantNull %v2uint
%uint_0 = OpConstant %uint 0 %uint_0 = OpConstant %uint 0
%_ptr_Uniform_ExternalTextureParams_std140 = OpTypePointer Uniform %ExternalTextureParams_std140 %_ptr_Uniform_ExternalTextureParams_std140 = OpTypePointer Uniform %ExternalTextureParams_std140
%_ptr_Function_v4float = OpTypePointer Function %v4float %_ptr_Function_v4float = OpTypePointer Function %v4float
%147 = OpTypeFunction %v4float %148 = OpTypeFunction %v4float
%gammaCorrection = OpFunction %v3float None %23 %gammaCorrection = OpFunction %v3float None %23
%v = OpFunctionParameter %v3float %v = OpFunctionParameter %v3float
%params = OpFunctionParameter %GammaTransferParams %params = OpFunctionParameter %GammaTransferParams
@ -197,104 +197,105 @@
%params_0 = OpFunctionParameter %ExternalTextureParams %params_0 = OpFunctionParameter %ExternalTextureParams
%72 = OpLabel %72 = OpLabel
%color = OpVariable %_ptr_Function_v3float Function %43 %color = OpVariable %_ptr_Function_v3float Function %43
%74 = OpCompositeExtract %uint %params_0 0 %75 = OpShiftRightLogical %v2uint %coord %74
%76 = OpIEqual %bool %74 %uint_1 %77 = OpCompositeExtract %uint %params_0 0
OpSelectionMerge %77 None %78 = OpIEqual %bool %77 %uint_1
OpBranchConditional %76 %78 %79 OpSelectionMerge %79 None
%78 = OpLabel OpBranchConditional %78 %80 %81
%80 = OpImageFetch %v4float %plane0 %coord Lod %82 %80 = OpLabel
%83 = OpVectorShuffle %v3float %80 %80 0 1 2 %82 = OpImageFetch %v4float %plane0 %coord Lod %84
OpStore %color %83 %85 = OpVectorShuffle %v3float %82 %82 0 1 2
OpBranch %77 OpStore %color %85
OpBranch %79
%81 = OpLabel
%86 = OpImageFetch %v4float %plane0 %coord Lod %84
%87 = OpCompositeExtract %float %86 0
%88 = OpImageFetch %v4float %plane1 %75 Lod %84
%89 = OpVectorShuffle %v2float %88 %88 0 1
%90 = OpCompositeExtract %float %89 0
%91 = OpCompositeExtract %float %89 1
%93 = OpCompositeConstruct %v4float %87 %90 %91 %float_1
%94 = OpCompositeExtract %mat3v4float %params_0 2
%95 = OpVectorTimesMatrix %v3float %93 %94
OpStore %color %95
OpBranch %79
%79 = OpLabel %79 = OpLabel
%84 = OpImageFetch %v4float %plane0 %coord Lod %82 %96 = OpCompositeExtract %uint %params_0 1
%85 = OpCompositeExtract %float %84 0 %98 = OpIEqual %bool %96 %97
%86 = OpImageFetch %v4float %plane1 %coord Lod %82 OpSelectionMerge %99 None
%87 = OpVectorShuffle %v2float %86 %86 0 1 OpBranchConditional %98 %100 %99
%88 = OpCompositeExtract %float %87 0 %100 = OpLabel
%89 = OpCompositeExtract %float %87 1 %102 = OpLoad %v3float %color
%91 = OpCompositeConstruct %v4float %85 %88 %89 %float_1 %103 = OpCompositeExtract %GammaTransferParams %params_0 3
%92 = OpCompositeExtract %mat3v4float %params_0 2 %101 = OpFunctionCall %v3float %gammaCorrection %102 %103
%93 = OpVectorTimesMatrix %v3float %91 %92 OpStore %color %101
OpStore %color %93 %104 = OpCompositeExtract %mat3v3float %params_0 5
OpBranch %77 %105 = OpLoad %v3float %color
%77 = OpLabel %106 = OpMatrixTimesVector %v3float %104 %105
%94 = OpCompositeExtract %uint %params_0 1 OpStore %color %106
%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
%97 = OpLabel
%108 = OpLoad %v3float %color %108 = OpLoad %v3float %color
%109 = OpCompositeExtract %float %108 0 %109 = OpCompositeExtract %GammaTransferParams %params_0 4
%110 = OpCompositeExtract %float %108 1 %107 = OpFunctionCall %v3float %gammaCorrection %108 %109
%111 = OpCompositeExtract %float %108 2 OpStore %color %107
%112 = OpCompositeConstruct %v4float %109 %110 %111 %float_1 OpBranch %99
OpReturnValue %112 %99 = OpLabel
%110 = OpLoad %v3float %color
%111 = OpCompositeExtract %float %110 0
%112 = OpCompositeExtract %float %110 1
%113 = OpCompositeExtract %float %110 2
%114 = OpCompositeConstruct %v4float %111 %112 %113 %float_1
OpReturnValue %114
OpFunctionEnd OpFunctionEnd
%conv_ExternalTextureParams = OpFunction %ExternalTextureParams None %113 %conv_ExternalTextureParams = OpFunction %ExternalTextureParams None %115
%val = OpFunctionParameter %ExternalTextureParams_std140 %val = OpFunctionParameter %ExternalTextureParams_std140
%116 = OpLabel %118 = OpLabel
%117 = OpCompositeExtract %uint %val 0 %119 = OpCompositeExtract %uint %val 0
%118 = OpCompositeExtract %uint %val 1 %120 = OpCompositeExtract %uint %val 1
%119 = OpCompositeExtract %mat3v4float %val 2 %121 = OpCompositeExtract %mat3v4float %val 2
%120 = OpCompositeExtract %GammaTransferParams %val 3 %122 = OpCompositeExtract %GammaTransferParams %val 3
%121 = OpCompositeExtract %GammaTransferParams %val 4 %123 = OpCompositeExtract %GammaTransferParams %val 4
%122 = OpCompositeExtract %mat3v3float %val 5 %124 = OpCompositeExtract %mat3v3float %val 5
%123 = OpCompositeExtract %v2float %val 6 %125 = OpCompositeExtract %v2float %val 6
%124 = OpCompositeExtract %v2float %val 7 %126 = OpCompositeExtract %v2float %val 7
%125 = OpCompositeExtract %v2float %val 8 %127 = OpCompositeExtract %v2float %val 8
%126 = OpCompositeConstruct %mat3v2float %123 %124 %125 %128 = OpCompositeConstruct %mat3v2float %125 %126 %127
%127 = OpCompositeConstruct %ExternalTextureParams %117 %118 %119 %120 %121 %122 %126 %129 = OpCompositeConstruct %ExternalTextureParams %119 %120 %121 %122 %123 %124 %128
OpReturnValue %127 OpReturnValue %129
OpFunctionEnd OpFunctionEnd
%textureLoad_1bfdfb = OpFunction %void None %128 %textureLoad_1bfdfb = OpFunction %void None %130
%131 = OpLabel %133 = OpLabel
%arg_1 = OpVariable %_ptr_Function_v2uint Function %135 %arg_1 = OpVariable %_ptr_Function_v2uint Function %136
%res = OpVariable %_ptr_Function_v4float Function %5 %res = OpVariable %_ptr_Function_v4float Function %5
OpStore %arg_1 %132 OpStore %arg_1 %74
%137 = OpLoad %11 %arg_0 %138 = OpLoad %11 %arg_0
%138 = OpLoad %11 %ext_tex_plane_1 %139 = OpLoad %11 %ext_tex_plane_1
%139 = OpLoad %v2uint %arg_1 %140 = OpLoad %v2uint %arg_1
%143 = OpAccessChain %_ptr_Uniform_ExternalTextureParams_std140 %ext_tex_params %uint_0 %144 = OpAccessChain %_ptr_Uniform_ExternalTextureParams_std140 %ext_tex_params %uint_0
%144 = OpLoad %ExternalTextureParams_std140 %143 %145 = OpLoad %ExternalTextureParams_std140 %144
%140 = OpFunctionCall %ExternalTextureParams %conv_ExternalTextureParams %144 %141 = OpFunctionCall %ExternalTextureParams %conv_ExternalTextureParams %145
%136 = OpFunctionCall %v4float %textureLoadExternal %137 %138 %139 %140 %137 = OpFunctionCall %v4float %textureLoadExternal %138 %139 %140 %141
OpStore %res %136 OpStore %res %137
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd
%vertex_main_inner = OpFunction %v4float None %147 %vertex_main_inner = OpFunction %v4float None %148
%149 = OpLabel %150 = OpLabel
%150 = OpFunctionCall %void %textureLoad_1bfdfb %151 = OpFunctionCall %void %textureLoad_1bfdfb
OpReturnValue %5 OpReturnValue %5
OpFunctionEnd OpFunctionEnd
%vertex_main = OpFunction %void None %128 %vertex_main = OpFunction %void None %130
%152 = OpLabel %153 = OpLabel
%153 = OpFunctionCall %v4float %vertex_main_inner %154 = OpFunctionCall %v4float %vertex_main_inner
OpStore %value %153 OpStore %value %154
OpStore %vertex_point_size %float_1 OpStore %vertex_point_size %float_1
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd
%fragment_main = OpFunction %void None %128 %fragment_main = OpFunction %void None %130
%155 = OpLabel %156 = OpLabel
%156 = OpFunctionCall %void %textureLoad_1bfdfb %157 = OpFunctionCall %void %textureLoad_1bfdfb
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd
%compute_main = OpFunction %void None %128 %compute_main = OpFunction %void None %130
%158 = OpLabel %159 = OpLabel
%159 = OpFunctionCall %void %textureLoad_1bfdfb %160 = OpFunctionCall %void %textureLoad_1bfdfb
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd

View File

@ -32,11 +32,12 @@ float3 gammaCorrection(float3 v, GammaTransferParams params) {
} }
float4 textureLoadExternal(Texture2D<float4> plane0, Texture2D<float4> plane1, int2 coord, ExternalTextureParams params) { float4 textureLoadExternal(Texture2D<float4> plane0, Texture2D<float4> plane1, int2 coord, ExternalTextureParams params) {
const int2 coord1 = (coord >> (1u).xx);
float3 color = float3(0.0f, 0.0f, 0.0f); float3 color = float3(0.0f, 0.0f, 0.0f);
if ((params.numPlanes == 1u)) { if ((params.numPlanes == 1u)) {
color = plane0.Load(int3(coord, 0)).rgb; color = plane0.Load(int3(coord, 0)).rgb;
} else { } else {
color = mul(params.yuvToRgbConversionMatrix, float4(plane0.Load(int3(coord, 0)).r, plane1.Load(int3(coord, 0)).rg, 1.0f)); color = mul(params.yuvToRgbConversionMatrix, float4(plane0.Load(int3(coord, 0)).r, plane1.Load(int3(coord1, 0)).rg, 1.0f));
} }
if ((params.doYuvToRgbConversionOnly == 0u)) { if ((params.doYuvToRgbConversionOnly == 0u)) {
color = gammaCorrection(color, params.gammaDecodeParams); color = gammaCorrection(color, params.gammaDecodeParams);

View File

@ -32,11 +32,12 @@ float3 gammaCorrection(float3 v, GammaTransferParams params) {
} }
float4 textureLoadExternal(Texture2D<float4> plane0, Texture2D<float4> plane1, int2 coord, ExternalTextureParams params) { float4 textureLoadExternal(Texture2D<float4> plane0, Texture2D<float4> plane1, int2 coord, ExternalTextureParams params) {
const int2 coord1 = (coord >> (1u).xx);
float3 color = float3(0.0f, 0.0f, 0.0f); float3 color = float3(0.0f, 0.0f, 0.0f);
if ((params.numPlanes == 1u)) { if ((params.numPlanes == 1u)) {
color = plane0.Load(int3(coord, 0)).rgb; color = plane0.Load(int3(coord, 0)).rgb;
} else { } else {
color = mul(params.yuvToRgbConversionMatrix, float4(plane0.Load(int3(coord, 0)).r, plane1.Load(int3(coord, 0)).rg, 1.0f)); color = mul(params.yuvToRgbConversionMatrix, float4(plane0.Load(int3(coord, 0)).r, plane1.Load(int3(coord1, 0)).rg, 1.0f));
} }
if ((params.doYuvToRgbConversionOnly == 0u)) { if ((params.doYuvToRgbConversionOnly == 0u)) {
color = gammaCorrection(color, params.gammaDecodeParams); color = gammaCorrection(color, params.gammaDecodeParams);

View File

@ -45,11 +45,12 @@ vec3 gammaCorrection(vec3 v, GammaTransferParams params) {
} }
vec4 textureLoadExternal(highp sampler2D plane0_1, highp sampler2D plane1_1, ivec2 coord, ExternalTextureParams params) { vec4 textureLoadExternal(highp sampler2D plane0_1, highp sampler2D plane1_1, ivec2 coord, ExternalTextureParams params) {
ivec2 coord1 = (coord >> uvec2(1u));
vec3 color = vec3(0.0f, 0.0f, 0.0f); vec3 color = vec3(0.0f, 0.0f, 0.0f);
if ((params.numPlanes == 1u)) { if ((params.numPlanes == 1u)) {
color = texelFetch(plane0_1, coord, 0).rgb; color = texelFetch(plane0_1, coord, 0).rgb;
} else { } else {
color = (vec4(texelFetch(plane0_1, coord, 0).r, texelFetch(plane1_1, coord, 0).rg, 1.0f) * params.yuvToRgbConversionMatrix); color = (vec4(texelFetch(plane0_1, coord, 0).r, texelFetch(plane1_1, coord1, 0).rg, 1.0f) * params.yuvToRgbConversionMatrix);
} }
if ((params.doYuvToRgbConversionOnly == 0u)) { if ((params.doYuvToRgbConversionOnly == 0u)) {
color = gammaCorrection(color, params.gammaDecodeParams); color = gammaCorrection(color, params.gammaDecodeParams);
@ -131,11 +132,12 @@ vec3 gammaCorrection(vec3 v, GammaTransferParams params) {
} }
vec4 textureLoadExternal(highp sampler2D plane0_1, highp sampler2D plane1_1, ivec2 coord, ExternalTextureParams params) { vec4 textureLoadExternal(highp sampler2D plane0_1, highp sampler2D plane1_1, ivec2 coord, ExternalTextureParams params) {
ivec2 coord1 = (coord >> uvec2(1u));
vec3 color = vec3(0.0f, 0.0f, 0.0f); vec3 color = vec3(0.0f, 0.0f, 0.0f);
if ((params.numPlanes == 1u)) { if ((params.numPlanes == 1u)) {
color = texelFetch(plane0_1, coord, 0).rgb; color = texelFetch(plane0_1, coord, 0).rgb;
} else { } else {
color = (vec4(texelFetch(plane0_1, coord, 0).r, texelFetch(plane1_1, coord, 0).rg, 1.0f) * params.yuvToRgbConversionMatrix); color = (vec4(texelFetch(plane0_1, coord, 0).r, texelFetch(plane1_1, coord1, 0).rg, 1.0f) * params.yuvToRgbConversionMatrix);
} }
if ((params.doYuvToRgbConversionOnly == 0u)) { if ((params.doYuvToRgbConversionOnly == 0u)) {
color = gammaCorrection(color, params.gammaDecodeParams); color = gammaCorrection(color, params.gammaDecodeParams);
@ -211,11 +213,12 @@ vec3 gammaCorrection(vec3 v, GammaTransferParams params) {
} }
vec4 textureLoadExternal(highp sampler2D plane0_1, highp sampler2D plane1_1, ivec2 coord, ExternalTextureParams params) { vec4 textureLoadExternal(highp sampler2D plane0_1, highp sampler2D plane1_1, ivec2 coord, ExternalTextureParams params) {
ivec2 coord1 = (coord >> uvec2(1u));
vec3 color = vec3(0.0f, 0.0f, 0.0f); vec3 color = vec3(0.0f, 0.0f, 0.0f);
if ((params.numPlanes == 1u)) { if ((params.numPlanes == 1u)) {
color = texelFetch(plane0_1, coord, 0).rgb; color = texelFetch(plane0_1, coord, 0).rgb;
} else { } else {
color = (vec4(texelFetch(plane0_1, coord, 0).r, texelFetch(plane1_1, coord, 0).rg, 1.0f) * params.yuvToRgbConversionMatrix); color = (vec4(texelFetch(plane0_1, coord, 0).r, texelFetch(plane1_1, coord1, 0).rg, 1.0f) * params.yuvToRgbConversionMatrix);
} }
if ((params.doYuvToRgbConversionOnly == 0u)) { if ((params.doYuvToRgbConversionOnly == 0u)) {
color = gammaCorrection(color, params.gammaDecodeParams); color = gammaCorrection(color, params.gammaDecodeParams);

View File

@ -45,11 +45,12 @@ float3 gammaCorrection(float3 v, GammaTransferParams params) {
} }
float4 textureLoadExternal(texture2d<float, access::sample> plane0, texture2d<float, access::sample> plane1, int2 coord, ExternalTextureParams params) { float4 textureLoadExternal(texture2d<float, access::sample> plane0, texture2d<float, access::sample> plane1, int2 coord, ExternalTextureParams params) {
int2 const coord1 = (coord >> uint2(1u));
float3 color = 0.0f; float3 color = 0.0f;
if ((params.numPlanes == 1u)) { if ((params.numPlanes == 1u)) {
color = float4(plane0.read(uint2(coord), 0)).rgb; color = float4(plane0.read(uint2(coord), 0)).rgb;
} else { } else {
color = (float4(plane0.read(uint2(coord), 0)[0], float4(plane1.read(uint2(coord), 0)).rg, 1.0f) * params.yuvToRgbConversionMatrix); color = (float4(plane0.read(uint2(coord), 0)[0], float4(plane1.read(uint2(coord1), 0)).rg, 1.0f) * params.yuvToRgbConversionMatrix);
} }
if ((params.doYuvToRgbConversionOnly == 0u)) { if ((params.doYuvToRgbConversionOnly == 0u)) {
color = gammaCorrection(color, params.gammaDecodeParams); color = gammaCorrection(color, params.gammaDecodeParams);

View File

@ -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: 161 ; Bound: 164
; Schema: 0 ; Schema: 0
OpCapability Shader OpCapability Shader
%29 = OpExtInstImport "GLSL.std.450" %29 = OpExtInstImport "GLSL.std.450"
@ -140,21 +140,23 @@
%mat3v2float = OpTypeMatrix %v2float 3 %mat3v2float = OpTypeMatrix %v2float 3
%ExternalTextureParams = OpTypeStruct %uint %uint %mat3v4float %GammaTransferParams %GammaTransferParams %mat3v3float %mat3v2float %ExternalTextureParams = OpTypeStruct %uint %uint %mat3v4float %GammaTransferParams %GammaTransferParams %mat3v3float %mat3v2float
%63 = OpTypeFunction %v4float %11 %11 %v2int %ExternalTextureParams %63 = OpTypeFunction %v4float %11 %11 %v2int %ExternalTextureParams
%v2uint = OpTypeVector %uint 2
%uint_1 = OpConstant %uint 1 %uint_1 = OpConstant %uint 1
%82 = OpConstantNull %int %76 = OpConstantComposite %v2uint %uint_1 %uint_1
%85 = OpConstantNull %int
%float_1 = OpConstant %float 1 %float_1 = OpConstant %float 1
%95 = OpConstantNull %uint %98 = OpConstantNull %uint
%113 = OpTypeFunction %ExternalTextureParams %ExternalTextureParams_std140 %116 = OpTypeFunction %ExternalTextureParams %ExternalTextureParams_std140
%void = OpTypeVoid %void = OpTypeVoid
%128 = OpTypeFunction %void %131 = OpTypeFunction %void
%int_1 = OpConstant %int 1 %int_1 = OpConstant %int 1
%133 = OpConstantComposite %v2int %int_1 %int_1 %136 = OpConstantComposite %v2int %int_1 %int_1
%_ptr_Function_v2int = OpTypePointer Function %v2int %_ptr_Function_v2int = OpTypePointer Function %v2int
%136 = OpConstantNull %v2int %139 = OpConstantNull %v2int
%uint_0 = OpConstant %uint 0 %uint_0 = OpConstant %uint 0
%_ptr_Uniform_ExternalTextureParams_std140 = OpTypePointer Uniform %ExternalTextureParams_std140 %_ptr_Uniform_ExternalTextureParams_std140 = OpTypePointer Uniform %ExternalTextureParams_std140
%_ptr_Function_v4float = OpTypePointer Function %v4float %_ptr_Function_v4float = OpTypePointer Function %v4float
%148 = OpTypeFunction %v4float %151 = OpTypeFunction %v4float
%gammaCorrection = OpFunction %v3float None %23 %gammaCorrection = OpFunction %v3float None %23
%v = OpFunctionParameter %v3float %v = OpFunctionParameter %v3float
%params = OpFunctionParameter %GammaTransferParams %params = OpFunctionParameter %GammaTransferParams
@ -198,104 +200,105 @@
%params_0 = OpFunctionParameter %ExternalTextureParams %params_0 = OpFunctionParameter %ExternalTextureParams
%73 = OpLabel %73 = OpLabel
%color = OpVariable %_ptr_Function_v3float Function %43 %color = OpVariable %_ptr_Function_v3float Function %43
%75 = OpCompositeExtract %uint %params_0 0 %77 = OpShiftRightArithmetic %v2int %coord %76
%77 = OpIEqual %bool %75 %uint_1 %79 = OpCompositeExtract %uint %params_0 0
OpSelectionMerge %78 None %80 = OpIEqual %bool %79 %uint_1
OpBranchConditional %77 %79 %80 OpSelectionMerge %81 None
%79 = OpLabel OpBranchConditional %80 %82 %83
%81 = OpImageFetch %v4float %plane0 %coord Lod %82 %82 = OpLabel
%83 = OpVectorShuffle %v3float %81 %81 0 1 2 %84 = OpImageFetch %v4float %plane0 %coord Lod %85
OpStore %color %83 %86 = OpVectorShuffle %v3float %84 %84 0 1 2
OpBranch %78 OpStore %color %86
%80 = OpLabel OpBranch %81
%84 = OpImageFetch %v4float %plane0 %coord Lod %82 %83 = OpLabel
%85 = OpCompositeExtract %float %84 0 %87 = OpImageFetch %v4float %plane0 %coord Lod %85
%86 = OpImageFetch %v4float %plane1 %coord Lod %82
%87 = OpVectorShuffle %v2float %86 %86 0 1
%88 = OpCompositeExtract %float %87 0 %88 = OpCompositeExtract %float %87 0
%89 = OpCompositeExtract %float %87 1 %89 = OpImageFetch %v4float %plane1 %77 Lod %85
%91 = OpCompositeConstruct %v4float %85 %88 %89 %float_1 %90 = OpVectorShuffle %v2float %89 %89 0 1
%92 = OpCompositeExtract %mat3v4float %params_0 2 %91 = OpCompositeExtract %float %90 0
%93 = OpVectorTimesMatrix %v3float %91 %92 %92 = OpCompositeExtract %float %90 1
OpStore %color %93 %94 = OpCompositeConstruct %v4float %88 %91 %92 %float_1
OpBranch %78 %95 = OpCompositeExtract %mat3v4float %params_0 2
%78 = OpLabel %96 = OpVectorTimesMatrix %v3float %94 %95
%94 = OpCompositeExtract %uint %params_0 1 OpStore %color %96
%96 = OpIEqual %bool %94 %95 OpBranch %81
OpSelectionMerge %97 None %81 = OpLabel
OpBranchConditional %96 %98 %97 %97 = OpCompositeExtract %uint %params_0 1
%98 = OpLabel %99 = OpIEqual %bool %97 %98
%100 = OpLoad %v3float %color OpSelectionMerge %100 None
%101 = OpCompositeExtract %GammaTransferParams %params_0 3 OpBranchConditional %99 %101 %100
%99 = OpFunctionCall %v3float %gammaCorrection %100 %101 %101 = OpLabel
OpStore %color %99
%102 = OpCompositeExtract %mat3v3float %params_0 5
%103 = OpLoad %v3float %color %103 = OpLoad %v3float %color
%104 = OpMatrixTimesVector %v3float %102 %103 %104 = OpCompositeExtract %GammaTransferParams %params_0 3
OpStore %color %104 %102 = OpFunctionCall %v3float %gammaCorrection %103 %104
OpStore %color %102
%105 = OpCompositeExtract %mat3v3float %params_0 5
%106 = OpLoad %v3float %color %106 = OpLoad %v3float %color
%107 = OpCompositeExtract %GammaTransferParams %params_0 4 %107 = OpMatrixTimesVector %v3float %105 %106
%105 = OpFunctionCall %v3float %gammaCorrection %106 %107 OpStore %color %107
OpStore %color %105 %109 = OpLoad %v3float %color
OpBranch %97 %110 = OpCompositeExtract %GammaTransferParams %params_0 4
%97 = OpLabel %108 = OpFunctionCall %v3float %gammaCorrection %109 %110
%108 = OpLoad %v3float %color OpStore %color %108
%109 = OpCompositeExtract %float %108 0 OpBranch %100
%110 = OpCompositeExtract %float %108 1 %100 = OpLabel
%111 = OpCompositeExtract %float %108 2 %111 = OpLoad %v3float %color
%112 = OpCompositeConstruct %v4float %109 %110 %111 %float_1 %112 = OpCompositeExtract %float %111 0
OpReturnValue %112 %113 = OpCompositeExtract %float %111 1
%114 = OpCompositeExtract %float %111 2
%115 = OpCompositeConstruct %v4float %112 %113 %114 %float_1
OpReturnValue %115
OpFunctionEnd OpFunctionEnd
%conv_ExternalTextureParams = OpFunction %ExternalTextureParams None %113 %conv_ExternalTextureParams = OpFunction %ExternalTextureParams None %116
%val = OpFunctionParameter %ExternalTextureParams_std140 %val = OpFunctionParameter %ExternalTextureParams_std140
%116 = OpLabel %119 = OpLabel
%117 = OpCompositeExtract %uint %val 0 %120 = OpCompositeExtract %uint %val 0
%118 = OpCompositeExtract %uint %val 1 %121 = OpCompositeExtract %uint %val 1
%119 = OpCompositeExtract %mat3v4float %val 2 %122 = OpCompositeExtract %mat3v4float %val 2
%120 = OpCompositeExtract %GammaTransferParams %val 3 %123 = OpCompositeExtract %GammaTransferParams %val 3
%121 = OpCompositeExtract %GammaTransferParams %val 4 %124 = OpCompositeExtract %GammaTransferParams %val 4
%122 = OpCompositeExtract %mat3v3float %val 5 %125 = OpCompositeExtract %mat3v3float %val 5
%123 = OpCompositeExtract %v2float %val 6 %126 = OpCompositeExtract %v2float %val 6
%124 = OpCompositeExtract %v2float %val 7 %127 = OpCompositeExtract %v2float %val 7
%125 = OpCompositeExtract %v2float %val 8 %128 = OpCompositeExtract %v2float %val 8
%126 = OpCompositeConstruct %mat3v2float %123 %124 %125 %129 = OpCompositeConstruct %mat3v2float %126 %127 %128
%127 = OpCompositeConstruct %ExternalTextureParams %117 %118 %119 %120 %121 %122 %126 %130 = OpCompositeConstruct %ExternalTextureParams %120 %121 %122 %123 %124 %125 %129
OpReturnValue %127 OpReturnValue %130
OpFunctionEnd OpFunctionEnd
%textureLoad_8acf41 = OpFunction %void None %128 %textureLoad_8acf41 = OpFunction %void None %131
%131 = OpLabel %134 = OpLabel
%arg_1 = OpVariable %_ptr_Function_v2int Function %136 %arg_1 = OpVariable %_ptr_Function_v2int Function %139
%res = OpVariable %_ptr_Function_v4float Function %5 %res = OpVariable %_ptr_Function_v4float Function %5
OpStore %arg_1 %133 OpStore %arg_1 %136
%138 = OpLoad %11 %arg_0 %141 = OpLoad %11 %arg_0
%139 = OpLoad %11 %ext_tex_plane_1 %142 = OpLoad %11 %ext_tex_plane_1
%140 = OpLoad %v2int %arg_1 %143 = OpLoad %v2int %arg_1
%144 = OpAccessChain %_ptr_Uniform_ExternalTextureParams_std140 %ext_tex_params %uint_0 %147 = OpAccessChain %_ptr_Uniform_ExternalTextureParams_std140 %ext_tex_params %uint_0
%145 = OpLoad %ExternalTextureParams_std140 %144 %148 = OpLoad %ExternalTextureParams_std140 %147
%141 = OpFunctionCall %ExternalTextureParams %conv_ExternalTextureParams %145 %144 = OpFunctionCall %ExternalTextureParams %conv_ExternalTextureParams %148
%137 = OpFunctionCall %v4float %textureLoadExternal %138 %139 %140 %141 %140 = OpFunctionCall %v4float %textureLoadExternal %141 %142 %143 %144
OpStore %res %137 OpStore %res %140
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd
%vertex_main_inner = OpFunction %v4float None %148 %vertex_main_inner = OpFunction %v4float None %151
%150 = OpLabel %153 = OpLabel
%151 = OpFunctionCall %void %textureLoad_8acf41 %154 = OpFunctionCall %void %textureLoad_8acf41
OpReturnValue %5 OpReturnValue %5
OpFunctionEnd OpFunctionEnd
%vertex_main = OpFunction %void None %128 %vertex_main = OpFunction %void None %131
%153 = OpLabel %156 = OpLabel
%154 = OpFunctionCall %v4float %vertex_main_inner %157 = OpFunctionCall %v4float %vertex_main_inner
OpStore %value %154 OpStore %value %157
OpStore %vertex_point_size %float_1 OpStore %vertex_point_size %float_1
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd
%fragment_main = OpFunction %void None %128 %fragment_main = OpFunction %void None %131
%156 = OpLabel
%157 = OpFunctionCall %void %textureLoad_8acf41
OpReturn
OpFunctionEnd
%compute_main = OpFunction %void None %128
%159 = OpLabel %159 = OpLabel
%160 = OpFunctionCall %void %textureLoad_8acf41 %160 = OpFunctionCall %void %textureLoad_8acf41
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd
%compute_main = OpFunction %void None %131
%162 = OpLabel
%163 = OpFunctionCall %void %textureLoad_8acf41
OpReturn
OpFunctionEnd

View File

@ -32,11 +32,12 @@ float3 gammaCorrection(float3 v, GammaTransferParams params) {
} }
float4 textureLoadExternal(Texture2D<float4> plane0, Texture2D<float4> plane1, int2 coord, ExternalTextureParams params) { float4 textureLoadExternal(Texture2D<float4> plane0, Texture2D<float4> plane1, int2 coord, ExternalTextureParams params) {
const int2 coord1 = (coord >> (1u).xx);
float3 color = float3(0.0f, 0.0f, 0.0f); float3 color = float3(0.0f, 0.0f, 0.0f);
if ((params.numPlanes == 1u)) { if ((params.numPlanes == 1u)) {
color = plane0.Load(int3(coord, 0)).rgb; color = plane0.Load(int3(coord, 0)).rgb;
} else { } else {
color = mul(params.yuvToRgbConversionMatrix, float4(plane0.Load(int3(coord, 0)).r, plane1.Load(int3(coord, 0)).rg, 1.0f)); color = mul(params.yuvToRgbConversionMatrix, float4(plane0.Load(int3(coord, 0)).r, plane1.Load(int3(coord1, 0)).rg, 1.0f));
} }
if ((params.doYuvToRgbConversionOnly == 0u)) { if ((params.doYuvToRgbConversionOnly == 0u)) {
color = gammaCorrection(color, params.gammaDecodeParams); color = gammaCorrection(color, params.gammaDecodeParams);

View File

@ -32,11 +32,12 @@ float3 gammaCorrection(float3 v, GammaTransferParams params) {
} }
float4 textureLoadExternal(Texture2D<float4> plane0, Texture2D<float4> plane1, int2 coord, ExternalTextureParams params) { float4 textureLoadExternal(Texture2D<float4> plane0, Texture2D<float4> plane1, int2 coord, ExternalTextureParams params) {
const int2 coord1 = (coord >> (1u).xx);
float3 color = float3(0.0f, 0.0f, 0.0f); float3 color = float3(0.0f, 0.0f, 0.0f);
if ((params.numPlanes == 1u)) { if ((params.numPlanes == 1u)) {
color = plane0.Load(int3(coord, 0)).rgb; color = plane0.Load(int3(coord, 0)).rgb;
} else { } else {
color = mul(params.yuvToRgbConversionMatrix, float4(plane0.Load(int3(coord, 0)).r, plane1.Load(int3(coord, 0)).rg, 1.0f)); color = mul(params.yuvToRgbConversionMatrix, float4(plane0.Load(int3(coord, 0)).r, plane1.Load(int3(coord1, 0)).rg, 1.0f));
} }
if ((params.doYuvToRgbConversionOnly == 0u)) { if ((params.doYuvToRgbConversionOnly == 0u)) {
color = gammaCorrection(color, params.gammaDecodeParams); color = gammaCorrection(color, params.gammaDecodeParams);

View File

@ -45,11 +45,12 @@ vec3 gammaCorrection(vec3 v, GammaTransferParams params) {
} }
vec4 textureLoadExternal(highp sampler2D plane0_1, highp sampler2D plane1_1, ivec2 coord, ExternalTextureParams params) { vec4 textureLoadExternal(highp sampler2D plane0_1, highp sampler2D plane1_1, ivec2 coord, ExternalTextureParams params) {
ivec2 coord1 = (coord >> uvec2(1u));
vec3 color = vec3(0.0f, 0.0f, 0.0f); vec3 color = vec3(0.0f, 0.0f, 0.0f);
if ((params.numPlanes == 1u)) { if ((params.numPlanes == 1u)) {
color = texelFetch(plane0_1, coord, 0).rgb; color = texelFetch(plane0_1, coord, 0).rgb;
} else { } else {
color = (vec4(texelFetch(plane0_1, coord, 0).r, texelFetch(plane1_1, coord, 0).rg, 1.0f) * params.yuvToRgbConversionMatrix); color = (vec4(texelFetch(plane0_1, coord, 0).r, texelFetch(plane1_1, coord1, 0).rg, 1.0f) * params.yuvToRgbConversionMatrix);
} }
if ((params.doYuvToRgbConversionOnly == 0u)) { if ((params.doYuvToRgbConversionOnly == 0u)) {
color = gammaCorrection(color, params.gammaDecodeParams); color = gammaCorrection(color, params.gammaDecodeParams);
@ -134,11 +135,12 @@ vec3 gammaCorrection(vec3 v, GammaTransferParams params) {
} }
vec4 textureLoadExternal(highp sampler2D plane0_1, highp sampler2D plane1_1, ivec2 coord, ExternalTextureParams params) { vec4 textureLoadExternal(highp sampler2D plane0_1, highp sampler2D plane1_1, ivec2 coord, ExternalTextureParams params) {
ivec2 coord1 = (coord >> uvec2(1u));
vec3 color = vec3(0.0f, 0.0f, 0.0f); vec3 color = vec3(0.0f, 0.0f, 0.0f);
if ((params.numPlanes == 1u)) { if ((params.numPlanes == 1u)) {
color = texelFetch(plane0_1, coord, 0).rgb; color = texelFetch(plane0_1, coord, 0).rgb;
} else { } else {
color = (vec4(texelFetch(plane0_1, coord, 0).r, texelFetch(plane1_1, coord, 0).rg, 1.0f) * params.yuvToRgbConversionMatrix); color = (vec4(texelFetch(plane0_1, coord, 0).r, texelFetch(plane1_1, coord1, 0).rg, 1.0f) * params.yuvToRgbConversionMatrix);
} }
if ((params.doYuvToRgbConversionOnly == 0u)) { if ((params.doYuvToRgbConversionOnly == 0u)) {
color = gammaCorrection(color, params.gammaDecodeParams); color = gammaCorrection(color, params.gammaDecodeParams);
@ -217,11 +219,12 @@ vec3 gammaCorrection(vec3 v, GammaTransferParams params) {
} }
vec4 textureLoadExternal(highp sampler2D plane0_1, highp sampler2D plane1_1, ivec2 coord, ExternalTextureParams params) { vec4 textureLoadExternal(highp sampler2D plane0_1, highp sampler2D plane1_1, ivec2 coord, ExternalTextureParams params) {
ivec2 coord1 = (coord >> uvec2(1u));
vec3 color = vec3(0.0f, 0.0f, 0.0f); vec3 color = vec3(0.0f, 0.0f, 0.0f);
if ((params.numPlanes == 1u)) { if ((params.numPlanes == 1u)) {
color = texelFetch(plane0_1, coord, 0).rgb; color = texelFetch(plane0_1, coord, 0).rgb;
} else { } else {
color = (vec4(texelFetch(plane0_1, coord, 0).r, texelFetch(plane1_1, coord, 0).rg, 1.0f) * params.yuvToRgbConversionMatrix); color = (vec4(texelFetch(plane0_1, coord, 0).r, texelFetch(plane1_1, coord1, 0).rg, 1.0f) * params.yuvToRgbConversionMatrix);
} }
if ((params.doYuvToRgbConversionOnly == 0u)) { if ((params.doYuvToRgbConversionOnly == 0u)) {
color = gammaCorrection(color, params.gammaDecodeParams); color = gammaCorrection(color, params.gammaDecodeParams);

View File

@ -45,11 +45,12 @@ float3 gammaCorrection(float3 v, GammaTransferParams params) {
} }
float4 textureLoadExternal(texture2d<float, access::sample> plane0, texture2d<float, access::sample> plane1, int2 coord, ExternalTextureParams params) { float4 textureLoadExternal(texture2d<float, access::sample> plane0, texture2d<float, access::sample> plane1, int2 coord, ExternalTextureParams params) {
int2 const coord1 = (coord >> uint2(1u));
float3 color = 0.0f; float3 color = 0.0f;
if ((params.numPlanes == 1u)) { if ((params.numPlanes == 1u)) {
color = float4(plane0.read(uint2(coord), 0)).rgb; color = float4(plane0.read(uint2(coord), 0)).rgb;
} else { } else {
color = (float4(plane0.read(uint2(coord), 0)[0], float4(plane1.read(uint2(coord), 0)).rg, 1.0f) * params.yuvToRgbConversionMatrix); color = (float4(plane0.read(uint2(coord), 0)[0], float4(plane1.read(uint2(coord1), 0)).rg, 1.0f) * params.yuvToRgbConversionMatrix);
} }
if ((params.doYuvToRgbConversionOnly == 0u)) { if ((params.doYuvToRgbConversionOnly == 0u)) {
color = gammaCorrection(color, params.gammaDecodeParams); color = gammaCorrection(color, params.gammaDecodeParams);

View File

@ -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: 164 ; Bound: 167
; Schema: 0 ; Schema: 0
OpCapability Shader OpCapability Shader
%29 = OpExtInstImport "GLSL.std.450" %29 = OpExtInstImport "GLSL.std.450"
@ -144,19 +144,21 @@
%mat3v2float = OpTypeMatrix %v2float 3 %mat3v2float = OpTypeMatrix %v2float 3
%ExternalTextureParams = OpTypeStruct %uint %uint %mat3v4float %GammaTransferParams %GammaTransferParams %mat3v3float %mat3v2float %ExternalTextureParams = OpTypeStruct %uint %uint %mat3v4float %GammaTransferParams %GammaTransferParams %mat3v3float %mat3v2float
%63 = OpTypeFunction %v4float %11 %11 %v2int %ExternalTextureParams %63 = OpTypeFunction %v4float %11 %11 %v2int %ExternalTextureParams
%v2uint = OpTypeVector %uint 2
%uint_1 = OpConstant %uint 1 %uint_1 = OpConstant %uint 1
%82 = OpConstantNull %int %76 = OpConstantComposite %v2uint %uint_1 %uint_1
%85 = OpConstantNull %int
%float_1 = OpConstant %float 1 %float_1 = OpConstant %float 1
%95 = OpConstantNull %uint %98 = OpConstantNull %uint
%113 = OpTypeFunction %v4float %11 %11 %ExternalTextureParams %v2int %116 = OpTypeFunction %v4float %11 %11 %ExternalTextureParams %v2int
%121 = OpTypeFunction %ExternalTextureParams %ExternalTextureParams_std140 %124 = OpTypeFunction %ExternalTextureParams %ExternalTextureParams_std140
%void = OpTypeVoid %void = OpTypeVoid
%136 = OpTypeFunction %void %139 = OpTypeFunction %void
%uint_0 = OpConstant %uint 0 %uint_0 = OpConstant %uint 0
%_ptr_Uniform_ExternalTextureParams_std140 = OpTypePointer Uniform %ExternalTextureParams_std140 %_ptr_Uniform_ExternalTextureParams_std140 = OpTypePointer Uniform %ExternalTextureParams_std140
%148 = OpConstantNull %v2int %151 = OpConstantNull %v2int
%_ptr_Function_v4float = OpTypePointer Function %v4float %_ptr_Function_v4float = OpTypePointer Function %v4float
%151 = OpTypeFunction %v4float %154 = OpTypeFunction %v4float
%gammaCorrection = OpFunction %v3float None %23 %gammaCorrection = OpFunction %v3float None %23
%v = OpFunctionParameter %v3float %v = OpFunctionParameter %v3float
%params = OpFunctionParameter %GammaTransferParams %params = OpFunctionParameter %GammaTransferParams
@ -200,110 +202,111 @@
%params_0 = OpFunctionParameter %ExternalTextureParams %params_0 = OpFunctionParameter %ExternalTextureParams
%73 = OpLabel %73 = OpLabel
%color = OpVariable %_ptr_Function_v3float Function %43 %color = OpVariable %_ptr_Function_v3float Function %43
%75 = OpCompositeExtract %uint %params_0 0 %77 = OpShiftRightArithmetic %v2int %coord %76
%77 = OpIEqual %bool %75 %uint_1 %79 = OpCompositeExtract %uint %params_0 0
OpSelectionMerge %78 None %80 = OpIEqual %bool %79 %uint_1
OpBranchConditional %77 %79 %80 OpSelectionMerge %81 None
%79 = OpLabel OpBranchConditional %80 %82 %83
%81 = OpImageFetch %v4float %plane0 %coord Lod %82 %82 = OpLabel
%83 = OpVectorShuffle %v3float %81 %81 0 1 2 %84 = OpImageFetch %v4float %plane0 %coord Lod %85
OpStore %color %83 %86 = OpVectorShuffle %v3float %84 %84 0 1 2
OpBranch %78 OpStore %color %86
%80 = OpLabel OpBranch %81
%84 = OpImageFetch %v4float %plane0 %coord Lod %82 %83 = OpLabel
%85 = OpCompositeExtract %float %84 0 %87 = OpImageFetch %v4float %plane0 %coord Lod %85
%86 = OpImageFetch %v4float %plane1 %coord Lod %82
%87 = OpVectorShuffle %v2float %86 %86 0 1
%88 = OpCompositeExtract %float %87 0 %88 = OpCompositeExtract %float %87 0
%89 = OpCompositeExtract %float %87 1 %89 = OpImageFetch %v4float %plane1 %77 Lod %85
%91 = OpCompositeConstruct %v4float %85 %88 %89 %float_1 %90 = OpVectorShuffle %v2float %89 %89 0 1
%92 = OpCompositeExtract %mat3v4float %params_0 2 %91 = OpCompositeExtract %float %90 0
%93 = OpVectorTimesMatrix %v3float %91 %92 %92 = OpCompositeExtract %float %90 1
OpStore %color %93 %94 = OpCompositeConstruct %v4float %88 %91 %92 %float_1
OpBranch %78 %95 = OpCompositeExtract %mat3v4float %params_0 2
%78 = OpLabel %96 = OpVectorTimesMatrix %v3float %94 %95
%94 = OpCompositeExtract %uint %params_0 1 OpStore %color %96
%96 = OpIEqual %bool %94 %95 OpBranch %81
OpSelectionMerge %97 None %81 = OpLabel
OpBranchConditional %96 %98 %97 %97 = OpCompositeExtract %uint %params_0 1
%98 = OpLabel %99 = OpIEqual %bool %97 %98
%100 = OpLoad %v3float %color OpSelectionMerge %100 None
%101 = OpCompositeExtract %GammaTransferParams %params_0 3 OpBranchConditional %99 %101 %100
%99 = OpFunctionCall %v3float %gammaCorrection %100 %101 %101 = OpLabel
OpStore %color %99
%102 = OpCompositeExtract %mat3v3float %params_0 5
%103 = OpLoad %v3float %color %103 = OpLoad %v3float %color
%104 = OpMatrixTimesVector %v3float %102 %103 %104 = OpCompositeExtract %GammaTransferParams %params_0 3
OpStore %color %104 %102 = OpFunctionCall %v3float %gammaCorrection %103 %104
OpStore %color %102
%105 = OpCompositeExtract %mat3v3float %params_0 5
%106 = OpLoad %v3float %color %106 = OpLoad %v3float %color
%107 = OpCompositeExtract %GammaTransferParams %params_0 4 %107 = OpMatrixTimesVector %v3float %105 %106
%105 = OpFunctionCall %v3float %gammaCorrection %106 %107 OpStore %color %107
OpStore %color %105 %109 = OpLoad %v3float %color
OpBranch %97 %110 = OpCompositeExtract %GammaTransferParams %params_0 4
%97 = OpLabel %108 = OpFunctionCall %v3float %gammaCorrection %109 %110
%108 = OpLoad %v3float %color OpStore %color %108
%109 = OpCompositeExtract %float %108 0 OpBranch %100
%110 = OpCompositeExtract %float %108 1 %100 = OpLabel
%111 = OpCompositeExtract %float %108 2 %111 = OpLoad %v3float %color
%112 = OpCompositeConstruct %v4float %109 %110 %111 %float_1 %112 = OpCompositeExtract %float %111 0
OpReturnValue %112 %113 = OpCompositeExtract %float %111 1
%114 = OpCompositeExtract %float %111 2
%115 = OpCompositeConstruct %v4float %112 %113 %114 %float_1
OpReturnValue %115
OpFunctionEnd OpFunctionEnd
%textureLoad2d = OpFunction %v4float None %113 %textureLoad2d = OpFunction %v4float None %116
%texture = OpFunctionParameter %11 %texture = OpFunctionParameter %11
%ext_tex_plane_1_1 = OpFunctionParameter %11 %ext_tex_plane_1_1 = OpFunctionParameter %11
%ext_tex_params_1 = OpFunctionParameter %ExternalTextureParams %ext_tex_params_1 = OpFunctionParameter %ExternalTextureParams
%coords = OpFunctionParameter %v2int %coords = OpFunctionParameter %v2int
%119 = OpLabel %122 = OpLabel
%120 = OpFunctionCall %v4float %textureLoadExternal %texture %ext_tex_plane_1_1 %coords %ext_tex_params_1 %123 = OpFunctionCall %v4float %textureLoadExternal %texture %ext_tex_plane_1_1 %coords %ext_tex_params_1
OpReturnValue %120 OpReturnValue %123
OpFunctionEnd OpFunctionEnd
%conv_ExternalTextureParams = OpFunction %ExternalTextureParams None %121 %conv_ExternalTextureParams = OpFunction %ExternalTextureParams None %124
%val = OpFunctionParameter %ExternalTextureParams_std140 %val = OpFunctionParameter %ExternalTextureParams_std140
%124 = OpLabel %127 = OpLabel
%125 = OpCompositeExtract %uint %val 0 %128 = OpCompositeExtract %uint %val 0
%126 = OpCompositeExtract %uint %val 1 %129 = OpCompositeExtract %uint %val 1
%127 = OpCompositeExtract %mat3v4float %val 2 %130 = OpCompositeExtract %mat3v4float %val 2
%128 = OpCompositeExtract %GammaTransferParams %val 3 %131 = OpCompositeExtract %GammaTransferParams %val 3
%129 = OpCompositeExtract %GammaTransferParams %val 4 %132 = OpCompositeExtract %GammaTransferParams %val 4
%130 = OpCompositeExtract %mat3v3float %val 5 %133 = OpCompositeExtract %mat3v3float %val 5
%131 = OpCompositeExtract %v2float %val 6 %134 = OpCompositeExtract %v2float %val 6
%132 = OpCompositeExtract %v2float %val 7 %135 = OpCompositeExtract %v2float %val 7
%133 = OpCompositeExtract %v2float %val 8 %136 = OpCompositeExtract %v2float %val 8
%134 = OpCompositeConstruct %mat3v2float %131 %132 %133 %137 = OpCompositeConstruct %mat3v2float %134 %135 %136
%135 = OpCompositeConstruct %ExternalTextureParams %125 %126 %127 %128 %129 %130 %134 %138 = OpCompositeConstruct %ExternalTextureParams %128 %129 %130 %131 %132 %133 %137
OpReturnValue %135 OpReturnValue %138
OpFunctionEnd OpFunctionEnd
%doTextureLoad = OpFunction %void None %136 %doTextureLoad = OpFunction %void None %139
%139 = OpLabel %142 = OpLabel
%res = OpVariable %_ptr_Function_v4float Function %5 %res = OpVariable %_ptr_Function_v4float Function %5
%141 = OpLoad %11 %arg_0 %144 = OpLoad %11 %arg_0
%142 = OpLoad %11 %ext_tex_plane_1 %145 = OpLoad %11 %ext_tex_plane_1
%146 = OpAccessChain %_ptr_Uniform_ExternalTextureParams_std140 %ext_tex_params %uint_0 %149 = OpAccessChain %_ptr_Uniform_ExternalTextureParams_std140 %ext_tex_params %uint_0
%147 = OpLoad %ExternalTextureParams_std140 %146 %150 = OpLoad %ExternalTextureParams_std140 %149
%143 = OpFunctionCall %ExternalTextureParams %conv_ExternalTextureParams %147 %146 = OpFunctionCall %ExternalTextureParams %conv_ExternalTextureParams %150
%140 = OpFunctionCall %v4float %textureLoad2d %141 %142 %143 %148 %143 = OpFunctionCall %v4float %textureLoad2d %144 %145 %146 %151
OpStore %res %140 OpStore %res %143
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd
%vertex_main_inner = OpFunction %v4float None %151 %vertex_main_inner = OpFunction %v4float None %154
%153 = OpLabel %156 = OpLabel
%154 = OpFunctionCall %void %doTextureLoad %157 = OpFunctionCall %void %doTextureLoad
OpReturnValue %5 OpReturnValue %5
OpFunctionEnd OpFunctionEnd
%vertex_main = OpFunction %void None %136 %vertex_main = OpFunction %void None %139
%156 = OpLabel %159 = OpLabel
%157 = OpFunctionCall %v4float %vertex_main_inner %160 = OpFunctionCall %v4float %vertex_main_inner
OpStore %value %157 OpStore %value %160
OpStore %vertex_point_size %float_1 OpStore %vertex_point_size %float_1
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd
%fragment_main = OpFunction %void None %136 %fragment_main = OpFunction %void None %139
%159 = OpLabel
%160 = OpFunctionCall %void %doTextureLoad
OpReturn
OpFunctionEnd
%compute_main = OpFunction %void None %136
%162 = OpLabel %162 = OpLabel
%163 = OpFunctionCall %void %doTextureLoad %163 = OpFunctionCall %void %doTextureLoad
OpReturn OpReturn
OpFunctionEnd OpFunctionEnd
%compute_main = OpFunction %void None %139
%165 = OpLabel
%166 = OpFunctionCall %void %doTextureLoad
OpReturn
OpFunctionEnd