s/OutputAttachment/RenderAttachment/g

But also keep OutputAttachment so it can be gradually changed in all
dependants.

See https://github.com/gpuweb/gpuweb/pull/1168 and
https://github.com/gpuweb/gpuweb/pull/1168

Bug: dawn:22
Change-Id: I6a1ec1de6c22ca4deac88b7fffde4b98d9d54a84
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/31040
Reviewed-by: Austin Eng <enga@chromium.org>
Reviewed-by: Stephen White <senorblanco@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
This commit is contained in:
Corentin Wallez 2020-10-27 15:35:56 +00:00 committed by Commit Bot service account
parent 25eeaa3d39
commit 6b087819dd
65 changed files with 187 additions and 186 deletions

View File

@ -1713,6 +1713,7 @@
{"value": 4, "name": "sampled"},
{"value": 8, "name": "storage"},
{"value": 16, "name": "output attachment"},
{"value": 16, "name": "render attachment"},
{"value": 32, "name": "present"}
]
},

View File

@ -52,7 +52,7 @@ void init() {
queue = device.GetDefaultQueue();
swapchain = GetSwapChain(device);
swapchain.Configure(GetPreferredSwapChainTextureFormat(), wgpu::TextureUsage::OutputAttachment,
swapchain.Configure(GetPreferredSwapChainTextureFormat(), wgpu::TextureUsage::RenderAttachment,
640, 480);
wgpu::ShaderModule vsModule =

View File

@ -34,7 +34,7 @@ void init() {
swapchain = wgpuDeviceCreateSwapChain(device, nullptr, &descriptor);
}
swapChainFormat = static_cast<WGPUTextureFormat>(GetPreferredSwapChainTextureFormat());
wgpuSwapChainConfigure(swapchain, swapChainFormat, WGPUTextureUsage_OutputAttachment, 640, 480);
wgpuSwapChainConfigure(swapchain, swapChainFormat, WGPUTextureUsage_RenderAttachment, 640, 480);
const char* vs =
"#version 450\n"

View File

@ -292,7 +292,7 @@ void init() {
queue = device.GetDefaultQueue();
swapchain = GetSwapChain(device);
swapchain.Configure(GetPreferredSwapChainTextureFormat(), wgpu::TextureUsage::OutputAttachment,
swapchain.Configure(GetPreferredSwapChainTextureFormat(), wgpu::TextureUsage::RenderAttachment,
640, 480);
initBuffers();

View File

@ -90,7 +90,7 @@ void init() {
queue = device.GetDefaultQueue();
swapchain = GetSwapChain(device);
swapchain.Configure(GetPreferredSwapChainTextureFormat(), wgpu::TextureUsage::OutputAttachment,
swapchain.Configure(GetPreferredSwapChainTextureFormat(), wgpu::TextureUsage::RenderAttachment,
640, 480);
initBuffers();

View File

@ -96,7 +96,7 @@ void init() {
queue = device.GetDefaultQueue();
swapchain = GetSwapChain(device);
swapchain.Configure(GetPreferredSwapChainTextureFormat(), wgpu::TextureUsage::OutputAttachment,
swapchain.Configure(GetPreferredSwapChainTextureFormat(), wgpu::TextureUsage::RenderAttachment,
640, 480);
initBuffers();

View File

@ -111,7 +111,7 @@ void AddWindow() {
glfwSetKeyCallback(window, OnKeyPress);
wgpu::SwapChainDescriptor descriptor;
descriptor.usage = wgpu::TextureUsage::OutputAttachment;
descriptor.usage = wgpu::TextureUsage::RenderAttachment;
descriptor.format = wgpu::TextureFormat::BGRA8Unorm;
descriptor.width = 0;
descriptor.height = 0;
@ -165,8 +165,8 @@ void DoRender(WindowData* data) {
std::ostream& operator<<(std::ostream& o, const wgpu::SwapChainDescriptor& desc) {
// For now only output attachment is possible.
ASSERT(desc.usage == wgpu::TextureUsage::OutputAttachment);
o << "OutputAttachment ";
ASSERT(desc.usage == wgpu::TextureUsage::RenderAttachment);
o << "RenderAttachment ";
o << desc.width << "x" << desc.height << " ";
// For now only BGRA is allowed

View File

@ -188,7 +188,7 @@ wgpu::TextureView CreateDefaultDepthStencilView(const wgpu::Device& device) {
descriptor.sampleCount = 1;
descriptor.format = wgpu::TextureFormat::Depth24PlusStencil8;
descriptor.mipLevelCount = 1;
descriptor.usage = wgpu::TextureUsage::OutputAttachment;
descriptor.usage = wgpu::TextureUsage::RenderAttachment;
auto depthStencilTexture = device.CreateTexture(&descriptor);
return depthStencilTexture.CreateView();
}

View File

@ -543,11 +543,11 @@ namespace dawn_native {
cmd->colorAttachments[index].clearColor =
descriptor->colorAttachments[i].clearColor;
usageTracker.TextureViewUsedAs(view, wgpu::TextureUsage::OutputAttachment);
usageTracker.TextureViewUsedAs(view, wgpu::TextureUsage::RenderAttachment);
if (resolveTarget != nullptr) {
usageTracker.TextureViewUsedAs(resolveTarget,
wgpu::TextureUsage::OutputAttachment);
wgpu::TextureUsage::RenderAttachment);
}
}
@ -568,7 +568,7 @@ namespace dawn_native {
cmd->depthStencilAttachment.stencilStoreOp =
descriptor->depthStencilAttachment->stencilStoreOp;
usageTracker.TextureViewUsedAs(view, wgpu::TextureUsage::OutputAttachment);
usageTracker.TextureViewUsedAs(view, wgpu::TextureUsage::RenderAttachment);
}
cmd->width = width;

View File

@ -81,8 +81,8 @@ namespace dawn_native {
return DAWN_VALIDATION_ERROR("Format must (currently) be BGRA8Unorm");
}
if (descriptor->usage != wgpu::TextureUsage::OutputAttachment) {
return DAWN_VALIDATION_ERROR("Usage must (currently) be OutputAttachment");
if (descriptor->usage != wgpu::TextureUsage::RenderAttachment) {
return DAWN_VALIDATION_ERROR("Usage must (currently) be RenderAttachment");
}
if (descriptor->width == 0 || descriptor->height == 0) {

View File

@ -198,9 +198,9 @@ namespace dawn_native {
}
if (!format->isRenderable &&
(descriptor->usage & wgpu::TextureUsage::OutputAttachment)) {
(descriptor->usage & wgpu::TextureUsage::RenderAttachment)) {
return DAWN_VALIDATION_ERROR(
"Non-renderable format used with OutputAttachment usage");
"Non-renderable format used with RenderAttachment usage");
}
if (!format->supportsStorageUsage &&

View File

@ -71,7 +71,7 @@ namespace dawn_native {
static constexpr wgpu::TextureUsage kWritableTextureUsages =
wgpu::TextureUsage::CopyDst | wgpu::TextureUsage::Storage |
wgpu::TextureUsage::OutputAttachment;
wgpu::TextureUsage::RenderAttachment;
// Convert the TextureAspect to an Aspect mask for the format. ASSERTs if the aspect
// does not exist in the format.

View File

@ -629,7 +629,7 @@ namespace dawn_native { namespace d3d12 {
// Clear textures that are not output attachments. Output attachments will be
// cleared during record render pass if the texture subresource has not been
// initialized before the render pass.
if (!(usages.textureUsages[i].usage & wgpu::TextureUsage::OutputAttachment)) {
if (!(usages.textureUsages[i].usage & wgpu::TextureUsage::RenderAttachment)) {
texture->EnsureSubresourceContentInitialized(commandContext,
texture->GetAllSubresources());
}

View File

@ -29,7 +29,7 @@ namespace dawn_native { namespace d3d12 {
if (allowedUsages & WGPUTextureUsage_Storage) {
usage |= DXGI_USAGE_UNORDERED_ACCESS;
}
if (allowedUsages & WGPUTextureUsage_OutputAttachment) {
if (allowedUsages & WGPUTextureUsage_RenderAttachment) {
usage |= DXGI_USAGE_RENDER_TARGET_OUTPUT;
}
return usage;

View File

@ -56,7 +56,7 @@ namespace dawn_native { namespace d3d12 {
if (usage & wgpu::TextureUsage::Storage) {
resourceState |= D3D12_RESOURCE_STATE_UNORDERED_ACCESS;
}
if (usage & wgpu::TextureUsage::OutputAttachment) {
if (usage & wgpu::TextureUsage::RenderAttachment) {
if (format.HasDepthOrStencil()) {
resourceState |= D3D12_RESOURCE_STATE_DEPTH_WRITE;
} else {
@ -79,7 +79,7 @@ namespace dawn_native { namespace d3d12 {
// A multisampled resource must have either D3D12_RESOURCE_FLAG_ALLOW_RENDER_TARGET or
// D3D12_RESOURCE_FLAG_ALLOW_DEPTH_STENCIL set in D3D12_RESOURCE_DESC::Flags.
// https://docs.microsoft.com/en-us/windows/desktop/api/d3d12/ns-d3d12-d3d12_resource_desc
if ((usage & wgpu::TextureUsage::OutputAttachment) != 0 || isMultisampledTexture) {
if ((usage & wgpu::TextureUsage::RenderAttachment) != 0 || isMultisampledTexture) {
if (format.HasDepthOrStencil()) {
flags |= D3D12_RESOURCE_FLAG_ALLOW_DEPTH_STENCIL;
} else {
@ -864,7 +864,7 @@ namespace dawn_native { namespace d3d12 {
uint8_t clearColor = (clearValue == TextureBase::ClearValue::Zero) ? 0 : 1;
float fClearColor = (clearValue == TextureBase::ClearValue::Zero) ? 0.f : 1.f;
if ((GetUsage() & wgpu::TextureUsage::OutputAttachment) != 0) {
if ((GetUsage() & wgpu::TextureUsage::RenderAttachment) != 0) {
if (GetFormat().HasDepthOrStencil()) {
TrackUsageAndTransitionNow(commandContext, D3D12_RESOURCE_STATE_DEPTH_WRITE, range);

View File

@ -547,7 +547,7 @@ namespace dawn_native { namespace metal {
// Clear textures that are not output attachments. Output attachments will be
// cleared in CreateMTLRenderPassDescriptor by setting the loadop to clear when the
// texture subresource has not been initialized before the render pass.
if (!(usages.textureUsages[i].usage & wgpu::TextureUsage::OutputAttachment)) {
if (!(usages.textureUsages[i].usage & wgpu::TextureUsage::RenderAttachment)) {
texture->EnsureSubresourceContentInitialized(texture->GetAllSubresources());
}
}

View File

@ -94,7 +94,7 @@ namespace dawn_native { namespace metal {
size.height = GetHeight();
[mLayer setDrawableSize:size];
[mLayer setFramebufferOnly:(GetUsage() == wgpu::TextureUsage::OutputAttachment)];
[mLayer setFramebufferOnly:(GetUsage() == wgpu::TextureUsage::RenderAttachment)];
[mLayer setDevice:ToBackend(GetDevice())->GetMTLDevice()];
[mLayer setPixelFormat:MetalPixelFormat(GetFormat())];

View File

@ -45,7 +45,7 @@ namespace dawn_native { namespace metal {
result |= MTLTextureUsageShaderRead;
}
if (usage & (wgpu::TextureUsage::OutputAttachment)) {
if (usage & (wgpu::TextureUsage::RenderAttachment)) {
result |= MTLTextureUsageRenderTarget;
}
@ -385,7 +385,7 @@ namespace dawn_native { namespace metal {
const uint8_t clearColor = (clearValue == TextureBase::ClearValue::Zero) ? 0 : 1;
const double dClearColor = (clearValue == TextureBase::ClearValue::Zero) ? 0.0 : 1.0;
if ((GetUsage() & wgpu::TextureUsage::OutputAttachment) != 0) {
if ((GetUsage() & wgpu::TextureUsage::RenderAttachment) != 0) {
ASSERT(GetFormat().isRenderable);
// End the blit encoder if it is open.

View File

@ -445,7 +445,7 @@ namespace dawn_native { namespace opengl {
// Clear textures that are not output attachments. Output attachments will be
// cleared in BeginRenderPass by setting the loadop to clear when the
// texture subresource has not been initialized before the render pass.
if (!(usages.textureUsages[i].usage & wgpu::TextureUsage::OutputAttachment)) {
if (!(usages.textureUsages[i].usage & wgpu::TextureUsage::RenderAttachment)) {
texture->EnsureSubresourceContentInitialized(texture->GetAllSubresources());
}
}

View File

@ -519,7 +519,7 @@ namespace dawn_native { namespace vulkan {
// Clear textures that are not output attachments. Output attachments will be
// cleared in RecordBeginRenderPass by setting the loadop to clear when the
// texture subresource has not been initialized before the render pass.
if (!(usages.textureUsages[i].usage & wgpu::TextureUsage::OutputAttachment)) {
if (!(usages.textureUsages[i].usage & wgpu::TextureUsage::RenderAttachment)) {
texture->EnsureSubresourceContentInitialized(recordingContext,
texture->GetAllSubresources());
}

View File

@ -71,7 +71,7 @@ namespace dawn_native { namespace vulkan {
if (usage & wgpu::TextureUsage::Storage) {
flags |= VK_ACCESS_SHADER_READ_BIT | VK_ACCESS_SHADER_WRITE_BIT;
}
if (usage & wgpu::TextureUsage::OutputAttachment) {
if (usage & wgpu::TextureUsage::RenderAttachment) {
if (format.HasDepthOrStencil()) {
flags |= VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_READ_BIT |
VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_WRITE_BIT;
@ -130,7 +130,7 @@ namespace dawn_native { namespace vulkan {
case wgpu::TextureUsage::Storage:
case kReadonlyStorageTexture:
return VK_IMAGE_LAYOUT_GENERAL;
case wgpu::TextureUsage::OutputAttachment:
case wgpu::TextureUsage::RenderAttachment:
if (format.HasDepthOrStencil()) {
return VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL;
} else {
@ -168,7 +168,7 @@ namespace dawn_native { namespace vulkan {
flags |=
VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT | VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT;
}
if (usage & wgpu::TextureUsage::OutputAttachment) {
if (usage & wgpu::TextureUsage::RenderAttachment) {
if (format.HasDepthOrStencil()) {
flags |= VK_PIPELINE_STAGE_EARLY_FRAGMENT_TESTS_BIT |
VK_PIPELINE_STAGE_LATE_FRAGMENT_TESTS_BIT;
@ -395,7 +395,7 @@ namespace dawn_native { namespace vulkan {
if (usage & wgpu::TextureUsage::Storage) {
flags |= VK_IMAGE_USAGE_STORAGE_BIT;
}
if (usage & wgpu::TextureUsage::OutputAttachment) {
if (usage & wgpu::TextureUsage::RenderAttachment) {
if (format.HasDepthOrStencil()) {
flags |= VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT;
} else {

View File

@ -311,7 +311,7 @@ source_set("dawn_end2end_tests_sources") {
"end2end/ScissorTests.cpp",
"end2end/ShaderFloat16Tests.cpp",
"end2end/StorageTextureTests.cpp",
"end2end/SubresourceOutputAttachmentTests.cpp",
"end2end/SubresourceRenderAttachmentTests.cpp",
"end2end/TextureFormatTests.cpp",
"end2end/TextureSubresourceTests.cpp",
"end2end/TextureViewTests.cpp",

View File

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

View File

@ -59,7 +59,7 @@ class ClipSpaceTest : public DawnTest {
textureDescriptor.dimension = wgpu::TextureDimension::e2D;
textureDescriptor.format = format;
textureDescriptor.usage =
wgpu::TextureUsage::OutputAttachment | wgpu::TextureUsage::CopySrc;
wgpu::TextureUsage::RenderAttachment | wgpu::TextureUsage::CopySrc;
textureDescriptor.mipLevelCount = 1;
textureDescriptor.sampleCount = 1;
textureDescriptor.size = {kSize, kSize, 1};

View File

@ -751,7 +751,7 @@ TEST_P(ColorStateTest, IndependentColorState) {
descriptor.sampleCount = 1;
descriptor.format = wgpu::TextureFormat::RGBA8Unorm;
descriptor.mipLevelCount = 1;
descriptor.usage = wgpu::TextureUsage::OutputAttachment | wgpu::TextureUsage::CopySrc;
descriptor.usage = wgpu::TextureUsage::RenderAttachment | wgpu::TextureUsage::CopySrc;
for (uint32_t i = 0; i < 4; ++i) {
renderTargets[i] = device.CreateTexture(&descriptor);

View File

@ -135,7 +135,7 @@ TEST_P(CreateReadyPipelineTest, CreateComputePipelineFailed) {
// Verify the basic use of CreateReadyRenderPipeline() works on all backends.
TEST_P(CreateReadyPipelineTest, BasicUseOfCreateReadyRenderPipeline) {
constexpr wgpu::TextureFormat kOutputAttachmentFormat = wgpu::TextureFormat::RGBA8Unorm;
constexpr wgpu::TextureFormat kRenderAttachmentFormat = wgpu::TextureFormat::RGBA8Unorm;
const char* vertexShader = R"(
#version 450
@ -157,7 +157,7 @@ TEST_P(CreateReadyPipelineTest, BasicUseOfCreateReadyRenderPipeline) {
utils::CreateShaderModule(device, utils::SingleShaderStage::Fragment, fragmentShader);
renderPipelineDescriptor.vertexStage.module = vsModule;
renderPipelineDescriptor.cFragmentStage.module = fsModule;
renderPipelineDescriptor.cColorStates[0].format = kOutputAttachmentFormat;
renderPipelineDescriptor.cColorStates[0].format = kRenderAttachmentFormat;
renderPipelineDescriptor.primitiveTopology = wgpu::PrimitiveTopology::PointList;
device.CreateReadyRenderPipeline(
@ -175,8 +175,8 @@ TEST_P(CreateReadyPipelineTest, BasicUseOfCreateReadyRenderPipeline) {
wgpu::TextureDescriptor textureDescriptor;
textureDescriptor.size = {1, 1, 1};
textureDescriptor.format = kOutputAttachmentFormat;
textureDescriptor.usage = wgpu::TextureUsage::OutputAttachment | wgpu::TextureUsage::CopySrc;
textureDescriptor.format = kRenderAttachmentFormat;
textureDescriptor.usage = wgpu::TextureUsage::RenderAttachment | wgpu::TextureUsage::CopySrc;
wgpu::Texture outputTexture = device.CreateTexture(&textureDescriptor);
utils::ComboRenderPassDescriptor renderPassDescriptor({outputTexture.CreateView()});
@ -212,7 +212,7 @@ TEST_P(CreateReadyPipelineTest, BasicUseOfCreateReadyRenderPipeline) {
TEST_P(CreateReadyPipelineTest, CreateRenderPipelineFailed) {
DAWN_SKIP_TEST_IF(IsDawnValidationSkipped());
constexpr wgpu::TextureFormat kOutputAttachmentFormat = wgpu::TextureFormat::Depth32Float;
constexpr wgpu::TextureFormat kRenderAttachmentFormat = wgpu::TextureFormat::Depth32Float;
const char* vertexShader = R"(
#version 450
@ -234,7 +234,7 @@ TEST_P(CreateReadyPipelineTest, CreateRenderPipelineFailed) {
utils::CreateShaderModule(device, utils::SingleShaderStage::Fragment, fragmentShader);
renderPipelineDescriptor.vertexStage.module = vsModule;
renderPipelineDescriptor.cFragmentStage.module = fsModule;
renderPipelineDescriptor.cColorStates[0].format = kOutputAttachmentFormat;
renderPipelineDescriptor.cColorStates[0].format = kRenderAttachmentFormat;
renderPipelineDescriptor.primitiveTopology = wgpu::PrimitiveTopology::PointList;
device.CreateReadyRenderPipeline(

View File

@ -63,7 +63,7 @@ class CullingTest : public DawnTest {
textureDescriptor.dimension = wgpu::TextureDimension::e2D;
textureDescriptor.format = format;
textureDescriptor.usage =
wgpu::TextureUsage::OutputAttachment | wgpu::TextureUsage::CopySrc;
wgpu::TextureUsage::RenderAttachment | wgpu::TextureUsage::CopySrc;
textureDescriptor.mipLevelCount = 1;
textureDescriptor.sampleCount = 1;
textureDescriptor.size = {kSize, kSize, 1};

View File

@ -65,7 +65,7 @@ namespace {
baseDawnDescriptor.sampleCount = 1;
baseDawnDescriptor.mipLevelCount = 1;
baseDawnDescriptor.usage = wgpu::TextureUsage::Sampled | wgpu::TextureUsage::CopySrc |
wgpu::TextureUsage::OutputAttachment |
wgpu::TextureUsage::RenderAttachment |
wgpu::TextureUsage::CopyDst;
baseD3dDescriptor.Width = kTestWidth;

View File

@ -71,7 +71,7 @@ class DepthBiasTests : public DawnTest {
wgpu::TextureDescriptor descriptor;
descriptor.size = {kRTSize, kRTSize, 1};
descriptor.format = depthFormat;
descriptor.usage = wgpu::TextureUsage::OutputAttachment | wgpu::TextureUsage::CopySrc;
descriptor.usage = wgpu::TextureUsage::RenderAttachment | wgpu::TextureUsage::CopySrc;
mDepthTexture = device.CreateTexture(&descriptor);
}
@ -79,7 +79,7 @@ class DepthBiasTests : public DawnTest {
wgpu::TextureDescriptor descriptor;
descriptor.size = {kRTSize, kRTSize, 1};
descriptor.format = wgpu::TextureFormat::RGBA8Unorm;
descriptor.usage = wgpu::TextureUsage::OutputAttachment | wgpu::TextureUsage::CopySrc;
descriptor.usage = wgpu::TextureUsage::RenderAttachment | wgpu::TextureUsage::CopySrc;
mRenderTarget = device.CreateTexture(&descriptor);
}

View File

@ -50,14 +50,14 @@ class DepthSamplingTest : public DawnTest {
mTextureUploadBuffer = device.CreateBuffer(&textureUploadDesc);
wgpu::TextureDescriptor inputTextureDesc;
inputTextureDesc.usage = wgpu::TextureUsage::Sampled | wgpu::TextureUsage::OutputAttachment;
inputTextureDesc.usage = wgpu::TextureUsage::Sampled | wgpu::TextureUsage::RenderAttachment;
inputTextureDesc.size = {1, 1, 1};
inputTextureDesc.format = wgpu::TextureFormat::Depth32Float;
mInputTexture = device.CreateTexture(&inputTextureDesc);
wgpu::TextureDescriptor outputTextureDesc;
outputTextureDesc.usage =
wgpu::TextureUsage::OutputAttachment | wgpu::TextureUsage::CopySrc;
wgpu::TextureUsage::RenderAttachment | wgpu::TextureUsage::CopySrc;
outputTextureDesc.size = {1, 1, 1};
outputTextureDesc.format = wgpu::TextureFormat::R32Float;
mOutputTexture = device.CreateTexture(&outputTextureDesc);

View File

@ -155,7 +155,7 @@ class DepthStencilCopyTests : public DawnTest {
wgpu::TextureUsage usage,
uint32_t mipLevel = 0) {
wgpu::Texture src = CreateDepthStencilTexture(
width, height, wgpu::TextureUsage::OutputAttachment | wgpu::TextureUsage::CopySrc,
width, height, wgpu::TextureUsage::RenderAttachment | wgpu::TextureUsage::CopySrc,
mipLevel + 1);
wgpu::Texture dst = CreateDepthStencilTexture(
@ -193,7 +193,7 @@ class DepthStencilCopyTests : public DawnTest {
wgpu::TextureDescriptor colorTexDesc = {};
colorTexDesc.size = {width, height, 1};
colorTexDesc.format = wgpu::TextureFormat::R32Uint;
colorTexDesc.usage = wgpu::TextureUsage::OutputAttachment | wgpu::TextureUsage::CopySrc;
colorTexDesc.usage = wgpu::TextureUsage::RenderAttachment | wgpu::TextureUsage::CopySrc;
wgpu::Texture colorTexture = device.CreateTexture(&colorTexDesc);
// Make a sampleable texture to store the depth data. We'll sample this in the
@ -306,7 +306,7 @@ TEST_P(DepthStencilCopyTests, FromDepthAspect) {
constexpr uint32_t kHeight = 4;
wgpu::Texture depthTexture = CreateDepthTexture(
kWidth, kHeight, wgpu::TextureUsage::OutputAttachment | wgpu::TextureUsage::CopySrc);
kWidth, kHeight, wgpu::TextureUsage::RenderAttachment | wgpu::TextureUsage::CopySrc);
InitializeDepthTextureRegion(depthTexture, 0.f, 0.3f);
@ -327,7 +327,7 @@ TEST_P(DepthStencilCopyTests, FromStencilAspect) {
constexpr uint32_t kHeight = 4;
wgpu::Texture depthStencilTexture = CreateDepthStencilTexture(
kWidth, kHeight, wgpu::TextureUsage::OutputAttachment | wgpu::TextureUsage::CopySrc);
kWidth, kHeight, wgpu::TextureUsage::RenderAttachment | wgpu::TextureUsage::CopySrc);
InitializeDepthStencilTextureRegion(depthStencilTexture, 0.f, 0.3f, 0u, 1u);
@ -349,7 +349,7 @@ TEST_P(DepthStencilCopyTests, FromNonZeroMipStencilAspect) {
DAWN_SKIP_TEST_IF(IsMetal() && IsIntel());
wgpu::Texture depthStencilTexture = CreateDepthStencilTexture(
9, 9, wgpu::TextureUsage::OutputAttachment | wgpu::TextureUsage::CopySrc, 2);
9, 9, wgpu::TextureUsage::RenderAttachment | wgpu::TextureUsage::CopySrc, 2);
InitializeDepthStencilTextureRegion(depthStencilTexture, 0.f, 0.3f, 0u, 1u, 1u);
@ -367,7 +367,7 @@ TEST_P(DepthStencilCopyTests, FromNonZeroMipStencilAspect) {
// Test copying the non-zero mip, depth-only aspect into a buffer.
TEST_P(DepthStencilCopyTests, FromNonZeroMipDepthAspect) {
wgpu::Texture depthTexture = CreateDepthTexture(
9, 9, wgpu::TextureUsage::OutputAttachment | wgpu::TextureUsage::CopySrc, 2);
9, 9, wgpu::TextureUsage::RenderAttachment | wgpu::TextureUsage::CopySrc, 2);
InitializeDepthTextureRegion(depthTexture, 0.f, 0.4f, 1);
@ -386,8 +386,8 @@ TEST_P(DepthStencilCopyTests, FromNonZeroMipDepthAspect) {
TEST_P(DepthStencilCopyTests, T2TBothAspectsThenCopyStencil) {
// TODO(enga): Figure out why this fails on MacOS Intel Iris.
// It passes on AMD Radeon Pro and Intel HD Graphics 630.
// Maybe has to do with the OutputAttachment usage. Notably, a later test
// T2TBothAspectsThenCopyNonRenderableStencil does not use OutputAttachment and works correctly.
// Maybe has to do with the RenderAttachment usage. Notably, a later test
// T2TBothAspectsThenCopyNonRenderableStencil does not use RenderAttachment and works correctly.
DAWN_SKIP_TEST_IF(IsMetal() && IsIntel());
constexpr uint32_t kWidth = 4;
@ -395,7 +395,7 @@ TEST_P(DepthStencilCopyTests, T2TBothAspectsThenCopyStencil) {
wgpu::Texture texture = CreateInitializeDepthStencilTextureAndCopyT2T(
0.1f, 0.3f, 1u, 3u, kWidth, kHeight,
wgpu::TextureUsage::CopySrc | wgpu::TextureUsage::OutputAttachment);
wgpu::TextureUsage::CopySrc | wgpu::TextureUsage::RenderAttachment);
// Check the stencil
std::vector<uint8_t> expectedData = {
@ -457,7 +457,7 @@ TEST_P(DepthStencilCopyTests, T2TBothAspectsThenCopyDepth) {
constexpr uint32_t kHeight = 4;
wgpu::Texture texture = CreateInitializeDepthStencilTextureAndCopyT2T(
0.1f, 0.3f, 1u, 3u, kWidth, kHeight, wgpu::TextureUsage::OutputAttachment);
0.1f, 0.3f, 1u, 3u, kWidth, kHeight, wgpu::TextureUsage::RenderAttachment);
// Check the depth
ExpectDepthData(texture, wgpu::TextureFormat::Depth24PlusStencil8, kWidth, kHeight, 0,
@ -472,7 +472,7 @@ TEST_P(DepthStencilCopyTests, T2TBothAspectsThenCopyDepth) {
// Test copying both aspects in a T2T copy, then copying only depth at a nonzero mip.
TEST_P(DepthStencilCopyTests, T2TBothAspectsThenCopyNonZeroMipDepth) {
wgpu::Texture texture = CreateInitializeDepthStencilTextureAndCopyT2T(
0.1f, 0.3f, 1u, 3u, 8, 8, wgpu::TextureUsage::OutputAttachment, 1);
0.1f, 0.3f, 1u, 3u, 8, 8, wgpu::TextureUsage::RenderAttachment, 1);
// Check the depth
ExpectDepthData(texture, wgpu::TextureFormat::Depth24PlusStencil8, 4, 4, 1,
@ -491,7 +491,7 @@ TEST_P(DepthStencilCopyTests, T2TBothAspectsThenCopyStencilThenDepth) {
wgpu::Texture texture = CreateInitializeDepthStencilTextureAndCopyT2T(
0.1f, 0.3f, 1u, 3u, kWidth, kHeight,
wgpu::TextureUsage::CopySrc | wgpu::TextureUsage::OutputAttachment);
wgpu::TextureUsage::CopySrc | wgpu::TextureUsage::RenderAttachment);
// Check the stencil
std::vector<uint8_t> expectedData = {
@ -527,7 +527,7 @@ TEST_P(DepthStencilCopyTests, T2TBothAspectsThenCopyDepthThenStencil) {
wgpu::Texture texture = CreateInitializeDepthStencilTextureAndCopyT2T(
0.1f, 0.3f, 1u, 3u, kWidth, kHeight,
wgpu::TextureUsage::CopySrc | wgpu::TextureUsage::OutputAttachment);
wgpu::TextureUsage::CopySrc | wgpu::TextureUsage::RenderAttachment);
// Check the depth
ExpectDepthData(texture, wgpu::TextureFormat::Depth24PlusStencil8, kWidth, kHeight, 0,
@ -568,7 +568,7 @@ TEST_P(DepthStencilCopyTests, ToStencilAspect) {
wgpu::Texture depthStencilTexture =
CreateDepthStencilTexture(kWidth, kHeight,
wgpu::TextureUsage::OutputAttachment |
wgpu::TextureUsage::RenderAttachment |
wgpu::TextureUsage::CopySrc | wgpu::TextureUsage::CopyDst);
{

View File

@ -34,7 +34,7 @@ class DepthStencilStateTest : public DawnTest {
renderTargetDescriptor.format = wgpu::TextureFormat::RGBA8Unorm;
renderTargetDescriptor.mipLevelCount = 1;
renderTargetDescriptor.usage =
wgpu::TextureUsage::OutputAttachment | wgpu::TextureUsage::CopySrc;
wgpu::TextureUsage::RenderAttachment | wgpu::TextureUsage::CopySrc;
renderTarget = device.CreateTexture(&renderTargetDescriptor);
renderTargetView = renderTarget.CreateView();
@ -47,7 +47,7 @@ class DepthStencilStateTest : public DawnTest {
depthDescriptor.sampleCount = 1;
depthDescriptor.format = wgpu::TextureFormat::Depth24PlusStencil8;
depthDescriptor.mipLevelCount = 1;
depthDescriptor.usage = wgpu::TextureUsage::OutputAttachment;
depthDescriptor.usage = wgpu::TextureUsage::RenderAttachment;
depthTexture = device.CreateTexture(&depthDescriptor);
depthTextureView = depthTexture.CreateView();

View File

@ -226,7 +226,7 @@ TEST_P(DeviceLostTest, CreateTextureFails) {
descriptor.size.depth = 1;
descriptor.mipLevelCount = 1;
descriptor.dimension = wgpu::TextureDimension::e2D;
descriptor.usage = wgpu::TextureUsage::OutputAttachment;
descriptor.usage = wgpu::TextureUsage::RenderAttachment;
ASSERT_DEVICE_ERROR(device.CreateTexture(&descriptor));
}

View File

@ -123,7 +123,7 @@ class IOSurfaceValidationTests : public IOSurfaceTestBase {
descriptor.size = {10, 10, 1};
descriptor.sampleCount = 1;
descriptor.mipLevelCount = 1;
descriptor.usage = wgpu::TextureUsage::OutputAttachment;
descriptor.usage = wgpu::TextureUsage::RenderAttachment;
}
protected:
@ -339,7 +339,7 @@ class IOSurfaceUsageTests : public IOSurfaceTestBase {
textureDescriptor.size = {1, 1, 1};
textureDescriptor.sampleCount = 1;
textureDescriptor.mipLevelCount = 1;
textureDescriptor.usage = wgpu::TextureUsage::OutputAttachment;
textureDescriptor.usage = wgpu::TextureUsage::RenderAttachment;
wgpu::Texture ioSurfaceTexture = WrapIOSurface(&textureDescriptor, ioSurface, 0);
wgpu::TextureView ioSurfaceView = ioSurfaceTexture.CreateView();
@ -463,7 +463,7 @@ TEST_P(IOSurfaceUsageTests, UninitializedTextureIsCleared) {
textureDescriptor.size = {1, 1, 1};
textureDescriptor.sampleCount = 1;
textureDescriptor.mipLevelCount = 1;
textureDescriptor.usage = wgpu::TextureUsage::OutputAttachment | wgpu::TextureUsage::CopySrc;
textureDescriptor.usage = wgpu::TextureUsage::RenderAttachment | wgpu::TextureUsage::CopySrc;
// wrap ioSurface and ensure color is not visible when isInitialized set to false
wgpu::Texture ioSurfaceTexture = WrapIOSurface(&textureDescriptor, ioSurface.get(), 0, false);

View File

@ -27,12 +27,12 @@ class MultisampledRenderingTest : public DawnTest {
}
void InitTexturesForTest() {
mMultisampledColorTexture = CreateTextureForOutputAttachment(kColorFormat, kSampleCount);
mMultisampledColorTexture = CreateTextureForRenderAttachment(kColorFormat, kSampleCount);
mMultisampledColorView = mMultisampledColorTexture.CreateView();
mResolveTexture = CreateTextureForOutputAttachment(kColorFormat, 1);
mResolveTexture = CreateTextureForRenderAttachment(kColorFormat, 1);
mResolveView = mResolveTexture.CreateView();
mDepthStencilTexture = CreateTextureForOutputAttachment(kDepthStencilFormat, kSampleCount);
mDepthStencilTexture = CreateTextureForRenderAttachment(kDepthStencilFormat, kSampleCount);
mDepthStencilView = mDepthStencilTexture.CreateView();
}
@ -89,7 +89,7 @@ class MultisampledRenderingTest : public DawnTest {
alphaToCoverageEnabled);
}
wgpu::Texture CreateTextureForOutputAttachment(wgpu::TextureFormat format,
wgpu::Texture CreateTextureForRenderAttachment(wgpu::TextureFormat format,
uint32_t sampleCount,
uint32_t mipLevelCount = 1,
uint32_t arrayLayerCount = 1) {
@ -101,7 +101,7 @@ class MultisampledRenderingTest : public DawnTest {
descriptor.sampleCount = sampleCount;
descriptor.format = format;
descriptor.mipLevelCount = mipLevelCount;
descriptor.usage = wgpu::TextureUsage::OutputAttachment | wgpu::TextureUsage::CopySrc;
descriptor.usage = wgpu::TextureUsage::RenderAttachment | wgpu::TextureUsage::CopySrc;
return device.CreateTexture(&descriptor);
}
@ -395,8 +395,8 @@ TEST_P(MultisampledRenderingTest, ResolveIntoMultipleResolveTargets) {
DAWN_SKIP_TEST_IF(IsD3D12() && IsNvidia() && IsBackendValidationEnabled());
wgpu::TextureView multisampledColorView2 =
CreateTextureForOutputAttachment(kColorFormat, kSampleCount).CreateView();
wgpu::Texture resolveTexture2 = CreateTextureForOutputAttachment(kColorFormat, 1);
CreateTextureForRenderAttachment(kColorFormat, kSampleCount).CreateView();
wgpu::Texture resolveTexture2 = CreateTextureForRenderAttachment(kColorFormat, 1);
wgpu::TextureView resolveView2 = resolveTexture2.CreateView();
wgpu::CommandEncoder commandEncoder = device.CreateCommandEncoder();
@ -438,7 +438,7 @@ TEST_P(MultisampledRenderingTest, ResolveOneMultisampledTextureTwice) {
constexpr wgpu::Color kGreen = {0.0f, 0.8f, 0.0f, 0.8f};
wgpu::Texture resolveTexture2 = CreateTextureForOutputAttachment(kColorFormat, 1);
wgpu::Texture resolveTexture2 = CreateTextureForRenderAttachment(kColorFormat, 1);
// In first render pass we draw a green triangle and specify mResolveView as the resolve target.
{
@ -483,7 +483,7 @@ TEST_P(MultisampledRenderingTest, ResolveIntoOneMipmapLevelOf2DTexture) {
textureViewDescriptor.baseMipLevel = kBaseMipLevel;
wgpu::Texture resolveTexture =
CreateTextureForOutputAttachment(kColorFormat, 1, kBaseMipLevel + 1, 1);
CreateTextureForRenderAttachment(kColorFormat, 1, kBaseMipLevel + 1, 1);
wgpu::TextureView resolveView = resolveTexture.CreateView(&textureViewDescriptor);
wgpu::CommandEncoder commandEncoder = device.CreateCommandEncoder();
@ -511,7 +511,7 @@ TEST_P(MultisampledRenderingTest, ResolveInto2DArrayTexture) {
DAWN_SKIP_TEST_IF(IsD3D12() && IsNvidia() && IsBackendValidationEnabled());
wgpu::TextureView multisampledColorView2 =
CreateTextureForOutputAttachment(kColorFormat, kSampleCount).CreateView();
CreateTextureForRenderAttachment(kColorFormat, kSampleCount).CreateView();
wgpu::TextureViewDescriptor baseTextureViewDescriptor;
baseTextureViewDescriptor.dimension = wgpu::TextureViewDimension::e2D;
@ -523,7 +523,7 @@ TEST_P(MultisampledRenderingTest, ResolveInto2DArrayTexture) {
constexpr uint32_t kBaseArrayLayer1 = 2;
constexpr uint32_t kBaseMipLevel1 = 0;
wgpu::Texture resolveTexture1 =
CreateTextureForOutputAttachment(kColorFormat, 1, kBaseMipLevel1 + 1, kBaseArrayLayer1 + 1);
CreateTextureForRenderAttachment(kColorFormat, 1, kBaseMipLevel1 + 1, kBaseArrayLayer1 + 1);
wgpu::TextureViewDescriptor resolveViewDescriptor1 = baseTextureViewDescriptor;
resolveViewDescriptor1.baseArrayLayer = kBaseArrayLayer1;
resolveViewDescriptor1.baseMipLevel = kBaseMipLevel1;
@ -534,7 +534,7 @@ TEST_P(MultisampledRenderingTest, ResolveInto2DArrayTexture) {
constexpr uint32_t kBaseArrayLayer2 = 5;
constexpr uint32_t kBaseMipLevel2 = 3;
wgpu::Texture resolveTexture2 =
CreateTextureForOutputAttachment(kColorFormat, 1, kBaseMipLevel2 + 1, kBaseArrayLayer2 + 1);
CreateTextureForRenderAttachment(kColorFormat, 1, kBaseMipLevel2 + 1, kBaseArrayLayer2 + 1);
wgpu::TextureViewDescriptor resolveViewDescriptor2 = baseTextureViewDescriptor;
resolveViewDescriptor2.baseArrayLayer = kBaseArrayLayer2;
resolveViewDescriptor2.baseMipLevel = kBaseMipLevel2;
@ -629,8 +629,8 @@ TEST_P(MultisampledRenderingTest, ResolveInto2DTextureWithEmptyFinalSampleMask)
// mask.
TEST_P(MultisampledRenderingTest, ResolveIntoMultipleResolveTargetsWithSampleMask) {
wgpu::TextureView multisampledColorView2 =
CreateTextureForOutputAttachment(kColorFormat, kSampleCount).CreateView();
wgpu::Texture resolveTexture2 = CreateTextureForOutputAttachment(kColorFormat, 1);
CreateTextureForRenderAttachment(kColorFormat, kSampleCount).CreateView();
wgpu::Texture resolveTexture2 = CreateTextureForRenderAttachment(kColorFormat, 1);
wgpu::TextureView resolveView2 = resolveTexture2.CreateView();
// The first and fourth samples are included,
@ -774,8 +774,8 @@ TEST_P(MultisampledRenderingTest, ResolveInto2DTextureWithSampleMaskAndShaderOut
// shader-output mask.
TEST_P(MultisampledRenderingTest, ResolveIntoMultipleResolveTargetsWithShaderOutputMask) {
wgpu::TextureView multisampledColorView2 =
CreateTextureForOutputAttachment(kColorFormat, kSampleCount).CreateView();
wgpu::Texture resolveTexture2 = CreateTextureForOutputAttachment(kColorFormat, 1);
CreateTextureForRenderAttachment(kColorFormat, kSampleCount).CreateView();
wgpu::Texture resolveTexture2 = CreateTextureForRenderAttachment(kColorFormat, 1);
wgpu::TextureView resolveView2 = resolveTexture2.CreateView();
wgpu::CommandEncoder commandEncoder = device.CreateCommandEncoder();
@ -871,8 +871,8 @@ TEST_P(MultisampledRenderingTest, ResolveInto2DTextureWithAlphaToCoverage) {
// component of the first color output attachment.
TEST_P(MultisampledRenderingTest, ResolveIntoMultipleResolveTargetsWithAlphaToCoverage) {
wgpu::TextureView multisampledColorView2 =
CreateTextureForOutputAttachment(kColorFormat, kSampleCount).CreateView();
wgpu::Texture resolveTexture2 = CreateTextureForOutputAttachment(kColorFormat, 1);
CreateTextureForRenderAttachment(kColorFormat, kSampleCount).CreateView();
wgpu::Texture resolveTexture2 = CreateTextureForRenderAttachment(kColorFormat, 1);
wgpu::TextureView resolveView2 = resolveTexture2.CreateView();
constexpr uint32_t kSampleMask = 0xFFFFFFFF;
constexpr float kMSAACoverage = 0.50f;

View File

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

View File

@ -37,7 +37,7 @@ TEST_P(NonzeroTextureCreationTests, TextureCreationClears) {
descriptor.sampleCount = 1;
descriptor.format = wgpu::TextureFormat::RGBA8Unorm;
descriptor.mipLevelCount = 1;
descriptor.usage = wgpu::TextureUsage::OutputAttachment | wgpu::TextureUsage::CopySrc;
descriptor.usage = wgpu::TextureUsage::RenderAttachment | wgpu::TextureUsage::CopySrc;
wgpu::Texture texture = device.CreateTexture(&descriptor);
RGBA8 filled(255, 255, 255, 255);
@ -56,7 +56,7 @@ TEST_P(NonzeroTextureCreationTests, Depth32TextureCreationDepthClears) {
descriptor.size.depth = 1;
descriptor.sampleCount = 1;
descriptor.mipLevelCount = 1;
descriptor.usage = wgpu::TextureUsage::OutputAttachment | wgpu::TextureUsage::CopySrc;
descriptor.usage = wgpu::TextureUsage::RenderAttachment | wgpu::TextureUsage::CopySrc;
descriptor.format = wgpu::TextureFormat::Depth32Float;
// We can only really test Depth32Float here because Depth24Plus(Stencil8)? may be in an unknown
@ -79,7 +79,7 @@ TEST_P(NonzeroTextureCreationTests, MipMapClears) {
descriptor.sampleCount = 1;
descriptor.format = wgpu::TextureFormat::RGBA8Unorm;
descriptor.mipLevelCount = mipLevels;
descriptor.usage = wgpu::TextureUsage::OutputAttachment | wgpu::TextureUsage::CopySrc;
descriptor.usage = wgpu::TextureUsage::RenderAttachment | wgpu::TextureUsage::CopySrc;
wgpu::Texture texture = device.CreateTexture(&descriptor);
std::vector<RGBA8> expected;
@ -103,7 +103,7 @@ TEST_P(NonzeroTextureCreationTests, ArrayLayerClears) {
descriptor.sampleCount = 1;
descriptor.format = wgpu::TextureFormat::RGBA8Unorm;
descriptor.mipLevelCount = 1;
descriptor.usage = wgpu::TextureUsage::OutputAttachment | wgpu::TextureUsage::CopySrc;
descriptor.usage = wgpu::TextureUsage::RenderAttachment | wgpu::TextureUsage::CopySrc;
wgpu::Texture texture = device.CreateTexture(&descriptor);
std::vector<RGBA8> expected;
@ -192,7 +192,7 @@ TEST_P(NonzeroTextureCreationTests, AllSubresourcesFilled) {
baseDescriptor.sampleCount = 1;
baseDescriptor.format = wgpu::TextureFormat::RGBA8Unorm;
baseDescriptor.mipLevelCount = 1;
baseDescriptor.usage = wgpu::TextureUsage::OutputAttachment | wgpu::TextureUsage::CopySrc;
baseDescriptor.usage = wgpu::TextureUsage::RenderAttachment | wgpu::TextureUsage::CopySrc;
RGBA8 filled(255, 255, 255, 255);

View File

@ -64,7 +64,7 @@ class RenderPassLoadOpTests : public DawnTest {
descriptor.sampleCount = 1;
descriptor.format = wgpu::TextureFormat::RGBA8Unorm;
descriptor.mipLevelCount = 1;
descriptor.usage = wgpu::TextureUsage::OutputAttachment | wgpu::TextureUsage::CopySrc;
descriptor.usage = wgpu::TextureUsage::RenderAttachment | wgpu::TextureUsage::CopySrc;
renderTarget = device.CreateTexture(&descriptor);
renderTargetView = renderTarget.CreateView();
@ -105,7 +105,7 @@ class RenderPassLoadOpTests : public DawnTest {
textureDescriptor.dimension = wgpu::TextureDimension::e2D;
textureDescriptor.size = kTextureSize;
textureDescriptor.usage =
wgpu::TextureUsage::OutputAttachment | wgpu::TextureUsage::CopySrc;
wgpu::TextureUsage::RenderAttachment | wgpu::TextureUsage::CopySrc;
textureDescriptor.format = format;
wgpu::Texture texture = device.CreateTexture(&textureDescriptor);

View File

@ -60,7 +60,7 @@ class RenderPassTest : public DawnTest {
descriptor.sampleCount = 1;
descriptor.format = kFormat;
descriptor.mipLevelCount = 1;
descriptor.usage = wgpu::TextureUsage::OutputAttachment | wgpu::TextureUsage::CopySrc;
descriptor.usage = wgpu::TextureUsage::RenderAttachment | wgpu::TextureUsage::CopySrc;
return device.CreateTexture(&descriptor);
}

View File

@ -495,7 +495,7 @@ class StorageTextureTests : public DawnTest {
utils::ComboRenderPipelineDescriptor desc(device);
desc.vertexStage.module = vsModule;
desc.cFragmentStage.module = fsModule;
desc.cColorStates[0].format = kOutputAttachmentFormat;
desc.cColorStates[0].format = kRenderAttachmentFormat;
desc.primitiveTopology = wgpu::PrimitiveTopology::PointList;
return device.CreateRenderPipeline(&desc);
}
@ -509,8 +509,8 @@ class StorageTextureTests : public DawnTest {
// Clear the output attachment to red at the beginning of the render pass.
wgpu::Texture outputTexture =
CreateTexture(kOutputAttachmentFormat,
wgpu::TextureUsage::OutputAttachment | wgpu::TextureUsage::CopySrc, 1, 1);
CreateTexture(kRenderAttachmentFormat,
wgpu::TextureUsage::RenderAttachment | wgpu::TextureUsage::CopySrc, 1, 1);
utils::ComboRenderPassDescriptor renderPassDescriptor({outputTexture.CreateView()});
renderPassDescriptor.cColorAttachments[0].loadOp = wgpu::LoadOp::Clear;
renderPassDescriptor.cColorAttachments[0].clearColor = {1.f, 0.f, 0.f, 1.f};
@ -570,8 +570,8 @@ class StorageTextureTests : public DawnTest {
// TODO(jiawei.shao@intel.com): remove the output attachment when Dawn supports beginning a
// render pass with no attachments.
wgpu::Texture dummyOutputTexture =
CreateTexture(kOutputAttachmentFormat,
wgpu::TextureUsage::OutputAttachment | wgpu::TextureUsage::CopySrc, 1, 1);
CreateTexture(kRenderAttachmentFormat,
wgpu::TextureUsage::RenderAttachment | wgpu::TextureUsage::CopySrc, 1, 1);
utils::ComboRenderPassDescriptor renderPassDescriptor({dummyOutputTexture.CreateView()});
wgpu::RenderPassEncoder renderPassEncoder = encoder.BeginRenderPass(&renderPassDescriptor);
renderPassEncoder.SetBindGroup(0, bindGroup);
@ -660,7 +660,7 @@ class StorageTextureTests : public DawnTest {
static constexpr size_t kWidth = 4u;
static constexpr size_t kHeight = 4u;
static constexpr wgpu::TextureFormat kOutputAttachmentFormat = wgpu::TextureFormat::RGBA8Unorm;
static constexpr wgpu::TextureFormat kRenderAttachmentFormat = wgpu::TextureFormat::RGBA8Unorm;
const char* kSimpleVertexShader = R"(
#version 450

View File

@ -19,7 +19,7 @@
#include "utils/WGPUHelpers.h"
// Test that rendering to a subresource of a texture works.
class SubresourceOutputAttachmentTest : public DawnTest {
class SubresourceRenderAttachmentTest : public DawnTest {
constexpr static uint32_t kRTSize = 2;
protected:
@ -125,7 +125,7 @@ class SubresourceOutputAttachmentTest : public DawnTest {
renderTargetDesc.sampleCount = 1;
renderTargetDesc.format = format;
renderTargetDesc.mipLevelCount = kMipLevelCount;
renderTargetDesc.usage = wgpu::TextureUsage::OutputAttachment | wgpu::TextureUsage::CopySrc;
renderTargetDesc.usage = wgpu::TextureUsage::RenderAttachment | wgpu::TextureUsage::CopySrc;
wgpu::Texture renderTarget = device.CreateTexture(&renderTargetDesc);
@ -139,22 +139,22 @@ class SubresourceOutputAttachmentTest : public DawnTest {
};
// Test rendering into a subresource of a color texture
TEST_P(SubresourceOutputAttachmentTest, ColorTexture) {
TEST_P(SubresourceRenderAttachmentTest, ColorTexture) {
DoTest(Type::Color);
}
// Test rendering into a subresource of a depth texture
TEST_P(SubresourceOutputAttachmentTest, DepthTexture) {
TEST_P(SubresourceRenderAttachmentTest, DepthTexture) {
DoTest(Type::Depth);
}
// Test rendering into a subresource of a stencil texture
// TODO(crbug.com/dawn/439): sample / copy of the stencil aspect.
TEST_P(SubresourceOutputAttachmentTest, DISABLED_StencilTexture) {
TEST_P(SubresourceRenderAttachmentTest, DISABLED_StencilTexture) {
DoTest(Type::Stencil);
}
DAWN_INSTANTIATE_TEST(SubresourceOutputAttachmentTest,
DAWN_INSTANTIATE_TEST(SubresourceRenderAttachmentTest,
D3D12Backend(),
D3D12Backend({}, {"use_d3d12_render_pass"}),
MetalBackend(),

View File

@ -53,7 +53,7 @@ class SwapChainTests : public DawnTest {
baseDescriptor.width = width;
baseDescriptor.height = height;
baseDescriptor.usage = wgpu::TextureUsage::OutputAttachment;
baseDescriptor.usage = wgpu::TextureUsage::RenderAttachment;
baseDescriptor.format = wgpu::TextureFormat::BGRA8Unorm;
baseDescriptor.presentMode = wgpu::PresentMode::Mailbox;
}

View File

@ -46,7 +46,7 @@ class SwapChainValidationTests : public DawnTest {
goodDescriptor.width = 1;
goodDescriptor.height = 1;
goodDescriptor.usage = wgpu::TextureUsage::OutputAttachment;
goodDescriptor.usage = wgpu::TextureUsage::RenderAttachment;
goodDescriptor.format = wgpu::TextureFormat::BGRA8Unorm;
goodDescriptor.presentMode = wgpu::PresentMode::Mailbox;
@ -69,12 +69,12 @@ class SwapChainValidationTests : public DawnTest {
wgpu::SwapChainDescriptor goodDescriptor;
wgpu::SwapChainDescriptor badDescriptor;
// Checks that an OutputAttachment view is an error by trying to create a render pass on it.
// Checks that an RenderAttachment view is an error by trying to create a render pass on it.
void CheckTextureViewIsError(wgpu::TextureView view) {
CheckTextureView(view, true, false);
}
// Checks that an OutputAttachment view is an error by trying to submit a render pass on it.
// Checks that an RenderAttachment view is an error by trying to submit a render pass on it.
void CheckTextureViewIsDestroyed(wgpu::TextureView view) {
CheckTextureView(view, false, true);
}
@ -149,7 +149,7 @@ TEST_P(SwapChainValidationTests, InvalidCreationSize) {
}
}
// Checks that the creation usage must be OutputAttachment
// Checks that the creation usage must be RenderAttachment
TEST_P(SwapChainValidationTests, InvalidCreationUsage) {
wgpu::SwapChainDescriptor desc = goodDescriptor;
desc.usage = wgpu::TextureUsage::Sampled;
@ -245,7 +245,7 @@ TEST_P(SwapChainValidationTests, ReturnedViewCharacteristics) {
// Create a second texture to be used as render pass attachment. Validation will check that the
// size of the view matches the size of this texture.
wgpu::TextureDescriptor textureDesc;
textureDesc.usage = wgpu::TextureUsage::OutputAttachment;
textureDesc.usage = wgpu::TextureUsage::RenderAttachment;
textureDesc.dimension = wgpu::TextureDimension::e2D;
textureDesc.size = {1, 1, 1};
textureDesc.format = wgpu::TextureFormat::R8Unorm;
@ -257,7 +257,7 @@ TEST_P(SwapChainValidationTests, ReturnedViewCharacteristics) {
wgpu::TextureView view = swapchain.GetCurrentTextureView();
// Validation will also check the dimension of the view is 2D, and it's usage contains
// OutputAttachment
// RenderAttachment
utils::ComboRenderPassDescriptor renderPassDesc({view, secondTexture.CreateView()});
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
wgpu::RenderPassEncoder pass = encoder.BeginRenderPass(&renderPassDesc);

View File

@ -215,7 +215,7 @@ class TextureFormatTest : public DawnTest {
ASSERT(expectedRenderDataSize == width * renderFormatInfo.texelByteSize);
wgpu::TextureDescriptor renderTargetDesc;
renderTargetDesc.usage = wgpu::TextureUsage::CopySrc | wgpu::TextureUsage::OutputAttachment;
renderTargetDesc.usage = wgpu::TextureUsage::CopySrc | wgpu::TextureUsage::RenderAttachment;
renderTargetDesc.size = {width, 1, 1};
renderTargetDesc.format = renderFormatInfo.format;

View File

@ -140,7 +140,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::OutputAttachment |
wgpu::TextureUsage::Sampled | wgpu::TextureUsage::RenderAttachment |
wgpu::TextureUsage::CopySrc);
// Create two views on different mipmap levels.
@ -166,7 +166,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::OutputAttachment |
wgpu::TextureUsage::Sampled | wgpu::TextureUsage::RenderAttachment |
wgpu::TextureUsage::CopySrc);
// Create two views on different layers

View File

@ -462,7 +462,7 @@ class TextureViewRenderingTest : public DawnTest {
ASSERT_LT(textureViewBaseLevel, levelCount);
constexpr wgpu::TextureUsage kUsage =
wgpu::TextureUsage::OutputAttachment | wgpu::TextureUsage::CopySrc;
wgpu::TextureUsage::RenderAttachment | wgpu::TextureUsage::CopySrc;
wgpu::Texture texture = Create2DTexture(device, textureWidthLevel0, textureHeightLevel0,
layerCount, levelCount, kUsage);

View File

@ -123,7 +123,7 @@ class TextureZeroInitTest : public DawnTest {
// This tests that the code path of CopyTextureToBuffer clears correctly to Zero after first usage
TEST_P(TextureZeroInitTest, CopyTextureToBufferSource) {
wgpu::TextureDescriptor descriptor = CreateTextureDescriptor(
1, 1, wgpu::TextureUsage::OutputAttachment | wgpu::TextureUsage::CopySrc, kColorFormat);
1, 1, wgpu::TextureUsage::RenderAttachment | wgpu::TextureUsage::CopySrc, kColorFormat);
wgpu::Texture texture = device.CreateTexture(&descriptor);
// Texture's first usage is in EXPECT_PIXEL_RGBA8_EQ's call to CopyTextureToBuffer
@ -140,7 +140,7 @@ TEST_P(TextureZeroInitTest, CopyMultipleTextureArrayLayersToBufferSource) {
constexpr uint32_t kArrayLayers = 6u;
const wgpu::TextureDescriptor descriptor = CreateTextureDescriptor(
1, kArrayLayers, wgpu::TextureUsage::OutputAttachment | wgpu::TextureUsage::CopySrc,
1, kArrayLayers, wgpu::TextureUsage::RenderAttachment | wgpu::TextureUsage::CopySrc,
kColorFormat);
wgpu::Texture texture = device.CreateTexture(&descriptor);
@ -183,7 +183,7 @@ TEST_P(TextureZeroInitTest, RenderingMipMapClearsToZero) {
uint32_t layerCount = 1;
wgpu::TextureDescriptor descriptor = CreateTextureDescriptor(
levelCount, layerCount, wgpu::TextureUsage::OutputAttachment | wgpu::TextureUsage::CopySrc,
levelCount, layerCount, wgpu::TextureUsage::RenderAttachment | wgpu::TextureUsage::CopySrc,
kColorFormat);
wgpu::Texture texture = device.CreateTexture(&descriptor);
@ -228,7 +228,7 @@ TEST_P(TextureZeroInitTest, RenderingArrayLayerClearsToZero) {
uint32_t layerCount = 4;
wgpu::TextureDescriptor descriptor = CreateTextureDescriptor(
levelCount, layerCount, wgpu::TextureUsage::OutputAttachment | wgpu::TextureUsage::CopySrc,
levelCount, layerCount, wgpu::TextureUsage::RenderAttachment | wgpu::TextureUsage::CopySrc,
kColorFormat);
wgpu::Texture texture = device.CreateTexture(&descriptor);
@ -374,7 +374,7 @@ TEST_P(TextureZeroInitTest, CopyTextureToTexture) {
wgpu::TextureDescriptor dstDescriptor =
CreateTextureDescriptor(1, 1,
wgpu::TextureUsage::OutputAttachment | wgpu::TextureUsage::CopyDst |
wgpu::TextureUsage::RenderAttachment | wgpu::TextureUsage::CopyDst |
wgpu::TextureUsage::CopySrc,
kColorFormat);
wgpu::Texture dstTexture = device.CreateTexture(&dstDescriptor);
@ -429,7 +429,7 @@ TEST_P(TextureZeroInitTest, CopyTextureToTextureHalf) {
wgpu::TextureDescriptor dstDescriptor =
CreateTextureDescriptor(1, 1,
wgpu::TextureUsage::OutputAttachment | wgpu::TextureUsage::CopyDst |
wgpu::TextureUsage::RenderAttachment | wgpu::TextureUsage::CopyDst |
wgpu::TextureUsage::CopySrc,
kColorFormat);
wgpu::Texture dstTexture = device.CreateTexture(&dstDescriptor);
@ -462,12 +462,12 @@ TEST_P(TextureZeroInitTest, RenderingLoadingDepth) {
wgpu::TextureDescriptor srcDescriptor =
CreateTextureDescriptor(1, 1,
wgpu::TextureUsage::CopySrc | wgpu::TextureUsage::CopyDst |
wgpu::TextureUsage::OutputAttachment,
wgpu::TextureUsage::RenderAttachment,
kColorFormat);
wgpu::Texture srcTexture = device.CreateTexture(&srcDescriptor);
wgpu::TextureDescriptor depthStencilDescriptor = CreateTextureDescriptor(
1, 1, wgpu::TextureUsage::OutputAttachment | wgpu::TextureUsage::CopySrc,
1, 1, wgpu::TextureUsage::RenderAttachment | wgpu::TextureUsage::CopySrc,
kDepthStencilFormat);
wgpu::Texture depthStencilTexture = device.CreateTexture(&depthStencilDescriptor);
@ -504,12 +504,12 @@ TEST_P(TextureZeroInitTest, RenderingLoadingStencil) {
wgpu::TextureDescriptor srcDescriptor =
CreateTextureDescriptor(1, 1,
wgpu::TextureUsage::CopySrc | wgpu::TextureUsage::CopyDst |
wgpu::TextureUsage::OutputAttachment,
wgpu::TextureUsage::RenderAttachment,
kColorFormat);
wgpu::Texture srcTexture = device.CreateTexture(&srcDescriptor);
wgpu::TextureDescriptor depthStencilDescriptor = CreateTextureDescriptor(
1, 1, wgpu::TextureUsage::OutputAttachment | wgpu::TextureUsage::CopySrc,
1, 1, wgpu::TextureUsage::RenderAttachment | wgpu::TextureUsage::CopySrc,
kDepthStencilFormat);
wgpu::Texture depthStencilTexture = device.CreateTexture(&depthStencilDescriptor);
@ -546,12 +546,12 @@ TEST_P(TextureZeroInitTest, RenderingLoadingDepthStencil) {
wgpu::TextureDescriptor srcDescriptor =
CreateTextureDescriptor(1, 1,
wgpu::TextureUsage::CopySrc | wgpu::TextureUsage::CopyDst |
wgpu::TextureUsage::OutputAttachment,
wgpu::TextureUsage::RenderAttachment,
kColorFormat);
wgpu::Texture srcTexture = device.CreateTexture(&srcDescriptor);
wgpu::TextureDescriptor depthStencilDescriptor = CreateTextureDescriptor(
1, 1, wgpu::TextureUsage::OutputAttachment | wgpu::TextureUsage::CopySrc,
1, 1, wgpu::TextureUsage::RenderAttachment | wgpu::TextureUsage::CopySrc,
kDepthStencilFormat);
wgpu::Texture depthStencilTexture = device.CreateTexture(&depthStencilDescriptor);
@ -585,7 +585,7 @@ TEST_P(TextureZeroInitTest, IndependentDepthStencilLoadAfterDiscard) {
DAWN_SKIP_TEST_IF(IsMetal() && IsIntel());
wgpu::TextureDescriptor depthStencilDescriptor = CreateTextureDescriptor(
1, 1, wgpu::TextureUsage::OutputAttachment | wgpu::TextureUsage::CopySrc,
1, 1, wgpu::TextureUsage::RenderAttachment | wgpu::TextureUsage::CopySrc,
kDepthStencilFormat);
wgpu::Texture depthStencilTexture = device.CreateTexture(&depthStencilDescriptor);
@ -620,7 +620,7 @@ TEST_P(TextureZeroInitTest, IndependentDepthStencilLoadAfterDiscard) {
wgpu::TextureDescriptor colorDescriptor =
CreateTextureDescriptor(1, 1,
wgpu::TextureUsage::CopySrc | wgpu::TextureUsage::CopyDst |
wgpu::TextureUsage::OutputAttachment,
wgpu::TextureUsage::RenderAttachment,
kColorFormat);
wgpu::Texture colorTexture = device.CreateTexture(&colorDescriptor);
@ -694,7 +694,7 @@ TEST_P(TextureZeroInitTest, IndependentDepthStencilLoadAfterDiscard) {
wgpu::TextureDescriptor colorDescriptor =
CreateTextureDescriptor(1, 1,
wgpu::TextureUsage::CopySrc | wgpu::TextureUsage::CopyDst |
wgpu::TextureUsage::OutputAttachment,
wgpu::TextureUsage::RenderAttachment,
kColorFormat);
wgpu::Texture colorTexture = device.CreateTexture(&colorDescriptor);
@ -747,7 +747,7 @@ TEST_P(TextureZeroInitTest, IndependentDepthStencilCopyAfterDiscard) {
DAWN_SKIP_TEST_IF(IsMetal() && IsIntel());
wgpu::TextureDescriptor depthStencilDescriptor = CreateTextureDescriptor(
1, 1, wgpu::TextureUsage::OutputAttachment | wgpu::TextureUsage::CopySrc,
1, 1, wgpu::TextureUsage::RenderAttachment | wgpu::TextureUsage::CopySrc,
kDepthStencilFormat);
wgpu::Texture depthStencilTexture = device.CreateTexture(&depthStencilDescriptor);
@ -792,7 +792,7 @@ TEST_P(TextureZeroInitTest, IndependentDepthStencilCopyAfterDiscard) {
wgpu::TextureDescriptor colorDescriptor =
CreateTextureDescriptor(1, 1,
wgpu::TextureUsage::CopySrc | wgpu::TextureUsage::CopyDst |
wgpu::TextureUsage::OutputAttachment,
wgpu::TextureUsage::RenderAttachment,
kColorFormat);
wgpu::Texture colorTexture = device.CreateTexture(&colorDescriptor);
@ -820,7 +820,7 @@ TEST_P(TextureZeroInitTest, IndependentDepthStencilCopyAfterDiscard) {
// This tests the color attachments clear to 0s
TEST_P(TextureZeroInitTest, ColorAttachmentsClear) {
wgpu::TextureDescriptor descriptor = CreateTextureDescriptor(
1, 1, wgpu::TextureUsage::OutputAttachment | wgpu::TextureUsage::CopySrc, kColorFormat);
1, 1, wgpu::TextureUsage::RenderAttachment | wgpu::TextureUsage::CopySrc, kColorFormat);
wgpu::Texture texture = device.CreateTexture(&descriptor);
utils::BasicRenderPass renderPass = utils::BasicRenderPass(kSize, kSize, texture, kColorFormat);
renderPass.renderPassInfo.cColorAttachments[0].loadOp = wgpu::LoadOp::Load;
@ -848,7 +848,7 @@ TEST_P(TextureZeroInitTest, RenderPassSampledTextureClear) {
wgpu::Texture texture = device.CreateTexture(&descriptor);
wgpu::TextureDescriptor renderTextureDescriptor = CreateTextureDescriptor(
1, 1, wgpu::TextureUsage::CopySrc | wgpu::TextureUsage::OutputAttachment, kColorFormat);
1, 1, wgpu::TextureUsage::CopySrc | wgpu::TextureUsage::RenderAttachment, kColorFormat);
wgpu::Texture renderTexture = device.CreateTexture(&renderTextureDescriptor);
wgpu::SamplerDescriptor samplerDesc = utils::GetDefaultSamplerDescriptor();
@ -1053,7 +1053,7 @@ TEST_P(TextureZeroInitTest, RenderPassStoreOpClear) {
wgpu::Texture texture = device.CreateTexture(&descriptor);
wgpu::TextureDescriptor renderTextureDescriptor = CreateTextureDescriptor(
1, 1, wgpu::TextureUsage::CopySrc | wgpu::TextureUsage::OutputAttachment, kColorFormat);
1, 1, wgpu::TextureUsage::CopySrc | wgpu::TextureUsage::RenderAttachment, kColorFormat);
wgpu::Texture renderTexture = device.CreateTexture(&renderTextureDescriptor);
wgpu::SamplerDescriptor samplerDesc = utils::GetDefaultSamplerDescriptor();
@ -1121,13 +1121,13 @@ TEST_P(TextureZeroInitTest, RenderingLoadingDepthStencilStoreOpClear) {
wgpu::TextureDescriptor srcDescriptor =
CreateTextureDescriptor(1, 1,
wgpu::TextureUsage::CopySrc | wgpu::TextureUsage::CopyDst |
wgpu::TextureUsage::OutputAttachment,
wgpu::TextureUsage::RenderAttachment,
kColorFormat);
wgpu::Texture srcTexture = device.CreateTexture(&srcDescriptor);
wgpu::TextureDescriptor depthStencilDescriptor =
CreateTextureDescriptor(1, 1,
wgpu::TextureUsage::OutputAttachment | wgpu::TextureUsage::CopySrc |
wgpu::TextureUsage::RenderAttachment | wgpu::TextureUsage::CopySrc |
wgpu::TextureUsage::CopyDst,
kDepthStencilFormat);
wgpu::Texture depthStencilTexture = device.CreateTexture(&depthStencilDescriptor);
@ -1203,7 +1203,7 @@ TEST_P(TextureZeroInitTest, PreservesInitializedMip) {
wgpu::Sampler sampler = device.CreateSampler(&samplerDesc);
wgpu::TextureDescriptor renderTextureDescriptor = CreateTextureDescriptor(
1, 1, wgpu::TextureUsage::CopySrc | wgpu::TextureUsage::OutputAttachment, kColorFormat);
1, 1, wgpu::TextureUsage::CopySrc | wgpu::TextureUsage::RenderAttachment, kColorFormat);
wgpu::Texture renderTexture = device.CreateTexture(&renderTextureDescriptor);
// Fill the sample texture's second mip with data
@ -1282,7 +1282,7 @@ TEST_P(TextureZeroInitTest, PreservesInitializedArrayLayer) {
wgpu::Sampler sampler = device.CreateSampler(&samplerDesc);
wgpu::TextureDescriptor renderTextureDescriptor = CreateTextureDescriptor(
1, 1, wgpu::TextureUsage::CopySrc | wgpu::TextureUsage::OutputAttachment, kColorFormat);
1, 1, wgpu::TextureUsage::CopySrc | wgpu::TextureUsage::RenderAttachment, kColorFormat);
wgpu::Texture renderTexture = device.CreateTexture(&renderTextureDescriptor);
// Fill the sample texture's second array layer with data

View File

@ -113,7 +113,7 @@ class ViewportTest : public DawnTest {
wgpu::TextureDescriptor depthDesc;
depthDesc.size = {3, 1, 1};
depthDesc.format = wgpu::TextureFormat::Depth32Float;
depthDesc.usage = wgpu::TextureUsage::OutputAttachment | wgpu::TextureUsage::CopySrc;
depthDesc.usage = wgpu::TextureUsage::RenderAttachment | wgpu::TextureUsage::CopySrc;
wgpu::Texture depthTexture = device.CreateTexture(&depthDesc);
// Render the three points with the viewport call.

View File

@ -285,7 +285,7 @@ void DrawCallPerf::SetUp() {
descriptor.size.width = kTextureSize;
descriptor.size.height = kTextureSize;
descriptor.size.depth = 1;
descriptor.usage = wgpu::TextureUsage::OutputAttachment;
descriptor.usage = wgpu::TextureUsage::RenderAttachment;
descriptor.format = wgpu::TextureFormat::RGBA8Unorm;
mColorAttachment = device.CreateTexture(&descriptor).CreateView();

View File

@ -287,7 +287,7 @@ TEST_F(BindGroupValidationTest, TextureUsage) {
// Make an output attachment texture and try to set it for a SampledTexture binding
wgpu::Texture outputTexture =
CreateTexture(wgpu::TextureUsage::OutputAttachment, wgpu::TextureFormat::RGBA8Unorm, 1);
CreateTexture(wgpu::TextureUsage::RenderAttachment, wgpu::TextureFormat::RGBA8Unorm, 1);
wgpu::TextureView outputTextureView = outputTexture.CreateView();
ASSERT_DEVICE_ERROR(utils::MakeBindGroup(device, layout, {{0, outputTextureView}}));
}

View File

@ -800,7 +800,7 @@ TEST_F(CopyCommandTest_B2T, CopyToStencilAspect) {
wgpu::Texture destination =
Create2DTexture(16, 16, 1, 1, wgpu::TextureFormat::Depth24PlusStencil8,
wgpu::TextureUsage::CopyDst | wgpu::TextureUsage::OutputAttachment);
wgpu::TextureUsage::CopyDst | wgpu::TextureUsage::RenderAttachment);
TestB2TCopy(utils::Expectation::Failure, source, 0, 256, 0, destination, 0, {0, 0, 0},
{15, 15, 1}, wgpu::TextureAspect::StencilOnly);
@ -817,7 +817,7 @@ TEST_F(CopyCommandTest_B2T, CopyToStencilAspect) {
wgpu::Texture destination =
Create2DTexture(16, 16, 2, 1, wgpu::TextureFormat::Depth24PlusStencil8,
wgpu::TextureUsage::CopyDst | wgpu::TextureUsage::OutputAttachment);
wgpu::TextureUsage::CopyDst | wgpu::TextureUsage::RenderAttachment);
// Whole mip is success
TestB2TCopy(utils::Expectation::Success, source, 0, 256, 0, destination, 1, {0, 0, 0},
@ -839,7 +839,7 @@ TEST_F(CopyCommandTest_B2T, CopyToStencilAspect) {
wgpu::Texture destination =
Create2DTexture(17, 17, 2, 1, wgpu::TextureFormat::Depth24PlusStencil8,
wgpu::TextureUsage::CopyDst | wgpu::TextureUsage::OutputAttachment);
wgpu::TextureUsage::CopyDst | wgpu::TextureUsage::RenderAttachment);
// Whole mip is success
TestB2TCopy(utils::Expectation::Success, source, 0, 256, 0, destination, 1, {0, 0, 0},

View File

@ -851,7 +851,7 @@ TEST_F(RenderBundleValidationTest, RenderPassColorFormatMismatch) {
wgpu::RenderBundle renderBundle = renderBundleEncoder.Finish();
wgpu::TextureDescriptor textureDesc = {};
textureDesc.usage = wgpu::TextureUsage::OutputAttachment;
textureDesc.usage = wgpu::TextureUsage::RenderAttachment;
textureDesc.size = wgpu::Extent3D({400, 400, 1});
textureDesc.format = wgpu::TextureFormat::RGBA8Unorm;
@ -921,7 +921,7 @@ TEST_F(RenderBundleValidationTest, RenderPassDepthStencilFormatMismatch) {
wgpu::RenderBundle renderBundle = renderBundleEncoder.Finish();
wgpu::TextureDescriptor textureDesc = {};
textureDesc.usage = wgpu::TextureUsage::OutputAttachment;
textureDesc.usage = wgpu::TextureUsage::RenderAttachment;
textureDesc.size = wgpu::Extent3D({400, 400, 1});
textureDesc.format = wgpu::TextureFormat::RGBA8Unorm;
@ -978,7 +978,7 @@ TEST_F(RenderBundleValidationTest, RenderPassSampleCountMismatch) {
wgpu::RenderBundle renderBundle = renderBundleEncoder.Finish();
wgpu::TextureDescriptor textureDesc = {};
textureDesc.usage = wgpu::TextureUsage::OutputAttachment;
textureDesc.usage = wgpu::TextureUsage::RenderAttachment;
textureDesc.size = wgpu::Extent3D({400, 400, 1});
textureDesc.format = wgpu::TextureFormat::RGBA8Unorm;

View File

@ -50,7 +50,7 @@ namespace {
uint32_t arrayLayerCount,
uint32_t mipLevelCount,
uint32_t sampleCount = 1,
wgpu::TextureUsage usage = wgpu::TextureUsage::OutputAttachment) {
wgpu::TextureUsage usage = wgpu::TextureUsage::RenderAttachment) {
wgpu::TextureDescriptor descriptor;
descriptor.dimension = dimension;
descriptor.size.width = width;
@ -548,8 +548,8 @@ namespace {
}
// It is not allowed to use a resolve target which is created from a texture whose usage does
// not include wgpu::TextureUsage::OutputAttachment.
TEST_F(MultisampledRenderPassDescriptorValidationTest, ResolveTargetUsageNoOutputAttachment) {
// not include wgpu::TextureUsage::RenderAttachment.
TEST_F(MultisampledRenderPassDescriptorValidationTest, ResolveTargetUsageNoRenderAttachment) {
constexpr wgpu::TextureUsage kUsage =
wgpu::TextureUsage::CopyDst | wgpu::TextureUsage::CopySrc;
wgpu::Texture nonColorUsageResolveTexture =

View File

@ -229,7 +229,7 @@ TEST_F(RenderPipelineValidationTest, SampleCountCompatibilityWithRenderPass) {
baseTextureDescriptor.size.depth = 1;
baseTextureDescriptor.mipLevelCount = 1;
baseTextureDescriptor.dimension = wgpu::TextureDimension::e2D;
baseTextureDescriptor.usage = wgpu::TextureUsage::OutputAttachment;
baseTextureDescriptor.usage = wgpu::TextureUsage::RenderAttachment;
utils::ComboRenderPipelineDescriptor nonMultisampledPipelineDescriptor(device);
nonMultisampledPipelineDescriptor.sampleCount = 1;

View File

@ -900,7 +900,7 @@ namespace {
{
// Create a texture
wgpu::Texture texture =
CreateTexture(wgpu::TextureUsage::Sampled | wgpu::TextureUsage::OutputAttachment);
CreateTexture(wgpu::TextureUsage::Sampled | wgpu::TextureUsage::RenderAttachment);
wgpu::TextureView view = texture.CreateView();
// Create a bind group to use the texture as sampled binding
@ -969,7 +969,7 @@ namespace {
{
// Create a texture
wgpu::Texture texture =
CreateTexture(wgpu::TextureUsage::Storage | wgpu::TextureUsage::OutputAttachment);
CreateTexture(wgpu::TextureUsage::Storage | wgpu::TextureUsage::RenderAttachment);
wgpu::TextureView view = texture.CreateView();
// Create a bind group to use the texture as writeonly storage binding
@ -1059,10 +1059,10 @@ namespace {
{
// Create textures that will be used as both a sampled texture and a render target
wgpu::Texture t0 =
CreateTexture(wgpu::TextureUsage::Sampled | wgpu::TextureUsage::OutputAttachment);
CreateTexture(wgpu::TextureUsage::Sampled | wgpu::TextureUsage::RenderAttachment);
wgpu::TextureView v0 = t0.CreateView();
wgpu::Texture t1 =
CreateTexture(wgpu::TextureUsage::Sampled | wgpu::TextureUsage::OutputAttachment);
CreateTexture(wgpu::TextureUsage::Sampled | wgpu::TextureUsage::RenderAttachment);
wgpu::TextureView v1 = t1.CreateView();
// Create bind groups to use the texture as sampled
@ -1312,7 +1312,7 @@ namespace {
wgpu::Texture texture0 = CreateTexture(wgpu::TextureUsage::CopySrc);
wgpu::Texture texture1 =
CreateTexture(wgpu::TextureUsage::CopyDst | wgpu::TextureUsage::Sampled |
wgpu::TextureUsage::OutputAttachment);
wgpu::TextureUsage::RenderAttachment);
wgpu::TextureView view0 = texture0.CreateView();
wgpu::TextureView view1 = texture1.CreateView();
@ -1353,10 +1353,10 @@ namespace {
{
// Create textures that will be used as both a sampled texture and a render target
wgpu::Texture texture0 =
CreateTexture(wgpu::TextureUsage::Sampled | wgpu::TextureUsage::OutputAttachment);
CreateTexture(wgpu::TextureUsage::Sampled | wgpu::TextureUsage::RenderAttachment);
wgpu::TextureView view0 = texture0.CreateView();
wgpu::Texture texture1 =
CreateTexture(wgpu::TextureUsage::Sampled | wgpu::TextureUsage::OutputAttachment);
CreateTexture(wgpu::TextureUsage::Sampled | wgpu::TextureUsage::RenderAttachment);
wgpu::TextureView view1 = texture1.CreateView();
// Create the bind group to use the texture as sampled
@ -1516,7 +1516,7 @@ namespace {
TEST_F(ResourceUsageTrackingTest, TextureUsageConflictWithInvisibleStageInBindGroup) {
// Create texture and texture view
wgpu::Texture texture =
CreateTexture(wgpu::TextureUsage::Storage | wgpu::TextureUsage::OutputAttachment);
CreateTexture(wgpu::TextureUsage::Storage | wgpu::TextureUsage::RenderAttachment);
wgpu::TextureView view = texture.CreateView();
// Test render pass

View File

@ -658,7 +658,7 @@ TEST_F(StorageTextureValidationTests, StorageTextureUsageInBindGroup) {
constexpr std::array<wgpu::TextureUsage, 6> kTextureUsages = {
wgpu::TextureUsage::CopySrc, wgpu::TextureUsage::CopyDst,
wgpu::TextureUsage::Sampled, wgpu::TextureUsage::Storage,
wgpu::TextureUsage::OutputAttachment, wgpu::TextureUsage::Present};
wgpu::TextureUsage::RenderAttachment, wgpu::TextureUsage::Present};
for (wgpu::BindingType storageBindingType : kSupportedStorageTextureBindingTypes) {
// Create a bind group layout.
@ -800,7 +800,7 @@ TEST_F(StorageTextureValidationTests, StorageTextureInRenderPass) {
constexpr wgpu::TextureFormat kFormat = wgpu::TextureFormat::RGBA8Unorm;
wgpu::Texture storageTexture = CreateTexture(wgpu::TextureUsage::Storage, kFormat);
wgpu::Texture outputAttachment = CreateTexture(wgpu::TextureUsage::OutputAttachment, kFormat);
wgpu::Texture outputAttachment = CreateTexture(wgpu::TextureUsage::RenderAttachment, kFormat);
utils::ComboRenderPassDescriptor renderPassDescriptor({outputAttachment.CreateView()});
for (wgpu::BindingType storageTextureType : kSupportedStorageTextureBindingTypes) {
@ -831,7 +831,7 @@ TEST_F(StorageTextureValidationTests, StorageTextureAndSampledTextureInOneRender
wgpu::Texture storageTexture =
CreateTexture(wgpu::TextureUsage::Storage | wgpu::TextureUsage::Sampled, kFormat);
wgpu::Texture outputAttachment = CreateTexture(wgpu::TextureUsage::OutputAttachment, kFormat);
wgpu::Texture outputAttachment = CreateTexture(wgpu::TextureUsage::RenderAttachment, kFormat);
utils::ComboRenderPassDescriptor renderPassDescriptor({outputAttachment.CreateView()});
// Create a bind group that contains a storage texture and a sampled texture.
@ -871,10 +871,10 @@ TEST_F(StorageTextureValidationTests, StorageTextureAndSampledTextureInOneRender
// Verify it is invalid to use a a texture as both storage texture (either read-only or write-only)
// and output attachment in one render pass.
TEST_F(StorageTextureValidationTests, StorageTextureAndOutputAttachmentInOneRenderPass) {
TEST_F(StorageTextureValidationTests, StorageTextureAndRenderAttachmentInOneRenderPass) {
constexpr wgpu::TextureFormat kFormat = wgpu::TextureFormat::RGBA8Unorm;
wgpu::Texture storageTexture =
CreateTexture(wgpu::TextureUsage::Storage | wgpu::TextureUsage::OutputAttachment, kFormat);
CreateTexture(wgpu::TextureUsage::Storage | wgpu::TextureUsage::RenderAttachment, kFormat);
utils::ComboRenderPassDescriptor renderPassDescriptor({storageTexture.CreateView()});
for (wgpu::BindingType storageTextureType : kSupportedStorageTextureBindingTypes) {
@ -917,7 +917,7 @@ TEST_F(StorageTextureValidationTests, ReadOnlyAndWriteOnlyStorageTextureInOneRen
// It is invalid to use a texture as both read-only storage texture and write-only storage
// texture in one render pass.
wgpu::Texture outputAttachment = CreateTexture(wgpu::TextureUsage::OutputAttachment, kFormat);
wgpu::Texture outputAttachment = CreateTexture(wgpu::TextureUsage::RenderAttachment, kFormat);
utils::ComboRenderPassDescriptor renderPassDescriptor({outputAttachment.CreateView()});
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
wgpu::RenderPassEncoder renderPassEncoder = encoder.BeginRenderPass(&renderPassDescriptor);

View File

@ -129,7 +129,7 @@ namespace {
// Create texture with 2 mipmap levels and 1 layer
wgpu::Texture texture =
CreateTexture(2, 1,
wgpu::TextureUsage::Sampled | wgpu::TextureUsage::OutputAttachment |
wgpu::TextureUsage::Sampled | wgpu::TextureUsage::RenderAttachment |
wgpu::TextureUsage::Storage);
// Create two views on different mipmap levels.
@ -143,7 +143,7 @@ namespace {
// Create texture with 1 mipmap level and 2 layers
wgpu::Texture texture =
CreateTexture(1, 2,
wgpu::TextureUsage::Sampled | wgpu::TextureUsage::OutputAttachment |
wgpu::TextureUsage::Sampled | wgpu::TextureUsage::RenderAttachment |
wgpu::TextureUsage::Storage);
// Create two views on different layers.

View File

@ -36,7 +36,7 @@ namespace {
descriptor.sampleCount = kDefaultSampleCount;
descriptor.dimension = wgpu::TextureDimension::e2D;
descriptor.format = kDefaultTextureFormat;
descriptor.usage = wgpu::TextureUsage::OutputAttachment | wgpu::TextureUsage::Sampled;
descriptor.usage = wgpu::TextureUsage::RenderAttachment | wgpu::TextureUsage::Sampled;
return descriptor;
}
@ -329,11 +329,11 @@ namespace {
ASSERT_DEVICE_ERROR(queue.Submit(1, &commands));
}
// Test it is an error to create an OutputAttachment texture with a non-renderable format.
TEST_F(TextureValidationTest, NonRenderableAndOutputAttachment) {
// Test it is an error to create an RenderAttachment texture with a non-renderable format.
TEST_F(TextureValidationTest, NonRenderableAndRenderAttachment) {
wgpu::TextureDescriptor descriptor;
descriptor.size = {1, 1, 1};
descriptor.usage = wgpu::TextureUsage::OutputAttachment;
descriptor.usage = wgpu::TextureUsage::RenderAttachment;
// Succeeds because RGBA8Unorm is renderable
descriptor.format = wgpu::TextureFormat::RGBA8Unorm;
@ -457,7 +457,7 @@ namespace {
// Test that only CopySrc, CopyDst and Sampled are accepted as the texture usage of the
// textures in BC formats.
wgpu::TextureUsage invalidUsages[] = {
wgpu::TextureUsage::OutputAttachment,
wgpu::TextureUsage::RenderAttachment,
wgpu::TextureUsage::Storage,
wgpu::TextureUsage::Present,
};

View File

@ -348,7 +348,7 @@ namespace {
TEST_F(TextureViewValidationTest, AspectMustExist) {
wgpu::TextureDescriptor descriptor = {};
descriptor.size = {1, 1, 1};
descriptor.usage = wgpu::TextureUsage::Sampled | wgpu::TextureUsage::OutputAttachment;
descriptor.usage = wgpu::TextureUsage::Sampled | wgpu::TextureUsage::RenderAttachment;
// Can select: All and DepthOnly from Depth32Float, but not StencilOnly
{

View File

@ -130,7 +130,7 @@ ValidationTest::DummyRenderPass::DummyRenderPass(const wgpu::Device& device)
descriptor.sampleCount = 1;
descriptor.format = attachmentFormat;
descriptor.mipLevelCount = 1;
descriptor.usage = wgpu::TextureUsage::OutputAttachment;
descriptor.usage = wgpu::TextureUsage::RenderAttachment;
attachment = device.CreateTexture(&descriptor);
wgpu::TextureView view = attachment.CreateView();

View File

@ -69,7 +69,7 @@ class D3D12DescriptorHeapTests : public DawnTest {
descriptor.sampleCount = 1;
descriptor.format = format;
descriptor.mipLevelCount = 1;
descriptor.usage = wgpu::TextureUsage::OutputAttachment | wgpu::TextureUsage::CopySrc;
descriptor.usage = wgpu::TextureUsage::RenderAttachment | wgpu::TextureUsage::CopySrc;
wgpu::Texture color = device.CreateTexture(&descriptor);
return utils::BasicRenderPass(width, height, color);
@ -739,7 +739,7 @@ TEST_P(D3D12DescriptorHeapTests, EncodeManyUBOAndSamplers) {
descriptor.sampleCount = 1;
descriptor.format = wgpu::TextureFormat::RGBA8Unorm;
descriptor.mipLevelCount = 1;
descriptor.usage = wgpu::TextureUsage::Sampled | wgpu::TextureUsage::OutputAttachment |
descriptor.usage = wgpu::TextureUsage::Sampled | wgpu::TextureUsage::RenderAttachment |
wgpu::TextureUsage::CopySrc;
wgpu::Texture texture = device.CreateTexture(&descriptor);
wgpu::TextureView textureView = texture.CreateView();

View File

@ -50,7 +50,7 @@ namespace dawn_native { namespace vulkan {
defaultDescriptor.size = {1, 1, 1};
defaultDescriptor.sampleCount = 1;
defaultDescriptor.mipLevelCount = 1;
defaultDescriptor.usage = wgpu::TextureUsage::OutputAttachment |
defaultDescriptor.usage = wgpu::TextureUsage::RenderAttachment |
wgpu::TextureUsage::CopySrc | wgpu::TextureUsage::CopyDst;
}

View File

@ -234,7 +234,7 @@ namespace dawn_native { namespace vulkan {
defaultDescriptor.size = {1, 1, 1};
defaultDescriptor.sampleCount = 1;
defaultDescriptor.mipLevelCount = 1;
defaultDescriptor.usage = wgpu::TextureUsage::OutputAttachment |
defaultDescriptor.usage = wgpu::TextureUsage::RenderAttachment |
wgpu::TextureUsage::CopySrc | wgpu::TextureUsage::CopyDst;
}
@ -401,7 +401,7 @@ namespace dawn_native { namespace vulkan {
defaultDescriptor.size = {1, 1, 1};
defaultDescriptor.sampleCount = 1;
defaultDescriptor.mipLevelCount = 1;
defaultDescriptor.usage = wgpu::TextureUsage::OutputAttachment |
defaultDescriptor.usage = wgpu::TextureUsage::RenderAttachment |
wgpu::TextureUsage::CopySrc | wgpu::TextureUsage::CopyDst;
}

View File

@ -65,7 +65,7 @@ namespace utils {
[mLayer setDrawableSize:size];
constexpr uint32_t kFramebufferOnlyTextureUsages =
WGPUTextureUsage_OutputAttachment | WGPUTextureUsage_Present;
WGPUTextureUsage_RenderAttachment | WGPUTextureUsage_Present;
bool hasOnlyFramebufferUsages = !(usage & (~kFramebufferOnlyTextureUsages));
if (hasOnlyFramebufferUsages) {
[mLayer setFramebufferOnly:YES];

View File

@ -262,7 +262,7 @@ namespace utils {
descriptor.sampleCount = 1;
descriptor.format = BasicRenderPass::kDefaultColorFormat;
descriptor.mipLevelCount = 1;
descriptor.usage = wgpu::TextureUsage::OutputAttachment | wgpu::TextureUsage::CopySrc;
descriptor.usage = wgpu::TextureUsage::RenderAttachment | wgpu::TextureUsage::CopySrc;
wgpu::Texture color = device.CreateTexture(&descriptor);
return BasicRenderPass(width, height, color);