mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-06-18 04:23:36 +00:00
[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:
parent
4607aa4c75
commit
cd9dc36d2e
@ -106,7 +106,7 @@ 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>;
|
||||||
[[set(0), binding(0)]] var<uniform_constant> mySampler: sampler;
|
[[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>;
|
[[location(0)]] var<out> FragColor : vec4<f32>;
|
||||||
[[stage(fragment)]] fn main() -> void {
|
[[stage(fragment)]] fn main() -> void {
|
||||||
|
@ -58,7 +58,7 @@ namespace dawn_native {
|
|||||||
|
|
||||||
static const char sPassthrough2D4ChannelFrag[] = R"(
|
static const char sPassthrough2D4ChannelFrag[] = R"(
|
||||||
[[binding(1), set(0)]] var<uniform_constant> mySampler: sampler;
|
[[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<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 {
|
||||||
|
@ -1772,11 +1772,11 @@ TEST_F(BindGroupLayoutCompatibilityTest, ROStorageInBGLWithRWStorageInShader) {
|
|||||||
|
|
||||||
TEST_F(BindGroupLayoutCompatibilityTest, TextureViewDimension) {
|
TEST_F(BindGroupLayoutCompatibilityTest, TextureViewDimension) {
|
||||||
constexpr char kTexture2DShaderFS[] = R"(
|
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 {
|
[[stage(fragment)]] fn main() -> void {
|
||||||
})";
|
})";
|
||||||
constexpr char kTexture2DShaderCS[] = R"(
|
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 {
|
[[stage(compute)]] fn main() -> void {
|
||||||
})";
|
})";
|
||||||
|
|
||||||
@ -1809,11 +1809,11 @@ TEST_F(BindGroupLayoutCompatibilityTest, TextureViewDimension) {
|
|||||||
wgpu::TextureViewDimension::e2DArray}})}));
|
wgpu::TextureViewDimension::e2DArray}})}));
|
||||||
|
|
||||||
constexpr char kTexture2DArrayShaderFS[] = R"(
|
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 {
|
[[stage(fragment)]] fn main() -> void {
|
||||||
})";
|
})";
|
||||||
constexpr char kTexture2DArrayShaderCS[] = R"(
|
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 {
|
[[stage(compute)]] fn main() -> void {
|
||||||
})";
|
})";
|
||||||
|
|
||||||
|
@ -210,7 +210,7 @@ TEST_F(GetBindGroupLayoutTests, BindingType) {
|
|||||||
{
|
{
|
||||||
binding.type = wgpu::BindingType::SampledTexture;
|
binding.type = wgpu::BindingType::SampledTexture;
|
||||||
wgpu::RenderPipeline pipeline = RenderPipelineFromFragmentShader(R"(
|
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 {
|
[[stage(fragment)]] fn main() -> void {
|
||||||
})");
|
})");
|
||||||
@ -252,7 +252,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"(
|
||||||
[[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 {
|
[[stage(fragment)]] fn main() -> void {
|
||||||
})");
|
})");
|
||||||
@ -262,7 +262,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"(
|
||||||
[[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 {
|
[[stage(fragment)]] fn main() -> void {
|
||||||
})");
|
})");
|
||||||
@ -272,7 +272,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"(
|
||||||
[[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 {
|
[[stage(fragment)]] fn main() -> void {
|
||||||
})");
|
})");
|
||||||
@ -282,7 +282,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"(
|
||||||
[[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 {
|
[[stage(fragment)]] fn main() -> void {
|
||||||
})");
|
})");
|
||||||
@ -292,7 +292,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"(
|
||||||
[[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 {
|
[[stage(fragment)]] fn main() -> void {
|
||||||
})");
|
})");
|
||||||
@ -302,7 +302,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"(
|
||||||
[[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 {
|
[[stage(fragment)]] fn main() -> void {
|
||||||
})");
|
})");
|
||||||
@ -323,7 +323,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"(
|
||||||
[[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 {
|
[[stage(fragment)]] fn main() -> void {
|
||||||
})");
|
})");
|
||||||
@ -333,7 +333,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"(
|
||||||
[[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 {
|
[[stage(fragment)]] fn main() -> void {
|
||||||
})");
|
})");
|
||||||
@ -343,7 +343,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"(
|
||||||
[[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 {
|
[[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 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"(
|
||||||
[[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 {
|
[[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 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"(
|
||||||
[[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 {
|
[[stage(vertex)]] fn main() -> void {
|
||||||
})");
|
})");
|
||||||
|
|
||||||
wgpu::ShaderModule fsModule = utils::CreateShaderModuleFromWGSL(device, R"(
|
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 {
|
[[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 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"(
|
||||||
[[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 {
|
[[stage(vertex)]] fn main() -> void {
|
||||||
})");
|
})");
|
||||||
|
|
||||||
wgpu::ShaderModule fsModule = utils::CreateShaderModuleFromWGSL(device, R"(
|
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 {
|
[[stage(fragment)]] fn main() -> void {
|
||||||
})");
|
})");
|
||||||
|
@ -257,111 +257,102 @@ TEST_F(RenderPipelineValidationTest, SampleCountCompatibilityWithRenderPass) {
|
|||||||
|
|
||||||
// It is not allowed to use multisampled render pass and non-multisampled render pipeline.
|
// It is not allowed to use multisampled render pass and non-multisampled render pipeline.
|
||||||
{
|
{
|
||||||
{
|
wgpu::TextureDescriptor textureDescriptor = baseTextureDescriptor;
|
||||||
wgpu::TextureDescriptor textureDescriptor = baseTextureDescriptor;
|
textureDescriptor.format = kColorFormat;
|
||||||
textureDescriptor.format = kColorFormat;
|
textureDescriptor.sampleCount = kMultisampledCount;
|
||||||
textureDescriptor.sampleCount = kMultisampledCount;
|
wgpu::Texture multisampledColorTexture = device.CreateTexture(&textureDescriptor);
|
||||||
wgpu::Texture multisampledColorTexture = device.CreateTexture(&textureDescriptor);
|
utils::ComboRenderPassDescriptor renderPassDescriptor(
|
||||||
utils::ComboRenderPassDescriptor renderPassDescriptor(
|
{multisampledColorTexture.CreateView()});
|
||||||
{multisampledColorTexture.CreateView()});
|
|
||||||
|
|
||||||
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
|
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
|
||||||
wgpu::RenderPassEncoder renderPass = encoder.BeginRenderPass(&renderPassDescriptor);
|
wgpu::RenderPassEncoder renderPass = encoder.BeginRenderPass(&renderPassDescriptor);
|
||||||
renderPass.SetPipeline(nonMultisampledPipeline);
|
renderPass.SetPipeline(nonMultisampledPipeline);
|
||||||
renderPass.EndPass();
|
renderPass.EndPass();
|
||||||
|
|
||||||
ASSERT_DEVICE_ERROR(encoder.Finish());
|
ASSERT_DEVICE_ERROR(encoder.Finish());
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
wgpu::TextureDescriptor textureDescriptor = baseTextureDescriptor;
|
wgpu::TextureDescriptor textureDescriptor = baseTextureDescriptor;
|
||||||
textureDescriptor.sampleCount = kMultisampledCount;
|
textureDescriptor.sampleCount = kMultisampledCount;
|
||||||
textureDescriptor.format = kDepthStencilFormat;
|
textureDescriptor.format = kDepthStencilFormat;
|
||||||
wgpu::Texture multisampledDepthStencilTexture =
|
wgpu::Texture multisampledDepthStencilTexture = device.CreateTexture(&textureDescriptor);
|
||||||
device.CreateTexture(&textureDescriptor);
|
utils::ComboRenderPassDescriptor renderPassDescriptor(
|
||||||
utils::ComboRenderPassDescriptor renderPassDescriptor(
|
{}, multisampledDepthStencilTexture.CreateView());
|
||||||
{}, multisampledDepthStencilTexture.CreateView());
|
|
||||||
|
|
||||||
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
|
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
|
||||||
wgpu::RenderPassEncoder renderPass = encoder.BeginRenderPass(&renderPassDescriptor);
|
wgpu::RenderPassEncoder renderPass = encoder.BeginRenderPass(&renderPassDescriptor);
|
||||||
renderPass.SetPipeline(nonMultisampledPipelineWithDepthStencilOnly);
|
renderPass.SetPipeline(nonMultisampledPipelineWithDepthStencilOnly);
|
||||||
renderPass.EndPass();
|
renderPass.EndPass();
|
||||||
|
|
||||||
ASSERT_DEVICE_ERROR(encoder.Finish());
|
ASSERT_DEVICE_ERROR(encoder.Finish());
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// It is allowed to use multisampled render pass and multisampled render pipeline.
|
// It is allowed to use multisampled render pass and multisampled render pipeline.
|
||||||
{
|
{
|
||||||
{
|
wgpu::TextureDescriptor textureDescriptor = baseTextureDescriptor;
|
||||||
wgpu::TextureDescriptor textureDescriptor = baseTextureDescriptor;
|
textureDescriptor.format = kColorFormat;
|
||||||
textureDescriptor.format = kColorFormat;
|
textureDescriptor.sampleCount = kMultisampledCount;
|
||||||
textureDescriptor.sampleCount = kMultisampledCount;
|
wgpu::Texture multisampledColorTexture = device.CreateTexture(&textureDescriptor);
|
||||||
wgpu::Texture multisampledColorTexture = device.CreateTexture(&textureDescriptor);
|
utils::ComboRenderPassDescriptor renderPassDescriptor(
|
||||||
utils::ComboRenderPassDescriptor renderPassDescriptor(
|
{multisampledColorTexture.CreateView()});
|
||||||
{multisampledColorTexture.CreateView()});
|
|
||||||
|
|
||||||
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
|
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
|
||||||
wgpu::RenderPassEncoder renderPass = encoder.BeginRenderPass(&renderPassDescriptor);
|
wgpu::RenderPassEncoder renderPass = encoder.BeginRenderPass(&renderPassDescriptor);
|
||||||
renderPass.SetPipeline(multisampledPipeline);
|
renderPass.SetPipeline(multisampledPipeline);
|
||||||
renderPass.EndPass();
|
renderPass.EndPass();
|
||||||
|
|
||||||
encoder.Finish();
|
encoder.Finish();
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
wgpu::TextureDescriptor textureDescriptor = baseTextureDescriptor;
|
wgpu::TextureDescriptor textureDescriptor = baseTextureDescriptor;
|
||||||
textureDescriptor.sampleCount = kMultisampledCount;
|
textureDescriptor.sampleCount = kMultisampledCount;
|
||||||
textureDescriptor.format = kDepthStencilFormat;
|
textureDescriptor.format = kDepthStencilFormat;
|
||||||
wgpu::Texture multisampledDepthStencilTexture =
|
wgpu::Texture multisampledDepthStencilTexture = device.CreateTexture(&textureDescriptor);
|
||||||
device.CreateTexture(&textureDescriptor);
|
utils::ComboRenderPassDescriptor renderPassDescriptor(
|
||||||
utils::ComboRenderPassDescriptor renderPassDescriptor(
|
{}, multisampledDepthStencilTexture.CreateView());
|
||||||
{}, multisampledDepthStencilTexture.CreateView());
|
|
||||||
|
|
||||||
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
|
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
|
||||||
wgpu::RenderPassEncoder renderPass = encoder.BeginRenderPass(&renderPassDescriptor);
|
wgpu::RenderPassEncoder renderPass = encoder.BeginRenderPass(&renderPassDescriptor);
|
||||||
renderPass.SetPipeline(multisampledPipelineWithDepthStencilOnly);
|
renderPass.SetPipeline(multisampledPipelineWithDepthStencilOnly);
|
||||||
renderPass.EndPass();
|
renderPass.EndPass();
|
||||||
|
|
||||||
encoder.Finish();
|
encoder.Finish();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// It is not allowed to use non-multisampled render pass and multisampled render pipeline.
|
// It is not allowed to use non-multisampled render pass and multisampled render pipeline.
|
||||||
{
|
{
|
||||||
{
|
wgpu::TextureDescriptor textureDescriptor = baseTextureDescriptor;
|
||||||
wgpu::TextureDescriptor textureDescriptor = baseTextureDescriptor;
|
textureDescriptor.format = kColorFormat;
|
||||||
textureDescriptor.format = kColorFormat;
|
textureDescriptor.sampleCount = 1;
|
||||||
textureDescriptor.sampleCount = 1;
|
wgpu::Texture nonMultisampledColorTexture = device.CreateTexture(&textureDescriptor);
|
||||||
wgpu::Texture nonMultisampledColorTexture = device.CreateTexture(&textureDescriptor);
|
utils::ComboRenderPassDescriptor nonMultisampledRenderPassDescriptor(
|
||||||
utils::ComboRenderPassDescriptor nonMultisampledRenderPassDescriptor(
|
{nonMultisampledColorTexture.CreateView()});
|
||||||
{nonMultisampledColorTexture.CreateView()});
|
|
||||||
|
|
||||||
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
|
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
|
||||||
wgpu::RenderPassEncoder renderPass =
|
wgpu::RenderPassEncoder renderPass =
|
||||||
encoder.BeginRenderPass(&nonMultisampledRenderPassDescriptor);
|
encoder.BeginRenderPass(&nonMultisampledRenderPassDescriptor);
|
||||||
renderPass.SetPipeline(multisampledPipeline);
|
renderPass.SetPipeline(multisampledPipeline);
|
||||||
renderPass.EndPass();
|
renderPass.EndPass();
|
||||||
|
|
||||||
ASSERT_DEVICE_ERROR(encoder.Finish());
|
ASSERT_DEVICE_ERROR(encoder.Finish());
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
wgpu::TextureDescriptor textureDescriptor = baseTextureDescriptor;
|
wgpu::TextureDescriptor textureDescriptor = baseTextureDescriptor;
|
||||||
textureDescriptor.sampleCount = 1;
|
textureDescriptor.sampleCount = 1;
|
||||||
textureDescriptor.format = kDepthStencilFormat;
|
textureDescriptor.format = kDepthStencilFormat;
|
||||||
wgpu::Texture multisampledDepthStencilTexture =
|
wgpu::Texture multisampledDepthStencilTexture = device.CreateTexture(&textureDescriptor);
|
||||||
device.CreateTexture(&textureDescriptor);
|
utils::ComboRenderPassDescriptor renderPassDescriptor(
|
||||||
utils::ComboRenderPassDescriptor renderPassDescriptor(
|
{}, multisampledDepthStencilTexture.CreateView());
|
||||||
{}, multisampledDepthStencilTexture.CreateView());
|
|
||||||
|
|
||||||
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
|
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
|
||||||
wgpu::RenderPassEncoder renderPass = encoder.BeginRenderPass(&renderPassDescriptor);
|
wgpu::RenderPassEncoder renderPass = encoder.BeginRenderPass(&renderPassDescriptor);
|
||||||
renderPass.SetPipeline(multisampledPipelineWithDepthStencilOnly);
|
renderPass.SetPipeline(multisampledPipelineWithDepthStencilOnly);
|
||||||
renderPass.EndPass();
|
renderPass.EndPass();
|
||||||
|
|
||||||
ASSERT_DEVICE_ERROR(encoder.Finish());
|
ASSERT_DEVICE_ERROR(encoder.Finish());
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -406,7 +397,7 @@ TEST_F(RenderPipelineValidationTest, TextureComponentTypeCompatibility) {
|
|||||||
|
|
||||||
std::ostringstream stream;
|
std::ostringstream stream;
|
||||||
stream << R"(
|
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"(>;
|
<< kScalarTypes[i] << R"(>;
|
||||||
|
|
||||||
[[stage(fragment)]] fn main() -> void {
|
[[stage(fragment)]] fn main() -> void {
|
||||||
@ -431,12 +422,12 @@ TEST_F(RenderPipelineValidationTest, TextureComponentTypeCompatibility) {
|
|||||||
TEST_F(RenderPipelineValidationTest, TextureViewDimensionCompatibility) {
|
TEST_F(RenderPipelineValidationTest, TextureViewDimensionCompatibility) {
|
||||||
constexpr uint32_t kNumTextureViewDimensions = 6u;
|
constexpr uint32_t kNumTextureViewDimensions = 6u;
|
||||||
std::array<const char*, kNumTextureViewDimensions> kTextureKeywords = {{
|
std::array<const char*, kNumTextureViewDimensions> kTextureKeywords = {{
|
||||||
"texture_sampled_1d",
|
"texture_1d",
|
||||||
"texture_sampled_2d",
|
"texture_2d",
|
||||||
"texture_sampled_2d_array",
|
"texture_2d_array",
|
||||||
"texture_sampled_cube",
|
"texture_cube",
|
||||||
"texture_sampled_cube_array",
|
"texture_cube_array",
|
||||||
"texture_sampled_3d",
|
"texture_3d",
|
||||||
}};
|
}};
|
||||||
|
|
||||||
std::array<wgpu::TextureViewDimension, kNumTextureViewDimensions> kTextureViewDimensions = {{
|
std::array<wgpu::TextureViewDimension, kNumTextureViewDimensions> kTextureViewDimensions = {{
|
||||||
@ -529,22 +520,15 @@ TEST_F(RenderPipelineValidationTest, StripIndexFormatRequired) {
|
|||||||
constexpr uint32_t kNumListType = 3u;
|
constexpr uint32_t kNumListType = 3u;
|
||||||
constexpr uint32_t kNumIndexFormat = 3u;
|
constexpr uint32_t kNumIndexFormat = 3u;
|
||||||
|
|
||||||
std::array<wgpu::PrimitiveTopology, kNumStripType> kStripTopologyTypes = {{
|
std::array<wgpu::PrimitiveTopology, kNumStripType> kStripTopologyTypes = {
|
||||||
wgpu::PrimitiveTopology::LineStrip,
|
{wgpu::PrimitiveTopology::LineStrip, wgpu::PrimitiveTopology::TriangleStrip}};
|
||||||
wgpu::PrimitiveTopology::TriangleStrip
|
|
||||||
}};
|
|
||||||
|
|
||||||
std::array<wgpu::PrimitiveTopology, kNumListType> kListTopologyTypes = {{
|
std::array<wgpu::PrimitiveTopology, kNumListType> kListTopologyTypes = {
|
||||||
wgpu::PrimitiveTopology::PointList,
|
{wgpu::PrimitiveTopology::PointList, wgpu::PrimitiveTopology::LineList,
|
||||||
wgpu::PrimitiveTopology::LineList,
|
wgpu::PrimitiveTopology::TriangleList}};
|
||||||
wgpu::PrimitiveTopology::TriangleList
|
|
||||||
}};
|
|
||||||
|
|
||||||
std::array<wgpu::IndexFormat, kNumIndexFormat> kIndexFormatTypes = {{
|
std::array<wgpu::IndexFormat, kNumIndexFormat> kIndexFormatTypes = {
|
||||||
wgpu::IndexFormat::Undefined,
|
{wgpu::IndexFormat::Undefined, wgpu::IndexFormat::Uint16, wgpu::IndexFormat::Uint32}};
|
||||||
wgpu::IndexFormat::Uint16,
|
|
||||||
wgpu::IndexFormat::Uint32
|
|
||||||
}};
|
|
||||||
|
|
||||||
for (wgpu::PrimitiveTopology primitiveTopology : kStripTopologyTypes) {
|
for (wgpu::PrimitiveTopology primitiveTopology : kStripTopologyTypes) {
|
||||||
for (wgpu::IndexFormat indexFormat : kIndexFormatTypes) {
|
for (wgpu::IndexFormat indexFormat : kIndexFormatTypes) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user