[wgsl]: s/texture_sampled_/texture_
These texture types were renamed in October 2020:
https://github.com/gpuweb/gpuweb/pull/1180
Tint has supported both forms since November 2020:
https://dawn-review.googlesource.com/c/tint/+/31380
Finally migrate to the new form so we can drop support for the old.
Bug: tint:286
Change-Id: Id19b79be28152b3de163f9cce75eefff1ae31d76
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/37702
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
diff --git a/examples/CppHelloTriangle.cpp b/examples/CppHelloTriangle.cpp
index dc66746..08fd4c5 100644
--- a/examples/CppHelloTriangle.cpp
+++ b/examples/CppHelloTriangle.cpp
@@ -106,7 +106,7 @@
wgpu::ShaderModule fsModule = utils::CreateShaderModuleFromWGSL(device, R"(
[[builtin(frag_coord)]] var<in> FragCoord : vec4<f32>;
[[set(0), binding(0)]] var<uniform_constant> mySampler: sampler;
- [[set(0), binding(1)]] var<uniform_constant> myTexture : texture_sampled_2d<f32>;
+ [[set(0), binding(1)]] var<uniform_constant> myTexture : texture_2d<f32>;
[[location(0)]] var<out> FragColor : vec4<f32>;
[[stage(fragment)]] fn main() -> void {
diff --git a/src/dawn_native/CopyTextureForBrowserHelper.cpp b/src/dawn_native/CopyTextureForBrowserHelper.cpp
index 6bca1f1..b8bc2a4 100644
--- a/src/dawn_native/CopyTextureForBrowserHelper.cpp
+++ b/src/dawn_native/CopyTextureForBrowserHelper.cpp
@@ -58,7 +58,7 @@
static const char sPassthrough2D4ChannelFrag[] = R"(
[[binding(1), set(0)]] var<uniform_constant> mySampler: sampler;
- [[binding(2), set(0)]] var<uniform_constant> myTexture: texture_sampled_2d<f32>;
+ [[binding(2), set(0)]] var<uniform_constant> myTexture: texture_2d<f32>;
[[location(0)]] var<in> v_texcoord : vec2<f32>;
[[location(0)]] var<out> rgbaColor : vec4<f32>;
[[stage(fragment)]] fn main() -> void {
diff --git a/src/tests/unittests/validation/BindGroupValidationTests.cpp b/src/tests/unittests/validation/BindGroupValidationTests.cpp
index 8d34ead..5b07aeb 100644
--- a/src/tests/unittests/validation/BindGroupValidationTests.cpp
+++ b/src/tests/unittests/validation/BindGroupValidationTests.cpp
@@ -1772,11 +1772,11 @@
TEST_F(BindGroupLayoutCompatibilityTest, TextureViewDimension) {
constexpr char kTexture2DShaderFS[] = R"(
- [[set(0), binding(0)]] var<uniform_constant> myTexture : texture_sampled_2d<f32>;
+ [[set(0), binding(0)]] var<uniform_constant> myTexture : texture_2d<f32>;
[[stage(fragment)]] fn main() -> void {
})";
constexpr char kTexture2DShaderCS[] = R"(
- [[set(0), binding(0)]] var<uniform_constant> myTexture : texture_sampled_2d<f32>;
+ [[set(0), binding(0)]] var<uniform_constant> myTexture : texture_2d<f32>;
[[stage(compute)]] fn main() -> void {
})";
@@ -1809,11 +1809,11 @@
wgpu::TextureViewDimension::e2DArray}})}));
constexpr char kTexture2DArrayShaderFS[] = R"(
- [[set(0), binding(0)]] var<uniform_constant> myTexture : texture_sampled_2d_array<f32>;
+ [[set(0), binding(0)]] var<uniform_constant> myTexture : texture_2d_array<f32>;
[[stage(fragment)]] fn main() -> void {
})";
constexpr char kTexture2DArrayShaderCS[] = R"(
- [[set(0), binding(0)]] var<uniform_constant> myTexture : texture_sampled_2d_array<f32>;
+ [[set(0), binding(0)]] var<uniform_constant> myTexture : texture_2d_array<f32>;
[[stage(compute)]] fn main() -> void {
})";
diff --git a/src/tests/unittests/validation/GetBindGroupLayoutValidationTests.cpp b/src/tests/unittests/validation/GetBindGroupLayoutValidationTests.cpp
index 49376d6..64b5111 100644
--- a/src/tests/unittests/validation/GetBindGroupLayoutValidationTests.cpp
+++ b/src/tests/unittests/validation/GetBindGroupLayoutValidationTests.cpp
@@ -210,7 +210,7 @@
{
binding.type = wgpu::BindingType::SampledTexture;
wgpu::RenderPipeline pipeline = RenderPipelineFromFragmentShader(R"(
- [[set(0), binding(0)]] var<uniform_constant> myTexture : texture_sampled_2d<f32>;
+ [[set(0), binding(0)]] var<uniform_constant> myTexture : texture_2d<f32>;
[[stage(fragment)]] fn main() -> void {
})");
@@ -252,7 +252,7 @@
{
binding.texture.viewDimension = wgpu::TextureViewDimension::e1D;
wgpu::RenderPipeline pipeline = RenderPipelineFromFragmentShader(R"(
- [[set(0), binding(0)]] var<uniform_constant> myTexture : texture_sampled_1d<f32>;
+ [[set(0), binding(0)]] var<uniform_constant> myTexture : texture_1d<f32>;
[[stage(fragment)]] fn main() -> void {
})");
@@ -262,7 +262,7 @@
{
binding.texture.viewDimension = wgpu::TextureViewDimension::e2D;
wgpu::RenderPipeline pipeline = RenderPipelineFromFragmentShader(R"(
- [[set(0), binding(0)]] var<uniform_constant> myTexture : texture_sampled_2d<f32>;
+ [[set(0), binding(0)]] var<uniform_constant> myTexture : texture_2d<f32>;
[[stage(fragment)]] fn main() -> void {
})");
@@ -272,7 +272,7 @@
{
binding.texture.viewDimension = wgpu::TextureViewDimension::e2DArray;
wgpu::RenderPipeline pipeline = RenderPipelineFromFragmentShader(R"(
- [[set(0), binding(0)]] var<uniform_constant> myTexture : texture_sampled_2d_array<f32>;
+ [[set(0), binding(0)]] var<uniform_constant> myTexture : texture_2d_array<f32>;
[[stage(fragment)]] fn main() -> void {
})");
@@ -282,7 +282,7 @@
{
binding.texture.viewDimension = wgpu::TextureViewDimension::e3D;
wgpu::RenderPipeline pipeline = RenderPipelineFromFragmentShader(R"(
- [[set(0), binding(0)]] var<uniform_constant> myTexture : texture_sampled_3d<f32>;
+ [[set(0), binding(0)]] var<uniform_constant> myTexture : texture_3d<f32>;
[[stage(fragment)]] fn main() -> void {
})");
@@ -292,7 +292,7 @@
{
binding.texture.viewDimension = wgpu::TextureViewDimension::Cube;
wgpu::RenderPipeline pipeline = RenderPipelineFromFragmentShader(R"(
- [[set(0), binding(0)]] var<uniform_constant> myTexture : texture_sampled_cube<f32>;
+ [[set(0), binding(0)]] var<uniform_constant> myTexture : texture_cube<f32>;
[[stage(fragment)]] fn main() -> void {
})");
@@ -302,7 +302,7 @@
{
binding.texture.viewDimension = wgpu::TextureViewDimension::CubeArray;
wgpu::RenderPipeline pipeline = RenderPipelineFromFragmentShader(R"(
- [[set(0), binding(0)]] var<uniform_constant> myTexture : texture_sampled_cube_array<f32>;
+ [[set(0), binding(0)]] var<uniform_constant> myTexture : texture_cube_array<f32>;
[[stage(fragment)]] fn main() -> void {
})");
@@ -323,7 +323,7 @@
{
binding.texture.sampleType = wgpu::TextureSampleType::Float;
wgpu::RenderPipeline pipeline = RenderPipelineFromFragmentShader(R"(
- [[set(0), binding(0)]] var<uniform_constant> myTexture : texture_sampled_2d<f32>;
+ [[set(0), binding(0)]] var<uniform_constant> myTexture : texture_2d<f32>;
[[stage(fragment)]] fn main() -> void {
})");
@@ -333,7 +333,7 @@
{
binding.texture.sampleType = wgpu::TextureSampleType::Sint;
wgpu::RenderPipeline pipeline = RenderPipelineFromFragmentShader(R"(
- [[set(0), binding(0)]] var<uniform_constant> myTexture : texture_sampled_2d<i32>;
+ [[set(0), binding(0)]] var<uniform_constant> myTexture : texture_2d<i32>;
[[stage(fragment)]] fn main() -> void {
})");
@@ -343,7 +343,7 @@
{
binding.texture.sampleType = wgpu::TextureSampleType::Uint;
wgpu::RenderPipeline pipeline = RenderPipelineFromFragmentShader(R"(
- [[set(0), binding(0)]] var<uniform_constant> myTexture : texture_sampled_2d<u32>;
+ [[set(0), binding(0)]] var<uniform_constant> myTexture : texture_2d<u32>;
[[stage(fragment)]] fn main() -> void {
})");
@@ -607,7 +607,7 @@
// Test it is invalid to have conflicting binding texture multisampling in the shaders.
TEST_F(GetBindGroupLayoutTests, ConflictingBindingTextureMultisampling) {
wgpu::ShaderModule vsModule = utils::CreateShaderModuleFromWGSL(device, R"(
- [[set(0), binding(0)]] var<uniform_constant> myTexture : texture_sampled_2d<f32>;
+ [[set(0), binding(0)]] var<uniform_constant> myTexture : texture_2d<f32>;
[[stage(vertex)]] fn main() -> void {
})");
@@ -629,13 +629,13 @@
// Test it is invalid to have conflicting binding texture dimension in the shaders.
TEST_F(GetBindGroupLayoutTests, ConflictingBindingViewDimension) {
wgpu::ShaderModule vsModule = utils::CreateShaderModuleFromWGSL(device, R"(
- [[set(0), binding(0)]] var<uniform_constant> myTexture : texture_sampled_2d<f32>;
+ [[set(0), binding(0)]] var<uniform_constant> myTexture : texture_2d<f32>;
[[stage(vertex)]] fn main() -> void {
})");
wgpu::ShaderModule fsModule = utils::CreateShaderModuleFromWGSL(device, R"(
- [[set(0), binding(0)]] var<uniform_constant> myTexture : texture_sampled_3d<f32>;
+ [[set(0), binding(0)]] var<uniform_constant> myTexture : texture_3d<f32>;
[[stage(fragment)]] fn main() -> void {
})");
@@ -651,13 +651,13 @@
// Test it is invalid to have conflicting binding texture component type in the shaders.
TEST_F(GetBindGroupLayoutTests, ConflictingBindingTextureComponentType) {
wgpu::ShaderModule vsModule = utils::CreateShaderModuleFromWGSL(device, R"(
- [[set(0), binding(0)]] var<uniform_constant> myTexture : texture_sampled_2d<f32>;
+ [[set(0), binding(0)]] var<uniform_constant> myTexture : texture_2d<f32>;
[[stage(vertex)]] fn main() -> void {
})");
wgpu::ShaderModule fsModule = utils::CreateShaderModuleFromWGSL(device, R"(
- [[set(0), binding(0)]] var<uniform_constant> myTexture : texture_sampled_2d<i32>;
+ [[set(0), binding(0)]] var<uniform_constant> myTexture : texture_2d<i32>;
[[stage(fragment)]] fn main() -> void {
})");
diff --git a/src/tests/unittests/validation/RenderPipelineValidationTests.cpp b/src/tests/unittests/validation/RenderPipelineValidationTests.cpp
index f8dce08..aa3f7d5 100644
--- a/src/tests/unittests/validation/RenderPipelineValidationTests.cpp
+++ b/src/tests/unittests/validation/RenderPipelineValidationTests.cpp
@@ -257,111 +257,102 @@
// It is not allowed to use multisampled render pass and non-multisampled render pipeline.
{
- {
- wgpu::TextureDescriptor textureDescriptor = baseTextureDescriptor;
- textureDescriptor.format = kColorFormat;
- textureDescriptor.sampleCount = kMultisampledCount;
- wgpu::Texture multisampledColorTexture = device.CreateTexture(&textureDescriptor);
- utils::ComboRenderPassDescriptor renderPassDescriptor(
- {multisampledColorTexture.CreateView()});
+ wgpu::TextureDescriptor textureDescriptor = baseTextureDescriptor;
+ textureDescriptor.format = kColorFormat;
+ textureDescriptor.sampleCount = kMultisampledCount;
+ wgpu::Texture multisampledColorTexture = device.CreateTexture(&textureDescriptor);
+ utils::ComboRenderPassDescriptor renderPassDescriptor(
+ {multisampledColorTexture.CreateView()});
- wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
- wgpu::RenderPassEncoder renderPass = encoder.BeginRenderPass(&renderPassDescriptor);
- renderPass.SetPipeline(nonMultisampledPipeline);
- renderPass.EndPass();
+ wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
+ wgpu::RenderPassEncoder renderPass = encoder.BeginRenderPass(&renderPassDescriptor);
+ renderPass.SetPipeline(nonMultisampledPipeline);
+ renderPass.EndPass();
- ASSERT_DEVICE_ERROR(encoder.Finish());
- }
+ ASSERT_DEVICE_ERROR(encoder.Finish());
+ }
- {
- wgpu::TextureDescriptor textureDescriptor = baseTextureDescriptor;
- textureDescriptor.sampleCount = kMultisampledCount;
- textureDescriptor.format = kDepthStencilFormat;
- wgpu::Texture multisampledDepthStencilTexture =
- device.CreateTexture(&textureDescriptor);
- utils::ComboRenderPassDescriptor renderPassDescriptor(
- {}, multisampledDepthStencilTexture.CreateView());
+ {
+ wgpu::TextureDescriptor textureDescriptor = baseTextureDescriptor;
+ textureDescriptor.sampleCount = kMultisampledCount;
+ textureDescriptor.format = kDepthStencilFormat;
+ wgpu::Texture multisampledDepthStencilTexture = device.CreateTexture(&textureDescriptor);
+ utils::ComboRenderPassDescriptor renderPassDescriptor(
+ {}, multisampledDepthStencilTexture.CreateView());
- wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
- wgpu::RenderPassEncoder renderPass = encoder.BeginRenderPass(&renderPassDescriptor);
- renderPass.SetPipeline(nonMultisampledPipelineWithDepthStencilOnly);
- renderPass.EndPass();
+ wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
+ wgpu::RenderPassEncoder renderPass = encoder.BeginRenderPass(&renderPassDescriptor);
+ renderPass.SetPipeline(nonMultisampledPipelineWithDepthStencilOnly);
+ renderPass.EndPass();
- ASSERT_DEVICE_ERROR(encoder.Finish());
- }
+ ASSERT_DEVICE_ERROR(encoder.Finish());
}
// It is allowed to use multisampled render pass and multisampled render pipeline.
{
- {
- wgpu::TextureDescriptor textureDescriptor = baseTextureDescriptor;
- textureDescriptor.format = kColorFormat;
- textureDescriptor.sampleCount = kMultisampledCount;
- wgpu::Texture multisampledColorTexture = device.CreateTexture(&textureDescriptor);
- utils::ComboRenderPassDescriptor renderPassDescriptor(
- {multisampledColorTexture.CreateView()});
+ wgpu::TextureDescriptor textureDescriptor = baseTextureDescriptor;
+ textureDescriptor.format = kColorFormat;
+ textureDescriptor.sampleCount = kMultisampledCount;
+ wgpu::Texture multisampledColorTexture = device.CreateTexture(&textureDescriptor);
+ utils::ComboRenderPassDescriptor renderPassDescriptor(
+ {multisampledColorTexture.CreateView()});
- wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
- wgpu::RenderPassEncoder renderPass = encoder.BeginRenderPass(&renderPassDescriptor);
- renderPass.SetPipeline(multisampledPipeline);
- renderPass.EndPass();
+ wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
+ wgpu::RenderPassEncoder renderPass = encoder.BeginRenderPass(&renderPassDescriptor);
+ renderPass.SetPipeline(multisampledPipeline);
+ renderPass.EndPass();
- encoder.Finish();
- }
+ encoder.Finish();
+ }
- {
- wgpu::TextureDescriptor textureDescriptor = baseTextureDescriptor;
- textureDescriptor.sampleCount = kMultisampledCount;
- textureDescriptor.format = kDepthStencilFormat;
- wgpu::Texture multisampledDepthStencilTexture =
- device.CreateTexture(&textureDescriptor);
- utils::ComboRenderPassDescriptor renderPassDescriptor(
- {}, multisampledDepthStencilTexture.CreateView());
+ {
+ wgpu::TextureDescriptor textureDescriptor = baseTextureDescriptor;
+ textureDescriptor.sampleCount = kMultisampledCount;
+ textureDescriptor.format = kDepthStencilFormat;
+ wgpu::Texture multisampledDepthStencilTexture = device.CreateTexture(&textureDescriptor);
+ utils::ComboRenderPassDescriptor renderPassDescriptor(
+ {}, multisampledDepthStencilTexture.CreateView());
- wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
- wgpu::RenderPassEncoder renderPass = encoder.BeginRenderPass(&renderPassDescriptor);
- renderPass.SetPipeline(multisampledPipelineWithDepthStencilOnly);
- renderPass.EndPass();
+ wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
+ wgpu::RenderPassEncoder renderPass = encoder.BeginRenderPass(&renderPassDescriptor);
+ renderPass.SetPipeline(multisampledPipelineWithDepthStencilOnly);
+ renderPass.EndPass();
- encoder.Finish();
- }
+ encoder.Finish();
}
// It is not allowed to use non-multisampled render pass and multisampled render pipeline.
{
- {
- wgpu::TextureDescriptor textureDescriptor = baseTextureDescriptor;
- textureDescriptor.format = kColorFormat;
- textureDescriptor.sampleCount = 1;
- wgpu::Texture nonMultisampledColorTexture = device.CreateTexture(&textureDescriptor);
- utils::ComboRenderPassDescriptor nonMultisampledRenderPassDescriptor(
- {nonMultisampledColorTexture.CreateView()});
+ wgpu::TextureDescriptor textureDescriptor = baseTextureDescriptor;
+ textureDescriptor.format = kColorFormat;
+ textureDescriptor.sampleCount = 1;
+ wgpu::Texture nonMultisampledColorTexture = device.CreateTexture(&textureDescriptor);
+ utils::ComboRenderPassDescriptor nonMultisampledRenderPassDescriptor(
+ {nonMultisampledColorTexture.CreateView()});
- wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
- wgpu::RenderPassEncoder renderPass =
- encoder.BeginRenderPass(&nonMultisampledRenderPassDescriptor);
- renderPass.SetPipeline(multisampledPipeline);
- renderPass.EndPass();
+ wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
+ wgpu::RenderPassEncoder renderPass =
+ encoder.BeginRenderPass(&nonMultisampledRenderPassDescriptor);
+ renderPass.SetPipeline(multisampledPipeline);
+ renderPass.EndPass();
- ASSERT_DEVICE_ERROR(encoder.Finish());
- }
+ ASSERT_DEVICE_ERROR(encoder.Finish());
+ }
- {
- wgpu::TextureDescriptor textureDescriptor = baseTextureDescriptor;
- textureDescriptor.sampleCount = 1;
- textureDescriptor.format = kDepthStencilFormat;
- wgpu::Texture multisampledDepthStencilTexture =
- device.CreateTexture(&textureDescriptor);
- utils::ComboRenderPassDescriptor renderPassDescriptor(
- {}, multisampledDepthStencilTexture.CreateView());
+ {
+ wgpu::TextureDescriptor textureDescriptor = baseTextureDescriptor;
+ textureDescriptor.sampleCount = 1;
+ textureDescriptor.format = kDepthStencilFormat;
+ wgpu::Texture multisampledDepthStencilTexture = device.CreateTexture(&textureDescriptor);
+ utils::ComboRenderPassDescriptor renderPassDescriptor(
+ {}, multisampledDepthStencilTexture.CreateView());
- wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
- wgpu::RenderPassEncoder renderPass = encoder.BeginRenderPass(&renderPassDescriptor);
- renderPass.SetPipeline(multisampledPipelineWithDepthStencilOnly);
- renderPass.EndPass();
+ wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
+ wgpu::RenderPassEncoder renderPass = encoder.BeginRenderPass(&renderPassDescriptor);
+ renderPass.SetPipeline(multisampledPipelineWithDepthStencilOnly);
+ renderPass.EndPass();
- ASSERT_DEVICE_ERROR(encoder.Finish());
- }
+ ASSERT_DEVICE_ERROR(encoder.Finish());
}
}
@@ -406,7 +397,7 @@
std::ostringstream stream;
stream << R"(
- [[set(0), binding(0)]] var<uniform_constant> myTexture : texture_sampled_2d<)"
+ [[set(0), binding(0)]] var<uniform_constant> myTexture : texture_2d<)"
<< kScalarTypes[i] << R"(>;
[[stage(fragment)]] fn main() -> void {
@@ -431,12 +422,12 @@
TEST_F(RenderPipelineValidationTest, TextureViewDimensionCompatibility) {
constexpr uint32_t kNumTextureViewDimensions = 6u;
std::array<const char*, kNumTextureViewDimensions> kTextureKeywords = {{
- "texture_sampled_1d",
- "texture_sampled_2d",
- "texture_sampled_2d_array",
- "texture_sampled_cube",
- "texture_sampled_cube_array",
- "texture_sampled_3d",
+ "texture_1d",
+ "texture_2d",
+ "texture_2d_array",
+ "texture_cube",
+ "texture_cube_array",
+ "texture_3d",
}};
std::array<wgpu::TextureViewDimension, kNumTextureViewDimensions> kTextureViewDimensions = {{
@@ -529,22 +520,15 @@
constexpr uint32_t kNumListType = 3u;
constexpr uint32_t kNumIndexFormat = 3u;
- std::array<wgpu::PrimitiveTopology, kNumStripType> kStripTopologyTypes = {{
- wgpu::PrimitiveTopology::LineStrip,
- wgpu::PrimitiveTopology::TriangleStrip
- }};
+ std::array<wgpu::PrimitiveTopology, kNumStripType> kStripTopologyTypes = {
+ {wgpu::PrimitiveTopology::LineStrip, wgpu::PrimitiveTopology::TriangleStrip}};
- std::array<wgpu::PrimitiveTopology, kNumListType> kListTopologyTypes = {{
- wgpu::PrimitiveTopology::PointList,
- wgpu::PrimitiveTopology::LineList,
- wgpu::PrimitiveTopology::TriangleList
- }};
+ std::array<wgpu::PrimitiveTopology, kNumListType> kListTopologyTypes = {
+ {wgpu::PrimitiveTopology::PointList, wgpu::PrimitiveTopology::LineList,
+ wgpu::PrimitiveTopology::TriangleList}};
- std::array<wgpu::IndexFormat, kNumIndexFormat> kIndexFormatTypes = {{
- wgpu::IndexFormat::Undefined,
- wgpu::IndexFormat::Uint16,
- wgpu::IndexFormat::Uint32
- }};
+ std::array<wgpu::IndexFormat, kNumIndexFormat> kIndexFormatTypes = {
+ {wgpu::IndexFormat::Undefined, wgpu::IndexFormat::Uint16, wgpu::IndexFormat::Uint32}};
for (wgpu::PrimitiveTopology primitiveTopology : kStripTopologyTypes) {
for (wgpu::IndexFormat indexFormat : kIndexFormatTypes) {