tint: Remove textureSampleLevel(texture_external)
Fixed: tint:1671 Change-Id: Iafed8d3ddbc99b80bbe70d3fc3847ac7a25c5e37 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/110101 Commit-Queue: Ben Clayton <bclayton@chromium.org> Kokoro: Kokoro <noreply+kokoro@google.com> Reviewed-by: Dan Sinclair <dsinclair@chromium.org> Commit-Queue: Ben Clayton <bclayton@google.com>
This commit is contained in:
parent
aedda6a500
commit
543dd18d3c
|
@ -2,6 +2,10 @@
|
|||
|
||||
## Changes for M110
|
||||
|
||||
### Breaking changes
|
||||
|
||||
* The `textureSampleLevel()` overload for `texture_external` has been removed. Use `textureSampleBaseClampToEdge()`. [tint:1671](crbug.com/tint/1671)
|
||||
|
||||
### Deprecated Features
|
||||
|
||||
* The `sig` member of the return type of `frexp()` has been renamed to `fract`. [tint:1757](crbug.com/tint/1757)
|
||||
|
|
|
@ -675,7 +675,6 @@ fn textureSampleLevel<A: iu32, L: iu32>(texture: texture_depth_2d_array, sampler
|
|||
fn textureSampleLevel<A: iu32, L: iu32>(texture: texture_depth_2d_array, sampler: sampler, coords: vec2<f32>, array_index: A, level: L, @const offset: vec2<i32>) -> f32
|
||||
fn textureSampleLevel<L: iu32>(texture: texture_depth_cube, sampler: sampler, coords: vec3<f32>, level: L) -> f32
|
||||
fn textureSampleLevel<A: iu32, L: iu32>(texture: texture_depth_cube_array,sampler: sampler, coords: vec3<f32>, array_index: A, level: L) -> f32
|
||||
@deprecated fn textureSampleLevel(texture: texture_external, sampler: sampler, coords: vec2<f32>) -> vec4<f32>
|
||||
fn textureSampleBaseClampToEdge(texture: texture_2d<f32>, sampler: sampler, coords: vec2<f32>) -> vec4<f32>
|
||||
fn textureSampleBaseClampToEdge(texture: texture_external, sampler: sampler, coords: vec2<f32>) -> vec4<f32>
|
||||
fn textureStore<C: iu32>(texture: texture_storage_1d<f32_texel_format, write>, coords: C, value: vec4<f32>)
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -211,8 +211,6 @@ struct MultiplanarExternalTexture::State {
|
|||
switch (builtin->Type()) {
|
||||
case sem::BuiltinType::kTextureLoad:
|
||||
return createTextureLoad(call, syms);
|
||||
case sem::BuiltinType::kTextureSampleLevel:
|
||||
return createTextureSampleLevel(expr, syms);
|
||||
case sem::BuiltinType::kTextureSampleBaseClampToEdge:
|
||||
return createTextureSampleBaseClampToEdge(expr, syms);
|
||||
default:
|
||||
|
@ -315,15 +313,6 @@ struct MultiplanarExternalTexture::State {
|
|||
const ast::CallExpression* plane_0_call = nullptr;
|
||||
const ast::CallExpression* plane_1_call = nullptr;
|
||||
switch (call_type) {
|
||||
case sem::BuiltinType::kTextureSampleLevel:
|
||||
// TODO(crbug.com/tint/1671): DEPRECATED
|
||||
// textureSampleLevel(plane0, smp, coord, 0.0);
|
||||
single_plane_call = b.Call("textureSampleLevel", "plane0", "smp", "coord", 0_a);
|
||||
// textureSampleLevel(plane0, smp, coord, 0.0);
|
||||
plane_0_call = b.Call("textureSampleLevel", "plane0", "smp", "coord", 0_a);
|
||||
// textureSampleLevel(plane1, smp, coord, 0.0);
|
||||
plane_1_call = b.Call("textureSampleLevel", "plane1", "smp", "coord", 0_a);
|
||||
break;
|
||||
case sem::BuiltinType::kTextureSampleBaseClampToEdge:
|
||||
stmts.Push(b.Decl(b.Let(
|
||||
"plane0_dims",
|
||||
|
@ -399,54 +388,6 @@ struct MultiplanarExternalTexture::State {
|
|||
return stmts;
|
||||
}
|
||||
|
||||
/// Creates the textureSampleExternal function if needed and returns a call expression to it.
|
||||
/// TODO(crbug.com/tint/1671): DEPRECATED: Replaced with createTextureSampleBaseClampToEdge().
|
||||
/// @param expr the call expression being transformed
|
||||
/// @param syms the expanded symbols to be used in the new call
|
||||
/// @returns a call expression to textureSampleExternal
|
||||
const ast::CallExpression* createTextureSampleLevel(const ast::CallExpression* expr,
|
||||
NewBindingSymbols syms) {
|
||||
const ast::Expression* plane_0_binding_param = ctx.Clone(expr->args[0]);
|
||||
|
||||
if (expr->args.Length() != 3) {
|
||||
TINT_ICE(Transform, b.Diagnostics()) << "expected textureSampleLevel call with a "
|
||||
"texture_external to have 3 parameters, found "
|
||||
<< expr->args.Length() << " parameters";
|
||||
}
|
||||
|
||||
// TextureSampleExternal calls the gammaCorrection function, so ensure it
|
||||
// exists.
|
||||
if (!gamma_correction_sym.IsValid()) {
|
||||
createGammaCorrectionFn();
|
||||
}
|
||||
|
||||
if (!texture_sample_external_sym.IsValid()) {
|
||||
texture_sample_external_sym = b.Symbols().New("textureSampleExternal");
|
||||
|
||||
// Emit the textureSampleExternal function.
|
||||
b.Func(
|
||||
texture_sample_external_sym,
|
||||
utils::Vector{
|
||||
b.Param("plane0", b.ty.sampled_texture(ast::TextureDimension::k2d, b.ty.f32())),
|
||||
b.Param("plane1", b.ty.sampled_texture(ast::TextureDimension::k2d, b.ty.f32())),
|
||||
b.Param("smp", b.ty.sampler(ast::SamplerKind::kSampler)),
|
||||
b.Param("coord", b.ty.vec2(b.ty.f32())),
|
||||
b.Param("params", b.ty.type_name(params_struct_sym)),
|
||||
},
|
||||
b.ty.vec4(b.ty.f32()),
|
||||
buildTextureBuiltinBody(sem::BuiltinType::kTextureSampleLevel));
|
||||
}
|
||||
|
||||
const ast::IdentifierExpression* exp = b.Expr(texture_sample_external_sym);
|
||||
return b.Call(exp, utils::Vector{
|
||||
plane_0_binding_param,
|
||||
b.Expr(syms.plane_1),
|
||||
ctx.Clone(expr->args[1]),
|
||||
ctx.Clone(expr->args[2]),
|
||||
b.Expr(syms.params),
|
||||
});
|
||||
}
|
||||
|
||||
/// Creates the textureSampleExternal function if needed and returns a call expression to it.
|
||||
/// @param expr the call expression being transformed
|
||||
/// @param syms the expanded symbols to be used in the new call
|
||||
|
|
|
@ -65,24 +65,6 @@ fn f(ext_tex : texture_external) {}
|
|||
EXPECT_TRUE(ShouldRun<MultiplanarExternalTexture>(src, data));
|
||||
}
|
||||
|
||||
// Running the transform without passing in data for the new bindings should result in an error.
|
||||
TEST_F(MultiplanarExternalTextureTest, ErrorNoPassedData_SampleLevel) {
|
||||
auto* src = R"(
|
||||
@group(0) @binding(0) var s : sampler;
|
||||
@group(0) @binding(1) var ext_tex : texture_external;
|
||||
|
||||
@fragment
|
||||
fn main(@builtin(position) coord : vec4<f32>) -> @location(0) vec4<f32> {
|
||||
return textureSampleLevel(ext_tex, s, coord.xy);
|
||||
}
|
||||
)";
|
||||
auto* expect =
|
||||
R"(error: missing new binding point data for tint::transform::MultiplanarExternalTexture)";
|
||||
|
||||
auto got = Run<MultiplanarExternalTexture>(src);
|
||||
EXPECT_EQ(expect, str(got));
|
||||
}
|
||||
|
||||
// Running the transform without passing in data for the new bindings should result in an error.
|
||||
TEST_F(MultiplanarExternalTextureTest, ErrorNoPassedData_SampleBaseClampToEdge) {
|
||||
auto* src = R"(
|
||||
|
@ -101,29 +83,6 @@ fn main(@builtin(position) coord : vec4<f32>) -> @location(0) vec4<f32> {
|
|||
EXPECT_EQ(expect, str(got));
|
||||
}
|
||||
|
||||
// Running the transform with incorrect binding data should result in an error.
|
||||
TEST_F(MultiplanarExternalTextureTest, ErrorIncorrectBindingPont_SampleLevel) {
|
||||
auto* src = R"(
|
||||
@group(0) @binding(0) var s : sampler;
|
||||
@group(0) @binding(1) var ext_tex : texture_external;
|
||||
|
||||
@fragment
|
||||
fn main(@builtin(position) coord : vec4<f32>) -> @location(0) vec4<f32> {
|
||||
return textureSampleLevel(ext_tex, s, coord.xy);
|
||||
}
|
||||
)";
|
||||
|
||||
auto* expect = R"(error: missing new binding points for texture_external at binding {0,1})";
|
||||
|
||||
DataMap data;
|
||||
// This bindings map specifies 0,0 as the location of the texture_external,
|
||||
// which is incorrect.
|
||||
data.Add<MultiplanarExternalTexture::NewBindingPoints>(
|
||||
MultiplanarExternalTexture::BindingsMap{{{0, 0}, {{0, 1}, {0, 2}}}});
|
||||
auto got = Run<MultiplanarExternalTexture>(src, data);
|
||||
EXPECT_EQ(expect, str(got));
|
||||
}
|
||||
|
||||
// Running the transform with incorrect binding data should result in an error.
|
||||
TEST_F(MultiplanarExternalTextureTest, ErrorIncorrectBindingPont_SampleBaseClampToEdge) {
|
||||
auto* src = R"(
|
||||
|
@ -257,82 +216,6 @@ fn main(@builtin(position) coord : vec4<f32>) -> @location(0) vec4<f32> {
|
|||
EXPECT_EQ(expect, str(got));
|
||||
}
|
||||
|
||||
// Test that the transform works with a textureSampleLevel call.
|
||||
TEST_F(MultiplanarExternalTextureTest, BasicTextureSampleLevel) {
|
||||
auto* src = R"(
|
||||
@group(0) @binding(0) var s : sampler;
|
||||
@group(0) @binding(1) var ext_tex : texture_external;
|
||||
|
||||
@fragment
|
||||
fn main(@builtin(position) coord : vec4<f32>) -> @location(0) vec4<f32> {
|
||||
return textureSampleLevel(ext_tex, s, coord.xy);
|
||||
}
|
||||
)";
|
||||
|
||||
auto* expect = R"(
|
||||
struct GammaTransferParams {
|
||||
G : f32,
|
||||
A : f32,
|
||||
B : f32,
|
||||
C : f32,
|
||||
D : f32,
|
||||
E : f32,
|
||||
F : f32,
|
||||
padding : u32,
|
||||
}
|
||||
|
||||
struct ExternalTextureParams {
|
||||
numPlanes : u32,
|
||||
doYuvToRgbConversionOnly : u32,
|
||||
yuvToRgbConversionMatrix : mat3x4<f32>,
|
||||
gammaDecodeParams : GammaTransferParams,
|
||||
gammaEncodeParams : GammaTransferParams,
|
||||
gamutConversionMatrix : mat3x3<f32>,
|
||||
}
|
||||
|
||||
@group(0) @binding(2) var ext_tex_plane_1 : texture_2d<f32>;
|
||||
|
||||
@group(0) @binding(3) var<uniform> ext_tex_params : ExternalTextureParams;
|
||||
|
||||
@group(0) @binding(0) var s : sampler;
|
||||
|
||||
@group(0) @binding(1) var ext_tex : texture_2d<f32>;
|
||||
|
||||
fn gammaCorrection(v : vec3<f32>, params : GammaTransferParams) -> vec3<f32> {
|
||||
let cond = (abs(v) < vec3<f32>(params.D));
|
||||
let t = (sign(v) * ((params.C * abs(v)) + params.F));
|
||||
let f = (sign(v) * (pow(((params.A * abs(v)) + params.B), vec3<f32>(params.G)) + params.E));
|
||||
return select(f, t, cond);
|
||||
}
|
||||
|
||||
fn textureSampleExternal(plane0 : texture_2d<f32>, plane1 : texture_2d<f32>, smp : sampler, coord : vec2<f32>, params : ExternalTextureParams) -> vec4<f32> {
|
||||
var color : vec3<f32>;
|
||||
if ((params.numPlanes == 1)) {
|
||||
color = textureSampleLevel(plane0, smp, coord, 0).rgb;
|
||||
} else {
|
||||
color = (vec4<f32>(textureSampleLevel(plane0, smp, coord, 0).r, textureSampleLevel(plane1, smp, coord, 0).rg, 1) * params.yuvToRgbConversionMatrix);
|
||||
}
|
||||
if ((params.doYuvToRgbConversionOnly == 0)) {
|
||||
color = gammaCorrection(color, params.gammaDecodeParams);
|
||||
color = (params.gamutConversionMatrix * color);
|
||||
color = gammaCorrection(color, params.gammaEncodeParams);
|
||||
}
|
||||
return vec4<f32>(color, 1);
|
||||
}
|
||||
|
||||
@fragment
|
||||
fn main(@builtin(position) coord : vec4<f32>) -> @location(0) vec4<f32> {
|
||||
return textureSampleExternal(ext_tex, ext_tex_plane_1, s, coord.xy, ext_tex_params);
|
||||
}
|
||||
)";
|
||||
|
||||
DataMap data;
|
||||
data.Add<MultiplanarExternalTexture::NewBindingPoints>(
|
||||
MultiplanarExternalTexture::BindingsMap{{{0, 1}, {{0, 2}, {0, 3}}}});
|
||||
auto got = Run<MultiplanarExternalTexture>(src, data);
|
||||
EXPECT_EQ(expect, str(got));
|
||||
}
|
||||
|
||||
// Test that the transform works with a textureSampleBaseClampToEdge call.
|
||||
TEST_F(MultiplanarExternalTextureTest, BasicTextureSampleBaseClampToEdge) {
|
||||
auto* src = R"(
|
||||
|
@ -415,82 +298,6 @@ fn main(@builtin(position) coord : vec4<f32>) -> @location(0) vec4<f32> {
|
|||
EXPECT_EQ(expect, str(got));
|
||||
}
|
||||
|
||||
// Test that the transform works with a textureSampleLevel call.
|
||||
TEST_F(MultiplanarExternalTextureTest, BasicTextureSampleLevel_OutOfOrder) {
|
||||
auto* src = R"(
|
||||
@fragment
|
||||
fn main(@builtin(position) coord : vec4<f32>) -> @location(0) vec4<f32> {
|
||||
return textureSampleLevel(ext_tex, s, coord.xy);
|
||||
}
|
||||
|
||||
@group(0) @binding(1) var ext_tex : texture_external;
|
||||
@group(0) @binding(0) var s : sampler;
|
||||
)";
|
||||
|
||||
auto* expect = R"(
|
||||
struct GammaTransferParams {
|
||||
G : f32,
|
||||
A : f32,
|
||||
B : f32,
|
||||
C : f32,
|
||||
D : f32,
|
||||
E : f32,
|
||||
F : f32,
|
||||
padding : u32,
|
||||
}
|
||||
|
||||
struct ExternalTextureParams {
|
||||
numPlanes : u32,
|
||||
doYuvToRgbConversionOnly : u32,
|
||||
yuvToRgbConversionMatrix : mat3x4<f32>,
|
||||
gammaDecodeParams : GammaTransferParams,
|
||||
gammaEncodeParams : GammaTransferParams,
|
||||
gamutConversionMatrix : mat3x3<f32>,
|
||||
}
|
||||
|
||||
@group(0) @binding(2) var ext_tex_plane_1 : texture_2d<f32>;
|
||||
|
||||
@group(0) @binding(3) var<uniform> ext_tex_params : ExternalTextureParams;
|
||||
|
||||
fn gammaCorrection(v : vec3<f32>, params : GammaTransferParams) -> vec3<f32> {
|
||||
let cond = (abs(v) < vec3<f32>(params.D));
|
||||
let t = (sign(v) * ((params.C * abs(v)) + params.F));
|
||||
let f = (sign(v) * (pow(((params.A * abs(v)) + params.B), vec3<f32>(params.G)) + params.E));
|
||||
return select(f, t, cond);
|
||||
}
|
||||
|
||||
fn textureSampleExternal(plane0 : texture_2d<f32>, plane1 : texture_2d<f32>, smp : sampler, coord : vec2<f32>, params : ExternalTextureParams) -> vec4<f32> {
|
||||
var color : vec3<f32>;
|
||||
if ((params.numPlanes == 1)) {
|
||||
color = textureSampleLevel(plane0, smp, coord, 0).rgb;
|
||||
} else {
|
||||
color = (vec4<f32>(textureSampleLevel(plane0, smp, coord, 0).r, textureSampleLevel(plane1, smp, coord, 0).rg, 1) * params.yuvToRgbConversionMatrix);
|
||||
}
|
||||
if ((params.doYuvToRgbConversionOnly == 0)) {
|
||||
color = gammaCorrection(color, params.gammaDecodeParams);
|
||||
color = (params.gamutConversionMatrix * color);
|
||||
color = gammaCorrection(color, params.gammaEncodeParams);
|
||||
}
|
||||
return vec4<f32>(color, 1);
|
||||
}
|
||||
|
||||
@fragment
|
||||
fn main(@builtin(position) coord : vec4<f32>) -> @location(0) vec4<f32> {
|
||||
return textureSampleExternal(ext_tex, ext_tex_plane_1, s, coord.xy, ext_tex_params);
|
||||
}
|
||||
|
||||
@group(0) @binding(1) var ext_tex : texture_2d<f32>;
|
||||
|
||||
@group(0) @binding(0) var s : sampler;
|
||||
)";
|
||||
|
||||
DataMap data;
|
||||
data.Add<MultiplanarExternalTexture::NewBindingPoints>(
|
||||
MultiplanarExternalTexture::BindingsMap{{{0, 1}, {{0, 2}, {0, 3}}}});
|
||||
auto got = Run<MultiplanarExternalTexture>(src, data);
|
||||
EXPECT_EQ(expect, str(got));
|
||||
}
|
||||
|
||||
// Test that the transform works with a textureSampleBaseClampToEdge call.
|
||||
TEST_F(MultiplanarExternalTextureTest, BasicTextureSampleBaseClampToEdge_OutOfOrder) {
|
||||
auto* src = R"(
|
||||
|
@ -757,97 +564,6 @@ fn main(@builtin(position) coord : vec4<f32>) -> @location(0) vec4<f32> {
|
|||
EXPECT_EQ(expect, str(got));
|
||||
}
|
||||
|
||||
// Tests that the transform works with both a textureSampleLevel and textureLoad call.
|
||||
TEST_F(MultiplanarExternalTextureTest, TextureSampleAndTextureLoad) {
|
||||
auto* src = R"(
|
||||
@group(0) @binding(0) var s : sampler;
|
||||
@group(0) @binding(1) var ext_tex : texture_external;
|
||||
|
||||
@fragment
|
||||
fn main(@builtin(position) coord : vec4<f32>) -> @location(0) vec4<f32> {
|
||||
return textureSampleLevel(ext_tex, s, coord.xy) + textureLoad(ext_tex, vec2<i32>(1, 1));
|
||||
}
|
||||
)";
|
||||
|
||||
auto* expect = R"(
|
||||
struct GammaTransferParams {
|
||||
G : f32,
|
||||
A : f32,
|
||||
B : f32,
|
||||
C : f32,
|
||||
D : f32,
|
||||
E : f32,
|
||||
F : f32,
|
||||
padding : u32,
|
||||
}
|
||||
|
||||
struct ExternalTextureParams {
|
||||
numPlanes : u32,
|
||||
doYuvToRgbConversionOnly : u32,
|
||||
yuvToRgbConversionMatrix : mat3x4<f32>,
|
||||
gammaDecodeParams : GammaTransferParams,
|
||||
gammaEncodeParams : GammaTransferParams,
|
||||
gamutConversionMatrix : mat3x3<f32>,
|
||||
}
|
||||
|
||||
@group(0) @binding(2) var ext_tex_plane_1 : texture_2d<f32>;
|
||||
|
||||
@group(0) @binding(3) var<uniform> ext_tex_params : ExternalTextureParams;
|
||||
|
||||
@group(0) @binding(0) var s : sampler;
|
||||
|
||||
@group(0) @binding(1) var ext_tex : texture_2d<f32>;
|
||||
|
||||
fn gammaCorrection(v : vec3<f32>, params : GammaTransferParams) -> vec3<f32> {
|
||||
let cond = (abs(v) < vec3<f32>(params.D));
|
||||
let t = (sign(v) * ((params.C * abs(v)) + params.F));
|
||||
let f = (sign(v) * (pow(((params.A * abs(v)) + params.B), vec3<f32>(params.G)) + params.E));
|
||||
return select(f, t, cond);
|
||||
}
|
||||
|
||||
fn textureSampleExternal(plane0 : texture_2d<f32>, plane1 : texture_2d<f32>, smp : sampler, coord : vec2<f32>, params : ExternalTextureParams) -> vec4<f32> {
|
||||
var color : vec3<f32>;
|
||||
if ((params.numPlanes == 1)) {
|
||||
color = textureSampleLevel(plane0, smp, coord, 0).rgb;
|
||||
} else {
|
||||
color = (vec4<f32>(textureSampleLevel(plane0, smp, coord, 0).r, textureSampleLevel(plane1, smp, coord, 0).rg, 1) * params.yuvToRgbConversionMatrix);
|
||||
}
|
||||
if ((params.doYuvToRgbConversionOnly == 0)) {
|
||||
color = gammaCorrection(color, params.gammaDecodeParams);
|
||||
color = (params.gamutConversionMatrix * color);
|
||||
color = gammaCorrection(color, params.gammaEncodeParams);
|
||||
}
|
||||
return vec4<f32>(color, 1);
|
||||
}
|
||||
|
||||
fn textureLoadExternal(plane0 : texture_2d<f32>, plane1 : texture_2d<f32>, coord : vec2<i32>, params : ExternalTextureParams) -> vec4<f32> {
|
||||
var color : vec3<f32>;
|
||||
if ((params.numPlanes == 1)) {
|
||||
color = textureLoad(plane0, coord, 0).rgb;
|
||||
} else {
|
||||
color = (vec4<f32>(textureLoad(plane0, coord, 0).r, textureLoad(plane1, coord, 0).rg, 1) * params.yuvToRgbConversionMatrix);
|
||||
}
|
||||
if ((params.doYuvToRgbConversionOnly == 0)) {
|
||||
color = gammaCorrection(color, params.gammaDecodeParams);
|
||||
color = (params.gamutConversionMatrix * color);
|
||||
color = gammaCorrection(color, params.gammaEncodeParams);
|
||||
}
|
||||
return vec4<f32>(color, 1);
|
||||
}
|
||||
|
||||
@fragment
|
||||
fn main(@builtin(position) coord : vec4<f32>) -> @location(0) vec4<f32> {
|
||||
return (textureSampleExternal(ext_tex, ext_tex_plane_1, s, coord.xy, ext_tex_params) + textureLoadExternal(ext_tex, ext_tex_plane_1, vec2<i32>(1, 1), ext_tex_params));
|
||||
}
|
||||
)";
|
||||
|
||||
DataMap data;
|
||||
data.Add<MultiplanarExternalTexture::NewBindingPoints>(
|
||||
MultiplanarExternalTexture::BindingsMap{{{0, 1}, {{0, 2}, {0, 3}}}});
|
||||
auto got = Run<MultiplanarExternalTexture>(src, data);
|
||||
EXPECT_EQ(expect, str(got));
|
||||
}
|
||||
|
||||
// Tests that the transform works with both a textureSampleBaseClampToEdge and textureLoad call.
|
||||
TEST_F(MultiplanarExternalTextureTest, TextureSampleBaseClampToEdgeAndTextureLoad) {
|
||||
auto* src = R"(
|
||||
|
@ -945,97 +661,6 @@ fn main(@builtin(position) coord : vec4<f32>) -> @location(0) vec4<f32> {
|
|||
EXPECT_EQ(expect, str(got));
|
||||
}
|
||||
|
||||
// Tests that the transform works with both a textureSampleLevel and textureLoad call.
|
||||
TEST_F(MultiplanarExternalTextureTest, TextureSampleAndTextureLoad_OutOfOrder) {
|
||||
auto* src = R"(
|
||||
@fragment
|
||||
fn main(@builtin(position) coord : vec4<f32>) -> @location(0) vec4<f32> {
|
||||
return textureSampleLevel(ext_tex, s, coord.xy) + textureLoad(ext_tex, vec2<i32>(1, 1));
|
||||
}
|
||||
|
||||
@group(0) @binding(0) var s : sampler;
|
||||
@group(0) @binding(1) var ext_tex : texture_external;
|
||||
)";
|
||||
|
||||
auto* expect = R"(
|
||||
struct GammaTransferParams {
|
||||
G : f32,
|
||||
A : f32,
|
||||
B : f32,
|
||||
C : f32,
|
||||
D : f32,
|
||||
E : f32,
|
||||
F : f32,
|
||||
padding : u32,
|
||||
}
|
||||
|
||||
struct ExternalTextureParams {
|
||||
numPlanes : u32,
|
||||
doYuvToRgbConversionOnly : u32,
|
||||
yuvToRgbConversionMatrix : mat3x4<f32>,
|
||||
gammaDecodeParams : GammaTransferParams,
|
||||
gammaEncodeParams : GammaTransferParams,
|
||||
gamutConversionMatrix : mat3x3<f32>,
|
||||
}
|
||||
|
||||
@group(0) @binding(2) var ext_tex_plane_1 : texture_2d<f32>;
|
||||
|
||||
@group(0) @binding(3) var<uniform> ext_tex_params : ExternalTextureParams;
|
||||
|
||||
fn gammaCorrection(v : vec3<f32>, params : GammaTransferParams) -> vec3<f32> {
|
||||
let cond = (abs(v) < vec3<f32>(params.D));
|
||||
let t = (sign(v) * ((params.C * abs(v)) + params.F));
|
||||
let f = (sign(v) * (pow(((params.A * abs(v)) + params.B), vec3<f32>(params.G)) + params.E));
|
||||
return select(f, t, cond);
|
||||
}
|
||||
|
||||
fn textureSampleExternal(plane0 : texture_2d<f32>, plane1 : texture_2d<f32>, smp : sampler, coord : vec2<f32>, params : ExternalTextureParams) -> vec4<f32> {
|
||||
var color : vec3<f32>;
|
||||
if ((params.numPlanes == 1)) {
|
||||
color = textureSampleLevel(plane0, smp, coord, 0).rgb;
|
||||
} else {
|
||||
color = (vec4<f32>(textureSampleLevel(plane0, smp, coord, 0).r, textureSampleLevel(plane1, smp, coord, 0).rg, 1) * params.yuvToRgbConversionMatrix);
|
||||
}
|
||||
if ((params.doYuvToRgbConversionOnly == 0)) {
|
||||
color = gammaCorrection(color, params.gammaDecodeParams);
|
||||
color = (params.gamutConversionMatrix * color);
|
||||
color = gammaCorrection(color, params.gammaEncodeParams);
|
||||
}
|
||||
return vec4<f32>(color, 1);
|
||||
}
|
||||
|
||||
fn textureLoadExternal(plane0 : texture_2d<f32>, plane1 : texture_2d<f32>, coord : vec2<i32>, params : ExternalTextureParams) -> vec4<f32> {
|
||||
var color : vec3<f32>;
|
||||
if ((params.numPlanes == 1)) {
|
||||
color = textureLoad(plane0, coord, 0).rgb;
|
||||
} else {
|
||||
color = (vec4<f32>(textureLoad(plane0, coord, 0).r, textureLoad(plane1, coord, 0).rg, 1) * params.yuvToRgbConversionMatrix);
|
||||
}
|
||||
if ((params.doYuvToRgbConversionOnly == 0)) {
|
||||
color = gammaCorrection(color, params.gammaDecodeParams);
|
||||
color = (params.gamutConversionMatrix * color);
|
||||
color = gammaCorrection(color, params.gammaEncodeParams);
|
||||
}
|
||||
return vec4<f32>(color, 1);
|
||||
}
|
||||
|
||||
@fragment
|
||||
fn main(@builtin(position) coord : vec4<f32>) -> @location(0) vec4<f32> {
|
||||
return (textureSampleExternal(ext_tex, ext_tex_plane_1, s, coord.xy, ext_tex_params) + textureLoadExternal(ext_tex, ext_tex_plane_1, vec2<i32>(1, 1), ext_tex_params));
|
||||
}
|
||||
|
||||
@group(0) @binding(0) var s : sampler;
|
||||
|
||||
@group(0) @binding(1) var ext_tex : texture_2d<f32>;
|
||||
)";
|
||||
|
||||
DataMap data;
|
||||
data.Add<MultiplanarExternalTexture::NewBindingPoints>(
|
||||
MultiplanarExternalTexture::BindingsMap{{{0, 1}, {{0, 2}, {0, 3}}}});
|
||||
auto got = Run<MultiplanarExternalTexture>(src, data);
|
||||
EXPECT_EQ(expect, str(got));
|
||||
}
|
||||
|
||||
// Tests that the transform works with both a textureSampleBaseClampToEdge and textureLoad call.
|
||||
TEST_F(MultiplanarExternalTextureTest, TextureSampleBaseClampToEdgeAndTextureLoad_OutOfOrder) {
|
||||
auto* src = R"(
|
||||
|
@ -1133,107 +758,6 @@ fn main(@builtin(position) coord : vec4<f32>) -> @location(0) vec4<f32> {
|
|||
EXPECT_EQ(expect, str(got));
|
||||
}
|
||||
|
||||
// Tests that the transform works with many instances of texture_external.
|
||||
TEST_F(MultiplanarExternalTextureTest, ManyTextureSampleLevel) {
|
||||
auto* src = R"(
|
||||
@group(0) @binding(0) var s : sampler;
|
||||
@group(0) @binding(1) var ext_tex : texture_external;
|
||||
@group(0) @binding(2) var ext_tex_1 : texture_external;
|
||||
@group(0) @binding(3) var ext_tex_2 : texture_external;
|
||||
@group(1) @binding(0) var ext_tex_3 : texture_external;
|
||||
|
||||
@fragment
|
||||
fn main(@builtin(position) coord : vec4<f32>) -> @location(0) vec4<f32> {
|
||||
return textureSampleLevel(ext_tex, s, coord.xy) + textureSampleLevel(ext_tex_1, s, coord.xy) + textureSampleLevel(ext_tex_2, s, coord.xy) + textureSampleLevel(ext_tex_3, s, coord.xy);
|
||||
}
|
||||
)";
|
||||
|
||||
auto* expect = R"(
|
||||
struct GammaTransferParams {
|
||||
G : f32,
|
||||
A : f32,
|
||||
B : f32,
|
||||
C : f32,
|
||||
D : f32,
|
||||
E : f32,
|
||||
F : f32,
|
||||
padding : u32,
|
||||
}
|
||||
|
||||
struct ExternalTextureParams {
|
||||
numPlanes : u32,
|
||||
doYuvToRgbConversionOnly : u32,
|
||||
yuvToRgbConversionMatrix : mat3x4<f32>,
|
||||
gammaDecodeParams : GammaTransferParams,
|
||||
gammaEncodeParams : GammaTransferParams,
|
||||
gamutConversionMatrix : mat3x3<f32>,
|
||||
}
|
||||
|
||||
@group(0) @binding(4) var ext_tex_plane_1 : texture_2d<f32>;
|
||||
|
||||
@group(0) @binding(5) var<uniform> ext_tex_params : ExternalTextureParams;
|
||||
|
||||
@group(0) @binding(6) var ext_tex_plane_1_1 : texture_2d<f32>;
|
||||
|
||||
@group(0) @binding(7) var<uniform> ext_tex_params_1 : ExternalTextureParams;
|
||||
|
||||
@group(0) @binding(8) var ext_tex_plane_1_2 : texture_2d<f32>;
|
||||
|
||||
@group(0) @binding(9) var<uniform> ext_tex_params_2 : ExternalTextureParams;
|
||||
|
||||
@group(1) @binding(1) var ext_tex_plane_1_3 : texture_2d<f32>;
|
||||
|
||||
@group(1) @binding(2) var<uniform> ext_tex_params_3 : ExternalTextureParams;
|
||||
|
||||
@group(0) @binding(0) var s : sampler;
|
||||
|
||||
@group(0) @binding(1) var ext_tex : texture_2d<f32>;
|
||||
|
||||
@group(0) @binding(2) var ext_tex_1 : texture_2d<f32>;
|
||||
|
||||
@group(0) @binding(3) var ext_tex_2 : texture_2d<f32>;
|
||||
|
||||
@group(1) @binding(0) var ext_tex_3 : texture_2d<f32>;
|
||||
|
||||
fn gammaCorrection(v : vec3<f32>, params : GammaTransferParams) -> vec3<f32> {
|
||||
let cond = (abs(v) < vec3<f32>(params.D));
|
||||
let t = (sign(v) * ((params.C * abs(v)) + params.F));
|
||||
let f = (sign(v) * (pow(((params.A * abs(v)) + params.B), vec3<f32>(params.G)) + params.E));
|
||||
return select(f, t, cond);
|
||||
}
|
||||
|
||||
fn textureSampleExternal(plane0 : texture_2d<f32>, plane1 : texture_2d<f32>, smp : sampler, coord : vec2<f32>, params : ExternalTextureParams) -> vec4<f32> {
|
||||
var color : vec3<f32>;
|
||||
if ((params.numPlanes == 1)) {
|
||||
color = textureSampleLevel(plane0, smp, coord, 0).rgb;
|
||||
} else {
|
||||
color = (vec4<f32>(textureSampleLevel(plane0, smp, coord, 0).r, textureSampleLevel(plane1, smp, coord, 0).rg, 1) * params.yuvToRgbConversionMatrix);
|
||||
}
|
||||
if ((params.doYuvToRgbConversionOnly == 0)) {
|
||||
color = gammaCorrection(color, params.gammaDecodeParams);
|
||||
color = (params.gamutConversionMatrix * color);
|
||||
color = gammaCorrection(color, params.gammaEncodeParams);
|
||||
}
|
||||
return vec4<f32>(color, 1);
|
||||
}
|
||||
|
||||
@fragment
|
||||
fn main(@builtin(position) coord : vec4<f32>) -> @location(0) vec4<f32> {
|
||||
return (((textureSampleExternal(ext_tex, ext_tex_plane_1, s, coord.xy, ext_tex_params) + textureSampleExternal(ext_tex_1, ext_tex_plane_1_1, s, coord.xy, ext_tex_params_1)) + textureSampleExternal(ext_tex_2, ext_tex_plane_1_2, s, coord.xy, ext_tex_params_2)) + textureSampleExternal(ext_tex_3, ext_tex_plane_1_3, s, coord.xy, ext_tex_params_3));
|
||||
}
|
||||
)";
|
||||
|
||||
DataMap data;
|
||||
data.Add<MultiplanarExternalTexture::NewBindingPoints>(MultiplanarExternalTexture::BindingsMap{
|
||||
{{0, 1}, {{0, 4}, {0, 5}}},
|
||||
{{0, 2}, {{0, 6}, {0, 7}}},
|
||||
{{0, 3}, {{0, 8}, {0, 9}}},
|
||||
{{1, 0}, {{1, 1}, {1, 2}}},
|
||||
});
|
||||
auto got = Run<MultiplanarExternalTexture>(src, data);
|
||||
EXPECT_EQ(expect, str(got));
|
||||
}
|
||||
|
||||
// Tests that the transform works with many instances of texture_external.
|
||||
TEST_F(MultiplanarExternalTextureTest, ManyTextureSampleBaseClampToEdge) {
|
||||
auto* src = R"(
|
||||
|
|
|
@ -1,45 +0,0 @@
|
|||
// Copyright 2022 The Tint Authors.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// File generated by tools/src/cmd/gen
|
||||
// using the template:
|
||||
// test/tint/builtins/gen/gen.wgsl.tmpl
|
||||
//
|
||||
// Do not modify this file directly
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@group(1) @binding(0) var arg_0: texture_external;
|
||||
@group(1) @binding(1) var arg_1: sampler;
|
||||
|
||||
// fn textureSampleLevel(texture: texture_external, sampler: sampler, coords: vec2<f32>) -> vec4<f32>
|
||||
fn textureSampleLevel_979816() {
|
||||
var res: vec4<f32> = textureSampleLevel(arg_0, arg_1, vec2<f32>(1.f));
|
||||
}
|
||||
|
||||
@vertex
|
||||
fn vertex_main() -> @builtin(position) vec4<f32> {
|
||||
textureSampleLevel_979816();
|
||||
return vec4<f32>();
|
||||
}
|
||||
|
||||
@fragment
|
||||
fn fragment_main() {
|
||||
textureSampleLevel_979816();
|
||||
}
|
||||
|
||||
@compute @workgroup_size(1)
|
||||
fn compute_main() {
|
||||
textureSampleLevel_979816();
|
||||
}
|
|
@ -1,116 +0,0 @@
|
|||
builtins/gen/literal/textureSampleLevel/979816.wgsl:28:24 warning: use of deprecated builtin
|
||||
var res: vec4<f32> = textureSampleLevel(arg_0, arg_1, vec2<f32>(1.f));
|
||||
^^^^^^^^^^^^^^^^^^
|
||||
|
||||
struct GammaTransferParams {
|
||||
float G;
|
||||
float A;
|
||||
float B;
|
||||
float C;
|
||||
float D;
|
||||
float E;
|
||||
float F;
|
||||
uint padding;
|
||||
};
|
||||
struct ExternalTextureParams {
|
||||
uint numPlanes;
|
||||
uint doYuvToRgbConversionOnly;
|
||||
float3x4 yuvToRgbConversionMatrix;
|
||||
GammaTransferParams gammaDecodeParams;
|
||||
GammaTransferParams gammaEncodeParams;
|
||||
float3x3 gamutConversionMatrix;
|
||||
};
|
||||
|
||||
Texture2D<float4> ext_tex_plane_1 : register(t2, space1);
|
||||
cbuffer cbuffer_ext_tex_params : register(b3, space1) {
|
||||
uint4 ext_tex_params[11];
|
||||
};
|
||||
Texture2D<float4> arg_0 : register(t0, space1);
|
||||
SamplerState arg_1 : register(s1, space1);
|
||||
|
||||
float3 gammaCorrection(float3 v, GammaTransferParams params) {
|
||||
const bool3 cond = (abs(v) < float3((params.D).xxx));
|
||||
const float3 t = (sign(v) * ((params.C * abs(v)) + params.F));
|
||||
const float3 f = (sign(v) * (pow(((params.A * abs(v)) + params.B), float3((params.G).xxx)) + params.E));
|
||||
return (cond ? t : f);
|
||||
}
|
||||
|
||||
float4 textureSampleExternal(Texture2D<float4> plane0, Texture2D<float4> plane1, SamplerState smp, float2 coord, ExternalTextureParams params) {
|
||||
float3 color = float3(0.0f, 0.0f, 0.0f);
|
||||
if ((params.numPlanes == 1u)) {
|
||||
color = plane0.SampleLevel(smp, coord, 0.0f).rgb;
|
||||
} else {
|
||||
color = mul(params.yuvToRgbConversionMatrix, float4(plane0.SampleLevel(smp, coord, 0.0f).r, plane1.SampleLevel(smp, coord, 0.0f).rg, 1.0f));
|
||||
}
|
||||
if ((params.doYuvToRgbConversionOnly == 0u)) {
|
||||
color = gammaCorrection(color, params.gammaDecodeParams);
|
||||
color = mul(color, params.gamutConversionMatrix);
|
||||
color = gammaCorrection(color, params.gammaEncodeParams);
|
||||
}
|
||||
return float4(color, 1.0f);
|
||||
}
|
||||
|
||||
float3x4 tint_symbol_3(uint4 buffer[11], 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_5(uint4 buffer[11], 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;
|
||||
const uint scalar_offset_6 = ((offset + 12u)) / 4;
|
||||
const uint scalar_offset_7 = ((offset + 16u)) / 4;
|
||||
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_9 = {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_9;
|
||||
}
|
||||
|
||||
float3x3 tint_symbol_7(uint4 buffer[11], 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));
|
||||
}
|
||||
|
||||
ExternalTextureParams tint_symbol_1(uint4 buffer[11], uint offset) {
|
||||
const uint scalar_offset_14 = ((offset + 0u)) / 4;
|
||||
const uint scalar_offset_15 = ((offset + 4u)) / 4;
|
||||
const ExternalTextureParams tint_symbol_10 = {buffer[scalar_offset_14 / 4][scalar_offset_14 % 4], buffer[scalar_offset_15 / 4][scalar_offset_15 % 4], tint_symbol_3(buffer, (offset + 16u)), tint_symbol_5(buffer, (offset + 64u)), tint_symbol_5(buffer, (offset + 96u)), tint_symbol_7(buffer, (offset + 128u))};
|
||||
return tint_symbol_10;
|
||||
}
|
||||
|
||||
void textureSampleLevel_979816() {
|
||||
float4 res = textureSampleExternal(arg_0, ext_tex_plane_1, arg_1, (1.0f).xx, tint_symbol_1(ext_tex_params, 0u));
|
||||
}
|
||||
|
||||
struct tint_symbol {
|
||||
float4 value : SV_Position;
|
||||
};
|
||||
|
||||
float4 vertex_main_inner() {
|
||||
textureSampleLevel_979816();
|
||||
return (0.0f).xxxx;
|
||||
}
|
||||
|
||||
tint_symbol vertex_main() {
|
||||
const float4 inner_result = vertex_main_inner();
|
||||
tint_symbol wrapper_result = (tint_symbol)0;
|
||||
wrapper_result.value = inner_result;
|
||||
return wrapper_result;
|
||||
}
|
||||
|
||||
void fragment_main() {
|
||||
textureSampleLevel_979816();
|
||||
return;
|
||||
}
|
||||
|
||||
[numthreads(1, 1, 1)]
|
||||
void compute_main() {
|
||||
textureSampleLevel_979816();
|
||||
return;
|
||||
}
|
|
@ -1,116 +0,0 @@
|
|||
builtins/gen/literal/textureSampleLevel/979816.wgsl:28:24 warning: use of deprecated builtin
|
||||
var res: vec4<f32> = textureSampleLevel(arg_0, arg_1, vec2<f32>(1.f));
|
||||
^^^^^^^^^^^^^^^^^^
|
||||
|
||||
struct GammaTransferParams {
|
||||
float G;
|
||||
float A;
|
||||
float B;
|
||||
float C;
|
||||
float D;
|
||||
float E;
|
||||
float F;
|
||||
uint padding;
|
||||
};
|
||||
struct ExternalTextureParams {
|
||||
uint numPlanes;
|
||||
uint doYuvToRgbConversionOnly;
|
||||
float3x4 yuvToRgbConversionMatrix;
|
||||
GammaTransferParams gammaDecodeParams;
|
||||
GammaTransferParams gammaEncodeParams;
|
||||
float3x3 gamutConversionMatrix;
|
||||
};
|
||||
|
||||
Texture2D<float4> ext_tex_plane_1 : register(t2, space1);
|
||||
cbuffer cbuffer_ext_tex_params : register(b3, space1) {
|
||||
uint4 ext_tex_params[11];
|
||||
};
|
||||
Texture2D<float4> arg_0 : register(t0, space1);
|
||||
SamplerState arg_1 : register(s1, space1);
|
||||
|
||||
float3 gammaCorrection(float3 v, GammaTransferParams params) {
|
||||
const bool3 cond = (abs(v) < float3((params.D).xxx));
|
||||
const float3 t = (sign(v) * ((params.C * abs(v)) + params.F));
|
||||
const float3 f = (sign(v) * (pow(((params.A * abs(v)) + params.B), float3((params.G).xxx)) + params.E));
|
||||
return (cond ? t : f);
|
||||
}
|
||||
|
||||
float4 textureSampleExternal(Texture2D<float4> plane0, Texture2D<float4> plane1, SamplerState smp, float2 coord, ExternalTextureParams params) {
|
||||
float3 color = float3(0.0f, 0.0f, 0.0f);
|
||||
if ((params.numPlanes == 1u)) {
|
||||
color = plane0.SampleLevel(smp, coord, 0.0f).rgb;
|
||||
} else {
|
||||
color = mul(params.yuvToRgbConversionMatrix, float4(plane0.SampleLevel(smp, coord, 0.0f).r, plane1.SampleLevel(smp, coord, 0.0f).rg, 1.0f));
|
||||
}
|
||||
if ((params.doYuvToRgbConversionOnly == 0u)) {
|
||||
color = gammaCorrection(color, params.gammaDecodeParams);
|
||||
color = mul(color, params.gamutConversionMatrix);
|
||||
color = gammaCorrection(color, params.gammaEncodeParams);
|
||||
}
|
||||
return float4(color, 1.0f);
|
||||
}
|
||||
|
||||
float3x4 tint_symbol_3(uint4 buffer[11], 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_5(uint4 buffer[11], 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;
|
||||
const uint scalar_offset_6 = ((offset + 12u)) / 4;
|
||||
const uint scalar_offset_7 = ((offset + 16u)) / 4;
|
||||
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_9 = {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_9;
|
||||
}
|
||||
|
||||
float3x3 tint_symbol_7(uint4 buffer[11], 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));
|
||||
}
|
||||
|
||||
ExternalTextureParams tint_symbol_1(uint4 buffer[11], uint offset) {
|
||||
const uint scalar_offset_14 = ((offset + 0u)) / 4;
|
||||
const uint scalar_offset_15 = ((offset + 4u)) / 4;
|
||||
const ExternalTextureParams tint_symbol_10 = {buffer[scalar_offset_14 / 4][scalar_offset_14 % 4], buffer[scalar_offset_15 / 4][scalar_offset_15 % 4], tint_symbol_3(buffer, (offset + 16u)), tint_symbol_5(buffer, (offset + 64u)), tint_symbol_5(buffer, (offset + 96u)), tint_symbol_7(buffer, (offset + 128u))};
|
||||
return tint_symbol_10;
|
||||
}
|
||||
|
||||
void textureSampleLevel_979816() {
|
||||
float4 res = textureSampleExternal(arg_0, ext_tex_plane_1, arg_1, (1.0f).xx, tint_symbol_1(ext_tex_params, 0u));
|
||||
}
|
||||
|
||||
struct tint_symbol {
|
||||
float4 value : SV_Position;
|
||||
};
|
||||
|
||||
float4 vertex_main_inner() {
|
||||
textureSampleLevel_979816();
|
||||
return (0.0f).xxxx;
|
||||
}
|
||||
|
||||
tint_symbol vertex_main() {
|
||||
const float4 inner_result = vertex_main_inner();
|
||||
tint_symbol wrapper_result = (tint_symbol)0;
|
||||
wrapper_result.value = inner_result;
|
||||
return wrapper_result;
|
||||
}
|
||||
|
||||
void fragment_main() {
|
||||
textureSampleLevel_979816();
|
||||
return;
|
||||
}
|
||||
|
||||
[numthreads(1, 1, 1)]
|
||||
void compute_main() {
|
||||
textureSampleLevel_979816();
|
||||
return;
|
||||
}
|
|
@ -1,200 +0,0 @@
|
|||
builtins/gen/literal/textureSampleLevel/979816.wgsl:28:24 warning: use of deprecated builtin
|
||||
var res: vec4<f32> = textureSampleLevel(arg_0, arg_1, vec2<f32>(1.f));
|
||||
^^^^^^^^^^^^^^^^^^
|
||||
|
||||
#version 310 es
|
||||
|
||||
struct GammaTransferParams {
|
||||
float G;
|
||||
float A;
|
||||
float B;
|
||||
float C;
|
||||
float D;
|
||||
float E;
|
||||
float F;
|
||||
uint padding;
|
||||
};
|
||||
|
||||
struct ExternalTextureParams {
|
||||
uint numPlanes;
|
||||
uint doYuvToRgbConversionOnly;
|
||||
mat3x4 yuvToRgbConversionMatrix;
|
||||
GammaTransferParams gammaDecodeParams;
|
||||
GammaTransferParams gammaEncodeParams;
|
||||
mat3 gamutConversionMatrix;
|
||||
};
|
||||
|
||||
layout(binding = 3, std140) uniform ext_tex_params_block_ubo {
|
||||
ExternalTextureParams inner;
|
||||
} ext_tex_params;
|
||||
|
||||
vec3 gammaCorrection(vec3 v, GammaTransferParams params) {
|
||||
bvec3 cond = lessThan(abs(v), vec3(params.D));
|
||||
vec3 t = (sign(v) * ((params.C * abs(v)) + params.F));
|
||||
vec3 f = (sign(v) * (pow(((params.A * abs(v)) + params.B), vec3(params.G)) + params.E));
|
||||
return mix(f, t, cond);
|
||||
}
|
||||
|
||||
|
||||
vec4 textureSampleExternal(highp sampler2D plane0_smp, highp sampler2D plane1_smp, vec2 coord, ExternalTextureParams params) {
|
||||
vec3 color = vec3(0.0f, 0.0f, 0.0f);
|
||||
if ((params.numPlanes == 1u)) {
|
||||
color = textureLod(plane0_smp, coord, 0.0f).rgb;
|
||||
} else {
|
||||
color = (vec4(textureLod(plane0_smp, coord, 0.0f).r, textureLod(plane1_smp, coord, 0.0f).rg, 1.0f) * params.yuvToRgbConversionMatrix);
|
||||
}
|
||||
if ((params.doYuvToRgbConversionOnly == 0u)) {
|
||||
color = gammaCorrection(color, params.gammaDecodeParams);
|
||||
color = (params.gamutConversionMatrix * color);
|
||||
color = gammaCorrection(color, params.gammaEncodeParams);
|
||||
}
|
||||
return vec4(color, 1.0f);
|
||||
}
|
||||
|
||||
uniform highp sampler2D arg_0_arg_1;
|
||||
uniform highp sampler2D ext_tex_plane_1_arg_1;
|
||||
void textureSampleLevel_979816() {
|
||||
vec4 res = textureSampleExternal(arg_0_arg_1, ext_tex_plane_1_arg_1, vec2(1.0f), ext_tex_params.inner);
|
||||
}
|
||||
|
||||
vec4 vertex_main() {
|
||||
textureSampleLevel_979816();
|
||||
return vec4(0.0f);
|
||||
}
|
||||
|
||||
void main() {
|
||||
gl_PointSize = 1.0;
|
||||
vec4 inner_result = vertex_main();
|
||||
gl_Position = inner_result;
|
||||
gl_Position.y = -(gl_Position.y);
|
||||
gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
|
||||
return;
|
||||
}
|
||||
#version 310 es
|
||||
precision mediump float;
|
||||
|
||||
struct GammaTransferParams {
|
||||
float G;
|
||||
float A;
|
||||
float B;
|
||||
float C;
|
||||
float D;
|
||||
float E;
|
||||
float F;
|
||||
uint padding;
|
||||
};
|
||||
|
||||
struct ExternalTextureParams {
|
||||
uint numPlanes;
|
||||
uint doYuvToRgbConversionOnly;
|
||||
mat3x4 yuvToRgbConversionMatrix;
|
||||
GammaTransferParams gammaDecodeParams;
|
||||
GammaTransferParams gammaEncodeParams;
|
||||
mat3 gamutConversionMatrix;
|
||||
};
|
||||
|
||||
layout(binding = 3, std140) uniform ext_tex_params_block_ubo {
|
||||
ExternalTextureParams inner;
|
||||
} ext_tex_params;
|
||||
|
||||
vec3 gammaCorrection(vec3 v, GammaTransferParams params) {
|
||||
bvec3 cond = lessThan(abs(v), vec3(params.D));
|
||||
vec3 t = (sign(v) * ((params.C * abs(v)) + params.F));
|
||||
vec3 f = (sign(v) * (pow(((params.A * abs(v)) + params.B), vec3(params.G)) + params.E));
|
||||
return mix(f, t, cond);
|
||||
}
|
||||
|
||||
|
||||
vec4 textureSampleExternal(highp sampler2D plane0_smp, highp sampler2D plane1_smp, vec2 coord, ExternalTextureParams params) {
|
||||
vec3 color = vec3(0.0f, 0.0f, 0.0f);
|
||||
if ((params.numPlanes == 1u)) {
|
||||
color = textureLod(plane0_smp, coord, 0.0f).rgb;
|
||||
} else {
|
||||
color = (vec4(textureLod(plane0_smp, coord, 0.0f).r, textureLod(plane1_smp, coord, 0.0f).rg, 1.0f) * params.yuvToRgbConversionMatrix);
|
||||
}
|
||||
if ((params.doYuvToRgbConversionOnly == 0u)) {
|
||||
color = gammaCorrection(color, params.gammaDecodeParams);
|
||||
color = (params.gamutConversionMatrix * color);
|
||||
color = gammaCorrection(color, params.gammaEncodeParams);
|
||||
}
|
||||
return vec4(color, 1.0f);
|
||||
}
|
||||
|
||||
uniform highp sampler2D arg_0_arg_1;
|
||||
uniform highp sampler2D ext_tex_plane_1_arg_1;
|
||||
void textureSampleLevel_979816() {
|
||||
vec4 res = textureSampleExternal(arg_0_arg_1, ext_tex_plane_1_arg_1, vec2(1.0f), ext_tex_params.inner);
|
||||
}
|
||||
|
||||
void fragment_main() {
|
||||
textureSampleLevel_979816();
|
||||
}
|
||||
|
||||
void main() {
|
||||
fragment_main();
|
||||
return;
|
||||
}
|
||||
#version 310 es
|
||||
|
||||
struct GammaTransferParams {
|
||||
float G;
|
||||
float A;
|
||||
float B;
|
||||
float C;
|
||||
float D;
|
||||
float E;
|
||||
float F;
|
||||
uint padding;
|
||||
};
|
||||
|
||||
struct ExternalTextureParams {
|
||||
uint numPlanes;
|
||||
uint doYuvToRgbConversionOnly;
|
||||
mat3x4 yuvToRgbConversionMatrix;
|
||||
GammaTransferParams gammaDecodeParams;
|
||||
GammaTransferParams gammaEncodeParams;
|
||||
mat3 gamutConversionMatrix;
|
||||
};
|
||||
|
||||
layout(binding = 3, std140) uniform ext_tex_params_block_ubo {
|
||||
ExternalTextureParams inner;
|
||||
} ext_tex_params;
|
||||
|
||||
vec3 gammaCorrection(vec3 v, GammaTransferParams params) {
|
||||
bvec3 cond = lessThan(abs(v), vec3(params.D));
|
||||
vec3 t = (sign(v) * ((params.C * abs(v)) + params.F));
|
||||
vec3 f = (sign(v) * (pow(((params.A * abs(v)) + params.B), vec3(params.G)) + params.E));
|
||||
return mix(f, t, cond);
|
||||
}
|
||||
|
||||
|
||||
vec4 textureSampleExternal(highp sampler2D plane0_smp, highp sampler2D plane1_smp, vec2 coord, ExternalTextureParams params) {
|
||||
vec3 color = vec3(0.0f, 0.0f, 0.0f);
|
||||
if ((params.numPlanes == 1u)) {
|
||||
color = textureLod(plane0_smp, coord, 0.0f).rgb;
|
||||
} else {
|
||||
color = (vec4(textureLod(plane0_smp, coord, 0.0f).r, textureLod(plane1_smp, coord, 0.0f).rg, 1.0f) * params.yuvToRgbConversionMatrix);
|
||||
}
|
||||
if ((params.doYuvToRgbConversionOnly == 0u)) {
|
||||
color = gammaCorrection(color, params.gammaDecodeParams);
|
||||
color = (params.gamutConversionMatrix * color);
|
||||
color = gammaCorrection(color, params.gammaEncodeParams);
|
||||
}
|
||||
return vec4(color, 1.0f);
|
||||
}
|
||||
|
||||
uniform highp sampler2D arg_0_arg_1;
|
||||
uniform highp sampler2D ext_tex_plane_1_arg_1;
|
||||
void textureSampleLevel_979816() {
|
||||
vec4 res = textureSampleExternal(arg_0_arg_1, ext_tex_plane_1_arg_1, vec2(1.0f), ext_tex_params.inner);
|
||||
}
|
||||
|
||||
void compute_main() {
|
||||
textureSampleLevel_979816();
|
||||
}
|
||||
|
||||
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
|
||||
void main() {
|
||||
compute_main();
|
||||
return;
|
||||
}
|
|
@ -1,93 +0,0 @@
|
|||
builtins/gen/literal/textureSampleLevel/979816.wgsl:28:24 warning: use of deprecated builtin
|
||||
var res: vec4<f32> = textureSampleLevel(arg_0, arg_1, vec2<f32>(1.f));
|
||||
^^^^^^^^^^^^^^^^^^
|
||||
|
||||
#include <metal_stdlib>
|
||||
|
||||
using namespace metal;
|
||||
|
||||
template<typename T, size_t N>
|
||||
struct tint_array {
|
||||
const constant T& operator[](size_t i) const constant { return elements[i]; }
|
||||
device T& operator[](size_t i) device { return elements[i]; }
|
||||
const device T& operator[](size_t i) const device { return elements[i]; }
|
||||
thread T& operator[](size_t i) thread { return elements[i]; }
|
||||
const thread T& operator[](size_t i) const thread { return elements[i]; }
|
||||
threadgroup T& operator[](size_t i) threadgroup { return elements[i]; }
|
||||
const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; }
|
||||
T elements[N];
|
||||
};
|
||||
|
||||
struct GammaTransferParams {
|
||||
/* 0x0000 */ float G;
|
||||
/* 0x0004 */ float A;
|
||||
/* 0x0008 */ float B;
|
||||
/* 0x000c */ float C;
|
||||
/* 0x0010 */ float D;
|
||||
/* 0x0014 */ float E;
|
||||
/* 0x0018 */ float F;
|
||||
/* 0x001c */ uint padding;
|
||||
};
|
||||
|
||||
struct ExternalTextureParams {
|
||||
/* 0x0000 */ uint numPlanes;
|
||||
/* 0x0004 */ uint doYuvToRgbConversionOnly;
|
||||
/* 0x0008 */ tint_array<int8_t, 8> tint_pad;
|
||||
/* 0x0010 */ float3x4 yuvToRgbConversionMatrix;
|
||||
/* 0x0040 */ GammaTransferParams gammaDecodeParams;
|
||||
/* 0x0060 */ GammaTransferParams gammaEncodeParams;
|
||||
/* 0x0080 */ float3x3 gamutConversionMatrix;
|
||||
};
|
||||
|
||||
float3 gammaCorrection(float3 v, GammaTransferParams params) {
|
||||
bool3 const cond = (fabs(v) < float3(params.D));
|
||||
float3 const t = (sign(v) * ((params.C * fabs(v)) + params.F));
|
||||
float3 const f = (sign(v) * (pow(((params.A * fabs(v)) + params.B), float3(params.G)) + params.E));
|
||||
return select(f, t, cond);
|
||||
}
|
||||
|
||||
float4 textureSampleExternal(texture2d<float, access::sample> plane0, texture2d<float, access::sample> plane1, sampler smp, float2 coord, ExternalTextureParams params) {
|
||||
float3 color = 0.0f;
|
||||
if ((params.numPlanes == 1u)) {
|
||||
color = float4(plane0.sample(smp, coord, level(0.0f))).rgb;
|
||||
} else {
|
||||
color = (float4(plane0.sample(smp, coord, level(0.0f))[0], float4(plane1.sample(smp, coord, level(0.0f))).rg, 1.0f) * params.yuvToRgbConversionMatrix);
|
||||
}
|
||||
if ((params.doYuvToRgbConversionOnly == 0u)) {
|
||||
color = gammaCorrection(color, params.gammaDecodeParams);
|
||||
color = (params.gamutConversionMatrix * color);
|
||||
color = gammaCorrection(color, params.gammaEncodeParams);
|
||||
}
|
||||
return float4(color, 1.0f);
|
||||
}
|
||||
|
||||
void textureSampleLevel_979816(texture2d<float, access::sample> tint_symbol_1, texture2d<float, access::sample> tint_symbol_2, sampler tint_symbol_3, const constant ExternalTextureParams* const tint_symbol_4) {
|
||||
float4 res = textureSampleExternal(tint_symbol_1, tint_symbol_2, tint_symbol_3, float2(1.0f), *(tint_symbol_4));
|
||||
}
|
||||
|
||||
struct tint_symbol {
|
||||
float4 value [[position]];
|
||||
};
|
||||
|
||||
float4 vertex_main_inner(texture2d<float, access::sample> tint_symbol_5, texture2d<float, access::sample> tint_symbol_6, sampler tint_symbol_7, const constant ExternalTextureParams* const tint_symbol_8) {
|
||||
textureSampleLevel_979816(tint_symbol_5, tint_symbol_6, tint_symbol_7, tint_symbol_8);
|
||||
return float4(0.0f);
|
||||
}
|
||||
|
||||
vertex tint_symbol vertex_main(texture2d<float, access::sample> tint_symbol_9 [[texture(0)]], texture2d<float, access::sample> tint_symbol_10 [[texture(1)]], sampler tint_symbol_11 [[sampler(0)]], const constant ExternalTextureParams* tint_symbol_12 [[buffer(2)]]) {
|
||||
float4 const inner_result = vertex_main_inner(tint_symbol_9, tint_symbol_10, tint_symbol_11, tint_symbol_12);
|
||||
tint_symbol wrapper_result = {};
|
||||
wrapper_result.value = inner_result;
|
||||
return wrapper_result;
|
||||
}
|
||||
|
||||
fragment void fragment_main(texture2d<float, access::sample> tint_symbol_13 [[texture(0)]], texture2d<float, access::sample> tint_symbol_14 [[texture(1)]], sampler tint_symbol_15 [[sampler(0)]], const constant ExternalTextureParams* tint_symbol_16 [[buffer(2)]]) {
|
||||
textureSampleLevel_979816(tint_symbol_13, tint_symbol_14, tint_symbol_15, tint_symbol_16);
|
||||
return;
|
||||
}
|
||||
|
||||
kernel void compute_main(texture2d<float, access::sample> tint_symbol_17 [[texture(0)]], texture2d<float, access::sample> tint_symbol_18 [[texture(1)]], sampler tint_symbol_19 [[sampler(0)]], const constant ExternalTextureParams* tint_symbol_20 [[buffer(2)]]) {
|
||||
textureSampleLevel_979816(tint_symbol_17, tint_symbol_18, tint_symbol_19, tint_symbol_20);
|
||||
return;
|
||||
}
|
||||
|
|
@ -1,259 +0,0 @@
|
|||
builtins/gen/literal/textureSampleLevel/979816.wgsl:28:24 warning: use of deprecated builtin
|
||||
var res: vec4<f32> = textureSampleLevel(arg_0, arg_1, vec2<f32>(1.f));
|
||||
^^^^^^^^^^^^^^^^^^
|
||||
|
||||
; SPIR-V
|
||||
; Version: 1.3
|
||||
; Generator: Google Tint Compiler; 0
|
||||
; Bound: 144
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
%31 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
|
||||
OpEntryPoint Fragment %fragment_main "fragment_main"
|
||||
OpEntryPoint GLCompute %compute_main "compute_main"
|
||||
OpExecutionMode %fragment_main OriginUpperLeft
|
||||
OpExecutionMode %compute_main LocalSize 1 1 1
|
||||
OpName %value "value"
|
||||
OpName %vertex_point_size "vertex_point_size"
|
||||
OpName %ext_tex_plane_1 "ext_tex_plane_1"
|
||||
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"
|
||||
OpMemberName %GammaTransferParams 2 "B"
|
||||
OpMemberName %GammaTransferParams 3 "C"
|
||||
OpMemberName %GammaTransferParams 4 "D"
|
||||
OpMemberName %GammaTransferParams 5 "E"
|
||||
OpMemberName %GammaTransferParams 6 "F"
|
||||
OpMemberName %GammaTransferParams 7 "padding"
|
||||
OpMemberName %ExternalTextureParams 4 "gammaEncodeParams"
|
||||
OpMemberName %ExternalTextureParams 5 "gamutConversionMatrix"
|
||||
OpName %ext_tex_params "ext_tex_params"
|
||||
OpName %arg_0 "arg_0"
|
||||
OpName %arg_1 "arg_1"
|
||||
OpName %gammaCorrection "gammaCorrection"
|
||||
OpName %v "v"
|
||||
OpName %params "params"
|
||||
OpName %textureSampleExternal "textureSampleExternal"
|
||||
OpName %plane0 "plane0"
|
||||
OpName %plane1 "plane1"
|
||||
OpName %smp "smp"
|
||||
OpName %coord "coord"
|
||||
OpName %params_0 "params"
|
||||
OpName %color "color"
|
||||
OpName %textureSampleLevel_979816 "textureSampleLevel_979816"
|
||||
OpName %res "res"
|
||||
OpName %vertex_main_inner "vertex_main_inner"
|
||||
OpName %vertex_main "vertex_main"
|
||||
OpName %fragment_main "fragment_main"
|
||||
OpName %compute_main "compute_main"
|
||||
OpDecorate %value BuiltIn Position
|
||||
OpDecorate %vertex_point_size BuiltIn PointSize
|
||||
OpDecorate %ext_tex_plane_1 DescriptorSet 1
|
||||
OpDecorate %ext_tex_plane_1 Binding 2
|
||||
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
|
||||
OpMemberDecorate %GammaTransferParams 3 Offset 12
|
||||
OpMemberDecorate %GammaTransferParams 4 Offset 16
|
||||
OpMemberDecorate %GammaTransferParams 5 Offset 20
|
||||
OpMemberDecorate %GammaTransferParams 6 Offset 24
|
||||
OpMemberDecorate %GammaTransferParams 7 Offset 28
|
||||
OpMemberDecorate %ExternalTextureParams 4 Offset 96
|
||||
OpMemberDecorate %ExternalTextureParams 5 Offset 128
|
||||
OpMemberDecorate %ExternalTextureParams 5 ColMajor
|
||||
OpMemberDecorate %ExternalTextureParams 5 MatrixStride 16
|
||||
OpDecorate %ext_tex_params NonWritable
|
||||
OpDecorate %ext_tex_params DescriptorSet 1
|
||||
OpDecorate %ext_tex_params Binding 3
|
||||
OpDecorate %arg_0 DescriptorSet 1
|
||||
OpDecorate %arg_0 Binding 0
|
||||
OpDecorate %arg_1 DescriptorSet 1
|
||||
OpDecorate %arg_1 Binding 1
|
||||
%float = OpTypeFloat 32
|
||||
%v4float = OpTypeVector %float 4
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%5 = OpConstantNull %v4float
|
||||
%value = OpVariable %_ptr_Output_v4float Output %5
|
||||
%_ptr_Output_float = OpTypePointer Output %float
|
||||
%8 = OpConstantNull %float
|
||||
%vertex_point_size = OpVariable %_ptr_Output_float Output %8
|
||||
%11 = OpTypeImage %float 2D 0 0 0 1 Unknown
|
||||
%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
|
||||
%ext_tex_plane_1 = OpVariable %_ptr_UniformConstant_11 UniformConstant
|
||||
%uint = OpTypeInt 32 0
|
||||
%mat3v4float = OpTypeMatrix %v4float 3
|
||||
%GammaTransferParams = OpTypeStruct %float %float %float %float %float %float %float %uint
|
||||
%v3float = OpTypeVector %float 3
|
||||
%mat3v3float = OpTypeMatrix %v3float 3
|
||||
%ExternalTextureParams = OpTypeStruct %uint %uint %mat3v4float %GammaTransferParams %GammaTransferParams %mat3v3float
|
||||
%ext_tex_params_block = OpTypeStruct %ExternalTextureParams
|
||||
%_ptr_Uniform_ext_tex_params_block = OpTypePointer Uniform %ext_tex_params_block
|
||||
%ext_tex_params = OpVariable %_ptr_Uniform_ext_tex_params_block Uniform
|
||||
%arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
|
||||
%24 = OpTypeSampler
|
||||
%_ptr_UniformConstant_24 = OpTypePointer UniformConstant %24
|
||||
%arg_1 = OpVariable %_ptr_UniformConstant_24 UniformConstant
|
||||
%25 = OpTypeFunction %v3float %v3float %GammaTransferParams
|
||||
%bool = OpTypeBool
|
||||
%v3bool = OpTypeVector %bool 3
|
||||
%_ptr_Function_v3float = OpTypePointer Function %v3float
|
||||
%45 = OpConstantNull %v3float
|
||||
%v2float = OpTypeVector %float 2
|
||||
%65 = OpTypeFunction %v4float %11 %11 %24 %v2float %ExternalTextureParams
|
||||
%uint_1 = OpConstant %uint 1
|
||||
%82 = OpTypeSampledImage %11
|
||||
%float_1 = OpConstant %float 1
|
||||
%98 = OpConstantNull %uint
|
||||
%void = OpTypeVoid
|
||||
%116 = OpTypeFunction %void
|
||||
%124 = OpConstantComposite %v2float %float_1 %float_1
|
||||
%uint_0 = OpConstant %uint 0
|
||||
%_ptr_Uniform_ExternalTextureParams = OpTypePointer Uniform %ExternalTextureParams
|
||||
%_ptr_Function_v4float = OpTypePointer Function %v4float
|
||||
%131 = OpTypeFunction %v4float
|
||||
%gammaCorrection = OpFunction %v3float None %25
|
||||
%v = OpFunctionParameter %v3float
|
||||
%params = OpFunctionParameter %GammaTransferParams
|
||||
%29 = OpLabel
|
||||
%43 = OpVariable %_ptr_Function_v3float Function %45
|
||||
%55 = OpVariable %_ptr_Function_v3float Function %45
|
||||
%61 = OpVariable %_ptr_Function_v3float Function %45
|
||||
%30 = OpExtInst %v3float %31 FAbs %v
|
||||
%32 = OpCompositeExtract %float %params 4
|
||||
%33 = OpCompositeConstruct %v3float %32 %32 %32
|
||||
%34 = OpFOrdLessThan %v3bool %30 %33
|
||||
%37 = OpExtInst %v3float %31 FSign %v
|
||||
%38 = OpCompositeExtract %float %params 3
|
||||
%39 = OpExtInst %v3float %31 FAbs %v
|
||||
%40 = OpVectorTimesScalar %v3float %39 %38
|
||||
%41 = OpCompositeExtract %float %params 6
|
||||
%46 = OpCompositeConstruct %v3float %41 %41 %41
|
||||
%42 = OpFAdd %v3float %40 %46
|
||||
%47 = OpFMul %v3float %37 %42
|
||||
%48 = OpExtInst %v3float %31 FSign %v
|
||||
%50 = OpCompositeExtract %float %params 1
|
||||
%51 = OpExtInst %v3float %31 FAbs %v
|
||||
%52 = OpVectorTimesScalar %v3float %51 %50
|
||||
%53 = OpCompositeExtract %float %params 2
|
||||
%56 = OpCompositeConstruct %v3float %53 %53 %53
|
||||
%54 = OpFAdd %v3float %52 %56
|
||||
%57 = OpCompositeExtract %float %params 0
|
||||
%58 = OpCompositeConstruct %v3float %57 %57 %57
|
||||
%49 = OpExtInst %v3float %31 Pow %54 %58
|
||||
%59 = OpCompositeExtract %float %params 5
|
||||
%62 = OpCompositeConstruct %v3float %59 %59 %59
|
||||
%60 = OpFAdd %v3float %49 %62
|
||||
%63 = OpFMul %v3float %48 %60
|
||||
%64 = OpSelect %v3float %34 %47 %63
|
||||
OpReturnValue %64
|
||||
OpFunctionEnd
|
||||
%textureSampleExternal = OpFunction %v4float None %65
|
||||
%plane0 = OpFunctionParameter %11
|
||||
%plane1 = OpFunctionParameter %11
|
||||
%smp = OpFunctionParameter %24
|
||||
%coord = OpFunctionParameter %v2float
|
||||
%params_0 = OpFunctionParameter %ExternalTextureParams
|
||||
%73 = OpLabel
|
||||
%color = OpVariable %_ptr_Function_v3float Function %45
|
||||
%75 = OpCompositeExtract %uint %params_0 0
|
||||
%77 = OpIEqual %bool %75 %uint_1
|
||||
OpSelectionMerge %78 None
|
||||
OpBranchConditional %77 %79 %80
|
||||
%79 = OpLabel
|
||||
%83 = OpSampledImage %82 %plane0 %smp
|
||||
%81 = OpImageSampleExplicitLod %v4float %83 %coord Lod %8
|
||||
%84 = OpVectorShuffle %v3float %81 %81 0 1 2
|
||||
OpStore %color %84
|
||||
OpBranch %78
|
||||
%80 = OpLabel
|
||||
%86 = OpSampledImage %82 %plane0 %smp
|
||||
%85 = OpImageSampleExplicitLod %v4float %86 %coord Lod %8
|
||||
%87 = OpCompositeExtract %float %85 0
|
||||
%89 = OpSampledImage %82 %plane1 %smp
|
||||
%88 = OpImageSampleExplicitLod %v4float %89 %coord Lod %8
|
||||
%90 = OpVectorShuffle %v2float %88 %88 0 1
|
||||
%91 = OpCompositeExtract %float %90 0
|
||||
%92 = OpCompositeExtract %float %90 1
|
||||
%94 = OpCompositeConstruct %v4float %87 %91 %92 %float_1
|
||||
%95 = OpCompositeExtract %mat3v4float %params_0 2
|
||||
%96 = OpVectorTimesMatrix %v3float %94 %95
|
||||
OpStore %color %96
|
||||
OpBranch %78
|
||||
%78 = OpLabel
|
||||
%97 = OpCompositeExtract %uint %params_0 1
|
||||
%99 = OpIEqual %bool %97 %98
|
||||
OpSelectionMerge %100 None
|
||||
OpBranchConditional %99 %101 %100
|
||||
%101 = OpLabel
|
||||
%103 = OpLoad %v3float %color
|
||||
%104 = OpCompositeExtract %GammaTransferParams %params_0 3
|
||||
%102 = OpFunctionCall %v3float %gammaCorrection %103 %104
|
||||
OpStore %color %102
|
||||
%105 = OpCompositeExtract %mat3v3float %params_0 5
|
||||
%106 = OpLoad %v3float %color
|
||||
%107 = OpMatrixTimesVector %v3float %105 %106
|
||||
OpStore %color %107
|
||||
%109 = OpLoad %v3float %color
|
||||
%110 = OpCompositeExtract %GammaTransferParams %params_0 4
|
||||
%108 = OpFunctionCall %v3float %gammaCorrection %109 %110
|
||||
OpStore %color %108
|
||||
OpBranch %100
|
||||
%100 = OpLabel
|
||||
%111 = OpLoad %v3float %color
|
||||
%112 = OpCompositeExtract %float %111 0
|
||||
%113 = OpCompositeExtract %float %111 1
|
||||
%114 = OpCompositeExtract %float %111 2
|
||||
%115 = OpCompositeConstruct %v4float %112 %113 %114 %float_1
|
||||
OpReturnValue %115
|
||||
OpFunctionEnd
|
||||
%textureSampleLevel_979816 = OpFunction %void None %116
|
||||
%119 = OpLabel
|
||||
%res = OpVariable %_ptr_Function_v4float Function %5
|
||||
%121 = OpLoad %11 %arg_0
|
||||
%122 = OpLoad %11 %ext_tex_plane_1
|
||||
%123 = OpLoad %24 %arg_1
|
||||
%127 = OpAccessChain %_ptr_Uniform_ExternalTextureParams %ext_tex_params %uint_0
|
||||
%128 = OpLoad %ExternalTextureParams %127
|
||||
%120 = OpFunctionCall %v4float %textureSampleExternal %121 %122 %123 %124 %128
|
||||
OpStore %res %120
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%vertex_main_inner = OpFunction %v4float None %131
|
||||
%133 = OpLabel
|
||||
%134 = OpFunctionCall %void %textureSampleLevel_979816
|
||||
OpReturnValue %5
|
||||
OpFunctionEnd
|
||||
%vertex_main = OpFunction %void None %116
|
||||
%136 = OpLabel
|
||||
%137 = OpFunctionCall %v4float %vertex_main_inner
|
||||
OpStore %value %137
|
||||
OpStore %vertex_point_size %float_1
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%fragment_main = OpFunction %void None %116
|
||||
%139 = OpLabel
|
||||
%140 = OpFunctionCall %void %textureSampleLevel_979816
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%compute_main = OpFunction %void None %116
|
||||
%142 = OpLabel
|
||||
%143 = OpFunctionCall %void %textureSampleLevel_979816
|
||||
OpReturn
|
||||
OpFunctionEnd
|
|
@ -1,27 +0,0 @@
|
|||
builtins/gen/literal/textureSampleLevel/979816.wgsl:28:24 warning: use of deprecated builtin
|
||||
var res: vec4<f32> = textureSampleLevel(arg_0, arg_1, vec2<f32>(1.f));
|
||||
^^^^^^^^^^^^^^^^^^
|
||||
|
||||
@group(1) @binding(0) var arg_0 : texture_external;
|
||||
|
||||
@group(1) @binding(1) var arg_1 : sampler;
|
||||
|
||||
fn textureSampleLevel_979816() {
|
||||
var res : vec4<f32> = textureSampleLevel(arg_0, arg_1, vec2<f32>(1.0f));
|
||||
}
|
||||
|
||||
@vertex
|
||||
fn vertex_main() -> @builtin(position) vec4<f32> {
|
||||
textureSampleLevel_979816();
|
||||
return vec4<f32>();
|
||||
}
|
||||
|
||||
@fragment
|
||||
fn fragment_main() {
|
||||
textureSampleLevel_979816();
|
||||
}
|
||||
|
||||
@compute @workgroup_size(1)
|
||||
fn compute_main() {
|
||||
textureSampleLevel_979816();
|
||||
}
|
|
@ -1,46 +0,0 @@
|
|||
// Copyright 2021 The Tint Authors.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// File generated by tools/src/cmd/gen
|
||||
// using the template:
|
||||
// test/tint/builtins/gen/gen.wgsl.tmpl
|
||||
//
|
||||
// Do not modify this file directly
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@group(1) @binding(0) var arg_0: texture_external;
|
||||
@group(1) @binding(1) var arg_1: sampler;
|
||||
|
||||
// fn textureSampleLevel(texture: texture_external, sampler: sampler, coords: vec2<f32>) -> vec4<f32>
|
||||
fn textureSampleLevel_979816() {
|
||||
var arg_2 = vec2<f32>(1.f);
|
||||
var res: vec4<f32> = textureSampleLevel(arg_0, arg_1, arg_2);
|
||||
}
|
||||
|
||||
@vertex
|
||||
fn vertex_main() -> @builtin(position) vec4<f32> {
|
||||
textureSampleLevel_979816();
|
||||
return vec4<f32>();
|
||||
}
|
||||
|
||||
@fragment
|
||||
fn fragment_main() {
|
||||
textureSampleLevel_979816();
|
||||
}
|
||||
|
||||
@compute @workgroup_size(1)
|
||||
fn compute_main() {
|
||||
textureSampleLevel_979816();
|
||||
}
|
|
@ -1,117 +0,0 @@
|
|||
builtins/gen/var/textureSampleLevel/979816.wgsl:29:24 warning: use of deprecated builtin
|
||||
var res: vec4<f32> = textureSampleLevel(arg_0, arg_1, arg_2);
|
||||
^^^^^^^^^^^^^^^^^^
|
||||
|
||||
struct GammaTransferParams {
|
||||
float G;
|
||||
float A;
|
||||
float B;
|
||||
float C;
|
||||
float D;
|
||||
float E;
|
||||
float F;
|
||||
uint padding;
|
||||
};
|
||||
struct ExternalTextureParams {
|
||||
uint numPlanes;
|
||||
uint doYuvToRgbConversionOnly;
|
||||
float3x4 yuvToRgbConversionMatrix;
|
||||
GammaTransferParams gammaDecodeParams;
|
||||
GammaTransferParams gammaEncodeParams;
|
||||
float3x3 gamutConversionMatrix;
|
||||
};
|
||||
|
||||
Texture2D<float4> ext_tex_plane_1 : register(t2, space1);
|
||||
cbuffer cbuffer_ext_tex_params : register(b3, space1) {
|
||||
uint4 ext_tex_params[11];
|
||||
};
|
||||
Texture2D<float4> arg_0 : register(t0, space1);
|
||||
SamplerState arg_1 : register(s1, space1);
|
||||
|
||||
float3 gammaCorrection(float3 v, GammaTransferParams params) {
|
||||
const bool3 cond = (abs(v) < float3((params.D).xxx));
|
||||
const float3 t = (sign(v) * ((params.C * abs(v)) + params.F));
|
||||
const float3 f = (sign(v) * (pow(((params.A * abs(v)) + params.B), float3((params.G).xxx)) + params.E));
|
||||
return (cond ? t : f);
|
||||
}
|
||||
|
||||
float4 textureSampleExternal(Texture2D<float4> plane0, Texture2D<float4> plane1, SamplerState smp, float2 coord, ExternalTextureParams params) {
|
||||
float3 color = float3(0.0f, 0.0f, 0.0f);
|
||||
if ((params.numPlanes == 1u)) {
|
||||
color = plane0.SampleLevel(smp, coord, 0.0f).rgb;
|
||||
} else {
|
||||
color = mul(params.yuvToRgbConversionMatrix, float4(plane0.SampleLevel(smp, coord, 0.0f).r, plane1.SampleLevel(smp, coord, 0.0f).rg, 1.0f));
|
||||
}
|
||||
if ((params.doYuvToRgbConversionOnly == 0u)) {
|
||||
color = gammaCorrection(color, params.gammaDecodeParams);
|
||||
color = mul(color, params.gamutConversionMatrix);
|
||||
color = gammaCorrection(color, params.gammaEncodeParams);
|
||||
}
|
||||
return float4(color, 1.0f);
|
||||
}
|
||||
|
||||
float3x4 tint_symbol_3(uint4 buffer[11], 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_5(uint4 buffer[11], 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;
|
||||
const uint scalar_offset_6 = ((offset + 12u)) / 4;
|
||||
const uint scalar_offset_7 = ((offset + 16u)) / 4;
|
||||
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_9 = {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_9;
|
||||
}
|
||||
|
||||
float3x3 tint_symbol_7(uint4 buffer[11], 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));
|
||||
}
|
||||
|
||||
ExternalTextureParams tint_symbol_1(uint4 buffer[11], uint offset) {
|
||||
const uint scalar_offset_14 = ((offset + 0u)) / 4;
|
||||
const uint scalar_offset_15 = ((offset + 4u)) / 4;
|
||||
const ExternalTextureParams tint_symbol_10 = {buffer[scalar_offset_14 / 4][scalar_offset_14 % 4], buffer[scalar_offset_15 / 4][scalar_offset_15 % 4], tint_symbol_3(buffer, (offset + 16u)), tint_symbol_5(buffer, (offset + 64u)), tint_symbol_5(buffer, (offset + 96u)), tint_symbol_7(buffer, (offset + 128u))};
|
||||
return tint_symbol_10;
|
||||
}
|
||||
|
||||
void textureSampleLevel_979816() {
|
||||
float2 arg_2 = (1.0f).xx;
|
||||
float4 res = textureSampleExternal(arg_0, ext_tex_plane_1, arg_1, arg_2, tint_symbol_1(ext_tex_params, 0u));
|
||||
}
|
||||
|
||||
struct tint_symbol {
|
||||
float4 value : SV_Position;
|
||||
};
|
||||
|
||||
float4 vertex_main_inner() {
|
||||
textureSampleLevel_979816();
|
||||
return (0.0f).xxxx;
|
||||
}
|
||||
|
||||
tint_symbol vertex_main() {
|
||||
const float4 inner_result = vertex_main_inner();
|
||||
tint_symbol wrapper_result = (tint_symbol)0;
|
||||
wrapper_result.value = inner_result;
|
||||
return wrapper_result;
|
||||
}
|
||||
|
||||
void fragment_main() {
|
||||
textureSampleLevel_979816();
|
||||
return;
|
||||
}
|
||||
|
||||
[numthreads(1, 1, 1)]
|
||||
void compute_main() {
|
||||
textureSampleLevel_979816();
|
||||
return;
|
||||
}
|
|
@ -1,117 +0,0 @@
|
|||
builtins/gen/var/textureSampleLevel/979816.wgsl:29:24 warning: use of deprecated builtin
|
||||
var res: vec4<f32> = textureSampleLevel(arg_0, arg_1, arg_2);
|
||||
^^^^^^^^^^^^^^^^^^
|
||||
|
||||
struct GammaTransferParams {
|
||||
float G;
|
||||
float A;
|
||||
float B;
|
||||
float C;
|
||||
float D;
|
||||
float E;
|
||||
float F;
|
||||
uint padding;
|
||||
};
|
||||
struct ExternalTextureParams {
|
||||
uint numPlanes;
|
||||
uint doYuvToRgbConversionOnly;
|
||||
float3x4 yuvToRgbConversionMatrix;
|
||||
GammaTransferParams gammaDecodeParams;
|
||||
GammaTransferParams gammaEncodeParams;
|
||||
float3x3 gamutConversionMatrix;
|
||||
};
|
||||
|
||||
Texture2D<float4> ext_tex_plane_1 : register(t2, space1);
|
||||
cbuffer cbuffer_ext_tex_params : register(b3, space1) {
|
||||
uint4 ext_tex_params[11];
|
||||
};
|
||||
Texture2D<float4> arg_0 : register(t0, space1);
|
||||
SamplerState arg_1 : register(s1, space1);
|
||||
|
||||
float3 gammaCorrection(float3 v, GammaTransferParams params) {
|
||||
const bool3 cond = (abs(v) < float3((params.D).xxx));
|
||||
const float3 t = (sign(v) * ((params.C * abs(v)) + params.F));
|
||||
const float3 f = (sign(v) * (pow(((params.A * abs(v)) + params.B), float3((params.G).xxx)) + params.E));
|
||||
return (cond ? t : f);
|
||||
}
|
||||
|
||||
float4 textureSampleExternal(Texture2D<float4> plane0, Texture2D<float4> plane1, SamplerState smp, float2 coord, ExternalTextureParams params) {
|
||||
float3 color = float3(0.0f, 0.0f, 0.0f);
|
||||
if ((params.numPlanes == 1u)) {
|
||||
color = plane0.SampleLevel(smp, coord, 0.0f).rgb;
|
||||
} else {
|
||||
color = mul(params.yuvToRgbConversionMatrix, float4(plane0.SampleLevel(smp, coord, 0.0f).r, plane1.SampleLevel(smp, coord, 0.0f).rg, 1.0f));
|
||||
}
|
||||
if ((params.doYuvToRgbConversionOnly == 0u)) {
|
||||
color = gammaCorrection(color, params.gammaDecodeParams);
|
||||
color = mul(color, params.gamutConversionMatrix);
|
||||
color = gammaCorrection(color, params.gammaEncodeParams);
|
||||
}
|
||||
return float4(color, 1.0f);
|
||||
}
|
||||
|
||||
float3x4 tint_symbol_3(uint4 buffer[11], 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_5(uint4 buffer[11], 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;
|
||||
const uint scalar_offset_6 = ((offset + 12u)) / 4;
|
||||
const uint scalar_offset_7 = ((offset + 16u)) / 4;
|
||||
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_9 = {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_9;
|
||||
}
|
||||
|
||||
float3x3 tint_symbol_7(uint4 buffer[11], 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));
|
||||
}
|
||||
|
||||
ExternalTextureParams tint_symbol_1(uint4 buffer[11], uint offset) {
|
||||
const uint scalar_offset_14 = ((offset + 0u)) / 4;
|
||||
const uint scalar_offset_15 = ((offset + 4u)) / 4;
|
||||
const ExternalTextureParams tint_symbol_10 = {buffer[scalar_offset_14 / 4][scalar_offset_14 % 4], buffer[scalar_offset_15 / 4][scalar_offset_15 % 4], tint_symbol_3(buffer, (offset + 16u)), tint_symbol_5(buffer, (offset + 64u)), tint_symbol_5(buffer, (offset + 96u)), tint_symbol_7(buffer, (offset + 128u))};
|
||||
return tint_symbol_10;
|
||||
}
|
||||
|
||||
void textureSampleLevel_979816() {
|
||||
float2 arg_2 = (1.0f).xx;
|
||||
float4 res = textureSampleExternal(arg_0, ext_tex_plane_1, arg_1, arg_2, tint_symbol_1(ext_tex_params, 0u));
|
||||
}
|
||||
|
||||
struct tint_symbol {
|
||||
float4 value : SV_Position;
|
||||
};
|
||||
|
||||
float4 vertex_main_inner() {
|
||||
textureSampleLevel_979816();
|
||||
return (0.0f).xxxx;
|
||||
}
|
||||
|
||||
tint_symbol vertex_main() {
|
||||
const float4 inner_result = vertex_main_inner();
|
||||
tint_symbol wrapper_result = (tint_symbol)0;
|
||||
wrapper_result.value = inner_result;
|
||||
return wrapper_result;
|
||||
}
|
||||
|
||||
void fragment_main() {
|
||||
textureSampleLevel_979816();
|
||||
return;
|
||||
}
|
||||
|
||||
[numthreads(1, 1, 1)]
|
||||
void compute_main() {
|
||||
textureSampleLevel_979816();
|
||||
return;
|
||||
}
|
|
@ -1,203 +0,0 @@
|
|||
builtins/gen/var/textureSampleLevel/979816.wgsl:29:24 warning: use of deprecated builtin
|
||||
var res: vec4<f32> = textureSampleLevel(arg_0, arg_1, arg_2);
|
||||
^^^^^^^^^^^^^^^^^^
|
||||
|
||||
#version 310 es
|
||||
|
||||
struct GammaTransferParams {
|
||||
float G;
|
||||
float A;
|
||||
float B;
|
||||
float C;
|
||||
float D;
|
||||
float E;
|
||||
float F;
|
||||
uint padding;
|
||||
};
|
||||
|
||||
struct ExternalTextureParams {
|
||||
uint numPlanes;
|
||||
uint doYuvToRgbConversionOnly;
|
||||
mat3x4 yuvToRgbConversionMatrix;
|
||||
GammaTransferParams gammaDecodeParams;
|
||||
GammaTransferParams gammaEncodeParams;
|
||||
mat3 gamutConversionMatrix;
|
||||
};
|
||||
|
||||
layout(binding = 3, std140) uniform ext_tex_params_block_ubo {
|
||||
ExternalTextureParams inner;
|
||||
} ext_tex_params;
|
||||
|
||||
vec3 gammaCorrection(vec3 v, GammaTransferParams params) {
|
||||
bvec3 cond = lessThan(abs(v), vec3(params.D));
|
||||
vec3 t = (sign(v) * ((params.C * abs(v)) + params.F));
|
||||
vec3 f = (sign(v) * (pow(((params.A * abs(v)) + params.B), vec3(params.G)) + params.E));
|
||||
return mix(f, t, cond);
|
||||
}
|
||||
|
||||
|
||||
vec4 textureSampleExternal(highp sampler2D plane0_smp, highp sampler2D plane1_smp, vec2 coord, ExternalTextureParams params) {
|
||||
vec3 color = vec3(0.0f, 0.0f, 0.0f);
|
||||
if ((params.numPlanes == 1u)) {
|
||||
color = textureLod(plane0_smp, coord, 0.0f).rgb;
|
||||
} else {
|
||||
color = (vec4(textureLod(plane0_smp, coord, 0.0f).r, textureLod(plane1_smp, coord, 0.0f).rg, 1.0f) * params.yuvToRgbConversionMatrix);
|
||||
}
|
||||
if ((params.doYuvToRgbConversionOnly == 0u)) {
|
||||
color = gammaCorrection(color, params.gammaDecodeParams);
|
||||
color = (params.gamutConversionMatrix * color);
|
||||
color = gammaCorrection(color, params.gammaEncodeParams);
|
||||
}
|
||||
return vec4(color, 1.0f);
|
||||
}
|
||||
|
||||
uniform highp sampler2D arg_0_arg_1;
|
||||
uniform highp sampler2D ext_tex_plane_1_arg_1;
|
||||
void textureSampleLevel_979816() {
|
||||
vec2 arg_2 = vec2(1.0f);
|
||||
vec4 res = textureSampleExternal(arg_0_arg_1, ext_tex_plane_1_arg_1, arg_2, ext_tex_params.inner);
|
||||
}
|
||||
|
||||
vec4 vertex_main() {
|
||||
textureSampleLevel_979816();
|
||||
return vec4(0.0f);
|
||||
}
|
||||
|
||||
void main() {
|
||||
gl_PointSize = 1.0;
|
||||
vec4 inner_result = vertex_main();
|
||||
gl_Position = inner_result;
|
||||
gl_Position.y = -(gl_Position.y);
|
||||
gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
|
||||
return;
|
||||
}
|
||||
#version 310 es
|
||||
precision mediump float;
|
||||
|
||||
struct GammaTransferParams {
|
||||
float G;
|
||||
float A;
|
||||
float B;
|
||||
float C;
|
||||
float D;
|
||||
float E;
|
||||
float F;
|
||||
uint padding;
|
||||
};
|
||||
|
||||
struct ExternalTextureParams {
|
||||
uint numPlanes;
|
||||
uint doYuvToRgbConversionOnly;
|
||||
mat3x4 yuvToRgbConversionMatrix;
|
||||
GammaTransferParams gammaDecodeParams;
|
||||
GammaTransferParams gammaEncodeParams;
|
||||
mat3 gamutConversionMatrix;
|
||||
};
|
||||
|
||||
layout(binding = 3, std140) uniform ext_tex_params_block_ubo {
|
||||
ExternalTextureParams inner;
|
||||
} ext_tex_params;
|
||||
|
||||
vec3 gammaCorrection(vec3 v, GammaTransferParams params) {
|
||||
bvec3 cond = lessThan(abs(v), vec3(params.D));
|
||||
vec3 t = (sign(v) * ((params.C * abs(v)) + params.F));
|
||||
vec3 f = (sign(v) * (pow(((params.A * abs(v)) + params.B), vec3(params.G)) + params.E));
|
||||
return mix(f, t, cond);
|
||||
}
|
||||
|
||||
|
||||
vec4 textureSampleExternal(highp sampler2D plane0_smp, highp sampler2D plane1_smp, vec2 coord, ExternalTextureParams params) {
|
||||
vec3 color = vec3(0.0f, 0.0f, 0.0f);
|
||||
if ((params.numPlanes == 1u)) {
|
||||
color = textureLod(plane0_smp, coord, 0.0f).rgb;
|
||||
} else {
|
||||
color = (vec4(textureLod(plane0_smp, coord, 0.0f).r, textureLod(plane1_smp, coord, 0.0f).rg, 1.0f) * params.yuvToRgbConversionMatrix);
|
||||
}
|
||||
if ((params.doYuvToRgbConversionOnly == 0u)) {
|
||||
color = gammaCorrection(color, params.gammaDecodeParams);
|
||||
color = (params.gamutConversionMatrix * color);
|
||||
color = gammaCorrection(color, params.gammaEncodeParams);
|
||||
}
|
||||
return vec4(color, 1.0f);
|
||||
}
|
||||
|
||||
uniform highp sampler2D arg_0_arg_1;
|
||||
uniform highp sampler2D ext_tex_plane_1_arg_1;
|
||||
void textureSampleLevel_979816() {
|
||||
vec2 arg_2 = vec2(1.0f);
|
||||
vec4 res = textureSampleExternal(arg_0_arg_1, ext_tex_plane_1_arg_1, arg_2, ext_tex_params.inner);
|
||||
}
|
||||
|
||||
void fragment_main() {
|
||||
textureSampleLevel_979816();
|
||||
}
|
||||
|
||||
void main() {
|
||||
fragment_main();
|
||||
return;
|
||||
}
|
||||
#version 310 es
|
||||
|
||||
struct GammaTransferParams {
|
||||
float G;
|
||||
float A;
|
||||
float B;
|
||||
float C;
|
||||
float D;
|
||||
float E;
|
||||
float F;
|
||||
uint padding;
|
||||
};
|
||||
|
||||
struct ExternalTextureParams {
|
||||
uint numPlanes;
|
||||
uint doYuvToRgbConversionOnly;
|
||||
mat3x4 yuvToRgbConversionMatrix;
|
||||
GammaTransferParams gammaDecodeParams;
|
||||
GammaTransferParams gammaEncodeParams;
|
||||
mat3 gamutConversionMatrix;
|
||||
};
|
||||
|
||||
layout(binding = 3, std140) uniform ext_tex_params_block_ubo {
|
||||
ExternalTextureParams inner;
|
||||
} ext_tex_params;
|
||||
|
||||
vec3 gammaCorrection(vec3 v, GammaTransferParams params) {
|
||||
bvec3 cond = lessThan(abs(v), vec3(params.D));
|
||||
vec3 t = (sign(v) * ((params.C * abs(v)) + params.F));
|
||||
vec3 f = (sign(v) * (pow(((params.A * abs(v)) + params.B), vec3(params.G)) + params.E));
|
||||
return mix(f, t, cond);
|
||||
}
|
||||
|
||||
|
||||
vec4 textureSampleExternal(highp sampler2D plane0_smp, highp sampler2D plane1_smp, vec2 coord, ExternalTextureParams params) {
|
||||
vec3 color = vec3(0.0f, 0.0f, 0.0f);
|
||||
if ((params.numPlanes == 1u)) {
|
||||
color = textureLod(plane0_smp, coord, 0.0f).rgb;
|
||||
} else {
|
||||
color = (vec4(textureLod(plane0_smp, coord, 0.0f).r, textureLod(plane1_smp, coord, 0.0f).rg, 1.0f) * params.yuvToRgbConversionMatrix);
|
||||
}
|
||||
if ((params.doYuvToRgbConversionOnly == 0u)) {
|
||||
color = gammaCorrection(color, params.gammaDecodeParams);
|
||||
color = (params.gamutConversionMatrix * color);
|
||||
color = gammaCorrection(color, params.gammaEncodeParams);
|
||||
}
|
||||
return vec4(color, 1.0f);
|
||||
}
|
||||
|
||||
uniform highp sampler2D arg_0_arg_1;
|
||||
uniform highp sampler2D ext_tex_plane_1_arg_1;
|
||||
void textureSampleLevel_979816() {
|
||||
vec2 arg_2 = vec2(1.0f);
|
||||
vec4 res = textureSampleExternal(arg_0_arg_1, ext_tex_plane_1_arg_1, arg_2, ext_tex_params.inner);
|
||||
}
|
||||
|
||||
void compute_main() {
|
||||
textureSampleLevel_979816();
|
||||
}
|
||||
|
||||
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
|
||||
void main() {
|
||||
compute_main();
|
||||
return;
|
||||
}
|
|
@ -1,94 +0,0 @@
|
|||
builtins/gen/var/textureSampleLevel/979816.wgsl:29:24 warning: use of deprecated builtin
|
||||
var res: vec4<f32> = textureSampleLevel(arg_0, arg_1, arg_2);
|
||||
^^^^^^^^^^^^^^^^^^
|
||||
|
||||
#include <metal_stdlib>
|
||||
|
||||
using namespace metal;
|
||||
|
||||
template<typename T, size_t N>
|
||||
struct tint_array {
|
||||
const constant T& operator[](size_t i) const constant { return elements[i]; }
|
||||
device T& operator[](size_t i) device { return elements[i]; }
|
||||
const device T& operator[](size_t i) const device { return elements[i]; }
|
||||
thread T& operator[](size_t i) thread { return elements[i]; }
|
||||
const thread T& operator[](size_t i) const thread { return elements[i]; }
|
||||
threadgroup T& operator[](size_t i) threadgroup { return elements[i]; }
|
||||
const threadgroup T& operator[](size_t i) const threadgroup { return elements[i]; }
|
||||
T elements[N];
|
||||
};
|
||||
|
||||
struct GammaTransferParams {
|
||||
/* 0x0000 */ float G;
|
||||
/* 0x0004 */ float A;
|
||||
/* 0x0008 */ float B;
|
||||
/* 0x000c */ float C;
|
||||
/* 0x0010 */ float D;
|
||||
/* 0x0014 */ float E;
|
||||
/* 0x0018 */ float F;
|
||||
/* 0x001c */ uint padding;
|
||||
};
|
||||
|
||||
struct ExternalTextureParams {
|
||||
/* 0x0000 */ uint numPlanes;
|
||||
/* 0x0004 */ uint doYuvToRgbConversionOnly;
|
||||
/* 0x0008 */ tint_array<int8_t, 8> tint_pad;
|
||||
/* 0x0010 */ float3x4 yuvToRgbConversionMatrix;
|
||||
/* 0x0040 */ GammaTransferParams gammaDecodeParams;
|
||||
/* 0x0060 */ GammaTransferParams gammaEncodeParams;
|
||||
/* 0x0080 */ float3x3 gamutConversionMatrix;
|
||||
};
|
||||
|
||||
float3 gammaCorrection(float3 v, GammaTransferParams params) {
|
||||
bool3 const cond = (fabs(v) < float3(params.D));
|
||||
float3 const t = (sign(v) * ((params.C * fabs(v)) + params.F));
|
||||
float3 const f = (sign(v) * (pow(((params.A * fabs(v)) + params.B), float3(params.G)) + params.E));
|
||||
return select(f, t, cond);
|
||||
}
|
||||
|
||||
float4 textureSampleExternal(texture2d<float, access::sample> plane0, texture2d<float, access::sample> plane1, sampler smp, float2 coord, ExternalTextureParams params) {
|
||||
float3 color = 0.0f;
|
||||
if ((params.numPlanes == 1u)) {
|
||||
color = float4(plane0.sample(smp, coord, level(0.0f))).rgb;
|
||||
} else {
|
||||
color = (float4(plane0.sample(smp, coord, level(0.0f))[0], float4(plane1.sample(smp, coord, level(0.0f))).rg, 1.0f) * params.yuvToRgbConversionMatrix);
|
||||
}
|
||||
if ((params.doYuvToRgbConversionOnly == 0u)) {
|
||||
color = gammaCorrection(color, params.gammaDecodeParams);
|
||||
color = (params.gamutConversionMatrix * color);
|
||||
color = gammaCorrection(color, params.gammaEncodeParams);
|
||||
}
|
||||
return float4(color, 1.0f);
|
||||
}
|
||||
|
||||
void textureSampleLevel_979816(texture2d<float, access::sample> tint_symbol_1, texture2d<float, access::sample> tint_symbol_2, sampler tint_symbol_3, const constant ExternalTextureParams* const tint_symbol_4) {
|
||||
float2 arg_2 = float2(1.0f);
|
||||
float4 res = textureSampleExternal(tint_symbol_1, tint_symbol_2, tint_symbol_3, arg_2, *(tint_symbol_4));
|
||||
}
|
||||
|
||||
struct tint_symbol {
|
||||
float4 value [[position]];
|
||||
};
|
||||
|
||||
float4 vertex_main_inner(texture2d<float, access::sample> tint_symbol_5, texture2d<float, access::sample> tint_symbol_6, sampler tint_symbol_7, const constant ExternalTextureParams* const tint_symbol_8) {
|
||||
textureSampleLevel_979816(tint_symbol_5, tint_symbol_6, tint_symbol_7, tint_symbol_8);
|
||||
return float4(0.0f);
|
||||
}
|
||||
|
||||
vertex tint_symbol vertex_main(texture2d<float, access::sample> tint_symbol_9 [[texture(0)]], texture2d<float, access::sample> tint_symbol_10 [[texture(1)]], sampler tint_symbol_11 [[sampler(0)]], const constant ExternalTextureParams* tint_symbol_12 [[buffer(2)]]) {
|
||||
float4 const inner_result = vertex_main_inner(tint_symbol_9, tint_symbol_10, tint_symbol_11, tint_symbol_12);
|
||||
tint_symbol wrapper_result = {};
|
||||
wrapper_result.value = inner_result;
|
||||
return wrapper_result;
|
||||
}
|
||||
|
||||
fragment void fragment_main(texture2d<float, access::sample> tint_symbol_13 [[texture(0)]], texture2d<float, access::sample> tint_symbol_14 [[texture(1)]], sampler tint_symbol_15 [[sampler(0)]], const constant ExternalTextureParams* tint_symbol_16 [[buffer(2)]]) {
|
||||
textureSampleLevel_979816(tint_symbol_13, tint_symbol_14, tint_symbol_15, tint_symbol_16);
|
||||
return;
|
||||
}
|
||||
|
||||
kernel void compute_main(texture2d<float, access::sample> tint_symbol_17 [[texture(0)]], texture2d<float, access::sample> tint_symbol_18 [[texture(1)]], sampler tint_symbol_19 [[sampler(0)]], const constant ExternalTextureParams* tint_symbol_20 [[buffer(2)]]) {
|
||||
textureSampleLevel_979816(tint_symbol_17, tint_symbol_18, tint_symbol_19, tint_symbol_20);
|
||||
return;
|
||||
}
|
||||
|
|
@ -1,265 +0,0 @@
|
|||
builtins/gen/var/textureSampleLevel/979816.wgsl:29:24 warning: use of deprecated builtin
|
||||
var res: vec4<f32> = textureSampleLevel(arg_0, arg_1, arg_2);
|
||||
^^^^^^^^^^^^^^^^^^
|
||||
|
||||
; SPIR-V
|
||||
; Version: 1.3
|
||||
; Generator: Google Tint Compiler; 0
|
||||
; Bound: 148
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
%31 = OpExtInstImport "GLSL.std.450"
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
|
||||
OpEntryPoint Fragment %fragment_main "fragment_main"
|
||||
OpEntryPoint GLCompute %compute_main "compute_main"
|
||||
OpExecutionMode %fragment_main OriginUpperLeft
|
||||
OpExecutionMode %compute_main LocalSize 1 1 1
|
||||
OpName %value "value"
|
||||
OpName %vertex_point_size "vertex_point_size"
|
||||
OpName %ext_tex_plane_1 "ext_tex_plane_1"
|
||||
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"
|
||||
OpMemberName %GammaTransferParams 2 "B"
|
||||
OpMemberName %GammaTransferParams 3 "C"
|
||||
OpMemberName %GammaTransferParams 4 "D"
|
||||
OpMemberName %GammaTransferParams 5 "E"
|
||||
OpMemberName %GammaTransferParams 6 "F"
|
||||
OpMemberName %GammaTransferParams 7 "padding"
|
||||
OpMemberName %ExternalTextureParams 4 "gammaEncodeParams"
|
||||
OpMemberName %ExternalTextureParams 5 "gamutConversionMatrix"
|
||||
OpName %ext_tex_params "ext_tex_params"
|
||||
OpName %arg_0 "arg_0"
|
||||
OpName %arg_1 "arg_1"
|
||||
OpName %gammaCorrection "gammaCorrection"
|
||||
OpName %v "v"
|
||||
OpName %params "params"
|
||||
OpName %textureSampleExternal "textureSampleExternal"
|
||||
OpName %plane0 "plane0"
|
||||
OpName %plane1 "plane1"
|
||||
OpName %smp "smp"
|
||||
OpName %coord "coord"
|
||||
OpName %params_0 "params"
|
||||
OpName %color "color"
|
||||
OpName %textureSampleLevel_979816 "textureSampleLevel_979816"
|
||||
OpName %arg_2 "arg_2"
|
||||
OpName %res "res"
|
||||
OpName %vertex_main_inner "vertex_main_inner"
|
||||
OpName %vertex_main "vertex_main"
|
||||
OpName %fragment_main "fragment_main"
|
||||
OpName %compute_main "compute_main"
|
||||
OpDecorate %value BuiltIn Position
|
||||
OpDecorate %vertex_point_size BuiltIn PointSize
|
||||
OpDecorate %ext_tex_plane_1 DescriptorSet 1
|
||||
OpDecorate %ext_tex_plane_1 Binding 2
|
||||
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
|
||||
OpMemberDecorate %GammaTransferParams 3 Offset 12
|
||||
OpMemberDecorate %GammaTransferParams 4 Offset 16
|
||||
OpMemberDecorate %GammaTransferParams 5 Offset 20
|
||||
OpMemberDecorate %GammaTransferParams 6 Offset 24
|
||||
OpMemberDecorate %GammaTransferParams 7 Offset 28
|
||||
OpMemberDecorate %ExternalTextureParams 4 Offset 96
|
||||
OpMemberDecorate %ExternalTextureParams 5 Offset 128
|
||||
OpMemberDecorate %ExternalTextureParams 5 ColMajor
|
||||
OpMemberDecorate %ExternalTextureParams 5 MatrixStride 16
|
||||
OpDecorate %ext_tex_params NonWritable
|
||||
OpDecorate %ext_tex_params DescriptorSet 1
|
||||
OpDecorate %ext_tex_params Binding 3
|
||||
OpDecorate %arg_0 DescriptorSet 1
|
||||
OpDecorate %arg_0 Binding 0
|
||||
OpDecorate %arg_1 DescriptorSet 1
|
||||
OpDecorate %arg_1 Binding 1
|
||||
%float = OpTypeFloat 32
|
||||
%v4float = OpTypeVector %float 4
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%5 = OpConstantNull %v4float
|
||||
%value = OpVariable %_ptr_Output_v4float Output %5
|
||||
%_ptr_Output_float = OpTypePointer Output %float
|
||||
%8 = OpConstantNull %float
|
||||
%vertex_point_size = OpVariable %_ptr_Output_float Output %8
|
||||
%11 = OpTypeImage %float 2D 0 0 0 1 Unknown
|
||||
%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
|
||||
%ext_tex_plane_1 = OpVariable %_ptr_UniformConstant_11 UniformConstant
|
||||
%uint = OpTypeInt 32 0
|
||||
%mat3v4float = OpTypeMatrix %v4float 3
|
||||
%GammaTransferParams = OpTypeStruct %float %float %float %float %float %float %float %uint
|
||||
%v3float = OpTypeVector %float 3
|
||||
%mat3v3float = OpTypeMatrix %v3float 3
|
||||
%ExternalTextureParams = OpTypeStruct %uint %uint %mat3v4float %GammaTransferParams %GammaTransferParams %mat3v3float
|
||||
%ext_tex_params_block = OpTypeStruct %ExternalTextureParams
|
||||
%_ptr_Uniform_ext_tex_params_block = OpTypePointer Uniform %ext_tex_params_block
|
||||
%ext_tex_params = OpVariable %_ptr_Uniform_ext_tex_params_block Uniform
|
||||
%arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
|
||||
%24 = OpTypeSampler
|
||||
%_ptr_UniformConstant_24 = OpTypePointer UniformConstant %24
|
||||
%arg_1 = OpVariable %_ptr_UniformConstant_24 UniformConstant
|
||||
%25 = OpTypeFunction %v3float %v3float %GammaTransferParams
|
||||
%bool = OpTypeBool
|
||||
%v3bool = OpTypeVector %bool 3
|
||||
%_ptr_Function_v3float = OpTypePointer Function %v3float
|
||||
%45 = OpConstantNull %v3float
|
||||
%v2float = OpTypeVector %float 2
|
||||
%65 = OpTypeFunction %v4float %11 %11 %24 %v2float %ExternalTextureParams
|
||||
%uint_1 = OpConstant %uint 1
|
||||
%82 = OpTypeSampledImage %11
|
||||
%float_1 = OpConstant %float 1
|
||||
%98 = OpConstantNull %uint
|
||||
%void = OpTypeVoid
|
||||
%116 = OpTypeFunction %void
|
||||
%120 = OpConstantComposite %v2float %float_1 %float_1
|
||||
%_ptr_Function_v2float = OpTypePointer Function %v2float
|
||||
%123 = OpConstantNull %v2float
|
||||
%uint_0 = OpConstant %uint 0
|
||||
%_ptr_Uniform_ExternalTextureParams = OpTypePointer Uniform %ExternalTextureParams
|
||||
%_ptr_Function_v4float = OpTypePointer Function %v4float
|
||||
%135 = OpTypeFunction %v4float
|
||||
%gammaCorrection = OpFunction %v3float None %25
|
||||
%v = OpFunctionParameter %v3float
|
||||
%params = OpFunctionParameter %GammaTransferParams
|
||||
%29 = OpLabel
|
||||
%43 = OpVariable %_ptr_Function_v3float Function %45
|
||||
%55 = OpVariable %_ptr_Function_v3float Function %45
|
||||
%61 = OpVariable %_ptr_Function_v3float Function %45
|
||||
%30 = OpExtInst %v3float %31 FAbs %v
|
||||
%32 = OpCompositeExtract %float %params 4
|
||||
%33 = OpCompositeConstruct %v3float %32 %32 %32
|
||||
%34 = OpFOrdLessThan %v3bool %30 %33
|
||||
%37 = OpExtInst %v3float %31 FSign %v
|
||||
%38 = OpCompositeExtract %float %params 3
|
||||
%39 = OpExtInst %v3float %31 FAbs %v
|
||||
%40 = OpVectorTimesScalar %v3float %39 %38
|
||||
%41 = OpCompositeExtract %float %params 6
|
||||
%46 = OpCompositeConstruct %v3float %41 %41 %41
|
||||
%42 = OpFAdd %v3float %40 %46
|
||||
%47 = OpFMul %v3float %37 %42
|
||||
%48 = OpExtInst %v3float %31 FSign %v
|
||||
%50 = OpCompositeExtract %float %params 1
|
||||
%51 = OpExtInst %v3float %31 FAbs %v
|
||||
%52 = OpVectorTimesScalar %v3float %51 %50
|
||||
%53 = OpCompositeExtract %float %params 2
|
||||
%56 = OpCompositeConstruct %v3float %53 %53 %53
|
||||
%54 = OpFAdd %v3float %52 %56
|
||||
%57 = OpCompositeExtract %float %params 0
|
||||
%58 = OpCompositeConstruct %v3float %57 %57 %57
|
||||
%49 = OpExtInst %v3float %31 Pow %54 %58
|
||||
%59 = OpCompositeExtract %float %params 5
|
||||
%62 = OpCompositeConstruct %v3float %59 %59 %59
|
||||
%60 = OpFAdd %v3float %49 %62
|
||||
%63 = OpFMul %v3float %48 %60
|
||||
%64 = OpSelect %v3float %34 %47 %63
|
||||
OpReturnValue %64
|
||||
OpFunctionEnd
|
||||
%textureSampleExternal = OpFunction %v4float None %65
|
||||
%plane0 = OpFunctionParameter %11
|
||||
%plane1 = OpFunctionParameter %11
|
||||
%smp = OpFunctionParameter %24
|
||||
%coord = OpFunctionParameter %v2float
|
||||
%params_0 = OpFunctionParameter %ExternalTextureParams
|
||||
%73 = OpLabel
|
||||
%color = OpVariable %_ptr_Function_v3float Function %45
|
||||
%75 = OpCompositeExtract %uint %params_0 0
|
||||
%77 = OpIEqual %bool %75 %uint_1
|
||||
OpSelectionMerge %78 None
|
||||
OpBranchConditional %77 %79 %80
|
||||
%79 = OpLabel
|
||||
%83 = OpSampledImage %82 %plane0 %smp
|
||||
%81 = OpImageSampleExplicitLod %v4float %83 %coord Lod %8
|
||||
%84 = OpVectorShuffle %v3float %81 %81 0 1 2
|
||||
OpStore %color %84
|
||||
OpBranch %78
|
||||
%80 = OpLabel
|
||||
%86 = OpSampledImage %82 %plane0 %smp
|
||||
%85 = OpImageSampleExplicitLod %v4float %86 %coord Lod %8
|
||||
%87 = OpCompositeExtract %float %85 0
|
||||
%89 = OpSampledImage %82 %plane1 %smp
|
||||
%88 = OpImageSampleExplicitLod %v4float %89 %coord Lod %8
|
||||
%90 = OpVectorShuffle %v2float %88 %88 0 1
|
||||
%91 = OpCompositeExtract %float %90 0
|
||||
%92 = OpCompositeExtract %float %90 1
|
||||
%94 = OpCompositeConstruct %v4float %87 %91 %92 %float_1
|
||||
%95 = OpCompositeExtract %mat3v4float %params_0 2
|
||||
%96 = OpVectorTimesMatrix %v3float %94 %95
|
||||
OpStore %color %96
|
||||
OpBranch %78
|
||||
%78 = OpLabel
|
||||
%97 = OpCompositeExtract %uint %params_0 1
|
||||
%99 = OpIEqual %bool %97 %98
|
||||
OpSelectionMerge %100 None
|
||||
OpBranchConditional %99 %101 %100
|
||||
%101 = OpLabel
|
||||
%103 = OpLoad %v3float %color
|
||||
%104 = OpCompositeExtract %GammaTransferParams %params_0 3
|
||||
%102 = OpFunctionCall %v3float %gammaCorrection %103 %104
|
||||
OpStore %color %102
|
||||
%105 = OpCompositeExtract %mat3v3float %params_0 5
|
||||
%106 = OpLoad %v3float %color
|
||||
%107 = OpMatrixTimesVector %v3float %105 %106
|
||||
OpStore %color %107
|
||||
%109 = OpLoad %v3float %color
|
||||
%110 = OpCompositeExtract %GammaTransferParams %params_0 4
|
||||
%108 = OpFunctionCall %v3float %gammaCorrection %109 %110
|
||||
OpStore %color %108
|
||||
OpBranch %100
|
||||
%100 = OpLabel
|
||||
%111 = OpLoad %v3float %color
|
||||
%112 = OpCompositeExtract %float %111 0
|
||||
%113 = OpCompositeExtract %float %111 1
|
||||
%114 = OpCompositeExtract %float %111 2
|
||||
%115 = OpCompositeConstruct %v4float %112 %113 %114 %float_1
|
||||
OpReturnValue %115
|
||||
OpFunctionEnd
|
||||
%textureSampleLevel_979816 = OpFunction %void None %116
|
||||
%119 = OpLabel
|
||||
%arg_2 = OpVariable %_ptr_Function_v2float Function %123
|
||||
%res = OpVariable %_ptr_Function_v4float Function %5
|
||||
OpStore %arg_2 %120
|
||||
%125 = OpLoad %11 %arg_0
|
||||
%126 = OpLoad %11 %ext_tex_plane_1
|
||||
%127 = OpLoad %24 %arg_1
|
||||
%128 = OpLoad %v2float %arg_2
|
||||
%131 = OpAccessChain %_ptr_Uniform_ExternalTextureParams %ext_tex_params %uint_0
|
||||
%132 = OpLoad %ExternalTextureParams %131
|
||||
%124 = OpFunctionCall %v4float %textureSampleExternal %125 %126 %127 %128 %132
|
||||
OpStore %res %124
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%vertex_main_inner = OpFunction %v4float None %135
|
||||
%137 = OpLabel
|
||||
%138 = OpFunctionCall %void %textureSampleLevel_979816
|
||||
OpReturnValue %5
|
||||
OpFunctionEnd
|
||||
%vertex_main = OpFunction %void None %116
|
||||
%140 = OpLabel
|
||||
%141 = OpFunctionCall %v4float %vertex_main_inner
|
||||
OpStore %value %141
|
||||
OpStore %vertex_point_size %float_1
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%fragment_main = OpFunction %void None %116
|
||||
%143 = OpLabel
|
||||
%144 = OpFunctionCall %void %textureSampleLevel_979816
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%compute_main = OpFunction %void None %116
|
||||
%146 = OpLabel
|
||||
%147 = OpFunctionCall %void %textureSampleLevel_979816
|
||||
OpReturn
|
||||
OpFunctionEnd
|
|
@ -1,28 +0,0 @@
|
|||
builtins/gen/var/textureSampleLevel/979816.wgsl:29:24 warning: use of deprecated builtin
|
||||
var res: vec4<f32> = textureSampleLevel(arg_0, arg_1, arg_2);
|
||||
^^^^^^^^^^^^^^^^^^
|
||||
|
||||
@group(1) @binding(0) var arg_0 : texture_external;
|
||||
|
||||
@group(1) @binding(1) var arg_1 : sampler;
|
||||
|
||||
fn textureSampleLevel_979816() {
|
||||
var arg_2 = vec2<f32>(1.0f);
|
||||
var res : vec4<f32> = textureSampleLevel(arg_0, arg_1, arg_2);
|
||||
}
|
||||
|
||||
@vertex
|
||||
fn vertex_main() -> @builtin(position) vec4<f32> {
|
||||
textureSampleLevel_979816();
|
||||
return vec4<f32>();
|
||||
}
|
||||
|
||||
@fragment
|
||||
fn fragment_main() {
|
||||
textureSampleLevel_979816();
|
||||
}
|
||||
|
||||
@compute @workgroup_size(1)
|
||||
fn compute_main() {
|
||||
textureSampleLevel_979816();
|
||||
}
|
Loading…
Reference in New Issue