mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-18 01:15:39 +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
@@ -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));
|
||||
|
||||
Reference in New Issue
Block a user