mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-17 17:05:31 +00:00
Make Texture format names match WebGPU
BUG=dawn:128 Change-Id: I73cc77082d02941d91fab8ee578e529db979fed1 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/8164 Reviewed-by: Kai Ninomiya <kainino@chromium.org> Reviewed-by: Jiawei Shao <jiawei.shao@intel.com> Commit-Queue: Corentin Wallez <cwallez@chromium.org>
This commit is contained in:
committed by
Commit Bot service account
parent
92cdeaaf81
commit
77fa31c5c6
@@ -247,7 +247,7 @@ TEST_P(BindGroupTests, UBOSamplerAndTexture) {
|
||||
descriptor.size.depth = 1;
|
||||
descriptor.arrayLayerCount = 1;
|
||||
descriptor.sampleCount = 1;
|
||||
descriptor.format = dawn::TextureFormat::R8G8B8A8Unorm;
|
||||
descriptor.format = dawn::TextureFormat::RGBA8Unorm;
|
||||
descriptor.mipLevelCount = 1;
|
||||
descriptor.usage = dawn::TextureUsageBit::TransferDst | dawn::TextureUsageBit::Sampled;
|
||||
dawn::Texture texture = device.CreateTexture(&descriptor);
|
||||
|
||||
@@ -72,8 +72,9 @@ class ClipSpaceTest : public DawnTest {
|
||||
|
||||
// Test that the clip space is correctly configured.
|
||||
TEST_P(ClipSpaceTest, ClipSpace) {
|
||||
dawn::Texture colorTexture = Create2DTextureForTest(dawn::TextureFormat::R8G8B8A8Unorm);
|
||||
dawn::Texture depthStencilTexture = Create2DTextureForTest(dawn::TextureFormat::D32FloatS8Uint);
|
||||
dawn::Texture colorTexture = Create2DTextureForTest(dawn::TextureFormat::RGBA8Unorm);
|
||||
dawn::Texture depthStencilTexture =
|
||||
Create2DTextureForTest(dawn::TextureFormat::Depth24PlusStencil8);
|
||||
|
||||
utils::ComboRenderPassDescriptor renderPassDescriptor(
|
||||
{colorTexture.CreateDefaultView()}, depthStencilTexture.CreateDefaultView());
|
||||
|
||||
@@ -760,7 +760,7 @@ TEST_P(ColorStateTest, IndependentColorState) {
|
||||
descriptor.size.depth = 1;
|
||||
descriptor.arrayLayerCount = 1;
|
||||
descriptor.sampleCount = 1;
|
||||
descriptor.format = dawn::TextureFormat::R8G8B8A8Unorm;
|
||||
descriptor.format = dawn::TextureFormat::RGBA8Unorm;
|
||||
descriptor.mipLevelCount = 1;
|
||||
descriptor.usage = dawn::TextureUsageBit::OutputAttachment | dawn::TextureUsageBit::TransferSrc;
|
||||
|
||||
|
||||
@@ -83,7 +83,7 @@ class CopyTests_T2B : public CopyTests {
|
||||
descriptor.size.depth = 1;
|
||||
descriptor.arrayLayerCount = textureSpec.arraySize;
|
||||
descriptor.sampleCount = 1;
|
||||
descriptor.format = dawn::TextureFormat::R8G8B8A8Unorm;
|
||||
descriptor.format = dawn::TextureFormat::RGBA8Unorm;
|
||||
descriptor.mipLevelCount = textureSpec.level + 1;
|
||||
descriptor.usage = dawn::TextureUsageBit::TransferDst | dawn::TextureUsageBit::TransferSrc;
|
||||
dawn::Texture texture = device.CreateTexture(&descriptor);
|
||||
@@ -196,7 +196,7 @@ protected:
|
||||
descriptor.size.depth = 1;
|
||||
descriptor.arrayLayerCount = 1;
|
||||
descriptor.sampleCount = 1;
|
||||
descriptor.format = dawn::TextureFormat::R8G8B8A8Unorm;
|
||||
descriptor.format = dawn::TextureFormat::RGBA8Unorm;
|
||||
descriptor.mipLevelCount = textureSpec.level + 1;
|
||||
descriptor.usage = dawn::TextureUsageBit::TransferDst | dawn::TextureUsageBit::TransferSrc;
|
||||
dawn::Texture texture = device.CreateTexture(&descriptor);
|
||||
@@ -275,7 +275,7 @@ class CopyTests_T2T : public CopyTests {
|
||||
srcDescriptor.size.depth = 1;
|
||||
srcDescriptor.arrayLayerCount = srcSpec.arraySize;
|
||||
srcDescriptor.sampleCount = 1;
|
||||
srcDescriptor.format = dawn::TextureFormat::R8G8B8A8Unorm;
|
||||
srcDescriptor.format = dawn::TextureFormat::RGBA8Unorm;
|
||||
srcDescriptor.mipLevelCount = srcSpec.level + 1;
|
||||
srcDescriptor.usage =
|
||||
dawn::TextureUsageBit::TransferSrc | dawn::TextureUsageBit::TransferDst;
|
||||
@@ -288,7 +288,7 @@ class CopyTests_T2T : public CopyTests {
|
||||
dstDescriptor.size.depth = 1;
|
||||
dstDescriptor.arrayLayerCount = dstSpec.arraySize;
|
||||
dstDescriptor.sampleCount = 1;
|
||||
dstDescriptor.format = dawn::TextureFormat::R8G8B8A8Unorm;
|
||||
dstDescriptor.format = dawn::TextureFormat::RGBA8Unorm;
|
||||
dstDescriptor.mipLevelCount = dstSpec.level + 1;
|
||||
dstDescriptor.usage =
|
||||
dawn::TextureUsageBit::TransferSrc | dawn::TextureUsageBit::TransferDst;
|
||||
|
||||
@@ -32,7 +32,7 @@ class DepthStencilStateTest : public DawnTest {
|
||||
renderTargetDescriptor.size.depth = 1;
|
||||
renderTargetDescriptor.arrayLayerCount = 1;
|
||||
renderTargetDescriptor.sampleCount = 1;
|
||||
renderTargetDescriptor.format = dawn::TextureFormat::R8G8B8A8Unorm;
|
||||
renderTargetDescriptor.format = dawn::TextureFormat::RGBA8Unorm;
|
||||
renderTargetDescriptor.mipLevelCount = 1;
|
||||
renderTargetDescriptor.usage = dawn::TextureUsageBit::OutputAttachment | dawn::TextureUsageBit::TransferSrc;
|
||||
renderTarget = device.CreateTexture(&renderTargetDescriptor);
|
||||
@@ -46,7 +46,7 @@ class DepthStencilStateTest : public DawnTest {
|
||||
depthDescriptor.size.depth = 1;
|
||||
depthDescriptor.arrayLayerCount = 1;
|
||||
depthDescriptor.sampleCount = 1;
|
||||
depthDescriptor.format = dawn::TextureFormat::D32FloatS8Uint;
|
||||
depthDescriptor.format = dawn::TextureFormat::Depth24PlusStencil8;
|
||||
depthDescriptor.mipLevelCount = 1;
|
||||
depthDescriptor.usage = dawn::TextureUsageBit::OutputAttachment;
|
||||
depthTexture = device.CreateTexture(&depthDescriptor);
|
||||
@@ -276,7 +276,7 @@ class DepthStencilStateTest : public DawnTest {
|
||||
descriptor.cVertexStage.module = vsModule;
|
||||
descriptor.cFragmentStage.module = fsModule;
|
||||
descriptor.cDepthStencilState = test.depthStencilState;
|
||||
descriptor.cDepthStencilState.format = dawn::TextureFormat::D32FloatS8Uint;
|
||||
descriptor.cDepthStencilState.format = dawn::TextureFormat::Depth24PlusStencil8;
|
||||
descriptor.depthStencilState = &descriptor.cDepthStencilState;
|
||||
|
||||
dawn::RenderPipeline pipeline = device.CreateRenderPipeline(&descriptor);
|
||||
|
||||
@@ -89,7 +89,7 @@ class DynamicBufferOffsetTests : public DawnTest {
|
||||
utils::ComboRenderPipelineDescriptor pipelineDescriptor(device);
|
||||
pipelineDescriptor.cVertexStage.module = vsModule;
|
||||
pipelineDescriptor.cFragmentStage.module = fsModule;
|
||||
pipelineDescriptor.cColorStates[0]->format = dawn::TextureFormat::R8G8B8A8Unorm;
|
||||
pipelineDescriptor.cColorStates[0]->format = dawn::TextureFormat::RGBA8Unorm;
|
||||
dawn::PipelineLayout pipelineLayout =
|
||||
utils::MakeBasicPipelineLayout(device, &mBindGroupLayout);
|
||||
pipelineDescriptor.layout = pipelineLayout;
|
||||
|
||||
@@ -113,7 +113,7 @@ class IOSurfaceValidationTests : public IOSurfaceTestBase {
|
||||
defaultIOSurface = CreateSinglePlaneIOSurface(10, 10, 'BGRA', 4);
|
||||
|
||||
descriptor.dimension = dawn::TextureDimension::e2D;
|
||||
descriptor.format = dawn::TextureFormat::B8G8R8A8Unorm;
|
||||
descriptor.format = dawn::TextureFormat::BGRA8Unorm;
|
||||
descriptor.size = {10, 10, 1};
|
||||
descriptor.sampleCount = 1;
|
||||
descriptor.arrayLayerCount = 1;
|
||||
@@ -305,7 +305,7 @@ class IOSurfaceUsageTests : public IOSurfaceTestBase {
|
||||
descriptor.cVertexStage.module = vs;
|
||||
descriptor.cFragmentStage.module = fs;
|
||||
descriptor.layout = utils::MakeBasicPipelineLayout(device, &bgl);
|
||||
descriptor.cColorStates[0]->format = dawn::TextureFormat::R8G8B8A8Unorm;
|
||||
descriptor.cColorStates[0]->format = dawn::TextureFormat::RGBA8Unorm;
|
||||
|
||||
pipeline = device.CreateRenderPipeline(&descriptor);
|
||||
}
|
||||
@@ -392,7 +392,7 @@ TEST_P(IOSurfaceUsageTests, SampleFromRG8IOSurface) {
|
||||
ScopedIOSurfaceRef ioSurface = CreateSinglePlaneIOSurface(1, 1, '2C08', 2);
|
||||
|
||||
uint16_t data = 0x0102; // Stored as (G, R)
|
||||
DoSampleTest(ioSurface.get(), dawn::TextureFormat::R8G8Unorm, &data, sizeof(data),
|
||||
DoSampleTest(ioSurface.get(), dawn::TextureFormat::RG8Unorm, &data, sizeof(data),
|
||||
RGBA8(2, 1, 0, 255));
|
||||
}
|
||||
|
||||
@@ -402,7 +402,7 @@ TEST_P(IOSurfaceUsageTests, ClearRG8IOSurface) {
|
||||
ScopedIOSurfaceRef ioSurface = CreateSinglePlaneIOSurface(1, 1, '2C08', 2);
|
||||
|
||||
uint16_t data = 0x0201;
|
||||
DoClearTest(ioSurface.get(), dawn::TextureFormat::R8G8Unorm, &data, sizeof(data));
|
||||
DoClearTest(ioSurface.get(), dawn::TextureFormat::RG8Unorm, &data, sizeof(data));
|
||||
}
|
||||
|
||||
// Test sampling from a BGRA8 IOSurface
|
||||
@@ -411,7 +411,7 @@ TEST_P(IOSurfaceUsageTests, SampleFromBGRA8888IOSurface) {
|
||||
ScopedIOSurfaceRef ioSurface = CreateSinglePlaneIOSurface(1, 1, 'BGRA', 4);
|
||||
|
||||
uint32_t data = 0x01020304; // Stored as (A, R, G, B)
|
||||
DoSampleTest(ioSurface.get(), dawn::TextureFormat::B8G8R8A8Unorm, &data, sizeof(data),
|
||||
DoSampleTest(ioSurface.get(), dawn::TextureFormat::BGRA8Unorm, &data, sizeof(data),
|
||||
RGBA8(2, 3, 4, 1));
|
||||
}
|
||||
|
||||
@@ -421,7 +421,7 @@ TEST_P(IOSurfaceUsageTests, ClearBGRA8IOSurface) {
|
||||
ScopedIOSurfaceRef ioSurface = CreateSinglePlaneIOSurface(1, 1, 'BGRA', 4);
|
||||
|
||||
uint32_t data = 0x04010203;
|
||||
DoClearTest(ioSurface.get(), dawn::TextureFormat::B8G8R8A8Unorm, &data, sizeof(data));
|
||||
DoClearTest(ioSurface.get(), dawn::TextureFormat::BGRA8Unorm, &data, sizeof(data));
|
||||
}
|
||||
|
||||
DAWN_INSTANTIATE_TEST(IOSurfaceValidationTests, MetalBackend);
|
||||
|
||||
@@ -173,8 +173,9 @@ class MultisampledRenderingTest : public DawnTest {
|
||||
constexpr static uint32_t kWidth = 3;
|
||||
constexpr static uint32_t kHeight = 3;
|
||||
constexpr static uint32_t kSampleCount = 4;
|
||||
constexpr static dawn::TextureFormat kColorFormat = dawn::TextureFormat::R8G8B8A8Unorm;
|
||||
constexpr static dawn::TextureFormat kDepthStencilFormat = dawn::TextureFormat::D32FloatS8Uint;
|
||||
constexpr static dawn::TextureFormat kColorFormat = dawn::TextureFormat::RGBA8Unorm;
|
||||
constexpr static dawn::TextureFormat kDepthStencilFormat =
|
||||
dawn::TextureFormat::Depth24PlusStencil8;
|
||||
|
||||
dawn::TextureView mMultisampledColorView;
|
||||
dawn::Texture mResolveTexture;
|
||||
|
||||
@@ -35,7 +35,7 @@ TEST_P(NonzeroTextureCreationTests, TextureCreationClearsOneBits) {
|
||||
descriptor.size.depth = 1;
|
||||
descriptor.arrayLayerCount = 1;
|
||||
descriptor.sampleCount = 1;
|
||||
descriptor.format = dawn::TextureFormat::R8G8B8A8Unorm;
|
||||
descriptor.format = dawn::TextureFormat::RGBA8Unorm;
|
||||
descriptor.mipLevelCount = 1;
|
||||
descriptor.usage = dawn::TextureUsageBit::OutputAttachment | dawn::TextureUsageBit::TransferSrc;
|
||||
dawn::Texture texture = device.CreateTexture(&descriptor);
|
||||
@@ -55,7 +55,7 @@ TEST_P(NonzeroTextureCreationTests, MipMapClears) {
|
||||
descriptor.size.depth = 1;
|
||||
descriptor.arrayLayerCount = 1;
|
||||
descriptor.sampleCount = 1;
|
||||
descriptor.format = dawn::TextureFormat::R8G8B8A8Unorm;
|
||||
descriptor.format = dawn::TextureFormat::RGBA8Unorm;
|
||||
descriptor.mipLevelCount = mipLevels;
|
||||
descriptor.usage = dawn::TextureUsageBit::OutputAttachment | dawn::TextureUsageBit::TransferSrc;
|
||||
dawn::Texture texture = device.CreateTexture(&descriptor);
|
||||
@@ -80,7 +80,7 @@ TEST_P(NonzeroTextureCreationTests, ArrayLayerClears) {
|
||||
descriptor.size.depth = 1;
|
||||
descriptor.arrayLayerCount = arrayLayers;
|
||||
descriptor.sampleCount = 1;
|
||||
descriptor.format = dawn::TextureFormat::R8G8B8A8Unorm;
|
||||
descriptor.format = dawn::TextureFormat::RGBA8Unorm;
|
||||
descriptor.mipLevelCount = 1;
|
||||
descriptor.usage = dawn::TextureUsageBit::OutputAttachment | dawn::TextureUsageBit::TransferSrc;
|
||||
dawn::Texture texture = device.CreateTexture(&descriptor);
|
||||
|
||||
@@ -64,7 +64,7 @@ class RenderPassLoadOpTests : public DawnTest {
|
||||
descriptor.size.depth = 1;
|
||||
descriptor.arrayLayerCount = 1;
|
||||
descriptor.sampleCount = 1;
|
||||
descriptor.format = dawn::TextureFormat::R8G8B8A8Unorm;
|
||||
descriptor.format = dawn::TextureFormat::RGBA8Unorm;
|
||||
descriptor.mipLevelCount = 1;
|
||||
descriptor.usage = dawn::TextureUsageBit::OutputAttachment | dawn::TextureUsageBit::TransferSrc;
|
||||
renderTarget = device.CreateTexture(&descriptor);
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
#include "utils/DawnHelpers.h"
|
||||
|
||||
constexpr uint32_t kRTSize = 16;
|
||||
constexpr dawn::TextureFormat kFormat = dawn::TextureFormat::R8G8B8A8Unorm;
|
||||
constexpr dawn::TextureFormat kFormat = dawn::TextureFormat::RGBA8Unorm;
|
||||
|
||||
class RenderPassTest : public DawnTest {
|
||||
protected:
|
||||
|
||||
@@ -88,7 +88,7 @@ protected:
|
||||
descriptor.size.depth = 1;
|
||||
descriptor.arrayLayerCount = 1;
|
||||
descriptor.sampleCount = 1;
|
||||
descriptor.format = dawn::TextureFormat::R8G8B8A8Unorm;
|
||||
descriptor.format = dawn::TextureFormat::RGBA8Unorm;
|
||||
descriptor.mipLevelCount = 1;
|
||||
descriptor.usage = dawn::TextureUsageBit::TransferDst | dawn::TextureUsageBit::Sampled;
|
||||
dawn::Texture texture = device.CreateTexture(&descriptor);
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
#include <array>
|
||||
|
||||
constexpr static unsigned int kRTSize = 64;
|
||||
constexpr dawn::TextureFormat kDefaultFormat = dawn::TextureFormat::R8G8B8A8Unorm;
|
||||
constexpr dawn::TextureFormat kDefaultFormat = dawn::TextureFormat::RGBA8Unorm;
|
||||
constexpr uint32_t kBytesPerTexel = 4;
|
||||
|
||||
namespace {
|
||||
|
||||
@@ -32,7 +32,7 @@ class TextureZeroInitTest : public DawnTest {
|
||||
descriptor.size.depth = 1;
|
||||
descriptor.arrayLayerCount = arrayLayerCount;
|
||||
descriptor.sampleCount = 1;
|
||||
descriptor.format = dawn::TextureFormat::R8G8B8A8Unorm;
|
||||
descriptor.format = dawn::TextureFormat::RGBA8Unorm;
|
||||
descriptor.mipLevelCount = mipLevelCount;
|
||||
descriptor.usage = usage;
|
||||
return descriptor;
|
||||
@@ -40,7 +40,7 @@ class TextureZeroInitTest : public DawnTest {
|
||||
dawn::TextureViewDescriptor CreateTextureViewDescriptor(uint32_t baseMipLevel,
|
||||
uint32_t baseArrayLayer) {
|
||||
dawn::TextureViewDescriptor descriptor;
|
||||
descriptor.format = dawn::TextureFormat::R8G8B8A8Unorm;
|
||||
descriptor.format = dawn::TextureFormat::RGBA8Unorm;
|
||||
descriptor.baseArrayLayer = baseArrayLayer;
|
||||
descriptor.arrayLayerCount = 1;
|
||||
descriptor.baseMipLevel = baseMipLevel;
|
||||
@@ -73,7 +73,7 @@ TEST_P(TextureZeroInitTest, MipMapClearsToZero) {
|
||||
dawn::TextureView view = texture.CreateView(&viewDescriptor);
|
||||
|
||||
utils::BasicRenderPass renderPass =
|
||||
utils::BasicRenderPass(kSize, kSize, texture, dawn::TextureFormat::R8G8B8A8Unorm);
|
||||
utils::BasicRenderPass(kSize, kSize, texture, dawn::TextureFormat::RGBA8Unorm);
|
||||
|
||||
renderPass.renderPassInfo.cColorAttachmentsInfoPtr[0]->attachment = view;
|
||||
dawn::CommandEncoder encoder = device.CreateCommandEncoder();
|
||||
@@ -102,7 +102,7 @@ TEST_P(TextureZeroInitTest, ArrayLayerClearsToZero) {
|
||||
dawn::TextureView view = texture.CreateView(&viewDescriptor);
|
||||
|
||||
utils::BasicRenderPass renderPass =
|
||||
utils::BasicRenderPass(kSize, kSize, texture, dawn::TextureFormat::R8G8B8A8Unorm);
|
||||
utils::BasicRenderPass(kSize, kSize, texture, dawn::TextureFormat::RGBA8Unorm);
|
||||
|
||||
renderPass.renderPassInfo.cColorAttachmentsInfoPtr[0]->attachment = view;
|
||||
dawn::CommandEncoder encoder = device.CreateCommandEncoder();
|
||||
|
||||
@@ -44,7 +44,7 @@ class BindGroupValidationTest : public ValidationTest {
|
||||
descriptor.size = {16, 16, 1};
|
||||
descriptor.arrayLayerCount = 1;
|
||||
descriptor.sampleCount = 1;
|
||||
descriptor.format = dawn::TextureFormat::R8G8B8A8Unorm;
|
||||
descriptor.format = dawn::TextureFormat::RGBA8Unorm;
|
||||
descriptor.mipLevelCount = 1;
|
||||
descriptor.usage = dawn::TextureUsageBit::Sampled;
|
||||
mSampledTexture = device.CreateTexture(&descriptor);
|
||||
@@ -216,7 +216,7 @@ TEST_F(BindGroupValidationTest, TextureBindingType) {
|
||||
// Setting the texture view to an error texture view is an error.
|
||||
{
|
||||
dawn::TextureViewDescriptor viewDesc;
|
||||
viewDesc.format = dawn::TextureFormat::R8G8B8A8Unorm;
|
||||
viewDesc.format = dawn::TextureFormat::RGBA8Unorm;
|
||||
viewDesc.dimension = dawn::TextureViewDimension::e2D;
|
||||
viewDesc.baseMipLevel = 0;
|
||||
viewDesc.mipLevelCount = 0;
|
||||
@@ -298,7 +298,7 @@ TEST_F(BindGroupValidationTest, TextureUsage) {
|
||||
descriptor.size = {16, 16, 1};
|
||||
descriptor.arrayLayerCount = 1;
|
||||
descriptor.sampleCount = 1;
|
||||
descriptor.format = dawn::TextureFormat::R8G8B8A8Unorm;
|
||||
descriptor.format = dawn::TextureFormat::RGBA8Unorm;
|
||||
descriptor.mipLevelCount = 1;
|
||||
descriptor.usage = dawn::TextureUsageBit::OutputAttachment;
|
||||
dawn::Texture outputTexture = device.CreateTexture(&descriptor);
|
||||
|
||||
@@ -238,7 +238,7 @@ TEST_F(CommandBufferValidationTest, TextureWithReadAndWriteUsage) {
|
||||
// Create a texture that will be used both as a sampled texture and a render target
|
||||
dawn::TextureDescriptor textureDescriptor;
|
||||
textureDescriptor.usage = dawn::TextureUsageBit::Sampled | dawn::TextureUsageBit::OutputAttachment;
|
||||
textureDescriptor.format = dawn::TextureFormat::R8G8B8A8Unorm;
|
||||
textureDescriptor.format = dawn::TextureFormat::RGBA8Unorm;
|
||||
textureDescriptor.dimension = dawn::TextureDimension::e2D;
|
||||
textureDescriptor.size = {1, 1, 1};
|
||||
textureDescriptor.arrayLayerCount = 1;
|
||||
|
||||
@@ -48,9 +48,9 @@ class CopyCommandTest : public ValidationTest {
|
||||
// TODO(jiawei.shao@intel.com): support more pixel formats
|
||||
uint32_t TextureFormatPixelSize(dawn::TextureFormat format) {
|
||||
switch (format) {
|
||||
case dawn::TextureFormat::R8G8Unorm:
|
||||
case dawn::TextureFormat::RG8Unorm:
|
||||
return 2;
|
||||
case dawn::TextureFormat::R8G8B8A8Unorm:
|
||||
case dawn::TextureFormat::RGBA8Unorm:
|
||||
return 4;
|
||||
default:
|
||||
UNREACHABLE();
|
||||
@@ -62,7 +62,7 @@ class CopyCommandTest : public ValidationTest {
|
||||
uint32_t width,
|
||||
uint32_t height,
|
||||
uint32_t depth,
|
||||
dawn::TextureFormat format = dawn::TextureFormat::R8G8B8A8Unorm) {
|
||||
dawn::TextureFormat format = dawn::TextureFormat::RGBA8Unorm) {
|
||||
uint32_t bytesPerPixel = TextureFormatPixelSize(format);
|
||||
uint32_t rowPitch = Align(width * bytesPerPixel, kTextureRowPitchAlignment);
|
||||
return (rowPitch * (height - 1) + width * bytesPerPixel) * depth;
|
||||
@@ -270,8 +270,8 @@ class CopyCommandTest_B2T : public CopyCommandTest {
|
||||
TEST_F(CopyCommandTest_B2T, Success) {
|
||||
uint64_t bufferSize = BufferSizeForTextureCopy(4, 4, 1);
|
||||
dawn::Buffer source = CreateBuffer(bufferSize, dawn::BufferUsageBit::TransferSrc);
|
||||
dawn::Texture destination = Create2DTexture(16, 16, 5, 1, dawn::TextureFormat::R8G8B8A8Unorm,
|
||||
dawn::TextureUsageBit::TransferDst);
|
||||
dawn::Texture destination = Create2DTexture(16, 16, 5, 1, dawn::TextureFormat::RGBA8Unorm,
|
||||
dawn::TextureUsageBit::TransferDst);
|
||||
|
||||
// Different copies, including some that touch the OOB condition
|
||||
{
|
||||
@@ -323,8 +323,8 @@ TEST_F(CopyCommandTest_B2T, Success) {
|
||||
TEST_F(CopyCommandTest_B2T, OutOfBoundsOnBuffer) {
|
||||
uint64_t bufferSize = BufferSizeForTextureCopy(4, 4, 1);
|
||||
dawn::Buffer source = CreateBuffer(bufferSize, dawn::BufferUsageBit::TransferSrc);
|
||||
dawn::Texture destination = Create2DTexture(16, 16, 5, 1, dawn::TextureFormat::R8G8B8A8Unorm,
|
||||
dawn::TextureUsageBit::TransferDst);
|
||||
dawn::Texture destination = Create2DTexture(16, 16, 5, 1, dawn::TextureFormat::RGBA8Unorm,
|
||||
dawn::TextureUsageBit::TransferDst);
|
||||
|
||||
// OOB on the buffer because we copy too many pixels
|
||||
TestB2TCopy(utils::Expectation::Failure, source, 0, 256, 0, destination, 0, 0, {0, 0, 0},
|
||||
@@ -355,8 +355,8 @@ TEST_F(CopyCommandTest_B2T, OutOfBoundsOnBuffer) {
|
||||
TEST_F(CopyCommandTest_B2T, OutOfBoundsOnTexture) {
|
||||
uint64_t bufferSize = BufferSizeForTextureCopy(4, 4, 1);
|
||||
dawn::Buffer source = CreateBuffer(bufferSize, dawn::BufferUsageBit::TransferSrc);
|
||||
dawn::Texture destination = Create2DTexture(16, 16, 5, 2, dawn::TextureFormat::R8G8B8A8Unorm,
|
||||
dawn::TextureUsageBit::TransferDst);
|
||||
dawn::Texture destination = Create2DTexture(16, 16, 5, 2, dawn::TextureFormat::RGBA8Unorm,
|
||||
dawn::TextureUsageBit::TransferDst);
|
||||
|
||||
// OOB on the texture because x + width overflows
|
||||
TestB2TCopy(utils::Expectation::Failure, source, 0, 256, 0, destination, 0, 0, {13, 12, 0},
|
||||
@@ -382,8 +382,8 @@ TEST_F(CopyCommandTest_B2T, OutOfBoundsOnTexture) {
|
||||
// Test that we force Z=0 and Depth=1 on copies to 2D textures
|
||||
TEST_F(CopyCommandTest_B2T, ZDepthConstraintFor2DTextures) {
|
||||
dawn::Buffer source = CreateBuffer(16 * 4, dawn::BufferUsageBit::TransferSrc);
|
||||
dawn::Texture destination = Create2DTexture(16, 16, 5, 1, dawn::TextureFormat::R8G8B8A8Unorm,
|
||||
dawn::TextureUsageBit::TransferDst);
|
||||
dawn::Texture destination = Create2DTexture(16, 16, 5, 1, dawn::TextureFormat::RGBA8Unorm,
|
||||
dawn::TextureUsageBit::TransferDst);
|
||||
|
||||
// Z=1 on an empty copy still errors
|
||||
TestB2TCopy(utils::Expectation::Failure, source, 0, 0, 0, destination, 0, 0, {0, 0, 1},
|
||||
@@ -398,10 +398,10 @@ TEST_F(CopyCommandTest_B2T, ZDepthConstraintFor2DTextures) {
|
||||
TEST_F(CopyCommandTest_B2T, IncorrectUsage) {
|
||||
dawn::Buffer source = CreateBuffer(16 * 4, dawn::BufferUsageBit::TransferSrc);
|
||||
dawn::Buffer vertex = CreateBuffer(16 * 4, dawn::BufferUsageBit::Vertex);
|
||||
dawn::Texture destination = Create2DTexture(16, 16, 5, 1, dawn::TextureFormat::R8G8B8A8Unorm,
|
||||
dawn::TextureUsageBit::TransferDst);
|
||||
dawn::Texture sampled = Create2DTexture(16, 16, 5, 1, dawn::TextureFormat::R8G8B8A8Unorm,
|
||||
dawn::TextureUsageBit::Sampled);
|
||||
dawn::Texture destination = Create2DTexture(16, 16, 5, 1, dawn::TextureFormat::RGBA8Unorm,
|
||||
dawn::TextureUsageBit::TransferDst);
|
||||
dawn::Texture sampled = Create2DTexture(16, 16, 5, 1, dawn::TextureFormat::RGBA8Unorm,
|
||||
dawn::TextureUsageBit::Sampled);
|
||||
|
||||
// Incorrect source usage
|
||||
TestB2TCopy(utils::Expectation::Failure, vertex, 0, 256, 0, destination, 0, 0, {0, 0, 0},
|
||||
@@ -415,8 +415,8 @@ TEST_F(CopyCommandTest_B2T, IncorrectUsage) {
|
||||
TEST_F(CopyCommandTest_B2T, IncorrectRowPitch) {
|
||||
uint64_t bufferSize = BufferSizeForTextureCopy(128, 16, 1);
|
||||
dawn::Buffer source = CreateBuffer(bufferSize, dawn::BufferUsageBit::TransferSrc);
|
||||
dawn::Texture destination = Create2DTexture(128, 16, 5, 1, dawn::TextureFormat::R8G8B8A8Unorm,
|
||||
dawn::TextureUsageBit::TransferDst);
|
||||
dawn::Texture destination = Create2DTexture(128, 16, 5, 1, dawn::TextureFormat::RGBA8Unorm,
|
||||
dawn::TextureUsageBit::TransferDst);
|
||||
|
||||
// Default row pitch is not 256-byte aligned
|
||||
TestB2TCopy(utils::Expectation::Failure, source, 0, 0, 0, destination, 0, 0, {0, 0, 0},
|
||||
@@ -434,7 +434,7 @@ TEST_F(CopyCommandTest_B2T, IncorrectRowPitch) {
|
||||
TEST_F(CopyCommandTest_B2T, ImageHeightConstraint) {
|
||||
uint64_t bufferSize = BufferSizeForTextureCopy(5, 5, 1);
|
||||
dawn::Buffer source = CreateBuffer(bufferSize, dawn::BufferUsageBit::TransferSrc);
|
||||
dawn::Texture destination = Create2DTexture(16, 16, 1, 1, dawn::TextureFormat::R8G8B8A8Unorm,
|
||||
dawn::Texture destination = Create2DTexture(16, 16, 1, 1, dawn::TextureFormat::RGBA8Unorm,
|
||||
dawn::TextureUsageBit::TransferDst);
|
||||
|
||||
// Image height is zero (Valid)
|
||||
@@ -458,8 +458,8 @@ TEST_F(CopyCommandTest_B2T, ImageHeightConstraint) {
|
||||
TEST_F(CopyCommandTest_B2T, IncorrectBufferOffset) {
|
||||
uint64_t bufferSize = BufferSizeForTextureCopy(4, 4, 1);
|
||||
dawn::Buffer source = CreateBuffer(bufferSize, dawn::BufferUsageBit::TransferSrc);
|
||||
dawn::Texture destination = Create2DTexture(16, 16, 5, 1, dawn::TextureFormat::R8G8B8A8Unorm,
|
||||
dawn::TextureUsageBit::TransferDst);
|
||||
dawn::Texture destination = Create2DTexture(16, 16, 5, 1, dawn::TextureFormat::RGBA8Unorm,
|
||||
dawn::TextureUsageBit::TransferDst);
|
||||
|
||||
// Correct usage
|
||||
TestB2TCopy(utils::Expectation::Success, source, bufferSize - 4, 256, 0, destination, 0, 0,
|
||||
@@ -480,7 +480,7 @@ TEST_F(CopyCommandTest_B2T, IncorrectBufferOffset) {
|
||||
TEST_F(CopyCommandTest_B2T, CopyToMultisampledTexture) {
|
||||
uint64_t bufferSize = BufferSizeForTextureCopy(16, 16, 1);
|
||||
dawn::Buffer source = CreateBuffer(bufferSize, dawn::BufferUsageBit::TransferSrc);
|
||||
dawn::Texture destination = Create2DTexture(2, 2, 1, 1, dawn::TextureFormat::R8G8B8A8Unorm,
|
||||
dawn::Texture destination = Create2DTexture(2, 2, 1, 1, dawn::TextureFormat::RGBA8Unorm,
|
||||
dawn::TextureUsageBit::TransferDst, 4);
|
||||
|
||||
TestB2TCopy(utils::Expectation::Failure, source, 0, 256, 0, destination, 0, 0, {0, 0, 0},
|
||||
@@ -505,9 +505,8 @@ TEST_F(CopyCommandTest_B2T, BufferOrTextureInErrorState) {
|
||||
dawn::Extent3D extent3D = {1, 1, 1};
|
||||
|
||||
{
|
||||
dawn::Texture destination =
|
||||
Create2DTexture(16, 16, 1, 1, dawn::TextureFormat::R8G8B8A8Unorm,
|
||||
dawn::TextureUsageBit::TransferDst);
|
||||
dawn::Texture destination = Create2DTexture(16, 16, 1, 1, dawn::TextureFormat::RGBA8Unorm,
|
||||
dawn::TextureUsageBit::TransferDst);
|
||||
dawn::TextureCopyView textureCopyView =
|
||||
utils::CreateTextureCopyView(destination, 0, 0, {1, 1, 1});
|
||||
|
||||
@@ -534,8 +533,8 @@ TEST_F(CopyCommandTest_B2T, TextureCopyBufferSizeLastRowComputation) {
|
||||
constexpr uint32_t kWidth = 4;
|
||||
constexpr uint32_t kHeight = 4;
|
||||
|
||||
constexpr std::array<dawn::TextureFormat, 2> kFormats = {dawn::TextureFormat::R8G8B8A8Unorm,
|
||||
dawn::TextureFormat::R8G8Unorm};
|
||||
constexpr std::array<dawn::TextureFormat, 2> kFormats = {dawn::TextureFormat::RGBA8Unorm,
|
||||
dawn::TextureFormat::RG8Unorm};
|
||||
|
||||
{
|
||||
// kRowPitch * (kHeight - 1) + kWidth is not large enough to be the valid buffer size in
|
||||
@@ -584,8 +583,8 @@ class CopyCommandTest_T2B : public CopyCommandTest {
|
||||
// Test a successfull T2B copy
|
||||
TEST_F(CopyCommandTest_T2B, Success) {
|
||||
uint64_t bufferSize = BufferSizeForTextureCopy(4, 4, 1);
|
||||
dawn::Texture source = Create2DTexture(16, 16, 5, 1, dawn::TextureFormat::R8G8B8A8Unorm,
|
||||
dawn::TextureUsageBit::TransferSrc);
|
||||
dawn::Texture source = Create2DTexture(16, 16, 5, 1, dawn::TextureFormat::RGBA8Unorm,
|
||||
dawn::TextureUsageBit::TransferSrc);
|
||||
dawn::Buffer destination = CreateBuffer(bufferSize, dawn::BufferUsageBit::TransferDst);
|
||||
|
||||
// Different copies, including some that touch the OOB condition
|
||||
@@ -637,8 +636,8 @@ TEST_F(CopyCommandTest_T2B, Success) {
|
||||
// Test OOB conditions on the texture
|
||||
TEST_F(CopyCommandTest_T2B, OutOfBoundsOnTexture) {
|
||||
uint64_t bufferSize = BufferSizeForTextureCopy(4, 4, 1);
|
||||
dawn::Texture source = Create2DTexture(16, 16, 5, 1, dawn::TextureFormat::R8G8B8A8Unorm,
|
||||
dawn::TextureUsageBit::TransferSrc);
|
||||
dawn::Texture source = Create2DTexture(16, 16, 5, 1, dawn::TextureFormat::RGBA8Unorm,
|
||||
dawn::TextureUsageBit::TransferSrc);
|
||||
dawn::Buffer destination = CreateBuffer(bufferSize, dawn::BufferUsageBit::TransferDst);
|
||||
|
||||
// OOB on the texture because x + width overflows
|
||||
@@ -661,8 +660,8 @@ TEST_F(CopyCommandTest_T2B, OutOfBoundsOnTexture) {
|
||||
// Test OOB conditions on the buffer
|
||||
TEST_F(CopyCommandTest_T2B, OutOfBoundsOnBuffer) {
|
||||
uint64_t bufferSize = BufferSizeForTextureCopy(4, 4, 1);
|
||||
dawn::Texture source = Create2DTexture(16, 16, 5, 1, dawn::TextureFormat::R8G8B8A8Unorm,
|
||||
dawn::TextureUsageBit::TransferSrc);
|
||||
dawn::Texture source = Create2DTexture(16, 16, 5, 1, dawn::TextureFormat::RGBA8Unorm,
|
||||
dawn::TextureUsageBit::TransferSrc);
|
||||
dawn::Buffer destination = CreateBuffer(bufferSize, dawn::BufferUsageBit::TransferDst);
|
||||
|
||||
// OOB on the buffer because we copy too many pixels
|
||||
@@ -692,8 +691,8 @@ TEST_F(CopyCommandTest_T2B, OutOfBoundsOnBuffer) {
|
||||
// Test that we force Z=0 and Depth=1 on copies from to 2D textures
|
||||
TEST_F(CopyCommandTest_T2B, ZDepthConstraintFor2DTextures) {
|
||||
uint64_t bufferSize = BufferSizeForTextureCopy(4, 4, 1);
|
||||
dawn::Texture source = Create2DTexture(16, 16, 5, 1, dawn::TextureFormat::R8G8B8A8Unorm,
|
||||
dawn::TextureUsageBit::TransferSrc);
|
||||
dawn::Texture source = Create2DTexture(16, 16, 5, 1, dawn::TextureFormat::RGBA8Unorm,
|
||||
dawn::TextureUsageBit::TransferSrc);
|
||||
dawn::Buffer destination = CreateBuffer(bufferSize, dawn::BufferUsageBit::TransferDst);
|
||||
|
||||
// Z=1 on an empty copy still errors
|
||||
@@ -708,10 +707,10 @@ TEST_F(CopyCommandTest_T2B, ZDepthConstraintFor2DTextures) {
|
||||
// Test T2B copies with incorrect buffer usage
|
||||
TEST_F(CopyCommandTest_T2B, IncorrectUsage) {
|
||||
uint64_t bufferSize = BufferSizeForTextureCopy(4, 4, 1);
|
||||
dawn::Texture source = Create2DTexture(16, 16, 5, 1, dawn::TextureFormat::R8G8B8A8Unorm,
|
||||
dawn::TextureUsageBit::TransferSrc);
|
||||
dawn::Texture sampled = Create2DTexture(16, 16, 5, 1, dawn::TextureFormat::R8G8B8A8Unorm,
|
||||
dawn::TextureUsageBit::Sampled);
|
||||
dawn::Texture source = Create2DTexture(16, 16, 5, 1, dawn::TextureFormat::RGBA8Unorm,
|
||||
dawn::TextureUsageBit::TransferSrc);
|
||||
dawn::Texture sampled = Create2DTexture(16, 16, 5, 1, dawn::TextureFormat::RGBA8Unorm,
|
||||
dawn::TextureUsageBit::Sampled);
|
||||
dawn::Buffer destination = CreateBuffer(bufferSize, dawn::BufferUsageBit::TransferDst);
|
||||
dawn::Buffer vertex = CreateBuffer(bufferSize, dawn::BufferUsageBit::Vertex);
|
||||
|
||||
@@ -725,8 +724,8 @@ TEST_F(CopyCommandTest_T2B, IncorrectUsage) {
|
||||
|
||||
TEST_F(CopyCommandTest_T2B, IncorrectRowPitch) {
|
||||
uint64_t bufferSize = BufferSizeForTextureCopy(128, 16, 1);
|
||||
dawn::Texture source = Create2DTexture(128, 16, 5, 1, dawn::TextureFormat::R8G8B8A8Unorm,
|
||||
dawn::TextureUsageBit::TransferDst);
|
||||
dawn::Texture source = Create2DTexture(128, 16, 5, 1, dawn::TextureFormat::RGBA8Unorm,
|
||||
dawn::TextureUsageBit::TransferDst);
|
||||
dawn::Buffer destination = CreateBuffer(bufferSize, dawn::BufferUsageBit::TransferSrc);
|
||||
|
||||
// Default row pitch is not 256-byte aligned
|
||||
@@ -744,7 +743,7 @@ TEST_F(CopyCommandTest_T2B, IncorrectRowPitch) {
|
||||
|
||||
TEST_F(CopyCommandTest_T2B, ImageHeightConstraint) {
|
||||
uint64_t bufferSize = BufferSizeForTextureCopy(5, 5, 1);
|
||||
dawn::Texture source = Create2DTexture(16, 16, 1, 1, dawn::TextureFormat::R8G8B8A8Unorm,
|
||||
dawn::Texture source = Create2DTexture(16, 16, 1, 1, dawn::TextureFormat::RGBA8Unorm,
|
||||
dawn::TextureUsageBit::TransferSrc);
|
||||
dawn::Buffer destination = CreateBuffer(bufferSize, dawn::BufferUsageBit::TransferDst);
|
||||
|
||||
@@ -768,7 +767,7 @@ TEST_F(CopyCommandTest_T2B, ImageHeightConstraint) {
|
||||
// Test T2B copies with incorrect buffer offset usage
|
||||
TEST_F(CopyCommandTest_T2B, IncorrectBufferOffset) {
|
||||
uint64_t bufferSize = BufferSizeForTextureCopy(128, 16, 1);
|
||||
dawn::Texture source = Create2DTexture(128, 16, 5, 1, dawn::TextureFormat::R8G8B8A8Unorm,
|
||||
dawn::Texture source = Create2DTexture(128, 16, 5, 1, dawn::TextureFormat::RGBA8Unorm,
|
||||
dawn::TextureUsageBit::TransferSrc);
|
||||
dawn::Buffer destination = CreateBuffer(bufferSize, dawn::BufferUsageBit::TransferDst);
|
||||
|
||||
@@ -787,7 +786,7 @@ TEST_F(CopyCommandTest_T2B, IncorrectBufferOffset) {
|
||||
|
||||
// Test multisampled textures cannot be used in T2B copies.
|
||||
TEST_F(CopyCommandTest_T2B, CopyFromMultisampledTexture) {
|
||||
dawn::Texture source = Create2DTexture(2, 2, 1, 1, dawn::TextureFormat::R8G8B8A8Unorm,
|
||||
dawn::Texture source = Create2DTexture(2, 2, 1, 1, dawn::TextureFormat::RGBA8Unorm,
|
||||
dawn::TextureUsageBit::TransferSrc, 4);
|
||||
uint64_t bufferSize = BufferSizeForTextureCopy(16, 16, 1);
|
||||
dawn::Buffer destination = CreateBuffer(bufferSize, dawn::BufferUsageBit::TransferDst);
|
||||
@@ -825,9 +824,8 @@ TEST_F(CopyCommandTest_T2B, BufferOrTextureInErrorState) {
|
||||
}
|
||||
|
||||
{
|
||||
dawn::Texture destination =
|
||||
Create2DTexture(16, 16, 1, 1, dawn::TextureFormat::R8G8B8A8Unorm,
|
||||
dawn::TextureUsageBit::TransferDst);
|
||||
dawn::Texture destination = Create2DTexture(16, 16, 1, 1, dawn::TextureFormat::RGBA8Unorm,
|
||||
dawn::TextureUsageBit::TransferDst);
|
||||
dawn::TextureCopyView textureCopyView =
|
||||
utils::CreateTextureCopyView(destination, 0, 0, {1, 1, 1});
|
||||
|
||||
@@ -843,8 +841,8 @@ TEST_F(CopyCommandTest_T2B, TextureCopyBufferSizeLastRowComputation) {
|
||||
constexpr uint32_t kWidth = 4;
|
||||
constexpr uint32_t kHeight = 4;
|
||||
|
||||
constexpr std::array<dawn::TextureFormat, 2> kFormats = {dawn::TextureFormat::R8G8B8A8Unorm,
|
||||
dawn::TextureFormat::R8G8Unorm};
|
||||
constexpr std::array<dawn::TextureFormat, 2> kFormats = {dawn::TextureFormat::RGBA8Unorm,
|
||||
dawn::TextureFormat::RG8Unorm};
|
||||
|
||||
{
|
||||
// kRowPitch * (kHeight - 1) + kWidth is not large enough to be the valid buffer size in
|
||||
@@ -891,9 +889,9 @@ TEST_F(CopyCommandTest_T2B, TextureCopyBufferSizeLastRowComputation) {
|
||||
class CopyCommandTest_T2T : public CopyCommandTest {};
|
||||
|
||||
TEST_F(CopyCommandTest_T2T, Success) {
|
||||
dawn::Texture source = Create2DTexture(16, 16, 5, 2, dawn::TextureFormat::R8G8B8A8Unorm,
|
||||
dawn::Texture source = Create2DTexture(16, 16, 5, 2, dawn::TextureFormat::RGBA8Unorm,
|
||||
dawn::TextureUsageBit::TransferSrc);
|
||||
dawn::Texture destination = Create2DTexture(16, 16, 5, 2, dawn::TextureFormat::R8G8B8A8Unorm,
|
||||
dawn::Texture destination = Create2DTexture(16, 16, 5, 2, dawn::TextureFormat::RGBA8Unorm,
|
||||
dawn::TextureUsageBit::TransferDst);
|
||||
|
||||
// Different copies, including some that touch the OOB condition
|
||||
@@ -944,9 +942,9 @@ TEST_F(CopyCommandTest_T2T, Success) {
|
||||
}
|
||||
|
||||
TEST_F(CopyCommandTest_T2T, IncorrectUsage) {
|
||||
dawn::Texture source = Create2DTexture(16, 16, 5, 2, dawn::TextureFormat::R8G8B8A8Unorm,
|
||||
dawn::Texture source = Create2DTexture(16, 16, 5, 2, dawn::TextureFormat::RGBA8Unorm,
|
||||
dawn::TextureUsageBit::TransferSrc);
|
||||
dawn::Texture destination = Create2DTexture(16, 16, 5, 2, dawn::TextureFormat::R8G8B8A8Unorm,
|
||||
dawn::Texture destination = Create2DTexture(16, 16, 5, 2, dawn::TextureFormat::RGBA8Unorm,
|
||||
dawn::TextureUsageBit::TransferDst);
|
||||
|
||||
// Incorrect source usage causes failure
|
||||
@@ -959,9 +957,9 @@ TEST_F(CopyCommandTest_T2T, IncorrectUsage) {
|
||||
}
|
||||
|
||||
TEST_F(CopyCommandTest_T2T, OutOfBounds) {
|
||||
dawn::Texture source = Create2DTexture(16, 16, 5, 2, dawn::TextureFormat::R8G8B8A8Unorm,
|
||||
dawn::Texture source = Create2DTexture(16, 16, 5, 2, dawn::TextureFormat::RGBA8Unorm,
|
||||
dawn::TextureUsageBit::TransferSrc);
|
||||
dawn::Texture destination = Create2DTexture(16, 16, 5, 2, dawn::TextureFormat::R8G8B8A8Unorm,
|
||||
dawn::Texture destination = Create2DTexture(16, 16, 5, 2, dawn::TextureFormat::RGBA8Unorm,
|
||||
dawn::TextureUsageBit::TransferDst);
|
||||
|
||||
// OOB on source
|
||||
@@ -1012,9 +1010,9 @@ TEST_F(CopyCommandTest_T2T, OutOfBounds) {
|
||||
}
|
||||
|
||||
TEST_F(CopyCommandTest_T2T, 2DTextureDepthConstraints) {
|
||||
dawn::Texture source = Create2DTexture(16, 16, 5, 2, dawn::TextureFormat::R8G8B8A8Unorm,
|
||||
dawn::Texture source = Create2DTexture(16, 16, 5, 2, dawn::TextureFormat::RGBA8Unorm,
|
||||
dawn::TextureUsageBit::TransferSrc);
|
||||
dawn::Texture destination = Create2DTexture(16, 16, 5, 2, dawn::TextureFormat::R8G8B8A8Unorm,
|
||||
dawn::Texture destination = Create2DTexture(16, 16, 5, 2, dawn::TextureFormat::RGBA8Unorm,
|
||||
dawn::TextureUsageBit::TransferDst);
|
||||
|
||||
// Empty copy on source with z > 0 fails
|
||||
@@ -1031,10 +1029,10 @@ TEST_F(CopyCommandTest_T2T, 2DTextureDepthConstraints) {
|
||||
}
|
||||
|
||||
TEST_F(CopyCommandTest_T2T, 2DTextureDepthStencil) {
|
||||
dawn::Texture source = Create2DTexture(16, 16, 1, 1, dawn::TextureFormat::D32FloatS8Uint,
|
||||
dawn::Texture source = Create2DTexture(16, 16, 1, 1, dawn::TextureFormat::Depth24PlusStencil8,
|
||||
dawn::TextureUsageBit::TransferSrc);
|
||||
dawn::Texture destination = Create2DTexture(16, 16, 1, 1, dawn::TextureFormat::D32FloatS8Uint,
|
||||
dawn::TextureUsageBit::TransferDst);
|
||||
dawn::Texture destination = Create2DTexture(
|
||||
16, 16, 1, 1, dawn::TextureFormat::Depth24PlusStencil8, dawn::TextureUsageBit::TransferDst);
|
||||
|
||||
// Success when entire depth stencil subresource is copied
|
||||
TestT2TCopy(utils::Expectation::Success, source, 0, 0, {0, 0, 0}, destination, 0, 0, {0, 0, 0},
|
||||
@@ -1046,9 +1044,9 @@ TEST_F(CopyCommandTest_T2T, 2DTextureDepthStencil) {
|
||||
}
|
||||
|
||||
TEST_F(CopyCommandTest_T2T, FormatsMismatch) {
|
||||
dawn::Texture source = Create2DTexture(16, 16, 5, 2, dawn::TextureFormat::R8G8B8A8Uint,
|
||||
dawn::Texture source = Create2DTexture(16, 16, 5, 2, dawn::TextureFormat::RGBA8Uint,
|
||||
dawn::TextureUsageBit::TransferSrc);
|
||||
dawn::Texture destination = Create2DTexture(16, 16, 5, 2, dawn::TextureFormat::R8G8B8A8Unorm,
|
||||
dawn::Texture destination = Create2DTexture(16, 16, 5, 2, dawn::TextureFormat::RGBA8Unorm,
|
||||
dawn::TextureUsageBit::TransferDst);
|
||||
|
||||
// Failure when formats don't match
|
||||
@@ -1058,11 +1056,11 @@ TEST_F(CopyCommandTest_T2T, FormatsMismatch) {
|
||||
|
||||
TEST_F(CopyCommandTest_T2T, MultisampledCopies) {
|
||||
dawn::Texture sourceMultiSampled1x = Create2DTexture(
|
||||
16, 16, 1, 1, dawn::TextureFormat::R8G8B8A8Unorm, dawn::TextureUsageBit::TransferSrc, 1);
|
||||
16, 16, 1, 1, dawn::TextureFormat::RGBA8Unorm, dawn::TextureUsageBit::TransferSrc, 1);
|
||||
dawn::Texture sourceMultiSampled4x = Create2DTexture(
|
||||
16, 16, 1, 1, dawn::TextureFormat::R8G8B8A8Unorm, dawn::TextureUsageBit::TransferSrc, 4);
|
||||
16, 16, 1, 1, dawn::TextureFormat::RGBA8Unorm, dawn::TextureUsageBit::TransferSrc, 4);
|
||||
dawn::Texture destinationMultiSampled4x = Create2DTexture(
|
||||
16, 16, 1, 1, dawn::TextureFormat::R8G8B8A8Unorm, dawn::TextureUsageBit::TransferDst, 4);
|
||||
16, 16, 1, 1, dawn::TextureFormat::RGBA8Unorm, dawn::TextureUsageBit::TransferDst, 4);
|
||||
|
||||
// Success when entire multisampled subresource is copied
|
||||
{
|
||||
|
||||
@@ -82,14 +82,15 @@ TEST_F(RenderPassDescriptorValidationTest, Empty) {
|
||||
TEST_F(RenderPassDescriptorValidationTest, OneAttachment) {
|
||||
// One color attachment
|
||||
{
|
||||
dawn::TextureView color = Create2DAttachment(device, 1, 1, dawn::TextureFormat::R8G8B8A8Unorm);
|
||||
dawn::TextureView color = Create2DAttachment(device, 1, 1, dawn::TextureFormat::RGBA8Unorm);
|
||||
utils::ComboRenderPassDescriptor renderPass({color});
|
||||
|
||||
AssertBeginRenderPassSuccess(&renderPass);
|
||||
}
|
||||
// One depth-stencil attachment
|
||||
{
|
||||
dawn::TextureView depthStencil = Create2DAttachment(device, 1, 1, dawn::TextureFormat::D32FloatS8Uint);
|
||||
dawn::TextureView depthStencil =
|
||||
Create2DAttachment(device, 1, 1, dawn::TextureFormat::Depth24PlusStencil8);
|
||||
utils::ComboRenderPassDescriptor renderPass({}, depthStencil);
|
||||
|
||||
AssertBeginRenderPassSuccess(&renderPass);
|
||||
@@ -98,14 +99,10 @@ TEST_F(RenderPassDescriptorValidationTest, OneAttachment) {
|
||||
|
||||
// Test OOB color attachment indices are handled
|
||||
TEST_F(RenderPassDescriptorValidationTest, ColorAttachmentOutOfBounds) {
|
||||
dawn::TextureView color1 = Create2DAttachment(device, 1, 1,
|
||||
dawn::TextureFormat::R8G8B8A8Unorm);
|
||||
dawn::TextureView color2 = Create2DAttachment(device, 1, 1,
|
||||
dawn::TextureFormat::R8G8B8A8Unorm);
|
||||
dawn::TextureView color3 = Create2DAttachment(device, 1, 1,
|
||||
dawn::TextureFormat::R8G8B8A8Unorm);
|
||||
dawn::TextureView color4 = Create2DAttachment(device, 1, 1,
|
||||
dawn::TextureFormat::R8G8B8A8Unorm);
|
||||
dawn::TextureView color1 = Create2DAttachment(device, 1, 1, dawn::TextureFormat::RGBA8Unorm);
|
||||
dawn::TextureView color2 = Create2DAttachment(device, 1, 1, dawn::TextureFormat::RGBA8Unorm);
|
||||
dawn::TextureView color3 = Create2DAttachment(device, 1, 1, dawn::TextureFormat::RGBA8Unorm);
|
||||
dawn::TextureView color4 = Create2DAttachment(device, 1, 1, dawn::TextureFormat::RGBA8Unorm);
|
||||
// For setting the color attachment, control case
|
||||
{
|
||||
utils::ComboRenderPassDescriptor renderPass({color1, color2, color3, color4});
|
||||
@@ -129,8 +126,8 @@ TEST_F(RenderPassDescriptorValidationTest, ColorAttachmentOutOfBounds) {
|
||||
colorAttachment3.attachment = color3;
|
||||
colorAttachment4.attachment = color4;
|
||||
|
||||
dawn::TextureView color5 = Create2DAttachment(device, 1, 1,
|
||||
dawn::TextureFormat::R8G8B8A8Unorm);
|
||||
dawn::TextureView color5 =
|
||||
Create2DAttachment(device, 1, 1, dawn::TextureFormat::RGBA8Unorm);
|
||||
dawn::RenderPassColorAttachmentDescriptor colorAttachment5 = colorAttachment1;
|
||||
colorAttachment5.attachment = color5;
|
||||
|
||||
@@ -149,12 +146,14 @@ TEST_F(RenderPassDescriptorValidationTest, ColorAttachmentOutOfBounds) {
|
||||
|
||||
// Attachments must have the same size
|
||||
TEST_F(RenderPassDescriptorValidationTest, SizeMustMatch) {
|
||||
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 color1x1A = Create2DAttachment(device, 1, 1, dawn::TextureFormat::RGBA8Unorm);
|
||||
dawn::TextureView color1x1B = Create2DAttachment(device, 1, 1, dawn::TextureFormat::RGBA8Unorm);
|
||||
dawn::TextureView color2x2 = Create2DAttachment(device, 2, 2, dawn::TextureFormat::RGBA8Unorm);
|
||||
|
||||
dawn::TextureView depthStencil1x1 = Create2DAttachment(device, 1, 1, dawn::TextureFormat::D32FloatS8Uint);
|
||||
dawn::TextureView depthStencil2x2 = Create2DAttachment(device, 2, 2, dawn::TextureFormat::D32FloatS8Uint);
|
||||
dawn::TextureView depthStencil1x1 =
|
||||
Create2DAttachment(device, 1, 1, dawn::TextureFormat::Depth24PlusStencil8);
|
||||
dawn::TextureView depthStencil2x2 =
|
||||
Create2DAttachment(device, 2, 2, dawn::TextureFormat::Depth24PlusStencil8);
|
||||
|
||||
// Control case: all the same size (1x1)
|
||||
{
|
||||
@@ -177,8 +176,9 @@ TEST_F(RenderPassDescriptorValidationTest, SizeMustMatch) {
|
||||
|
||||
// Attachments formats must match whether they are used for color or depth-stencil
|
||||
TEST_F(RenderPassDescriptorValidationTest, FormatMismatch) {
|
||||
dawn::TextureView color = Create2DAttachment(device, 1, 1, dawn::TextureFormat::R8G8B8A8Unorm);
|
||||
dawn::TextureView depthStencil = Create2DAttachment(device, 1, 1, dawn::TextureFormat::D32FloatS8Uint);
|
||||
dawn::TextureView color = Create2DAttachment(device, 1, 1, dawn::TextureFormat::RGBA8Unorm);
|
||||
dawn::TextureView depthStencil =
|
||||
Create2DAttachment(device, 1, 1, dawn::TextureFormat::Depth24PlusStencil8);
|
||||
|
||||
// Using depth-stencil for color
|
||||
{
|
||||
@@ -198,8 +198,8 @@ TEST_F(RenderPassDescriptorValidationTest, FormatMismatch) {
|
||||
TEST_F(RenderPassDescriptorValidationTest, TextureViewLayerCountForColorAndDepthStencil) {
|
||||
constexpr uint32_t kLevelCount = 1;
|
||||
constexpr uint32_t kSize = 32;
|
||||
constexpr dawn::TextureFormat kColorFormat = dawn::TextureFormat::R8G8B8A8Unorm;
|
||||
constexpr dawn::TextureFormat kDepthStencilFormat = dawn::TextureFormat::D32FloatS8Uint;
|
||||
constexpr dawn::TextureFormat kColorFormat = dawn::TextureFormat::RGBA8Unorm;
|
||||
constexpr dawn::TextureFormat kDepthStencilFormat = dawn::TextureFormat::Depth24PlusStencil8;
|
||||
|
||||
constexpr uint32_t kArrayLayers = 10;
|
||||
|
||||
@@ -291,8 +291,8 @@ TEST_F(RenderPassDescriptorValidationTest, TextureViewLayerCountForColorAndDepth
|
||||
TEST_F(RenderPassDescriptorValidationTest, TextureViewLevelCountForColorAndDepthStencil) {
|
||||
constexpr uint32_t kArrayLayers = 1;
|
||||
constexpr uint32_t kSize = 32;
|
||||
constexpr dawn::TextureFormat kColorFormat = dawn::TextureFormat::R8G8B8A8Unorm;
|
||||
constexpr dawn::TextureFormat kDepthStencilFormat = dawn::TextureFormat::D32FloatS8Uint;
|
||||
constexpr dawn::TextureFormat kColorFormat = dawn::TextureFormat::RGBA8Unorm;
|
||||
constexpr dawn::TextureFormat kDepthStencilFormat = dawn::TextureFormat::Depth24PlusStencil8;
|
||||
|
||||
constexpr uint32_t kLevelCount = 4;
|
||||
|
||||
@@ -386,7 +386,7 @@ TEST_F(RenderPassDescriptorValidationTest, NonMultisampledColorWithResolveTarget
|
||||
static constexpr uint32_t kLevelCount = 1;
|
||||
static constexpr uint32_t kSize = 32;
|
||||
static constexpr uint32_t kSampleCount = 1;
|
||||
static constexpr dawn::TextureFormat kColorFormat = dawn::TextureFormat::R8G8B8A8Unorm;
|
||||
static constexpr dawn::TextureFormat kColorFormat = dawn::TextureFormat::RGBA8Unorm;
|
||||
|
||||
dawn::Texture colorTexture = CreateTexture(
|
||||
device, dawn::TextureDimension::e2D, kColorFormat, kSize, kSize, kArrayLayers,
|
||||
@@ -420,7 +420,7 @@ class MultisampledRenderPassDescriptorValidationTest : public RenderPassDescript
|
||||
static constexpr uint32_t kLevelCount = 1;
|
||||
static constexpr uint32_t kSize = 32;
|
||||
static constexpr uint32_t kSampleCount = 4;
|
||||
static constexpr dawn::TextureFormat kColorFormat = dawn::TextureFormat::R8G8B8A8Unorm;
|
||||
static constexpr dawn::TextureFormat kColorFormat = dawn::TextureFormat::RGBA8Unorm;
|
||||
|
||||
private:
|
||||
dawn::TextureView CreateColorTextureView(uint32_t sampleCount) {
|
||||
@@ -532,7 +532,7 @@ TEST_F(MultisampledRenderPassDescriptorValidationTest, MultisampledColorWithReso
|
||||
|
||||
// It is not allowed to use a resolve target in a format different from the color attachment.
|
||||
TEST_F(MultisampledRenderPassDescriptorValidationTest, ResolveTargetDifferentFormat) {
|
||||
constexpr dawn::TextureFormat kColorFormat2 = dawn::TextureFormat::B8G8R8A8Unorm;
|
||||
constexpr dawn::TextureFormat kColorFormat2 = dawn::TextureFormat::BGRA8Unorm;
|
||||
dawn::Texture resolveTexture = CreateTexture(
|
||||
device, dawn::TextureDimension::e2D, kColorFormat2, kSize, kSize, kArrayLayers,
|
||||
kLevelCount);
|
||||
@@ -585,7 +585,7 @@ TEST_F(MultisampledRenderPassDescriptorValidationTest, ColorAttachmentResolveTar
|
||||
|
||||
// Tests on the sample count of depth stencil attachment.
|
||||
TEST_F(MultisampledRenderPassDescriptorValidationTest, DepthStencilAttachmentSampleCount) {
|
||||
constexpr dawn::TextureFormat kDepthStencilFormat = dawn::TextureFormat::D32FloatS8Uint;
|
||||
constexpr dawn::TextureFormat kDepthStencilFormat = dawn::TextureFormat::Depth24PlusStencil8;
|
||||
dawn::Texture multisampledDepthStencilTexture = CreateTexture(
|
||||
device, dawn::TextureDimension::e2D, kDepthStencilFormat, kSize, kSize, kArrayLayers,
|
||||
kLevelCount, kSampleCount);
|
||||
|
||||
@@ -97,8 +97,8 @@ TEST_F(RenderPipelineValidationTest, SampleCount) {
|
||||
// in the render pass.
|
||||
TEST_F(RenderPipelineValidationTest, SampleCountCompatibilityWithRenderPass) {
|
||||
constexpr uint32_t kMultisampledCount = 4;
|
||||
constexpr dawn::TextureFormat kColorFormat = dawn::TextureFormat::R8G8B8A8Unorm;
|
||||
constexpr dawn::TextureFormat kDepthStencilFormat = dawn::TextureFormat::D32FloatS8Uint;
|
||||
constexpr dawn::TextureFormat kColorFormat = dawn::TextureFormat::RGBA8Unorm;
|
||||
constexpr dawn::TextureFormat kDepthStencilFormat = dawn::TextureFormat::Depth24PlusStencil8;
|
||||
|
||||
dawn::TextureDescriptor baseTextureDescriptor;
|
||||
baseTextureDescriptor.size.width = 4;
|
||||
|
||||
@@ -45,7 +45,7 @@ class TextureValidationTest : public ValidationTest {
|
||||
static constexpr uint32_t kDefaultMipLevels = 1;
|
||||
static constexpr uint32_t kDefaultSampleCount = 1;
|
||||
|
||||
static constexpr dawn::TextureFormat kDefaultTextureFormat = dawn::TextureFormat::R8G8B8A8Unorm;
|
||||
static constexpr dawn::TextureFormat kDefaultTextureFormat = dawn::TextureFormat::RGBA8Unorm;
|
||||
};
|
||||
|
||||
// Test the validation of sample count
|
||||
|
||||
@@ -23,7 +23,7 @@ constexpr uint32_t kWidth = 32u;
|
||||
constexpr uint32_t kHeight = 32u;
|
||||
constexpr uint32_t kDefaultMipLevels = 6u;
|
||||
|
||||
constexpr dawn::TextureFormat kDefaultTextureFormat = dawn::TextureFormat::R8G8B8A8Unorm;
|
||||
constexpr dawn::TextureFormat kDefaultTextureFormat = dawn::TextureFormat::RGBA8Unorm;
|
||||
|
||||
dawn::Texture Create2DArrayTexture(dawn::Device& device,
|
||||
uint32_t arrayLayerCount,
|
||||
@@ -213,7 +213,7 @@ TEST_F(TextureViewValidationTest, TextureViewFormatCompatibility) {
|
||||
// It is an error to create a texture view in depth-stencil format on a RGBA texture.
|
||||
{
|
||||
dawn::TextureViewDescriptor descriptor = base2DTextureViewDescriptor;
|
||||
descriptor.format = dawn::TextureFormat::D32FloatS8Uint;
|
||||
descriptor.format = dawn::TextureFormat::Depth24PlusStencil8;
|
||||
ASSERT_DEVICE_ERROR(texture.CreateView(&descriptor));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -77,8 +77,7 @@ void ValidationTest::OnDeviceError(const char* message, void* userdata) {
|
||||
}
|
||||
|
||||
ValidationTest::DummyRenderPass::DummyRenderPass(const dawn::Device& device)
|
||||
: attachmentFormat(dawn::TextureFormat::R8G8B8A8Unorm), width(400), height(400) {
|
||||
|
||||
: attachmentFormat(dawn::TextureFormat::RGBA8Unorm), width(400), height(400) {
|
||||
dawn::TextureDescriptor descriptor;
|
||||
descriptor.dimension = dawn::TextureDimension::e2D;
|
||||
descriptor.size.width = width;
|
||||
|
||||
@@ -37,7 +37,7 @@ class VertexInputTest : public ValidationTest {
|
||||
descriptor.cVertexStage.module = vsModule;
|
||||
descriptor.cFragmentStage.module = fsModule;
|
||||
descriptor.vertexInput = &state;
|
||||
descriptor.cColorStates[0]->format = dawn::TextureFormat::R8G8B8A8Unorm;
|
||||
descriptor.cColorStates[0]->format = dawn::TextureFormat::RGBA8Unorm;
|
||||
|
||||
if (!success) {
|
||||
ASSERT_DEVICE_ERROR(device.CreateRenderPipeline(&descriptor));
|
||||
|
||||
@@ -111,7 +111,7 @@ TEST_F(WireArgumentTests, CStringArgument) {
|
||||
blendDescriptor.dstFactor = DAWN_BLEND_FACTOR_ONE;
|
||||
DawnColorStateDescriptor colorStateDescriptor;
|
||||
colorStateDescriptor.nextInChain = nullptr;
|
||||
colorStateDescriptor.format = DAWN_TEXTURE_FORMAT_R8_G8_B8_A8_UNORM;
|
||||
colorStateDescriptor.format = DAWN_TEXTURE_FORMAT_RGBA8_UNORM;
|
||||
colorStateDescriptor.alphaBlend = blendDescriptor;
|
||||
colorStateDescriptor.colorBlend = blendDescriptor;
|
||||
colorStateDescriptor.writeMask = DAWN_COLOR_WRITE_MASK_ALL;
|
||||
@@ -141,7 +141,7 @@ TEST_F(WireArgumentTests, CStringArgument) {
|
||||
|
||||
DawnDepthStencilStateDescriptor depthStencilState;
|
||||
depthStencilState.nextInChain = nullptr;
|
||||
depthStencilState.format = DAWN_TEXTURE_FORMAT_D32_FLOAT_S8_UINT;
|
||||
depthStencilState.format = DAWN_TEXTURE_FORMAT_DEPTH24_PLUS_STENCIL8;
|
||||
depthStencilState.depthWriteEnabled = false;
|
||||
depthStencilState.depthCompare = DAWN_COMPARE_FUNCTION_ALWAYS;
|
||||
depthStencilState.stencilBack = stencilFace;
|
||||
|
||||
@@ -81,7 +81,7 @@ TEST_F(WireOptionalTests, OptionalStructPointer) {
|
||||
blendDescriptor.dstFactor = DAWN_BLEND_FACTOR_ONE;
|
||||
DawnColorStateDescriptor colorStateDescriptor;
|
||||
colorStateDescriptor.nextInChain = nullptr;
|
||||
colorStateDescriptor.format = DAWN_TEXTURE_FORMAT_R8_G8_B8_A8_UNORM;
|
||||
colorStateDescriptor.format = DAWN_TEXTURE_FORMAT_RGBA8_UNORM;
|
||||
colorStateDescriptor.alphaBlend = blendDescriptor;
|
||||
colorStateDescriptor.colorBlend = blendDescriptor;
|
||||
colorStateDescriptor.writeMask = DAWN_COLOR_WRITE_MASK_ALL;
|
||||
@@ -111,7 +111,7 @@ TEST_F(WireOptionalTests, OptionalStructPointer) {
|
||||
|
||||
DawnDepthStencilStateDescriptor depthStencilState;
|
||||
depthStencilState.nextInChain = nullptr;
|
||||
depthStencilState.format = DAWN_TEXTURE_FORMAT_D32_FLOAT_S8_UINT;
|
||||
depthStencilState.format = DAWN_TEXTURE_FORMAT_DEPTH24_PLUS_STENCIL8;
|
||||
depthStencilState.depthWriteEnabled = false;
|
||||
depthStencilState.depthCompare = DAWN_COMPARE_FUNCTION_ALWAYS;
|
||||
depthStencilState.stencilBack = stencilFace;
|
||||
|
||||
Reference in New Issue
Block a user