mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-20 10:25:28 +00:00
Rename nxt:: to dawn:: in tests
This commit is contained in:
committed by
Corentin Wallez
parent
83a9c9d6d9
commit
54e58c20b2
@@ -21,13 +21,13 @@ namespace {
|
||||
class RenderPassDescriptorValidationTest : public ValidationTest {
|
||||
};
|
||||
|
||||
nxt::TextureView Create2DAttachment(nxt::Device& device, uint32_t width, uint32_t height, nxt::TextureFormat format) {
|
||||
nxt::Texture attachment = device.CreateTextureBuilder()
|
||||
.SetDimension(nxt::TextureDimension::e2D)
|
||||
dawn::TextureView Create2DAttachment(dawn::Device& device, uint32_t width, uint32_t height, dawn::TextureFormat format) {
|
||||
dawn::Texture attachment = device.CreateTextureBuilder()
|
||||
.SetDimension(dawn::TextureDimension::e2D)
|
||||
.SetExtent(width, height, 1)
|
||||
.SetFormat(format)
|
||||
.SetMipLevels(1)
|
||||
.SetAllowedUsage(nxt::TextureUsageBit::OutputAttachment)
|
||||
.SetAllowedUsage(dawn::TextureUsageBit::OutputAttachment)
|
||||
.GetResult();
|
||||
|
||||
return attachment.CreateTextureViewBuilder()
|
||||
@@ -44,16 +44,16 @@ TEST_F(RenderPassDescriptorValidationTest, Empty) {
|
||||
TEST_F(RenderPassDescriptorValidationTest, OneAttachment) {
|
||||
// One color attachment
|
||||
{
|
||||
nxt::TextureView color = Create2DAttachment(device, 1, 1, nxt::TextureFormat::R8G8B8A8Unorm);
|
||||
dawn::TextureView color = Create2DAttachment(device, 1, 1, dawn::TextureFormat::R8G8B8A8Unorm);
|
||||
AssertWillBeSuccess(device.CreateRenderPassDescriptorBuilder())
|
||||
.SetColorAttachment(0, color, nxt::LoadOp::Clear)
|
||||
.SetColorAttachment(0, color, dawn::LoadOp::Clear)
|
||||
.GetResult();
|
||||
}
|
||||
// One depth-stencil attachment
|
||||
{
|
||||
nxt::TextureView depthStencil = Create2DAttachment(device, 1, 1, nxt::TextureFormat::D32FloatS8Uint);
|
||||
dawn::TextureView depthStencil = Create2DAttachment(device, 1, 1, dawn::TextureFormat::D32FloatS8Uint);
|
||||
AssertWillBeSuccess(device.CreateRenderPassDescriptorBuilder())
|
||||
.SetDepthStencilAttachment(depthStencil, nxt::LoadOp::Clear, nxt::LoadOp::Clear)
|
||||
.SetDepthStencilAttachment(depthStencil, dawn::LoadOp::Clear, dawn::LoadOp::Clear)
|
||||
.GetResult();
|
||||
}
|
||||
}
|
||||
@@ -62,31 +62,31 @@ TEST_F(RenderPassDescriptorValidationTest, OneAttachment) {
|
||||
TEST_F(RenderPassDescriptorValidationTest, ColorAttachmentOutOfBounds) {
|
||||
// For setting the color attachment, control case
|
||||
{
|
||||
nxt::TextureView color = Create2DAttachment(device, 1, 1, nxt::TextureFormat::R8G8B8A8Unorm);
|
||||
dawn::TextureView color = Create2DAttachment(device, 1, 1, dawn::TextureFormat::R8G8B8A8Unorm);
|
||||
AssertWillBeSuccess(device.CreateRenderPassDescriptorBuilder())
|
||||
.SetColorAttachment(kMaxColorAttachments - 1, color, nxt::LoadOp::Clear)
|
||||
.SetColorAttachment(kMaxColorAttachments - 1, color, dawn::LoadOp::Clear)
|
||||
.GetResult();
|
||||
}
|
||||
// For setting the color attachment, OOB
|
||||
{
|
||||
nxt::TextureView color = Create2DAttachment(device, 1, 1, nxt::TextureFormat::R8G8B8A8Unorm);
|
||||
dawn::TextureView color = Create2DAttachment(device, 1, 1, dawn::TextureFormat::R8G8B8A8Unorm);
|
||||
AssertWillBeError(device.CreateRenderPassDescriptorBuilder())
|
||||
.SetColorAttachment(kMaxColorAttachments, color, nxt::LoadOp::Clear)
|
||||
.SetColorAttachment(kMaxColorAttachments, color, dawn::LoadOp::Clear)
|
||||
.GetResult();
|
||||
}
|
||||
|
||||
nxt::TextureView color = Create2DAttachment(device, 1, 1, nxt::TextureFormat::R8G8B8A8Unorm);
|
||||
dawn::TextureView color = Create2DAttachment(device, 1, 1, dawn::TextureFormat::R8G8B8A8Unorm);
|
||||
// For setting the clear color, control case
|
||||
{
|
||||
AssertWillBeSuccess(device.CreateRenderPassDescriptorBuilder())
|
||||
.SetColorAttachment(0, color, nxt::LoadOp::Clear)
|
||||
.SetColorAttachment(0, color, dawn::LoadOp::Clear)
|
||||
.SetColorAttachmentClearColor(kMaxColorAttachments - 1, 0.0f, 0.0f, 0.0f, 0.0f)
|
||||
.GetResult();
|
||||
}
|
||||
// For setting the clear color, OOB
|
||||
{
|
||||
AssertWillBeError(device.CreateRenderPassDescriptorBuilder())
|
||||
.SetColorAttachment(0, color, nxt::LoadOp::Clear)
|
||||
.SetColorAttachment(0, color, dawn::LoadOp::Clear)
|
||||
.SetColorAttachmentClearColor(kMaxColorAttachments, 0.0f, 0.0f, 0.0f, 0.0f)
|
||||
.GetResult();
|
||||
}
|
||||
@@ -94,26 +94,26 @@ TEST_F(RenderPassDescriptorValidationTest, ColorAttachmentOutOfBounds) {
|
||||
|
||||
// Test setting a clear value without an attachment and vice-versa is ok.
|
||||
TEST_F(RenderPassDescriptorValidationTest, ClearAndAttachmentMismatchIsOk) {
|
||||
nxt::TextureView color = Create2DAttachment(device, 1, 1, nxt::TextureFormat::R8G8B8A8Unorm);
|
||||
dawn::TextureView color = Create2DAttachment(device, 1, 1, dawn::TextureFormat::R8G8B8A8Unorm);
|
||||
|
||||
// For cleared attachment 0 doesn't get a color, clear color for 1 is unused
|
||||
{
|
||||
AssertWillBeSuccess(device.CreateRenderPassDescriptorBuilder())
|
||||
.SetColorAttachment(0, color, nxt::LoadOp::Clear)
|
||||
.SetColorAttachment(0, color, dawn::LoadOp::Clear)
|
||||
.SetColorAttachmentClearColor(1, 0.0f, 0.0f, 0.0f, 0.0f)
|
||||
.GetResult();
|
||||
}
|
||||
// Clear depth stencil doesn't get values
|
||||
{
|
||||
nxt::TextureView depthStencil = Create2DAttachment(device, 1, 1, nxt::TextureFormat::D32FloatS8Uint);
|
||||
dawn::TextureView depthStencil = Create2DAttachment(device, 1, 1, dawn::TextureFormat::D32FloatS8Uint);
|
||||
AssertWillBeSuccess(device.CreateRenderPassDescriptorBuilder())
|
||||
.SetDepthStencilAttachment(depthStencil, nxt::LoadOp::Clear, nxt::LoadOp::Clear)
|
||||
.SetDepthStencilAttachment(depthStencil, dawn::LoadOp::Clear, dawn::LoadOp::Clear)
|
||||
.GetResult();
|
||||
}
|
||||
// Clear values for depth-stencil when it isn't used
|
||||
{
|
||||
AssertWillBeSuccess(device.CreateRenderPassDescriptorBuilder())
|
||||
.SetColorAttachment(0, color, nxt::LoadOp::Clear)
|
||||
.SetColorAttachment(0, color, dawn::LoadOp::Clear)
|
||||
.SetDepthStencilAttachmentClearValue(0.0f, 0)
|
||||
.GetResult();
|
||||
}
|
||||
@@ -121,56 +121,56 @@ TEST_F(RenderPassDescriptorValidationTest, ClearAndAttachmentMismatchIsOk) {
|
||||
|
||||
// Attachments must have the same size
|
||||
TEST_F(RenderPassDescriptorValidationTest, SizeMustMatch) {
|
||||
nxt::TextureView color1x1A = Create2DAttachment(device, 1, 1, nxt::TextureFormat::R8G8B8A8Unorm);
|
||||
nxt::TextureView color1x1B = Create2DAttachment(device, 1, 1, nxt::TextureFormat::R8G8B8A8Unorm);
|
||||
nxt::TextureView color2x2 = Create2DAttachment(device, 2, 2, nxt::TextureFormat::R8G8B8A8Unorm);
|
||||
nxt::TextureView depthStencil1x1 = Create2DAttachment(device, 1, 1, nxt::TextureFormat::D32FloatS8Uint);
|
||||
nxt::TextureView depthStencil2x2 = Create2DAttachment(device, 2, 2, nxt::TextureFormat::D32FloatS8Uint);
|
||||
dawn::TextureView color1x1A = Create2DAttachment(device, 1, 1, dawn::TextureFormat::R8G8B8A8Unorm);
|
||||
dawn::TextureView color1x1B = Create2DAttachment(device, 1, 1, dawn::TextureFormat::R8G8B8A8Unorm);
|
||||
dawn::TextureView color2x2 = Create2DAttachment(device, 2, 2, dawn::TextureFormat::R8G8B8A8Unorm);
|
||||
dawn::TextureView depthStencil1x1 = Create2DAttachment(device, 1, 1, dawn::TextureFormat::D32FloatS8Uint);
|
||||
dawn::TextureView depthStencil2x2 = Create2DAttachment(device, 2, 2, dawn::TextureFormat::D32FloatS8Uint);
|
||||
|
||||
// Control case: all the same size (1x1)
|
||||
{
|
||||
AssertWillBeSuccess(device.CreateRenderPassDescriptorBuilder())
|
||||
.SetColorAttachment(0, color1x1A, nxt::LoadOp::Clear)
|
||||
.SetColorAttachment(1, color1x1B, nxt::LoadOp::Clear)
|
||||
.SetDepthStencilAttachment(depthStencil1x1, nxt::LoadOp::Clear, nxt::LoadOp::Clear)
|
||||
.SetColorAttachment(0, color1x1A, dawn::LoadOp::Clear)
|
||||
.SetColorAttachment(1, color1x1B, dawn::LoadOp::Clear)
|
||||
.SetDepthStencilAttachment(depthStencil1x1, dawn::LoadOp::Clear, dawn::LoadOp::Clear)
|
||||
.GetResult();
|
||||
}
|
||||
|
||||
// One of the color attachments has a different size
|
||||
{
|
||||
AssertWillBeError(device.CreateRenderPassDescriptorBuilder())
|
||||
.SetColorAttachment(0, color1x1A, nxt::LoadOp::Clear)
|
||||
.SetColorAttachment(1, color2x2, nxt::LoadOp::Clear)
|
||||
.SetDepthStencilAttachment(depthStencil1x1, nxt::LoadOp::Clear, nxt::LoadOp::Clear)
|
||||
.SetColorAttachment(0, color1x1A, dawn::LoadOp::Clear)
|
||||
.SetColorAttachment(1, color2x2, dawn::LoadOp::Clear)
|
||||
.SetDepthStencilAttachment(depthStencil1x1, dawn::LoadOp::Clear, dawn::LoadOp::Clear)
|
||||
.GetResult();
|
||||
}
|
||||
|
||||
// The depth stencil attachment has a different size
|
||||
{
|
||||
AssertWillBeError(device.CreateRenderPassDescriptorBuilder())
|
||||
.SetColorAttachment(0, color1x1A, nxt::LoadOp::Clear)
|
||||
.SetColorAttachment(1, color1x1B, nxt::LoadOp::Clear)
|
||||
.SetDepthStencilAttachment(depthStencil2x2, nxt::LoadOp::Clear, nxt::LoadOp::Clear)
|
||||
.SetColorAttachment(0, color1x1A, dawn::LoadOp::Clear)
|
||||
.SetColorAttachment(1, color1x1B, dawn::LoadOp::Clear)
|
||||
.SetDepthStencilAttachment(depthStencil2x2, dawn::LoadOp::Clear, dawn::LoadOp::Clear)
|
||||
.GetResult();
|
||||
}
|
||||
}
|
||||
|
||||
// Attachments formats must match whether they are used for color or depth-stencil
|
||||
TEST_F(RenderPassDescriptorValidationTest, FormatMismatch) {
|
||||
nxt::TextureView color = Create2DAttachment(device, 1, 1, nxt::TextureFormat::R8G8B8A8Unorm);
|
||||
nxt::TextureView depthStencil = Create2DAttachment(device, 1, 1, nxt::TextureFormat::D32FloatS8Uint);
|
||||
dawn::TextureView color = Create2DAttachment(device, 1, 1, dawn::TextureFormat::R8G8B8A8Unorm);
|
||||
dawn::TextureView depthStencil = Create2DAttachment(device, 1, 1, dawn::TextureFormat::D32FloatS8Uint);
|
||||
|
||||
// Using depth-stencil for color
|
||||
{
|
||||
AssertWillBeError(device.CreateRenderPassDescriptorBuilder())
|
||||
.SetColorAttachment(0, depthStencil, nxt::LoadOp::Clear)
|
||||
.SetColorAttachment(0, depthStencil, dawn::LoadOp::Clear)
|
||||
.GetResult();
|
||||
}
|
||||
|
||||
// Using color for depth-stencil
|
||||
{
|
||||
AssertWillBeError(device.CreateRenderPassDescriptorBuilder())
|
||||
.SetDepthStencilAttachment(color, nxt::LoadOp::Clear, nxt::LoadOp::Clear)
|
||||
.SetDepthStencilAttachment(color, dawn::LoadOp::Clear, dawn::LoadOp::Clear)
|
||||
.GetResult();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user