Updating names of attachment clear values
Renames multiple attachment clear values to match their new names in the spec, deprecating the old ones. - GPURenderPassColorAttachment.clearColor -> clearValue - GPURenderPassDepthStencilAttachment.clearDepth -> depthClearValue - GPURenderPassDepthStencilAttachment.clearStencil -> stencilClearValue Additionally, the old names are marked as deprecated with appropriate warnings if they are used during the deprecation period. Bug: dawn:1269 Change-Id: I6649184d65578118942c1f51a41f350719665272 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/80941 Reviewed-by: Shrek Shao <shrekshao@google.com> Reviewed-by: Austin Eng <enga@chromium.org> Commit-Queue: Brandon Jones <bajones@chromium.org>
This commit is contained in:
parent
b0179f49fa
commit
6e8c473fa5
|
@ -1800,7 +1800,8 @@
|
|||
{"name": "resolve target", "type": "texture view", "optional": true},
|
||||
{"name": "load op", "type": "load op"},
|
||||
{"name": "store op", "type": "store op"},
|
||||
{"name": "clear color", "type": "color"}
|
||||
{"name": "clear color", "type": "color", "default": "{ NAN, NAN, NAN, NAN }" },
|
||||
{"name": "clear value", "type": "color" }
|
||||
]
|
||||
},
|
||||
|
||||
|
@ -1810,11 +1811,13 @@
|
|||
{"name": "view", "type": "texture view"},
|
||||
{"name": "depth load op", "type": "load op", "default": "undefined"},
|
||||
{"name": "depth store op", "type": "store op", "default": "undefined"},
|
||||
{"name": "clear depth", "type": "float", "default": "0"},
|
||||
{"name": "clear depth", "type": "float", "default": "NAN"},
|
||||
{"name": "depth clear value", "type": "float", "default": "0"},
|
||||
{"name": "depth read only", "type": "bool", "default": "false"},
|
||||
{"name": "stencil load op", "type": "load op", "default": "undefined"},
|
||||
{"name": "stencil store op", "type": "store op", "default": "undefined"},
|
||||
{"name": "clear stencil", "type": "uint32_t", "default": "0"},
|
||||
{"name": "stencil clear value", "type": "uint32_t", "default": "0"},
|
||||
{"name": "stencil read only", "type": "bool", "default": "false"}
|
||||
]
|
||||
},
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
|
||||
#include "dawn/{{api}}.h"
|
||||
#include "dawn/EnumClassBitmasks.h"
|
||||
#include <cmath>
|
||||
|
||||
namespace {{metadata.namespace}} {
|
||||
|
||||
|
@ -153,6 +154,8 @@ namespace {{metadata.namespace}} {
|
|||
{{" "}}= {{as_cppType(member.type.name)}}::{{as_cppEnum(Name(member.default_value))}}
|
||||
{%- elif member.type.category == "native" and member.default_value != None -%}
|
||||
{{" "}}= {{member.default_value}}
|
||||
{%- elif member.default_value != None -%}
|
||||
{{" "}}= {{member.default_value}}
|
||||
{%- else -%}
|
||||
{{assert(member.default_value == None)}}
|
||||
{%- endif -%}
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
{% set native_namespace = namespace_name.namespace_case() %}
|
||||
{% set native_dir = impl_dir + namespace_name.Dirs() %}
|
||||
#include "{{native_dir}}/Forward.h"
|
||||
#include <cmath>
|
||||
|
||||
namespace {{native_namespace}} {
|
||||
|
||||
|
@ -36,6 +37,8 @@ namespace {{native_namespace}} {
|
|||
{{" "}}= {{namespace}}::{{as_cppType(member.type.name)}}::{{as_cppEnum(Name(member.default_value))}}
|
||||
{%- elif member.type.category == "native" and member.default_value != None -%}
|
||||
{{" "}}= {{member.default_value}}
|
||||
{%- elif member.default_value != None -%}
|
||||
{{" "}}= {{member.default_value}}
|
||||
{%- else -%}
|
||||
{{assert(member.default_value == None)}}
|
||||
{%- endif -%}
|
||||
|
|
|
@ -43,6 +43,11 @@ namespace dawn::native {
|
|||
|
||||
namespace {
|
||||
|
||||
bool HasDeprecatedColor(const RenderPassColorAttachment& attachment) {
|
||||
return !std::isnan(attachment.clearColor.r) || !std::isnan(attachment.clearColor.g) ||
|
||||
!std::isnan(attachment.clearColor.b) || !std::isnan(attachment.clearColor.a);
|
||||
}
|
||||
|
||||
MaybeError ValidateB2BCopyAlignment(uint64_t dataSize,
|
||||
uint64_t srcOffset,
|
||||
uint64_t dstOffset) {
|
||||
|
@ -233,13 +238,19 @@ namespace dawn::native {
|
|||
DAWN_TRY(ValidateLoadOp(colorAttachment.loadOp));
|
||||
DAWN_TRY(ValidateStoreOp(colorAttachment.storeOp));
|
||||
|
||||
// TODO(dawn:1269): Remove after the deprecation period.
|
||||
bool useClearColor = HasDeprecatedColor(colorAttachment);
|
||||
const dawn::native::Color& clearValue =
|
||||
useClearColor ? colorAttachment.clearColor : colorAttachment.clearValue;
|
||||
if (useClearColor) {
|
||||
device->EmitDeprecationWarning(
|
||||
"clearColor is deprecated, prefer using clearValue instead.");
|
||||
}
|
||||
|
||||
if (colorAttachment.loadOp == wgpu::LoadOp::Clear) {
|
||||
DAWN_INVALID_IF(std::isnan(colorAttachment.clearColor.r) ||
|
||||
std::isnan(colorAttachment.clearColor.g) ||
|
||||
std::isnan(colorAttachment.clearColor.b) ||
|
||||
std::isnan(colorAttachment.clearColor.a),
|
||||
"Color clear value (%s) contain a NaN.",
|
||||
&colorAttachment.clearColor);
|
||||
DAWN_INVALID_IF(std::isnan(clearValue.r) || std::isnan(clearValue.g) ||
|
||||
std::isnan(clearValue.b) || std::isnan(clearValue.a),
|
||||
"Color clear value (%s) contain a NaN.", &clearValue);
|
||||
}
|
||||
|
||||
DAWN_TRY(ValidateOrSetColorAttachmentSampleCount(attachment, sampleCount));
|
||||
|
@ -331,9 +342,22 @@ namespace dawn::native {
|
|||
DAWN_TRY(ValidateStoreOp(depthStencilAttachment->stencilStoreOp));
|
||||
}
|
||||
|
||||
DAWN_INVALID_IF(depthStencilAttachment->depthLoadOp == wgpu::LoadOp::Clear &&
|
||||
std::isnan(depthStencilAttachment->clearDepth),
|
||||
"Depth clear value is NaN.");
|
||||
if (!std::isnan(depthStencilAttachment->clearDepth)) {
|
||||
// TODO(dawn:1269): Remove this branch after the deprecation period.
|
||||
device->EmitDeprecationWarning(
|
||||
"clearDepth is deprecated, prefer depthClearValue instead.");
|
||||
} else {
|
||||
DAWN_INVALID_IF(depthStencilAttachment->depthLoadOp == wgpu::LoadOp::Clear &&
|
||||
std::isnan(depthStencilAttachment->depthClearValue),
|
||||
"depthClearValue is NaN.");
|
||||
}
|
||||
|
||||
// TODO(dawn:1269): Remove after the deprecation period.
|
||||
if (depthStencilAttachment->stencilClearValue == 0 &&
|
||||
depthStencilAttachment->clearStencil != 0) {
|
||||
device->EmitDeprecationWarning(
|
||||
"clearStencil is deprecated, prefer stencilClearValue instead.");
|
||||
}
|
||||
|
||||
// *sampleCount == 0 must only happen when there is no color attachment. In that case we
|
||||
// do not need to validate the sample count of the depth stencil attachment.
|
||||
|
@ -641,8 +665,11 @@ namespace dawn::native {
|
|||
cmd->colorAttachments[index].resolveTarget = resolveTarget;
|
||||
cmd->colorAttachments[index].loadOp = descriptor->colorAttachments[i].loadOp;
|
||||
cmd->colorAttachments[index].storeOp = descriptor->colorAttachments[i].storeOp;
|
||||
|
||||
cmd->colorAttachments[index].clearColor =
|
||||
descriptor->colorAttachments[i].clearColor;
|
||||
HasDeprecatedColor(descriptor->colorAttachments[i])
|
||||
? descriptor->colorAttachments[i].clearColor
|
||||
: descriptor->colorAttachments[i].clearValue;
|
||||
|
||||
usageTracker.TextureViewUsedAs(view, wgpu::TextureUsage::RenderAttachment);
|
||||
|
||||
|
@ -656,10 +683,26 @@ namespace dawn::native {
|
|||
TextureViewBase* view = descriptor->depthStencilAttachment->view;
|
||||
|
||||
cmd->depthStencilAttachment.view = view;
|
||||
cmd->depthStencilAttachment.clearDepth =
|
||||
descriptor->depthStencilAttachment->clearDepth;
|
||||
cmd->depthStencilAttachment.clearStencil =
|
||||
descriptor->depthStencilAttachment->clearStencil;
|
||||
|
||||
if (!std::isnan(descriptor->depthStencilAttachment->clearDepth)) {
|
||||
// TODO(dawn:1269): Remove this branch after the deprecation period.
|
||||
cmd->depthStencilAttachment.clearDepth =
|
||||
descriptor->depthStencilAttachment->clearDepth;
|
||||
} else {
|
||||
cmd->depthStencilAttachment.clearDepth =
|
||||
descriptor->depthStencilAttachment->depthClearValue;
|
||||
}
|
||||
|
||||
if (descriptor->depthStencilAttachment->stencilClearValue == 0 &&
|
||||
descriptor->depthStencilAttachment->clearStencil != 0) {
|
||||
// TODO(dawn:1269): Remove this branch after the deprecation period.
|
||||
cmd->depthStencilAttachment.clearStencil =
|
||||
descriptor->depthStencilAttachment->clearStencil;
|
||||
} else {
|
||||
cmd->depthStencilAttachment.clearStencil =
|
||||
descriptor->depthStencilAttachment->stencilClearValue;
|
||||
}
|
||||
|
||||
cmd->depthStencilAttachment.depthReadOnly =
|
||||
descriptor->depthStencilAttachment->depthReadOnly;
|
||||
cmd->depthStencilAttachment.stencilReadOnly =
|
||||
|
|
|
@ -577,7 +577,7 @@ namespace dawn::native {
|
|||
colorAttachmentDesc.view = dstView.Get();
|
||||
colorAttachmentDesc.loadOp = wgpu::LoadOp::Load;
|
||||
colorAttachmentDesc.storeOp = wgpu::StoreOp::Store;
|
||||
colorAttachmentDesc.clearColor = {0.0, 0.0, 0.0, 1.0};
|
||||
colorAttachmentDesc.clearValue = {0.0, 0.0, 0.0, 1.0};
|
||||
|
||||
// Create render pass.
|
||||
RenderPassDescriptor renderPassDesc;
|
||||
|
|
|
@ -107,7 +107,7 @@ class BufferZeroInitTest : public DawnTest {
|
|||
|
||||
utils::ComboRenderPassDescriptor renderPassDescriptor(
|
||||
{texture.CreateView(&viewDescriptor)});
|
||||
renderPassDescriptor.cColorAttachments[0].clearColor = color;
|
||||
renderPassDescriptor.cColorAttachments[0].clearValue = color;
|
||||
wgpu::RenderPassEncoder renderPass = encoder.BeginRenderPass(&renderPassDescriptor);
|
||||
renderPass.End();
|
||||
}
|
||||
|
|
|
@ -72,12 +72,12 @@ TEST_P(ClipSpaceTest, ClipSpace) {
|
|||
|
||||
utils::ComboRenderPassDescriptor renderPassDescriptor({colorTexture.CreateView()},
|
||||
depthStencilTexture.CreateView());
|
||||
renderPassDescriptor.cColorAttachments[0].clearColor = {0.0, 1.0, 0.0, 1.0};
|
||||
renderPassDescriptor.cColorAttachments[0].clearValue = {0.0, 1.0, 0.0, 1.0};
|
||||
renderPassDescriptor.cColorAttachments[0].loadOp = wgpu::LoadOp::Clear;
|
||||
|
||||
// Clear the depth stencil attachment to 0.5f, so only the bottom-right triangle should be
|
||||
// drawn.
|
||||
renderPassDescriptor.cDepthStencilAttachmentInfo.clearDepth = 0.5f;
|
||||
renderPassDescriptor.cDepthStencilAttachmentInfo.depthClearValue = 0.5f;
|
||||
renderPassDescriptor.cDepthStencilAttachmentInfo.depthLoadOp = wgpu::LoadOp::Clear;
|
||||
|
||||
wgpu::CommandEncoder commandEncoder = device.CreateCommandEncoder();
|
||||
|
|
|
@ -1039,7 +1039,7 @@ TEST_P(CopyTests_T2B, CopyOneRowWithDepth32Float) {
|
|||
// Initialize the depth texture with 0.5f.
|
||||
constexpr float kClearDepthValue = 0.5f;
|
||||
utils::ComboRenderPassDescriptor renderPass({}, texture.CreateView());
|
||||
renderPass.cDepthStencilAttachmentInfo.clearDepth = kClearDepthValue;
|
||||
renderPass.cDepthStencilAttachmentInfo.depthClearValue = kClearDepthValue;
|
||||
renderPass.cDepthStencilAttachmentInfo.depthLoadOp = wgpu::LoadOp::Clear;
|
||||
renderPass.cDepthStencilAttachmentInfo.depthStoreOp = wgpu::StoreOp::Store;
|
||||
wgpu::RenderPassEncoder renderPassEncoder = encoder.BeginRenderPass(&renderPass);
|
||||
|
|
|
@ -80,7 +80,7 @@ class CreatePipelineAsyncTest : public DawnTest {
|
|||
|
||||
utils::ComboRenderPassDescriptor renderPassDescriptor({outputTexture.CreateView()});
|
||||
renderPassDescriptor.cColorAttachments[0].loadOp = wgpu::LoadOp::Clear;
|
||||
renderPassDescriptor.cColorAttachments[0].clearColor = {1.f, 0.f, 0.f, 1.f};
|
||||
renderPassDescriptor.cColorAttachments[0].clearValue = {1.f, 0.f, 0.f, 1.f};
|
||||
|
||||
wgpu::CommandBuffer commands;
|
||||
{
|
||||
|
@ -293,7 +293,7 @@ TEST_P(CreatePipelineAsyncTest, ReleaseEntryPointsAfterCreateRenderPipelineAsync
|
|||
|
||||
utils::ComboRenderPassDescriptor renderPassDescriptor({outputTexture.CreateView()});
|
||||
renderPassDescriptor.cColorAttachments[0].loadOp = wgpu::LoadOp::Clear;
|
||||
renderPassDescriptor.cColorAttachments[0].clearColor = {1.f, 0.f, 0.f, 1.f};
|
||||
renderPassDescriptor.cColorAttachments[0].clearValue = {1.f, 0.f, 0.f, 1.f};
|
||||
|
||||
wgpu::CommandBuffer commands;
|
||||
{
|
||||
|
@ -728,9 +728,9 @@ TEST_P(CreatePipelineAsyncTest, CreateRenderPipelineAsyncWithDepthStencilState)
|
|||
// to 0.
|
||||
utils::ComboRenderPassDescriptor renderPass({renderTargetView}, depthStencilView);
|
||||
renderPass.cColorAttachments[0].loadOp = wgpu::LoadOp::Clear;
|
||||
renderPass.cColorAttachments[0].clearColor = {0.0, 1.0, 0.0, 1.0};
|
||||
renderPass.cColorAttachments[0].clearValue = {0.0, 1.0, 0.0, 1.0};
|
||||
renderPass.cDepthStencilAttachmentInfo.stencilLoadOp = wgpu::LoadOp::Clear;
|
||||
renderPass.cDepthStencilAttachmentInfo.clearStencil = 0u;
|
||||
renderPass.cDepthStencilAttachmentInfo.stencilClearValue = 0u;
|
||||
|
||||
wgpu::RenderPipeline pipeline;
|
||||
{
|
||||
|
@ -801,7 +801,7 @@ TEST_P(CreatePipelineAsyncTest, CreateRenderPipelineWithMultisampleState) {
|
|||
// (1, 0, 0, 1).
|
||||
utils::ComboRenderPassDescriptor renderPass({renderTargetView});
|
||||
renderPass.cColorAttachments[0].loadOp = wgpu::LoadOp::Clear;
|
||||
renderPass.cColorAttachments[0].clearColor = {1.0, 0.0, 0.0, 1.0};
|
||||
renderPass.cColorAttachments[0].clearValue = {1.0, 0.0, 0.0, 1.0};
|
||||
renderPass.cColorAttachments[0].resolveTarget = resolveTargetView;
|
||||
|
||||
wgpu::RenderPipeline pipeline;
|
||||
|
@ -873,9 +873,9 @@ TEST_P(CreatePipelineAsyncTest, CreateRenderPipelineAsyncWithBlendState) {
|
|||
// Prepare two color attachments
|
||||
utils::ComboRenderPassDescriptor renderPass({renderTargetViews[0], renderTargetViews[1]});
|
||||
renderPass.cColorAttachments[0].loadOp = wgpu::LoadOp::Clear;
|
||||
renderPass.cColorAttachments[0].clearColor = {0.2, 0.0, 0.0, 0.2};
|
||||
renderPass.cColorAttachments[0].clearValue = {0.2, 0.0, 0.0, 0.2};
|
||||
renderPass.cColorAttachments[1].loadOp = wgpu::LoadOp::Clear;
|
||||
renderPass.cColorAttachments[1].clearColor = {0.0, 0.2, 0.0, 0.2};
|
||||
renderPass.cColorAttachments[1].clearValue = {0.0, 0.2, 0.0, 0.2};
|
||||
|
||||
{
|
||||
utils::ComboRenderPipelineDescriptor renderPipelineDescriptor;
|
||||
|
@ -949,8 +949,8 @@ TEST_P(CreatePipelineAsyncTest, CreateRenderPipelineAsyncWithBlendState) {
|
|||
queue.Submit(1, &commands);
|
||||
|
||||
// When the blend states are all set correctly, the color of renderTargets[0] should be
|
||||
// (0.6, 0, 0, 0.6) = colorAttachment0.clearColor + (0.4, 0.0, 0.0, 0.4), and the color of
|
||||
// renderTargets[1] should be (0.8, 0, 0, 0.8) = (1, 0, 0, 1) - colorAttachment1.clearColor.
|
||||
// (0.6, 0, 0, 0.6) = colorAttachment0.clearValue + (0.4, 0.0, 0.0, 0.4), and the color of
|
||||
// renderTargets[1] should be (0.8, 0, 0, 0.8) = (1, 0, 0, 1) - colorAttachment1.clearValue.
|
||||
RGBA8 expected0 = {153, 0, 0, 153};
|
||||
RGBA8 expected1 = {0, 204, 0, 204};
|
||||
EXPECT_PIXEL_RGBA8_EQ(expected0, renderTargets[0], 0, 0);
|
||||
|
|
|
@ -75,7 +75,7 @@ class CullingTest : public DawnTest {
|
|||
wgpu::Texture colorTexture = Create2DTextureForTest(wgpu::TextureFormat::RGBA8Unorm);
|
||||
|
||||
utils::ComboRenderPassDescriptor renderPassDescriptor({colorTexture.CreateView()});
|
||||
renderPassDescriptor.cColorAttachments[0].clearColor = {0.0, 0.0, 1.0, 1.0};
|
||||
renderPassDescriptor.cColorAttachments[0].clearValue = {0.0, 0.0, 1.0, 1.0};
|
||||
renderPassDescriptor.cColorAttachments[0].loadOp = wgpu::LoadOp::Clear;
|
||||
|
||||
wgpu::CommandEncoder commandEncoder = device.CreateCommandEncoder();
|
||||
|
|
|
@ -326,7 +326,7 @@ class D3D12SharedHandleUsageTests : public D3D12ResourceTestBase {
|
|||
|
||||
// Submit a clear operation
|
||||
utils::ComboRenderPassDescriptor renderPassDescriptor({wrappedView}, {});
|
||||
renderPassDescriptor.cColorAttachments[0].clearColor = clearColor;
|
||||
renderPassDescriptor.cColorAttachments[0].clearValue = clearColor;
|
||||
|
||||
wgpu::CommandEncoder encoder = wgpuDevice.CreateCommandEncoder();
|
||||
wgpu::RenderPassEncoder pass = encoder.BeginRenderPass(&renderPassDescriptor);
|
||||
|
|
|
@ -73,6 +73,54 @@ TEST_P(DeprecationTests, ReadOnlyDepthStencilStoreLoadOpsAttachment) {
|
|||
pass.End();
|
||||
}
|
||||
|
||||
// Test that setting the clearColor, clearDepth, or clearStencil values for render pass attachments
|
||||
// is deprecated. (dawn:1269)
|
||||
TEST_P(DeprecationTests, AttachmentClearColor) {
|
||||
utils::BasicRenderPass renderPass = utils::CreateBasicRenderPass(device, 1, 1);
|
||||
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
|
||||
wgpu::RenderPassEncoder pass;
|
||||
|
||||
// Check that setting load/store ops with read only depth/stencil attachments gives a warning.
|
||||
wgpu::TextureDescriptor descriptor;
|
||||
descriptor.dimension = wgpu::TextureDimension::e2D;
|
||||
descriptor.size = {1, 1, 1};
|
||||
descriptor.sampleCount = 1;
|
||||
descriptor.format = wgpu::TextureFormat::Depth24PlusStencil8;
|
||||
descriptor.mipLevelCount = 1;
|
||||
descriptor.usage = wgpu::TextureUsage::RenderAttachment;
|
||||
wgpu::Texture depthStencil = device.CreateTexture(&descriptor);
|
||||
|
||||
wgpu::RenderPassDepthStencilAttachment* depthAttachment =
|
||||
&renderPass.renderPassInfo.cDepthStencilAttachmentInfo;
|
||||
renderPass.renderPassInfo.depthStencilAttachment = depthAttachment;
|
||||
depthAttachment->view = depthStencil.CreateView();
|
||||
depthAttachment->depthLoadOp = wgpu::LoadOp::Clear;
|
||||
depthAttachment->stencilLoadOp = wgpu::LoadOp::Clear;
|
||||
|
||||
// A pass that uses none of the deprecated value should be fine.
|
||||
pass = encoder.BeginRenderPass(&renderPass.renderPassInfo);
|
||||
pass.End();
|
||||
|
||||
depthAttachment->clearStencil = 1;
|
||||
|
||||
EXPECT_DEPRECATION_WARNING(pass = encoder.BeginRenderPass(&renderPass.renderPassInfo));
|
||||
pass.End();
|
||||
|
||||
depthAttachment->clearStencil = 0;
|
||||
depthAttachment->depthClearValue = 0.0f;
|
||||
depthAttachment->clearDepth = 1.0f;
|
||||
|
||||
EXPECT_DEPRECATION_WARNING(pass = encoder.BeginRenderPass(&renderPass.renderPassInfo));
|
||||
pass.End();
|
||||
|
||||
renderPass.renderPassInfo.depthStencilAttachment = nullptr;
|
||||
renderPass.renderPassInfo.cColorAttachments[0].clearColor = {1.0, 2.0, 3.0, 4.0};
|
||||
renderPass.renderPassInfo.cColorAttachments[0].clearValue = {5.0, 4.0, 3.0, 2.0};
|
||||
|
||||
EXPECT_DEPRECATION_WARNING(pass = encoder.BeginRenderPass(&renderPass.renderPassInfo));
|
||||
pass.End();
|
||||
}
|
||||
|
||||
// Test that endPass() is deprecated for both render and compute passes.
|
||||
TEST_P(DeprecationTests, EndPass) {
|
||||
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
|
||||
|
|
|
@ -92,7 +92,7 @@ class DepthBiasTests : public DawnTest {
|
|||
// Create a render pass which clears depth to depthClear
|
||||
utils::ComboRenderPassDescriptor renderPassDesc({mRenderTarget.CreateView()},
|
||||
mDepthTexture.CreateView());
|
||||
renderPassDesc.cDepthStencilAttachmentInfo.clearDepth = depthClear;
|
||||
renderPassDesc.cDepthStencilAttachmentInfo.depthClearValue = depthClear;
|
||||
|
||||
// Create a render pipeline to render the quad
|
||||
utils::ComboRenderPipelineDescriptor renderPipelineDesc;
|
||||
|
|
|
@ -150,7 +150,7 @@ class DepthStencilCopyTests : public DawnTestWithParams<DepthStencilCopyTestPara
|
|||
viewDesc.mipLevelCount = 1;
|
||||
|
||||
utils::ComboRenderPassDescriptor renderPassDesc({}, texture.CreateView(&viewDesc));
|
||||
renderPassDesc.cDepthStencilAttachmentInfo.clearDepth = clearDepth;
|
||||
renderPassDesc.cDepthStencilAttachmentInfo.depthClearValue = clearDepth;
|
||||
|
||||
utils::ComboRenderPipelineDescriptor renderPipelineDesc;
|
||||
PopulatePipelineDescriptorWriteDepth(&renderPipelineDesc, GetParam().mTextureFormat,
|
||||
|
@ -181,8 +181,8 @@ class DepthStencilCopyTests : public DawnTestWithParams<DepthStencilCopyTestPara
|
|||
viewDesc.mipLevelCount = 1;
|
||||
|
||||
utils::ComboRenderPassDescriptor renderPassDesc({}, texture.CreateView(&viewDesc));
|
||||
renderPassDesc.cDepthStencilAttachmentInfo.clearDepth = clearDepth;
|
||||
renderPassDesc.cDepthStencilAttachmentInfo.clearStencil = clearStencil;
|
||||
renderPassDesc.cDepthStencilAttachmentInfo.depthClearValue = clearDepth;
|
||||
renderPassDesc.cDepthStencilAttachmentInfo.stencilClearValue = clearStencil;
|
||||
|
||||
utils::ComboRenderPipelineDescriptor renderPipelineDesc;
|
||||
PopulatePipelineDescriptorWriteDepth(&renderPipelineDesc, GetParam().mTextureFormat,
|
||||
|
@ -599,7 +599,7 @@ TEST_P(StencilCopyTests, ToStencilAspect) {
|
|||
|
||||
// Clear depth to 0.7, so we can check that the stencil copy doesn't mutate the depth.
|
||||
utils::ComboRenderPassDescriptor passDescriptor({}, depthStencilTexture.CreateView());
|
||||
passDescriptor.cDepthStencilAttachmentInfo.clearDepth = 0.7;
|
||||
passDescriptor.cDepthStencilAttachmentInfo.depthClearValue = 0.7;
|
||||
|
||||
wgpu::RenderPassEncoder pass = commandEncoder.BeginRenderPass(&passDescriptor);
|
||||
pass.End();
|
||||
|
|
|
@ -85,9 +85,9 @@ namespace {
|
|||
textureViews[mipLevel] = texture.CreateView(&textureViewDesc);
|
||||
|
||||
utils::ComboRenderPassDescriptor renderPassDescriptor({}, textureViews[mipLevel]);
|
||||
renderPassDescriptor.cDepthStencilAttachmentInfo.clearDepth =
|
||||
renderPassDescriptor.cDepthStencilAttachmentInfo.depthClearValue =
|
||||
kDepthValues[mipLevel];
|
||||
renderPassDescriptor.cDepthStencilAttachmentInfo.clearStencil =
|
||||
renderPassDescriptor.cDepthStencilAttachmentInfo.stencilClearValue =
|
||||
kStencilValues[mipLevel];
|
||||
renderPassDescriptors.push_back(renderPassDescriptor);
|
||||
}
|
||||
|
|
|
@ -266,7 +266,7 @@ class DepthStencilSamplingTest : public DawnTestWithParams<DepthStencilSamplingT
|
|||
wgpu::Texture texture,
|
||||
float depthValue) {
|
||||
utils::ComboRenderPassDescriptor passDescriptor({}, texture.CreateView());
|
||||
passDescriptor.cDepthStencilAttachmentInfo.clearDepth = depthValue;
|
||||
passDescriptor.cDepthStencilAttachmentInfo.depthClearValue = depthValue;
|
||||
|
||||
wgpu::RenderPassEncoder pass = commandEncoder.BeginRenderPass(&passDescriptor);
|
||||
pass.End();
|
||||
|
@ -276,7 +276,7 @@ class DepthStencilSamplingTest : public DawnTestWithParams<DepthStencilSamplingT
|
|||
wgpu::Texture texture,
|
||||
uint8_t stencilValue) {
|
||||
utils::ComboRenderPassDescriptor passDescriptor({}, texture.CreateView());
|
||||
passDescriptor.cDepthStencilAttachmentInfo.clearStencil = stencilValue;
|
||||
passDescriptor.cDepthStencilAttachmentInfo.stencilClearValue = stencilValue;
|
||||
|
||||
wgpu::RenderPassEncoder pass = commandEncoder.BeginRenderPass(&passDescriptor);
|
||||
pass.End();
|
||||
|
@ -657,8 +657,8 @@ TEST_P(DepthStencilSamplingTest, SampleDepthAndStencilRender) {
|
|||
|
||||
// Initialize both depth and stencil aspects.
|
||||
utils::ComboRenderPassDescriptor passDescriptor({}, inputTexture.CreateView());
|
||||
passDescriptor.cDepthStencilAttachmentInfo.clearDepth = 0.43f;
|
||||
passDescriptor.cDepthStencilAttachmentInfo.clearStencil = 31;
|
||||
passDescriptor.cDepthStencilAttachmentInfo.depthClearValue = 0.43f;
|
||||
passDescriptor.cDepthStencilAttachmentInfo.stencilClearValue = 31;
|
||||
|
||||
wgpu::RenderPassEncoder pass = commandEncoder.BeginRenderPass(&passDescriptor);
|
||||
pass.End();
|
||||
|
@ -679,13 +679,13 @@ TEST_P(DepthStencilSamplingTest, SampleDepthAndStencilRender) {
|
|||
queue.Submit(1, &commands);
|
||||
|
||||
float expectedDepth = 0.0f;
|
||||
memcpy(&expectedDepth, &passDescriptor.cDepthStencilAttachmentInfo.clearDepth,
|
||||
memcpy(&expectedDepth, &passDescriptor.cDepthStencilAttachmentInfo.depthClearValue,
|
||||
sizeof(float));
|
||||
EXPECT_BUFFER(depthOutput, 0, sizeof(float),
|
||||
new ::detail::ExpectEq<float>(expectedDepth, tolerance));
|
||||
|
||||
uint8_t expectedStencil = 0;
|
||||
memcpy(&expectedStencil, &passDescriptor.cDepthStencilAttachmentInfo.clearStencil,
|
||||
memcpy(&expectedStencil, &passDescriptor.cDepthStencilAttachmentInfo.stencilClearValue,
|
||||
sizeof(uint8_t));
|
||||
EXPECT_BUFFER_U32_EQ(expectedStencil, stencilOutput, 0);
|
||||
}
|
||||
|
@ -708,8 +708,8 @@ TEST_P(DepthStencilSamplingTest, SampleDepthAndStencilRender) {
|
|||
wgpu::CommandEncoder commandEncoder = device.CreateCommandEncoder();
|
||||
// Initialize both depth and stencil aspects.
|
||||
utils::ComboRenderPassDescriptor passDescriptor({}, inputTexture.CreateView());
|
||||
passDescriptor.cDepthStencilAttachmentInfo.clearDepth = 0.43f;
|
||||
passDescriptor.cDepthStencilAttachmentInfo.clearStencil = 31;
|
||||
passDescriptor.cDepthStencilAttachmentInfo.depthClearValue = 0.43f;
|
||||
passDescriptor.cDepthStencilAttachmentInfo.stencilClearValue = 31;
|
||||
|
||||
wgpu::RenderPassEncoder pass = commandEncoder.BeginRenderPass(&passDescriptor);
|
||||
pass.End();
|
||||
|
@ -727,13 +727,13 @@ TEST_P(DepthStencilSamplingTest, SampleDepthAndStencilRender) {
|
|||
queue.Submit(1, &commands);
|
||||
|
||||
float expectedDepth = 0.0f;
|
||||
memcpy(&expectedDepth, &passDescriptor.cDepthStencilAttachmentInfo.clearDepth,
|
||||
memcpy(&expectedDepth, &passDescriptor.cDepthStencilAttachmentInfo.depthClearValue,
|
||||
sizeof(float));
|
||||
EXPECT_BUFFER(depthOutput, 0, sizeof(float),
|
||||
new ::detail::ExpectEq<float>(expectedDepth, tolerance));
|
||||
|
||||
uint8_t expectedStencil = 0;
|
||||
memcpy(&expectedStencil, &passDescriptor.cDepthStencilAttachmentInfo.clearStencil,
|
||||
memcpy(&expectedStencil, &passDescriptor.cDepthStencilAttachmentInfo.stencilClearValue,
|
||||
sizeof(uint8_t));
|
||||
EXPECT_BUFFER_U32_EQ(expectedStencil, stencilOutput, 0);
|
||||
}
|
||||
|
|
|
@ -97,7 +97,7 @@ TEST_P(ExternalTextureTests, SampleExternalTexture) {
|
|||
// Initialize texture with green to ensure it is sampled from later.
|
||||
{
|
||||
utils::ComboRenderPassDescriptor renderPass({externalView}, nullptr);
|
||||
renderPass.cColorAttachments[0].clearColor = {0.0f, 1.0f, 0.0f, 1.0f};
|
||||
renderPass.cColorAttachments[0].clearValue = {0.0f, 1.0f, 0.0f, 1.0f};
|
||||
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
|
||||
wgpu::RenderPassEncoder pass = encoder.BeginRenderPass(&renderPass);
|
||||
pass.End();
|
||||
|
@ -201,8 +201,8 @@ TEST_P(ExternalTextureTests, SampleMultiplanarExternalTexture) {
|
|||
{
|
||||
utils::ComboRenderPassDescriptor renderPass({externalViewPlane0, externalViewPlane1},
|
||||
nullptr);
|
||||
renderPass.cColorAttachments[0].clearColor = {expectation.y, 0.0f, 0.0f, 0.0f};
|
||||
renderPass.cColorAttachments[1].clearColor = {expectation.u, expectation.v, 0.0f, 0.0f};
|
||||
renderPass.cColorAttachments[0].clearValue = {expectation.y, 0.0f, 0.0f, 0.0f};
|
||||
renderPass.cColorAttachments[1].clearValue = {expectation.u, expectation.v, 0.0f, 0.0f};
|
||||
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
|
||||
wgpu::RenderPassEncoder pass = encoder.BeginRenderPass(&renderPass);
|
||||
pass.End();
|
||||
|
|
|
@ -350,7 +350,7 @@ class IOSurfaceUsageTests : public IOSurfaceTestBase {
|
|||
wgpu::TextureView ioSurfaceView = ioSurfaceTexture.CreateView();
|
||||
|
||||
utils::ComboRenderPassDescriptor renderPassDescriptor({ioSurfaceView}, {});
|
||||
renderPassDescriptor.cColorAttachments[0].clearColor = {1 / 255.0f, 2 / 255.0f, 3 / 255.0f,
|
||||
renderPassDescriptor.cColorAttachments[0].clearValue = {1 / 255.0f, 2 / 255.0f, 3 / 255.0f,
|
||||
4 / 255.0f};
|
||||
|
||||
// Execute commands to clear the ioSurface
|
||||
|
|
|
@ -163,12 +163,12 @@ class MultisampledRenderingTest : public DawnTest {
|
|||
uint32_t i = 0;
|
||||
for (const wgpu::TextureView& resolveTargetView : resolveTargetViews) {
|
||||
renderPass.cColorAttachments[i].loadOp = colorLoadOp;
|
||||
renderPass.cColorAttachments[i].clearColor = kClearColor;
|
||||
renderPass.cColorAttachments[i].clearValue = kClearColor;
|
||||
renderPass.cColorAttachments[i].resolveTarget = resolveTargetView;
|
||||
++i;
|
||||
}
|
||||
|
||||
renderPass.cDepthStencilAttachmentInfo.clearDepth = kClearDepth;
|
||||
renderPass.cDepthStencilAttachmentInfo.depthClearValue = kClearDepth;
|
||||
renderPass.cDepthStencilAttachmentInfo.depthLoadOp = depthStencilLoadOp;
|
||||
|
||||
if (hasDepthStencilAttachment) {
|
||||
|
|
|
@ -198,7 +198,7 @@ TEST_P(MultisampledSamplingTest, SamplePositions) {
|
|||
uint32_t sampleOffset = (iter * kSampleCount + sample);
|
||||
|
||||
utils::ComboRenderPassDescriptor renderPass({colorView}, depthView);
|
||||
renderPass.cDepthStencilAttachmentInfo.clearDepth = 0.f;
|
||||
renderPass.cDepthStencilAttachmentInfo.depthClearValue = 0.f;
|
||||
|
||||
wgpu::RenderPassEncoder renderPassEncoder = commandEncoder.BeginRenderPass(&renderPass);
|
||||
renderPassEncoder.SetPipeline(drawPipeline);
|
||||
|
|
|
@ -150,10 +150,11 @@ class ReadOnlyDepthStencilAttachmentTests
|
|||
wgpu::TextureView depthStencilViewInAttachment = depthStencilTexture.CreateView();
|
||||
utils::ComboRenderPassDescriptor passDescriptorInit({}, depthStencilViewInAttachment);
|
||||
if (aspect == wgpu::TextureAspect::DepthOnly) {
|
||||
passDescriptorInit.cDepthStencilAttachmentInfo.clearDepth = values->depthInitValue;
|
||||
passDescriptorInit.cDepthStencilAttachmentInfo.depthClearValue = values->depthInitValue;
|
||||
} else {
|
||||
ASSERT(aspect == wgpu::TextureAspect::StencilOnly);
|
||||
passDescriptorInit.cDepthStencilAttachmentInfo.clearStencil = values->stencilInitValue;
|
||||
passDescriptorInit.cDepthStencilAttachmentInfo.stencilClearValue =
|
||||
values->stencilInitValue;
|
||||
}
|
||||
wgpu::RenderPassEncoder passInit = commandEncoder.BeginRenderPass(&passDescriptorInit);
|
||||
passInit.End();
|
||||
|
|
|
@ -112,7 +112,7 @@ class RenderPassLoadOpTests : public DawnTest {
|
|||
wgpu::Texture texture = device.CreateTexture(&textureDescriptor);
|
||||
|
||||
utils::ComboRenderPassDescriptor renderPassDescriptor({texture.CreateView()});
|
||||
renderPassDescriptor.cColorAttachments[0].clearColor = clearColor;
|
||||
renderPassDescriptor.cColorAttachments[0].clearValue = clearColor;
|
||||
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
|
||||
wgpu::RenderPassEncoder renderPass = encoder.BeginRenderPass(&renderPassDescriptor);
|
||||
renderPass.End();
|
||||
|
@ -156,7 +156,7 @@ TEST_P(RenderPassLoadOpTests, ColorClearThenLoadAndDraw) {
|
|||
auto commandsClearZero = commandsClearZeroEncoder.Finish();
|
||||
|
||||
utils::ComboRenderPassDescriptor renderPassClearGreen({renderTargetView});
|
||||
renderPassClearGreen.cColorAttachments[0].clearColor = {0.0f, 1.0f, 0.0f, 1.0f};
|
||||
renderPassClearGreen.cColorAttachments[0].clearValue = {0.0f, 1.0f, 0.0f, 1.0f};
|
||||
auto commandsClearGreenEncoder = device.CreateCommandEncoder();
|
||||
auto clearGreenPass = commandsClearGreenEncoder.BeginRenderPass(&renderPassClearGreen);
|
||||
clearGreenPass.End();
|
||||
|
|
|
@ -84,7 +84,7 @@ TEST_P(RenderPassTest, TwoRenderPassesInOneCommandBuffer) {
|
|||
// In the first render pass we clear renderTarget1 to red and draw a blue triangle in the
|
||||
// bottom left of renderTarget1.
|
||||
utils::ComboRenderPassDescriptor renderPass({renderTarget1.CreateView()});
|
||||
renderPass.cColorAttachments[0].clearColor = {1.0f, 0.0f, 0.0f, 1.0f};
|
||||
renderPass.cColorAttachments[0].clearValue = {1.0f, 0.0f, 0.0f, 1.0f};
|
||||
|
||||
wgpu::RenderPassEncoder pass = encoder.BeginRenderPass(&renderPass);
|
||||
pass.SetPipeline(pipeline);
|
||||
|
@ -96,7 +96,7 @@ TEST_P(RenderPassTest, TwoRenderPassesInOneCommandBuffer) {
|
|||
// In the second render pass we clear renderTarget2 to green and draw a blue triangle in the
|
||||
// bottom left of renderTarget2.
|
||||
utils::ComboRenderPassDescriptor renderPass({renderTarget2.CreateView()});
|
||||
renderPass.cColorAttachments[0].clearColor = {0.0f, 1.0f, 0.0f, 1.0f};
|
||||
renderPass.cColorAttachments[0].clearValue = {0.0f, 1.0f, 0.0f, 1.0f};
|
||||
|
||||
wgpu::RenderPassEncoder pass = encoder.BeginRenderPass(&renderPass);
|
||||
pass.SetPipeline(pipeline);
|
||||
|
@ -124,7 +124,7 @@ TEST_P(RenderPassTest, NoCorrespondingFragmentShaderOutputs) {
|
|||
wgpu::TextureView renderTargetView = renderTarget.CreateView();
|
||||
|
||||
utils::ComboRenderPassDescriptor renderPass({renderTargetView});
|
||||
renderPass.cColorAttachments[0].clearColor = {1.0f, 0.0f, 0.0f, 1.0f};
|
||||
renderPass.cColorAttachments[0].clearValue = {1.0f, 0.0f, 0.0f, 1.0f};
|
||||
renderPass.cColorAttachments[0].loadOp = wgpu::LoadOp::Clear;
|
||||
renderPass.cColorAttachments[0].storeOp = wgpu::StoreOp::Store;
|
||||
wgpu::RenderPassEncoder pass = encoder.BeginRenderPass(&renderPass);
|
||||
|
|
|
@ -474,7 +474,7 @@ fn IsEqualTo(pixel : vec4<f32>, expected : vec4<f32>) -> bool {
|
|||
wgpu::TextureUsage::RenderAttachment | wgpu::TextureUsage::CopySrc, {1, 1});
|
||||
utils::ComboRenderPassDescriptor renderPassDescriptor({outputTexture.CreateView()});
|
||||
renderPassDescriptor.cColorAttachments[0].loadOp = wgpu::LoadOp::Clear;
|
||||
renderPassDescriptor.cColorAttachments[0].clearColor = {1.f, 0.f, 0.f, 1.f};
|
||||
renderPassDescriptor.cColorAttachments[0].clearValue = {1.f, 0.f, 0.f, 1.f};
|
||||
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
|
||||
wgpu::RenderPassEncoder renderPassEncoder = encoder.BeginRenderPass(&renderPassDescriptor);
|
||||
renderPassEncoder.SetBindGroup(0, bindGroup);
|
||||
|
|
|
@ -46,7 +46,7 @@ class SubresourceRenderAttachmentTest : public DawnTest {
|
|||
switch (type) {
|
||||
case Type::Color: {
|
||||
utils::ComboRenderPassDescriptor renderPass({renderTargetView});
|
||||
renderPass.cColorAttachments[0].clearColor = {
|
||||
renderPass.cColorAttachments[0].clearValue = {
|
||||
static_cast<float>(expectedColor.r) / 255.f,
|
||||
static_cast<float>(expectedColor.g) / 255.f,
|
||||
static_cast<float>(expectedColor.b) / 255.f,
|
||||
|
@ -56,12 +56,12 @@ class SubresourceRenderAttachmentTest : public DawnTest {
|
|||
}
|
||||
case Type::Depth: {
|
||||
utils::ComboRenderPassDescriptor renderPass({}, renderTargetView);
|
||||
renderPass.cDepthStencilAttachmentInfo.clearDepth = expectedDepth;
|
||||
renderPass.cDepthStencilAttachmentInfo.depthClearValue = expectedDepth;
|
||||
return renderPass;
|
||||
}
|
||||
case Type::Stencil: {
|
||||
utils::ComboRenderPassDescriptor renderPass({}, renderTargetView);
|
||||
renderPass.cDepthStencilAttachmentInfo.clearStencil = expectedStencil;
|
||||
renderPass.cDepthStencilAttachmentInfo.stencilClearValue = expectedStencil;
|
||||
return renderPass;
|
||||
}
|
||||
default:
|
||||
|
|
|
@ -70,7 +70,7 @@ class SwapChainTests : public DawnTest {
|
|||
void ClearTexture(wgpu::TextureView view, wgpu::Color color) {
|
||||
utils::ComboRenderPassDescriptor desc({view});
|
||||
desc.cColorAttachments[0].loadOp = wgpu::LoadOp::Clear;
|
||||
desc.cColorAttachments[0].clearColor = color;
|
||||
desc.cColorAttachments[0].clearValue = color;
|
||||
|
||||
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
|
||||
wgpu::RenderPassEncoder pass = encoder.BeginRenderPass(&desc);
|
||||
|
|
|
@ -76,7 +76,7 @@ class TextureSubresourceTest : public DawnTest {
|
|||
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
|
||||
|
||||
utils::ComboRenderPassDescriptor renderPassDesc({view});
|
||||
renderPassDesc.cColorAttachments[0].clearColor = {0.0f, 0.0f, 0.0f, 1.0f};
|
||||
renderPassDesc.cColorAttachments[0].clearValue = {0.0f, 0.0f, 0.0f, 1.0f};
|
||||
wgpu::RenderPassEncoder pass = encoder.BeginRenderPass(&renderPassDesc);
|
||||
pass.SetPipeline(rp);
|
||||
pass.Draw(3);
|
||||
|
@ -125,7 +125,7 @@ class TextureSubresourceTest : public DawnTest {
|
|||
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
|
||||
|
||||
utils::ComboRenderPassDescriptor renderPassDesc({renderView});
|
||||
renderPassDesc.cColorAttachments[0].clearColor = {0.0f, 0.0f, 0.0f, 1.0f};
|
||||
renderPassDesc.cColorAttachments[0].clearValue = {0.0f, 0.0f, 0.0f, 1.0f};
|
||||
wgpu::RenderPassEncoder pass = encoder.BeginRenderPass(&renderPassDesc);
|
||||
pass.SetPipeline(rp);
|
||||
pass.SetBindGroup(0, bindGroup);
|
||||
|
|
|
@ -495,7 +495,7 @@ class TextureViewRenderingTest : public DawnTest {
|
|||
|
||||
// Clear textureView with Red(255, 0, 0, 255) and render Green(0, 255, 0, 255) into it
|
||||
utils::ComboRenderPassDescriptor renderPassInfo({textureView});
|
||||
renderPassInfo.cColorAttachments[0].clearColor = {1.0f, 0.0f, 0.0f, 1.0f};
|
||||
renderPassInfo.cColorAttachments[0].clearValue = {1.0f, 0.0f, 0.0f, 1.0f};
|
||||
|
||||
const char* oneColorFragmentShader = R"(
|
||||
@stage(fragment) fn main(@location(0) texCoord : vec2<f32>) ->
|
||||
|
|
|
@ -202,7 +202,7 @@ TEST_P(TextureZeroInitTest, RenderingMipMapClearsToZero) {
|
|||
// Specify loadOp Load. Clear should be used to zero-initialize.
|
||||
renderPass.renderPassInfo.cColorAttachments[0].loadOp = wgpu::LoadOp::Load;
|
||||
// Specify non-zero clear color. It should still be cleared to zero.
|
||||
renderPass.renderPassInfo.cColorAttachments[0].clearColor = {0.5f, 0.5f, 0.5f, 0.5f};
|
||||
renderPass.renderPassInfo.cColorAttachments[0].clearValue = {0.5f, 0.5f, 0.5f, 0.5f};
|
||||
renderPass.renderPassInfo.cColorAttachments[0].view = view;
|
||||
|
||||
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
|
||||
|
@ -247,7 +247,7 @@ TEST_P(TextureZeroInitTest, RenderingArrayLayerClearsToZero) {
|
|||
// Specify loadOp Load. Clear should be used to zero-initialize.
|
||||
renderPass.renderPassInfo.cColorAttachments[0].loadOp = wgpu::LoadOp::Load;
|
||||
// Specify non-zero clear color. It should still be cleared to zero.
|
||||
renderPass.renderPassInfo.cColorAttachments[0].clearColor = {0.5f, 0.5f, 0.5f, 0.5f};
|
||||
renderPass.renderPassInfo.cColorAttachments[0].clearValue = {0.5f, 0.5f, 0.5f, 0.5f};
|
||||
renderPass.renderPassInfo.cColorAttachments[0].view = view;
|
||||
|
||||
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
|
||||
|
@ -483,9 +483,9 @@ TEST_P(TextureZeroInitTest, RenderingLoadingDepth) {
|
|||
depthStencilTexture.CreateView());
|
||||
renderPassDescriptor.cDepthStencilAttachmentInfo.depthLoadOp = wgpu::LoadOp::Load;
|
||||
// Set clearDepth to non-zero. It should still be cleared to 0 by the loadOp.
|
||||
renderPassDescriptor.cDepthStencilAttachmentInfo.clearDepth = 0.5f;
|
||||
renderPassDescriptor.cDepthStencilAttachmentInfo.depthClearValue = 0.5f;
|
||||
renderPassDescriptor.cDepthStencilAttachmentInfo.stencilLoadOp = wgpu::LoadOp::Clear;
|
||||
renderPassDescriptor.cDepthStencilAttachmentInfo.clearStencil = 0;
|
||||
renderPassDescriptor.cDepthStencilAttachmentInfo.stencilClearValue = 0;
|
||||
renderPassDescriptor.cDepthStencilAttachmentInfo.depthStoreOp = wgpu::StoreOp::Store;
|
||||
renderPassDescriptor.cDepthStencilAttachmentInfo.stencilStoreOp = wgpu::StoreOp::Store;
|
||||
|
||||
|
@ -524,10 +524,10 @@ TEST_P(TextureZeroInitTest, RenderingLoadingStencil) {
|
|||
utils::ComboRenderPassDescriptor renderPassDescriptor({srcTexture.CreateView()},
|
||||
depthStencilTexture.CreateView());
|
||||
renderPassDescriptor.cDepthStencilAttachmentInfo.depthLoadOp = wgpu::LoadOp::Clear;
|
||||
renderPassDescriptor.cDepthStencilAttachmentInfo.clearDepth = 0.0f;
|
||||
renderPassDescriptor.cDepthStencilAttachmentInfo.depthClearValue = 0.0f;
|
||||
renderPassDescriptor.cDepthStencilAttachmentInfo.stencilLoadOp = wgpu::LoadOp::Load;
|
||||
// Set clearStencil to non-zero. It should still be cleared to 0 by the loadOp.
|
||||
renderPassDescriptor.cDepthStencilAttachmentInfo.clearStencil = 2;
|
||||
renderPassDescriptor.cDepthStencilAttachmentInfo.stencilClearValue = 2;
|
||||
renderPassDescriptor.cDepthStencilAttachmentInfo.depthStoreOp = wgpu::StoreOp::Store;
|
||||
renderPassDescriptor.cDepthStencilAttachmentInfo.stencilStoreOp = wgpu::StoreOp::Store;
|
||||
|
||||
|
@ -605,7 +605,7 @@ TEST_P(TextureZeroInitTest, IndependentDepthStencilLoadAfterDiscard) {
|
|||
utils::ComboRenderPassDescriptor renderPassDescriptor({},
|
||||
depthStencilTexture.CreateView());
|
||||
renderPassDescriptor.cDepthStencilAttachmentInfo.depthStoreOp = wgpu::StoreOp::Discard;
|
||||
renderPassDescriptor.cDepthStencilAttachmentInfo.clearStencil = 2;
|
||||
renderPassDescriptor.cDepthStencilAttachmentInfo.stencilClearValue = 2;
|
||||
renderPassDescriptor.cDepthStencilAttachmentInfo.stencilStoreOp = wgpu::StoreOp::Store;
|
||||
|
||||
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
|
||||
|
@ -678,7 +678,7 @@ TEST_P(TextureZeroInitTest, IndependentDepthStencilLoadAfterDiscard) {
|
|||
{
|
||||
utils::ComboRenderPassDescriptor renderPassDescriptor({},
|
||||
depthStencilTexture.CreateView());
|
||||
renderPassDescriptor.cDepthStencilAttachmentInfo.clearDepth = 0.7;
|
||||
renderPassDescriptor.cDepthStencilAttachmentInfo.depthClearValue = 0.7;
|
||||
renderPassDescriptor.cDepthStencilAttachmentInfo.depthStoreOp = wgpu::StoreOp::Store;
|
||||
renderPassDescriptor.cDepthStencilAttachmentInfo.stencilStoreOp =
|
||||
wgpu::StoreOp::Discard;
|
||||
|
@ -764,7 +764,7 @@ TEST_P(TextureZeroInitTest, IndependentDepthStencilCopyAfterDiscard) {
|
|||
// Clear the depth to 0.3 and discard the stencil.
|
||||
{
|
||||
utils::ComboRenderPassDescriptor renderPassDescriptor({}, depthStencilTexture.CreateView());
|
||||
renderPassDescriptor.cDepthStencilAttachmentInfo.clearDepth = 0.3;
|
||||
renderPassDescriptor.cDepthStencilAttachmentInfo.depthClearValue = 0.3;
|
||||
renderPassDescriptor.cDepthStencilAttachmentInfo.depthStoreOp = wgpu::StoreOp::Store;
|
||||
renderPassDescriptor.cDepthStencilAttachmentInfo.stencilStoreOp = wgpu::StoreOp::Discard;
|
||||
|
||||
|
@ -875,7 +875,7 @@ TEST_P(TextureZeroInitTest, RenderPassSampledTextureClear) {
|
|||
// Encode pass and submit
|
||||
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
|
||||
utils::ComboRenderPassDescriptor renderPassDesc({renderTexture.CreateView()});
|
||||
renderPassDesc.cColorAttachments[0].clearColor = {1.0, 1.0, 1.0, 1.0};
|
||||
renderPassDesc.cColorAttachments[0].clearValue = {1.0, 1.0, 1.0, 1.0};
|
||||
renderPassDesc.cColorAttachments[0].loadOp = wgpu::LoadOp::Clear;
|
||||
wgpu::RenderPassEncoder pass = encoder.BeginRenderPass(&renderPassDesc);
|
||||
pass.SetPipeline(renderPipeline);
|
||||
|
@ -933,7 +933,7 @@ TEST_P(TextureZeroInitTest, TextureBothSampledAndAttachmentClear) {
|
|||
// Encode pass and submit
|
||||
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
|
||||
utils::ComboRenderPassDescriptor renderPassDesc({attachmentView});
|
||||
renderPassDesc.cColorAttachments[0].clearColor = {1.0, 1.0, 1.0, 1.0};
|
||||
renderPassDesc.cColorAttachments[0].clearValue = {1.0, 1.0, 1.0, 1.0};
|
||||
renderPassDesc.cColorAttachments[0].loadOp = wgpu::LoadOp::Clear;
|
||||
wgpu::RenderPassEncoder pass = encoder.BeginRenderPass(&renderPassDesc);
|
||||
pass.SetPipeline(renderPipeline);
|
||||
|
@ -1160,7 +1160,7 @@ TEST_P(TextureZeroInitTest, RenderPassStoreOpClear) {
|
|||
// Encode pass and submit
|
||||
encoder = device.CreateCommandEncoder();
|
||||
utils::ComboRenderPassDescriptor renderPassDesc({renderTexture.CreateView()});
|
||||
renderPassDesc.cColorAttachments[0].clearColor = {0.0, 0.0, 0.0, 0.0};
|
||||
renderPassDesc.cColorAttachments[0].clearValue = {0.0, 0.0, 0.0, 0.0};
|
||||
renderPassDesc.cColorAttachments[0].loadOp = wgpu::LoadOp::Clear;
|
||||
renderPassDesc.cColorAttachments[0].storeOp = wgpu::StoreOp::Discard;
|
||||
wgpu::RenderPassEncoder pass = encoder.BeginRenderPass(&renderPassDesc);
|
||||
|
@ -1212,8 +1212,8 @@ TEST_P(TextureZeroInitTest, RenderingLoadingDepthStencilStoreOpClear) {
|
|||
depthStencilTexture.CreateView());
|
||||
renderPassDescriptor.cDepthStencilAttachmentInfo.depthLoadOp = wgpu::LoadOp::Clear;
|
||||
renderPassDescriptor.cDepthStencilAttachmentInfo.stencilLoadOp = wgpu::LoadOp::Clear;
|
||||
renderPassDescriptor.cDepthStencilAttachmentInfo.clearDepth = 1.0f;
|
||||
renderPassDescriptor.cDepthStencilAttachmentInfo.clearStencil = 1u;
|
||||
renderPassDescriptor.cDepthStencilAttachmentInfo.depthClearValue = 1.0f;
|
||||
renderPassDescriptor.cDepthStencilAttachmentInfo.stencilClearValue = 1u;
|
||||
renderPassDescriptor.cDepthStencilAttachmentInfo.depthStoreOp = wgpu::StoreOp::Discard;
|
||||
renderPassDescriptor.cDepthStencilAttachmentInfo.stencilStoreOp = wgpu::StoreOp::Discard;
|
||||
{
|
||||
|
@ -1307,7 +1307,7 @@ TEST_P(TextureZeroInitTest, PreservesInitializedMip) {
|
|||
// Encode pass and submit
|
||||
encoder = device.CreateCommandEncoder();
|
||||
utils::ComboRenderPassDescriptor renderPassDesc({renderTexture.CreateView()});
|
||||
renderPassDesc.cColorAttachments[0].clearColor = {0.0, 0.0, 0.0, 0.0};
|
||||
renderPassDesc.cColorAttachments[0].clearValue = {0.0, 0.0, 0.0, 0.0};
|
||||
renderPassDesc.cColorAttachments[0].loadOp = wgpu::LoadOp::Clear;
|
||||
renderPassDesc.cColorAttachments[0].storeOp = wgpu::StoreOp::Discard;
|
||||
wgpu::RenderPassEncoder pass = encoder.BeginRenderPass(&renderPassDesc);
|
||||
|
@ -1391,7 +1391,7 @@ TEST_P(TextureZeroInitTest, PreservesInitializedArrayLayer) {
|
|||
// Encode pass and submit
|
||||
encoder = device.CreateCommandEncoder();
|
||||
utils::ComboRenderPassDescriptor renderPassDesc({renderTexture.CreateView()});
|
||||
renderPassDesc.cColorAttachments[0].clearColor = {0.0, 0.0, 0.0, 0.0};
|
||||
renderPassDesc.cColorAttachments[0].clearValue = {0.0, 0.0, 0.0, 0.0};
|
||||
renderPassDesc.cColorAttachments[0].loadOp = wgpu::LoadOp::Clear;
|
||||
renderPassDesc.cColorAttachments[0].storeOp = wgpu::StoreOp::Discard;
|
||||
wgpu::RenderPassEncoder pass = encoder.BeginRenderPass(&renderPassDesc);
|
||||
|
|
|
@ -144,12 +144,12 @@ class VertexOnlyRenderPipelineTest : public DawnTest {
|
|||
utils::ComboRenderPassDescriptor clearPass =
|
||||
utils::ComboRenderPassDescriptor({renderTargetColor.CreateView()}, depthStencilView);
|
||||
clearPass.cDepthStencilAttachmentInfo.depthLoadOp = wgpu::LoadOp::Clear;
|
||||
clearPass.cDepthStencilAttachmentInfo.clearDepth = 0.0f;
|
||||
clearPass.cDepthStencilAttachmentInfo.depthClearValue = 0.0f;
|
||||
clearPass.cDepthStencilAttachmentInfo.stencilLoadOp = wgpu::LoadOp::Clear;
|
||||
clearPass.cDepthStencilAttachmentInfo.clearStencil = 0x0;
|
||||
clearPass.cDepthStencilAttachmentInfo.stencilClearValue = 0x0;
|
||||
for (auto& t : clearPass.cColorAttachments) {
|
||||
t.loadOp = wgpu::LoadOp::Clear;
|
||||
t.clearColor = {0.0, 0.0, 0.0, 0.0};
|
||||
t.clearValue = {0.0, 0.0, 0.0, 0.0};
|
||||
}
|
||||
|
||||
auto pass = encoder.BeginRenderPass(&clearPass);
|
||||
|
|
|
@ -117,7 +117,7 @@ class ViewportTest : public DawnTest {
|
|||
|
||||
// Render the three points with the viewport call.
|
||||
utils::ComboRenderPassDescriptor rpDesc({}, depthTexture.CreateView());
|
||||
rpDesc.cDepthStencilAttachmentInfo.clearDepth = 0.0f;
|
||||
rpDesc.cDepthStencilAttachmentInfo.depthClearValue = 0.0f;
|
||||
rpDesc.cDepthStencilAttachmentInfo.depthLoadOp = wgpu::LoadOp::Clear;
|
||||
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
|
||||
wgpu::RenderPassEncoder pass = encoder.BeginRenderPass(&rpDesc);
|
||||
|
|
|
@ -106,7 +106,7 @@ namespace {
|
|||
colorAttachments[i].view =
|
||||
Create2DAttachment(device, 1, 1, wgpu::TextureFormat::RGBA8Unorm);
|
||||
colorAttachments[i].resolveTarget = nullptr;
|
||||
colorAttachments[i].clearColor = {0.0f, 0.0f, 0.0f, 0.0f};
|
||||
colorAttachments[i].clearValue = {0.0f, 0.0f, 0.0f, 0.0f};
|
||||
colorAttachments[i].loadOp = wgpu::LoadOp::Clear;
|
||||
colorAttachments[i].storeOp = wgpu::StoreOp::Store;
|
||||
}
|
||||
|
@ -729,68 +729,68 @@ namespace {
|
|||
// Tests that NaN cannot be used in clearColor.
|
||||
{
|
||||
utils::ComboRenderPassDescriptor renderPass({color}, nullptr);
|
||||
renderPass.cColorAttachments[0].clearColor.r = NAN;
|
||||
renderPass.cColorAttachments[0].clearValue.r = NAN;
|
||||
AssertBeginRenderPassError(&renderPass);
|
||||
}
|
||||
|
||||
{
|
||||
utils::ComboRenderPassDescriptor renderPass({color}, nullptr);
|
||||
renderPass.cColorAttachments[0].clearColor.g = NAN;
|
||||
renderPass.cColorAttachments[0].clearValue.g = NAN;
|
||||
AssertBeginRenderPassError(&renderPass);
|
||||
}
|
||||
|
||||
{
|
||||
utils::ComboRenderPassDescriptor renderPass({color}, nullptr);
|
||||
renderPass.cColorAttachments[0].clearColor.b = NAN;
|
||||
renderPass.cColorAttachments[0].clearValue.b = NAN;
|
||||
AssertBeginRenderPassError(&renderPass);
|
||||
}
|
||||
|
||||
{
|
||||
utils::ComboRenderPassDescriptor renderPass({color}, nullptr);
|
||||
renderPass.cColorAttachments[0].clearColor.a = NAN;
|
||||
renderPass.cColorAttachments[0].clearValue.a = NAN;
|
||||
AssertBeginRenderPassError(&renderPass);
|
||||
}
|
||||
|
||||
// Tests that INFINITY can be used in clearColor.
|
||||
{
|
||||
utils::ComboRenderPassDescriptor renderPass({color}, nullptr);
|
||||
renderPass.cColorAttachments[0].clearColor.r = INFINITY;
|
||||
renderPass.cColorAttachments[0].clearValue.r = INFINITY;
|
||||
AssertBeginRenderPassSuccess(&renderPass);
|
||||
}
|
||||
|
||||
{
|
||||
utils::ComboRenderPassDescriptor renderPass({color}, nullptr);
|
||||
renderPass.cColorAttachments[0].clearColor.g = INFINITY;
|
||||
renderPass.cColorAttachments[0].clearValue.g = INFINITY;
|
||||
AssertBeginRenderPassSuccess(&renderPass);
|
||||
}
|
||||
|
||||
{
|
||||
utils::ComboRenderPassDescriptor renderPass({color}, nullptr);
|
||||
renderPass.cColorAttachments[0].clearColor.b = INFINITY;
|
||||
renderPass.cColorAttachments[0].clearValue.b = INFINITY;
|
||||
AssertBeginRenderPassSuccess(&renderPass);
|
||||
}
|
||||
|
||||
{
|
||||
utils::ComboRenderPassDescriptor renderPass({color}, nullptr);
|
||||
renderPass.cColorAttachments[0].clearColor.a = INFINITY;
|
||||
renderPass.cColorAttachments[0].clearValue.a = INFINITY;
|
||||
AssertBeginRenderPassSuccess(&renderPass);
|
||||
}
|
||||
|
||||
// Tests that NaN cannot be used in clearDepth.
|
||||
// Tests that NaN cannot be used in depthClearValue.
|
||||
{
|
||||
wgpu::TextureView depth =
|
||||
Create2DAttachment(device, 1, 1, wgpu::TextureFormat::Depth24Plus);
|
||||
utils::ComboRenderPassDescriptor renderPass({color}, depth);
|
||||
renderPass.cDepthStencilAttachmentInfo.clearDepth = NAN;
|
||||
renderPass.cDepthStencilAttachmentInfo.depthClearValue = NAN;
|
||||
AssertBeginRenderPassError(&renderPass);
|
||||
}
|
||||
|
||||
// Tests that INFINITY can be used in clearDepth.
|
||||
// Tests that INFINITY can be used in depthClearValue.
|
||||
{
|
||||
wgpu::TextureView depth =
|
||||
Create2DAttachment(device, 1, 1, wgpu::TextureFormat::Depth24Plus);
|
||||
utils::ComboRenderPassDescriptor renderPass({color}, depth);
|
||||
renderPass.cDepthStencilAttachmentInfo.clearDepth = INFINITY;
|
||||
renderPass.cDepthStencilAttachmentInfo.depthClearValue = INFINITY;
|
||||
AssertBeginRenderPassSuccess(&renderPass);
|
||||
}
|
||||
|
||||
|
|
|
@ -268,7 +268,7 @@ ValidationTest::DummyRenderPass::DummyRenderPass(const wgpu::Device& device)
|
|||
wgpu::TextureView view = attachment.CreateView();
|
||||
mColorAttachment.view = view;
|
||||
mColorAttachment.resolveTarget = nullptr;
|
||||
mColorAttachment.clearColor = {0.0f, 0.0f, 0.0f, 0.0f};
|
||||
mColorAttachment.clearValue = {0.0f, 0.0f, 0.0f, 0.0f};
|
||||
mColorAttachment.loadOp = wgpu::LoadOp::Clear;
|
||||
mColorAttachment.storeOp = wgpu::StoreOp::Store;
|
||||
|
||||
|
|
|
@ -759,7 +759,7 @@ TEST_P(D3D12DescriptorHeapTests, EncodeManyUBOAndSamplers) {
|
|||
|
||||
utils::ComboRenderPassDescriptor renderPassDesc({textureView});
|
||||
renderPassDesc.cColorAttachments[0].loadOp = wgpu::LoadOp::Clear;
|
||||
renderPassDesc.cColorAttachments[0].clearColor = {0.0f, 1.0f, 0.0f, 1.0f};
|
||||
renderPassDesc.cColorAttachments[0].clearValue = {0.0f, 1.0f, 0.0f, 1.0f};
|
||||
renderPass.renderPassInfo.cColorAttachments[0].view = textureView;
|
||||
|
||||
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
|
||||
|
|
|
@ -323,7 +323,7 @@ class EGLImageUsageTests : public EGLImageTestBase {
|
|||
wgpu::TextureView eglImageView = eglImageTexture.CreateView();
|
||||
|
||||
utils::ComboRenderPassDescriptor renderPassDescriptor({eglImageView}, {});
|
||||
renderPassDescriptor.cColorAttachments[0].clearColor = {1 / 255.0f, 2 / 255.0f, 3 / 255.0f,
|
||||
renderPassDescriptor.cColorAttachments[0].clearValue = {1 / 255.0f, 2 / 255.0f, 3 / 255.0f,
|
||||
4 / 255.0f};
|
||||
|
||||
// Execute commands to clear the eglImage
|
||||
|
|
|
@ -273,7 +273,7 @@ namespace dawn::native { namespace vulkan {
|
|||
|
||||
// Submit a clear operation
|
||||
utils::ComboRenderPassDescriptor renderPassDescriptor({wrappedView}, {});
|
||||
renderPassDescriptor.cColorAttachments[0].clearColor = clearColor;
|
||||
renderPassDescriptor.cColorAttachments[0].clearValue = clearColor;
|
||||
renderPassDescriptor.cColorAttachments[0].loadOp = wgpu::LoadOp::Clear;
|
||||
|
||||
wgpu::CommandEncoder encoder = dawnDevice.CreateCommandEncoder();
|
||||
|
|
|
@ -89,11 +89,11 @@ namespace utils {
|
|||
for (uint32_t i = 0; i < kMaxColorAttachments; ++i) {
|
||||
cColorAttachments[i].loadOp = wgpu::LoadOp::Clear;
|
||||
cColorAttachments[i].storeOp = wgpu::StoreOp::Store;
|
||||
cColorAttachments[i].clearColor = {0.0f, 0.0f, 0.0f, 0.0f};
|
||||
cColorAttachments[i].clearValue = {0.0f, 0.0f, 0.0f, 0.0f};
|
||||
}
|
||||
|
||||
cDepthStencilAttachmentInfo.clearDepth = 1.0f;
|
||||
cDepthStencilAttachmentInfo.clearStencil = 0;
|
||||
cDepthStencilAttachmentInfo.depthClearValue = 1.0f;
|
||||
cDepthStencilAttachmentInfo.stencilClearValue = 0;
|
||||
cDepthStencilAttachmentInfo.depthLoadOp = wgpu::LoadOp::Clear;
|
||||
cDepthStencilAttachmentInfo.depthStoreOp = wgpu::StoreOp::Store;
|
||||
cDepthStencilAttachmentInfo.stencilLoadOp = wgpu::LoadOp::Clear;
|
||||
|
|
Loading…
Reference in New Issue