Update deprecated TextureUsage flag names

Older names are kept around as an alias for a while. Unfortunately we
have no mechanism for producing deprecation error messages when they
are used.

Bug: dawn:1035
Change-Id: Ic6716fd526ecbedaa8e7925ab93e3ff32f642d97
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/61382
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Brandon Jones <bajones@chromium.org>
This commit is contained in:
Brandon Jones 2021-08-10 04:07:37 +00:00 committed by Dawn LUCI CQ
parent f99d5aa7d4
commit 27e17a6aad
59 changed files with 330 additions and 292 deletions

View File

@ -1995,10 +1995,13 @@
{"value": 0, "name": "none"},
{"value": 1, "name": "copy src"},
{"value": 2, "name": "copy dst"},
{"value": 4, "name": "sampled"},
{"value": 8, "name": "storage"},
{"value": 4, "name": "texture binding"},
{"value": 8, "name": "storage binding"},
{"value": 16, "name": "render attachment"},
{"value": 32, "name": "present"}
{"value": 32, "name": "present"},
{"value": 4, "name": "sampled", "deprecated": true},
{"value": 8, "name": "storage", "deprecated": true}
]
},
"texture view descriptor": {

View File

@ -60,7 +60,7 @@ void initTextures() {
descriptor.sampleCount = 1;
descriptor.format = wgpu::TextureFormat::RGBA8Unorm;
descriptor.mipLevelCount = 1;
descriptor.usage = wgpu::TextureUsage::CopyDst | wgpu::TextureUsage::Sampled;
descriptor.usage = wgpu::TextureUsage::CopyDst | wgpu::TextureUsage::TextureBinding;
texture = device.CreateTexture(&descriptor);
sampler = device.CreateSampler();

View File

@ -141,7 +141,7 @@ namespace dawn_native {
SampleTypeBit requiredType =
SampleTypeToSampleTypeBit(bindingInfo.texture.sampleType);
if (!(texture->GetUsage() & wgpu::TextureUsage::Sampled)) {
if (!(texture->GetUsage() & wgpu::TextureUsage::TextureBinding)) {
return DAWN_VALIDATION_ERROR("Texture binding usage mismatch");
}
@ -167,7 +167,7 @@ namespace dawn_native {
break;
}
case BindingInfoType::StorageTexture: {
if (!(texture->GetUsage() & wgpu::TextureUsage::Storage)) {
if (!(texture->GetUsage() & wgpu::TextureUsage::StorageBinding)) {
return DAWN_VALIDATION_ERROR("Storage Texture binding usage mismatch");
}
ASSERT(!texture->IsMultisampledTexture());

View File

@ -401,7 +401,7 @@ namespace dawn_native {
MaybeError ValidateCopyTextureForBrowserRestrictions(const ImageCopyTexture& src,
const ImageCopyTexture& dst,
const Extent3D& copySize) {
if (!(src.texture->GetUsage() & wgpu::TextureUsage::Sampled)) {
if (!(src.texture->GetUsage() & wgpu::TextureUsage::TextureBinding)) {
return DAWN_VALIDATION_ERROR("Source texture must have sampled usage");
}

View File

@ -289,7 +289,7 @@ namespace dawn_native {
DAWN_TRY(ValidateTextureCopyRange(device, *destination, *copySize));
DAWN_TRY(ValidateCanUseAs(source->texture, wgpu::TextureUsage::CopySrc));
DAWN_TRY(ValidateCanUseAs(source->texture, wgpu::TextureUsage::Sampled));
DAWN_TRY(ValidateCanUseAs(source->texture, wgpu::TextureUsage::TextureBinding));
DAWN_TRY(ValidateCanUseAs(destination->texture, wgpu::TextureUsage::CopyDst));
DAWN_TRY(ValidateCanUseAs(destination->texture, wgpu::TextureUsage::RenderAttachment));

View File

@ -29,11 +29,11 @@ namespace dawn_native {
"at least one of the passed texture views.");
}
if ((textureView->GetTexture()->GetUsage() & wgpu::TextureUsage::Sampled) !=
wgpu::TextureUsage::Sampled) {
if ((textureView->GetTexture()->GetUsage() & wgpu::TextureUsage::TextureBinding) !=
wgpu::TextureUsage::TextureBinding) {
return DAWN_VALIDATION_ERROR(
"The external texture descriptor specifies a texture that was not created with "
"TextureUsage::Sampled.");
"TextureUsage::TextureBinding.");
}
if (textureView->GetDimension() != wgpu::TextureViewDimension::e2D) {

View File

@ -108,7 +108,7 @@ namespace dawn_native {
case BindingInfoType::Texture: {
TextureViewBase* view = group->GetBindingAsTextureView(bindingIndex);
TextureViewUsedAs(view, wgpu::TextureUsage::Sampled);
TextureViewUsedAs(view, wgpu::TextureUsage::TextureBinding);
break;
}
@ -119,7 +119,7 @@ namespace dawn_native {
TextureViewUsedAs(view, kReadOnlyStorageTexture);
break;
case wgpu::StorageTextureAccess::WriteOnly:
TextureViewUsedAs(view, wgpu::TextureUsage::Storage);
TextureViewUsedAs(view, wgpu::TextureUsage::StorageBinding);
break;
case wgpu::StorageTextureAccess::Undefined:
UNREACHABLE();
@ -140,7 +140,7 @@ namespace dawn_native {
ASSERT(textureViews[2].Get() == nullptr);
mExternalTextureUsages.insert(externalTexture);
TextureViewUsedAs(textureViews[0].Get(), wgpu::TextureUsage::Sampled);
TextureViewUsedAs(textureViews[0].Get(), wgpu::TextureUsage::TextureBinding);
break;
}

View File

@ -135,7 +135,7 @@ namespace dawn_native {
// Compressed formats are not renderable. They cannot support multisample.
ASSERT(!format->isCompressed);
if (usage & wgpu::TextureUsage::Storage) {
if (usage & wgpu::TextureUsage::StorageBinding) {
return DAWN_VALIDATION_ERROR(
"The sample counts of the storage textures must be 1.");
}
@ -225,8 +225,8 @@ namespace dawn_native {
const Format* format) {
DAWN_TRY(dawn_native::ValidateTextureUsage(usage));
constexpr wgpu::TextureUsage kValidCompressedUsages = wgpu::TextureUsage::Sampled |
wgpu::TextureUsage::CopySrc |
constexpr wgpu::TextureUsage kValidCompressedUsages =
wgpu::TextureUsage::TextureBinding | wgpu::TextureUsage::CopySrc |
wgpu::TextureUsage::CopyDst;
if (format->isCompressed && !IsSubset(usage, kValidCompressedUsages)) {
return DAWN_VALIDATION_ERROR(
@ -238,11 +238,12 @@ namespace dawn_native {
"Non-renderable format used with RenderAttachment usage");
}
if (!format->supportsStorageUsage && (usage & wgpu::TextureUsage::Storage)) {
if (!format->supportsStorageUsage && (usage & wgpu::TextureUsage::StorageBinding)) {
return DAWN_VALIDATION_ERROR("Format cannot be used in storage textures");
}
constexpr wgpu::TextureUsage kValidMultiPlanarUsages = wgpu::TextureUsage::Sampled;
constexpr wgpu::TextureUsage kValidMultiPlanarUsages =
wgpu::TextureUsage::TextureBinding;
if (format->IsMultiPlanar() && !IsSubset(usage, kValidMultiPlanarUsages)) {
return DAWN_VALIDATION_ERROR("Multi-planar format doesn't have valid usage.");
}
@ -453,7 +454,7 @@ namespace dawn_native {
// Add readonly storage usage if the texture has a storage usage. The validation rules in
// ValidateSyncScopeResourceUsage will make sure we don't use both at the same time.
if (mInternalUsage & wgpu::TextureUsage::Storage) {
if (mInternalUsage & wgpu::TextureUsage::StorageBinding) {
mInternalUsage |= kReadOnlyStorageTexture;
}
}

View File

@ -40,7 +40,7 @@ namespace dawn_native {
bool IsValidSampleCount(uint32_t sampleCount);
static constexpr wgpu::TextureUsage kReadOnlyTextureUsages =
wgpu::TextureUsage::CopySrc | wgpu::TextureUsage::Sampled | kReadOnlyStorageTexture;
wgpu::TextureUsage::CopySrc | wgpu::TextureUsage::TextureBinding | kReadOnlyStorageTexture;
class TextureBase : public ObjectBase {
public:

View File

@ -306,7 +306,7 @@ namespace dawn_native { namespace d3d12 {
}
return (bufferUsages & wgpu::BufferUsage::Storage ||
textureUsages & wgpu::TextureUsage::Storage);
textureUsages & wgpu::TextureUsage::StorageBinding);
}
} // anonymous namespace

View File

@ -23,10 +23,10 @@ namespace dawn_native { namespace d3d12 {
namespace {
DXGI_USAGE D3D12SwapChainBufferUsage(WGPUTextureUsage allowedUsages) {
DXGI_USAGE usage = DXGI_CPU_ACCESS_NONE;
if (allowedUsages & WGPUTextureUsage_Sampled) {
if (allowedUsages & WGPUTextureUsage_TextureBinding) {
usage |= DXGI_USAGE_SHADER_INPUT;
}
if (allowedUsages & WGPUTextureUsage_Storage) {
if (allowedUsages & WGPUTextureUsage_StorageBinding) {
usage |= DXGI_USAGE_UNORDERED_ACCESS;
}
if (allowedUsages & WGPUTextureUsage_RenderAttachment) {

View File

@ -58,10 +58,10 @@ namespace dawn_native { namespace d3d12 {
DXGI_USAGE ToDXGIUsage(wgpu::TextureUsage usage) {
DXGI_USAGE dxgiUsage = DXGI_CPU_ACCESS_NONE;
if (usage & wgpu::TextureUsage::Sampled) {
if (usage & wgpu::TextureUsage::TextureBinding) {
dxgiUsage |= DXGI_USAGE_SHADER_INPUT;
}
if (usage & wgpu::TextureUsage::Storage) {
if (usage & wgpu::TextureUsage::StorageBinding) {
dxgiUsage |= DXGI_USAGE_UNORDERED_ACCESS;
}
if (usage & wgpu::TextureUsage::RenderAttachment) {

View File

@ -49,11 +49,11 @@ namespace dawn_native { namespace d3d12 {
if (usage & wgpu::TextureUsage::CopyDst) {
resourceState |= D3D12_RESOURCE_STATE_COPY_DEST;
}
if (usage & (wgpu::TextureUsage::Sampled | kReadOnlyStorageTexture)) {
if (usage & (wgpu::TextureUsage::TextureBinding | kReadOnlyStorageTexture)) {
resourceState |= (D3D12_RESOURCE_STATE_PIXEL_SHADER_RESOURCE |
D3D12_RESOURCE_STATE_NON_PIXEL_SHADER_RESOURCE);
}
if (usage & wgpu::TextureUsage::Storage) {
if (usage & wgpu::TextureUsage::StorageBinding) {
resourceState |= D3D12_RESOURCE_STATE_UNORDERED_ACCESS;
}
if (usage & wgpu::TextureUsage::RenderAttachment) {
@ -72,7 +72,7 @@ namespace dawn_native { namespace d3d12 {
bool isMultisampledTexture) {
D3D12_RESOURCE_FLAGS flags = D3D12_RESOURCE_FLAG_NONE;
if (usage & wgpu::TextureUsage::Storage) {
if (usage & wgpu::TextureUsage::StorageBinding) {
flags |= D3D12_RESOURCE_FLAG_ALLOW_UNORDERED_ACCESS;
}
@ -498,8 +498,9 @@ namespace dawn_native { namespace d3d12 {
// This will need to be much more nuanced when WebGPU has
// texture view compatibility rules.
const bool needsTypelessFormat = GetFormat().HasDepthOrStencil() &&
(GetInternalUsage() & wgpu::TextureUsage::Sampled) != 0;
const bool needsTypelessFormat =
GetFormat().HasDepthOrStencil() &&
(GetInternalUsage() & wgpu::TextureUsage::TextureBinding) != 0;
DXGI_FORMAT dxgiFormat = needsTypelessFormat
? D3D12TypelessTextureFormat(GetFormat().format)

View File

@ -30,7 +30,7 @@ namespace dawn_native { namespace metal {
namespace {
bool UsageNeedsTextureView(wgpu::TextureUsage usage) {
constexpr wgpu::TextureUsage kUsageNeedsTextureView =
wgpu::TextureUsage::Storage | wgpu::TextureUsage::Sampled;
wgpu::TextureUsage::StorageBinding | wgpu::TextureUsage::TextureBinding;
return usage & kUsageNeedsTextureView;
}
@ -39,11 +39,11 @@ namespace dawn_native { namespace metal {
uint32_t sampleCount) {
MTLTextureUsage result = MTLTextureUsageUnknown; // This is 0
if (usage & (wgpu::TextureUsage::Storage)) {
if (usage & (wgpu::TextureUsage::StorageBinding)) {
result |= MTLTextureUsageShaderWrite | MTLTextureUsageShaderRead;
}
if (usage & (wgpu::TextureUsage::Sampled)) {
if (usage & (wgpu::TextureUsage::TextureBinding)) {
result |= MTLTextureUsageShaderRead;
// For sampling stencil aspect of combined depth/stencil. See TextureView

View File

@ -182,7 +182,8 @@ namespace dawn_native { namespace opengl {
return DAWN_VALIDATION_ERROR("EGLImage texture must be 2D");
}
if (descriptor->usage & (wgpu::TextureUsage::Sampled | wgpu::TextureUsage::Storage)) {
if (descriptor->usage &
(wgpu::TextureUsage::TextureBinding | wgpu::TextureUsage::StorageBinding)) {
return DAWN_VALIDATION_ERROR("EGLImage texture cannot have sampled or storage usage");
}

View File

@ -81,7 +81,7 @@ namespace dawn_native { namespace opengl {
bool UsageNeedsTextureView(wgpu::TextureUsage usage) {
constexpr wgpu::TextureUsage kUsageNeedingTextureView =
wgpu::TextureUsage::Storage | wgpu::TextureUsage::Sampled;
wgpu::TextureUsage::StorageBinding | wgpu::TextureUsage::TextureBinding;
return usage & kUsageNeedingTextureView;
}
@ -100,7 +100,7 @@ namespace dawn_native { namespace opengl {
}
if (ToBackend(texture)->GetGLFormat().format == GL_DEPTH_STENCIL &&
(texture->GetUsage() & wgpu::TextureUsage::Sampled) != 0 &&
(texture->GetUsage() & wgpu::TextureUsage::TextureBinding) != 0 &&
textureViewDescriptor->aspect == wgpu::TextureAspect::StencilOnly) {
// We need a separate view for one of the depth or stencil planes
// because each glTextureView needs it's own handle to set

View File

@ -105,7 +105,7 @@ namespace dawn_native { namespace vulkan {
// The layout may be GENERAL here because of interactions between the Sampled
// and ReadOnlyStorage usages. See the logic in VulkanImageLayout.
writeImageInfo[numWrites].imageLayout = VulkanImageLayout(
ToBackend(view->GetTexture()), wgpu::TextureUsage::Sampled);
ToBackend(view->GetTexture()), wgpu::TextureUsage::TextureBinding);
write.pImageInfo = &writeImageInfo[numWrites];
break;
@ -143,7 +143,7 @@ namespace dawn_native { namespace vulkan {
writeImageInfo[numWrites].imageView = view->GetHandle();
writeImageInfo[numWrites].imageLayout = VulkanImageLayout(
ToBackend(view->GetTexture()), wgpu::TextureUsage::Sampled);
ToBackend(view->GetTexture()), wgpu::TextureUsage::TextureBinding);
write.pImageInfo = &writeImageInfo[numWrites];
break;

View File

@ -67,10 +67,10 @@ namespace dawn_native { namespace vulkan {
if (usage & wgpu::TextureUsage::CopyDst) {
flags |= VK_ACCESS_TRANSFER_WRITE_BIT;
}
if (usage & wgpu::TextureUsage::Sampled) {
if (usage & wgpu::TextureUsage::TextureBinding) {
flags |= VK_ACCESS_SHADER_READ_BIT;
}
if (usage & wgpu::TextureUsage::Storage) {
if (usage & wgpu::TextureUsage::StorageBinding) {
flags |= VK_ACCESS_SHADER_READ_BIT | VK_ACCESS_SHADER_WRITE_BIT;
}
if (usage & kReadOnlyStorageTexture) {
@ -119,7 +119,7 @@ namespace dawn_native { namespace vulkan {
if (usage & (wgpu::TextureUsage::CopySrc | wgpu::TextureUsage::CopyDst)) {
flags |= VK_PIPELINE_STAGE_TRANSFER_BIT;
}
if (usage & (wgpu::TextureUsage::Sampled | kReadOnlyStorageTexture)) {
if (usage & (wgpu::TextureUsage::TextureBinding | kReadOnlyStorageTexture)) {
// TODO(crbug.com/dawn/851): Only transition to the usage we care about to avoid
// introducing FS -> VS dependencies that would prevent parallelization on tiler
// GPUs
@ -127,7 +127,7 @@ namespace dawn_native { namespace vulkan {
VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT |
VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT;
}
if (usage & wgpu::TextureUsage::Storage) {
if (usage & wgpu::TextureUsage::StorageBinding) {
flags |=
VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT | VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT;
}
@ -355,10 +355,10 @@ namespace dawn_native { namespace vulkan {
if (usage & wgpu::TextureUsage::CopyDst) {
flags |= VK_IMAGE_USAGE_TRANSFER_DST_BIT;
}
if (usage & wgpu::TextureUsage::Sampled) {
if (usage & wgpu::TextureUsage::TextureBinding) {
flags |= VK_IMAGE_USAGE_SAMPLED_BIT;
}
if (usage & (wgpu::TextureUsage::Storage | kReadOnlyStorageTexture)) {
if (usage & (wgpu::TextureUsage::StorageBinding | kReadOnlyStorageTexture)) {
flags |= VK_IMAGE_USAGE_STORAGE_BIT;
}
if (usage & wgpu::TextureUsage::RenderAttachment) {
@ -383,7 +383,7 @@ namespace dawn_native { namespace vulkan {
if (!wgpu::HasZeroOrOneBits(usage)) {
// Sampled | ReadOnlyStorage is the only possible multi-bit usage, if more appear we
// might need additional special-casing.
ASSERT(usage == (wgpu::TextureUsage::Sampled | kReadOnlyStorageTexture));
ASSERT(usage == (wgpu::TextureUsage::TextureBinding | kReadOnlyStorageTexture));
return VK_IMAGE_LAYOUT_GENERAL;
}
@ -397,8 +397,8 @@ namespace dawn_native { namespace vulkan {
// the storage usage. We can't know at bindgroup creation time if that case will
// happen so we must prepare for the pessimistic case and always use the GENERAL
// layout.
case wgpu::TextureUsage::Sampled:
if (texture->GetInternalUsage() & wgpu::TextureUsage::Storage) {
case wgpu::TextureUsage::TextureBinding:
if (texture->GetInternalUsage() & wgpu::TextureUsage::StorageBinding) {
return VK_IMAGE_LAYOUT_GENERAL;
} else {
return VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL;
@ -415,7 +415,7 @@ namespace dawn_native { namespace vulkan {
// Read-only and write-only storage textures must use general layout because load
// and store operations on storage images can only be done on the images in
// VK_IMAGE_LAYOUT_GENERAL layout.
case wgpu::TextureUsage::Storage:
case wgpu::TextureUsage::StorageBinding:
case kReadOnlyStorageTexture:
return VK_IMAGE_LAYOUT_GENERAL;

View File

@ -1263,7 +1263,7 @@ std::ostringstream& DawnTestBase::ExpectAttachmentDepthStencilTestData(
wgpu::TextureDescriptor depthDataDesc = {};
depthDataDesc.size = {width, height, 1};
depthDataDesc.format = wgpu::TextureFormat::R32Float;
depthDataDesc.usage = wgpu::TextureUsage::Sampled | wgpu::TextureUsage::CopyDst;
depthDataDesc.usage = wgpu::TextureUsage::TextureBinding | wgpu::TextureUsage::CopyDst;
depthDataTexture = device.CreateTexture(&depthDataDesc);
// Upload the depth data.

View File

@ -289,7 +289,7 @@ TEST_P(BindGroupTests, UBOSamplerAndTexture) {
descriptor.sampleCount = 1;
descriptor.format = wgpu::TextureFormat::RGBA8Unorm;
descriptor.mipLevelCount = 1;
descriptor.usage = wgpu::TextureUsage::CopyDst | wgpu::TextureUsage::Sampled;
descriptor.usage = wgpu::TextureUsage::CopyDst | wgpu::TextureUsage::TextureBinding;
wgpu::Texture texture = device.CreateTexture(&descriptor);
wgpu::TextureView textureView = texture.CreateView();
@ -1258,7 +1258,7 @@ TEST_P(BindGroupTests, ReallyLargeBindGroup) {
"Please update this test");
for (uint32_t i = 0; i < kMaxSampledTexturesPerShaderStage; ++i) {
wgpu::Texture texture = CreateTextureWithRedData(
wgpu::TextureFormat::R8Unorm, expectedValue, wgpu::TextureUsage::Sampled);
wgpu::TextureFormat::R8Unorm, expectedValue, wgpu::TextureUsage::TextureBinding);
bgEntries.push_back({nullptr, binding, nullptr, 0, 0, nullptr, texture.CreateView()});
interface << "[[group(0), binding(" << binding++ << ")]] "
@ -1277,7 +1277,7 @@ TEST_P(BindGroupTests, ReallyLargeBindGroup) {
}
for (uint32_t i = 0; i < kMaxStorageTexturesPerShaderStage; ++i) {
wgpu::Texture texture = CreateTextureWithRedData(
wgpu::TextureFormat::R32Uint, expectedValue, wgpu::TextureUsage::Storage);
wgpu::TextureFormat::R32Uint, expectedValue, wgpu::TextureUsage::StorageBinding);
bgEntries.push_back({nullptr, binding, nullptr, 0, 0, nullptr, texture.CreateView()});
interface << "[[group(0), binding(" << binding++ << ")]] "
@ -1391,7 +1391,7 @@ TEST_P(BindGroupTests, CreateWithDestroyedResource) {
device, {{0, wgpu::ShaderStage::Fragment, wgpu::TextureSampleType::Float}});
wgpu::TextureDescriptor textureDesc;
textureDesc.usage = wgpu::TextureUsage::Sampled;
textureDesc.usage = wgpu::TextureUsage::TextureBinding;
textureDesc.size = {1, 1, 1};
textureDesc.format = wgpu::TextureFormat::BGRA8Unorm;
@ -1424,7 +1424,7 @@ TEST_P(BindGroupTests, CreateWithDestroyedResource) {
wgpu::TextureFormat::R32Uint}}));
wgpu::TextureDescriptor textureDesc;
textureDesc.usage = wgpu::TextureUsage::Storage;
textureDesc.usage = wgpu::TextureUsage::StorageBinding;
textureDesc.size = {1, 1, 1};
textureDesc.format = wgpu::TextureFormat::R32Uint;

View File

@ -91,7 +91,8 @@ class BufferZeroInitTest : public DawnTest {
descriptor.size = size;
descriptor.format = format;
descriptor.usage = wgpu::TextureUsage::CopyDst | wgpu::TextureUsage::CopySrc |
wgpu::TextureUsage::RenderAttachment | wgpu::TextureUsage::Storage;
wgpu::TextureUsage::RenderAttachment |
wgpu::TextureUsage::StorageBinding;
wgpu::Texture texture = device.CreateTexture(&descriptor);
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();

View File

@ -423,7 +423,7 @@ class CompressedTextureBCFormatTest : public DawnTest {
static constexpr uint32_t kBCBlockHeightInTexels = 4;
static constexpr wgpu::TextureUsage kDefaultBCFormatTextureUsage =
wgpu::TextureUsage::Sampled | wgpu::TextureUsage::CopyDst;
wgpu::TextureUsage::TextureBinding | wgpu::TextureUsage::CopyDst;
bool mIsBCFormatSupported = false;
};
@ -567,8 +567,8 @@ TEST_P(CompressedTextureBCFormatTest, CopyWholeTextureSubResourceIntoNonZeroMipm
config.textureDescriptor.format = format;
// Add the usage bit for both source and destination textures so that we don't need to
// create two copy configs.
config.textureDescriptor.usage =
wgpu::TextureUsage::CopySrc | wgpu::TextureUsage::CopyDst | wgpu::TextureUsage::Sampled;
config.textureDescriptor.usage = wgpu::TextureUsage::CopySrc | wgpu::TextureUsage::CopyDst |
wgpu::TextureUsage::TextureBinding;
wgpu::Texture bcTextureSrc = CreateTextureWithCompressedData(config);

View File

@ -301,8 +301,8 @@ class CopyTextureForBrowserTests : public DawnTest {
srcDescriptor.size = srcSpec.textureSize;
srcDescriptor.format = srcSpec.format;
srcDescriptor.mipLevelCount = srcSpec.level + 1;
srcDescriptor.usage =
wgpu::TextureUsage::CopySrc | wgpu::TextureUsage::CopyDst | wgpu::TextureUsage::Sampled;
srcDescriptor.usage = wgpu::TextureUsage::CopySrc | wgpu::TextureUsage::CopyDst |
wgpu::TextureUsage::TextureBinding;
wgpu::Texture srcTexture = device.CreateTexture(&srcDescriptor);
const utils::TextureDataCopyLayout srcCopyLayout =
@ -346,7 +346,7 @@ class CopyTextureForBrowserTests : public DawnTest {
dstDescriptor.size = dstSpec.textureSize;
dstDescriptor.format = dstSpec.format;
dstDescriptor.mipLevelCount = dstSpec.level + 1;
dstDescriptor.usage = wgpu::TextureUsage::CopyDst | wgpu::TextureUsage::Sampled |
dstDescriptor.usage = wgpu::TextureUsage::CopyDst | wgpu::TextureUsage::TextureBinding |
wgpu::TextureUsage::RenderAttachment | wgpu::TextureUsage::CopySrc;
dstTexture = device.CreateTexture(&dstDescriptor);

View File

@ -64,9 +64,9 @@ namespace {
baseDawnDescriptor.size = {kTestWidth, kTestHeight, 1};
baseDawnDescriptor.sampleCount = 1;
baseDawnDescriptor.mipLevelCount = 1;
baseDawnDescriptor.usage = wgpu::TextureUsage::Sampled | wgpu::TextureUsage::CopySrc |
wgpu::TextureUsage::RenderAttachment |
wgpu::TextureUsage::CopyDst;
baseDawnDescriptor.usage =
wgpu::TextureUsage::TextureBinding | wgpu::TextureUsage::CopySrc |
wgpu::TextureUsage::RenderAttachment | wgpu::TextureUsage::CopyDst;
baseD3dDescriptor.Width = kTestWidth;
baseD3dDescriptor.Height = kTestHeight;
@ -620,12 +620,12 @@ TEST_P(D3D12SharedHandleUsageTests, ExternalImageUsage) {
&externalImage);
ASSERT_NE(texture.Get(), nullptr);
externalAccessDesc.usage = WGPUTextureUsage_Storage;
externalAccessDesc.usage = WGPUTextureUsage_StorageBinding;
texture =
wgpu::Texture::Acquire(externalImage->ProduceTexture(device.Get(), &externalAccessDesc));
ASSERT_EQ(texture.Get(), nullptr);
externalAccessDesc.usage = WGPUTextureUsage_Sampled;
externalAccessDesc.usage = WGPUTextureUsage_TextureBinding;
texture =
wgpu::Texture::Acquire(externalImage->ProduceTexture(device.Get(), &externalAccessDesc));
ASSERT_NE(texture.Get(), nullptr);

View File

@ -287,7 +287,8 @@ namespace {
TEST_P(D3D12VideoViewsTests, NV12SampleYtoR) {
wgpu::Texture wgpuTexture;
CreateVideoTextureForTest(wgpu::TextureFormat::R8BG8Biplanar420Unorm,
wgpu::TextureUsage::Sampled, /*isCheckerboard*/ false, &wgpuTexture);
wgpu::TextureUsage::TextureBinding, /*isCheckerboard*/ false,
&wgpuTexture);
ASSERT_NE(wgpuTexture.Get(), nullptr);
wgpu::TextureViewDescriptor viewDesc;
@ -338,7 +339,8 @@ TEST_P(D3D12VideoViewsTests, NV12SampleYtoR) {
TEST_P(D3D12VideoViewsTests, NV12SampleUVtoRG) {
wgpu::Texture wgpuTexture;
CreateVideoTextureForTest(wgpu::TextureFormat::R8BG8Biplanar420Unorm,
wgpu::TextureUsage::Sampled, /*isCheckerboard*/ false, &wgpuTexture);
wgpu::TextureUsage::TextureBinding, /*isCheckerboard*/ false,
&wgpuTexture);
ASSERT_NE(wgpuTexture.Get(), nullptr);
wgpu::TextureViewDescriptor viewDesc;
@ -394,7 +396,8 @@ TEST_P(D3D12VideoViewsTests, NV12SampleYUVtoRGB) {
wgpu::Texture wgpuTexture;
CreateVideoTextureForTest(wgpu::TextureFormat::R8BG8Biplanar420Unorm,
wgpu::TextureUsage::Sampled, /*isCheckerboard*/ true, &wgpuTexture);
wgpu::TextureUsage::TextureBinding, /*isCheckerboard*/ true,
&wgpuTexture);
ASSERT_NE(wgpuTexture.Get(), nullptr);
wgpu::TextureViewDescriptor lumaViewDesc;

View File

@ -70,7 +70,7 @@ namespace {
descriptor.format = GetParam().mFormat;
descriptor.mipLevelCount = kMipLevelCount;
descriptor.usage = wgpu::TextureUsage::RenderAttachment | wgpu::TextureUsage::CopySrc |
wgpu::TextureUsage::Sampled;
wgpu::TextureUsage::TextureBinding;
texture = device.CreateTexture(&descriptor);

View File

@ -225,7 +225,8 @@ class DepthStencilSamplingTest : public DawnTest {
wgpu::Texture CreateInputTexture(wgpu::TextureFormat format) {
wgpu::TextureDescriptor inputTextureDesc;
inputTextureDesc.usage = wgpu::TextureUsage::Sampled | wgpu::TextureUsage::RenderAttachment;
inputTextureDesc.usage =
wgpu::TextureUsage::TextureBinding | wgpu::TextureUsage::RenderAttachment;
inputTextureDesc.size = {1, 1, 1};
inputTextureDesc.format = format;
return device.CreateTexture(&inputTextureDesc);

View File

@ -40,7 +40,7 @@ namespace {
static constexpr uint32_t kWidth = 4;
static constexpr uint32_t kHeight = 4;
static constexpr wgpu::TextureFormat kFormat = wgpu::TextureFormat::RGBA8Unorm;
static constexpr wgpu::TextureUsage kSampledUsage = wgpu::TextureUsage::Sampled;
static constexpr wgpu::TextureUsage kSampledUsage = wgpu::TextureUsage::TextureBinding;
};
} // anonymous namespace
@ -87,7 +87,7 @@ TEST_P(ExternalTextureTests, SampleExternalTexture) {
wgpu::Texture sampledTexture =
Create2DTexture(device, kWidth, kHeight, kFormat,
wgpu::TextureUsage::Sampled | wgpu::TextureUsage::RenderAttachment);
wgpu::TextureUsage::TextureBinding | wgpu::TextureUsage::RenderAttachment);
wgpu::Texture renderTexture =
Create2DTexture(device, kWidth, kHeight, kFormat,
wgpu::TextureUsage::CopySrc | wgpu::TextureUsage::RenderAttachment);

View File

@ -236,8 +236,8 @@ TEST_P(GpuMemorySyncTests, SampledAndROStorageTextureInComputePass) {
wgpu::TextureDescriptor texDesc;
texDesc.format = wgpu::TextureFormat::R32Uint;
texDesc.size = {1, 1, 1};
texDesc.usage =
wgpu::TextureUsage::Storage | wgpu::TextureUsage::Sampled | wgpu::TextureUsage::CopyDst;
texDesc.usage = wgpu::TextureUsage::StorageBinding | wgpu::TextureUsage::TextureBinding |
wgpu::TextureUsage::CopyDst;
wgpu::Texture tex = device.CreateTexture(&texDesc);
wgpu::ImageCopyTexture copyDst;

View File

@ -304,7 +304,7 @@ class IOSurfaceUsageTests : public IOSurfaceTestBase {
textureDescriptor.size = {1, 1, 1};
textureDescriptor.sampleCount = 1;
textureDescriptor.mipLevelCount = 1;
textureDescriptor.usage = wgpu::TextureUsage::Sampled;
textureDescriptor.usage = wgpu::TextureUsage::TextureBinding;
wgpu::Texture wrappingTexture = WrapIOSurface(&textureDescriptor, ioSurface, 0);
wgpu::TextureView textureView = wrappingTexture.CreateView();

View File

@ -133,7 +133,7 @@ TEST_P(MultisampledSamplingTest, SamplePositions) {
wgpu::Texture colorTexture;
{
wgpu::TextureDescriptor desc = {};
desc.usage = wgpu::TextureUsage::Sampled | wgpu::TextureUsage::RenderAttachment;
desc.usage = wgpu::TextureUsage::TextureBinding | wgpu::TextureUsage::RenderAttachment;
desc.size = kTextureSize;
desc.format = kColorFormat;
desc.sampleCount = kSampleCount;
@ -143,7 +143,7 @@ TEST_P(MultisampledSamplingTest, SamplePositions) {
wgpu::Texture depthTexture;
{
wgpu::TextureDescriptor desc = {};
desc.usage = wgpu::TextureUsage::Sampled | wgpu::TextureUsage::RenderAttachment;
desc.usage = wgpu::TextureUsage::TextureBinding | wgpu::TextureUsage::RenderAttachment;
desc.size = kTextureSize;
desc.format = kDepthFormat;
desc.sampleCount = kSampleCount;

View File

@ -398,8 +398,8 @@ DAWN_INSTANTIATE_TEST_P(
{wgpu::TextureFormat::Depth24PlusStencil8},
{wgpu::TextureAspect::DepthOnly, wgpu::TextureAspect::StencilOnly},
{wgpu::TextureUsage(wgpu::TextureUsage::RenderAttachment | wgpu::TextureUsage::CopySrc |
wgpu::TextureUsage::Sampled),
wgpu::TextureUsage(wgpu::TextureUsage::Sampled | wgpu::TextureUsage::CopySrc)},
wgpu::TextureUsage::TextureBinding),
wgpu::TextureUsage(wgpu::TextureUsage::TextureBinding | wgpu::TextureUsage::CopySrc)},
{wgpu::TextureDimension::e2D},
{1u, 7u}, // depth or array layers
{4u}, // mip count
@ -421,8 +421,8 @@ DAWN_INSTANTIATE_TEST_P(
{"lazy_clear_resource_on_first_use"})},
{wgpu::TextureFormat::R8Unorm, wgpu::TextureFormat::RG8Unorm, wgpu::TextureFormat::RGBA8Unorm},
{wgpu::TextureAspect::All},
{wgpu::TextureUsage(wgpu::TextureUsage::RenderAttachment | wgpu::TextureUsage::Sampled),
wgpu::TextureUsage::Sampled},
{wgpu::TextureUsage(wgpu::TextureUsage::RenderAttachment | wgpu::TextureUsage::TextureBinding),
wgpu::TextureUsage::TextureBinding},
{wgpu::TextureDimension::e2D},
{1u}, // depth or array layers
{1u}, // mip count

View File

@ -108,7 +108,7 @@ class SamplerFilterAnisotropicTest : public DawnTest {
descriptor.sampleCount = 1;
descriptor.format = wgpu::TextureFormat::RGBA8Unorm;
descriptor.mipLevelCount = mipLevelCount;
descriptor.usage = wgpu::TextureUsage::CopyDst | wgpu::TextureUsage::Sampled;
descriptor.usage = wgpu::TextureUsage::CopyDst | wgpu::TextureUsage::TextureBinding;
wgpu::Texture texture = device.CreateTexture(&descriptor);
const uint32_t rowPixels = kTextureBytesPerRowAlignment / sizeof(RGBA8);

View File

@ -92,7 +92,7 @@ class SamplerTest : public DawnTest {
descriptor.sampleCount = 1;
descriptor.format = wgpu::TextureFormat::RGBA8Unorm;
descriptor.mipLevelCount = 1;
descriptor.usage = wgpu::TextureUsage::CopyDst | wgpu::TextureUsage::Sampled;
descriptor.usage = wgpu::TextureUsage::CopyDst | wgpu::TextureUsage::TextureBinding;
wgpu::Texture texture = device.CreateTexture(&descriptor);
// Create a 2x2 checkerboard texture, with black in the top left and bottom right corners.

View File

@ -519,8 +519,8 @@ fn IsEqualTo(pixel : vec4<f32>, expected : vec4<f32>) -> bool {
utils::CreateBufferFromData(device, uploadBufferData.data(), uploadBufferSize,
wgpu::BufferUsage::CopySrc | wgpu::BufferUsage::CopyDst);
wgpu::Texture outputTexture =
CreateTexture(format, wgpu::TextureUsage::Storage | wgpu::TextureUsage::CopyDst, kWidth,
wgpu::Texture outputTexture = CreateTexture(
format, wgpu::TextureUsage::StorageBinding | wgpu::TextureUsage::CopyDst, kWidth,
kHeight, sliceCount, utils::ViewDimensionToTextureDimension(dimension));
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
@ -894,7 +894,7 @@ TEST_P(StorageTextureTests, WriteonlyStorageTextureInComputeShader) {
// Prepare the write-only storage texture.
wgpu::Texture writeonlyStorageTexture =
CreateTexture(format, wgpu::TextureUsage::Storage | wgpu::TextureUsage::CopySrc);
CreateTexture(format, wgpu::TextureUsage::StorageBinding | wgpu::TextureUsage::CopySrc);
// Write the expected pixel values into the write-only storage texture.
const std::string computeShader = CommonWriteOnlyTestCode("compute", format);
@ -932,7 +932,7 @@ TEST_P(StorageTextureTests, ReadWriteDifferentStorageTextureInOneDispatchInCompu
// Prepare the write-only storage texture.
wgpu::Texture writeonlyStorageTexture =
CreateTexture(format, wgpu::TextureUsage::Storage | wgpu::TextureUsage::CopySrc);
CreateTexture(format, wgpu::TextureUsage::StorageBinding | wgpu::TextureUsage::CopySrc);
// Write the expected pixel values into the write-only storage texture.
const std::string computeShader = CommonReadWriteTestCode(format);
@ -973,7 +973,7 @@ TEST_P(StorageTextureTests, WriteonlyStorageTextureInFragmentShader) {
// Prepare the write-only storage texture.
wgpu::Texture writeonlyStorageTexture =
CreateTexture(format, wgpu::TextureUsage::Storage | wgpu::TextureUsage::CopySrc);
CreateTexture(format, wgpu::TextureUsage::StorageBinding | wgpu::TextureUsage::CopySrc);
// Write the expected pixel values into the write-only storage texture.
const std::string fragmentShader = CommonWriteOnlyTestCode("fragment", format);
@ -1048,8 +1048,8 @@ TEST_P(StorageTextureTests, Writeonly2DArrayOr3DStorageTexture) {
// Prepare the write-only storage texture.
for (wgpu::TextureViewDimension dimension : dimensions) {
wgpu::Texture writeonlyStorageTexture = CreateTexture(
kTextureFormat, wgpu::TextureUsage::Storage | wgpu::TextureUsage::CopySrc, kWidth,
kHeight, kSliceCount, utils::ViewDimensionToTextureDimension(dimension));
kTextureFormat, wgpu::TextureUsage::StorageBinding | wgpu::TextureUsage::CopySrc,
kWidth, kHeight, kSliceCount, utils::ViewDimensionToTextureDimension(dimension));
// Write the expected pixel values into the write-only storage texture.
const std::string computeShader =
@ -1084,8 +1084,8 @@ TEST_P(StorageTextureTests, ReadWrite2DArrayOr3DStorageTexture) {
CreateTextureWithTestData(initialTextureData, kTextureFormat, dimension);
// Prepare the write-only storage texture.
wgpu::Texture writeonlyStorageTexture = CreateTexture(
kTextureFormat, wgpu::TextureUsage::Storage | wgpu::TextureUsage::CopySrc, kWidth,
kHeight, kSliceCount, utils::ViewDimensionToTextureDimension(dimension));
kTextureFormat, wgpu::TextureUsage::StorageBinding | wgpu::TextureUsage::CopySrc,
kWidth, kHeight, kSliceCount, utils::ViewDimensionToTextureDimension(dimension));
// Read values from read-only storage texture and write into the write-only storage texture.
const std::string computeShader = CommonReadWriteTestCode(kTextureFormat, dimension);
@ -1109,9 +1109,9 @@ TEST_P(StorageTextureTests, ReadonlyAndWriteonlyStorageTexturePingPong) {
constexpr wgpu::TextureFormat kTextureFormat = wgpu::TextureFormat::R32Uint;
wgpu::Texture storageTexture1 = CreateTexture(
kTextureFormat, wgpu::TextureUsage::Storage | wgpu::TextureUsage::CopySrc, 1u, 1u);
kTextureFormat, wgpu::TextureUsage::StorageBinding | wgpu::TextureUsage::CopySrc, 1u, 1u);
wgpu::Texture storageTexture2 = CreateTexture(
kTextureFormat, wgpu::TextureUsage::Storage | wgpu::TextureUsage::CopySrc, 1u, 1u);
kTextureFormat, wgpu::TextureUsage::StorageBinding | wgpu::TextureUsage::CopySrc, 1u, 1u);
wgpu::ShaderModule module = utils::CreateShaderModule(device, R"(
[[group(0), binding(0)]] var Src : texture_storage_2d<r32uint, read>;
@ -1183,12 +1183,14 @@ TEST_P(StorageTextureTests, ReadonlyAndWriteonlyStorageTexturePingPong) {
// a write-only storage texture are synchronized in one pass.
TEST_P(StorageTextureTests, SampledAndWriteonlyStorageTexturePingPong) {
constexpr wgpu::TextureFormat kTextureFormat = wgpu::TextureFormat::R32Uint;
wgpu::Texture storageTexture1 = CreateTexture(
kTextureFormat,
wgpu::TextureUsage::Sampled | wgpu::TextureUsage::Storage | wgpu::TextureUsage::CopySrc, 1u,
1u);
wgpu::Texture storageTexture1 =
CreateTexture(kTextureFormat,
wgpu::TextureUsage::TextureBinding | wgpu::TextureUsage::StorageBinding |
wgpu::TextureUsage::CopySrc,
1u, 1u);
wgpu::Texture storageTexture2 = CreateTexture(
kTextureFormat, wgpu::TextureUsage::Sampled | wgpu::TextureUsage::Storage, 1u, 1u);
kTextureFormat, wgpu::TextureUsage::TextureBinding | wgpu::TextureUsage::StorageBinding, 1u,
1u);
wgpu::ShaderModule module = utils::CreateShaderModule(device, R"(
[[group(0), binding(0)]] var Src : texture_2d<u32>;
[[group(0), binding(1)]] var Dst : texture_storage_2d<r32uint, write>;
@ -1307,7 +1309,7 @@ fn doTest() -> bool {
// texture in a render pass.
TEST_P(StorageTextureZeroInitTests, ReadonlyStorageTextureClearsToZeroInRenderPass) {
wgpu::Texture readonlyStorageTexture =
CreateTexture(wgpu::TextureFormat::R32Uint, wgpu::TextureUsage::Storage);
CreateTexture(wgpu::TextureFormat::R32Uint, wgpu::TextureUsage::StorageBinding);
// Create a rendering pipeline that reads the pixels from the read-only storage texture and uses
// green as the output color, otherwise uses red instead.
@ -1331,7 +1333,7 @@ TEST_P(StorageTextureZeroInitTests, ReadonlyStorageTextureClearsToZeroInRenderPa
// texture in a compute pass.
TEST_P(StorageTextureZeroInitTests, ReadonlyStorageTextureClearsToZeroInComputePass) {
wgpu::Texture readonlyStorageTexture =
CreateTexture(wgpu::TextureFormat::R32Uint, wgpu::TextureUsage::Storage);
CreateTexture(wgpu::TextureFormat::R32Uint, wgpu::TextureUsage::StorageBinding);
// Create a compute shader that reads the pixels from the read-only storage texture and writes 1
// to DstBuffer if they all have the expected value.
@ -1360,8 +1362,9 @@ TEST_P(StorageTextureZeroInitTests, ReadonlyStorageTextureClearsToZeroInComputeP
TEST_P(StorageTextureZeroInitTests, WriteonlyStorageTextureClearsToZeroInRenderPass) {
// Prepare the write-only storage texture.
constexpr uint32_t kTexelSizeR32Uint = 4u;
wgpu::Texture writeonlyStorageTexture = CreateTexture(
wgpu::TextureFormat::R32Uint, wgpu::TextureUsage::Storage | wgpu::TextureUsage::CopySrc);
wgpu::Texture writeonlyStorageTexture =
CreateTexture(wgpu::TextureFormat::R32Uint,
wgpu::TextureUsage::StorageBinding | wgpu::TextureUsage::CopySrc);
WriteIntoStorageTextureInRenderPass(writeonlyStorageTexture, kSimpleVertexShader,
kCommonWriteOnlyZeroInitTestCodeFragment);
@ -1373,8 +1376,9 @@ TEST_P(StorageTextureZeroInitTests, WriteonlyStorageTextureClearsToZeroInRenderP
TEST_P(StorageTextureZeroInitTests, WriteonlyStorageTextureClearsToZeroInComputePass) {
// Prepare the write-only storage texture.
constexpr uint32_t kTexelSizeR32Uint = 4u;
wgpu::Texture writeonlyStorageTexture = CreateTexture(
wgpu::TextureFormat::R32Uint, wgpu::TextureUsage::Storage | wgpu::TextureUsage::CopySrc);
wgpu::Texture writeonlyStorageTexture =
CreateTexture(wgpu::TextureFormat::R32Uint,
wgpu::TextureUsage::StorageBinding | wgpu::TextureUsage::CopySrc);
WriteIntoStorageTextureInComputePass(writeonlyStorageTexture,
kCommonWriteOnlyZeroInitTestCodeCompute);

View File

@ -152,7 +152,7 @@ TEST_P(SwapChainValidationTests, InvalidCreationSize) {
// Checks that the creation usage must be RenderAttachment
TEST_P(SwapChainValidationTests, InvalidCreationUsage) {
wgpu::SwapChainDescriptor desc = goodDescriptor;
desc.usage = wgpu::TextureUsage::Sampled;
desc.usage = wgpu::TextureUsage::TextureBinding;
ASSERT_DEVICE_ERROR(device.CreateSwapChain(surface, &desc));
}

View File

@ -67,7 +67,7 @@ TEST_P(Texture3DTests, Sampling) {
descriptor.dimension = wgpu::TextureDimension::e3D;
descriptor.size = copySize;
descriptor.format = kFormat;
descriptor.usage = wgpu::TextureUsage::CopyDst | wgpu::TextureUsage::Sampled;
descriptor.usage = wgpu::TextureUsage::CopyDst | wgpu::TextureUsage::TextureBinding;
wgpu::Texture texture = device.CreateTexture(&descriptor);
wgpu::TextureView textureView = texture.CreateView();

View File

@ -198,7 +198,7 @@ class TextureFormatTest : public DawnTest {
// Create the texture we will sample from
wgpu::TextureDescriptor sampleTextureDesc;
sampleTextureDesc.usage = wgpu::TextureUsage::CopyDst | wgpu::TextureUsage::Sampled;
sampleTextureDesc.usage = wgpu::TextureUsage::CopyDst | wgpu::TextureUsage::TextureBinding;
sampleTextureDesc.size = {width, 1, 1};
sampleTextureDesc.format = sampleFormatInfo.format;
wgpu::Texture sampleTexture = device.CreateTexture(&sampleTextureDesc);

View File

@ -144,7 +144,7 @@ TEST_P(TextureSubresourceTest, MipmapLevelsTest) {
// Create a texture with 2 mipmap levels and 1 layer
wgpu::Texture texture =
CreateTexture(2, 1,
wgpu::TextureUsage::Sampled | wgpu::TextureUsage::RenderAttachment |
wgpu::TextureUsage::TextureBinding | wgpu::TextureUsage::RenderAttachment |
wgpu::TextureUsage::CopySrc);
// Create two views on different mipmap levels.
@ -172,7 +172,7 @@ TEST_P(TextureSubresourceTest, ArrayLayersTest) {
// Create a texture with 1 mipmap level and 2 layers
wgpu::Texture texture =
CreateTexture(1, 2,
wgpu::TextureUsage::Sampled | wgpu::TextureUsage::RenderAttachment |
wgpu::TextureUsage::TextureBinding | wgpu::TextureUsage::RenderAttachment |
wgpu::TextureUsage::CopySrc);
// Create two views on different layers

View File

@ -125,7 +125,7 @@ class TextureViewSamplingTest : public DawnTest {
const uint32_t textureWidthLevel0 = 1 << mipLevelCount;
const uint32_t textureHeightLevel0 = 1 << mipLevelCount;
constexpr wgpu::TextureUsage kUsage =
wgpu::TextureUsage::CopyDst | wgpu::TextureUsage::Sampled;
wgpu::TextureUsage::CopyDst | wgpu::TextureUsage::TextureBinding;
mTexture = Create2DTexture(device, textureWidthLevel0, textureHeightLevel0, arrayLayerCount,
mipLevelCount, kUsage);
@ -684,7 +684,7 @@ TEST_P(TextureViewTest, OnlyCopySrcDst) {
TEST_P(TextureViewTest, DestroyedTexture) {
wgpu::TextureDescriptor descriptor;
descriptor.size = {4, 4, 2};
descriptor.usage = wgpu::TextureUsage::Sampled | wgpu::TextureUsage::CopyDst;
descriptor.usage = wgpu::TextureUsage::TextureBinding | wgpu::TextureUsage::CopyDst;
descriptor.format = wgpu::TextureFormat::RGBA8Unorm;
wgpu::Texture texture = device.CreateTexture(&descriptor);
@ -707,7 +707,8 @@ class TextureView3DTest : public DawnTest {};
// Test that 3D textures and 3D texture views can be created successfully
TEST_P(TextureView3DTest, BasicTest) {
wgpu::Texture texture = Create3DTexture(device, {4, 4, 4}, 3, wgpu::TextureUsage::Sampled);
wgpu::Texture texture =
Create3DTexture(device, {4, 4, 4}, 3, wgpu::TextureUsage::TextureBinding);
wgpu::TextureView view = texture.CreateView();
}

View File

@ -269,9 +269,10 @@ TEST_P(TextureZeroInitTest, RenderingArrayLayerClearsToZero) {
// This tests CopyBufferToTexture fully overwrites copy so lazy init is not needed.
TEST_P(TextureZeroInitTest, CopyBufferToTexture) {
wgpu::TextureDescriptor descriptor = CreateTextureDescriptor(
4, 1,
wgpu::TextureUsage::CopyDst | wgpu::TextureUsage::Sampled | wgpu::TextureUsage::CopySrc,
wgpu::TextureDescriptor descriptor =
CreateTextureDescriptor(4, 1,
wgpu::TextureUsage::CopyDst | wgpu::TextureUsage::TextureBinding |
wgpu::TextureUsage::CopySrc,
kColorFormat);
wgpu::Texture texture = device.CreateTexture(&descriptor);
@ -300,9 +301,10 @@ TEST_P(TextureZeroInitTest, CopyBufferToTexture) {
// Test for a copy only to a subset of the subresource, lazy init is necessary to clear the other
// half.
TEST_P(TextureZeroInitTest, CopyBufferToTextureHalf) {
wgpu::TextureDescriptor descriptor = CreateTextureDescriptor(
4, 1,
wgpu::TextureUsage::CopyDst | wgpu::TextureUsage::Sampled | wgpu::TextureUsage::CopySrc,
wgpu::TextureDescriptor descriptor =
CreateTextureDescriptor(4, 1,
wgpu::TextureUsage::CopyDst | wgpu::TextureUsage::TextureBinding |
wgpu::TextureUsage::CopySrc,
kColorFormat);
wgpu::Texture texture = device.CreateTexture(&descriptor);
@ -371,7 +373,7 @@ TEST_P(TextureZeroInitTest, CopyBufferToTextureMultipleArrayLayers) {
// This tests CopyTextureToTexture fully overwrites copy so lazy init is not needed.
TEST_P(TextureZeroInitTest, CopyTextureToTexture) {
wgpu::TextureDescriptor srcDescriptor = CreateTextureDescriptor(
1, 1, wgpu::TextureUsage::Sampled | wgpu::TextureUsage::CopySrc, kColorFormat);
1, 1, wgpu::TextureUsage::TextureBinding | wgpu::TextureUsage::CopySrc, kColorFormat);
wgpu::Texture srcTexture = device.CreateTexture(&srcDescriptor);
wgpu::ImageCopyTexture srcImageCopyTexture =
@ -407,9 +409,10 @@ TEST_P(TextureZeroInitTest, CopyTextureToTexture) {
// This Tests the CopyTextureToTexture's copy only to a subset of the subresource, lazy init is
// necessary to clear the other half.
TEST_P(TextureZeroInitTest, CopyTextureToTextureHalf) {
wgpu::TextureDescriptor srcDescriptor = CreateTextureDescriptor(
1, 1,
wgpu::TextureUsage::Sampled | wgpu::TextureUsage::CopySrc | wgpu::TextureUsage::CopyDst,
wgpu::TextureDescriptor srcDescriptor =
CreateTextureDescriptor(1, 1,
wgpu::TextureUsage::TextureBinding | wgpu::TextureUsage::CopySrc |
wgpu::TextureUsage::CopyDst,
kColorFormat);
wgpu::Texture srcTexture = device.CreateTexture(&srcDescriptor);
@ -850,7 +853,7 @@ TEST_P(TextureZeroInitTest, ColorAttachmentsClear) {
TEST_P(TextureZeroInitTest, RenderPassSampledTextureClear) {
// Create needed resources
wgpu::TextureDescriptor descriptor =
CreateTextureDescriptor(1, 1, wgpu::TextureUsage::Sampled, kColorFormat);
CreateTextureDescriptor(1, 1, wgpu::TextureUsage::TextureBinding, kColorFormat);
wgpu::Texture texture = device.CreateTexture(&descriptor);
wgpu::TextureDescriptor renderTextureDescriptor = CreateTextureDescriptor(
@ -900,7 +903,7 @@ TEST_P(TextureZeroInitTest, TextureBothSampledAndAttachmentClear) {
// Create a 2D array texture, layer 0 will be used as attachment, layer 1 as sampled.
wgpu::TextureDescriptor texDesc;
texDesc.usage = wgpu::TextureUsage::Sampled | wgpu::TextureUsage::RenderAttachment |
texDesc.usage = wgpu::TextureUsage::TextureBinding | wgpu::TextureUsage::RenderAttachment |
wgpu::TextureUsage::CopySrc;
texDesc.size = {1, 1, 2};
texDesc.format = wgpu::TextureFormat::RGBA8Unorm;
@ -954,7 +957,7 @@ TEST_P(TextureZeroInitTest, TextureBothSampledAndAttachmentClear) {
TEST_P(TextureZeroInitTest, ComputePassSampledTextureClear) {
// Create needed resources
wgpu::TextureDescriptor descriptor =
CreateTextureDescriptor(1, 1, wgpu::TextureUsage::Sampled, kColorFormat);
CreateTextureDescriptor(1, 1, wgpu::TextureUsage::TextureBinding, kColorFormat);
descriptor.size.width = 1;
descriptor.size.height = 1;
wgpu::Texture texture = device.CreateTexture(&descriptor);
@ -1121,7 +1124,7 @@ TEST_P(TextureZeroInitTest, NonRenderableTextureClearWithMultiArrayLayers) {
TEST_P(TextureZeroInitTest, RenderPassStoreOpClear) {
// Create needed resources
wgpu::TextureDescriptor descriptor = CreateTextureDescriptor(
1, 1, wgpu::TextureUsage::Sampled | wgpu::TextureUsage::CopyDst, kColorFormat);
1, 1, wgpu::TextureUsage::TextureBinding | wgpu::TextureUsage::CopyDst, kColorFormat);
wgpu::Texture texture = device.CreateTexture(&descriptor);
wgpu::TextureDescriptor renderTextureDescriptor = CreateTextureDescriptor(
@ -1262,9 +1265,10 @@ TEST_P(TextureZeroInitTest, RenderingLoadingDepthStencilStoreOpClear) {
// Test that if one mip of a texture is initialized and another is uninitialized, lazy clearing the
// uninitialized mip does not clear the initialized mip.
TEST_P(TextureZeroInitTest, PreservesInitializedMip) {
wgpu::TextureDescriptor sampleTextureDescriptor = CreateTextureDescriptor(
2, 1,
wgpu::TextureUsage::CopySrc | wgpu::TextureUsage::CopyDst | wgpu::TextureUsage::Sampled,
wgpu::TextureDescriptor sampleTextureDescriptor =
CreateTextureDescriptor(2, 1,
wgpu::TextureUsage::CopySrc | wgpu::TextureUsage::CopyDst |
wgpu::TextureUsage::TextureBinding,
kColorFormat);
wgpu::Texture sampleTexture = device.CreateTexture(&sampleTextureDescriptor);
@ -1340,9 +1344,10 @@ TEST_P(TextureZeroInitTest, PreservesInitializedArrayLayer) {
// TODO(crbug.com/dawn/593): This test uses glTextureView() which is not supported on OpenGL ES.
DAWN_TEST_UNSUPPORTED_IF(IsOpenGLES());
wgpu::TextureDescriptor sampleTextureDescriptor = CreateTextureDescriptor(
1, 2,
wgpu::TextureUsage::CopySrc | wgpu::TextureUsage::CopyDst | wgpu::TextureUsage::Sampled,
wgpu::TextureDescriptor sampleTextureDescriptor =
CreateTextureDescriptor(1, 2,
wgpu::TextureUsage::CopySrc | wgpu::TextureUsage::CopyDst |
wgpu::TextureUsage::TextureBinding,
kColorFormat);
wgpu::Texture sampleTexture = device.CreateTexture(&sampleTextureDescriptor);
@ -1493,9 +1498,10 @@ TEST_P(TextureZeroInitTest, WriteWholeTexture) {
// Test WriteTexture to a subset of the texture, lazy init is necessary to clear the other
// half.
TEST_P(TextureZeroInitTest, WriteTextureHalf) {
wgpu::TextureDescriptor descriptor = CreateTextureDescriptor(
4, 1,
wgpu::TextureUsage::CopyDst | wgpu::TextureUsage::Sampled | wgpu::TextureUsage::CopySrc,
wgpu::TextureDescriptor descriptor =
CreateTextureDescriptor(4, 1,
wgpu::TextureUsage::CopyDst | wgpu::TextureUsage::TextureBinding |
wgpu::TextureUsage::CopySrc,
kColorFormat);
wgpu::Texture texture = device.CreateTexture(&descriptor);
@ -1570,9 +1576,10 @@ TEST_P(TextureZeroInitTest, WriteWholeTextureArray) {
// Test WriteTexture to a subset of the subresource, lazy init is necessary to clear the other
// half.
TEST_P(TextureZeroInitTest, WriteTextureArrayHalf) {
wgpu::TextureDescriptor descriptor = CreateTextureDescriptor(
4, 6,
wgpu::TextureUsage::CopyDst | wgpu::TextureUsage::Sampled | wgpu::TextureUsage::CopySrc,
wgpu::TextureDescriptor descriptor =
CreateTextureDescriptor(4, 6,
wgpu::TextureUsage::CopyDst | wgpu::TextureUsage::TextureBinding |
wgpu::TextureUsage::CopySrc,
kColorFormat);
wgpu::Texture texture = device.CreateTexture(&descriptor);
@ -1649,9 +1656,10 @@ TEST_P(TextureZeroInitTest, WriteWholeTextureAtMipLevel) {
// Test WriteTexture to a subset of the texture at mip level, lazy init is necessary to clear the
// other half.
TEST_P(TextureZeroInitTest, WriteTextureHalfAtMipLevel) {
wgpu::TextureDescriptor descriptor = CreateTextureDescriptor(
4, 1,
wgpu::TextureUsage::CopyDst | wgpu::TextureUsage::Sampled | wgpu::TextureUsage::CopySrc,
wgpu::TextureDescriptor descriptor =
CreateTextureDescriptor(4, 1,
wgpu::TextureUsage::CopyDst | wgpu::TextureUsage::TextureBinding |
wgpu::TextureUsage::CopySrc,
kColorFormat);
wgpu::Texture texture = device.CreateTexture(&descriptor);
@ -1834,8 +1842,8 @@ class CompressedTextureZeroInitTest : public TextureZeroInitTest {
// than the virtual mip size)
TEST_P(CompressedTextureZeroInitTest, FullMipCopy) {
wgpu::TextureDescriptor textureDescriptor;
textureDescriptor.usage =
wgpu::TextureUsage::CopySrc | wgpu::TextureUsage::CopyDst | wgpu::TextureUsage::Sampled;
textureDescriptor.usage = wgpu::TextureUsage::CopySrc | wgpu::TextureUsage::CopyDst |
wgpu::TextureUsage::TextureBinding;
textureDescriptor.size = {60, 60, 1};
textureDescriptor.mipLevelCount = 1;
textureDescriptor.format = utils::kBCFormats[0];
@ -1850,8 +1858,8 @@ TEST_P(CompressedTextureZeroInitTest, HalfCopyBufferToTexture) {
DAWN_SUPPRESS_TEST_IF(IsOpenGL() || IsOpenGLES());
wgpu::TextureDescriptor textureDescriptor;
textureDescriptor.usage =
wgpu::TextureUsage::CopySrc | wgpu::TextureUsage::CopyDst | wgpu::TextureUsage::Sampled;
textureDescriptor.usage = wgpu::TextureUsage::CopySrc | wgpu::TextureUsage::CopyDst |
wgpu::TextureUsage::TextureBinding;
constexpr static uint32_t kSize = 16;
textureDescriptor.size = {kSize, kSize, 1};
textureDescriptor.mipLevelCount = 1;
@ -1870,8 +1878,8 @@ TEST_P(CompressedTextureZeroInitTest, FullCopyToNonZeroMipLevel) {
DAWN_TEST_UNSUPPORTED_IF(IsOpenGLES());
wgpu::TextureDescriptor textureDescriptor;
textureDescriptor.usage =
wgpu::TextureUsage::CopySrc | wgpu::TextureUsage::CopyDst | wgpu::TextureUsage::Sampled;
textureDescriptor.usage = wgpu::TextureUsage::CopySrc | wgpu::TextureUsage::CopyDst |
wgpu::TextureUsage::TextureBinding;
constexpr static uint32_t kSize = 60;
textureDescriptor.size = {kSize, kSize, 1};
textureDescriptor.mipLevelCount = 3;
@ -1895,8 +1903,8 @@ TEST_P(CompressedTextureZeroInitTest, HalfCopyToNonZeroMipLevel) {
DAWN_SUPPRESS_TEST_IF(IsOpenGL() || IsOpenGLES());
wgpu::TextureDescriptor textureDescriptor;
textureDescriptor.usage =
wgpu::TextureUsage::CopySrc | wgpu::TextureUsage::CopyDst | wgpu::TextureUsage::Sampled;
textureDescriptor.usage = wgpu::TextureUsage::CopySrc | wgpu::TextureUsage::CopyDst |
wgpu::TextureUsage::TextureBinding;
constexpr static uint32_t kSize = 60;
textureDescriptor.size = {kSize, kSize, 1};
textureDescriptor.mipLevelCount = 3;
@ -1919,8 +1927,8 @@ TEST_P(CompressedTextureZeroInitTest, FullCopyToNonZeroArrayLayer) {
DAWN_TEST_UNSUPPORTED_IF(IsOpenGLES());
wgpu::TextureDescriptor textureDescriptor;
textureDescriptor.usage =
wgpu::TextureUsage::CopySrc | wgpu::TextureUsage::CopyDst | wgpu::TextureUsage::Sampled;
textureDescriptor.usage = wgpu::TextureUsage::CopySrc | wgpu::TextureUsage::CopyDst |
wgpu::TextureUsage::TextureBinding;
constexpr static uint32_t kSize = 16;
constexpr static uint32_t kArrayLayers = 4;
textureDescriptor.size = {kSize, kSize, kArrayLayers};
@ -1939,8 +1947,8 @@ TEST_P(CompressedTextureZeroInitTest, HalfCopyToNonZeroArrayLayer) {
DAWN_SUPPRESS_TEST_IF(IsOpenGL() || IsOpenGLES());
wgpu::TextureDescriptor textureDescriptor;
textureDescriptor.usage =
wgpu::TextureUsage::CopySrc | wgpu::TextureUsage::CopyDst | wgpu::TextureUsage::Sampled;
textureDescriptor.usage = wgpu::TextureUsage::CopySrc | wgpu::TextureUsage::CopyDst |
wgpu::TextureUsage::TextureBinding;
constexpr static uint32_t kSize = 16;
constexpr static uint32_t kArrayLayers = 4;
textureDescriptor.size = {kSize, kSize, kArrayLayers};
@ -1959,9 +1967,10 @@ TEST_P(CompressedTextureZeroInitTest, FullCopyTextureToTextureMipLevel) {
DAWN_TEST_UNSUPPORTED_IF(IsOpenGLES());
// create srcTexture and fill it with data
wgpu::TextureDescriptor srcDescriptor = CreateTextureDescriptor(
3, 1,
wgpu::TextureUsage::Sampled | wgpu::TextureUsage::CopySrc | wgpu::TextureUsage::CopyDst,
wgpu::TextureDescriptor srcDescriptor =
CreateTextureDescriptor(3, 1,
wgpu::TextureUsage::TextureBinding | wgpu::TextureUsage::CopySrc |
wgpu::TextureUsage::CopyDst,
utils::kBCFormats[0]);
wgpu::Texture srcTexture = device.CreateTexture(&srcDescriptor);
@ -1980,9 +1989,10 @@ TEST_P(CompressedTextureZeroInitTest, FullCopyTextureToTextureMipLevel) {
utils::CreateImageCopyTexture(srcTexture, kViewMipLevel, {0, 0, 0});
// create dstTexture that we will copy to
wgpu::TextureDescriptor dstDescriptor = CreateTextureDescriptor(
3, 1,
wgpu::TextureUsage::CopyDst | wgpu::TextureUsage::CopySrc | wgpu::TextureUsage::Sampled,
wgpu::TextureDescriptor dstDescriptor =
CreateTextureDescriptor(3, 1,
wgpu::TextureUsage::CopyDst | wgpu::TextureUsage::CopySrc |
wgpu::TextureUsage::TextureBinding,
utils::kBCFormats[0]);
wgpu::Texture dstTexture = device.CreateTexture(&dstDescriptor);
@ -2006,9 +2016,10 @@ TEST_P(CompressedTextureZeroInitTest, HalfCopyTextureToTextureMipLevel) {
DAWN_SUPPRESS_TEST_IF(IsOpenGL() || IsOpenGLES());
// create srcTexture with data
wgpu::TextureDescriptor srcDescriptor = CreateTextureDescriptor(
3, 1,
wgpu::TextureUsage::Sampled | wgpu::TextureUsage::CopySrc | wgpu::TextureUsage::CopyDst,
wgpu::TextureDescriptor srcDescriptor =
CreateTextureDescriptor(3, 1,
wgpu::TextureUsage::TextureBinding | wgpu::TextureUsage::CopySrc |
wgpu::TextureUsage::CopyDst,
utils::kBCFormats[0]);
wgpu::Texture srcTexture = device.CreateTexture(&srcDescriptor);
@ -2027,9 +2038,10 @@ TEST_P(CompressedTextureZeroInitTest, HalfCopyTextureToTextureMipLevel) {
utils::CreateImageCopyTexture(srcTexture, kViewMipLevel, {0, 0, 0});
// create dstTexture that we will copy to
wgpu::TextureDescriptor dstDescriptor = CreateTextureDescriptor(
3, 1,
wgpu::TextureUsage::CopyDst | wgpu::TextureUsage::CopySrc | wgpu::TextureUsage::Sampled,
wgpu::TextureDescriptor dstDescriptor =
CreateTextureDescriptor(3, 1,
wgpu::TextureUsage::CopyDst | wgpu::TextureUsage::CopySrc |
wgpu::TextureUsage::TextureBinding,
utils::kBCFormats[0]);
wgpu::Texture dstTexture = device.CreateTexture(&dstDescriptor);

View File

@ -57,8 +57,8 @@ class SubresourceTrackingPerf : public DawnPerfTestWithParams<SubresourceTrackin
materialDesc.size = {1u << (params.mipLevelCount - 1), 1u << (params.mipLevelCount - 1),
params.arrayLayerCount};
materialDesc.mipLevelCount = params.mipLevelCount;
materialDesc.usage = wgpu::TextureUsage::Sampled | wgpu::TextureUsage::RenderAttachment |
wgpu::TextureUsage::CopyDst;
materialDesc.usage = wgpu::TextureUsage::TextureBinding |
wgpu::TextureUsage::RenderAttachment | wgpu::TextureUsage::CopyDst;
materialDesc.format = wgpu::TextureFormat::RGBA8Unorm;
mMaterials = device.CreateTexture(&materialDesc);

View File

@ -53,7 +53,8 @@ class BindGroupValidationTest : public ValidationTest {
}
{ mSampler = device.CreateSampler(); }
{
mSampledTexture = CreateTexture(wgpu::TextureUsage::Sampled, kDefaultTextureFormat, 1);
mSampledTexture =
CreateTexture(wgpu::TextureUsage::TextureBinding, kDefaultTextureFormat, 1);
mSampledTextureView = mSampledTexture.CreateView();
wgpu::ExternalTextureDescriptor externalTextureDesc;
@ -306,7 +307,8 @@ TEST_F(BindGroupValidationTest, BufferBindingType) {
// Check that an external texture binding must contain exactly an external texture
TEST_F(BindGroupValidationTest, ExternalTextureBindingType) {
// Create an external texture
wgpu::Texture texture = CreateTexture(wgpu::TextureUsage::Sampled, kDefaultTextureFormat, 1);
wgpu::Texture texture =
CreateTexture(wgpu::TextureUsage::TextureBinding, kDefaultTextureFormat, 1);
wgpu::ExternalTextureDescriptor externalDesc;
externalDesc.plane0 = texture.CreateView();
externalDesc.format = kDefaultTextureFormat;
@ -414,7 +416,7 @@ TEST_F(BindGroupValidationTest, StorageTextureUsage) {
descriptor.size = {16, 16, 1};
descriptor.sampleCount = 1;
descriptor.mipLevelCount = 1;
descriptor.usage = wgpu::TextureUsage::Storage;
descriptor.usage = wgpu::TextureUsage::StorageBinding;
descriptor.format = wgpu::TextureFormat::RGBA8Uint;
wgpu::TextureView view = device.CreateTexture(&descriptor).CreateView();
@ -423,7 +425,7 @@ TEST_F(BindGroupValidationTest, StorageTextureUsage) {
utils::MakeBindGroup(device, layout, {{0, view}});
// Sampled texture is invalid with storage buffer binding
descriptor.usage = wgpu::TextureUsage::Sampled;
descriptor.usage = wgpu::TextureUsage::TextureBinding;
descriptor.format = wgpu::TextureFormat::RGBA8Unorm;
view = device.CreateTexture(&descriptor).CreateView();
ASSERT_DEVICE_ERROR(utils::MakeBindGroup(device, layout, {{0, view}}));
@ -444,7 +446,7 @@ TEST_F(BindGroupValidationTest, TextureSampleType) {
wgpu::TextureDescriptor descriptor;
descriptor.size = {4, 4, 1};
descriptor.usage = wgpu::TextureUsage::Sampled;
descriptor.usage = wgpu::TextureUsage::TextureBinding;
descriptor.format = format;
wgpu::TextureView view = device.CreateTexture(&descriptor).CreateView();
@ -502,7 +504,7 @@ TEST_F(BindGroupValidationTest, SamplingDepthStencilTexture) {
wgpu::TextureDescriptor desc;
desc.size = {1, 1, 1};
desc.usage = wgpu::TextureUsage::Sampled;
desc.usage = wgpu::TextureUsage::TextureBinding;
// Depth32Float is allowed to be sampled.
{
@ -547,7 +549,7 @@ TEST_F(BindGroupValidationTest, TextureDimension) {
// Make a 2DArray texture and try to set it to a 2D binding.
wgpu::Texture arrayTexture =
CreateTexture(wgpu::TextureUsage::Sampled, wgpu::TextureFormat::RGBA8Uint, 2);
CreateTexture(wgpu::TextureUsage::TextureBinding, wgpu::TextureFormat::RGBA8Uint, 2);
wgpu::TextureView arrayTextureView = arrayTexture.CreateView();
ASSERT_DEVICE_ERROR(utils::MakeBindGroup(device, layout, {{0, arrayTextureView}}));
@ -649,7 +651,7 @@ TEST_F(BindGroupValidationTest, MultisampledTexture) {
// Control case: setting a multisampled 2D texture works
wgpu::TextureDescriptor textureDesc;
textureDesc.sampleCount = 4;
textureDesc.usage = wgpu::TextureUsage::Sampled;
textureDesc.usage = wgpu::TextureUsage::TextureBinding;
textureDesc.dimension = wgpu::TextureDimension::e2D;
textureDesc.format = wgpu::TextureFormat::RGBA8Unorm;
textureDesc.size = {1, 1, 1};

View File

@ -548,8 +548,8 @@ TEST_F(CopyCommandTest_B2T, IncorrectUsage) {
wgpu::Buffer vertex = CreateBuffer(16 * 4, wgpu::BufferUsage::Vertex);
wgpu::Texture destination =
Create2DTexture(16, 16, 5, 1, wgpu::TextureFormat::RGBA8Unorm, wgpu::TextureUsage::CopyDst);
wgpu::Texture sampled =
Create2DTexture(16, 16, 5, 1, wgpu::TextureFormat::RGBA8Unorm, wgpu::TextureUsage::Sampled);
wgpu::Texture sampled = Create2DTexture(16, 16, 5, 1, wgpu::TextureFormat::RGBA8Unorm,
wgpu::TextureUsage::TextureBinding);
// Incorrect source usage
TestB2TCopy(utils::Expectation::Failure, vertex, 0, 256, 4, destination, 0, {0, 0, 0},
@ -1161,8 +1161,8 @@ TEST_F(CopyCommandTest_T2B, IncorrectUsage) {
uint64_t bufferSize = BufferSizeForTextureCopy(4, 4, 1);
wgpu::Texture source =
Create2DTexture(16, 16, 5, 1, wgpu::TextureFormat::RGBA8Unorm, wgpu::TextureUsage::CopySrc);
wgpu::Texture sampled =
Create2DTexture(16, 16, 5, 1, wgpu::TextureFormat::RGBA8Unorm, wgpu::TextureUsage::Sampled);
wgpu::Texture sampled = Create2DTexture(16, 16, 5, 1, wgpu::TextureFormat::RGBA8Unorm,
wgpu::TextureUsage::TextureBinding);
wgpu::Buffer destination = CreateBuffer(bufferSize, wgpu::BufferUsage::CopyDst);
wgpu::Buffer vertex = CreateBuffer(bufferSize, wgpu::BufferUsage::Vertex);
@ -2028,8 +2028,9 @@ class CopyCommandTest_CompressedTextureFormats : public CopyCommandTest {
uint32_t mipmapLevels = 1,
uint32_t width = kWidth,
uint32_t height = kHeight) {
constexpr wgpu::TextureUsage kUsage =
wgpu::TextureUsage::CopyDst | wgpu::TextureUsage::CopySrc | wgpu::TextureUsage::Sampled;
constexpr wgpu::TextureUsage kUsage = wgpu::TextureUsage::CopyDst |
wgpu::TextureUsage::CopySrc |
wgpu::TextureUsage::TextureBinding;
constexpr uint32_t kArrayLayers = 1;
return CopyCommandTest::Create2DTexture(width, height, mipmapLevels, kArrayLayers, format,
kUsage, 1);

View File

@ -71,7 +71,7 @@ class CopyTextureForBrowserTest : public ValidationTest {
TEST_F(CopyTextureForBrowserTest, Success) {
wgpu::Texture source =
Create2DTexture(16, 16, 5, 4, wgpu::TextureFormat::RGBA8Unorm,
wgpu::TextureUsage::CopySrc | wgpu::TextureUsage::Sampled);
wgpu::TextureUsage::CopySrc | wgpu::TextureUsage::TextureBinding);
wgpu::Texture destination =
Create2DTexture(16, 16, 5, 4, wgpu::TextureFormat::RGBA8Unorm,
wgpu::TextureUsage::CopyDst | wgpu::TextureUsage::RenderAttachment);
@ -127,7 +127,7 @@ TEST_F(CopyTextureForBrowserTest, Success) {
TEST_F(CopyTextureForBrowserTest, IncorrectUsage) {
wgpu::Texture validSource =
Create2DTexture(16, 16, 5, 1, wgpu::TextureFormat::RGBA8Unorm,
wgpu::TextureUsage::CopySrc | wgpu::TextureUsage::Sampled);
wgpu::TextureUsage::CopySrc | wgpu::TextureUsage::TextureBinding);
wgpu::Texture validDestination =
Create2DTexture(16, 16, 5, 1, wgpu::TextureFormat::RGBA8Unorm,
wgpu::TextureUsage::CopyDst | wgpu::TextureUsage::RenderAttachment);
@ -135,8 +135,8 @@ TEST_F(CopyTextureForBrowserTest, IncorrectUsage) {
Create2DTexture(16, 16, 5, 1, wgpu::TextureFormat::RGBA8Unorm, wgpu::TextureUsage::CopySrc);
wgpu::Texture noRenderAttachmentUsageDestination =
Create2DTexture(16, 16, 5, 2, wgpu::TextureFormat::RGBA8Unorm, wgpu::TextureUsage::CopyDst);
wgpu::Texture noCopySrcUsageSource =
Create2DTexture(16, 16, 5, 1, wgpu::TextureFormat::RGBA8Unorm, wgpu::TextureUsage::Sampled);
wgpu::Texture noCopySrcUsageSource = Create2DTexture(
16, 16, 5, 1, wgpu::TextureFormat::RGBA8Unorm, wgpu::TextureUsage::TextureBinding);
wgpu::Texture noCopyDstUsageSource = Create2DTexture(
16, 16, 5, 2, wgpu::TextureFormat::RGBA8Unorm, wgpu::TextureUsage::RenderAttachment);
@ -161,7 +161,7 @@ TEST_F(CopyTextureForBrowserTest, IncorrectUsage) {
TEST_F(CopyTextureForBrowserTest, OutOfBounds) {
wgpu::Texture source =
Create2DTexture(16, 16, 5, 1, wgpu::TextureFormat::RGBA8Unorm,
wgpu::TextureUsage::CopySrc | wgpu::TextureUsage::Sampled);
wgpu::TextureUsage::CopySrc | wgpu::TextureUsage::TextureBinding);
wgpu::Texture destination =
Create2DTexture(16, 16, 5, 4, wgpu::TextureFormat::RGBA8Unorm,
wgpu::TextureUsage::CopyDst | wgpu::TextureUsage::RenderAttachment);
@ -221,7 +221,7 @@ TEST_F(CopyTextureForBrowserTest, OutOfBounds) {
TEST_F(CopyTextureForBrowserTest, InvalidDstFormat) {
wgpu::Texture source =
Create2DTexture(16, 16, 5, 1, wgpu::TextureFormat::RGBA8Unorm,
wgpu::TextureUsage::CopySrc | wgpu::TextureUsage::Sampled);
wgpu::TextureUsage::CopySrc | wgpu::TextureUsage::TextureBinding);
wgpu::Texture destination =
Create2DTexture(16, 16, 5, 2, wgpu::TextureFormat::RG8Uint,
wgpu::TextureUsage::CopyDst | wgpu::TextureUsage::RenderAttachment);
@ -235,13 +235,13 @@ TEST_F(CopyTextureForBrowserTest, InvalidDstFormat) {
TEST_F(CopyTextureForBrowserTest, InvalidSampleCount) {
wgpu::Texture sourceMultiSampled1x =
Create2DTexture(16, 16, 1, 1, wgpu::TextureFormat::RGBA8Unorm,
wgpu::TextureUsage::CopySrc | wgpu::TextureUsage::Sampled, 1);
wgpu::TextureUsage::CopySrc | wgpu::TextureUsage::TextureBinding, 1);
wgpu::Texture destinationMultiSampled1x =
Create2DTexture(16, 16, 1, 1, wgpu::TextureFormat::RGBA8Unorm,
wgpu::TextureUsage::CopyDst | wgpu::TextureUsage::RenderAttachment, 1);
wgpu::Texture sourceMultiSampled4x =
Create2DTexture(16, 16, 1, 1, wgpu::TextureFormat::RGBA8Unorm,
wgpu::TextureUsage::CopySrc | wgpu::TextureUsage::Sampled, 4);
wgpu::TextureUsage::CopySrc | wgpu::TextureUsage::TextureBinding, 4);
wgpu::Texture destinationMultiSampled4x =
Create2DTexture(16, 16, 1, 1, wgpu::TextureFormat::RGBA8Unorm,
wgpu::TextureUsage::CopyDst | wgpu::TextureUsage::RenderAttachment, 4);

View File

@ -29,7 +29,8 @@ namespace {
descriptor.sampleCount = kDefaultSampleCount;
descriptor.dimension = wgpu::TextureDimension::e2D;
descriptor.format = kDefaultTextureFormat;
descriptor.usage = wgpu::TextureUsage::Sampled | wgpu::TextureUsage::RenderAttachment;
descriptor.usage =
wgpu::TextureUsage::TextureBinding | wgpu::TextureUsage::RenderAttachment;
return descriptor;
}
@ -88,7 +89,8 @@ namespace {
ASSERT_DEVICE_ERROR(device.CreateExternalTexture(&externalDesc));
}
// Creating an external texture from a texture without TextureUsage::Sampled should fail.
// Creating an external texture from a texture without TextureUsage::TextureBinding should
// fail.
{
textureDescriptor.mipLevelCount = 2;
wgpu::Texture internalTexture = device.CreateTexture(&textureDescriptor);

View File

@ -108,7 +108,7 @@ TEST_F(TextureInternalUsageValidationTest, UsageValidation) {
// Internal usage adds storage usage which is invalid
// with multisampling.
internalDesc.internalUsage = wgpu::TextureUsage::Storage;
internalDesc.internalUsage = wgpu::TextureUsage::StorageBinding;
ASSERT_DEVICE_ERROR(device.CreateTexture(&textureDesc));
}
}

View File

@ -309,7 +309,7 @@ namespace {
wgpu::TextureDescriptor texDesc;
texDesc.size = {1, 1, 1};
texDesc.usage = wgpu::TextureUsage::Sampled;
texDesc.usage = wgpu::TextureUsage::TextureBinding;
texDesc.format = wgpu::TextureFormat::RGBA8Unorm;
// Test that completely unused bindgroups still have their buffers checked.

View File

@ -225,7 +225,7 @@ namespace {
const uint64_t dataSize =
utils::RequiredBytesInCopy(256, 0, {4, 4, 1}, wgpu::TextureFormat::RGBA8Unorm);
wgpu::Texture sampled = Create2DTexture({16, 16, 1}, 5, wgpu::TextureFormat::RGBA8Unorm,
wgpu::TextureUsage::Sampled);
wgpu::TextureUsage::TextureBinding);
// Incorrect destination usage
ASSERT_DEVICE_ERROR(

View File

@ -144,7 +144,7 @@ namespace {
// Error case: using a texture with Sampled is invalid.
{
wgpu::TextureDescriptor texDesc;
texDesc.usage = wgpu::TextureUsage::Sampled;
texDesc.usage = wgpu::TextureUsage::TextureBinding;
texDesc.size = {1, 1, 1};
texDesc.format = wgpu::TextureFormat::RGBA8Unorm;
wgpu::Texture sampledTex = device.CreateTexture(&texDesc);
@ -365,7 +365,7 @@ namespace {
// Error case: using a texture with Sampled is invalid.
{
wgpu::TextureDescriptor texDesc;
texDesc.usage = wgpu::TextureUsage::Sampled;
texDesc.usage = wgpu::TextureUsage::TextureBinding;
texDesc.size = {1, 1, 1};
texDesc.format = wgpu::TextureFormat::Depth32Float;
wgpu::Texture sampledTex = device.CreateTexture(&texDesc);

View File

@ -818,7 +818,7 @@ namespace {
TEST_F(ResourceUsageTrackingTest, TextureWithMultipleReadUsages) {
// Create a texture that will be used as both sampled and readonly storage texture
wgpu::Texture texture =
CreateTexture(wgpu::TextureUsage::Sampled | wgpu::TextureUsage::Storage);
CreateTexture(wgpu::TextureUsage::TextureBinding | wgpu::TextureUsage::StorageBinding);
wgpu::TextureView view = texture.CreateView();
// Create a bind group to use the texture as sampled and readonly storage bindings
@ -865,8 +865,8 @@ namespace {
// Test render pass
{
// Create a texture
wgpu::Texture texture =
CreateTexture(wgpu::TextureUsage::Sampled | wgpu::TextureUsage::RenderAttachment);
wgpu::Texture texture = CreateTexture(wgpu::TextureUsage::TextureBinding |
wgpu::TextureUsage::RenderAttachment);
wgpu::TextureView view = texture.CreateView();
// Create a bind group to use the texture as sampled binding
@ -888,8 +888,8 @@ namespace {
// Test compute pass
{
// Create a texture
wgpu::Texture texture =
CreateTexture(wgpu::TextureUsage::Sampled | wgpu::TextureUsage::Storage);
wgpu::Texture texture = CreateTexture(wgpu::TextureUsage::TextureBinding |
wgpu::TextureUsage::StorageBinding);
wgpu::TextureView view = texture.CreateView();
// Create a bind group to use the texture as sampled and writeonly bindings
@ -931,8 +931,8 @@ namespace {
// Test render pass
{
// Create a texture
wgpu::Texture texture =
CreateTexture(wgpu::TextureUsage::Storage | wgpu::TextureUsage::RenderAttachment);
wgpu::Texture texture = CreateTexture(wgpu::TextureUsage::StorageBinding |
wgpu::TextureUsage::RenderAttachment);
wgpu::TextureView view = texture.CreateView();
// Create a bind group to use the texture as writeonly storage binding
@ -971,7 +971,7 @@ namespace {
// Test compute pass
{
// Create a texture
wgpu::Texture texture = CreateTexture(wgpu::TextureUsage::Storage);
wgpu::Texture texture = CreateTexture(wgpu::TextureUsage::StorageBinding);
wgpu::TextureView view = texture.CreateView();
// Create a bind group to use the texture as sampled and writeonly bindings
@ -1066,11 +1066,11 @@ namespace {
// Test render pass
{
// Create textures that will be used as both a sampled texture and a render target
wgpu::Texture t0 =
CreateTexture(wgpu::TextureUsage::Sampled | wgpu::TextureUsage::RenderAttachment);
wgpu::Texture t0 = CreateTexture(wgpu::TextureUsage::TextureBinding |
wgpu::TextureUsage::RenderAttachment);
wgpu::TextureView v0 = t0.CreateView();
wgpu::Texture t1 =
CreateTexture(wgpu::TextureUsage::Sampled | wgpu::TextureUsage::RenderAttachment);
wgpu::Texture t1 = CreateTexture(wgpu::TextureUsage::TextureBinding |
wgpu::TextureUsage::RenderAttachment);
wgpu::TextureView v1 = t1.CreateView();
// Create bind groups to use the texture as sampled
@ -1100,7 +1100,7 @@ namespace {
// Test compute pass
{
// Create a texture that will be used storage texture
wgpu::Texture texture = CreateTexture(wgpu::TextureUsage::Storage);
wgpu::Texture texture = CreateTexture(wgpu::TextureUsage::StorageBinding);
wgpu::TextureView view = texture.CreateView();
// Create bind groups to use the texture as readonly and writeonly bindings
@ -1134,7 +1134,7 @@ namespace {
// Test compute pass and render pass mixed together with resource dependency
{
// Create a texture that will be used a storage texture
wgpu::Texture texture = CreateTexture(wgpu::TextureUsage::Storage);
wgpu::Texture texture = CreateTexture(wgpu::TextureUsage::StorageBinding);
wgpu::TextureView view = texture.CreateView();
// Create bind groups to use the texture as readonly and writeonly bindings
@ -1174,7 +1174,7 @@ namespace {
TEST_F(ResourceUsageTrackingTest, TextureWithReadAndWriteUsageOnDifferentDrawsOrDispatches) {
// Create a texture that will be used both as a sampled texture and a storage texture
wgpu::Texture texture =
CreateTexture(wgpu::TextureUsage::Sampled | wgpu::TextureUsage::Storage);
CreateTexture(wgpu::TextureUsage::TextureBinding | wgpu::TextureUsage::StorageBinding);
wgpu::TextureView view = texture.CreateView();
// Test render pass
@ -1251,7 +1251,7 @@ namespace {
TEST_F(ResourceUsageTrackingTest, TextureWithReadAndWriteUsageInSingleDrawOrDispatch) {
// Create a texture that will be used both as a sampled texture and a storage texture
wgpu::Texture texture =
CreateTexture(wgpu::TextureUsage::Sampled | wgpu::TextureUsage::Storage);
CreateTexture(wgpu::TextureUsage::TextureBinding | wgpu::TextureUsage::StorageBinding);
wgpu::TextureView view = texture.CreateView();
// Test render pass
@ -1323,7 +1323,7 @@ namespace {
// Create textures that will be used as both a sampled texture and a render target
wgpu::Texture texture0 = CreateTexture(wgpu::TextureUsage::CopySrc);
wgpu::Texture texture1 =
CreateTexture(wgpu::TextureUsage::CopyDst | wgpu::TextureUsage::Sampled |
CreateTexture(wgpu::TextureUsage::CopyDst | wgpu::TextureUsage::TextureBinding |
wgpu::TextureUsage::RenderAttachment);
wgpu::TextureView view0 = texture0.CreateView();
wgpu::TextureView view1 = texture1.CreateView();
@ -1368,11 +1368,11 @@ namespace {
// Test render pass
{
// Create textures that will be used as both a sampled texture and a render target
wgpu::Texture texture0 =
CreateTexture(wgpu::TextureUsage::Sampled | wgpu::TextureUsage::RenderAttachment);
wgpu::Texture texture0 = CreateTexture(wgpu::TextureUsage::TextureBinding |
wgpu::TextureUsage::RenderAttachment);
wgpu::TextureView view0 = texture0.CreateView();
wgpu::Texture texture1 =
CreateTexture(wgpu::TextureUsage::Sampled | wgpu::TextureUsage::RenderAttachment);
wgpu::Texture texture1 = CreateTexture(wgpu::TextureUsage::TextureBinding |
wgpu::TextureUsage::RenderAttachment);
wgpu::TextureView view1 = texture1.CreateView();
// Create the bind group to use the texture as sampled
@ -1411,9 +1411,9 @@ namespace {
// Test compute pass
{
// Create a texture that will be used both as storage texture
wgpu::Texture texture0 = CreateTexture(wgpu::TextureUsage::Storage);
wgpu::Texture texture0 = CreateTexture(wgpu::TextureUsage::StorageBinding);
wgpu::TextureView view0 = texture0.CreateView();
wgpu::Texture texture1 = CreateTexture(wgpu::TextureUsage::Storage);
wgpu::Texture texture1 = CreateTexture(wgpu::TextureUsage::StorageBinding);
wgpu::TextureView view1 = texture1.CreateView();
// Create the bind group to use the texture as readonly and writeonly bindings
@ -1472,7 +1472,7 @@ namespace {
// visible to the programmable pass where it is used.
TEST_F(ResourceUsageTrackingTest, TextureUsageConflictBetweenInvisibleStagesInBindGroup) {
// Create texture and texture view
wgpu::Texture texture = CreateTexture(wgpu::TextureUsage::Storage);
wgpu::Texture texture = CreateTexture(wgpu::TextureUsage::StorageBinding);
wgpu::TextureView view = texture.CreateView();
// Test render pass for bind group. The conflict of readonly storage and writeonly storage
@ -1532,8 +1532,8 @@ namespace {
// visible to the programmable pass where it is used.
TEST_F(ResourceUsageTrackingTest, TextureUsageConflictWithInvisibleStageInBindGroup) {
// Create texture and texture view
wgpu::Texture texture =
CreateTexture(wgpu::TextureUsage::Storage | wgpu::TextureUsage::RenderAttachment);
wgpu::Texture texture = CreateTexture(wgpu::TextureUsage::StorageBinding |
wgpu::TextureUsage::RenderAttachment);
wgpu::TextureView view = texture.CreateView();
// Test render pass
@ -1595,7 +1595,7 @@ namespace {
// used in the pipeline.
TEST_F(ResourceUsageTrackingTest, TextureUsageConflictWithUnusedPipelineBindings) {
// Create texture and texture view
wgpu::Texture texture = CreateTexture(wgpu::TextureUsage::Storage);
wgpu::Texture texture = CreateTexture(wgpu::TextureUsage::StorageBinding);
wgpu::TextureView view = texture.CreateView();
// Create bind groups.

View File

@ -305,7 +305,7 @@ TEST_F(StorageTextureValidationTests, BindGroupLayoutWithStorageTextureBindingTy
}
// Validate it is an error to declare a read-only or write-only storage texture in shaders with any
// format that doesn't support TextureUsage::Storage texture usages.
// format that doesn't support TextureUsage::StorageBinding texture usages.
TEST_F(StorageTextureValidationTests, StorageTextureFormatInShaders) {
// Not include RGBA8UnormSrgb, BGRA8Unorm, BGRA8UnormSrgb because they are not related to any
// SPIR-V Image Formats.
@ -625,19 +625,20 @@ TEST_F(StorageTextureValidationTests, StorageTextureBindingTypeInBindGroup) {
// Texture views are allowed to be used as storage textures in a bind group.
{
wgpu::TextureView textureView =
CreateTexture(wgpu::TextureUsage::Storage, kStorageTextureFormat).CreateView();
CreateTexture(wgpu::TextureUsage::StorageBinding, kStorageTextureFormat)
.CreateView();
utils::MakeBindGroup(device, bindGroupLayout, {{0, textureView}});
}
}
}
// Verify that a texture used as read-only or write-only storage texture in a bind group must be
// created with the texture usage wgpu::TextureUsage::STORAGE.
// created with the texture usage wgpu::TextureUsage::StorageBinding.
TEST_F(StorageTextureValidationTests, StorageTextureUsageInBindGroup) {
constexpr wgpu::TextureFormat kStorageTextureFormat = wgpu::TextureFormat::R32Float;
constexpr std::array<wgpu::TextureUsage, 6> kTextureUsages = {
wgpu::TextureUsage::CopySrc, wgpu::TextureUsage::CopyDst,
wgpu::TextureUsage::Sampled, wgpu::TextureUsage::Storage,
wgpu::TextureUsage::TextureBinding, wgpu::TextureUsage::StorageBinding,
wgpu::TextureUsage::RenderAttachment, wgpu::TextureUsage::Present};
for (wgpu::StorageTextureAccess storageBindingType : kSupportedStorageTextureAccess) {
@ -658,8 +659,8 @@ TEST_F(StorageTextureValidationTests, StorageTextureUsageInBindGroup) {
CreateTexture(usage, kStorageTextureFormat).CreateView();
// Verify that the texture used as storage texture must be created with the texture
// usage wgpu::TextureUsage::STORAGE.
if (usage & wgpu::TextureUsage::Storage) {
// usage wgpu::TextureUsage::StorageBinding.
if (usage & wgpu::TextureUsage::StorageBinding) {
utils::MakeBindGroup(device, bindGroupLayout, {{0, textureView}});
} else {
ASSERT_DEVICE_ERROR(
@ -698,7 +699,8 @@ TEST_F(StorageTextureValidationTests, StorageTextureFormatInBindGroup) {
// Create texture views with different texture formats.
wgpu::TextureView storageTextureView =
CreateTexture(wgpu::TextureUsage::Storage, textureViewFormat).CreateView();
CreateTexture(wgpu::TextureUsage::StorageBinding, textureViewFormat)
.CreateView();
// Verify that the format of the texture view used as storage texture in a bind
// group must match the storage texture format declaration in the bind group layout.
@ -750,8 +752,9 @@ TEST_F(StorageTextureValidationTests, StorageTextureViewDimensionInBindGroup) {
for (wgpu::TextureViewDimension dimensionOfTextureView : kSupportedDimensions) {
// Create a texture view with given texture view dimension.
wgpu::Texture texture = CreateTexture(
wgpu::TextureUsage::Storage, kStorageTextureFormat, 1, kDepthOrArrayLayers,
wgpu::Texture texture =
CreateTexture(wgpu::TextureUsage::StorageBinding, kStorageTextureFormat, 1,
kDepthOrArrayLayers,
utils::ViewDimensionToTextureDimension(dimensionOfTextureView));
wgpu::TextureViewDescriptor textureViewDescriptor = kDefaultTextureViewDescriptor;
@ -784,7 +787,7 @@ TEST_F(StorageTextureValidationTests, MultisampledStorageTexture) {
// texture in a render pass.
TEST_F(StorageTextureValidationTests, StorageTextureInRenderPass) {
constexpr wgpu::TextureFormat kFormat = wgpu::TextureFormat::RGBA8Unorm;
wgpu::Texture storageTexture = CreateTexture(wgpu::TextureUsage::Storage, kFormat);
wgpu::Texture storageTexture = CreateTexture(wgpu::TextureUsage::StorageBinding, kFormat);
wgpu::Texture outputAttachment = CreateTexture(wgpu::TextureUsage::RenderAttachment, kFormat);
utils::ComboRenderPassDescriptor renderPassDescriptor({outputAttachment.CreateView()});
@ -815,8 +818,8 @@ TEST_F(StorageTextureValidationTests, StorageTextureInRenderPass) {
// sampled texture in one render pass.
TEST_F(StorageTextureValidationTests, StorageTextureAndSampledTextureInOneRenderPass) {
constexpr wgpu::TextureFormat kFormat = wgpu::TextureFormat::RGBA8Unorm;
wgpu::Texture storageTexture =
CreateTexture(wgpu::TextureUsage::Storage | wgpu::TextureUsage::Sampled, kFormat);
wgpu::Texture storageTexture = CreateTexture(
wgpu::TextureUsage::StorageBinding | wgpu::TextureUsage::TextureBinding, kFormat);
wgpu::Texture outputAttachment = CreateTexture(wgpu::TextureUsage::RenderAttachment, kFormat);
utils::ComboRenderPassDescriptor renderPassDescriptor({outputAttachment.CreateView()});
@ -860,8 +863,8 @@ TEST_F(StorageTextureValidationTests, StorageTextureAndSampledTextureInOneRender
// and render attachment in one render pass.
TEST_F(StorageTextureValidationTests, StorageTextureAndRenderAttachmentInOneRenderPass) {
constexpr wgpu::TextureFormat kFormat = wgpu::TextureFormat::RGBA8Unorm;
wgpu::Texture storageTexture =
CreateTexture(wgpu::TextureUsage::Storage | wgpu::TextureUsage::RenderAttachment, kFormat);
wgpu::Texture storageTexture = CreateTexture(
wgpu::TextureUsage::StorageBinding | wgpu::TextureUsage::RenderAttachment, kFormat);
utils::ComboRenderPassDescriptor renderPassDescriptor({storageTexture.CreateView()});
for (wgpu::StorageTextureAccess storageTextureType : kSupportedStorageTextureAccess) {
@ -888,7 +891,7 @@ TEST_F(StorageTextureValidationTests, StorageTextureAndRenderAttachmentInOneRend
// texture in one render pass.
TEST_F(StorageTextureValidationTests, ReadOnlyAndWriteOnlyStorageTextureInOneRenderPass) {
constexpr wgpu::TextureFormat kFormat = wgpu::TextureFormat::RGBA8Unorm;
wgpu::Texture storageTexture = CreateTexture(wgpu::TextureUsage::Storage, kFormat);
wgpu::Texture storageTexture = CreateTexture(wgpu::TextureUsage::StorageBinding, kFormat);
// Create a bind group that uses the same texture as both read-only and write-only storage
// texture.
@ -918,8 +921,8 @@ TEST_F(StorageTextureValidationTests, ReadOnlyAndWriteOnlyStorageTextureInOneRen
// sampled texture in one compute pass.
TEST_F(StorageTextureValidationTests, StorageTextureAndSampledTextureInOneComputePass) {
constexpr wgpu::TextureFormat kFormat = wgpu::TextureFormat::RGBA8Unorm;
wgpu::Texture storageTexture =
CreateTexture(wgpu::TextureUsage::Storage | wgpu::TextureUsage::Sampled, kFormat);
wgpu::Texture storageTexture = CreateTexture(
wgpu::TextureUsage::StorageBinding | wgpu::TextureUsage::TextureBinding, kFormat);
for (wgpu::StorageTextureAccess storageTextureType : kSupportedStorageTextureAccess) {
// Create a bind group that binds the same texture as both storage texture and sampled
@ -948,7 +951,7 @@ TEST_F(StorageTextureValidationTests, StorageTextureAndSampledTextureInOneComput
// texture in one compute pass.
TEST_F(StorageTextureValidationTests, ReadOnlyAndWriteOnlyStorageTextureInOneComputePass) {
constexpr wgpu::TextureFormat kFormat = wgpu::TextureFormat::RGBA8Unorm;
wgpu::Texture storageTexture = CreateTexture(wgpu::TextureUsage::Storage, kFormat);
wgpu::Texture storageTexture = CreateTexture(wgpu::TextureUsage::StorageBinding, kFormat);
// Create a bind group that uses the same texture as both read-only and write-only storage
// texture.

View File

@ -125,10 +125,10 @@ namespace {
// Test different mipmap levels
TEST_F(TextureSubresourceTest, MipmapLevelsTest) {
// Create texture with 2 mipmap levels and 1 layer
wgpu::Texture texture =
CreateTexture(2, 1,
wgpu::TextureUsage::Sampled | wgpu::TextureUsage::RenderAttachment |
wgpu::TextureUsage::Storage);
wgpu::Texture texture = CreateTexture(2, 1,
wgpu::TextureUsage::TextureBinding |
wgpu::TextureUsage::RenderAttachment |
wgpu::TextureUsage::StorageBinding);
// Create two views on different mipmap levels.
wgpu::TextureView samplerView = CreateTextureView(texture, 0, 0);
@ -139,10 +139,10 @@ namespace {
// Test different array layers
TEST_F(TextureSubresourceTest, ArrayLayersTest) {
// Create texture with 1 mipmap level and 2 layers
wgpu::Texture texture =
CreateTexture(1, 2,
wgpu::TextureUsage::Sampled | wgpu::TextureUsage::RenderAttachment |
wgpu::TextureUsage::Storage);
wgpu::Texture texture = CreateTexture(1, 2,
wgpu::TextureUsage::TextureBinding |
wgpu::TextureUsage::RenderAttachment |
wgpu::TextureUsage::StorageBinding);
// Create two views on different layers.
wgpu::TextureView samplerView = CreateTextureView(texture, 0, 0);

View File

@ -44,7 +44,8 @@ namespace {
descriptor.sampleCount = kDefaultSampleCount;
descriptor.dimension = wgpu::TextureDimension::e2D;
descriptor.format = kDefaultTextureFormat;
descriptor.usage = wgpu::TextureUsage::RenderAttachment | wgpu::TextureUsage::Sampled;
descriptor.usage =
wgpu::TextureUsage::RenderAttachment | wgpu::TextureUsage::TextureBinding;
return descriptor;
}
@ -133,11 +134,11 @@ namespace {
ASSERT_DEVICE_ERROR(device.CreateTexture(&descriptor));
}
// It is an error to set TextureUsage::Storage when sampleCount > 1.
// It is an error to set TextureUsage::StorageBinding when sampleCount > 1.
{
wgpu::TextureDescriptor descriptor = defaultDescriptor;
descriptor.sampleCount = 4;
descriptor.usage |= wgpu::TextureUsage::Storage;
descriptor.usage |= wgpu::TextureUsage::StorageBinding;
ASSERT_DEVICE_ERROR(device.CreateTexture(&descriptor));
}
@ -507,11 +508,11 @@ namespace {
}
// Test it is an error to create a Storage texture with any format that doesn't support
// TextureUsage::Storage texture usages.
// TextureUsage::StorageBinding texture usages.
TEST_F(TextureValidationTest, TextureFormatNotSupportTextureUsageStorage) {
wgpu::TextureDescriptor descriptor;
descriptor.size = {1, 1, 1};
descriptor.usage = wgpu::TextureUsage::Storage;
descriptor.usage = wgpu::TextureUsage::StorageBinding;
for (wgpu::TextureFormat format : utils::kAllTextureFormats) {
descriptor.format = format;
@ -554,7 +555,7 @@ namespace {
wgpu::TextureDescriptor descriptor =
TextureValidationTest::CreateDefaultTextureDescriptor();
descriptor.usage = wgpu::TextureUsage::CopySrc | wgpu::TextureUsage::CopyDst |
wgpu::TextureUsage::Sampled;
wgpu::TextureUsage::TextureBinding;
return descriptor;
}
};
@ -601,7 +602,7 @@ namespace {
TEST_F(CompressedTextureFormatsValidationTests, TextureUsage) {
wgpu::TextureUsage invalidUsages[] = {
wgpu::TextureUsage::RenderAttachment,
wgpu::TextureUsage::Storage,
wgpu::TextureUsage::StorageBinding,
wgpu::TextureUsage::Present,
};
for (wgpu::TextureFormat format : utils::kBCFormats) {

View File

@ -39,7 +39,7 @@ namespace {
descriptor.sampleCount = sampleCount;
descriptor.format = kDefaultTextureFormat;
descriptor.mipLevelCount = mipLevelCount;
descriptor.usage = wgpu::TextureUsage::Sampled;
descriptor.usage = wgpu::TextureUsage::TextureBinding;
return device.CreateTexture(&descriptor);
}
@ -50,7 +50,7 @@ namespace {
descriptor.sampleCount = 1;
descriptor.format = kDefaultTextureFormat;
descriptor.mipLevelCount = kDefaultMipLevels;
descriptor.usage = wgpu::TextureUsage::Sampled;
descriptor.usage = wgpu::TextureUsage::TextureBinding;
return device.CreateTexture(&descriptor);
}
@ -523,7 +523,8 @@ namespace {
TEST_F(TextureViewValidationTest, AspectMustExist) {
wgpu::TextureDescriptor descriptor = {};
descriptor.size = {1, 1, 1};
descriptor.usage = wgpu::TextureUsage::Sampled | wgpu::TextureUsage::RenderAttachment;
descriptor.usage =
wgpu::TextureUsage::TextureBinding | wgpu::TextureUsage::RenderAttachment;
// Can select: All and DepthOnly from Depth32Float, but not StencilOnly
{

View File

@ -118,10 +118,10 @@ namespace {
// Test copying from one multi-planar format into another fails.
TEST_F(VideoViewsValidation, T2TCopyAllAspectsFails) {
wgpu::Texture srcTexture = CreateVideoTextureForTest(
wgpu::TextureFormat::R8BG8Biplanar420Unorm, wgpu::TextureUsage::Sampled);
wgpu::TextureFormat::R8BG8Biplanar420Unorm, wgpu::TextureUsage::TextureBinding);
wgpu::Texture dstTexture = CreateVideoTextureForTest(
wgpu::TextureFormat::R8BG8Biplanar420Unorm, wgpu::TextureUsage::Sampled);
wgpu::TextureFormat::R8BG8Biplanar420Unorm, wgpu::TextureUsage::TextureBinding);
wgpu::ImageCopyTexture copySrc = utils::CreateImageCopyTexture(srcTexture, 0, {0, 0, 0});
@ -137,10 +137,10 @@ namespace {
// Test copying from one multi-planar format into another per plane fails.
TEST_F(VideoViewsValidation, T2TCopyPlaneAspectFails) {
wgpu::Texture srcTexture = CreateVideoTextureForTest(
wgpu::TextureFormat::R8BG8Biplanar420Unorm, wgpu::TextureUsage::Sampled);
wgpu::TextureFormat::R8BG8Biplanar420Unorm, wgpu::TextureUsage::TextureBinding);
wgpu::Texture dstTexture = CreateVideoTextureForTest(
wgpu::TextureFormat::R8BG8Biplanar420Unorm, wgpu::TextureUsage::Sampled);
wgpu::TextureFormat::R8BG8Biplanar420Unorm, wgpu::TextureUsage::TextureBinding);
wgpu::ImageCopyTexture copySrc = utils::CreateImageCopyTexture(
srcTexture, 0, {0, 0, 0}, wgpu::TextureAspect::Plane0Only);
@ -169,7 +169,7 @@ namespace {
// Test copying from a multi-planar format to a buffer fails.
TEST_F(VideoViewsValidation, T2BCopyAllAspectsFails) {
wgpu::Texture srcTexture = CreateVideoTextureForTest(
wgpu::TextureFormat::R8BG8Biplanar420Unorm, wgpu::TextureUsage::Sampled);
wgpu::TextureFormat::R8BG8Biplanar420Unorm, wgpu::TextureUsage::TextureBinding);
wgpu::BufferDescriptor bufferDescriptor;
bufferDescriptor.size = 1;
@ -190,7 +190,7 @@ namespace {
// Test copying from multi-planar format per plane to a buffer fails.
TEST_F(VideoViewsValidation, T2BCopyPlaneAspectsFails) {
wgpu::Texture srcTexture = CreateVideoTextureForTest(
wgpu::TextureFormat::R8BG8Biplanar420Unorm, wgpu::TextureUsage::Sampled);
wgpu::TextureFormat::R8BG8Biplanar420Unorm, wgpu::TextureUsage::TextureBinding);
wgpu::BufferDescriptor bufferDescriptor;
bufferDescriptor.size = 1;
@ -228,7 +228,7 @@ namespace {
device, dummyData.data(), dummyData.size(), wgpu::BufferUsage::CopySrc);
wgpu::Texture dstTexture = CreateVideoTextureForTest(
wgpu::TextureFormat::R8BG8Biplanar420Unorm, wgpu::TextureUsage::Sampled);
wgpu::TextureFormat::R8BG8Biplanar420Unorm, wgpu::TextureUsage::TextureBinding);
wgpu::ImageCopyBuffer copySrc = utils::CreateImageCopyBuffer(srcBuffer, 0, 12, 4);
@ -249,7 +249,7 @@ namespace {
device, dummyData.data(), dummyData.size(), wgpu::BufferUsage::CopySrc);
wgpu::Texture dstTexture = CreateVideoTextureForTest(
wgpu::TextureFormat::R8BG8Biplanar420Unorm, wgpu::TextureUsage::Sampled);
wgpu::TextureFormat::R8BG8Biplanar420Unorm, wgpu::TextureUsage::TextureBinding);
wgpu::ImageCopyBuffer copySrc = utils::CreateImageCopyBuffer(srcBuffer, 0, 12, 4);
@ -281,7 +281,7 @@ namespace {
// R8BG8Biplanar420Unorm is allowed to be sampled, if plane 0 or plane 1 is selected.
wgpu::Texture texture = CreateVideoTextureForTest(
wgpu::TextureFormat::R8BG8Biplanar420Unorm, wgpu::TextureUsage::Sampled);
wgpu::TextureFormat::R8BG8Biplanar420Unorm, wgpu::TextureUsage::TextureBinding);
wgpu::TextureViewDescriptor desc = {};
@ -302,7 +302,7 @@ namespace {
// Tests writing into a multi-planar format fails.
TEST_F(VideoViewsValidation, WriteTextureAllAspectsFails) {
wgpu::Texture texture = CreateVideoTextureForTest(
wgpu::TextureFormat::R8BG8Biplanar420Unorm, wgpu::TextureUsage::Sampled);
wgpu::TextureFormat::R8BG8Biplanar420Unorm, wgpu::TextureUsage::TextureBinding);
wgpu::TextureDataLayout textureDataLayout = utils::CreateTextureDataLayout(0, 4, 4);
@ -321,7 +321,7 @@ namespace {
// Tests writing into a multi-planar format per plane fails.
TEST_F(VideoViewsValidation, WriteTexturePlaneAspectsFails) {
wgpu::Texture texture = CreateVideoTextureForTest(
wgpu::TextureFormat::R8BG8Biplanar420Unorm, wgpu::TextureUsage::Sampled);
wgpu::TextureFormat::R8BG8Biplanar420Unorm, wgpu::TextureUsage::TextureBinding);
wgpu::TextureDataLayout textureDataLayout = utils::CreateTextureDataLayout(0, 12, 4);
wgpu::ImageCopyTexture imageCopyTexture =

View File

@ -752,7 +752,7 @@ TEST_P(D3D12DescriptorHeapTests, EncodeManyUBOAndSamplers) {
descriptor.sampleCount = 1;
descriptor.format = wgpu::TextureFormat::RGBA8Unorm;
descriptor.mipLevelCount = 1;
descriptor.usage = wgpu::TextureUsage::Sampled | wgpu::TextureUsage::RenderAttachment |
descriptor.usage = wgpu::TextureUsage::TextureBinding | wgpu::TextureUsage::RenderAttachment |
wgpu::TextureUsage::CopySrc;
wgpu::Texture texture = device.CreateTexture(&descriptor);
wgpu::TextureView textureView = texture.CreateView();

View File

@ -58,7 +58,7 @@ TEST_P(D3D12ResourceHeapTests, AlignSmallCompressedTexture) {
descriptor.sampleCount = 1;
descriptor.format = wgpu::TextureFormat::BC1RGBAUnorm;
descriptor.mipLevelCount = 1;
descriptor.usage = wgpu::TextureUsage::Sampled;
descriptor.usage = wgpu::TextureUsage::TextureBinding;
// Create a smaller one that allows use of the smaller alignment.
wgpu::Texture texture = device.CreateTexture(&descriptor);

View File

@ -203,14 +203,14 @@ TEST_P(EGLImageValidationTests, InvalidTextureDimension) {
// Test an error occurs if the texture usage is not RenderAttachment
TEST_P(EGLImageValidationTests, InvalidTextureUsage) {
DAWN_TEST_UNSUPPORTED_IF(UsesWire());
descriptor.usage = wgpu::TextureUsage::Sampled;
descriptor.usage = wgpu::TextureUsage::TextureBinding;
ScopedEGLImage image = CreateDefaultEGLImage();
wgpu::Texture texture;
ASSERT_DEVICE_ERROR(texture = WrapEGLImage(&descriptor, image.getImage()));
ASSERT_EQ(texture.Get(), nullptr);
descriptor.usage = wgpu::TextureUsage::Storage;
descriptor.usage = wgpu::TextureUsage::StorageBinding;
ASSERT_DEVICE_ERROR(texture = WrapEGLImage(&descriptor, image.getImage()));