[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>
This commit is contained in:
Ben Clayton 2021-01-13 20:29:08 +00:00 committed by Commit Bot service account
parent 4607aa4c75
commit cd9dc36d2e
5 changed files with 108 additions and 124 deletions

View File

@ -106,7 +106,7 @@ void init() {
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 {

View File

@ -58,7 +58,7 @@ namespace dawn_native {
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 {

View File

@ -1772,11 +1772,11 @@ TEST_F(BindGroupLayoutCompatibilityTest, ROStorageInBGLWithRWStorageInShader) {
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 @@ TEST_F(BindGroupLayoutCompatibilityTest, TextureViewDimension) {
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 {
})";

View File

@ -210,7 +210,7 @@ TEST_F(GetBindGroupLayoutTests, BindingType) {
{
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 @@ TEST_F(GetBindGroupLayoutTests, ViewDimension) {
{
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 @@ TEST_F(GetBindGroupLayoutTests, ViewDimension) {
{
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 @@ TEST_F(GetBindGroupLayoutTests, ViewDimension) {
{
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 @@ TEST_F(GetBindGroupLayoutTests, ViewDimension) {
{
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 @@ TEST_F(GetBindGroupLayoutTests, ViewDimension) {
{
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 @@ TEST_F(GetBindGroupLayoutTests, ViewDimension) {
{
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 @@ TEST_F(GetBindGroupLayoutTests, TextureComponentType) {
{
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 @@ TEST_F(GetBindGroupLayoutTests, TextureComponentType) {
{
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 @@ TEST_F(GetBindGroupLayoutTests, TextureComponentType) {
{
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_F(GetBindGroupLayoutTests, ConflictingBindingType) {
// 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_F(GetBindGroupLayoutTests, ConflictingBindingTextureMultisampling) {
// 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_F(GetBindGroupLayoutTests, ConflictingBindingViewDimension) {
// 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 {
})");

View File

@ -257,111 +257,102 @@ TEST_F(RenderPipelineValidationTest, SampleCountCompatibilityWithRenderPass) {
// 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 @@ TEST_F(RenderPipelineValidationTest, TextureComponentTypeCompatibility) {
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, TextureComponentTypeCompatibility) {
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 @@ TEST_F(RenderPipelineValidationTest, StripIndexFormatRequired) {
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) {