mirror of
https://github.com/gfx-rs/wgpu.git
synced 2025-12-08 21:26:17 +00:00
[naga] Make external texture snapshot test call textureLoad() with both vec2<i32> and vec2<i32> coordinates
The HLSL external texture implementation didn't have to do anything in particular to handle both coordinate types, as int2 automatically gets promoted to uint2. But in MSL this is not the case, and it is therefore important to test that we correctly handle both coordinate types.
This commit is contained in:
parent
bb21da3014
commit
2cada72dfb
@ -5,10 +5,11 @@ var samp: sampler;
|
||||
|
||||
fn test(t: texture_external) -> vec4<f32> {
|
||||
var a = textureSampleBaseClampToEdge(t, samp, vec2(0.0f));
|
||||
var b = textureLoad(t, vec2(0u));
|
||||
var c = textureDimensions(t);
|
||||
var b = textureLoad(t, vec2(0i));
|
||||
var c = textureLoad(t, vec2(0u));
|
||||
var d = textureDimensions(t);
|
||||
|
||||
return a + b + vec2f(c).xyxy;
|
||||
return a + b + c + vec2f(d).xyxy;
|
||||
}
|
||||
|
||||
@fragment
|
||||
|
||||
@ -137,17 +137,21 @@ float4 test(Texture2D<float4> t_plane0_, Texture2D<float4> t_plane1_, Texture2D<
|
||||
{
|
||||
float4 a = (float4)0;
|
||||
float4 b = (float4)0;
|
||||
uint2 c = (uint2)0;
|
||||
float4 c = (float4)0;
|
||||
uint2 d = (uint2)0;
|
||||
|
||||
float4 _e4 = nagaTextureSampleBaseClampToEdge(t_plane0_, t_plane1_, t_plane2_, t_params, samp, (0.0).xx);
|
||||
a = _e4;
|
||||
float4 _e8 = nagaTextureLoadExternal(t_plane0_, t_plane1_, t_plane2_, t_params, (0u).xx);
|
||||
float4 _e8 = nagaTextureLoadExternal(t_plane0_, t_plane1_, t_plane2_, t_params, (int(0)).xx);
|
||||
b = _e8;
|
||||
c = NagaExternalDimensions2D(t_plane0_, t_plane1_, t_plane2_, t_params);
|
||||
float4 _e12 = a;
|
||||
float4 _e13 = b;
|
||||
uint2 _e15 = c;
|
||||
return ((_e12 + _e13) + float2(_e15).xyxy);
|
||||
float4 _e12 = nagaTextureLoadExternal(t_plane0_, t_plane1_, t_plane2_, t_params, (0u).xx);
|
||||
c = _e12;
|
||||
d = NagaExternalDimensions2D(t_plane0_, t_plane1_, t_plane2_, t_params);
|
||||
float4 _e16 = a;
|
||||
float4 _e17 = b;
|
||||
float4 _e19 = c;
|
||||
uint2 _e21 = d;
|
||||
return (((_e16 + _e17) + _e19) + float2(_e21).xyxy);
|
||||
}
|
||||
|
||||
float4 fragment_main() : SV_Target0
|
||||
|
||||
@ -230,6 +230,11 @@
|
||||
),
|
||||
(
|
||||
name: Some("c"),
|
||||
ty: 10,
|
||||
init: None,
|
||||
),
|
||||
(
|
||||
name: Some("d"),
|
||||
ty: 2,
|
||||
init: None,
|
||||
),
|
||||
@ -254,7 +259,7 @@
|
||||
clamp_to_edge: true,
|
||||
),
|
||||
LocalVariable(0),
|
||||
Literal(U32(0)),
|
||||
Literal(I32(0)),
|
||||
Splat(
|
||||
size: Bi,
|
||||
value: 6,
|
||||
@ -267,13 +272,26 @@
|
||||
level: None,
|
||||
),
|
||||
LocalVariable(1),
|
||||
Literal(U32(0)),
|
||||
Splat(
|
||||
size: Bi,
|
||||
value: 10,
|
||||
),
|
||||
ImageLoad(
|
||||
image: 0,
|
||||
coordinate: 11,
|
||||
array_index: None,
|
||||
sample: None,
|
||||
level: None,
|
||||
),
|
||||
LocalVariable(2),
|
||||
ImageQuery(
|
||||
image: 0,
|
||||
query: Size(
|
||||
level: None,
|
||||
),
|
||||
),
|
||||
LocalVariable(2),
|
||||
LocalVariable(3),
|
||||
Load(
|
||||
pointer: 5,
|
||||
),
|
||||
@ -282,26 +300,34 @@
|
||||
),
|
||||
Binary(
|
||||
op: Add,
|
||||
left: 12,
|
||||
right: 13,
|
||||
left: 16,
|
||||
right: 17,
|
||||
),
|
||||
Load(
|
||||
pointer: 11,
|
||||
pointer: 13,
|
||||
),
|
||||
Binary(
|
||||
op: Add,
|
||||
left: 18,
|
||||
right: 19,
|
||||
),
|
||||
Load(
|
||||
pointer: 15,
|
||||
),
|
||||
As(
|
||||
expr: 15,
|
||||
expr: 21,
|
||||
kind: Float,
|
||||
convert: Some(4),
|
||||
),
|
||||
Swizzle(
|
||||
size: Quad,
|
||||
vector: 16,
|
||||
vector: 22,
|
||||
pattern: (X, Y, X, Y),
|
||||
),
|
||||
Binary(
|
||||
op: Add,
|
||||
left: 14,
|
||||
right: 17,
|
||||
left: 20,
|
||||
right: 23,
|
||||
),
|
||||
],
|
||||
named_expressions: {
|
||||
@ -325,19 +351,27 @@
|
||||
value: 8,
|
||||
),
|
||||
Emit((
|
||||
start: 10,
|
||||
end: 11,
|
||||
start: 11,
|
||||
end: 13,
|
||||
)),
|
||||
Store(
|
||||
pointer: 11,
|
||||
value: 10,
|
||||
pointer: 13,
|
||||
value: 12,
|
||||
),
|
||||
Emit((
|
||||
start: 12,
|
||||
end: 19,
|
||||
start: 14,
|
||||
end: 15,
|
||||
)),
|
||||
Store(
|
||||
pointer: 15,
|
||||
value: 14,
|
||||
),
|
||||
Emit((
|
||||
start: 16,
|
||||
end: 25,
|
||||
)),
|
||||
Return(
|
||||
value: Some(18),
|
||||
value: Some(24),
|
||||
),
|
||||
],
|
||||
diagnostic_filter_leaf: None,
|
||||
|
||||
@ -230,6 +230,11 @@
|
||||
),
|
||||
(
|
||||
name: Some("c"),
|
||||
ty: 10,
|
||||
init: None,
|
||||
),
|
||||
(
|
||||
name: Some("d"),
|
||||
ty: 2,
|
||||
init: None,
|
||||
),
|
||||
@ -254,7 +259,7 @@
|
||||
clamp_to_edge: true,
|
||||
),
|
||||
LocalVariable(0),
|
||||
Literal(U32(0)),
|
||||
Literal(I32(0)),
|
||||
Splat(
|
||||
size: Bi,
|
||||
value: 6,
|
||||
@ -267,13 +272,26 @@
|
||||
level: None,
|
||||
),
|
||||
LocalVariable(1),
|
||||
Literal(U32(0)),
|
||||
Splat(
|
||||
size: Bi,
|
||||
value: 10,
|
||||
),
|
||||
ImageLoad(
|
||||
image: 0,
|
||||
coordinate: 11,
|
||||
array_index: None,
|
||||
sample: None,
|
||||
level: None,
|
||||
),
|
||||
LocalVariable(2),
|
||||
ImageQuery(
|
||||
image: 0,
|
||||
query: Size(
|
||||
level: None,
|
||||
),
|
||||
),
|
||||
LocalVariable(2),
|
||||
LocalVariable(3),
|
||||
Load(
|
||||
pointer: 5,
|
||||
),
|
||||
@ -282,26 +300,34 @@
|
||||
),
|
||||
Binary(
|
||||
op: Add,
|
||||
left: 12,
|
||||
right: 13,
|
||||
left: 16,
|
||||
right: 17,
|
||||
),
|
||||
Load(
|
||||
pointer: 11,
|
||||
pointer: 13,
|
||||
),
|
||||
Binary(
|
||||
op: Add,
|
||||
left: 18,
|
||||
right: 19,
|
||||
),
|
||||
Load(
|
||||
pointer: 15,
|
||||
),
|
||||
As(
|
||||
expr: 15,
|
||||
expr: 21,
|
||||
kind: Float,
|
||||
convert: Some(4),
|
||||
),
|
||||
Swizzle(
|
||||
size: Quad,
|
||||
vector: 16,
|
||||
vector: 22,
|
||||
pattern: (X, Y, X, Y),
|
||||
),
|
||||
Binary(
|
||||
op: Add,
|
||||
left: 14,
|
||||
right: 17,
|
||||
left: 20,
|
||||
right: 23,
|
||||
),
|
||||
],
|
||||
named_expressions: {
|
||||
@ -325,19 +351,27 @@
|
||||
value: 8,
|
||||
),
|
||||
Emit((
|
||||
start: 10,
|
||||
end: 11,
|
||||
start: 11,
|
||||
end: 13,
|
||||
)),
|
||||
Store(
|
||||
pointer: 11,
|
||||
value: 10,
|
||||
pointer: 13,
|
||||
value: 12,
|
||||
),
|
||||
Emit((
|
||||
start: 12,
|
||||
end: 19,
|
||||
start: 14,
|
||||
end: 15,
|
||||
)),
|
||||
Store(
|
||||
pointer: 15,
|
||||
value: 14,
|
||||
),
|
||||
Emit((
|
||||
start: 16,
|
||||
end: 25,
|
||||
)),
|
||||
Return(
|
||||
value: Some(18),
|
||||
value: Some(24),
|
||||
),
|
||||
],
|
||||
diagnostic_filter_leaf: None,
|
||||
|
||||
@ -6,18 +6,22 @@ var samp: sampler;
|
||||
fn test(t: texture_external) -> vec4<f32> {
|
||||
var a: vec4<f32>;
|
||||
var b: vec4<f32>;
|
||||
var c: vec2<u32>;
|
||||
var c: vec4<f32>;
|
||||
var d: vec2<u32>;
|
||||
|
||||
let _e4 = textureSampleBaseClampToEdge(t, samp, vec2(0f));
|
||||
a = _e4;
|
||||
let _e8 = textureLoad(t, vec2(0u));
|
||||
let _e8 = textureLoad(t, vec2(0i));
|
||||
b = _e8;
|
||||
let _e10 = textureDimensions(t);
|
||||
c = _e10;
|
||||
let _e12 = a;
|
||||
let _e13 = b;
|
||||
let _e15 = c;
|
||||
return ((_e12 + _e13) + vec2<f32>(_e15).xyxy);
|
||||
let _e12 = textureLoad(t, vec2(0u));
|
||||
c = _e12;
|
||||
let _e14 = textureDimensions(t);
|
||||
d = _e14;
|
||||
let _e16 = a;
|
||||
let _e17 = b;
|
||||
let _e19 = c;
|
||||
let _e21 = d;
|
||||
return (((_e16 + _e17) + _e19) + vec2<f32>(_e21).xyxy);
|
||||
}
|
||||
|
||||
@fragment
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user