mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-07-05 12:46:11 +00:00
Remove explicit storage class from samplers/textures
Tint automatically infers a storage class of `handle` for these types of variable, as per the WGSL spec. Explicitly specifying a storage class for them will soon become an error. Bug: tint:332 Change-Id: Ib67e44a5afcdd364470488fd4b456a2b42304daa Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/41402 Commit-Queue: Austin Eng <enga@chromium.org> Auto-Submit: James Price <jrprice@google.com> Reviewed-by: Austin Eng <enga@chromium.org>
This commit is contained in:
parent
b417919516
commit
7e80cce1a9
@ -104,8 +104,8 @@ void init() {
|
|||||||
|
|
||||||
wgpu::ShaderModule fsModule = utils::CreateShaderModuleFromWGSL(device, R"(
|
wgpu::ShaderModule fsModule = utils::CreateShaderModuleFromWGSL(device, R"(
|
||||||
[[builtin(frag_coord)]] var<in> FragCoord : vec4<f32>;
|
[[builtin(frag_coord)]] var<in> FragCoord : vec4<f32>;
|
||||||
[[group(0), binding(0)]] var<uniform_constant> mySampler: sampler;
|
[[group(0), binding(0)]] var mySampler: sampler;
|
||||||
[[group(0), binding(1)]] var<uniform_constant> myTexture : texture_2d<f32>;
|
[[group(0), binding(1)]] var myTexture : texture_2d<f32>;
|
||||||
|
|
||||||
[[location(0)]] var<out> FragColor : vec4<f32>;
|
[[location(0)]] var<out> FragColor : vec4<f32>;
|
||||||
[[stage(fragment)]] fn main() -> void {
|
[[stage(fragment)]] fn main() -> void {
|
||||||
|
@ -57,8 +57,8 @@ namespace dawn_native {
|
|||||||
)";
|
)";
|
||||||
|
|
||||||
static const char sPassthrough2D4ChannelFrag[] = R"(
|
static const char sPassthrough2D4ChannelFrag[] = R"(
|
||||||
[[binding(1), group(0)]] var<uniform_constant> mySampler: sampler;
|
[[binding(1), group(0)]] var mySampler: sampler;
|
||||||
[[binding(2), group(0)]] var<uniform_constant> myTexture: texture_2d<f32>;
|
[[binding(2), group(0)]] var myTexture: texture_2d<f32>;
|
||||||
[[location(0)]] var<in> v_texcoord : vec2<f32>;
|
[[location(0)]] var<in> v_texcoord : vec2<f32>;
|
||||||
[[location(0)]] var<out> rgbaColor : vec4<f32>;
|
[[location(0)]] var<out> rgbaColor : vec4<f32>;
|
||||||
[[stage(fragment)]] fn main() -> void {
|
[[stage(fragment)]] fn main() -> void {
|
||||||
|
@ -268,8 +268,8 @@ TEST_P(BindGroupTests, UBOSamplerAndTexture) {
|
|||||||
})");
|
})");
|
||||||
|
|
||||||
wgpu::ShaderModule fsModule = utils::CreateShaderModuleFromWGSL(device, R"(
|
wgpu::ShaderModule fsModule = utils::CreateShaderModuleFromWGSL(device, R"(
|
||||||
[[group(0), binding(1)]] var <uniform_constant> samp : sampler;
|
[[group(0), binding(1)]] var samp : sampler;
|
||||||
[[group(0), binding(2)]] var <uniform_constant> tex : texture_2d<f32>;
|
[[group(0), binding(2)]] var tex : texture_2d<f32>;
|
||||||
[[builtin(frag_coord)]] var<in> FragCoord : vec4<f32>;
|
[[builtin(frag_coord)]] var<in> FragCoord : vec4<f32>;
|
||||||
|
|
||||||
[[location(0)]] var<out> fragColor : vec4<f32>;
|
[[location(0)]] var<out> fragColor : vec4<f32>;
|
||||||
@ -1218,12 +1218,12 @@ TEST_P(BindGroupTests, ReallyLargeBindGroup) {
|
|||||||
bgEntries.push_back({binding, nullptr, 0, 0, nullptr, texture.CreateView()});
|
bgEntries.push_back({binding, nullptr, 0, 0, nullptr, texture.CreateView()});
|
||||||
|
|
||||||
interface << "[[group(0), binding(" << binding++ << ")]] "
|
interface << "[[group(0), binding(" << binding++ << ")]] "
|
||||||
<< "var<uniform_constant> tex" << i << " : texture_2d<f32>;\n";
|
<< "var tex" << i << " : texture_2d<f32>;\n";
|
||||||
|
|
||||||
bgEntries.push_back({binding, nullptr, 0, 0, device.CreateSampler(), nullptr});
|
bgEntries.push_back({binding, nullptr, 0, 0, device.CreateSampler(), nullptr});
|
||||||
|
|
||||||
interface << "[[group(0), binding(" << binding++ << ")]]"
|
interface << "[[group(0), binding(" << binding++ << ")]]"
|
||||||
<< "var<uniform_constant> samp" << i << " : sampler;\n";
|
<< "var samp" << i << " : sampler;\n";
|
||||||
|
|
||||||
body << "if (abs(textureSampleLevel(tex" << i << ", samp" << i
|
body << "if (abs(textureSampleLevel(tex" << i << ", samp" << i
|
||||||
<< ", vec2<f32>(0.5, 0.5), 0.0).r - " << expectedValue++
|
<< ", vec2<f32>(0.5, 0.5), 0.0).r - " << expectedValue++
|
||||||
@ -1237,8 +1237,7 @@ TEST_P(BindGroupTests, ReallyLargeBindGroup) {
|
|||||||
bgEntries.push_back({binding, nullptr, 0, 0, nullptr, texture.CreateView()});
|
bgEntries.push_back({binding, nullptr, 0, 0, nullptr, texture.CreateView()});
|
||||||
|
|
||||||
interface << "[[group(0), binding(" << binding++ << ")]] "
|
interface << "[[group(0), binding(" << binding++ << ")]] "
|
||||||
<< "var<uniform_constant> image" << i
|
<< "var image" << i << " : [[access(read)]] texture_storage_2d<r32uint>;\n";
|
||||||
<< " : [[access(read)]] texture_storage_2d<r32uint>;\n";
|
|
||||||
|
|
||||||
body << "if (textureLoad(image" << i << ", vec2<i32>(0, 0)).r != " << expectedValue++
|
body << "if (textureLoad(image" << i << ", vec2<i32>(0, 0)).r != " << expectedValue++
|
||||||
<< "u) {\n";
|
<< "u) {\n";
|
||||||
|
@ -156,8 +156,8 @@ class CompressedTextureBCFormatTest : public DawnTest {
|
|||||||
return;
|
return;
|
||||||
})");
|
})");
|
||||||
wgpu::ShaderModule fsModule = utils::CreateShaderModuleFromWGSL(device, R"(
|
wgpu::ShaderModule fsModule = utils::CreateShaderModuleFromWGSL(device, R"(
|
||||||
[[group(0), binding(0)]] var<uniform_constant> sampler0 : sampler;
|
[[group(0), binding(0)]] var sampler0 : sampler;
|
||||||
[[group(0), binding(1)]] var<uniform_constant> texture0 : texture_2d<f32>;
|
[[group(0), binding(1)]] var texture0 : texture_2d<f32>;
|
||||||
|
|
||||||
[[location(0)]] var<in> texCoord : vec2<f32>;
|
[[location(0)]] var<in> texCoord : vec2<f32>;
|
||||||
[[location(0)]] var<out> fragColor : vec4<f32>;
|
[[location(0)]] var<out> fragColor : vec4<f32>;
|
||||||
|
@ -270,8 +270,8 @@ TEST_P(D3D12VideoViewsTests, NV12SampleYtoR) {
|
|||||||
renderPipelineDescriptor.vertexStage.module = GetTestVertexShaderModule();
|
renderPipelineDescriptor.vertexStage.module = GetTestVertexShaderModule();
|
||||||
|
|
||||||
renderPipelineDescriptor.cFragmentStage.module = utils::CreateShaderModuleFromWGSL(device, R"(
|
renderPipelineDescriptor.cFragmentStage.module = utils::CreateShaderModuleFromWGSL(device, R"(
|
||||||
[[set(0), binding(0)]] var<uniform_constant> sampler0 : sampler;
|
[[set(0), binding(0)]] var sampler0 : sampler;
|
||||||
[[set(0), binding(1)]] var<uniform_constant> texture : texture_2d<f32>;
|
[[set(0), binding(1)]] var texture : texture_2d<f32>;
|
||||||
|
|
||||||
[[location(0)]] var<in> texCoord : vec2<f32>;
|
[[location(0)]] var<in> texCoord : vec2<f32>;
|
||||||
[[location(0)]] var<out> fragColor : vec4<f32>;
|
[[location(0)]] var<out> fragColor : vec4<f32>;
|
||||||
@ -321,8 +321,8 @@ TEST_P(D3D12VideoViewsTests, NV12SampleUVtoRG) {
|
|||||||
renderPipelineDescriptor.vertexStage.module = GetTestVertexShaderModule();
|
renderPipelineDescriptor.vertexStage.module = GetTestVertexShaderModule();
|
||||||
|
|
||||||
renderPipelineDescriptor.cFragmentStage.module = utils::CreateShaderModuleFromWGSL(device, R"(
|
renderPipelineDescriptor.cFragmentStage.module = utils::CreateShaderModuleFromWGSL(device, R"(
|
||||||
[[set(0), binding(0)]] var<uniform_constant> sampler0 : sampler;
|
[[set(0), binding(0)]] var sampler0 : sampler;
|
||||||
[[set(0), binding(1)]] var<uniform_constant> texture : texture_2d<f32>;
|
[[set(0), binding(1)]] var texture : texture_2d<f32>;
|
||||||
|
|
||||||
[[location(0)]] var<in> texCoord : vec2<f32>;
|
[[location(0)]] var<in> texCoord : vec2<f32>;
|
||||||
[[location(0)]] var<out> fragColor : vec4<f32>;
|
[[location(0)]] var<out> fragColor : vec4<f32>;
|
||||||
@ -377,9 +377,9 @@ TEST_P(D3D12VideoViewsTests, NV12SampleYUVtoRGB) {
|
|||||||
renderPipelineDescriptor.vertexStage.module = GetTestVertexShaderModule();
|
renderPipelineDescriptor.vertexStage.module = GetTestVertexShaderModule();
|
||||||
|
|
||||||
renderPipelineDescriptor.cFragmentStage.module = utils::CreateShaderModuleFromWGSL(device, R"(
|
renderPipelineDescriptor.cFragmentStage.module = utils::CreateShaderModuleFromWGSL(device, R"(
|
||||||
[[set(0), binding(0)]] var<uniform_constant> sampler0 : sampler;
|
[[set(0), binding(0)]] var sampler0 : sampler;
|
||||||
[[set(0), binding(1)]] var<uniform_constant> lumaTexture : texture_2d<f32>;
|
[[set(0), binding(1)]] var lumaTexture : texture_2d<f32>;
|
||||||
[[set(0), binding(2)]] var<uniform_constant> chromaTexture : texture_2d<f32>;
|
[[set(0), binding(2)]] var chromaTexture : texture_2d<f32>;
|
||||||
|
|
||||||
[[location(0)]] var<in> texCoord : vec2<f32>;
|
[[location(0)]] var<in> texCoord : vec2<f32>;
|
||||||
[[location(0)]] var<out> fragColor : vec4<f32>;
|
[[location(0)]] var<out> fragColor : vec4<f32>;
|
||||||
|
@ -253,7 +253,7 @@ class DepthStencilCopyTests : public DawnTest {
|
|||||||
// Sample the input texture and write out depth. |result| will only be set to 1 if we
|
// Sample the input texture and write out depth. |result| will only be set to 1 if we
|
||||||
// pass the depth test.
|
// pass the depth test.
|
||||||
pipelineDescriptor.cFragmentStage.module = utils::CreateShaderModuleFromWGSL(device, R"(
|
pipelineDescriptor.cFragmentStage.module = utils::CreateShaderModuleFromWGSL(device, R"(
|
||||||
[[group(0), binding(0)]] var<uniform_constant> texture0 : texture_2d<f32>;
|
[[group(0), binding(0)]] var texture0 : texture_2d<f32>;
|
||||||
[[builtin(frag_coord)]] var<in> FragCoord : vec4<f32>;
|
[[builtin(frag_coord)]] var<in> FragCoord : vec4<f32>;
|
||||||
|
|
||||||
[[location(0)]] var<out> result : u32;
|
[[location(0)]] var<out> result : u32;
|
||||||
|
@ -80,8 +80,7 @@ class DepthStencilSamplingTest : public DawnTest {
|
|||||||
for (TestAspect aspect : aspects) {
|
for (TestAspect aspect : aspects) {
|
||||||
switch (aspect) {
|
switch (aspect) {
|
||||||
case TestAspect::Depth:
|
case TestAspect::Depth:
|
||||||
shaderSource << "[[group(0), binding(" << index
|
shaderSource << "[[group(0), binding(" << index << ")]] var tex" << index
|
||||||
<< ")]] var<uniform_constant> tex" << index
|
|
||||||
<< " : texture_2d<f32>;\n";
|
<< " : texture_2d<f32>;\n";
|
||||||
|
|
||||||
shaderSource << "[[location(" << index << ")]] var<out> result" << index
|
shaderSource << "[[location(" << index << ")]] var<out> result" << index
|
||||||
@ -92,8 +91,7 @@ class DepthStencilSamplingTest : public DawnTest {
|
|||||||
pipelineDescriptor.cColorStates[index].format = wgpu::TextureFormat::R32Float;
|
pipelineDescriptor.cColorStates[index].format = wgpu::TextureFormat::R32Float;
|
||||||
break;
|
break;
|
||||||
case TestAspect::Stencil:
|
case TestAspect::Stencil:
|
||||||
shaderSource << "[[group(0), binding(" << index
|
shaderSource << "[[group(0), binding(" << index << ")]] var tex" << index
|
||||||
<< ")]] var<uniform_constant> tex" << index
|
|
||||||
<< " : texture_2d<u32>;\n";
|
<< " : texture_2d<u32>;\n";
|
||||||
|
|
||||||
shaderSource << "[[location(" << index << ")]] var<out> result" << index
|
shaderSource << "[[location(" << index << ")]] var<out> result" << index
|
||||||
@ -137,8 +135,7 @@ class DepthStencilSamplingTest : public DawnTest {
|
|||||||
for (TestAspect aspect : aspects) {
|
for (TestAspect aspect : aspects) {
|
||||||
switch (aspect) {
|
switch (aspect) {
|
||||||
case TestAspect::Depth:
|
case TestAspect::Depth:
|
||||||
shaderSource << "[[group(0), binding(" << 2 * index
|
shaderSource << "[[group(0), binding(" << 2 * index << ")]] var tex" << index
|
||||||
<< ")]] var<uniform_constant> tex" << index
|
|
||||||
<< " : texture_2d<f32>;\n";
|
<< " : texture_2d<f32>;\n";
|
||||||
|
|
||||||
shaderSource << "[[group(0), binding(" << 2 * index + 1
|
shaderSource << "[[group(0), binding(" << 2 * index + 1
|
||||||
@ -149,8 +146,7 @@ class DepthStencilSamplingTest : public DawnTest {
|
|||||||
<< ", vec2<i32>(0, 0), 0)[" << componentIndex << "];";
|
<< ", vec2<i32>(0, 0), 0)[" << componentIndex << "];";
|
||||||
break;
|
break;
|
||||||
case TestAspect::Stencil:
|
case TestAspect::Stencil:
|
||||||
shaderSource << "[[group(0), binding(" << 2 * index
|
shaderSource << "[[group(0), binding(" << 2 * index << ")]] var tex" << index
|
||||||
<< ")]] var<uniform_constant> tex" << index
|
|
||||||
<< " : texture_2d<u32>;\n";
|
<< " : texture_2d<u32>;\n";
|
||||||
|
|
||||||
shaderSource << "[[group(0), binding(" << 2 * index + 1
|
shaderSource << "[[group(0), binding(" << 2 * index + 1
|
||||||
@ -185,8 +181,8 @@ class DepthStencilSamplingTest : public DawnTest {
|
|||||||
})");
|
})");
|
||||||
|
|
||||||
wgpu::ShaderModule fsModule = utils::CreateShaderModuleFromWGSL(device, R"(
|
wgpu::ShaderModule fsModule = utils::CreateShaderModuleFromWGSL(device, R"(
|
||||||
[[group(0), binding(0)]] var<uniform_constant> samp : sampler_comparison;
|
[[group(0), binding(0)]] var samp : sampler_comparison;
|
||||||
[[group(0), binding(1)]] var<uniform_constant> tex : texture_depth_2d;
|
[[group(0), binding(1)]] var tex : texture_depth_2d;
|
||||||
[[block]] struct Uniforms {
|
[[block]] struct Uniforms {
|
||||||
[[offset(0)]] compareRef : f32;
|
[[offset(0)]] compareRef : f32;
|
||||||
};
|
};
|
||||||
@ -217,8 +213,8 @@ class DepthStencilSamplingTest : public DawnTest {
|
|||||||
|
|
||||||
wgpu::ComputePipeline CreateComparisonComputePipeline() {
|
wgpu::ComputePipeline CreateComparisonComputePipeline() {
|
||||||
wgpu::ShaderModule csModule = utils::CreateShaderModuleFromWGSL(device, R"(
|
wgpu::ShaderModule csModule = utils::CreateShaderModuleFromWGSL(device, R"(
|
||||||
[[group(0), binding(0)]] var<uniform_constant> samp : sampler_comparison;
|
[[group(0), binding(0)]] var samp : sampler_comparison;
|
||||||
[[group(0), binding(1)]] var<uniform_constant> tex : texture_depth_2d;
|
[[group(0), binding(1)]] var tex : texture_depth_2d;
|
||||||
[[block]] struct Uniforms {
|
[[block]] struct Uniforms {
|
||||||
[[offset(0)]] compareRef : f32;
|
[[offset(0)]] compareRef : f32;
|
||||||
};
|
};
|
||||||
|
@ -258,8 +258,8 @@ TEST_P(GpuMemorySyncTests, SampledAndROStorageTextureInComputePass) {
|
|||||||
[[offset(4)]] storageOut: u32;
|
[[offset(4)]] storageOut: u32;
|
||||||
};
|
};
|
||||||
[[group(0), binding(0)]] var<storage_buffer> output : [[access(write)]] Output;
|
[[group(0), binding(0)]] var<storage_buffer> output : [[access(write)]] Output;
|
||||||
[[group(0), binding(1)]] var<uniform_constant> sampledTex : texture_2d<u32>;
|
[[group(0), binding(1)]] var sampledTex : texture_2d<u32>;
|
||||||
[[group(0), binding(2)]] var<uniform_constant> storageTex : [[access(read)]] texture_storage_2d<r32uint>;
|
[[group(0), binding(2)]] var storageTex : [[access(read)]] texture_storage_2d<r32uint>;
|
||||||
|
|
||||||
[[stage(compute)]] fn main() -> void {
|
[[stage(compute)]] fn main() -> void {
|
||||||
output.sampledOut = textureLoad(sampledTex, vec2<i32>(0, 0), 0).x;
|
output.sampledOut = textureLoad(sampledTex, vec2<i32>(0, 0), 0).x;
|
||||||
|
@ -274,8 +274,8 @@ class IOSurfaceUsageTests : public IOSurfaceTestBase {
|
|||||||
}
|
}
|
||||||
)");
|
)");
|
||||||
wgpu::ShaderModule fs = utils::CreateShaderModuleFromWGSL(device, R"(
|
wgpu::ShaderModule fs = utils::CreateShaderModuleFromWGSL(device, R"(
|
||||||
[[group(0), binding(0)]] var<uniform_constant> sampler0 : sampler;
|
[[group(0), binding(0)]] var sampler0 : sampler;
|
||||||
[[group(0), binding(1)]] var<uniform_constant> texture0 : texture_2d<f32>;
|
[[group(0), binding(1)]] var texture0 : texture_2d<f32>;
|
||||||
|
|
||||||
[[location(0)]] var<in> texCoord : vec2<f32>;
|
[[location(0)]] var<in> texCoord : vec2<f32>;
|
||||||
[[location(0)]] var<out> fragColor : vec4<f32>;
|
[[location(0)]] var<out> fragColor : vec4<f32>;
|
||||||
|
@ -90,8 +90,8 @@ class MultisampledSamplingTest : public DawnTest {
|
|||||||
wgpu::ComputePipelineDescriptor desc = {};
|
wgpu::ComputePipelineDescriptor desc = {};
|
||||||
desc.computeStage.entryPoint = "main";
|
desc.computeStage.entryPoint = "main";
|
||||||
desc.computeStage.module = utils::CreateShaderModuleFromWGSL(device, R"(
|
desc.computeStage.module = utils::CreateShaderModuleFromWGSL(device, R"(
|
||||||
[[group(0), binding(0)]] var<uniform_constant> texture0 : texture_multisampled_2d<f32>;
|
[[group(0), binding(0)]] var texture0 : texture_multisampled_2d<f32>;
|
||||||
[[group(0), binding(1)]] var<uniform_constant> texture1 : texture_multisampled_2d<f32>;
|
[[group(0), binding(1)]] var texture1 : texture_multisampled_2d<f32>;
|
||||||
|
|
||||||
[[block]] struct Results {
|
[[block]] struct Results {
|
||||||
[[offset(0)]] colorSamples : [[stride(4)]] array<f32, 4>;
|
[[offset(0)]] colorSamples : [[stride(4)]] array<f32, 4>;
|
||||||
|
@ -56,8 +56,8 @@ class SamplerFilterAnisotropicTest : public DawnTest {
|
|||||||
}
|
}
|
||||||
)");
|
)");
|
||||||
wgpu::ShaderModule fsModule = utils::CreateShaderModuleFromWGSL(device, R"(
|
wgpu::ShaderModule fsModule = utils::CreateShaderModuleFromWGSL(device, R"(
|
||||||
[[group(0), binding(0)]] var<uniform_constant> sampler0 : sampler;
|
[[group(0), binding(0)]] var sampler0 : sampler;
|
||||||
[[group(0), binding(1)]] var<uniform_constant> texture0 : texture_2d<f32>;
|
[[group(0), binding(1)]] var texture0 : texture_2d<f32>;
|
||||||
|
|
||||||
[[builtin(frag_coord)]] var<in> FragCoord : vec4<f32>;
|
[[builtin(frag_coord)]] var<in> FragCoord : vec4<f32>;
|
||||||
|
|
||||||
|
@ -70,8 +70,8 @@ class SamplerTest : public DawnTest {
|
|||||||
}
|
}
|
||||||
)");
|
)");
|
||||||
auto fsModule = utils::CreateShaderModuleFromWGSL(device, R"(
|
auto fsModule = utils::CreateShaderModuleFromWGSL(device, R"(
|
||||||
[[group(0), binding(0)]] var<uniform_constant> sampler0 : sampler;
|
[[group(0), binding(0)]] var sampler0 : sampler;
|
||||||
[[group(0), binding(1)]] var<uniform_constant> texture0 : texture_2d<f32>;
|
[[group(0), binding(1)]] var texture0 : texture_2d<f32>;
|
||||||
|
|
||||||
[[builtin(frag_coord)]] var<in> FragCoord : vec4<f32>;
|
[[builtin(frag_coord)]] var<in> FragCoord : vec4<f32>;
|
||||||
|
|
||||||
|
@ -166,7 +166,7 @@ class StorageTextureTests : public DawnTest {
|
|||||||
uint32_t binding) {
|
uint32_t binding) {
|
||||||
std::ostringstream ostream;
|
std::ostringstream ostream;
|
||||||
ostream << "[[group(0), binding(" << binding << ")]] "
|
ostream << "[[group(0), binding(" << binding << ")]] "
|
||||||
<< "var<uniform_constant> storageImage" << binding << " : "
|
<< "var storageImage" << binding << " : "
|
||||||
<< "[[access(" << accessQualifier << ")]] "
|
<< "[[access(" << accessQualifier << ")]] "
|
||||||
<< "texture_storage_2d";
|
<< "texture_storage_2d";
|
||||||
if (is2DArray) {
|
if (is2DArray) {
|
||||||
@ -983,8 +983,8 @@ TEST_P(StorageTextureTests, ReadonlyAndWriteonlyStorageTexturePingPong) {
|
|||||||
kTextureFormat, wgpu::TextureUsage::Storage | wgpu::TextureUsage::CopySrc, 1u, 1u);
|
kTextureFormat, wgpu::TextureUsage::Storage | wgpu::TextureUsage::CopySrc, 1u, 1u);
|
||||||
|
|
||||||
wgpu::ShaderModule module = utils::CreateShaderModuleFromWGSL(device, R"(
|
wgpu::ShaderModule module = utils::CreateShaderModuleFromWGSL(device, R"(
|
||||||
[[group(0), binding(0)]] var<uniform_constant> Src : [[access(read)]] texture_storage_2d<r32uint>;
|
[[group(0), binding(0)]] var Src : [[access(read)]] texture_storage_2d<r32uint>;
|
||||||
[[group(0), binding(1)]] var<uniform_constant> Dst : [[access(write)]] texture_storage_2d<r32uint>;
|
[[group(0), binding(1)]] var Dst : [[access(write)]] texture_storage_2d<r32uint>;
|
||||||
[[stage(compute)]] fn main() -> void {
|
[[stage(compute)]] fn main() -> void {
|
||||||
var srcValue : vec4<u32> = textureLoad(Src, vec2<i32>(0, 0));
|
var srcValue : vec4<u32> = textureLoad(Src, vec2<i32>(0, 0));
|
||||||
srcValue.x = srcValue.x + 1u;
|
srcValue.x = srcValue.x + 1u;
|
||||||
@ -1057,8 +1057,8 @@ TEST_P(StorageTextureTests, SampledAndWriteonlyStorageTexturePingPong) {
|
|||||||
wgpu::Texture storageTexture2 = CreateTexture(
|
wgpu::Texture storageTexture2 = CreateTexture(
|
||||||
kTextureFormat, wgpu::TextureUsage::Sampled | wgpu::TextureUsage::Storage, 1u, 1u);
|
kTextureFormat, wgpu::TextureUsage::Sampled | wgpu::TextureUsage::Storage, 1u, 1u);
|
||||||
wgpu::ShaderModule module = utils::CreateShaderModuleFromWGSL(device, R"(
|
wgpu::ShaderModule module = utils::CreateShaderModuleFromWGSL(device, R"(
|
||||||
[[group(0), binding(0)]] var<uniform_constant> Src : texture_2d<u32>;
|
[[group(0), binding(0)]] var Src : texture_2d<u32>;
|
||||||
[[group(0), binding(1)]] var<uniform_constant> Dst : [[access(write)]] texture_storage_2d<r32uint>;
|
[[group(0), binding(1)]] var Dst : [[access(write)]] texture_storage_2d<r32uint>;
|
||||||
[[stage(compute)]] fn main() -> void {
|
[[stage(compute)]] fn main() -> void {
|
||||||
var srcValue : vec4<u32> = textureLoad(Src, vec2<i32>(0, 0));
|
var srcValue : vec4<u32> = textureLoad(Src, vec2<i32>(0, 0));
|
||||||
srcValue.x = srcValue.x + 1u;
|
srcValue.x = srcValue.x + 1u;
|
||||||
@ -1156,13 +1156,13 @@ fn doTest() -> bool {
|
|||||||
})";
|
})";
|
||||||
|
|
||||||
const char* kCommonWriteOnlyZeroInitTestCodeFragment = R"(
|
const char* kCommonWriteOnlyZeroInitTestCodeFragment = R"(
|
||||||
[[group(0), binding(0)]] var<uniform_constant> dstImage : [[access(write)]] texture_storage_2d<r32uint>;
|
[[group(0), binding(0)]] var dstImage : [[access(write)]] texture_storage_2d<r32uint>;
|
||||||
|
|
||||||
[[stage(fragment)]] fn main() -> void {
|
[[stage(fragment)]] fn main() -> void {
|
||||||
textureStore(dstImage, vec2<i32>(0, 0), vec4<u32>(1u, 0u, 0u, 1u));
|
textureStore(dstImage, vec2<i32>(0, 0), vec4<u32>(1u, 0u, 0u, 1u));
|
||||||
})";
|
})";
|
||||||
const char* kCommonWriteOnlyZeroInitTestCodeCompute = R"(
|
const char* kCommonWriteOnlyZeroInitTestCodeCompute = R"(
|
||||||
[[group(0), binding(0)]] var<uniform_constant> dstImage : [[access(write)]] texture_storage_2d<r32uint>;
|
[[group(0), binding(0)]] var dstImage : [[access(write)]] texture_storage_2d<r32uint>;
|
||||||
|
|
||||||
[[stage(compute)]] fn main() -> void {
|
[[stage(compute)]] fn main() -> void {
|
||||||
textureStore(dstImage, vec2<i32>(0, 0), vec4<u32>(1u, 0u, 0u, 1u));
|
textureStore(dstImage, vec2<i32>(0, 0), vec4<u32>(1u, 0u, 0u, 1u));
|
||||||
@ -1179,7 +1179,7 @@ TEST_P(StorageTextureZeroInitTests, ReadonlyStorageTextureClearsToZeroInRenderPa
|
|||||||
// green as the output color, otherwise uses red instead.
|
// green as the output color, otherwise uses red instead.
|
||||||
const char* kVertexShader = kSimpleVertexShader;
|
const char* kVertexShader = kSimpleVertexShader;
|
||||||
const std::string kFragmentShader = std::string(R"(
|
const std::string kFragmentShader = std::string(R"(
|
||||||
[[group(0), binding(0)]] var<uniform_constant> srcImage : [[access(read)]] texture_storage_2d<r32uint>;
|
[[group(0), binding(0)]] var srcImage : [[access(read)]] texture_storage_2d<r32uint>;
|
||||||
[[location(0)]] var<out> o_color : vec4<f32>;
|
[[location(0)]] var<out> o_color : vec4<f32>;
|
||||||
)") + kCommonReadOnlyZeroInitTestCode +
|
)") + kCommonReadOnlyZeroInitTestCode +
|
||||||
R"(
|
R"(
|
||||||
@ -1206,7 +1206,7 @@ TEST_P(StorageTextureZeroInitTests, ReadonlyStorageTextureClearsToZeroInComputeP
|
|||||||
[[offset(0)]] result : u32;
|
[[offset(0)]] result : u32;
|
||||||
};
|
};
|
||||||
|
|
||||||
[[group(0), binding(0)]] var<uniform_constant> srcImage : [[access(read)]] texture_storage_2d<r32uint>;
|
[[group(0), binding(0)]] var srcImage : [[access(read)]] texture_storage_2d<r32uint>;
|
||||||
[[group(0), binding(1)]] var<storage_buffer> dstBuffer : DstBuffer;
|
[[group(0), binding(1)]] var<storage_buffer> dstBuffer : DstBuffer;
|
||||||
)") + kCommonReadOnlyZeroInitTestCode + R"(
|
)") + kCommonReadOnlyZeroInitTestCode + R"(
|
||||||
[[stage(compute)]] fn main() -> void {
|
[[stage(compute)]] fn main() -> void {
|
||||||
|
@ -163,8 +163,7 @@ class TextureFormatTest : public DawnTest {
|
|||||||
const char* type = utils::GetWGSLColorTextureComponentType(sampleFormatInfo.format);
|
const char* type = utils::GetWGSLColorTextureComponentType(sampleFormatInfo.format);
|
||||||
|
|
||||||
std::ostringstream fsSource;
|
std::ostringstream fsSource;
|
||||||
fsSource << "[[group(0), binding(0)]] var<uniform_constant> myTexture : texture_2d<" << type
|
fsSource << "[[group(0), binding(0)]] var myTexture : texture_2d<" << type << ">;\n";
|
||||||
<< ">;\n";
|
|
||||||
fsSource << "[[builtin(frag_coord)]] var<in> FragCoord : vec4<f32>;\n";
|
fsSource << "[[builtin(frag_coord)]] var<in> FragCoord : vec4<f32>;\n";
|
||||||
fsSource << "[[location(0)]] var<out> fragColor : vec4<" << type << ">;\n";
|
fsSource << "[[location(0)]] var<out> fragColor : vec4<" << type << ">;\n";
|
||||||
fsSource << "[[stage(fragment)]] fn main() -> void {\n";
|
fsSource << "[[stage(fragment)]] fn main() -> void {\n";
|
||||||
|
@ -106,8 +106,8 @@ class TextureSubresourceTest : public DawnTest {
|
|||||||
})");
|
})");
|
||||||
|
|
||||||
wgpu::ShaderModule fsModule = utils::CreateShaderModuleFromWGSL(device, R"(
|
wgpu::ShaderModule fsModule = utils::CreateShaderModuleFromWGSL(device, R"(
|
||||||
[[group(0), binding(0)]] var<uniform_constant> samp : sampler;
|
[[group(0), binding(0)]] var samp : sampler;
|
||||||
[[group(0), binding(1)]] var<uniform_constant> tex : texture_2d<f32>;
|
[[group(0), binding(1)]] var tex : texture_2d<f32>;
|
||||||
|
|
||||||
[[builtin(frag_coord)]] var<in> FragCoord : vec4<f32>;
|
[[builtin(frag_coord)]] var<in> FragCoord : vec4<f32>;
|
||||||
|
|
||||||
|
@ -78,7 +78,7 @@ class SubresourceTrackingPerf : public DawnPerfTestWithParams<SubresourceTrackin
|
|||||||
)");
|
)");
|
||||||
pipelineDesc.cFragmentStage.module = utils::CreateShaderModuleFromWGSL(device, R"(
|
pipelineDesc.cFragmentStage.module = utils::CreateShaderModuleFromWGSL(device, R"(
|
||||||
[[location(0)]] var<out> FragColor : vec4<f32>;
|
[[location(0)]] var<out> FragColor : vec4<f32>;
|
||||||
[[group(0), binding(0)]] var<uniform_constant> materials : texture_2d<f32>;
|
[[group(0), binding(0)]] var materials : texture_2d<f32>;
|
||||||
[[stage(fragment)]] fn main() -> void {
|
[[stage(fragment)]] fn main() -> void {
|
||||||
FragColor = vec4<f32>(1.0, 0.0, 0.0, 1.0);
|
FragColor = vec4<f32>(1.0, 0.0, 0.0, 1.0);
|
||||||
}
|
}
|
||||||
|
@ -1787,11 +1787,11 @@ TEST_F(BindGroupLayoutCompatibilityTest, ROStorageInBGLWithRWStorageInShader) {
|
|||||||
|
|
||||||
TEST_F(BindGroupLayoutCompatibilityTest, TextureViewDimension) {
|
TEST_F(BindGroupLayoutCompatibilityTest, TextureViewDimension) {
|
||||||
constexpr char kTexture2DShaderFS[] = R"(
|
constexpr char kTexture2DShaderFS[] = R"(
|
||||||
[[group(0), binding(0)]] var<uniform_constant> myTexture : texture_2d<f32>;
|
[[group(0), binding(0)]] var myTexture : texture_2d<f32>;
|
||||||
[[stage(fragment)]] fn main() -> void {
|
[[stage(fragment)]] fn main() -> void {
|
||||||
})";
|
})";
|
||||||
constexpr char kTexture2DShaderCS[] = R"(
|
constexpr char kTexture2DShaderCS[] = R"(
|
||||||
[[group(0), binding(0)]] var<uniform_constant> myTexture : texture_2d<f32>;
|
[[group(0), binding(0)]] var myTexture : texture_2d<f32>;
|
||||||
[[stage(compute)]] fn main() -> void {
|
[[stage(compute)]] fn main() -> void {
|
||||||
})";
|
})";
|
||||||
|
|
||||||
@ -1824,11 +1824,11 @@ TEST_F(BindGroupLayoutCompatibilityTest, TextureViewDimension) {
|
|||||||
wgpu::TextureViewDimension::e2DArray}})}));
|
wgpu::TextureViewDimension::e2DArray}})}));
|
||||||
|
|
||||||
constexpr char kTexture2DArrayShaderFS[] = R"(
|
constexpr char kTexture2DArrayShaderFS[] = R"(
|
||||||
[[group(0), binding(0)]] var<uniform_constant> myTexture : texture_2d_array<f32>;
|
[[group(0), binding(0)]] var myTexture : texture_2d_array<f32>;
|
||||||
[[stage(fragment)]] fn main() -> void {
|
[[stage(fragment)]] fn main() -> void {
|
||||||
})";
|
})";
|
||||||
constexpr char kTexture2DArrayShaderCS[] = R"(
|
constexpr char kTexture2DArrayShaderCS[] = R"(
|
||||||
[[group(0), binding(0)]] var<uniform_constant> myTexture : texture_2d_array<f32>;
|
[[group(0), binding(0)]] var myTexture : texture_2d_array<f32>;
|
||||||
[[stage(compute)]] fn main() -> void {
|
[[stage(compute)]] fn main() -> void {
|
||||||
})";
|
})";
|
||||||
|
|
||||||
@ -2077,7 +2077,7 @@ TEST_F(ComparisonSamplerBindingTest, DISABLED_ShaderAndBGLMatches) {
|
|||||||
device, {{0, wgpu::ShaderStage::Fragment, wgpu::SamplerBindingType::Filtering}});
|
device, {{0, wgpu::ShaderStage::Fragment, wgpu::SamplerBindingType::Filtering}});
|
||||||
|
|
||||||
CreateFragmentPipeline(&bindGroupLayout, R"(
|
CreateFragmentPipeline(&bindGroupLayout, R"(
|
||||||
[[group(0), binding(0)]] var<uniform_constant> mySampler: sampler;
|
[[group(0), binding(0)]] var mySampler: sampler;
|
||||||
[[stage(fragment)]] fn main() -> void {
|
[[stage(fragment)]] fn main() -> void {
|
||||||
})");
|
})");
|
||||||
}
|
}
|
||||||
@ -2088,7 +2088,7 @@ TEST_F(ComparisonSamplerBindingTest, DISABLED_ShaderAndBGLMatches) {
|
|||||||
device, {{0, wgpu::ShaderStage::Fragment, wgpu::SamplerBindingType::Comparison}});
|
device, {{0, wgpu::ShaderStage::Fragment, wgpu::SamplerBindingType::Comparison}});
|
||||||
|
|
||||||
CreateFragmentPipeline(&bindGroupLayout, R"(
|
CreateFragmentPipeline(&bindGroupLayout, R"(
|
||||||
[[group(0), binding(0)]] var<uniform_constant> mySampler: sampler_comparison;
|
[[group(0), binding(0)]] var mySampler: sampler_comparison;
|
||||||
[[stage(fragment)]] fn main() -> void {
|
[[stage(fragment)]] fn main() -> void {
|
||||||
})");
|
})");
|
||||||
}
|
}
|
||||||
@ -2099,7 +2099,7 @@ TEST_F(ComparisonSamplerBindingTest, DISABLED_ShaderAndBGLMatches) {
|
|||||||
device, {{0, wgpu::ShaderStage::Fragment, wgpu::SamplerBindingType::Filtering}});
|
device, {{0, wgpu::ShaderStage::Fragment, wgpu::SamplerBindingType::Filtering}});
|
||||||
|
|
||||||
ASSERT_DEVICE_ERROR(CreateFragmentPipeline(&bindGroupLayout, R"(
|
ASSERT_DEVICE_ERROR(CreateFragmentPipeline(&bindGroupLayout, R"(
|
||||||
[[group(0), binding(0)]] var<uniform_constant> mySampler: sampler_comparison;
|
[[group(0), binding(0)]] var mySampler: sampler_comparison;
|
||||||
[[stage(fragment)]] fn main() -> void {
|
[[stage(fragment)]] fn main() -> void {
|
||||||
})"));
|
})"));
|
||||||
}
|
}
|
||||||
@ -2110,7 +2110,7 @@ TEST_F(ComparisonSamplerBindingTest, DISABLED_ShaderAndBGLMatches) {
|
|||||||
device, {{0, wgpu::ShaderStage::Fragment, wgpu::SamplerBindingType::Comparison}});
|
device, {{0, wgpu::ShaderStage::Fragment, wgpu::SamplerBindingType::Comparison}});
|
||||||
|
|
||||||
ASSERT_DEVICE_ERROR(CreateFragmentPipeline(&bindGroupLayout, R"(
|
ASSERT_DEVICE_ERROR(CreateFragmentPipeline(&bindGroupLayout, R"(
|
||||||
[[group(0), binding(0)]] var<uniform_constant> mySampler: sampler;
|
[[group(0), binding(0)]] var mySampler: sampler;
|
||||||
[[stage(fragment)]] fn main() -> void {
|
[[stage(fragment)]] fn main() -> void {
|
||||||
})"));
|
})"));
|
||||||
}
|
}
|
||||||
|
@ -231,7 +231,7 @@ TEST_F(GetBindGroupLayoutTests, BindingType) {
|
|||||||
{
|
{
|
||||||
binding.texture.sampleType = wgpu::TextureSampleType::Float;
|
binding.texture.sampleType = wgpu::TextureSampleType::Float;
|
||||||
wgpu::RenderPipeline pipeline = RenderPipelineFromFragmentShader(R"(
|
wgpu::RenderPipeline pipeline = RenderPipelineFromFragmentShader(R"(
|
||||||
[[group(0), binding(0)]] var<uniform_constant> myTexture : texture_2d<f32>;
|
[[group(0), binding(0)]] var myTexture : texture_2d<f32>;
|
||||||
|
|
||||||
[[stage(fragment)]] fn main() -> void {
|
[[stage(fragment)]] fn main() -> void {
|
||||||
})");
|
})");
|
||||||
@ -241,7 +241,7 @@ TEST_F(GetBindGroupLayoutTests, BindingType) {
|
|||||||
{
|
{
|
||||||
binding.texture.multisampled = true;
|
binding.texture.multisampled = true;
|
||||||
wgpu::RenderPipeline pipeline = RenderPipelineFromFragmentShader(R"(
|
wgpu::RenderPipeline pipeline = RenderPipelineFromFragmentShader(R"(
|
||||||
[[group(0), binding(0)]] var<uniform_constant> myTexture : texture_multisampled_2d<f32>;
|
[[group(0), binding(0)]] var myTexture : texture_multisampled_2d<f32>;
|
||||||
|
|
||||||
[[stage(fragment)]] fn main() -> void {
|
[[stage(fragment)]] fn main() -> void {
|
||||||
})");
|
})");
|
||||||
@ -252,7 +252,7 @@ TEST_F(GetBindGroupLayoutTests, BindingType) {
|
|||||||
{
|
{
|
||||||
binding.sampler.type = wgpu::SamplerBindingType::Filtering;
|
binding.sampler.type = wgpu::SamplerBindingType::Filtering;
|
||||||
wgpu::RenderPipeline pipeline = RenderPipelineFromFragmentShader(R"(
|
wgpu::RenderPipeline pipeline = RenderPipelineFromFragmentShader(R"(
|
||||||
[[group(0), binding(0)]] var<uniform_constant> mySampler: sampler;
|
[[group(0), binding(0)]] var mySampler: sampler;
|
||||||
|
|
||||||
[[stage(fragment)]] fn main() -> void {
|
[[stage(fragment)]] fn main() -> void {
|
||||||
})");
|
})");
|
||||||
@ -279,7 +279,7 @@ TEST_F(GetBindGroupLayoutTests, ViewDimension) {
|
|||||||
{
|
{
|
||||||
binding.texture.viewDimension = wgpu::TextureViewDimension::e1D;
|
binding.texture.viewDimension = wgpu::TextureViewDimension::e1D;
|
||||||
wgpu::RenderPipeline pipeline = RenderPipelineFromFragmentShader(R"(
|
wgpu::RenderPipeline pipeline = RenderPipelineFromFragmentShader(R"(
|
||||||
[[group(0), binding(0)]] var<uniform_constant> myTexture : texture_1d<f32>;
|
[[group(0), binding(0)]] var myTexture : texture_1d<f32>;
|
||||||
|
|
||||||
[[stage(fragment)]] fn main() -> void {
|
[[stage(fragment)]] fn main() -> void {
|
||||||
})");
|
})");
|
||||||
@ -289,7 +289,7 @@ TEST_F(GetBindGroupLayoutTests, ViewDimension) {
|
|||||||
{
|
{
|
||||||
binding.texture.viewDimension = wgpu::TextureViewDimension::e2D;
|
binding.texture.viewDimension = wgpu::TextureViewDimension::e2D;
|
||||||
wgpu::RenderPipeline pipeline = RenderPipelineFromFragmentShader(R"(
|
wgpu::RenderPipeline pipeline = RenderPipelineFromFragmentShader(R"(
|
||||||
[[group(0), binding(0)]] var<uniform_constant> myTexture : texture_2d<f32>;
|
[[group(0), binding(0)]] var myTexture : texture_2d<f32>;
|
||||||
|
|
||||||
[[stage(fragment)]] fn main() -> void {
|
[[stage(fragment)]] fn main() -> void {
|
||||||
})");
|
})");
|
||||||
@ -299,7 +299,7 @@ TEST_F(GetBindGroupLayoutTests, ViewDimension) {
|
|||||||
{
|
{
|
||||||
binding.texture.viewDimension = wgpu::TextureViewDimension::e2DArray;
|
binding.texture.viewDimension = wgpu::TextureViewDimension::e2DArray;
|
||||||
wgpu::RenderPipeline pipeline = RenderPipelineFromFragmentShader(R"(
|
wgpu::RenderPipeline pipeline = RenderPipelineFromFragmentShader(R"(
|
||||||
[[group(0), binding(0)]] var<uniform_constant> myTexture : texture_2d_array<f32>;
|
[[group(0), binding(0)]] var myTexture : texture_2d_array<f32>;
|
||||||
|
|
||||||
[[stage(fragment)]] fn main() -> void {
|
[[stage(fragment)]] fn main() -> void {
|
||||||
})");
|
})");
|
||||||
@ -309,7 +309,7 @@ TEST_F(GetBindGroupLayoutTests, ViewDimension) {
|
|||||||
{
|
{
|
||||||
binding.texture.viewDimension = wgpu::TextureViewDimension::e3D;
|
binding.texture.viewDimension = wgpu::TextureViewDimension::e3D;
|
||||||
wgpu::RenderPipeline pipeline = RenderPipelineFromFragmentShader(R"(
|
wgpu::RenderPipeline pipeline = RenderPipelineFromFragmentShader(R"(
|
||||||
[[group(0), binding(0)]] var<uniform_constant> myTexture : texture_3d<f32>;
|
[[group(0), binding(0)]] var myTexture : texture_3d<f32>;
|
||||||
|
|
||||||
[[stage(fragment)]] fn main() -> void {
|
[[stage(fragment)]] fn main() -> void {
|
||||||
})");
|
})");
|
||||||
@ -319,7 +319,7 @@ TEST_F(GetBindGroupLayoutTests, ViewDimension) {
|
|||||||
{
|
{
|
||||||
binding.texture.viewDimension = wgpu::TextureViewDimension::Cube;
|
binding.texture.viewDimension = wgpu::TextureViewDimension::Cube;
|
||||||
wgpu::RenderPipeline pipeline = RenderPipelineFromFragmentShader(R"(
|
wgpu::RenderPipeline pipeline = RenderPipelineFromFragmentShader(R"(
|
||||||
[[group(0), binding(0)]] var<uniform_constant> myTexture : texture_cube<f32>;
|
[[group(0), binding(0)]] var myTexture : texture_cube<f32>;
|
||||||
|
|
||||||
[[stage(fragment)]] fn main() -> void {
|
[[stage(fragment)]] fn main() -> void {
|
||||||
})");
|
})");
|
||||||
@ -329,7 +329,7 @@ TEST_F(GetBindGroupLayoutTests, ViewDimension) {
|
|||||||
{
|
{
|
||||||
binding.texture.viewDimension = wgpu::TextureViewDimension::CubeArray;
|
binding.texture.viewDimension = wgpu::TextureViewDimension::CubeArray;
|
||||||
wgpu::RenderPipeline pipeline = RenderPipelineFromFragmentShader(R"(
|
wgpu::RenderPipeline pipeline = RenderPipelineFromFragmentShader(R"(
|
||||||
[[group(0), binding(0)]] var<uniform_constant> myTexture : texture_cube_array<f32>;
|
[[group(0), binding(0)]] var myTexture : texture_cube_array<f32>;
|
||||||
|
|
||||||
[[stage(fragment)]] fn main() -> void {
|
[[stage(fragment)]] fn main() -> void {
|
||||||
})");
|
})");
|
||||||
@ -355,7 +355,7 @@ TEST_F(GetBindGroupLayoutTests, TextureComponentType) {
|
|||||||
{
|
{
|
||||||
binding.texture.sampleType = wgpu::TextureSampleType::Float;
|
binding.texture.sampleType = wgpu::TextureSampleType::Float;
|
||||||
wgpu::RenderPipeline pipeline = RenderPipelineFromFragmentShader(R"(
|
wgpu::RenderPipeline pipeline = RenderPipelineFromFragmentShader(R"(
|
||||||
[[group(0), binding(0)]] var<uniform_constant> myTexture : texture_2d<f32>;
|
[[group(0), binding(0)]] var myTexture : texture_2d<f32>;
|
||||||
|
|
||||||
[[stage(fragment)]] fn main() -> void {
|
[[stage(fragment)]] fn main() -> void {
|
||||||
})");
|
})");
|
||||||
@ -365,7 +365,7 @@ TEST_F(GetBindGroupLayoutTests, TextureComponentType) {
|
|||||||
{
|
{
|
||||||
binding.texture.sampleType = wgpu::TextureSampleType::Sint;
|
binding.texture.sampleType = wgpu::TextureSampleType::Sint;
|
||||||
wgpu::RenderPipeline pipeline = RenderPipelineFromFragmentShader(R"(
|
wgpu::RenderPipeline pipeline = RenderPipelineFromFragmentShader(R"(
|
||||||
[[group(0), binding(0)]] var<uniform_constant> myTexture : texture_2d<i32>;
|
[[group(0), binding(0)]] var myTexture : texture_2d<i32>;
|
||||||
|
|
||||||
[[stage(fragment)]] fn main() -> void {
|
[[stage(fragment)]] fn main() -> void {
|
||||||
})");
|
})");
|
||||||
@ -375,7 +375,7 @@ TEST_F(GetBindGroupLayoutTests, TextureComponentType) {
|
|||||||
{
|
{
|
||||||
binding.texture.sampleType = wgpu::TextureSampleType::Uint;
|
binding.texture.sampleType = wgpu::TextureSampleType::Uint;
|
||||||
wgpu::RenderPipeline pipeline = RenderPipelineFromFragmentShader(R"(
|
wgpu::RenderPipeline pipeline = RenderPipelineFromFragmentShader(R"(
|
||||||
[[group(0), binding(0)]] var<uniform_constant> myTexture : texture_2d<u32>;
|
[[group(0), binding(0)]] var myTexture : texture_2d<u32>;
|
||||||
|
|
||||||
[[stage(fragment)]] fn main() -> void {
|
[[stage(fragment)]] fn main() -> void {
|
||||||
})");
|
})");
|
||||||
@ -567,7 +567,7 @@ TEST_F(GetBindGroupLayoutTests, StageAggregation) {
|
|||||||
})");
|
})");
|
||||||
|
|
||||||
wgpu::ShaderModule vsModuleSampler = utils::CreateShaderModuleFromWGSL(device, R"(
|
wgpu::ShaderModule vsModuleSampler = utils::CreateShaderModuleFromWGSL(device, R"(
|
||||||
[[group(0), binding(0)]] var<uniform_constant> mySampler: sampler;
|
[[group(0), binding(0)]] var mySampler: sampler;
|
||||||
[[stage(vertex)]] fn main() -> void {
|
[[stage(vertex)]] fn main() -> void {
|
||||||
})");
|
})");
|
||||||
|
|
||||||
@ -576,7 +576,7 @@ TEST_F(GetBindGroupLayoutTests, StageAggregation) {
|
|||||||
})");
|
})");
|
||||||
|
|
||||||
wgpu::ShaderModule fsModuleSampler = utils::CreateShaderModuleFromWGSL(device, R"(
|
wgpu::ShaderModule fsModuleSampler = utils::CreateShaderModuleFromWGSL(device, R"(
|
||||||
[[group(0), binding(0)]] var<uniform_constant> mySampler: sampler;
|
[[group(0), binding(0)]] var mySampler: sampler;
|
||||||
[[stage(fragment)]] fn main() -> void {
|
[[stage(fragment)]] fn main() -> void {
|
||||||
})");
|
})");
|
||||||
|
|
||||||
@ -654,13 +654,13 @@ TEST_F(GetBindGroupLayoutTests, ConflictingBindingType) {
|
|||||||
// Test it is invalid to have conflicting binding texture multisampling in the shaders.
|
// Test it is invalid to have conflicting binding texture multisampling in the shaders.
|
||||||
TEST_F(GetBindGroupLayoutTests, ConflictingBindingTextureMultisampling) {
|
TEST_F(GetBindGroupLayoutTests, ConflictingBindingTextureMultisampling) {
|
||||||
wgpu::ShaderModule vsModule = utils::CreateShaderModuleFromWGSL(device, R"(
|
wgpu::ShaderModule vsModule = utils::CreateShaderModuleFromWGSL(device, R"(
|
||||||
[[group(0), binding(0)]] var<uniform_constant> myTexture : texture_2d<f32>;
|
[[group(0), binding(0)]] var myTexture : texture_2d<f32>;
|
||||||
|
|
||||||
[[stage(vertex)]] fn main() -> void {
|
[[stage(vertex)]] fn main() -> void {
|
||||||
})");
|
})");
|
||||||
|
|
||||||
wgpu::ShaderModule fsModule = utils::CreateShaderModuleFromWGSL(device, R"(
|
wgpu::ShaderModule fsModule = utils::CreateShaderModuleFromWGSL(device, R"(
|
||||||
[[group(0), binding(0)]] var<uniform_constant> myTexture : texture_multisampled_2d<f32>;
|
[[group(0), binding(0)]] var myTexture : texture_multisampled_2d<f32>;
|
||||||
|
|
||||||
[[stage(fragment)]] fn main() -> void {
|
[[stage(fragment)]] fn main() -> void {
|
||||||
})");
|
})");
|
||||||
@ -676,13 +676,13 @@ TEST_F(GetBindGroupLayoutTests, ConflictingBindingTextureMultisampling) {
|
|||||||
// Test it is invalid to have conflicting binding texture dimension in the shaders.
|
// Test it is invalid to have conflicting binding texture dimension in the shaders.
|
||||||
TEST_F(GetBindGroupLayoutTests, ConflictingBindingViewDimension) {
|
TEST_F(GetBindGroupLayoutTests, ConflictingBindingViewDimension) {
|
||||||
wgpu::ShaderModule vsModule = utils::CreateShaderModuleFromWGSL(device, R"(
|
wgpu::ShaderModule vsModule = utils::CreateShaderModuleFromWGSL(device, R"(
|
||||||
[[group(0), binding(0)]] var<uniform_constant> myTexture : texture_2d<f32>;
|
[[group(0), binding(0)]] var myTexture : texture_2d<f32>;
|
||||||
|
|
||||||
[[stage(vertex)]] fn main() -> void {
|
[[stage(vertex)]] fn main() -> void {
|
||||||
})");
|
})");
|
||||||
|
|
||||||
wgpu::ShaderModule fsModule = utils::CreateShaderModuleFromWGSL(device, R"(
|
wgpu::ShaderModule fsModule = utils::CreateShaderModuleFromWGSL(device, R"(
|
||||||
[[group(0), binding(0)]] var<uniform_constant> myTexture : texture_3d<f32>;
|
[[group(0), binding(0)]] var myTexture : texture_3d<f32>;
|
||||||
|
|
||||||
[[stage(fragment)]] fn main() -> void {
|
[[stage(fragment)]] fn main() -> void {
|
||||||
})");
|
})");
|
||||||
@ -698,13 +698,13 @@ TEST_F(GetBindGroupLayoutTests, ConflictingBindingViewDimension) {
|
|||||||
// Test it is invalid to have conflicting binding texture component type in the shaders.
|
// Test it is invalid to have conflicting binding texture component type in the shaders.
|
||||||
TEST_F(GetBindGroupLayoutTests, ConflictingBindingTextureComponentType) {
|
TEST_F(GetBindGroupLayoutTests, ConflictingBindingTextureComponentType) {
|
||||||
wgpu::ShaderModule vsModule = utils::CreateShaderModuleFromWGSL(device, R"(
|
wgpu::ShaderModule vsModule = utils::CreateShaderModuleFromWGSL(device, R"(
|
||||||
[[group(0), binding(0)]] var<uniform_constant> myTexture : texture_2d<f32>;
|
[[group(0), binding(0)]] var myTexture : texture_2d<f32>;
|
||||||
|
|
||||||
[[stage(vertex)]] fn main() -> void {
|
[[stage(vertex)]] fn main() -> void {
|
||||||
})");
|
})");
|
||||||
|
|
||||||
wgpu::ShaderModule fsModule = utils::CreateShaderModuleFromWGSL(device, R"(
|
wgpu::ShaderModule fsModule = utils::CreateShaderModuleFromWGSL(device, R"(
|
||||||
[[group(0), binding(0)]] var<uniform_constant> myTexture : texture_2d<i32>;
|
[[group(0), binding(0)]] var myTexture : texture_2d<i32>;
|
||||||
|
|
||||||
[[stage(fragment)]] fn main() -> void {
|
[[stage(fragment)]] fn main() -> void {
|
||||||
})");
|
})");
|
||||||
|
@ -397,7 +397,7 @@ TEST_F(RenderPipelineValidationTest, TextureComponentTypeCompatibility) {
|
|||||||
|
|
||||||
std::ostringstream stream;
|
std::ostringstream stream;
|
||||||
stream << R"(
|
stream << R"(
|
||||||
[[group(0), binding(0)]] var<uniform_constant> myTexture : texture_2d<)"
|
[[group(0), binding(0)]] var myTexture : texture_2d<)"
|
||||||
<< kScalarTypes[i] << R"(>;
|
<< kScalarTypes[i] << R"(>;
|
||||||
|
|
||||||
[[stage(fragment)]] fn main() -> void {
|
[[stage(fragment)]] fn main() -> void {
|
||||||
@ -446,7 +446,7 @@ TEST_F(RenderPipelineValidationTest, TextureViewDimensionCompatibility) {
|
|||||||
|
|
||||||
std::ostringstream stream;
|
std::ostringstream stream;
|
||||||
stream << R"(
|
stream << R"(
|
||||||
[[group(0), binding(0)]] var<uniform_constant> myTexture : )"
|
[[group(0), binding(0)]] var myTexture : )"
|
||||||
<< kTextureKeywords[i] << R"(<f32>;
|
<< kTextureKeywords[i] << R"(<f32>;
|
||||||
[[stage(fragment)]] fn main() -> void {
|
[[stage(fragment)]] fn main() -> void {
|
||||||
})";
|
})";
|
||||||
|
@ -1554,7 +1554,7 @@ namespace {
|
|||||||
})");
|
})");
|
||||||
|
|
||||||
wgpu::ShaderModule fsModule = utils::CreateShaderModuleFromWGSL(device, R"(
|
wgpu::ShaderModule fsModule = utils::CreateShaderModuleFromWGSL(device, R"(
|
||||||
[[group(0), binding(0)]] var<uniform_constant> tex : [[access(read)]] texture_storage_2d<rgba8unorm>;
|
[[group(0), binding(0)]] var tex : [[access(read)]] texture_storage_2d<rgba8unorm>;
|
||||||
[[stage(fragment)]] fn main() -> void {
|
[[stage(fragment)]] fn main() -> void {
|
||||||
})");
|
})");
|
||||||
utils::ComboRenderPipelineDescriptor pipelineDescriptor(device);
|
utils::ComboRenderPipelineDescriptor pipelineDescriptor(device);
|
||||||
@ -1580,7 +1580,7 @@ namespace {
|
|||||||
{
|
{
|
||||||
// Create a passthrough compute pipeline with a readonly storage texture
|
// Create a passthrough compute pipeline with a readonly storage texture
|
||||||
wgpu::ShaderModule csModule = utils::CreateShaderModuleFromWGSL(device, R"(
|
wgpu::ShaderModule csModule = utils::CreateShaderModuleFromWGSL(device, R"(
|
||||||
[[group(0), binding(0)]] var<uniform_constant> tex : [[access(read)]] texture_storage_2d<rgba8unorm>;
|
[[group(0), binding(0)]] var tex : [[access(read)]] texture_storage_2d<rgba8unorm>;
|
||||||
[[stage(compute)]] fn main() -> void {
|
[[stage(compute)]] fn main() -> void {
|
||||||
})");
|
})");
|
||||||
wgpu::ComputePipelineDescriptor pipelineDescriptor;
|
wgpu::ComputePipelineDescriptor pipelineDescriptor;
|
||||||
|
@ -84,7 +84,7 @@ class StorageTextureValidationTests : public ValidationTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::ostringstream ostream;
|
std::ostringstream ostream;
|
||||||
ostream << "[[group(0), binding(0)]] var<uniform_constant> image0 : "
|
ostream << "[[group(0), binding(0)]] var image0 : "
|
||||||
<< "[[access(" << access << ")]] " << imageTypeDeclaration << "<"
|
<< "[[access(" << access << ")]] " << imageTypeDeclaration << "<"
|
||||||
<< imageFormatQualifier
|
<< imageFormatQualifier
|
||||||
<< ">;\n"
|
<< ">;\n"
|
||||||
@ -121,7 +121,7 @@ TEST_F(StorageTextureValidationTests, RenderPipeline) {
|
|||||||
// Readonly storage texture can be declared in a vertex shader.
|
// Readonly storage texture can be declared in a vertex shader.
|
||||||
{
|
{
|
||||||
wgpu::ShaderModule vsModule = utils::CreateShaderModuleFromWGSL(device, R"(
|
wgpu::ShaderModule vsModule = utils::CreateShaderModuleFromWGSL(device, R"(
|
||||||
[[group(0), binding(0)]] var<uniform_constant> image0 : [[access(read)]] texture_storage_2d<rgba8unorm>;
|
[[group(0), binding(0)]] var image0 : [[access(read)]] texture_storage_2d<rgba8unorm>;
|
||||||
[[builtin(vertex_index)]] var<in> VertexIndex : u32;
|
[[builtin(vertex_index)]] var<in> VertexIndex : u32;
|
||||||
[[builtin(position)]] var<out> Position : vec4<f32>;
|
[[builtin(position)]] var<out> Position : vec4<f32>;
|
||||||
[[stage(vertex)]] fn main() -> void {
|
[[stage(vertex)]] fn main() -> void {
|
||||||
@ -138,7 +138,7 @@ TEST_F(StorageTextureValidationTests, RenderPipeline) {
|
|||||||
// Read-only storage textures can be declared in a fragment shader.
|
// Read-only storage textures can be declared in a fragment shader.
|
||||||
{
|
{
|
||||||
wgpu::ShaderModule fsModule = utils::CreateShaderModuleFromWGSL(device, R"(
|
wgpu::ShaderModule fsModule = utils::CreateShaderModuleFromWGSL(device, R"(
|
||||||
[[group(0), binding(0)]] var<uniform_constant> image0 : [[access(read)]] texture_storage_2d<rgba8unorm>;
|
[[group(0), binding(0)]] var image0 : [[access(read)]] texture_storage_2d<rgba8unorm>;
|
||||||
[[builtin(frag_coord)]] var<in> FragCoord : vec4<f32>;
|
[[builtin(frag_coord)]] var<in> FragCoord : vec4<f32>;
|
||||||
[[location(0)]] var<out> fragColor : vec4<f32>;
|
[[location(0)]] var<out> fragColor : vec4<f32>;
|
||||||
[[stage(fragment)]] fn main() -> void {
|
[[stage(fragment)]] fn main() -> void {
|
||||||
@ -156,7 +156,7 @@ TEST_F(StorageTextureValidationTests, RenderPipeline) {
|
|||||||
if ((false) /* TODO(https://crbug.com/tint/449) */) {
|
if ((false) /* TODO(https://crbug.com/tint/449) */) {
|
||||||
wgpu::ShaderModule vsModule = utils::CreateShaderModuleFromWGSL(device, R"(
|
wgpu::ShaderModule vsModule = utils::CreateShaderModuleFromWGSL(device, R"(
|
||||||
[[builtin(vertex_index)]] var<in> vertex_index : u32;
|
[[builtin(vertex_index)]] var<in> vertex_index : u32;
|
||||||
[[group(0), binding(0)]] var<uniform_constant> image0 : [[access(write)]] texture_storage_2d<rgba8unorm>;
|
[[group(0), binding(0)]] var image0 : [[access(write)]] texture_storage_2d<rgba8unorm>;
|
||||||
[[stage(vertex)]] fn main() -> void {
|
[[stage(vertex)]] fn main() -> void {
|
||||||
textureStore(image0, vec2<i32>(i32(vertex_index), 0), vec4<f32>(1.0, 0.0, 0.0, 1.0));
|
textureStore(image0, vec2<i32>(i32(vertex_index), 0), vec4<f32>(1.0, 0.0, 0.0, 1.0));
|
||||||
})");
|
})");
|
||||||
@ -172,7 +172,7 @@ TEST_F(StorageTextureValidationTests, RenderPipeline) {
|
|||||||
{
|
{
|
||||||
wgpu::ShaderModule fsModule = utils::CreateShaderModuleFromWGSL(device, R"(
|
wgpu::ShaderModule fsModule = utils::CreateShaderModuleFromWGSL(device, R"(
|
||||||
[[builtin(frag_coord)]] var<in> frag_coord : vec4<f32>;
|
[[builtin(frag_coord)]] var<in> frag_coord : vec4<f32>;
|
||||||
[[group(0), binding(0)]] var<uniform_constant> image0 : [[access(write)]] texture_storage_2d<rgba8unorm>;
|
[[group(0), binding(0)]] var image0 : [[access(write)]] texture_storage_2d<rgba8unorm>;
|
||||||
[[stage(fragment)]] fn main() -> void {
|
[[stage(fragment)]] fn main() -> void {
|
||||||
textureStore(image0, vec2<i32>(frag_coord.xy), vec4<f32>(1.0, 0.0, 0.0, 1.0));
|
textureStore(image0, vec2<i32>(frag_coord.xy), vec4<f32>(1.0, 0.0, 0.0, 1.0));
|
||||||
})");
|
})");
|
||||||
@ -191,7 +191,7 @@ TEST_F(StorageTextureValidationTests, ComputePipeline) {
|
|||||||
// Read-only storage textures can be declared in a compute shader.
|
// Read-only storage textures can be declared in a compute shader.
|
||||||
{
|
{
|
||||||
wgpu::ShaderModule csModule = utils::CreateShaderModuleFromWGSL(device, R"(
|
wgpu::ShaderModule csModule = utils::CreateShaderModuleFromWGSL(device, R"(
|
||||||
[[group(0), binding(0)]] var<uniform_constant> image0 : [[access(read)]] texture_storage_2d<rgba8unorm>;
|
[[group(0), binding(0)]] var image0 : [[access(read)]] texture_storage_2d<rgba8unorm>;
|
||||||
[[builtin(local_invocation_id)]] var<in> LocalInvocationID : vec3<u32>;
|
[[builtin(local_invocation_id)]] var<in> LocalInvocationID : vec3<u32>;
|
||||||
|
|
||||||
[[block]] struct Buf {
|
[[block]] struct Buf {
|
||||||
@ -214,7 +214,7 @@ TEST_F(StorageTextureValidationTests, ComputePipeline) {
|
|||||||
// Write-only storage textures can be declared in a compute shader.
|
// Write-only storage textures can be declared in a compute shader.
|
||||||
{
|
{
|
||||||
wgpu::ShaderModule csModule = utils::CreateShaderModuleFromWGSL(device, R"(
|
wgpu::ShaderModule csModule = utils::CreateShaderModuleFromWGSL(device, R"(
|
||||||
[[group(0), binding(0)]] var<uniform_constant> image0 : [[access(write)]] texture_storage_2d<rgba8unorm>;
|
[[group(0), binding(0)]] var image0 : [[access(write)]] texture_storage_2d<rgba8unorm>;
|
||||||
[[builtin(local_invocation_id)]] var<in> LocalInvocationID : vec3<u32>;
|
[[builtin(local_invocation_id)]] var<in> LocalInvocationID : vec3<u32>;
|
||||||
|
|
||||||
[[stage(compute)]] fn main() -> void {
|
[[stage(compute)]] fn main() -> void {
|
||||||
@ -235,7 +235,7 @@ TEST_F(StorageTextureValidationTests, ReadWriteStorageTexture) {
|
|||||||
// Read-write storage textures cannot be declared in a vertex shader by default.
|
// Read-write storage textures cannot be declared in a vertex shader by default.
|
||||||
{
|
{
|
||||||
ASSERT_DEVICE_ERROR(utils::CreateShaderModuleFromWGSL(device, R"(
|
ASSERT_DEVICE_ERROR(utils::CreateShaderModuleFromWGSL(device, R"(
|
||||||
[[group(0), binding(0)]] var<uniform_constant> image0 : [[access(read_write)]] texture_storage_2d<rgba8unorm>;
|
[[group(0), binding(0)]] var image0 : [[access(read_write)]] texture_storage_2d<rgba8unorm>;
|
||||||
[[stage(vertex)]] fn main() -> void {
|
[[stage(vertex)]] fn main() -> void {
|
||||||
})"));
|
})"));
|
||||||
}
|
}
|
||||||
@ -243,7 +243,7 @@ TEST_F(StorageTextureValidationTests, ReadWriteStorageTexture) {
|
|||||||
// Read-write storage textures cannot be declared in a fragment shader by default.
|
// Read-write storage textures cannot be declared in a fragment shader by default.
|
||||||
{
|
{
|
||||||
ASSERT_DEVICE_ERROR(utils::CreateShaderModuleFromWGSL(device, R"(
|
ASSERT_DEVICE_ERROR(utils::CreateShaderModuleFromWGSL(device, R"(
|
||||||
[[group(0), binding(0)]] var<uniform_constant> image0 : [[access(read_write)]] texture_storage_2d<rgba8unorm>;
|
[[group(0), binding(0)]] var image0 : [[access(read_write)]] texture_storage_2d<rgba8unorm>;
|
||||||
[[stage(fragment)]] fn main() -> void {
|
[[stage(fragment)]] fn main() -> void {
|
||||||
})"));
|
})"));
|
||||||
}
|
}
|
||||||
@ -251,7 +251,7 @@ TEST_F(StorageTextureValidationTests, ReadWriteStorageTexture) {
|
|||||||
// Read-write storage textures cannot be declared in a compute shader by default.
|
// Read-write storage textures cannot be declared in a compute shader by default.
|
||||||
{
|
{
|
||||||
ASSERT_DEVICE_ERROR(utils::CreateShaderModuleFromWGSL(device, R"(
|
ASSERT_DEVICE_ERROR(utils::CreateShaderModuleFromWGSL(device, R"(
|
||||||
[[group(0), binding(0)]] var<uniform_constant> image0 : [[access(read_write)]] texture_storage_2d<rgba8unorm>;
|
[[group(0), binding(0)]] var image0 : [[access(read_write)]] texture_storage_2d<rgba8unorm>;
|
||||||
[[stage(compute)]] fn main() -> void {
|
[[stage(compute)]] fn main() -> void {
|
||||||
})"));
|
})"));
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user