mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-06-05 22:23:29 +00:00
Update WGSL in tests with renamed builtins
These builtins have been renamed: * frag_coord -> position * sample_mask_in -> sample_mask * sample_mask_out -> sample_mask Change-Id: Ic40dc9f4e509587b7ac82e43abbf9eec68225d9f Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/48300 Auto-Submit: James Price <jrprice@google.com> Commit-Queue: Corentin Wallez <cwallez@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
This commit is contained in:
parent
7f5a472258
commit
eae70b75ae
@ -105,7 +105,7 @@ void init() {
|
|||||||
[[group(0), binding(0)]] var mySampler: sampler;
|
[[group(0), binding(0)]] var mySampler: sampler;
|
||||||
[[group(0), binding(1)]] var myTexture : texture_2d<f32>;
|
[[group(0), binding(1)]] var myTexture : texture_2d<f32>;
|
||||||
|
|
||||||
[[stage(fragment)]] fn main([[builtin(frag_coord)]] FragCoord : vec4<f32>)
|
[[stage(fragment)]] fn main([[builtin(position)]] FragCoord : vec4<f32>)
|
||||||
-> [[location(0)]] vec4<f32> {
|
-> [[location(0)]] vec4<f32> {
|
||||||
return textureSample(myTexture, mySampler, FragCoord.xy / vec2<f32>(640.0, 480.0));
|
return textureSample(myTexture, mySampler, FragCoord.xy / vec2<f32>(640.0, 480.0));
|
||||||
})");
|
})");
|
||||||
|
@ -256,7 +256,7 @@ TEST_P(BindGroupTests, UBOSamplerAndTexture) {
|
|||||||
[[group(0), binding(2)]] var tex : texture_2d<f32>;
|
[[group(0), binding(2)]] var tex : texture_2d<f32>;
|
||||||
|
|
||||||
[[stage(fragment)]]
|
[[stage(fragment)]]
|
||||||
fn main([[builtin(frag_coord)]] FragCoord : vec4<f32>) -> [[location(0)]] vec4<f32> {
|
fn main([[builtin(position)]] FragCoord : vec4<f32>) -> [[location(0)]] vec4<f32> {
|
||||||
return textureSample(tex, samp, FragCoord.xy);
|
return textureSample(tex, samp, FragCoord.xy);
|
||||||
})");
|
})");
|
||||||
|
|
||||||
|
@ -44,7 +44,7 @@ class CullingTest : public DawnTest {
|
|||||||
// will make the pixel's R and G channels exactly equal to the pixel's x and y coordinates.
|
// will make the pixel's R and G channels exactly equal to the pixel's x and y coordinates.
|
||||||
pipelineDescriptor.cFragment.module = utils::CreateShaderModule(device, R"(
|
pipelineDescriptor.cFragment.module = utils::CreateShaderModule(device, R"(
|
||||||
[[stage(fragment)]]
|
[[stage(fragment)]]
|
||||||
fn main([[builtin(frag_coord)]] FragCoord : vec4<f32>) -> [[location(0)]] vec4<f32> {
|
fn main([[builtin(position)]] FragCoord : vec4<f32>) -> [[location(0)]] vec4<f32> {
|
||||||
return vec4<f32>(
|
return vec4<f32>(
|
||||||
(FragCoord.xy - vec2<f32>(0.5, 0.5)) / vec2<f32>(255.0, 255.0),
|
(FragCoord.xy - vec2<f32>(0.5, 0.5)) / vec2<f32>(255.0, 255.0),
|
||||||
0.0, 1.0);
|
0.0, 1.0);
|
||||||
|
@ -256,7 +256,7 @@ class DepthStencilCopyTests : public DawnTest {
|
|||||||
};
|
};
|
||||||
|
|
||||||
[[stage(fragment)]]
|
[[stage(fragment)]]
|
||||||
fn main([[builtin(frag_coord)]] FragCoord : vec4<f32>) -> FragmentOut {
|
fn main([[builtin(position)]] FragCoord : vec4<f32>) -> FragmentOut {
|
||||||
var output : FragmentOut;
|
var output : FragmentOut;
|
||||||
output.result = 1u;
|
output.result = 1u;
|
||||||
output.fragDepth = textureLoad(texture0, vec2<i32>(FragCoord.xy), 0)[0];
|
output.fragDepth = textureLoad(texture0, vec2<i32>(FragCoord.xy), 0)[0];
|
||||||
|
@ -784,7 +784,7 @@ TEST_P(MultisampledRenderingTest, ResolveInto2DTextureWithSampleMaskAndShaderOut
|
|||||||
|
|
||||||
struct FragmentOut {
|
struct FragmentOut {
|
||||||
[[location(0)]] color : vec4<f32>;
|
[[location(0)]] color : vec4<f32>;
|
||||||
[[builtin(sample_mask_out)]] sampleMask : u32;
|
[[builtin(sample_mask)]] sampleMask : u32;
|
||||||
};
|
};
|
||||||
|
|
||||||
[[stage(fragment)]] fn main() -> FragmentOut {
|
[[stage(fragment)]] fn main() -> FragmentOut {
|
||||||
@ -847,7 +847,7 @@ TEST_P(MultisampledRenderingTest, ResolveIntoMultipleResolveTargetsWithShaderOut
|
|||||||
struct FragmentOut {
|
struct FragmentOut {
|
||||||
[[location(0)]] color0 : vec4<f32>;
|
[[location(0)]] color0 : vec4<f32>;
|
||||||
[[location(1)]] color1 : vec4<f32>;
|
[[location(1)]] color1 : vec4<f32>;
|
||||||
[[builtin(sample_mask_out)]] sampleMask : u32;
|
[[builtin(sample_mask)]] sampleMask : u32;
|
||||||
};
|
};
|
||||||
|
|
||||||
[[stage(fragment)]] fn main() -> FragmentOut {
|
[[stage(fragment)]] fn main() -> FragmentOut {
|
||||||
|
@ -68,7 +68,7 @@ class SamplerFilterAnisotropicTest : public DawnTest {
|
|||||||
|
|
||||||
struct FragmentIn {
|
struct FragmentIn {
|
||||||
[[location(0)]] uv: vec2<f32>;
|
[[location(0)]] uv: vec2<f32>;
|
||||||
[[builtin(frag_coord)]] fragCoord : vec4<f32>;
|
[[builtin(position)]] fragCoord : vec4<f32>;
|
||||||
};
|
};
|
||||||
|
|
||||||
[[stage(fragment)]]
|
[[stage(fragment)]]
|
||||||
|
@ -72,7 +72,7 @@ class SamplerTest : public DawnTest {
|
|||||||
[[group(0), binding(1)]] var texture0 : texture_2d<f32>;
|
[[group(0), binding(1)]] var texture0 : texture_2d<f32>;
|
||||||
|
|
||||||
[[stage(fragment)]]
|
[[stage(fragment)]]
|
||||||
fn main([[builtin(frag_coord)]] FragCoord : vec4<f32>) -> [[location(0)]] vec4<f32> {
|
fn main([[builtin(position)]] FragCoord : vec4<f32>) -> [[location(0)]] vec4<f32> {
|
||||||
return textureSample(texture0, sampler0, FragCoord.xy / vec2<f32>(2.0, 2.0));
|
return textureSample(texture0, sampler0, FragCoord.xy / vec2<f32>(2.0, 2.0));
|
||||||
})");
|
})");
|
||||||
|
|
||||||
|
@ -111,7 +111,7 @@ fn main([[builtin(vertex_index)]] VertexIndex : u32) -> [[builtin(position)]] ve
|
|||||||
|
|
||||||
std::string fragmentShader = R"(
|
std::string fragmentShader = R"(
|
||||||
[[stage(fragment)]]
|
[[stage(fragment)]]
|
||||||
fn main([[builtin(frag_coord)]] fragCoord : vec4<f32>) -> [[location(0)]] vec4<f32> {
|
fn main([[builtin(position)]] fragCoord : vec4<f32>) -> [[location(0)]] vec4<f32> {
|
||||||
return vec4<f32>(fragCoord.xy, 0.0, 1.0);
|
return vec4<f32>(fragCoord.xy, 0.0, 1.0);
|
||||||
})";
|
})";
|
||||||
wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, fragmentShader.c_str());
|
wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, fragmentShader.c_str());
|
||||||
@ -191,7 +191,7 @@ fn main(input : VertexIn) -> VertexOut {
|
|||||||
std::string fragmentShader = R"(
|
std::string fragmentShader = R"(
|
||||||
struct FragmentIn {
|
struct FragmentIn {
|
||||||
[[location(0)]] color : vec4<f32>;
|
[[location(0)]] color : vec4<f32>;
|
||||||
[[builtin(frag_coord)]] fragCoord : vec4<f32>;
|
[[builtin(position)]] fragCoord : vec4<f32>;
|
||||||
};
|
};
|
||||||
|
|
||||||
[[stage(fragment)]]
|
[[stage(fragment)]]
|
||||||
@ -238,7 +238,7 @@ fn main(input : VertexIn) -> VertexOut {
|
|||||||
std::string fragmentShader = R"(
|
std::string fragmentShader = R"(
|
||||||
struct FragmentIn {
|
struct FragmentIn {
|
||||||
[[location(0)]] color : vec4<f32>;
|
[[location(0)]] color : vec4<f32>;
|
||||||
[[builtin(frag_coord)]] fragCoord : vec4<f32>;
|
[[builtin(position)]] fragCoord : vec4<f32>;
|
||||||
};
|
};
|
||||||
|
|
||||||
[[stage(fragment)]]
|
[[stage(fragment)]]
|
||||||
|
@ -162,7 +162,7 @@ class TextureFormatTest : public DawnTest {
|
|||||||
fsSource << " [[location(0)]] color : vec4<" << type << ">;\n";
|
fsSource << " [[location(0)]] color : vec4<" << type << ">;\n";
|
||||||
fsSource << R"(};
|
fsSource << R"(};
|
||||||
[[stage(fragment)]]
|
[[stage(fragment)]]
|
||||||
fn main([[builtin(frag_coord)]] FragCoord : vec4<f32>) -> FragmentOut {
|
fn main([[builtin(position)]] FragCoord : vec4<f32>) -> FragmentOut {
|
||||||
var output : FragmentOut;
|
var output : FragmentOut;
|
||||||
output.color = textureLoad(myTexture, vec2<i32>(FragCoord.xy), 0);
|
output.color = textureLoad(myTexture, vec2<i32>(FragCoord.xy), 0);
|
||||||
return output;
|
return output;
|
||||||
|
@ -105,7 +105,7 @@ class TextureSubresourceTest : public DawnTest {
|
|||||||
[[group(0), binding(1)]] var tex : texture_2d<f32>;
|
[[group(0), binding(1)]] var tex : texture_2d<f32>;
|
||||||
|
|
||||||
[[stage(fragment)]]
|
[[stage(fragment)]]
|
||||||
fn main([[builtin(frag_coord)]] FragCoord : vec4<f32>) -> [[location(0)]] vec4<f32> {
|
fn main([[builtin(position)]] FragCoord : vec4<f32>) -> [[location(0)]] vec4<f32> {
|
||||||
return textureSample(tex, samp, FragCoord.xy / vec2<f32>(4.0, 4.0));
|
return textureSample(tex, samp, FragCoord.xy / vec2<f32>(4.0, 4.0));
|
||||||
})");
|
})");
|
||||||
|
|
||||||
|
@ -106,7 +106,7 @@ class TextureZeroInitTest : public DawnTest {
|
|||||||
[[location(0)]] color : vec4<f32>;
|
[[location(0)]] color : vec4<f32>;
|
||||||
};
|
};
|
||||||
[[stage(fragment)]]
|
[[stage(fragment)]]
|
||||||
fn main([[builtin(frag_coord)]] FragCoord : vec4<f32>) -> FragmentOut {
|
fn main([[builtin(position)]] FragCoord : vec4<f32>) -> FragmentOut {
|
||||||
var output : FragmentOut;
|
var output : FragmentOut;
|
||||||
output.color = textureLoad(texture0, vec2<i32>(FragCoord.xy), 0);
|
output.color = textureLoad(texture0, vec2<i32>(FragCoord.xy), 0);
|
||||||
return output;
|
return output;
|
||||||
|
@ -139,7 +139,7 @@ TEST_F(StorageTextureValidationTests, RenderPipeline) {
|
|||||||
wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"(
|
wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"(
|
||||||
[[group(0), binding(0)]] var image0 : [[access(read)]] texture_storage_2d<rgba8unorm>;
|
[[group(0), binding(0)]] var image0 : [[access(read)]] texture_storage_2d<rgba8unorm>;
|
||||||
[[stage(fragment)]] fn main(
|
[[stage(fragment)]] fn main(
|
||||||
[[builtin(frag_coord)]] FragCoord : vec4<f32>
|
[[builtin(position)]] FragCoord : vec4<f32>
|
||||||
) -> [[location(0)]] vec4<f32> {
|
) -> [[location(0)]] vec4<f32> {
|
||||||
return textureLoad(image0, vec2<i32>(FragCoord.xy));
|
return textureLoad(image0, vec2<i32>(FragCoord.xy));
|
||||||
})");
|
})");
|
||||||
@ -170,8 +170,8 @@ TEST_F(StorageTextureValidationTests, RenderPipeline) {
|
|||||||
{
|
{
|
||||||
wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"(
|
wgpu::ShaderModule fsModule = utils::CreateShaderModule(device, R"(
|
||||||
[[group(0), binding(0)]] var image0 : [[access(write)]] texture_storage_2d<rgba8unorm>;
|
[[group(0), binding(0)]] var image0 : [[access(write)]] texture_storage_2d<rgba8unorm>;
|
||||||
[[stage(fragment)]] fn main([[builtin(frag_coord)]] frag_coord : vec4<f32>) {
|
[[stage(fragment)]] fn main([[builtin(position)]] position : vec4<f32>) {
|
||||||
textureStore(image0, vec2<i32>(frag_coord.xy), vec4<f32>(1.0, 0.0, 0.0, 1.0));
|
textureStore(image0, vec2<i32>(position.xy), vec4<f32>(1.0, 0.0, 0.0, 1.0));
|
||||||
})");
|
})");
|
||||||
|
|
||||||
utils::ComboRenderPipelineDescriptor2 descriptor;
|
utils::ComboRenderPipelineDescriptor2 descriptor;
|
||||||
|
@ -804,7 +804,7 @@ TEST_P(D3D12DescriptorHeapTests, EncodeManyUBOAndSamplers) {
|
|||||||
[[group(0), binding(3)]] var<uniform> buffer0 : U;
|
[[group(0), binding(3)]] var<uniform> buffer0 : U;
|
||||||
|
|
||||||
[[stage(fragment)]] fn main(
|
[[stage(fragment)]] fn main(
|
||||||
[[builtin(frag_coord)]] FragCoord : vec4<f32>
|
[[builtin(position)]] FragCoord : vec4<f32>
|
||||||
) -> [[location(0)]] vec4<f32> {
|
) -> [[location(0)]] vec4<f32> {
|
||||||
return textureSample(texture0, sampler0, FragCoord.xy) + buffer0.color;
|
return textureSample(texture0, sampler0, FragCoord.xy) + buffer0.color;
|
||||||
})");
|
})");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user