mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-16 00:17:03 +00:00
Implement External Texture Crop Functionality
Adds to the External Texture shader transform to allow cropping. Tests included. Bug: chromium:1316671 Change-Id: Id0ec9acac22a0968ba6847d6ead9cf5084eaca88 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/113281 Commit-Queue: Austin Eng <enga@chromium.org> Reviewed-by: Ben Clayton <bclayton@google.com> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Kokoro: Kokoro <noreply+kokoro@google.com>
This commit is contained in:
committed by
Dawn LUCI CQ
parent
0be08d8b88
commit
183df9d24e
@@ -19,12 +19,12 @@ struct ExternalTextureParams {
|
||||
GammaTransferParams gammaDecodeParams;
|
||||
GammaTransferParams gammaEncodeParams;
|
||||
float3x3 gamutConversionMatrix;
|
||||
float2x2 rotationMatrix;
|
||||
float2x3 coordTransformationMatrix;
|
||||
};
|
||||
|
||||
Texture2D<float4> ext_tex_plane_1 : register(t2, space0);
|
||||
cbuffer cbuffer_ext_tex_params : register(b3, space0) {
|
||||
uint4 ext_tex_params[12];
|
||||
uint4 ext_tex_params[13];
|
||||
};
|
||||
Texture2D<float4> t : register(t0, space0);
|
||||
RWTexture2D<float4> outImage : register(u1, space0);
|
||||
@@ -51,14 +51,14 @@ float4 textureLoadExternal(Texture2D<float4> plane0, Texture2D<float4> plane1, i
|
||||
return float4(color, 1.0f);
|
||||
}
|
||||
|
||||
float3x4 tint_symbol_6(uint4 buffer[12], uint offset) {
|
||||
float3x4 tint_symbol_6(uint4 buffer[13], uint offset) {
|
||||
const uint scalar_offset = ((offset + 0u)) / 4;
|
||||
const uint scalar_offset_1 = ((offset + 16u)) / 4;
|
||||
const uint scalar_offset_2 = ((offset + 32u)) / 4;
|
||||
return float3x4(asfloat(buffer[scalar_offset / 4]), asfloat(buffer[scalar_offset_1 / 4]), asfloat(buffer[scalar_offset_2 / 4]));
|
||||
}
|
||||
|
||||
GammaTransferParams tint_symbol_8(uint4 buffer[12], uint offset) {
|
||||
GammaTransferParams tint_symbol_8(uint4 buffer[13], uint offset) {
|
||||
const uint scalar_offset_3 = ((offset + 0u)) / 4;
|
||||
const uint scalar_offset_4 = ((offset + 4u)) / 4;
|
||||
const uint scalar_offset_5 = ((offset + 8u)) / 4;
|
||||
@@ -67,30 +67,28 @@ GammaTransferParams tint_symbol_8(uint4 buffer[12], uint offset) {
|
||||
const uint scalar_offset_8 = ((offset + 20u)) / 4;
|
||||
const uint scalar_offset_9 = ((offset + 24u)) / 4;
|
||||
const uint scalar_offset_10 = ((offset + 28u)) / 4;
|
||||
const GammaTransferParams tint_symbol_14 = {asfloat(buffer[scalar_offset_3 / 4][scalar_offset_3 % 4]), asfloat(buffer[scalar_offset_4 / 4][scalar_offset_4 % 4]), asfloat(buffer[scalar_offset_5 / 4][scalar_offset_5 % 4]), asfloat(buffer[scalar_offset_6 / 4][scalar_offset_6 % 4]), asfloat(buffer[scalar_offset_7 / 4][scalar_offset_7 % 4]), asfloat(buffer[scalar_offset_8 / 4][scalar_offset_8 % 4]), asfloat(buffer[scalar_offset_9 / 4][scalar_offset_9 % 4]), buffer[scalar_offset_10 / 4][scalar_offset_10 % 4]};
|
||||
return tint_symbol_14;
|
||||
const GammaTransferParams tint_symbol_13 = {asfloat(buffer[scalar_offset_3 / 4][scalar_offset_3 % 4]), asfloat(buffer[scalar_offset_4 / 4][scalar_offset_4 % 4]), asfloat(buffer[scalar_offset_5 / 4][scalar_offset_5 % 4]), asfloat(buffer[scalar_offset_6 / 4][scalar_offset_6 % 4]), asfloat(buffer[scalar_offset_7 / 4][scalar_offset_7 % 4]), asfloat(buffer[scalar_offset_8 / 4][scalar_offset_8 % 4]), asfloat(buffer[scalar_offset_9 / 4][scalar_offset_9 % 4]), buffer[scalar_offset_10 / 4][scalar_offset_10 % 4]};
|
||||
return tint_symbol_13;
|
||||
}
|
||||
|
||||
float3x3 tint_symbol_10(uint4 buffer[12], uint offset) {
|
||||
float3x3 tint_symbol_10(uint4 buffer[13], uint offset) {
|
||||
const uint scalar_offset_11 = ((offset + 0u)) / 4;
|
||||
const uint scalar_offset_12 = ((offset + 16u)) / 4;
|
||||
const uint scalar_offset_13 = ((offset + 32u)) / 4;
|
||||
return float3x3(asfloat(buffer[scalar_offset_11 / 4].xyz), asfloat(buffer[scalar_offset_12 / 4].xyz), asfloat(buffer[scalar_offset_13 / 4].xyz));
|
||||
}
|
||||
|
||||
float2x2 tint_symbol_12(uint4 buffer[12], uint offset) {
|
||||
float2x3 tint_symbol_12(uint4 buffer[13], uint offset) {
|
||||
const uint scalar_offset_14 = ((offset + 0u)) / 4;
|
||||
uint4 ubo_load = buffer[scalar_offset_14 / 4];
|
||||
const uint scalar_offset_15 = ((offset + 8u)) / 4;
|
||||
uint4 ubo_load_1 = buffer[scalar_offset_15 / 4];
|
||||
return float2x2(asfloat(((scalar_offset_14 & 2) ? ubo_load.zw : ubo_load.xy)), asfloat(((scalar_offset_15 & 2) ? ubo_load_1.zw : ubo_load_1.xy)));
|
||||
const uint scalar_offset_15 = ((offset + 16u)) / 4;
|
||||
return float2x3(asfloat(buffer[scalar_offset_14 / 4].xyz), asfloat(buffer[scalar_offset_15 / 4].xyz));
|
||||
}
|
||||
|
||||
ExternalTextureParams tint_symbol_4(uint4 buffer[12], uint offset) {
|
||||
ExternalTextureParams tint_symbol_4(uint4 buffer[13], uint offset) {
|
||||
const uint scalar_offset_16 = ((offset + 0u)) / 4;
|
||||
const uint scalar_offset_17 = ((offset + 4u)) / 4;
|
||||
const ExternalTextureParams tint_symbol_15 = {buffer[scalar_offset_16 / 4][scalar_offset_16 % 4], buffer[scalar_offset_17 / 4][scalar_offset_17 % 4], tint_symbol_6(buffer, (offset + 16u)), tint_symbol_8(buffer, (offset + 64u)), tint_symbol_8(buffer, (offset + 96u)), tint_symbol_10(buffer, (offset + 128u)), tint_symbol_12(buffer, (offset + 176u))};
|
||||
return tint_symbol_15;
|
||||
const ExternalTextureParams tint_symbol_14 = {buffer[scalar_offset_16 / 4][scalar_offset_16 % 4], buffer[scalar_offset_17 / 4][scalar_offset_17 % 4], tint_symbol_6(buffer, (offset + 16u)), tint_symbol_8(buffer, (offset + 64u)), tint_symbol_8(buffer, (offset + 96u)), tint_symbol_10(buffer, (offset + 128u)), tint_symbol_12(buffer, (offset + 176u))};
|
||||
return tint_symbol_14;
|
||||
}
|
||||
|
||||
[numthreads(1, 1, 1)]
|
||||
|
||||
@@ -19,12 +19,12 @@ struct ExternalTextureParams {
|
||||
GammaTransferParams gammaDecodeParams;
|
||||
GammaTransferParams gammaEncodeParams;
|
||||
float3x3 gamutConversionMatrix;
|
||||
float2x2 rotationMatrix;
|
||||
float2x3 coordTransformationMatrix;
|
||||
};
|
||||
|
||||
Texture2D<float4> ext_tex_plane_1 : register(t2, space0);
|
||||
cbuffer cbuffer_ext_tex_params : register(b3, space0) {
|
||||
uint4 ext_tex_params[12];
|
||||
uint4 ext_tex_params[13];
|
||||
};
|
||||
Texture2D<float4> t : register(t0, space0);
|
||||
RWTexture2D<float4> outImage : register(u1, space0);
|
||||
@@ -51,14 +51,14 @@ float4 textureLoadExternal(Texture2D<float4> plane0, Texture2D<float4> plane1, i
|
||||
return float4(color, 1.0f);
|
||||
}
|
||||
|
||||
float3x4 tint_symbol_6(uint4 buffer[12], uint offset) {
|
||||
float3x4 tint_symbol_6(uint4 buffer[13], uint offset) {
|
||||
const uint scalar_offset = ((offset + 0u)) / 4;
|
||||
const uint scalar_offset_1 = ((offset + 16u)) / 4;
|
||||
const uint scalar_offset_2 = ((offset + 32u)) / 4;
|
||||
return float3x4(asfloat(buffer[scalar_offset / 4]), asfloat(buffer[scalar_offset_1 / 4]), asfloat(buffer[scalar_offset_2 / 4]));
|
||||
}
|
||||
|
||||
GammaTransferParams tint_symbol_8(uint4 buffer[12], uint offset) {
|
||||
GammaTransferParams tint_symbol_8(uint4 buffer[13], uint offset) {
|
||||
const uint scalar_offset_3 = ((offset + 0u)) / 4;
|
||||
const uint scalar_offset_4 = ((offset + 4u)) / 4;
|
||||
const uint scalar_offset_5 = ((offset + 8u)) / 4;
|
||||
@@ -67,30 +67,28 @@ GammaTransferParams tint_symbol_8(uint4 buffer[12], uint offset) {
|
||||
const uint scalar_offset_8 = ((offset + 20u)) / 4;
|
||||
const uint scalar_offset_9 = ((offset + 24u)) / 4;
|
||||
const uint scalar_offset_10 = ((offset + 28u)) / 4;
|
||||
const GammaTransferParams tint_symbol_14 = {asfloat(buffer[scalar_offset_3 / 4][scalar_offset_3 % 4]), asfloat(buffer[scalar_offset_4 / 4][scalar_offset_4 % 4]), asfloat(buffer[scalar_offset_5 / 4][scalar_offset_5 % 4]), asfloat(buffer[scalar_offset_6 / 4][scalar_offset_6 % 4]), asfloat(buffer[scalar_offset_7 / 4][scalar_offset_7 % 4]), asfloat(buffer[scalar_offset_8 / 4][scalar_offset_8 % 4]), asfloat(buffer[scalar_offset_9 / 4][scalar_offset_9 % 4]), buffer[scalar_offset_10 / 4][scalar_offset_10 % 4]};
|
||||
return tint_symbol_14;
|
||||
const GammaTransferParams tint_symbol_13 = {asfloat(buffer[scalar_offset_3 / 4][scalar_offset_3 % 4]), asfloat(buffer[scalar_offset_4 / 4][scalar_offset_4 % 4]), asfloat(buffer[scalar_offset_5 / 4][scalar_offset_5 % 4]), asfloat(buffer[scalar_offset_6 / 4][scalar_offset_6 % 4]), asfloat(buffer[scalar_offset_7 / 4][scalar_offset_7 % 4]), asfloat(buffer[scalar_offset_8 / 4][scalar_offset_8 % 4]), asfloat(buffer[scalar_offset_9 / 4][scalar_offset_9 % 4]), buffer[scalar_offset_10 / 4][scalar_offset_10 % 4]};
|
||||
return tint_symbol_13;
|
||||
}
|
||||
|
||||
float3x3 tint_symbol_10(uint4 buffer[12], uint offset) {
|
||||
float3x3 tint_symbol_10(uint4 buffer[13], uint offset) {
|
||||
const uint scalar_offset_11 = ((offset + 0u)) / 4;
|
||||
const uint scalar_offset_12 = ((offset + 16u)) / 4;
|
||||
const uint scalar_offset_13 = ((offset + 32u)) / 4;
|
||||
return float3x3(asfloat(buffer[scalar_offset_11 / 4].xyz), asfloat(buffer[scalar_offset_12 / 4].xyz), asfloat(buffer[scalar_offset_13 / 4].xyz));
|
||||
}
|
||||
|
||||
float2x2 tint_symbol_12(uint4 buffer[12], uint offset) {
|
||||
float2x3 tint_symbol_12(uint4 buffer[13], uint offset) {
|
||||
const uint scalar_offset_14 = ((offset + 0u)) / 4;
|
||||
uint4 ubo_load = buffer[scalar_offset_14 / 4];
|
||||
const uint scalar_offset_15 = ((offset + 8u)) / 4;
|
||||
uint4 ubo_load_1 = buffer[scalar_offset_15 / 4];
|
||||
return float2x2(asfloat(((scalar_offset_14 & 2) ? ubo_load.zw : ubo_load.xy)), asfloat(((scalar_offset_15 & 2) ? ubo_load_1.zw : ubo_load_1.xy)));
|
||||
const uint scalar_offset_15 = ((offset + 16u)) / 4;
|
||||
return float2x3(asfloat(buffer[scalar_offset_14 / 4].xyz), asfloat(buffer[scalar_offset_15 / 4].xyz));
|
||||
}
|
||||
|
||||
ExternalTextureParams tint_symbol_4(uint4 buffer[12], uint offset) {
|
||||
ExternalTextureParams tint_symbol_4(uint4 buffer[13], uint offset) {
|
||||
const uint scalar_offset_16 = ((offset + 0u)) / 4;
|
||||
const uint scalar_offset_17 = ((offset + 4u)) / 4;
|
||||
const ExternalTextureParams tint_symbol_15 = {buffer[scalar_offset_16 / 4][scalar_offset_16 % 4], buffer[scalar_offset_17 / 4][scalar_offset_17 % 4], tint_symbol_6(buffer, (offset + 16u)), tint_symbol_8(buffer, (offset + 64u)), tint_symbol_8(buffer, (offset + 96u)), tint_symbol_10(buffer, (offset + 128u)), tint_symbol_12(buffer, (offset + 176u))};
|
||||
return tint_symbol_15;
|
||||
const ExternalTextureParams tint_symbol_14 = {buffer[scalar_offset_16 / 4][scalar_offset_16 % 4], buffer[scalar_offset_17 / 4][scalar_offset_17 % 4], tint_symbol_6(buffer, (offset + 16u)), tint_symbol_8(buffer, (offset + 64u)), tint_symbol_8(buffer, (offset + 96u)), tint_symbol_10(buffer, (offset + 128u)), tint_symbol_12(buffer, (offset + 176u))};
|
||||
return tint_symbol_14;
|
||||
}
|
||||
|
||||
[numthreads(1, 1, 1)]
|
||||
|
||||
@@ -20,24 +20,11 @@ struct ExternalTextureParams {
|
||||
GammaTransferParams gammaDecodeParams;
|
||||
GammaTransferParams gammaEncodeParams;
|
||||
mat3 gamutConversionMatrix;
|
||||
mat2 rotationMatrix;
|
||||
mat2x3 coordTransformationMatrix;
|
||||
};
|
||||
|
||||
struct ExternalTextureParams_std140 {
|
||||
uint numPlanes;
|
||||
uint doYuvToRgbConversionOnly;
|
||||
uint pad;
|
||||
uint pad_1;
|
||||
mat3x4 yuvToRgbConversionMatrix;
|
||||
GammaTransferParams gammaDecodeParams;
|
||||
GammaTransferParams gammaEncodeParams;
|
||||
mat3 gamutConversionMatrix;
|
||||
vec2 rotationMatrix_0;
|
||||
vec2 rotationMatrix_1;
|
||||
};
|
||||
|
||||
layout(binding = 3, std140) uniform ext_tex_params_block_std140_ubo {
|
||||
ExternalTextureParams_std140 inner;
|
||||
layout(binding = 3, std140) uniform ext_tex_params_block_ubo {
|
||||
ExternalTextureParams inner;
|
||||
} ext_tex_params;
|
||||
|
||||
layout(rgba8) uniform highp writeonly image2D outImage;
|
||||
@@ -65,14 +52,10 @@ vec4 textureLoadExternal(highp sampler2D plane0_1, highp sampler2D plane1_1, ive
|
||||
|
||||
uniform highp sampler2D t_2;
|
||||
uniform highp sampler2D ext_tex_plane_1_1;
|
||||
ExternalTextureParams conv_ExternalTextureParams(ExternalTextureParams_std140 val) {
|
||||
return ExternalTextureParams(val.numPlanes, val.doYuvToRgbConversionOnly, val.pad, val.pad_1, val.yuvToRgbConversionMatrix, val.gammaDecodeParams, val.gammaEncodeParams, val.gamutConversionMatrix, mat2(val.rotationMatrix_0, val.rotationMatrix_1));
|
||||
}
|
||||
|
||||
void tint_symbol() {
|
||||
vec4 red = textureLoadExternal(t_2, ext_tex_plane_1_1, clamp(ivec2(10), ivec2(0), ivec2((uvec2(uvec2(textureSize(t_2, 0))) - uvec2(1u)))), conv_ExternalTextureParams(ext_tex_params.inner));
|
||||
vec4 red = textureLoadExternal(t_2, ext_tex_plane_1_1, clamp(ivec2(10), ivec2(0), ivec2((uvec2(uvec2(textureSize(t_2, 0))) - uvec2(1u)))), ext_tex_params.inner);
|
||||
imageStore(outImage, clamp(ivec2(0), ivec2(0), ivec2((uvec2(uvec2(imageSize(outImage))) - uvec2(1u)))), red);
|
||||
vec4 green = textureLoadExternal(t_2, ext_tex_plane_1_1, clamp(ivec2(70, 118), ivec2(0), ivec2((uvec2(uvec2(textureSize(t_2, 0))) - uvec2(1u)))), conv_ExternalTextureParams(ext_tex_params.inner));
|
||||
vec4 green = textureLoadExternal(t_2, ext_tex_plane_1_1, clamp(ivec2(70, 118), ivec2(0), ivec2((uvec2(uvec2(textureSize(t_2, 0))) - uvec2(1u)))), ext_tex_params.inner);
|
||||
imageStore(outImage, clamp(ivec2(1, 0), ivec2(0), ivec2((uvec2(uvec2(imageSize(outImage))) - uvec2(1u)))), green);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ struct ExternalTextureParams {
|
||||
/* 0x0040 */ GammaTransferParams gammaDecodeParams;
|
||||
/* 0x0060 */ GammaTransferParams gammaEncodeParams;
|
||||
/* 0x0080 */ float3x3 gamutConversionMatrix;
|
||||
/* 0x00b0 */ float2x2 rotationMatrix;
|
||||
/* 0x00b0 */ float2x3 coordTransformationMatrix;
|
||||
};
|
||||
|
||||
float3 gammaCorrection(float3 v, GammaTransferParams params) {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
; SPIR-V
|
||||
; Version: 1.3
|
||||
; Generator: Google Tint Compiler; 0
|
||||
; Bound: 195
|
||||
; Bound: 178
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
OpCapability ImageQuery
|
||||
@@ -10,13 +10,13 @@
|
||||
OpEntryPoint GLCompute %main "main"
|
||||
OpExecutionMode %main LocalSize 1 1 1
|
||||
OpName %ext_tex_plane_1 "ext_tex_plane_1"
|
||||
OpName %ext_tex_params_block_std140 "ext_tex_params_block_std140"
|
||||
OpMemberName %ext_tex_params_block_std140 0 "inner"
|
||||
OpName %ExternalTextureParams_std140 "ExternalTextureParams_std140"
|
||||
OpMemberName %ExternalTextureParams_std140 0 "numPlanes"
|
||||
OpMemberName %ExternalTextureParams_std140 1 "doYuvToRgbConversionOnly"
|
||||
OpMemberName %ExternalTextureParams_std140 2 "yuvToRgbConversionMatrix"
|
||||
OpMemberName %ExternalTextureParams_std140 3 "gammaDecodeParams"
|
||||
OpName %ext_tex_params_block "ext_tex_params_block"
|
||||
OpMemberName %ext_tex_params_block 0 "inner"
|
||||
OpName %ExternalTextureParams "ExternalTextureParams"
|
||||
OpMemberName %ExternalTextureParams 0 "numPlanes"
|
||||
OpMemberName %ExternalTextureParams 1 "doYuvToRgbConversionOnly"
|
||||
OpMemberName %ExternalTextureParams 2 "yuvToRgbConversionMatrix"
|
||||
OpMemberName %ExternalTextureParams 3 "gammaDecodeParams"
|
||||
OpName %GammaTransferParams "GammaTransferParams"
|
||||
OpMemberName %GammaTransferParams 0 "G"
|
||||
OpMemberName %GammaTransferParams 1 "A"
|
||||
@@ -26,10 +26,9 @@
|
||||
OpMemberName %GammaTransferParams 5 "E"
|
||||
OpMemberName %GammaTransferParams 6 "F"
|
||||
OpMemberName %GammaTransferParams 7 "padding"
|
||||
OpMemberName %ExternalTextureParams_std140 4 "gammaEncodeParams"
|
||||
OpMemberName %ExternalTextureParams_std140 5 "gamutConversionMatrix"
|
||||
OpMemberName %ExternalTextureParams_std140 6 "rotationMatrix_0"
|
||||
OpMemberName %ExternalTextureParams_std140 7 "rotationMatrix_1"
|
||||
OpMemberName %ExternalTextureParams 4 "gammaEncodeParams"
|
||||
OpMemberName %ExternalTextureParams 5 "gamutConversionMatrix"
|
||||
OpMemberName %ExternalTextureParams 6 "coordTransformationMatrix"
|
||||
OpName %ext_tex_params "ext_tex_params"
|
||||
OpName %t "t"
|
||||
OpName %outImage "outImage"
|
||||
@@ -40,35 +39,25 @@
|
||||
OpName %gammaCorrection "gammaCorrection"
|
||||
OpName %v "v"
|
||||
OpName %params "params"
|
||||
OpName %ExternalTextureParams "ExternalTextureParams"
|
||||
OpMemberName %ExternalTextureParams 0 "numPlanes"
|
||||
OpMemberName %ExternalTextureParams 1 "doYuvToRgbConversionOnly"
|
||||
OpMemberName %ExternalTextureParams 2 "yuvToRgbConversionMatrix"
|
||||
OpMemberName %ExternalTextureParams 3 "gammaDecodeParams"
|
||||
OpMemberName %ExternalTextureParams 4 "gammaEncodeParams"
|
||||
OpMemberName %ExternalTextureParams 5 "gamutConversionMatrix"
|
||||
OpMemberName %ExternalTextureParams 6 "rotationMatrix"
|
||||
OpName %textureLoadExternal "textureLoadExternal"
|
||||
OpName %plane0 "plane0"
|
||||
OpName %plane1 "plane1"
|
||||
OpName %coord "coord"
|
||||
OpName %params_0 "params"
|
||||
OpName %color "color"
|
||||
OpName %conv_ExternalTextureParams "conv_ExternalTextureParams"
|
||||
OpName %val "val"
|
||||
OpName %main "main"
|
||||
OpName %red "red"
|
||||
OpName %green "green"
|
||||
OpDecorate %ext_tex_plane_1 DescriptorSet 0
|
||||
OpDecorate %ext_tex_plane_1 Binding 2
|
||||
OpDecorate %ext_tex_params_block_std140 Block
|
||||
OpMemberDecorate %ext_tex_params_block_std140 0 Offset 0
|
||||
OpMemberDecorate %ExternalTextureParams_std140 0 Offset 0
|
||||
OpMemberDecorate %ExternalTextureParams_std140 1 Offset 4
|
||||
OpMemberDecorate %ExternalTextureParams_std140 2 Offset 16
|
||||
OpMemberDecorate %ExternalTextureParams_std140 2 ColMajor
|
||||
OpMemberDecorate %ExternalTextureParams_std140 2 MatrixStride 16
|
||||
OpMemberDecorate %ExternalTextureParams_std140 3 Offset 64
|
||||
OpDecorate %ext_tex_params_block Block
|
||||
OpMemberDecorate %ext_tex_params_block 0 Offset 0
|
||||
OpMemberDecorate %ExternalTextureParams 0 Offset 0
|
||||
OpMemberDecorate %ExternalTextureParams 1 Offset 4
|
||||
OpMemberDecorate %ExternalTextureParams 2 Offset 16
|
||||
OpMemberDecorate %ExternalTextureParams 2 ColMajor
|
||||
OpMemberDecorate %ExternalTextureParams 2 MatrixStride 16
|
||||
OpMemberDecorate %ExternalTextureParams 3 Offset 64
|
||||
OpMemberDecorate %GammaTransferParams 0 Offset 0
|
||||
OpMemberDecorate %GammaTransferParams 1 Offset 4
|
||||
OpMemberDecorate %GammaTransferParams 2 Offset 8
|
||||
@@ -77,12 +66,13 @@
|
||||
OpMemberDecorate %GammaTransferParams 5 Offset 20
|
||||
OpMemberDecorate %GammaTransferParams 6 Offset 24
|
||||
OpMemberDecorate %GammaTransferParams 7 Offset 28
|
||||
OpMemberDecorate %ExternalTextureParams_std140 4 Offset 96
|
||||
OpMemberDecorate %ExternalTextureParams_std140 5 Offset 128
|
||||
OpMemberDecorate %ExternalTextureParams_std140 5 ColMajor
|
||||
OpMemberDecorate %ExternalTextureParams_std140 5 MatrixStride 16
|
||||
OpMemberDecorate %ExternalTextureParams_std140 6 Offset 176
|
||||
OpMemberDecorate %ExternalTextureParams_std140 7 Offset 184
|
||||
OpMemberDecorate %ExternalTextureParams 4 Offset 96
|
||||
OpMemberDecorate %ExternalTextureParams 5 Offset 128
|
||||
OpMemberDecorate %ExternalTextureParams 5 ColMajor
|
||||
OpMemberDecorate %ExternalTextureParams 5 MatrixStride 16
|
||||
OpMemberDecorate %ExternalTextureParams 6 Offset 176
|
||||
OpMemberDecorate %ExternalTextureParams 6 ColMajor
|
||||
OpMemberDecorate %ExternalTextureParams 6 MatrixStride 16
|
||||
OpDecorate %ext_tex_params NonWritable
|
||||
OpDecorate %ext_tex_params DescriptorSet 0
|
||||
OpDecorate %ext_tex_params Binding 3
|
||||
@@ -91,19 +81,6 @@
|
||||
OpDecorate %outImage NonReadable
|
||||
OpDecorate %outImage DescriptorSet 0
|
||||
OpDecorate %outImage Binding 1
|
||||
OpMemberDecorate %ExternalTextureParams 0 Offset 0
|
||||
OpMemberDecorate %ExternalTextureParams 1 Offset 4
|
||||
OpMemberDecorate %ExternalTextureParams 2 Offset 16
|
||||
OpMemberDecorate %ExternalTextureParams 2 ColMajor
|
||||
OpMemberDecorate %ExternalTextureParams 2 MatrixStride 16
|
||||
OpMemberDecorate %ExternalTextureParams 3 Offset 64
|
||||
OpMemberDecorate %ExternalTextureParams 4 Offset 96
|
||||
OpMemberDecorate %ExternalTextureParams 5 Offset 128
|
||||
OpMemberDecorate %ExternalTextureParams 5 ColMajor
|
||||
OpMemberDecorate %ExternalTextureParams 5 MatrixStride 16
|
||||
OpMemberDecorate %ExternalTextureParams 6 Offset 176
|
||||
OpMemberDecorate %ExternalTextureParams 6 ColMajor
|
||||
OpMemberDecorate %ExternalTextureParams 6 MatrixStride 8
|
||||
%float = OpTypeFloat 32
|
||||
%3 = OpTypeImage %float 2D 0 0 0 1 Unknown
|
||||
%_ptr_UniformConstant_3 = OpTypePointer UniformConstant %3
|
||||
@@ -114,11 +91,11 @@
|
||||
%GammaTransferParams = OpTypeStruct %float %float %float %float %float %float %float %uint
|
||||
%v3float = OpTypeVector %float 3
|
||||
%mat3v3float = OpTypeMatrix %v3float 3
|
||||
%v2float = OpTypeVector %float 2
|
||||
%ExternalTextureParams_std140 = OpTypeStruct %uint %uint %mat3v4float %GammaTransferParams %GammaTransferParams %mat3v3float %v2float %v2float
|
||||
%ext_tex_params_block_std140 = OpTypeStruct %ExternalTextureParams_std140
|
||||
%_ptr_Uniform_ext_tex_params_block_std140 = OpTypePointer Uniform %ext_tex_params_block_std140
|
||||
%ext_tex_params = OpVariable %_ptr_Uniform_ext_tex_params_block_std140 Uniform
|
||||
%mat2v3float = OpTypeMatrix %v3float 2
|
||||
%ExternalTextureParams = OpTypeStruct %uint %uint %mat3v4float %GammaTransferParams %GammaTransferParams %mat3v3float %mat2v3float
|
||||
%ext_tex_params_block = OpTypeStruct %ExternalTextureParams
|
||||
%_ptr_Uniform_ext_tex_params_block = OpTypePointer Uniform %ext_tex_params_block
|
||||
%ext_tex_params = OpVariable %_ptr_Uniform_ext_tex_params_block Uniform
|
||||
%t = OpVariable %_ptr_UniformConstant_3 UniformConstant
|
||||
%19 = OpTypeImage %float 2D 0 0 0 2 Rgba8
|
||||
%_ptr_UniformConstant_19 = OpTypePointer UniformConstant %19
|
||||
@@ -131,31 +108,29 @@
|
||||
%v3bool = OpTypeVector %bool 3
|
||||
%_ptr_Function_v3float = OpTypePointer Function %v3float
|
||||
%50 = OpConstantNull %v3float
|
||||
%mat2v2float = OpTypeMatrix %v2float 2
|
||||
%ExternalTextureParams = OpTypeStruct %uint %uint %mat3v4float %GammaTransferParams %GammaTransferParams %mat3v3float %mat2v2float
|
||||
%70 = OpTypeFunction %v4float %3 %3 %v2int %ExternalTextureParams
|
||||
%uint_1 = OpConstant %uint 1
|
||||
%87 = OpConstantNull %int
|
||||
%85 = OpConstantNull %int
|
||||
%v2float = OpTypeVector %float 2
|
||||
%float_1 = OpConstant %float 1
|
||||
%100 = OpConstantNull %uint
|
||||
%118 = OpTypeFunction %ExternalTextureParams %ExternalTextureParams_std140
|
||||
%99 = OpConstantNull %uint
|
||||
%void = OpTypeVoid
|
||||
%132 = OpTypeFunction %void
|
||||
%117 = OpTypeFunction %void
|
||||
%int_10 = OpConstant %int 10
|
||||
%138 = OpConstantComposite %v2int %int_10 %int_10
|
||||
%139 = OpConstantNull %v2int
|
||||
%123 = OpConstantComposite %v2int %int_10 %int_10
|
||||
%124 = OpConstantNull %v2int
|
||||
%v2uint = OpTypeVector %uint 2
|
||||
%int_0 = OpConstant %int 0
|
||||
%146 = OpConstantComposite %v2uint %uint_1 %uint_1
|
||||
%131 = OpConstantComposite %v2uint %uint_1 %uint_1
|
||||
%uint_0 = OpConstant %uint 0
|
||||
%_ptr_Uniform_ExternalTextureParams_std140 = OpTypePointer Uniform %ExternalTextureParams_std140
|
||||
%_ptr_Uniform_ExternalTextureParams = OpTypePointer Uniform %ExternalTextureParams
|
||||
%_ptr_Function_v4float = OpTypePointer Function %v4float
|
||||
%158 = OpConstantNull %v4float
|
||||
%142 = OpConstantNull %v4float
|
||||
%int_70 = OpConstant %int 70
|
||||
%int_118 = OpConstant %int 118
|
||||
%171 = OpConstantComposite %v2int %int_70 %int_118
|
||||
%155 = OpConstantComposite %v2int %int_70 %int_118
|
||||
%int_1 = OpConstant %int 1
|
||||
%186 = OpConstantComposite %v2int %int_1 %87
|
||||
%169 = OpConstantComposite %v2int %int_1 %85
|
||||
%tint_clamp = OpFunction %v2int None %20
|
||||
%e = OpFunctionParameter %v2int
|
||||
%low = OpFunctionParameter %v2int
|
||||
@@ -206,114 +181,97 @@
|
||||
%plane1 = OpFunctionParameter %3
|
||||
%coord = OpFunctionParameter %v2int
|
||||
%params_0 = OpFunctionParameter %ExternalTextureParams
|
||||
%78 = OpLabel
|
||||
%76 = OpLabel
|
||||
%color = OpVariable %_ptr_Function_v3float Function %50
|
||||
%80 = OpCompositeExtract %uint %params_0 0
|
||||
%82 = OpIEqual %bool %80 %uint_1
|
||||
OpSelectionMerge %83 None
|
||||
OpBranchConditional %82 %84 %85
|
||||
%84 = OpLabel
|
||||
%86 = OpImageFetch %v4float %plane0 %coord Lod %87
|
||||
%88 = OpVectorShuffle %v3float %86 %86 0 1 2
|
||||
OpStore %color %88
|
||||
OpBranch %83
|
||||
%85 = OpLabel
|
||||
%89 = OpImageFetch %v4float %plane0 %coord Lod %87
|
||||
%90 = OpCompositeExtract %float %89 0
|
||||
%91 = OpImageFetch %v4float %plane1 %coord Lod %87
|
||||
%92 = OpVectorShuffle %v2float %91 %91 0 1
|
||||
%93 = OpCompositeExtract %float %92 0
|
||||
%94 = OpCompositeExtract %float %92 1
|
||||
%96 = OpCompositeConstruct %v4float %90 %93 %94 %float_1
|
||||
%97 = OpCompositeExtract %mat3v4float %params_0 2
|
||||
%98 = OpVectorTimesMatrix %v3float %96 %97
|
||||
OpStore %color %98
|
||||
OpBranch %83
|
||||
%78 = OpCompositeExtract %uint %params_0 0
|
||||
%80 = OpIEqual %bool %78 %uint_1
|
||||
OpSelectionMerge %81 None
|
||||
OpBranchConditional %80 %82 %83
|
||||
%82 = OpLabel
|
||||
%84 = OpImageFetch %v4float %plane0 %coord Lod %85
|
||||
%86 = OpVectorShuffle %v3float %84 %84 0 1 2
|
||||
OpStore %color %86
|
||||
OpBranch %81
|
||||
%83 = OpLabel
|
||||
%99 = OpCompositeExtract %uint %params_0 1
|
||||
%101 = OpIEqual %bool %99 %100
|
||||
OpSelectionMerge %102 None
|
||||
OpBranchConditional %101 %103 %102
|
||||
%103 = OpLabel
|
||||
%105 = OpLoad %v3float %color
|
||||
%106 = OpCompositeExtract %GammaTransferParams %params_0 3
|
||||
%104 = OpFunctionCall %v3float %gammaCorrection %105 %106
|
||||
OpStore %color %104
|
||||
%107 = OpCompositeExtract %mat3v3float %params_0 5
|
||||
%108 = OpLoad %v3float %color
|
||||
%109 = OpMatrixTimesVector %v3float %107 %108
|
||||
OpStore %color %109
|
||||
%111 = OpLoad %v3float %color
|
||||
%112 = OpCompositeExtract %GammaTransferParams %params_0 4
|
||||
%110 = OpFunctionCall %v3float %gammaCorrection %111 %112
|
||||
OpStore %color %110
|
||||
OpBranch %102
|
||||
%87 = OpImageFetch %v4float %plane0 %coord Lod %85
|
||||
%88 = OpCompositeExtract %float %87 0
|
||||
%89 = OpImageFetch %v4float %plane1 %coord Lod %85
|
||||
%91 = OpVectorShuffle %v2float %89 %89 0 1
|
||||
%92 = OpCompositeExtract %float %91 0
|
||||
%93 = OpCompositeExtract %float %91 1
|
||||
%95 = OpCompositeConstruct %v4float %88 %92 %93 %float_1
|
||||
%96 = OpCompositeExtract %mat3v4float %params_0 2
|
||||
%97 = OpVectorTimesMatrix %v3float %95 %96
|
||||
OpStore %color %97
|
||||
OpBranch %81
|
||||
%81 = OpLabel
|
||||
%98 = OpCompositeExtract %uint %params_0 1
|
||||
%100 = OpIEqual %bool %98 %99
|
||||
OpSelectionMerge %101 None
|
||||
OpBranchConditional %100 %102 %101
|
||||
%102 = OpLabel
|
||||
%113 = OpLoad %v3float %color
|
||||
%114 = OpCompositeExtract %float %113 0
|
||||
%115 = OpCompositeExtract %float %113 1
|
||||
%116 = OpCompositeExtract %float %113 2
|
||||
%117 = OpCompositeConstruct %v4float %114 %115 %116 %float_1
|
||||
OpReturnValue %117
|
||||
%104 = OpLoad %v3float %color
|
||||
%105 = OpCompositeExtract %GammaTransferParams %params_0 3
|
||||
%103 = OpFunctionCall %v3float %gammaCorrection %104 %105
|
||||
OpStore %color %103
|
||||
%106 = OpCompositeExtract %mat3v3float %params_0 5
|
||||
%107 = OpLoad %v3float %color
|
||||
%108 = OpMatrixTimesVector %v3float %106 %107
|
||||
OpStore %color %108
|
||||
%110 = OpLoad %v3float %color
|
||||
%111 = OpCompositeExtract %GammaTransferParams %params_0 4
|
||||
%109 = OpFunctionCall %v3float %gammaCorrection %110 %111
|
||||
OpStore %color %109
|
||||
OpBranch %101
|
||||
%101 = OpLabel
|
||||
%112 = OpLoad %v3float %color
|
||||
%113 = OpCompositeExtract %float %112 0
|
||||
%114 = OpCompositeExtract %float %112 1
|
||||
%115 = OpCompositeExtract %float %112 2
|
||||
%116 = OpCompositeConstruct %v4float %113 %114 %115 %float_1
|
||||
OpReturnValue %116
|
||||
OpFunctionEnd
|
||||
%conv_ExternalTextureParams = OpFunction %ExternalTextureParams None %118
|
||||
%val = OpFunctionParameter %ExternalTextureParams_std140
|
||||
%121 = OpLabel
|
||||
%122 = OpCompositeExtract %uint %val 0
|
||||
%123 = OpCompositeExtract %uint %val 1
|
||||
%124 = OpCompositeExtract %mat3v4float %val 2
|
||||
%125 = OpCompositeExtract %GammaTransferParams %val 3
|
||||
%126 = OpCompositeExtract %GammaTransferParams %val 4
|
||||
%127 = OpCompositeExtract %mat3v3float %val 5
|
||||
%128 = OpCompositeExtract %v2float %val 6
|
||||
%129 = OpCompositeExtract %v2float %val 7
|
||||
%130 = OpCompositeConstruct %mat2v2float %128 %129
|
||||
%131 = OpCompositeConstruct %ExternalTextureParams %122 %123 %124 %125 %126 %127 %130
|
||||
OpReturnValue %131
|
||||
OpFunctionEnd
|
||||
%main = OpFunction %void None %132
|
||||
%135 = OpLabel
|
||||
%red = OpVariable %_ptr_Function_v4float Function %158
|
||||
%green = OpVariable %_ptr_Function_v4float Function %158
|
||||
%144 = OpLoad %3 %t
|
||||
%143 = OpImageQuerySizeLod %v2uint %144 %int_0
|
||||
%147 = OpISub %v2uint %143 %146
|
||||
%140 = OpBitcast %v2int %147
|
||||
%136 = OpFunctionCall %v2int %tint_clamp %138 %139 %140
|
||||
%149 = OpLoad %3 %t
|
||||
%150 = OpLoad %3 %ext_tex_plane_1
|
||||
%154 = OpAccessChain %_ptr_Uniform_ExternalTextureParams_std140 %ext_tex_params %uint_0
|
||||
%155 = OpLoad %ExternalTextureParams_std140 %154
|
||||
%151 = OpFunctionCall %ExternalTextureParams %conv_ExternalTextureParams %155
|
||||
%148 = OpFunctionCall %v4float %textureLoadExternal %149 %150 %136 %151
|
||||
OpStore %red %148
|
||||
%163 = OpLoad %19 %outImage
|
||||
%162 = OpImageQuerySize %v2uint %163
|
||||
%164 = OpISub %v2uint %162 %146
|
||||
%160 = OpBitcast %v2int %164
|
||||
%159 = OpFunctionCall %v2int %tint_clamp %139 %139 %160
|
||||
%166 = OpLoad %19 %outImage
|
||||
%167 = OpLoad %v4float %red
|
||||
OpImageWrite %166 %159 %167
|
||||
%175 = OpLoad %3 %t
|
||||
%174 = OpImageQuerySizeLod %v2uint %175 %int_0
|
||||
%176 = OpISub %v2uint %174 %146
|
||||
%172 = OpBitcast %v2int %176
|
||||
%168 = OpFunctionCall %v2int %tint_clamp %171 %139 %172
|
||||
%178 = OpLoad %3 %t
|
||||
%179 = OpLoad %3 %ext_tex_plane_1
|
||||
%181 = OpAccessChain %_ptr_Uniform_ExternalTextureParams_std140 %ext_tex_params %uint_0
|
||||
%182 = OpLoad %ExternalTextureParams_std140 %181
|
||||
%180 = OpFunctionCall %ExternalTextureParams %conv_ExternalTextureParams %182
|
||||
%177 = OpFunctionCall %v4float %textureLoadExternal %178 %179 %168 %180
|
||||
OpStore %green %177
|
||||
%190 = OpLoad %19 %outImage
|
||||
%189 = OpImageQuerySize %v2uint %190
|
||||
%191 = OpISub %v2uint %189 %146
|
||||
%187 = OpBitcast %v2int %191
|
||||
%184 = OpFunctionCall %v2int %tint_clamp %186 %139 %187
|
||||
%193 = OpLoad %19 %outImage
|
||||
%194 = OpLoad %v4float %green
|
||||
OpImageWrite %193 %184 %194
|
||||
%main = OpFunction %void None %117
|
||||
%120 = OpLabel
|
||||
%red = OpVariable %_ptr_Function_v4float Function %142
|
||||
%green = OpVariable %_ptr_Function_v4float Function %142
|
||||
%129 = OpLoad %3 %t
|
||||
%128 = OpImageQuerySizeLod %v2uint %129 %int_0
|
||||
%132 = OpISub %v2uint %128 %131
|
||||
%125 = OpBitcast %v2int %132
|
||||
%121 = OpFunctionCall %v2int %tint_clamp %123 %124 %125
|
||||
%134 = OpLoad %3 %t
|
||||
%135 = OpLoad %3 %ext_tex_plane_1
|
||||
%138 = OpAccessChain %_ptr_Uniform_ExternalTextureParams %ext_tex_params %uint_0
|
||||
%139 = OpLoad %ExternalTextureParams %138
|
||||
%133 = OpFunctionCall %v4float %textureLoadExternal %134 %135 %121 %139
|
||||
OpStore %red %133
|
||||
%147 = OpLoad %19 %outImage
|
||||
%146 = OpImageQuerySize %v2uint %147
|
||||
%148 = OpISub %v2uint %146 %131
|
||||
%144 = OpBitcast %v2int %148
|
||||
%143 = OpFunctionCall %v2int %tint_clamp %124 %124 %144
|
||||
%150 = OpLoad %19 %outImage
|
||||
%151 = OpLoad %v4float %red
|
||||
OpImageWrite %150 %143 %151
|
||||
%159 = OpLoad %3 %t
|
||||
%158 = OpImageQuerySizeLod %v2uint %159 %int_0
|
||||
%160 = OpISub %v2uint %158 %131
|
||||
%156 = OpBitcast %v2int %160
|
||||
%152 = OpFunctionCall %v2int %tint_clamp %155 %124 %156
|
||||
%162 = OpLoad %3 %t
|
||||
%163 = OpLoad %3 %ext_tex_plane_1
|
||||
%164 = OpAccessChain %_ptr_Uniform_ExternalTextureParams %ext_tex_params %uint_0
|
||||
%165 = OpLoad %ExternalTextureParams %164
|
||||
%161 = OpFunctionCall %v4float %textureLoadExternal %162 %163 %152 %165
|
||||
OpStore %green %161
|
||||
%173 = OpLoad %19 %outImage
|
||||
%172 = OpImageQuerySize %v2uint %173
|
||||
%174 = OpISub %v2uint %172 %131
|
||||
%170 = OpBitcast %v2int %174
|
||||
%167 = OpFunctionCall %v2int %tint_clamp %169 %124 %170
|
||||
%176 = OpLoad %19 %outImage
|
||||
%177 = OpLoad %v4float %green
|
||||
OpImageWrite %176 %167 %177
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
|
||||
@@ -16,7 +16,7 @@ struct ExternalTextureParams {
|
||||
gammaDecodeParams : GammaTransferParams,
|
||||
gammaEncodeParams : GammaTransferParams,
|
||||
gamutConversionMatrix : mat3x3<f32>,
|
||||
rotationMatrix : mat2x2<f32>,
|
||||
coordTransformationMatrix : mat2x3<f32>,
|
||||
}
|
||||
|
||||
@group(0) @binding(2) var ext_tex_plane_1 : texture_2d<f32>;
|
||||
|
||||
Reference in New Issue
Block a user