mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-11 14:41:50 +00:00
Reduce shader complexity for external textures
Do more math on the CPU to avoid per-fragment ALU operations. Use a mat3x2 instead of mat2x3 to avoid padding. Fixed: dawn:1614 Change-Id: Ib0e0f7d44ed9aa16eaca712f6553214fad141feb Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/116060 Kokoro: Kokoro <noreply+kokoro@google.com> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Brandon1 Jones <brandon1.jones@intel.com> Commit-Queue: Ben Clayton <bclayton@google.com>
This commit is contained in:
committed by
Dawn LUCI CQ
parent
b6fb41cc32
commit
be367b73ae
@@ -263,7 +263,7 @@ struct MultiplanarExternalTexture::State {
|
||||
b.Member("gammaDecodeParams", b.ty.type_name("GammaTransferParams")),
|
||||
b.Member("gammaEncodeParams", b.ty.type_name("GammaTransferParams")),
|
||||
b.Member("gamutConversionMatrix", b.ty.mat3x3<f32>()),
|
||||
b.Member("coordTransformationMatrix", b.ty.mat2x3<f32>())};
|
||||
b.Member("coordTransformationMatrix", b.ty.mat3x2<f32>())};
|
||||
|
||||
params_struct_sym = b.Symbols().New("ExternalTextureParams");
|
||||
|
||||
@@ -316,12 +316,9 @@ struct MultiplanarExternalTexture::State {
|
||||
const ast::CallExpression* plane_1_call = nullptr;
|
||||
switch (call_type) {
|
||||
case sem::BuiltinType::kTextureSampleBaseClampToEdge:
|
||||
// TODO(dawn:1614): Change this statement to incorporate the "- 0.5" into the
|
||||
// matrix.
|
||||
stmts.Push(
|
||||
b.Decl(b.Let("modifiedCoords",
|
||||
b.Mul(b.vec3<f32>(b.Sub("coord", f32(0.5)), f32(1.0f)),
|
||||
b.MemberAccessor("params", "coordTransformationMatrix")))));
|
||||
stmts.Push(b.Decl(b.Let(
|
||||
"modifiedCoords", b.Mul(b.MemberAccessor("params", "coordTransformationMatrix"),
|
||||
b.vec3<f32>("coord", 1_a)))));
|
||||
|
||||
stmts.Push(b.Decl(b.Let(
|
||||
"plane0_dims",
|
||||
|
||||
@@ -138,7 +138,7 @@ struct ExternalTextureParams {
|
||||
gammaDecodeParams : GammaTransferParams,
|
||||
gammaEncodeParams : GammaTransferParams,
|
||||
gamutConversionMatrix : mat3x3<f32>,
|
||||
coordTransformationMatrix : mat2x3<f32>,
|
||||
coordTransformationMatrix : mat3x2<f32>,
|
||||
}
|
||||
|
||||
@group(0) @binding(1) var ext_tex_plane_1 : texture_2d<f32>;
|
||||
@@ -194,7 +194,7 @@ struct ExternalTextureParams {
|
||||
gammaDecodeParams : GammaTransferParams,
|
||||
gammaEncodeParams : GammaTransferParams,
|
||||
gamutConversionMatrix : mat3x3<f32>,
|
||||
coordTransformationMatrix : mat2x3<f32>,
|
||||
coordTransformationMatrix : mat3x2<f32>,
|
||||
}
|
||||
|
||||
@group(0) @binding(1) var ext_tex_plane_1 : texture_2d<f32>;
|
||||
@@ -249,7 +249,7 @@ struct ExternalTextureParams {
|
||||
gammaDecodeParams : GammaTransferParams,
|
||||
gammaEncodeParams : GammaTransferParams,
|
||||
gamutConversionMatrix : mat3x3<f32>,
|
||||
coordTransformationMatrix : mat2x3<f32>,
|
||||
coordTransformationMatrix : mat3x2<f32>,
|
||||
}
|
||||
|
||||
@group(0) @binding(2) var ext_tex_plane_1 : texture_2d<f32>;
|
||||
@@ -268,7 +268,7 @@ fn gammaCorrection(v : vec3<f32>, params : GammaTransferParams) -> vec3<f32> {
|
||||
}
|
||||
|
||||
fn textureSampleExternal(plane0 : texture_2d<f32>, plane1 : texture_2d<f32>, smp : sampler, coord : vec2<f32>, params : ExternalTextureParams) -> vec4<f32> {
|
||||
let modifiedCoords = (vec3<f32>((coord - 0.5f), 1.0f) * params.coordTransformationMatrix);
|
||||
let modifiedCoords = (params.coordTransformationMatrix * vec3<f32>(coord, 1));
|
||||
let plane0_dims = vec2<f32>(textureDimensions(plane0, 0));
|
||||
let plane0_half_texel = (vec2<f32>(0.5) / plane0_dims);
|
||||
let plane0_clamped = clamp(modifiedCoords, plane0_half_texel, (1 - plane0_half_texel));
|
||||
@@ -333,7 +333,7 @@ struct ExternalTextureParams {
|
||||
gammaDecodeParams : GammaTransferParams,
|
||||
gammaEncodeParams : GammaTransferParams,
|
||||
gamutConversionMatrix : mat3x3<f32>,
|
||||
coordTransformationMatrix : mat2x3<f32>,
|
||||
coordTransformationMatrix : mat3x2<f32>,
|
||||
}
|
||||
|
||||
@group(0) @binding(2) var ext_tex_plane_1 : texture_2d<f32>;
|
||||
@@ -348,7 +348,7 @@ fn gammaCorrection(v : vec3<f32>, params : GammaTransferParams) -> vec3<f32> {
|
||||
}
|
||||
|
||||
fn textureSampleExternal(plane0 : texture_2d<f32>, plane1 : texture_2d<f32>, smp : sampler, coord : vec2<f32>, params : ExternalTextureParams) -> vec4<f32> {
|
||||
let modifiedCoords = (vec3<f32>((coord - 0.5f), 1.0f) * params.coordTransformationMatrix);
|
||||
let modifiedCoords = (params.coordTransformationMatrix * vec3<f32>(coord, 1));
|
||||
let plane0_dims = vec2<f32>(textureDimensions(plane0, 0));
|
||||
let plane0_half_texel = (vec2<f32>(0.5) / plane0_dims);
|
||||
let plane0_clamped = clamp(modifiedCoords, plane0_half_texel, (1 - plane0_half_texel));
|
||||
@@ -418,7 +418,7 @@ struct ExternalTextureParams {
|
||||
gammaDecodeParams : GammaTransferParams,
|
||||
gammaEncodeParams : GammaTransferParams,
|
||||
gamutConversionMatrix : mat3x3<f32>,
|
||||
coordTransformationMatrix : mat2x3<f32>,
|
||||
coordTransformationMatrix : mat3x2<f32>,
|
||||
}
|
||||
|
||||
@group(0) @binding(1) var ext_tex_plane_1 : texture_2d<f32>;
|
||||
@@ -511,7 +511,7 @@ struct ExternalTextureParams {
|
||||
gammaDecodeParams : GammaTransferParams,
|
||||
gammaEncodeParams : GammaTransferParams,
|
||||
gamutConversionMatrix : mat3x3<f32>,
|
||||
coordTransformationMatrix : mat2x3<f32>,
|
||||
coordTransformationMatrix : mat3x2<f32>,
|
||||
}
|
||||
|
||||
@group(0) @binding(1) var ext_tex_plane_1 : texture_2d<f32>;
|
||||
@@ -603,7 +603,7 @@ struct ExternalTextureParams {
|
||||
gammaDecodeParams : GammaTransferParams,
|
||||
gammaEncodeParams : GammaTransferParams,
|
||||
gamutConversionMatrix : mat3x3<f32>,
|
||||
coordTransformationMatrix : mat2x3<f32>,
|
||||
coordTransformationMatrix : mat3x2<f32>,
|
||||
}
|
||||
|
||||
@group(0) @binding(2) var ext_tex_plane_1 : texture_2d<f32>;
|
||||
@@ -622,7 +622,7 @@ fn gammaCorrection(v : vec3<f32>, params : GammaTransferParams) -> vec3<f32> {
|
||||
}
|
||||
|
||||
fn textureSampleExternal(plane0 : texture_2d<f32>, plane1 : texture_2d<f32>, smp : sampler, coord : vec2<f32>, params : ExternalTextureParams) -> vec4<f32> {
|
||||
let modifiedCoords = (vec3<f32>((coord - 0.5f), 1.0f) * params.coordTransformationMatrix);
|
||||
let modifiedCoords = (params.coordTransformationMatrix * vec3<f32>(coord, 1));
|
||||
let plane0_dims = vec2<f32>(textureDimensions(plane0, 0));
|
||||
let plane0_half_texel = (vec2<f32>(0.5) / plane0_dims);
|
||||
let plane0_clamped = clamp(modifiedCoords, plane0_half_texel, (1 - plane0_half_texel));
|
||||
@@ -702,7 +702,7 @@ struct ExternalTextureParams {
|
||||
gammaDecodeParams : GammaTransferParams,
|
||||
gammaEncodeParams : GammaTransferParams,
|
||||
gamutConversionMatrix : mat3x3<f32>,
|
||||
coordTransformationMatrix : mat2x3<f32>,
|
||||
coordTransformationMatrix : mat3x2<f32>,
|
||||
}
|
||||
|
||||
@group(0) @binding(2) var ext_tex_plane_1 : texture_2d<f32>;
|
||||
@@ -717,7 +717,7 @@ fn gammaCorrection(v : vec3<f32>, params : GammaTransferParams) -> vec3<f32> {
|
||||
}
|
||||
|
||||
fn textureSampleExternal(plane0 : texture_2d<f32>, plane1 : texture_2d<f32>, smp : sampler, coord : vec2<f32>, params : ExternalTextureParams) -> vec4<f32> {
|
||||
let modifiedCoords = (vec3<f32>((coord - 0.5f), 1.0f) * params.coordTransformationMatrix);
|
||||
let modifiedCoords = (params.coordTransformationMatrix * vec3<f32>(coord, 1));
|
||||
let plane0_dims = vec2<f32>(textureDimensions(plane0, 0));
|
||||
let plane0_half_texel = (vec2<f32>(0.5) / plane0_dims);
|
||||
let plane0_clamped = clamp(modifiedCoords, plane0_half_texel, (1 - plane0_half_texel));
|
||||
@@ -807,7 +807,7 @@ struct ExternalTextureParams {
|
||||
gammaDecodeParams : GammaTransferParams,
|
||||
gammaEncodeParams : GammaTransferParams,
|
||||
gamutConversionMatrix : mat3x3<f32>,
|
||||
coordTransformationMatrix : mat2x3<f32>,
|
||||
coordTransformationMatrix : mat3x2<f32>,
|
||||
}
|
||||
|
||||
@group(0) @binding(4) var ext_tex_plane_1 : texture_2d<f32>;
|
||||
@@ -844,7 +844,7 @@ fn gammaCorrection(v : vec3<f32>, params : GammaTransferParams) -> vec3<f32> {
|
||||
}
|
||||
|
||||
fn textureSampleExternal(plane0 : texture_2d<f32>, plane1 : texture_2d<f32>, smp : sampler, coord : vec2<f32>, params : ExternalTextureParams) -> vec4<f32> {
|
||||
let modifiedCoords = (vec3<f32>((coord - 0.5f), 1.0f) * params.coordTransformationMatrix);
|
||||
let modifiedCoords = (params.coordTransformationMatrix * vec3<f32>(coord, 1));
|
||||
let plane0_dims = vec2<f32>(textureDimensions(plane0, 0));
|
||||
let plane0_half_texel = (vec2<f32>(0.5) / plane0_dims);
|
||||
let plane0_clamped = clamp(modifiedCoords, plane0_half_texel, (1 - plane0_half_texel));
|
||||
@@ -918,7 +918,7 @@ struct ExternalTextureParams {
|
||||
gammaDecodeParams : GammaTransferParams,
|
||||
gammaEncodeParams : GammaTransferParams,
|
||||
gamutConversionMatrix : mat3x3<f32>,
|
||||
coordTransformationMatrix : mat2x3<f32>,
|
||||
coordTransformationMatrix : mat3x2<f32>,
|
||||
}
|
||||
|
||||
@group(0) @binding(2) var ext_tex_plane_1 : texture_2d<f32>;
|
||||
@@ -933,7 +933,7 @@ fn gammaCorrection(v : vec3<f32>, params : GammaTransferParams) -> vec3<f32> {
|
||||
}
|
||||
|
||||
fn textureSampleExternal(plane0 : texture_2d<f32>, plane1 : texture_2d<f32>, smp : sampler, coord : vec2<f32>, params : ExternalTextureParams) -> vec4<f32> {
|
||||
let modifiedCoords = (vec3<f32>((coord - 0.5f), 1.0f) * params.coordTransformationMatrix);
|
||||
let modifiedCoords = (params.coordTransformationMatrix * vec3<f32>(coord, 1));
|
||||
let plane0_dims = vec2<f32>(textureDimensions(plane0, 0));
|
||||
let plane0_half_texel = (vec2<f32>(0.5) / plane0_dims);
|
||||
let plane0_clamped = clamp(modifiedCoords, plane0_half_texel, (1 - plane0_half_texel));
|
||||
@@ -1011,7 +1011,7 @@ struct ExternalTextureParams {
|
||||
gammaDecodeParams : GammaTransferParams,
|
||||
gammaEncodeParams : GammaTransferParams,
|
||||
gamutConversionMatrix : mat3x3<f32>,
|
||||
coordTransformationMatrix : mat2x3<f32>,
|
||||
coordTransformationMatrix : mat3x2<f32>,
|
||||
}
|
||||
|
||||
@group(0) @binding(2) var ext_tex_plane_1 : texture_2d<f32>;
|
||||
@@ -1031,7 +1031,7 @@ fn gammaCorrection(v : vec3<f32>, params : GammaTransferParams) -> vec3<f32> {
|
||||
}
|
||||
|
||||
fn textureSampleExternal(plane0 : texture_2d<f32>, plane1 : texture_2d<f32>, smp : sampler, coord : vec2<f32>, params : ExternalTextureParams) -> vec4<f32> {
|
||||
let modifiedCoords = (vec3<f32>((coord - 0.5f), 1.0f) * params.coordTransformationMatrix);
|
||||
let modifiedCoords = (params.coordTransformationMatrix * vec3<f32>(coord, 1));
|
||||
let plane0_dims = vec2<f32>(textureDimensions(plane0, 0));
|
||||
let plane0_half_texel = (vec2<f32>(0.5) / plane0_dims);
|
||||
let plane0_clamped = clamp(modifiedCoords, plane0_half_texel, (1 - plane0_half_texel));
|
||||
@@ -1104,7 +1104,7 @@ struct ExternalTextureParams {
|
||||
gammaDecodeParams : GammaTransferParams,
|
||||
gammaEncodeParams : GammaTransferParams,
|
||||
gamutConversionMatrix : mat3x3<f32>,
|
||||
coordTransformationMatrix : mat2x3<f32>,
|
||||
coordTransformationMatrix : mat3x2<f32>,
|
||||
}
|
||||
|
||||
@group(0) @binding(2) var ext_tex_plane_1 : texture_2d<f32>;
|
||||
@@ -1119,7 +1119,7 @@ fn gammaCorrection(v : vec3<f32>, params : GammaTransferParams) -> vec3<f32> {
|
||||
}
|
||||
|
||||
fn textureSampleExternal(plane0 : texture_2d<f32>, plane1 : texture_2d<f32>, smp : sampler, coord : vec2<f32>, params : ExternalTextureParams) -> vec4<f32> {
|
||||
let modifiedCoords = (vec3<f32>((coord - 0.5f), 1.0f) * params.coordTransformationMatrix);
|
||||
let modifiedCoords = (params.coordTransformationMatrix * vec3<f32>(coord, 1));
|
||||
let plane0_dims = vec2<f32>(textureDimensions(plane0, 0));
|
||||
let plane0_half_texel = (vec2<f32>(0.5) / plane0_dims);
|
||||
let plane0_clamped = clamp(modifiedCoords, plane0_half_texel, (1 - plane0_half_texel));
|
||||
@@ -1199,7 +1199,7 @@ struct ExternalTextureParams {
|
||||
gammaDecodeParams : GammaTransferParams,
|
||||
gammaEncodeParams : GammaTransferParams,
|
||||
gamutConversionMatrix : mat3x3<f32>,
|
||||
coordTransformationMatrix : mat2x3<f32>,
|
||||
coordTransformationMatrix : mat3x2<f32>,
|
||||
}
|
||||
|
||||
@group(0) @binding(3) var ext_tex_plane_1 : texture_2d<f32>;
|
||||
@@ -1218,7 +1218,7 @@ fn gammaCorrection(v : vec3<f32>, params : GammaTransferParams) -> vec3<f32> {
|
||||
}
|
||||
|
||||
fn textureSampleExternal(plane0 : texture_2d<f32>, plane1 : texture_2d<f32>, smp : sampler, coord : vec2<f32>, params : ExternalTextureParams) -> vec4<f32> {
|
||||
let modifiedCoords = (vec3<f32>((coord - 0.5f), 1.0f) * params.coordTransformationMatrix);
|
||||
let modifiedCoords = (params.coordTransformationMatrix * vec3<f32>(coord, 1));
|
||||
let plane0_dims = vec2<f32>(textureDimensions(plane0, 0));
|
||||
let plane0_half_texel = (vec2<f32>(0.5) / plane0_dims);
|
||||
let plane0_clamped = clamp(modifiedCoords, plane0_half_texel, (1 - plane0_half_texel));
|
||||
@@ -1303,7 +1303,7 @@ struct ExternalTextureParams {
|
||||
gammaDecodeParams : GammaTransferParams,
|
||||
gammaEncodeParams : GammaTransferParams,
|
||||
gamutConversionMatrix : mat3x3<f32>,
|
||||
coordTransformationMatrix : mat2x3<f32>,
|
||||
coordTransformationMatrix : mat3x2<f32>,
|
||||
}
|
||||
|
||||
@group(0) @binding(3) var ext_tex_plane_1 : texture_2d<f32>;
|
||||
@@ -1327,7 +1327,7 @@ fn gammaCorrection(v : vec3<f32>, params : GammaTransferParams) -> vec3<f32> {
|
||||
}
|
||||
|
||||
fn textureSampleExternal(plane0 : texture_2d<f32>, plane1 : texture_2d<f32>, smp : sampler, coord : vec2<f32>, params : ExternalTextureParams) -> vec4<f32> {
|
||||
let modifiedCoords = (vec3<f32>((coord - 0.5f), 1.0f) * params.coordTransformationMatrix);
|
||||
let modifiedCoords = (params.coordTransformationMatrix * vec3<f32>(coord, 1));
|
||||
let plane0_dims = vec2<f32>(textureDimensions(plane0, 0));
|
||||
let plane0_half_texel = (vec2<f32>(0.5) / plane0_dims);
|
||||
let plane0_clamped = clamp(modifiedCoords, plane0_half_texel, (1 - plane0_half_texel));
|
||||
@@ -1408,7 +1408,7 @@ struct ExternalTextureParams {
|
||||
gammaDecodeParams : GammaTransferParams,
|
||||
gammaEncodeParams : GammaTransferParams,
|
||||
gamutConversionMatrix : mat3x3<f32>,
|
||||
coordTransformationMatrix : mat2x3<f32>,
|
||||
coordTransformationMatrix : mat3x2<f32>,
|
||||
}
|
||||
|
||||
@group(0) @binding(2) var ext_tex_plane_1 : texture_2d<f32>;
|
||||
@@ -1423,7 +1423,7 @@ fn gammaCorrection(v : vec3<f32>, params : GammaTransferParams) -> vec3<f32> {
|
||||
}
|
||||
|
||||
fn textureSampleExternal(plane0 : texture_2d<f32>, plane1 : texture_2d<f32>, smp : sampler, coord : vec2<f32>, params : ExternalTextureParams) -> vec4<f32> {
|
||||
let modifiedCoords = (vec3<f32>((coord - 0.5f), 1.0f) * params.coordTransformationMatrix);
|
||||
let modifiedCoords = (params.coordTransformationMatrix * vec3<f32>(coord, 1));
|
||||
let plane0_dims = vec2<f32>(textureDimensions(plane0, 0));
|
||||
let plane0_half_texel = (vec2<f32>(0.5) / plane0_dims);
|
||||
let plane0_clamped = clamp(modifiedCoords, plane0_half_texel, (1 - plane0_half_texel));
|
||||
@@ -1509,7 +1509,7 @@ struct ExternalTextureParams {
|
||||
gammaDecodeParams : GammaTransferParams,
|
||||
gammaEncodeParams : GammaTransferParams,
|
||||
gamutConversionMatrix : mat3x3<f32>,
|
||||
coordTransformationMatrix : mat2x3<f32>,
|
||||
coordTransformationMatrix : mat3x2<f32>,
|
||||
}
|
||||
|
||||
@group(0) @binding(2) var ext_tex_plane_1 : texture_2d<f32>;
|
||||
@@ -1524,7 +1524,7 @@ fn gammaCorrection(v : vec3<f32>, params : GammaTransferParams) -> vec3<f32> {
|
||||
}
|
||||
|
||||
fn textureSampleExternal(plane0 : texture_2d<f32>, plane1 : texture_2d<f32>, smp : sampler, coord : vec2<f32>, params : ExternalTextureParams) -> vec4<f32> {
|
||||
let modifiedCoords = (vec3<f32>((coord - 0.5f), 1.0f) * params.coordTransformationMatrix);
|
||||
let modifiedCoords = (params.coordTransformationMatrix * vec3<f32>(coord, 1));
|
||||
let plane0_dims = vec2<f32>(textureDimensions(plane0, 0));
|
||||
let plane0_half_texel = (vec2<f32>(0.5) / plane0_dims);
|
||||
let plane0_clamped = clamp(modifiedCoords, plane0_half_texel, (1 - plane0_half_texel));
|
||||
@@ -1598,7 +1598,7 @@ struct ExternalTextureParams {
|
||||
gammaDecodeParams : GammaTransferParams,
|
||||
gammaEncodeParams : GammaTransferParams,
|
||||
gamutConversionMatrix : mat3x3<f32>,
|
||||
coordTransformationMatrix : mat2x3<f32>,
|
||||
coordTransformationMatrix : mat3x2<f32>,
|
||||
}
|
||||
|
||||
fn f(ext_tex : texture_2d<f32>, ext_tex_plane_1 : texture_2d<f32>, ext_tex_params : ExternalTextureParams) -> vec2<u32> {
|
||||
@@ -1650,7 +1650,7 @@ struct ExternalTextureParams {
|
||||
gammaDecodeParams : GammaTransferParams,
|
||||
gammaEncodeParams : GammaTransferParams,
|
||||
gamutConversionMatrix : mat3x3<f32>,
|
||||
coordTransformationMatrix : mat2x3<f32>,
|
||||
coordTransformationMatrix : mat3x2<f32>,
|
||||
}
|
||||
|
||||
@group(0) @binding(2) var ext_tex_plane_1 : texture_2d<f32>;
|
||||
@@ -1667,7 +1667,7 @@ fn gammaCorrection(v : vec3<f32>, params : GammaTransferParams) -> vec3<f32> {
|
||||
}
|
||||
|
||||
fn textureSampleExternal(plane0 : texture_2d<f32>, plane1 : texture_2d<f32>, smp : sampler, coord : vec2<f32>, params : ExternalTextureParams) -> vec4<f32> {
|
||||
let modifiedCoords = (vec3<f32>((coord - 0.5f), 1.0f) * params.coordTransformationMatrix);
|
||||
let modifiedCoords = (params.coordTransformationMatrix * vec3<f32>(coord, 1));
|
||||
let plane0_dims = vec2<f32>(textureDimensions(plane0, 0));
|
||||
let plane0_half_texel = (vec2<f32>(0.5) / plane0_dims);
|
||||
let plane0_clamped = clamp(modifiedCoords, plane0_half_texel, (1 - plane0_half_texel));
|
||||
@@ -1746,7 +1746,7 @@ struct ExternalTextureParams {
|
||||
gammaDecodeParams : GammaTransferParams,
|
||||
gammaEncodeParams : GammaTransferParams,
|
||||
gamutConversionMatrix : mat3x3<f32>,
|
||||
coordTransformationMatrix : mat2x3<f32>,
|
||||
coordTransformationMatrix : mat3x2<f32>,
|
||||
}
|
||||
|
||||
@group(0) @binding(2) var ext_tex_plane_1 : texture_2d<f32>;
|
||||
@@ -1766,7 +1766,7 @@ fn gammaCorrection(v : vec3<f32>, params : GammaTransferParams) -> vec3<f32> {
|
||||
}
|
||||
|
||||
fn textureSampleExternal(plane0 : texture_2d<f32>, plane1 : texture_2d<f32>, smp : sampler, coord : vec2<f32>, params : ExternalTextureParams) -> vec4<f32> {
|
||||
let modifiedCoords = (vec3<f32>((coord - 0.5f), 1.0f) * params.coordTransformationMatrix);
|
||||
let modifiedCoords = (params.coordTransformationMatrix * vec3<f32>(coord, 1));
|
||||
let plane0_dims = vec2<f32>(textureDimensions(plane0, 0));
|
||||
let plane0_half_texel = (vec2<f32>(0.5) / plane0_dims);
|
||||
let plane0_clamped = clamp(modifiedCoords, plane0_half_texel, (1 - plane0_half_texel));
|
||||
|
||||
Reference in New Issue
Block a user