mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-05-13 19:01:24 +00:00
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:
parent
25eeaa3d39
commit
6b087819dd
@ -1713,6 +1713,7 @@
|
|||||||
{"value": 4, "name": "sampled"},
|
{"value": 4, "name": "sampled"},
|
||||||
{"value": 8, "name": "storage"},
|
{"value": 8, "name": "storage"},
|
||||||
{"value": 16, "name": "output attachment"},
|
{"value": 16, "name": "output attachment"},
|
||||||
|
{"value": 16, "name": "render attachment"},
|
||||||
{"value": 32, "name": "present"}
|
{"value": 32, "name": "present"}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
@ -52,7 +52,7 @@ void init() {
|
|||||||
|
|
||||||
queue = device.GetDefaultQueue();
|
queue = device.GetDefaultQueue();
|
||||||
swapchain = GetSwapChain(device);
|
swapchain = GetSwapChain(device);
|
||||||
swapchain.Configure(GetPreferredSwapChainTextureFormat(), wgpu::TextureUsage::OutputAttachment,
|
swapchain.Configure(GetPreferredSwapChainTextureFormat(), wgpu::TextureUsage::RenderAttachment,
|
||||||
640, 480);
|
640, 480);
|
||||||
|
|
||||||
wgpu::ShaderModule vsModule =
|
wgpu::ShaderModule vsModule =
|
||||||
|
@ -34,7 +34,7 @@ void init() {
|
|||||||
swapchain = wgpuDeviceCreateSwapChain(device, nullptr, &descriptor);
|
swapchain = wgpuDeviceCreateSwapChain(device, nullptr, &descriptor);
|
||||||
}
|
}
|
||||||
swapChainFormat = static_cast<WGPUTextureFormat>(GetPreferredSwapChainTextureFormat());
|
swapChainFormat = static_cast<WGPUTextureFormat>(GetPreferredSwapChainTextureFormat());
|
||||||
wgpuSwapChainConfigure(swapchain, swapChainFormat, WGPUTextureUsage_OutputAttachment, 640, 480);
|
wgpuSwapChainConfigure(swapchain, swapChainFormat, WGPUTextureUsage_RenderAttachment, 640, 480);
|
||||||
|
|
||||||
const char* vs =
|
const char* vs =
|
||||||
"#version 450\n"
|
"#version 450\n"
|
||||||
|
@ -292,7 +292,7 @@ void init() {
|
|||||||
|
|
||||||
queue = device.GetDefaultQueue();
|
queue = device.GetDefaultQueue();
|
||||||
swapchain = GetSwapChain(device);
|
swapchain = GetSwapChain(device);
|
||||||
swapchain.Configure(GetPreferredSwapChainTextureFormat(), wgpu::TextureUsage::OutputAttachment,
|
swapchain.Configure(GetPreferredSwapChainTextureFormat(), wgpu::TextureUsage::RenderAttachment,
|
||||||
640, 480);
|
640, 480);
|
||||||
|
|
||||||
initBuffers();
|
initBuffers();
|
||||||
|
@ -90,7 +90,7 @@ void init() {
|
|||||||
|
|
||||||
queue = device.GetDefaultQueue();
|
queue = device.GetDefaultQueue();
|
||||||
swapchain = GetSwapChain(device);
|
swapchain = GetSwapChain(device);
|
||||||
swapchain.Configure(GetPreferredSwapChainTextureFormat(), wgpu::TextureUsage::OutputAttachment,
|
swapchain.Configure(GetPreferredSwapChainTextureFormat(), wgpu::TextureUsage::RenderAttachment,
|
||||||
640, 480);
|
640, 480);
|
||||||
|
|
||||||
initBuffers();
|
initBuffers();
|
||||||
|
@ -96,7 +96,7 @@ void init() {
|
|||||||
|
|
||||||
queue = device.GetDefaultQueue();
|
queue = device.GetDefaultQueue();
|
||||||
swapchain = GetSwapChain(device);
|
swapchain = GetSwapChain(device);
|
||||||
swapchain.Configure(GetPreferredSwapChainTextureFormat(), wgpu::TextureUsage::OutputAttachment,
|
swapchain.Configure(GetPreferredSwapChainTextureFormat(), wgpu::TextureUsage::RenderAttachment,
|
||||||
640, 480);
|
640, 480);
|
||||||
|
|
||||||
initBuffers();
|
initBuffers();
|
||||||
|
@ -111,7 +111,7 @@ void AddWindow() {
|
|||||||
glfwSetKeyCallback(window, OnKeyPress);
|
glfwSetKeyCallback(window, OnKeyPress);
|
||||||
|
|
||||||
wgpu::SwapChainDescriptor descriptor;
|
wgpu::SwapChainDescriptor descriptor;
|
||||||
descriptor.usage = wgpu::TextureUsage::OutputAttachment;
|
descriptor.usage = wgpu::TextureUsage::RenderAttachment;
|
||||||
descriptor.format = wgpu::TextureFormat::BGRA8Unorm;
|
descriptor.format = wgpu::TextureFormat::BGRA8Unorm;
|
||||||
descriptor.width = 0;
|
descriptor.width = 0;
|
||||||
descriptor.height = 0;
|
descriptor.height = 0;
|
||||||
@ -165,8 +165,8 @@ void DoRender(WindowData* data) {
|
|||||||
|
|
||||||
std::ostream& operator<<(std::ostream& o, const wgpu::SwapChainDescriptor& desc) {
|
std::ostream& operator<<(std::ostream& o, const wgpu::SwapChainDescriptor& desc) {
|
||||||
// For now only output attachment is possible.
|
// For now only output attachment is possible.
|
||||||
ASSERT(desc.usage == wgpu::TextureUsage::OutputAttachment);
|
ASSERT(desc.usage == wgpu::TextureUsage::RenderAttachment);
|
||||||
o << "OutputAttachment ";
|
o << "RenderAttachment ";
|
||||||
o << desc.width << "x" << desc.height << " ";
|
o << desc.width << "x" << desc.height << " ";
|
||||||
|
|
||||||
// For now only BGRA is allowed
|
// For now only BGRA is allowed
|
||||||
|
@ -188,7 +188,7 @@ wgpu::TextureView CreateDefaultDepthStencilView(const wgpu::Device& device) {
|
|||||||
descriptor.sampleCount = 1;
|
descriptor.sampleCount = 1;
|
||||||
descriptor.format = wgpu::TextureFormat::Depth24PlusStencil8;
|
descriptor.format = wgpu::TextureFormat::Depth24PlusStencil8;
|
||||||
descriptor.mipLevelCount = 1;
|
descriptor.mipLevelCount = 1;
|
||||||
descriptor.usage = wgpu::TextureUsage::OutputAttachment;
|
descriptor.usage = wgpu::TextureUsage::RenderAttachment;
|
||||||
auto depthStencilTexture = device.CreateTexture(&descriptor);
|
auto depthStencilTexture = device.CreateTexture(&descriptor);
|
||||||
return depthStencilTexture.CreateView();
|
return depthStencilTexture.CreateView();
|
||||||
}
|
}
|
||||||
|
@ -543,11 +543,11 @@ namespace dawn_native {
|
|||||||
cmd->colorAttachments[index].clearColor =
|
cmd->colorAttachments[index].clearColor =
|
||||||
descriptor->colorAttachments[i].clearColor;
|
descriptor->colorAttachments[i].clearColor;
|
||||||
|
|
||||||
usageTracker.TextureViewUsedAs(view, wgpu::TextureUsage::OutputAttachment);
|
usageTracker.TextureViewUsedAs(view, wgpu::TextureUsage::RenderAttachment);
|
||||||
|
|
||||||
if (resolveTarget != nullptr) {
|
if (resolveTarget != nullptr) {
|
||||||
usageTracker.TextureViewUsedAs(resolveTarget,
|
usageTracker.TextureViewUsedAs(resolveTarget,
|
||||||
wgpu::TextureUsage::OutputAttachment);
|
wgpu::TextureUsage::RenderAttachment);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -568,7 +568,7 @@ namespace dawn_native {
|
|||||||
cmd->depthStencilAttachment.stencilStoreOp =
|
cmd->depthStencilAttachment.stencilStoreOp =
|
||||||
descriptor->depthStencilAttachment->stencilStoreOp;
|
descriptor->depthStencilAttachment->stencilStoreOp;
|
||||||
|
|
||||||
usageTracker.TextureViewUsedAs(view, wgpu::TextureUsage::OutputAttachment);
|
usageTracker.TextureViewUsedAs(view, wgpu::TextureUsage::RenderAttachment);
|
||||||
}
|
}
|
||||||
|
|
||||||
cmd->width = width;
|
cmd->width = width;
|
||||||
|
@ -81,8 +81,8 @@ namespace dawn_native {
|
|||||||
return DAWN_VALIDATION_ERROR("Format must (currently) be BGRA8Unorm");
|
return DAWN_VALIDATION_ERROR("Format must (currently) be BGRA8Unorm");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (descriptor->usage != wgpu::TextureUsage::OutputAttachment) {
|
if (descriptor->usage != wgpu::TextureUsage::RenderAttachment) {
|
||||||
return DAWN_VALIDATION_ERROR("Usage must (currently) be OutputAttachment");
|
return DAWN_VALIDATION_ERROR("Usage must (currently) be RenderAttachment");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (descriptor->width == 0 || descriptor->height == 0) {
|
if (descriptor->width == 0 || descriptor->height == 0) {
|
||||||
|
@ -198,9 +198,9 @@ namespace dawn_native {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!format->isRenderable &&
|
if (!format->isRenderable &&
|
||||||
(descriptor->usage & wgpu::TextureUsage::OutputAttachment)) {
|
(descriptor->usage & wgpu::TextureUsage::RenderAttachment)) {
|
||||||
return DAWN_VALIDATION_ERROR(
|
return DAWN_VALIDATION_ERROR(
|
||||||
"Non-renderable format used with OutputAttachment usage");
|
"Non-renderable format used with RenderAttachment usage");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!format->supportsStorageUsage &&
|
if (!format->supportsStorageUsage &&
|
||||||
|
@ -71,7 +71,7 @@ namespace dawn_native {
|
|||||||
|
|
||||||
static constexpr wgpu::TextureUsage kWritableTextureUsages =
|
static constexpr wgpu::TextureUsage kWritableTextureUsages =
|
||||||
wgpu::TextureUsage::CopyDst | wgpu::TextureUsage::Storage |
|
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
|
// Convert the TextureAspect to an Aspect mask for the format. ASSERTs if the aspect
|
||||||
// does not exist in the format.
|
// does not exist in the format.
|
||||||
|
@ -629,7 +629,7 @@ namespace dawn_native { namespace d3d12 {
|
|||||||
// Clear textures that are not output attachments. Output attachments will be
|
// Clear textures that are not output attachments. Output attachments will be
|
||||||
// cleared during record render pass if the texture subresource has not been
|
// cleared during record render pass if the texture subresource has not been
|
||||||
// initialized before the render pass.
|
// 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->EnsureSubresourceContentInitialized(commandContext,
|
||||||
texture->GetAllSubresources());
|
texture->GetAllSubresources());
|
||||||
}
|
}
|
||||||
|
@ -29,7 +29,7 @@ namespace dawn_native { namespace d3d12 {
|
|||||||
if (allowedUsages & WGPUTextureUsage_Storage) {
|
if (allowedUsages & WGPUTextureUsage_Storage) {
|
||||||
usage |= DXGI_USAGE_UNORDERED_ACCESS;
|
usage |= DXGI_USAGE_UNORDERED_ACCESS;
|
||||||
}
|
}
|
||||||
if (allowedUsages & WGPUTextureUsage_OutputAttachment) {
|
if (allowedUsages & WGPUTextureUsage_RenderAttachment) {
|
||||||
usage |= DXGI_USAGE_RENDER_TARGET_OUTPUT;
|
usage |= DXGI_USAGE_RENDER_TARGET_OUTPUT;
|
||||||
}
|
}
|
||||||
return usage;
|
return usage;
|
||||||
|
@ -56,7 +56,7 @@ namespace dawn_native { namespace d3d12 {
|
|||||||
if (usage & wgpu::TextureUsage::Storage) {
|
if (usage & wgpu::TextureUsage::Storage) {
|
||||||
resourceState |= D3D12_RESOURCE_STATE_UNORDERED_ACCESS;
|
resourceState |= D3D12_RESOURCE_STATE_UNORDERED_ACCESS;
|
||||||
}
|
}
|
||||||
if (usage & wgpu::TextureUsage::OutputAttachment) {
|
if (usage & wgpu::TextureUsage::RenderAttachment) {
|
||||||
if (format.HasDepthOrStencil()) {
|
if (format.HasDepthOrStencil()) {
|
||||||
resourceState |= D3D12_RESOURCE_STATE_DEPTH_WRITE;
|
resourceState |= D3D12_RESOURCE_STATE_DEPTH_WRITE;
|
||||||
} else {
|
} else {
|
||||||
@ -79,7 +79,7 @@ namespace dawn_native { namespace d3d12 {
|
|||||||
// A multisampled resource must have either D3D12_RESOURCE_FLAG_ALLOW_RENDER_TARGET or
|
// 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.
|
// 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
|
// 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()) {
|
if (format.HasDepthOrStencil()) {
|
||||||
flags |= D3D12_RESOURCE_FLAG_ALLOW_DEPTH_STENCIL;
|
flags |= D3D12_RESOURCE_FLAG_ALLOW_DEPTH_STENCIL;
|
||||||
} else {
|
} else {
|
||||||
@ -864,7 +864,7 @@ namespace dawn_native { namespace d3d12 {
|
|||||||
uint8_t clearColor = (clearValue == TextureBase::ClearValue::Zero) ? 0 : 1;
|
uint8_t clearColor = (clearValue == TextureBase::ClearValue::Zero) ? 0 : 1;
|
||||||
float fClearColor = (clearValue == TextureBase::ClearValue::Zero) ? 0.f : 1.f;
|
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()) {
|
if (GetFormat().HasDepthOrStencil()) {
|
||||||
TrackUsageAndTransitionNow(commandContext, D3D12_RESOURCE_STATE_DEPTH_WRITE, range);
|
TrackUsageAndTransitionNow(commandContext, D3D12_RESOURCE_STATE_DEPTH_WRITE, range);
|
||||||
|
|
||||||
|
@ -547,7 +547,7 @@ namespace dawn_native { namespace metal {
|
|||||||
// Clear textures that are not output attachments. Output attachments will be
|
// Clear textures that are not output attachments. Output attachments will be
|
||||||
// cleared in CreateMTLRenderPassDescriptor by setting the loadop to clear when the
|
// cleared in CreateMTLRenderPassDescriptor by setting the loadop to clear when the
|
||||||
// texture subresource has not been initialized before the render pass.
|
// 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());
|
texture->EnsureSubresourceContentInitialized(texture->GetAllSubresources());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -94,7 +94,7 @@ namespace dawn_native { namespace metal {
|
|||||||
size.height = GetHeight();
|
size.height = GetHeight();
|
||||||
[mLayer setDrawableSize:size];
|
[mLayer setDrawableSize:size];
|
||||||
|
|
||||||
[mLayer setFramebufferOnly:(GetUsage() == wgpu::TextureUsage::OutputAttachment)];
|
[mLayer setFramebufferOnly:(GetUsage() == wgpu::TextureUsage::RenderAttachment)];
|
||||||
[mLayer setDevice:ToBackend(GetDevice())->GetMTLDevice()];
|
[mLayer setDevice:ToBackend(GetDevice())->GetMTLDevice()];
|
||||||
[mLayer setPixelFormat:MetalPixelFormat(GetFormat())];
|
[mLayer setPixelFormat:MetalPixelFormat(GetFormat())];
|
||||||
|
|
||||||
|
@ -45,7 +45,7 @@ namespace dawn_native { namespace metal {
|
|||||||
result |= MTLTextureUsageShaderRead;
|
result |= MTLTextureUsageShaderRead;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (usage & (wgpu::TextureUsage::OutputAttachment)) {
|
if (usage & (wgpu::TextureUsage::RenderAttachment)) {
|
||||||
result |= MTLTextureUsageRenderTarget;
|
result |= MTLTextureUsageRenderTarget;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -385,7 +385,7 @@ namespace dawn_native { namespace metal {
|
|||||||
const uint8_t clearColor = (clearValue == TextureBase::ClearValue::Zero) ? 0 : 1;
|
const uint8_t clearColor = (clearValue == TextureBase::ClearValue::Zero) ? 0 : 1;
|
||||||
const double dClearColor = (clearValue == TextureBase::ClearValue::Zero) ? 0.0 : 1.0;
|
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);
|
ASSERT(GetFormat().isRenderable);
|
||||||
|
|
||||||
// End the blit encoder if it is open.
|
// End the blit encoder if it is open.
|
||||||
|
@ -445,7 +445,7 @@ namespace dawn_native { namespace opengl {
|
|||||||
// Clear textures that are not output attachments. Output attachments will be
|
// Clear textures that are not output attachments. Output attachments will be
|
||||||
// cleared in BeginRenderPass by setting the loadop to clear when the
|
// cleared in BeginRenderPass by setting the loadop to clear when the
|
||||||
// texture subresource has not been initialized before the render pass.
|
// 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());
|
texture->EnsureSubresourceContentInitialized(texture->GetAllSubresources());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -519,7 +519,7 @@ namespace dawn_native { namespace vulkan {
|
|||||||
// Clear textures that are not output attachments. Output attachments will be
|
// Clear textures that are not output attachments. Output attachments will be
|
||||||
// cleared in RecordBeginRenderPass by setting the loadop to clear when the
|
// cleared in RecordBeginRenderPass by setting the loadop to clear when the
|
||||||
// texture subresource has not been initialized before the render pass.
|
// 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->EnsureSubresourceContentInitialized(recordingContext,
|
||||||
texture->GetAllSubresources());
|
texture->GetAllSubresources());
|
||||||
}
|
}
|
||||||
|
@ -71,7 +71,7 @@ namespace dawn_native { namespace vulkan {
|
|||||||
if (usage & wgpu::TextureUsage::Storage) {
|
if (usage & wgpu::TextureUsage::Storage) {
|
||||||
flags |= VK_ACCESS_SHADER_READ_BIT | VK_ACCESS_SHADER_WRITE_BIT;
|
flags |= VK_ACCESS_SHADER_READ_BIT | VK_ACCESS_SHADER_WRITE_BIT;
|
||||||
}
|
}
|
||||||
if (usage & wgpu::TextureUsage::OutputAttachment) {
|
if (usage & wgpu::TextureUsage::RenderAttachment) {
|
||||||
if (format.HasDepthOrStencil()) {
|
if (format.HasDepthOrStencil()) {
|
||||||
flags |= VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_READ_BIT |
|
flags |= VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_READ_BIT |
|
||||||
VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_WRITE_BIT;
|
VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_WRITE_BIT;
|
||||||
@ -130,7 +130,7 @@ namespace dawn_native { namespace vulkan {
|
|||||||
case wgpu::TextureUsage::Storage:
|
case wgpu::TextureUsage::Storage:
|
||||||
case kReadonlyStorageTexture:
|
case kReadonlyStorageTexture:
|
||||||
return VK_IMAGE_LAYOUT_GENERAL;
|
return VK_IMAGE_LAYOUT_GENERAL;
|
||||||
case wgpu::TextureUsage::OutputAttachment:
|
case wgpu::TextureUsage::RenderAttachment:
|
||||||
if (format.HasDepthOrStencil()) {
|
if (format.HasDepthOrStencil()) {
|
||||||
return VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL;
|
return VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL;
|
||||||
} else {
|
} else {
|
||||||
@ -168,7 +168,7 @@ namespace dawn_native { namespace vulkan {
|
|||||||
flags |=
|
flags |=
|
||||||
VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT | VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT;
|
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()) {
|
if (format.HasDepthOrStencil()) {
|
||||||
flags |= VK_PIPELINE_STAGE_EARLY_FRAGMENT_TESTS_BIT |
|
flags |= VK_PIPELINE_STAGE_EARLY_FRAGMENT_TESTS_BIT |
|
||||||
VK_PIPELINE_STAGE_LATE_FRAGMENT_TESTS_BIT;
|
VK_PIPELINE_STAGE_LATE_FRAGMENT_TESTS_BIT;
|
||||||
@ -395,7 +395,7 @@ namespace dawn_native { namespace vulkan {
|
|||||||
if (usage & wgpu::TextureUsage::Storage) {
|
if (usage & wgpu::TextureUsage::Storage) {
|
||||||
flags |= VK_IMAGE_USAGE_STORAGE_BIT;
|
flags |= VK_IMAGE_USAGE_STORAGE_BIT;
|
||||||
}
|
}
|
||||||
if (usage & wgpu::TextureUsage::OutputAttachment) {
|
if (usage & wgpu::TextureUsage::RenderAttachment) {
|
||||||
if (format.HasDepthOrStencil()) {
|
if (format.HasDepthOrStencil()) {
|
||||||
flags |= VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT;
|
flags |= VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT;
|
||||||
} else {
|
} else {
|
||||||
|
@ -311,7 +311,7 @@ source_set("dawn_end2end_tests_sources") {
|
|||||||
"end2end/ScissorTests.cpp",
|
"end2end/ScissorTests.cpp",
|
||||||
"end2end/ShaderFloat16Tests.cpp",
|
"end2end/ShaderFloat16Tests.cpp",
|
||||||
"end2end/StorageTextureTests.cpp",
|
"end2end/StorageTextureTests.cpp",
|
||||||
"end2end/SubresourceOutputAttachmentTests.cpp",
|
"end2end/SubresourceRenderAttachmentTests.cpp",
|
||||||
"end2end/TextureFormatTests.cpp",
|
"end2end/TextureFormatTests.cpp",
|
||||||
"end2end/TextureSubresourceTests.cpp",
|
"end2end/TextureSubresourceTests.cpp",
|
||||||
"end2end/TextureViewTests.cpp",
|
"end2end/TextureViewTests.cpp",
|
||||||
|
@ -91,7 +91,7 @@ class BufferZeroInitTest : public DawnTest {
|
|||||||
descriptor.size = size;
|
descriptor.size = size;
|
||||||
descriptor.format = format;
|
descriptor.format = format;
|
||||||
descriptor.usage = wgpu::TextureUsage::CopyDst | wgpu::TextureUsage::CopySrc |
|
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::Texture texture = device.CreateTexture(&descriptor);
|
||||||
|
|
||||||
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
|
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
|
||||||
|
@ -59,7 +59,7 @@ class ClipSpaceTest : public DawnTest {
|
|||||||
textureDescriptor.dimension = wgpu::TextureDimension::e2D;
|
textureDescriptor.dimension = wgpu::TextureDimension::e2D;
|
||||||
textureDescriptor.format = format;
|
textureDescriptor.format = format;
|
||||||
textureDescriptor.usage =
|
textureDescriptor.usage =
|
||||||
wgpu::TextureUsage::OutputAttachment | wgpu::TextureUsage::CopySrc;
|
wgpu::TextureUsage::RenderAttachment | wgpu::TextureUsage::CopySrc;
|
||||||
textureDescriptor.mipLevelCount = 1;
|
textureDescriptor.mipLevelCount = 1;
|
||||||
textureDescriptor.sampleCount = 1;
|
textureDescriptor.sampleCount = 1;
|
||||||
textureDescriptor.size = {kSize, kSize, 1};
|
textureDescriptor.size = {kSize, kSize, 1};
|
||||||
|
@ -751,7 +751,7 @@ TEST_P(ColorStateTest, IndependentColorState) {
|
|||||||
descriptor.sampleCount = 1;
|
descriptor.sampleCount = 1;
|
||||||
descriptor.format = wgpu::TextureFormat::RGBA8Unorm;
|
descriptor.format = wgpu::TextureFormat::RGBA8Unorm;
|
||||||
descriptor.mipLevelCount = 1;
|
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) {
|
for (uint32_t i = 0; i < 4; ++i) {
|
||||||
renderTargets[i] = device.CreateTexture(&descriptor);
|
renderTargets[i] = device.CreateTexture(&descriptor);
|
||||||
|
@ -135,7 +135,7 @@ TEST_P(CreateReadyPipelineTest, CreateComputePipelineFailed) {
|
|||||||
|
|
||||||
// Verify the basic use of CreateReadyRenderPipeline() works on all backends.
|
// Verify the basic use of CreateReadyRenderPipeline() works on all backends.
|
||||||
TEST_P(CreateReadyPipelineTest, BasicUseOfCreateReadyRenderPipeline) {
|
TEST_P(CreateReadyPipelineTest, BasicUseOfCreateReadyRenderPipeline) {
|
||||||
constexpr wgpu::TextureFormat kOutputAttachmentFormat = wgpu::TextureFormat::RGBA8Unorm;
|
constexpr wgpu::TextureFormat kRenderAttachmentFormat = wgpu::TextureFormat::RGBA8Unorm;
|
||||||
|
|
||||||
const char* vertexShader = R"(
|
const char* vertexShader = R"(
|
||||||
#version 450
|
#version 450
|
||||||
@ -157,7 +157,7 @@ TEST_P(CreateReadyPipelineTest, BasicUseOfCreateReadyRenderPipeline) {
|
|||||||
utils::CreateShaderModule(device, utils::SingleShaderStage::Fragment, fragmentShader);
|
utils::CreateShaderModule(device, utils::SingleShaderStage::Fragment, fragmentShader);
|
||||||
renderPipelineDescriptor.vertexStage.module = vsModule;
|
renderPipelineDescriptor.vertexStage.module = vsModule;
|
||||||
renderPipelineDescriptor.cFragmentStage.module = fsModule;
|
renderPipelineDescriptor.cFragmentStage.module = fsModule;
|
||||||
renderPipelineDescriptor.cColorStates[0].format = kOutputAttachmentFormat;
|
renderPipelineDescriptor.cColorStates[0].format = kRenderAttachmentFormat;
|
||||||
renderPipelineDescriptor.primitiveTopology = wgpu::PrimitiveTopology::PointList;
|
renderPipelineDescriptor.primitiveTopology = wgpu::PrimitiveTopology::PointList;
|
||||||
|
|
||||||
device.CreateReadyRenderPipeline(
|
device.CreateReadyRenderPipeline(
|
||||||
@ -175,8 +175,8 @@ TEST_P(CreateReadyPipelineTest, BasicUseOfCreateReadyRenderPipeline) {
|
|||||||
|
|
||||||
wgpu::TextureDescriptor textureDescriptor;
|
wgpu::TextureDescriptor textureDescriptor;
|
||||||
textureDescriptor.size = {1, 1, 1};
|
textureDescriptor.size = {1, 1, 1};
|
||||||
textureDescriptor.format = kOutputAttachmentFormat;
|
textureDescriptor.format = kRenderAttachmentFormat;
|
||||||
textureDescriptor.usage = wgpu::TextureUsage::OutputAttachment | wgpu::TextureUsage::CopySrc;
|
textureDescriptor.usage = wgpu::TextureUsage::RenderAttachment | wgpu::TextureUsage::CopySrc;
|
||||||
wgpu::Texture outputTexture = device.CreateTexture(&textureDescriptor);
|
wgpu::Texture outputTexture = device.CreateTexture(&textureDescriptor);
|
||||||
|
|
||||||
utils::ComboRenderPassDescriptor renderPassDescriptor({outputTexture.CreateView()});
|
utils::ComboRenderPassDescriptor renderPassDescriptor({outputTexture.CreateView()});
|
||||||
@ -212,7 +212,7 @@ TEST_P(CreateReadyPipelineTest, BasicUseOfCreateReadyRenderPipeline) {
|
|||||||
TEST_P(CreateReadyPipelineTest, CreateRenderPipelineFailed) {
|
TEST_P(CreateReadyPipelineTest, CreateRenderPipelineFailed) {
|
||||||
DAWN_SKIP_TEST_IF(IsDawnValidationSkipped());
|
DAWN_SKIP_TEST_IF(IsDawnValidationSkipped());
|
||||||
|
|
||||||
constexpr wgpu::TextureFormat kOutputAttachmentFormat = wgpu::TextureFormat::Depth32Float;
|
constexpr wgpu::TextureFormat kRenderAttachmentFormat = wgpu::TextureFormat::Depth32Float;
|
||||||
|
|
||||||
const char* vertexShader = R"(
|
const char* vertexShader = R"(
|
||||||
#version 450
|
#version 450
|
||||||
@ -234,7 +234,7 @@ TEST_P(CreateReadyPipelineTest, CreateRenderPipelineFailed) {
|
|||||||
utils::CreateShaderModule(device, utils::SingleShaderStage::Fragment, fragmentShader);
|
utils::CreateShaderModule(device, utils::SingleShaderStage::Fragment, fragmentShader);
|
||||||
renderPipelineDescriptor.vertexStage.module = vsModule;
|
renderPipelineDescriptor.vertexStage.module = vsModule;
|
||||||
renderPipelineDescriptor.cFragmentStage.module = fsModule;
|
renderPipelineDescriptor.cFragmentStage.module = fsModule;
|
||||||
renderPipelineDescriptor.cColorStates[0].format = kOutputAttachmentFormat;
|
renderPipelineDescriptor.cColorStates[0].format = kRenderAttachmentFormat;
|
||||||
renderPipelineDescriptor.primitiveTopology = wgpu::PrimitiveTopology::PointList;
|
renderPipelineDescriptor.primitiveTopology = wgpu::PrimitiveTopology::PointList;
|
||||||
|
|
||||||
device.CreateReadyRenderPipeline(
|
device.CreateReadyRenderPipeline(
|
||||||
|
@ -63,7 +63,7 @@ class CullingTest : public DawnTest {
|
|||||||
textureDescriptor.dimension = wgpu::TextureDimension::e2D;
|
textureDescriptor.dimension = wgpu::TextureDimension::e2D;
|
||||||
textureDescriptor.format = format;
|
textureDescriptor.format = format;
|
||||||
textureDescriptor.usage =
|
textureDescriptor.usage =
|
||||||
wgpu::TextureUsage::OutputAttachment | wgpu::TextureUsage::CopySrc;
|
wgpu::TextureUsage::RenderAttachment | wgpu::TextureUsage::CopySrc;
|
||||||
textureDescriptor.mipLevelCount = 1;
|
textureDescriptor.mipLevelCount = 1;
|
||||||
textureDescriptor.sampleCount = 1;
|
textureDescriptor.sampleCount = 1;
|
||||||
textureDescriptor.size = {kSize, kSize, 1};
|
textureDescriptor.size = {kSize, kSize, 1};
|
||||||
|
@ -65,7 +65,7 @@ namespace {
|
|||||||
baseDawnDescriptor.sampleCount = 1;
|
baseDawnDescriptor.sampleCount = 1;
|
||||||
baseDawnDescriptor.mipLevelCount = 1;
|
baseDawnDescriptor.mipLevelCount = 1;
|
||||||
baseDawnDescriptor.usage = wgpu::TextureUsage::Sampled | wgpu::TextureUsage::CopySrc |
|
baseDawnDescriptor.usage = wgpu::TextureUsage::Sampled | wgpu::TextureUsage::CopySrc |
|
||||||
wgpu::TextureUsage::OutputAttachment |
|
wgpu::TextureUsage::RenderAttachment |
|
||||||
wgpu::TextureUsage::CopyDst;
|
wgpu::TextureUsage::CopyDst;
|
||||||
|
|
||||||
baseD3dDescriptor.Width = kTestWidth;
|
baseD3dDescriptor.Width = kTestWidth;
|
||||||
|
@ -71,7 +71,7 @@ class DepthBiasTests : public DawnTest {
|
|||||||
wgpu::TextureDescriptor descriptor;
|
wgpu::TextureDescriptor descriptor;
|
||||||
descriptor.size = {kRTSize, kRTSize, 1};
|
descriptor.size = {kRTSize, kRTSize, 1};
|
||||||
descriptor.format = depthFormat;
|
descriptor.format = depthFormat;
|
||||||
descriptor.usage = wgpu::TextureUsage::OutputAttachment | wgpu::TextureUsage::CopySrc;
|
descriptor.usage = wgpu::TextureUsage::RenderAttachment | wgpu::TextureUsage::CopySrc;
|
||||||
mDepthTexture = device.CreateTexture(&descriptor);
|
mDepthTexture = device.CreateTexture(&descriptor);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -79,7 +79,7 @@ class DepthBiasTests : public DawnTest {
|
|||||||
wgpu::TextureDescriptor descriptor;
|
wgpu::TextureDescriptor descriptor;
|
||||||
descriptor.size = {kRTSize, kRTSize, 1};
|
descriptor.size = {kRTSize, kRTSize, 1};
|
||||||
descriptor.format = wgpu::TextureFormat::RGBA8Unorm;
|
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);
|
mRenderTarget = device.CreateTexture(&descriptor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -50,14 +50,14 @@ class DepthSamplingTest : public DawnTest {
|
|||||||
mTextureUploadBuffer = device.CreateBuffer(&textureUploadDesc);
|
mTextureUploadBuffer = device.CreateBuffer(&textureUploadDesc);
|
||||||
|
|
||||||
wgpu::TextureDescriptor inputTextureDesc;
|
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.size = {1, 1, 1};
|
||||||
inputTextureDesc.format = wgpu::TextureFormat::Depth32Float;
|
inputTextureDesc.format = wgpu::TextureFormat::Depth32Float;
|
||||||
mInputTexture = device.CreateTexture(&inputTextureDesc);
|
mInputTexture = device.CreateTexture(&inputTextureDesc);
|
||||||
|
|
||||||
wgpu::TextureDescriptor outputTextureDesc;
|
wgpu::TextureDescriptor outputTextureDesc;
|
||||||
outputTextureDesc.usage =
|
outputTextureDesc.usage =
|
||||||
wgpu::TextureUsage::OutputAttachment | wgpu::TextureUsage::CopySrc;
|
wgpu::TextureUsage::RenderAttachment | wgpu::TextureUsage::CopySrc;
|
||||||
outputTextureDesc.size = {1, 1, 1};
|
outputTextureDesc.size = {1, 1, 1};
|
||||||
outputTextureDesc.format = wgpu::TextureFormat::R32Float;
|
outputTextureDesc.format = wgpu::TextureFormat::R32Float;
|
||||||
mOutputTexture = device.CreateTexture(&outputTextureDesc);
|
mOutputTexture = device.CreateTexture(&outputTextureDesc);
|
||||||
|
@ -155,7 +155,7 @@ class DepthStencilCopyTests : public DawnTest {
|
|||||||
wgpu::TextureUsage usage,
|
wgpu::TextureUsage usage,
|
||||||
uint32_t mipLevel = 0) {
|
uint32_t mipLevel = 0) {
|
||||||
wgpu::Texture src = CreateDepthStencilTexture(
|
wgpu::Texture src = CreateDepthStencilTexture(
|
||||||
width, height, wgpu::TextureUsage::OutputAttachment | wgpu::TextureUsage::CopySrc,
|
width, height, wgpu::TextureUsage::RenderAttachment | wgpu::TextureUsage::CopySrc,
|
||||||
mipLevel + 1);
|
mipLevel + 1);
|
||||||
|
|
||||||
wgpu::Texture dst = CreateDepthStencilTexture(
|
wgpu::Texture dst = CreateDepthStencilTexture(
|
||||||
@ -193,7 +193,7 @@ class DepthStencilCopyTests : public DawnTest {
|
|||||||
wgpu::TextureDescriptor colorTexDesc = {};
|
wgpu::TextureDescriptor colorTexDesc = {};
|
||||||
colorTexDesc.size = {width, height, 1};
|
colorTexDesc.size = {width, height, 1};
|
||||||
colorTexDesc.format = wgpu::TextureFormat::R32Uint;
|
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);
|
wgpu::Texture colorTexture = device.CreateTexture(&colorTexDesc);
|
||||||
|
|
||||||
// Make a sampleable texture to store the depth data. We'll sample this in the
|
// 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;
|
constexpr uint32_t kHeight = 4;
|
||||||
|
|
||||||
wgpu::Texture depthTexture = CreateDepthTexture(
|
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);
|
InitializeDepthTextureRegion(depthTexture, 0.f, 0.3f);
|
||||||
|
|
||||||
@ -327,7 +327,7 @@ TEST_P(DepthStencilCopyTests, FromStencilAspect) {
|
|||||||
constexpr uint32_t kHeight = 4;
|
constexpr uint32_t kHeight = 4;
|
||||||
|
|
||||||
wgpu::Texture depthStencilTexture = CreateDepthStencilTexture(
|
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);
|
InitializeDepthStencilTextureRegion(depthStencilTexture, 0.f, 0.3f, 0u, 1u);
|
||||||
|
|
||||||
@ -349,7 +349,7 @@ TEST_P(DepthStencilCopyTests, FromNonZeroMipStencilAspect) {
|
|||||||
DAWN_SKIP_TEST_IF(IsMetal() && IsIntel());
|
DAWN_SKIP_TEST_IF(IsMetal() && IsIntel());
|
||||||
|
|
||||||
wgpu::Texture depthStencilTexture = CreateDepthStencilTexture(
|
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);
|
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 copying the non-zero mip, depth-only aspect into a buffer.
|
||||||
TEST_P(DepthStencilCopyTests, FromNonZeroMipDepthAspect) {
|
TEST_P(DepthStencilCopyTests, FromNonZeroMipDepthAspect) {
|
||||||
wgpu::Texture depthTexture = CreateDepthTexture(
|
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);
|
InitializeDepthTextureRegion(depthTexture, 0.f, 0.4f, 1);
|
||||||
|
|
||||||
@ -386,8 +386,8 @@ TEST_P(DepthStencilCopyTests, FromNonZeroMipDepthAspect) {
|
|||||||
TEST_P(DepthStencilCopyTests, T2TBothAspectsThenCopyStencil) {
|
TEST_P(DepthStencilCopyTests, T2TBothAspectsThenCopyStencil) {
|
||||||
// TODO(enga): Figure out why this fails on MacOS Intel Iris.
|
// TODO(enga): Figure out why this fails on MacOS Intel Iris.
|
||||||
// It passes on AMD Radeon Pro and Intel HD Graphics 630.
|
// It passes on AMD Radeon Pro and Intel HD Graphics 630.
|
||||||
// Maybe has to do with the OutputAttachment usage. Notably, a later test
|
// Maybe has to do with the RenderAttachment usage. Notably, a later test
|
||||||
// T2TBothAspectsThenCopyNonRenderableStencil does not use OutputAttachment and works correctly.
|
// T2TBothAspectsThenCopyNonRenderableStencil does not use RenderAttachment and works correctly.
|
||||||
DAWN_SKIP_TEST_IF(IsMetal() && IsIntel());
|
DAWN_SKIP_TEST_IF(IsMetal() && IsIntel());
|
||||||
|
|
||||||
constexpr uint32_t kWidth = 4;
|
constexpr uint32_t kWidth = 4;
|
||||||
@ -395,7 +395,7 @@ TEST_P(DepthStencilCopyTests, T2TBothAspectsThenCopyStencil) {
|
|||||||
|
|
||||||
wgpu::Texture texture = CreateInitializeDepthStencilTextureAndCopyT2T(
|
wgpu::Texture texture = CreateInitializeDepthStencilTextureAndCopyT2T(
|
||||||
0.1f, 0.3f, 1u, 3u, kWidth, kHeight,
|
0.1f, 0.3f, 1u, 3u, kWidth, kHeight,
|
||||||
wgpu::TextureUsage::CopySrc | wgpu::TextureUsage::OutputAttachment);
|
wgpu::TextureUsage::CopySrc | wgpu::TextureUsage::RenderAttachment);
|
||||||
|
|
||||||
// Check the stencil
|
// Check the stencil
|
||||||
std::vector<uint8_t> expectedData = {
|
std::vector<uint8_t> expectedData = {
|
||||||
@ -457,7 +457,7 @@ TEST_P(DepthStencilCopyTests, T2TBothAspectsThenCopyDepth) {
|
|||||||
constexpr uint32_t kHeight = 4;
|
constexpr uint32_t kHeight = 4;
|
||||||
|
|
||||||
wgpu::Texture texture = CreateInitializeDepthStencilTextureAndCopyT2T(
|
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
|
// Check the depth
|
||||||
ExpectDepthData(texture, wgpu::TextureFormat::Depth24PlusStencil8, kWidth, kHeight, 0,
|
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 copying both aspects in a T2T copy, then copying only depth at a nonzero mip.
|
||||||
TEST_P(DepthStencilCopyTests, T2TBothAspectsThenCopyNonZeroMipDepth) {
|
TEST_P(DepthStencilCopyTests, T2TBothAspectsThenCopyNonZeroMipDepth) {
|
||||||
wgpu::Texture texture = CreateInitializeDepthStencilTextureAndCopyT2T(
|
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
|
// Check the depth
|
||||||
ExpectDepthData(texture, wgpu::TextureFormat::Depth24PlusStencil8, 4, 4, 1,
|
ExpectDepthData(texture, wgpu::TextureFormat::Depth24PlusStencil8, 4, 4, 1,
|
||||||
@ -491,7 +491,7 @@ TEST_P(DepthStencilCopyTests, T2TBothAspectsThenCopyStencilThenDepth) {
|
|||||||
|
|
||||||
wgpu::Texture texture = CreateInitializeDepthStencilTextureAndCopyT2T(
|
wgpu::Texture texture = CreateInitializeDepthStencilTextureAndCopyT2T(
|
||||||
0.1f, 0.3f, 1u, 3u, kWidth, kHeight,
|
0.1f, 0.3f, 1u, 3u, kWidth, kHeight,
|
||||||
wgpu::TextureUsage::CopySrc | wgpu::TextureUsage::OutputAttachment);
|
wgpu::TextureUsage::CopySrc | wgpu::TextureUsage::RenderAttachment);
|
||||||
|
|
||||||
// Check the stencil
|
// Check the stencil
|
||||||
std::vector<uint8_t> expectedData = {
|
std::vector<uint8_t> expectedData = {
|
||||||
@ -527,7 +527,7 @@ TEST_P(DepthStencilCopyTests, T2TBothAspectsThenCopyDepthThenStencil) {
|
|||||||
|
|
||||||
wgpu::Texture texture = CreateInitializeDepthStencilTextureAndCopyT2T(
|
wgpu::Texture texture = CreateInitializeDepthStencilTextureAndCopyT2T(
|
||||||
0.1f, 0.3f, 1u, 3u, kWidth, kHeight,
|
0.1f, 0.3f, 1u, 3u, kWidth, kHeight,
|
||||||
wgpu::TextureUsage::CopySrc | wgpu::TextureUsage::OutputAttachment);
|
wgpu::TextureUsage::CopySrc | wgpu::TextureUsage::RenderAttachment);
|
||||||
|
|
||||||
// Check the depth
|
// Check the depth
|
||||||
ExpectDepthData(texture, wgpu::TextureFormat::Depth24PlusStencil8, kWidth, kHeight, 0,
|
ExpectDepthData(texture, wgpu::TextureFormat::Depth24PlusStencil8, kWidth, kHeight, 0,
|
||||||
@ -568,7 +568,7 @@ TEST_P(DepthStencilCopyTests, ToStencilAspect) {
|
|||||||
|
|
||||||
wgpu::Texture depthStencilTexture =
|
wgpu::Texture depthStencilTexture =
|
||||||
CreateDepthStencilTexture(kWidth, kHeight,
|
CreateDepthStencilTexture(kWidth, kHeight,
|
||||||
wgpu::TextureUsage::OutputAttachment |
|
wgpu::TextureUsage::RenderAttachment |
|
||||||
wgpu::TextureUsage::CopySrc | wgpu::TextureUsage::CopyDst);
|
wgpu::TextureUsage::CopySrc | wgpu::TextureUsage::CopyDst);
|
||||||
|
|
||||||
{
|
{
|
||||||
|
@ -34,7 +34,7 @@ class DepthStencilStateTest : public DawnTest {
|
|||||||
renderTargetDescriptor.format = wgpu::TextureFormat::RGBA8Unorm;
|
renderTargetDescriptor.format = wgpu::TextureFormat::RGBA8Unorm;
|
||||||
renderTargetDescriptor.mipLevelCount = 1;
|
renderTargetDescriptor.mipLevelCount = 1;
|
||||||
renderTargetDescriptor.usage =
|
renderTargetDescriptor.usage =
|
||||||
wgpu::TextureUsage::OutputAttachment | wgpu::TextureUsage::CopySrc;
|
wgpu::TextureUsage::RenderAttachment | wgpu::TextureUsage::CopySrc;
|
||||||
renderTarget = device.CreateTexture(&renderTargetDescriptor);
|
renderTarget = device.CreateTexture(&renderTargetDescriptor);
|
||||||
|
|
||||||
renderTargetView = renderTarget.CreateView();
|
renderTargetView = renderTarget.CreateView();
|
||||||
@ -47,7 +47,7 @@ class DepthStencilStateTest : public DawnTest {
|
|||||||
depthDescriptor.sampleCount = 1;
|
depthDescriptor.sampleCount = 1;
|
||||||
depthDescriptor.format = wgpu::TextureFormat::Depth24PlusStencil8;
|
depthDescriptor.format = wgpu::TextureFormat::Depth24PlusStencil8;
|
||||||
depthDescriptor.mipLevelCount = 1;
|
depthDescriptor.mipLevelCount = 1;
|
||||||
depthDescriptor.usage = wgpu::TextureUsage::OutputAttachment;
|
depthDescriptor.usage = wgpu::TextureUsage::RenderAttachment;
|
||||||
depthTexture = device.CreateTexture(&depthDescriptor);
|
depthTexture = device.CreateTexture(&depthDescriptor);
|
||||||
|
|
||||||
depthTextureView = depthTexture.CreateView();
|
depthTextureView = depthTexture.CreateView();
|
||||||
|
@ -226,7 +226,7 @@ TEST_P(DeviceLostTest, CreateTextureFails) {
|
|||||||
descriptor.size.depth = 1;
|
descriptor.size.depth = 1;
|
||||||
descriptor.mipLevelCount = 1;
|
descriptor.mipLevelCount = 1;
|
||||||
descriptor.dimension = wgpu::TextureDimension::e2D;
|
descriptor.dimension = wgpu::TextureDimension::e2D;
|
||||||
descriptor.usage = wgpu::TextureUsage::OutputAttachment;
|
descriptor.usage = wgpu::TextureUsage::RenderAttachment;
|
||||||
|
|
||||||
ASSERT_DEVICE_ERROR(device.CreateTexture(&descriptor));
|
ASSERT_DEVICE_ERROR(device.CreateTexture(&descriptor));
|
||||||
}
|
}
|
||||||
|
@ -123,7 +123,7 @@ class IOSurfaceValidationTests : public IOSurfaceTestBase {
|
|||||||
descriptor.size = {10, 10, 1};
|
descriptor.size = {10, 10, 1};
|
||||||
descriptor.sampleCount = 1;
|
descriptor.sampleCount = 1;
|
||||||
descriptor.mipLevelCount = 1;
|
descriptor.mipLevelCount = 1;
|
||||||
descriptor.usage = wgpu::TextureUsage::OutputAttachment;
|
descriptor.usage = wgpu::TextureUsage::RenderAttachment;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
@ -339,7 +339,7 @@ class IOSurfaceUsageTests : public IOSurfaceTestBase {
|
|||||||
textureDescriptor.size = {1, 1, 1};
|
textureDescriptor.size = {1, 1, 1};
|
||||||
textureDescriptor.sampleCount = 1;
|
textureDescriptor.sampleCount = 1;
|
||||||
textureDescriptor.mipLevelCount = 1;
|
textureDescriptor.mipLevelCount = 1;
|
||||||
textureDescriptor.usage = wgpu::TextureUsage::OutputAttachment;
|
textureDescriptor.usage = wgpu::TextureUsage::RenderAttachment;
|
||||||
wgpu::Texture ioSurfaceTexture = WrapIOSurface(&textureDescriptor, ioSurface, 0);
|
wgpu::Texture ioSurfaceTexture = WrapIOSurface(&textureDescriptor, ioSurface, 0);
|
||||||
|
|
||||||
wgpu::TextureView ioSurfaceView = ioSurfaceTexture.CreateView();
|
wgpu::TextureView ioSurfaceView = ioSurfaceTexture.CreateView();
|
||||||
@ -463,7 +463,7 @@ TEST_P(IOSurfaceUsageTests, UninitializedTextureIsCleared) {
|
|||||||
textureDescriptor.size = {1, 1, 1};
|
textureDescriptor.size = {1, 1, 1};
|
||||||
textureDescriptor.sampleCount = 1;
|
textureDescriptor.sampleCount = 1;
|
||||||
textureDescriptor.mipLevelCount = 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
|
// wrap ioSurface and ensure color is not visible when isInitialized set to false
|
||||||
wgpu::Texture ioSurfaceTexture = WrapIOSurface(&textureDescriptor, ioSurface.get(), 0, false);
|
wgpu::Texture ioSurfaceTexture = WrapIOSurface(&textureDescriptor, ioSurface.get(), 0, false);
|
||||||
|
@ -27,12 +27,12 @@ class MultisampledRenderingTest : public DawnTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void InitTexturesForTest() {
|
void InitTexturesForTest() {
|
||||||
mMultisampledColorTexture = CreateTextureForOutputAttachment(kColorFormat, kSampleCount);
|
mMultisampledColorTexture = CreateTextureForRenderAttachment(kColorFormat, kSampleCount);
|
||||||
mMultisampledColorView = mMultisampledColorTexture.CreateView();
|
mMultisampledColorView = mMultisampledColorTexture.CreateView();
|
||||||
mResolveTexture = CreateTextureForOutputAttachment(kColorFormat, 1);
|
mResolveTexture = CreateTextureForRenderAttachment(kColorFormat, 1);
|
||||||
mResolveView = mResolveTexture.CreateView();
|
mResolveView = mResolveTexture.CreateView();
|
||||||
|
|
||||||
mDepthStencilTexture = CreateTextureForOutputAttachment(kDepthStencilFormat, kSampleCount);
|
mDepthStencilTexture = CreateTextureForRenderAttachment(kDepthStencilFormat, kSampleCount);
|
||||||
mDepthStencilView = mDepthStencilTexture.CreateView();
|
mDepthStencilView = mDepthStencilTexture.CreateView();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -89,7 +89,7 @@ class MultisampledRenderingTest : public DawnTest {
|
|||||||
alphaToCoverageEnabled);
|
alphaToCoverageEnabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
wgpu::Texture CreateTextureForOutputAttachment(wgpu::TextureFormat format,
|
wgpu::Texture CreateTextureForRenderAttachment(wgpu::TextureFormat format,
|
||||||
uint32_t sampleCount,
|
uint32_t sampleCount,
|
||||||
uint32_t mipLevelCount = 1,
|
uint32_t mipLevelCount = 1,
|
||||||
uint32_t arrayLayerCount = 1) {
|
uint32_t arrayLayerCount = 1) {
|
||||||
@ -101,7 +101,7 @@ class MultisampledRenderingTest : public DawnTest {
|
|||||||
descriptor.sampleCount = sampleCount;
|
descriptor.sampleCount = sampleCount;
|
||||||
descriptor.format = format;
|
descriptor.format = format;
|
||||||
descriptor.mipLevelCount = mipLevelCount;
|
descriptor.mipLevelCount = mipLevelCount;
|
||||||
descriptor.usage = wgpu::TextureUsage::OutputAttachment | wgpu::TextureUsage::CopySrc;
|
descriptor.usage = wgpu::TextureUsage::RenderAttachment | wgpu::TextureUsage::CopySrc;
|
||||||
return device.CreateTexture(&descriptor);
|
return device.CreateTexture(&descriptor);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -395,8 +395,8 @@ TEST_P(MultisampledRenderingTest, ResolveIntoMultipleResolveTargets) {
|
|||||||
DAWN_SKIP_TEST_IF(IsD3D12() && IsNvidia() && IsBackendValidationEnabled());
|
DAWN_SKIP_TEST_IF(IsD3D12() && IsNvidia() && IsBackendValidationEnabled());
|
||||||
|
|
||||||
wgpu::TextureView multisampledColorView2 =
|
wgpu::TextureView multisampledColorView2 =
|
||||||
CreateTextureForOutputAttachment(kColorFormat, kSampleCount).CreateView();
|
CreateTextureForRenderAttachment(kColorFormat, kSampleCount).CreateView();
|
||||||
wgpu::Texture resolveTexture2 = CreateTextureForOutputAttachment(kColorFormat, 1);
|
wgpu::Texture resolveTexture2 = CreateTextureForRenderAttachment(kColorFormat, 1);
|
||||||
wgpu::TextureView resolveView2 = resolveTexture2.CreateView();
|
wgpu::TextureView resolveView2 = resolveTexture2.CreateView();
|
||||||
|
|
||||||
wgpu::CommandEncoder commandEncoder = device.CreateCommandEncoder();
|
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};
|
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.
|
// 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;
|
textureViewDescriptor.baseMipLevel = kBaseMipLevel;
|
||||||
|
|
||||||
wgpu::Texture resolveTexture =
|
wgpu::Texture resolveTexture =
|
||||||
CreateTextureForOutputAttachment(kColorFormat, 1, kBaseMipLevel + 1, 1);
|
CreateTextureForRenderAttachment(kColorFormat, 1, kBaseMipLevel + 1, 1);
|
||||||
wgpu::TextureView resolveView = resolveTexture.CreateView(&textureViewDescriptor);
|
wgpu::TextureView resolveView = resolveTexture.CreateView(&textureViewDescriptor);
|
||||||
|
|
||||||
wgpu::CommandEncoder commandEncoder = device.CreateCommandEncoder();
|
wgpu::CommandEncoder commandEncoder = device.CreateCommandEncoder();
|
||||||
@ -511,7 +511,7 @@ TEST_P(MultisampledRenderingTest, ResolveInto2DArrayTexture) {
|
|||||||
DAWN_SKIP_TEST_IF(IsD3D12() && IsNvidia() && IsBackendValidationEnabled());
|
DAWN_SKIP_TEST_IF(IsD3D12() && IsNvidia() && IsBackendValidationEnabled());
|
||||||
|
|
||||||
wgpu::TextureView multisampledColorView2 =
|
wgpu::TextureView multisampledColorView2 =
|
||||||
CreateTextureForOutputAttachment(kColorFormat, kSampleCount).CreateView();
|
CreateTextureForRenderAttachment(kColorFormat, kSampleCount).CreateView();
|
||||||
|
|
||||||
wgpu::TextureViewDescriptor baseTextureViewDescriptor;
|
wgpu::TextureViewDescriptor baseTextureViewDescriptor;
|
||||||
baseTextureViewDescriptor.dimension = wgpu::TextureViewDimension::e2D;
|
baseTextureViewDescriptor.dimension = wgpu::TextureViewDimension::e2D;
|
||||||
@ -523,7 +523,7 @@ TEST_P(MultisampledRenderingTest, ResolveInto2DArrayTexture) {
|
|||||||
constexpr uint32_t kBaseArrayLayer1 = 2;
|
constexpr uint32_t kBaseArrayLayer1 = 2;
|
||||||
constexpr uint32_t kBaseMipLevel1 = 0;
|
constexpr uint32_t kBaseMipLevel1 = 0;
|
||||||
wgpu::Texture resolveTexture1 =
|
wgpu::Texture resolveTexture1 =
|
||||||
CreateTextureForOutputAttachment(kColorFormat, 1, kBaseMipLevel1 + 1, kBaseArrayLayer1 + 1);
|
CreateTextureForRenderAttachment(kColorFormat, 1, kBaseMipLevel1 + 1, kBaseArrayLayer1 + 1);
|
||||||
wgpu::TextureViewDescriptor resolveViewDescriptor1 = baseTextureViewDescriptor;
|
wgpu::TextureViewDescriptor resolveViewDescriptor1 = baseTextureViewDescriptor;
|
||||||
resolveViewDescriptor1.baseArrayLayer = kBaseArrayLayer1;
|
resolveViewDescriptor1.baseArrayLayer = kBaseArrayLayer1;
|
||||||
resolveViewDescriptor1.baseMipLevel = kBaseMipLevel1;
|
resolveViewDescriptor1.baseMipLevel = kBaseMipLevel1;
|
||||||
@ -534,7 +534,7 @@ TEST_P(MultisampledRenderingTest, ResolveInto2DArrayTexture) {
|
|||||||
constexpr uint32_t kBaseArrayLayer2 = 5;
|
constexpr uint32_t kBaseArrayLayer2 = 5;
|
||||||
constexpr uint32_t kBaseMipLevel2 = 3;
|
constexpr uint32_t kBaseMipLevel2 = 3;
|
||||||
wgpu::Texture resolveTexture2 =
|
wgpu::Texture resolveTexture2 =
|
||||||
CreateTextureForOutputAttachment(kColorFormat, 1, kBaseMipLevel2 + 1, kBaseArrayLayer2 + 1);
|
CreateTextureForRenderAttachment(kColorFormat, 1, kBaseMipLevel2 + 1, kBaseArrayLayer2 + 1);
|
||||||
wgpu::TextureViewDescriptor resolveViewDescriptor2 = baseTextureViewDescriptor;
|
wgpu::TextureViewDescriptor resolveViewDescriptor2 = baseTextureViewDescriptor;
|
||||||
resolveViewDescriptor2.baseArrayLayer = kBaseArrayLayer2;
|
resolveViewDescriptor2.baseArrayLayer = kBaseArrayLayer2;
|
||||||
resolveViewDescriptor2.baseMipLevel = kBaseMipLevel2;
|
resolveViewDescriptor2.baseMipLevel = kBaseMipLevel2;
|
||||||
@ -629,8 +629,8 @@ TEST_P(MultisampledRenderingTest, ResolveInto2DTextureWithEmptyFinalSampleMask)
|
|||||||
// mask.
|
// mask.
|
||||||
TEST_P(MultisampledRenderingTest, ResolveIntoMultipleResolveTargetsWithSampleMask) {
|
TEST_P(MultisampledRenderingTest, ResolveIntoMultipleResolveTargetsWithSampleMask) {
|
||||||
wgpu::TextureView multisampledColorView2 =
|
wgpu::TextureView multisampledColorView2 =
|
||||||
CreateTextureForOutputAttachment(kColorFormat, kSampleCount).CreateView();
|
CreateTextureForRenderAttachment(kColorFormat, kSampleCount).CreateView();
|
||||||
wgpu::Texture resolveTexture2 = CreateTextureForOutputAttachment(kColorFormat, 1);
|
wgpu::Texture resolveTexture2 = CreateTextureForRenderAttachment(kColorFormat, 1);
|
||||||
wgpu::TextureView resolveView2 = resolveTexture2.CreateView();
|
wgpu::TextureView resolveView2 = resolveTexture2.CreateView();
|
||||||
|
|
||||||
// The first and fourth samples are included,
|
// The first and fourth samples are included,
|
||||||
@ -774,8 +774,8 @@ TEST_P(MultisampledRenderingTest, ResolveInto2DTextureWithSampleMaskAndShaderOut
|
|||||||
// shader-output mask.
|
// shader-output mask.
|
||||||
TEST_P(MultisampledRenderingTest, ResolveIntoMultipleResolveTargetsWithShaderOutputMask) {
|
TEST_P(MultisampledRenderingTest, ResolveIntoMultipleResolveTargetsWithShaderOutputMask) {
|
||||||
wgpu::TextureView multisampledColorView2 =
|
wgpu::TextureView multisampledColorView2 =
|
||||||
CreateTextureForOutputAttachment(kColorFormat, kSampleCount).CreateView();
|
CreateTextureForRenderAttachment(kColorFormat, kSampleCount).CreateView();
|
||||||
wgpu::Texture resolveTexture2 = CreateTextureForOutputAttachment(kColorFormat, 1);
|
wgpu::Texture resolveTexture2 = CreateTextureForRenderAttachment(kColorFormat, 1);
|
||||||
wgpu::TextureView resolveView2 = resolveTexture2.CreateView();
|
wgpu::TextureView resolveView2 = resolveTexture2.CreateView();
|
||||||
|
|
||||||
wgpu::CommandEncoder commandEncoder = device.CreateCommandEncoder();
|
wgpu::CommandEncoder commandEncoder = device.CreateCommandEncoder();
|
||||||
@ -871,8 +871,8 @@ TEST_P(MultisampledRenderingTest, ResolveInto2DTextureWithAlphaToCoverage) {
|
|||||||
// component of the first color output attachment.
|
// component of the first color output attachment.
|
||||||
TEST_P(MultisampledRenderingTest, ResolveIntoMultipleResolveTargetsWithAlphaToCoverage) {
|
TEST_P(MultisampledRenderingTest, ResolveIntoMultipleResolveTargetsWithAlphaToCoverage) {
|
||||||
wgpu::TextureView multisampledColorView2 =
|
wgpu::TextureView multisampledColorView2 =
|
||||||
CreateTextureForOutputAttachment(kColorFormat, kSampleCount).CreateView();
|
CreateTextureForRenderAttachment(kColorFormat, kSampleCount).CreateView();
|
||||||
wgpu::Texture resolveTexture2 = CreateTextureForOutputAttachment(kColorFormat, 1);
|
wgpu::Texture resolveTexture2 = CreateTextureForRenderAttachment(kColorFormat, 1);
|
||||||
wgpu::TextureView resolveView2 = resolveTexture2.CreateView();
|
wgpu::TextureView resolveView2 = resolveTexture2.CreateView();
|
||||||
constexpr uint32_t kSampleMask = 0xFFFFFFFF;
|
constexpr uint32_t kSampleMask = 0xFFFFFFFF;
|
||||||
constexpr float kMSAACoverage = 0.50f;
|
constexpr float kMSAACoverage = 0.50f;
|
||||||
|
@ -131,7 +131,7 @@ TEST_P(MultisampledSamplingTest, SamplePositions) {
|
|||||||
wgpu::Texture colorTexture;
|
wgpu::Texture colorTexture;
|
||||||
{
|
{
|
||||||
wgpu::TextureDescriptor desc = {};
|
wgpu::TextureDescriptor desc = {};
|
||||||
desc.usage = wgpu::TextureUsage::Sampled | wgpu::TextureUsage::OutputAttachment;
|
desc.usage = wgpu::TextureUsage::Sampled | wgpu::TextureUsage::RenderAttachment;
|
||||||
desc.size = kTextureSize;
|
desc.size = kTextureSize;
|
||||||
desc.format = kColorFormat;
|
desc.format = kColorFormat;
|
||||||
desc.sampleCount = kSampleCount;
|
desc.sampleCount = kSampleCount;
|
||||||
@ -141,7 +141,7 @@ TEST_P(MultisampledSamplingTest, SamplePositions) {
|
|||||||
wgpu::Texture depthTexture;
|
wgpu::Texture depthTexture;
|
||||||
{
|
{
|
||||||
wgpu::TextureDescriptor desc = {};
|
wgpu::TextureDescriptor desc = {};
|
||||||
desc.usage = wgpu::TextureUsage::Sampled | wgpu::TextureUsage::OutputAttachment;
|
desc.usage = wgpu::TextureUsage::Sampled | wgpu::TextureUsage::RenderAttachment;
|
||||||
desc.size = kTextureSize;
|
desc.size = kTextureSize;
|
||||||
desc.format = kDepthFormat;
|
desc.format = kDepthFormat;
|
||||||
desc.sampleCount = kSampleCount;
|
desc.sampleCount = kSampleCount;
|
||||||
|
@ -37,7 +37,7 @@ TEST_P(NonzeroTextureCreationTests, TextureCreationClears) {
|
|||||||
descriptor.sampleCount = 1;
|
descriptor.sampleCount = 1;
|
||||||
descriptor.format = wgpu::TextureFormat::RGBA8Unorm;
|
descriptor.format = wgpu::TextureFormat::RGBA8Unorm;
|
||||||
descriptor.mipLevelCount = 1;
|
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);
|
wgpu::Texture texture = device.CreateTexture(&descriptor);
|
||||||
|
|
||||||
RGBA8 filled(255, 255, 255, 255);
|
RGBA8 filled(255, 255, 255, 255);
|
||||||
@ -56,7 +56,7 @@ TEST_P(NonzeroTextureCreationTests, Depth32TextureCreationDepthClears) {
|
|||||||
descriptor.size.depth = 1;
|
descriptor.size.depth = 1;
|
||||||
descriptor.sampleCount = 1;
|
descriptor.sampleCount = 1;
|
||||||
descriptor.mipLevelCount = 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;
|
descriptor.format = wgpu::TextureFormat::Depth32Float;
|
||||||
|
|
||||||
// We can only really test Depth32Float here because Depth24Plus(Stencil8)? may be in an unknown
|
// 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.sampleCount = 1;
|
||||||
descriptor.format = wgpu::TextureFormat::RGBA8Unorm;
|
descriptor.format = wgpu::TextureFormat::RGBA8Unorm;
|
||||||
descriptor.mipLevelCount = mipLevels;
|
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);
|
wgpu::Texture texture = device.CreateTexture(&descriptor);
|
||||||
|
|
||||||
std::vector<RGBA8> expected;
|
std::vector<RGBA8> expected;
|
||||||
@ -103,7 +103,7 @@ TEST_P(NonzeroTextureCreationTests, ArrayLayerClears) {
|
|||||||
descriptor.sampleCount = 1;
|
descriptor.sampleCount = 1;
|
||||||
descriptor.format = wgpu::TextureFormat::RGBA8Unorm;
|
descriptor.format = wgpu::TextureFormat::RGBA8Unorm;
|
||||||
descriptor.mipLevelCount = 1;
|
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);
|
wgpu::Texture texture = device.CreateTexture(&descriptor);
|
||||||
|
|
||||||
std::vector<RGBA8> expected;
|
std::vector<RGBA8> expected;
|
||||||
@ -192,7 +192,7 @@ TEST_P(NonzeroTextureCreationTests, AllSubresourcesFilled) {
|
|||||||
baseDescriptor.sampleCount = 1;
|
baseDescriptor.sampleCount = 1;
|
||||||
baseDescriptor.format = wgpu::TextureFormat::RGBA8Unorm;
|
baseDescriptor.format = wgpu::TextureFormat::RGBA8Unorm;
|
||||||
baseDescriptor.mipLevelCount = 1;
|
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);
|
RGBA8 filled(255, 255, 255, 255);
|
||||||
|
|
||||||
|
@ -64,7 +64,7 @@ class RenderPassLoadOpTests : public DawnTest {
|
|||||||
descriptor.sampleCount = 1;
|
descriptor.sampleCount = 1;
|
||||||
descriptor.format = wgpu::TextureFormat::RGBA8Unorm;
|
descriptor.format = wgpu::TextureFormat::RGBA8Unorm;
|
||||||
descriptor.mipLevelCount = 1;
|
descriptor.mipLevelCount = 1;
|
||||||
descriptor.usage = wgpu::TextureUsage::OutputAttachment | wgpu::TextureUsage::CopySrc;
|
descriptor.usage = wgpu::TextureUsage::RenderAttachment | wgpu::TextureUsage::CopySrc;
|
||||||
renderTarget = device.CreateTexture(&descriptor);
|
renderTarget = device.CreateTexture(&descriptor);
|
||||||
|
|
||||||
renderTargetView = renderTarget.CreateView();
|
renderTargetView = renderTarget.CreateView();
|
||||||
@ -105,7 +105,7 @@ class RenderPassLoadOpTests : public DawnTest {
|
|||||||
textureDescriptor.dimension = wgpu::TextureDimension::e2D;
|
textureDescriptor.dimension = wgpu::TextureDimension::e2D;
|
||||||
textureDescriptor.size = kTextureSize;
|
textureDescriptor.size = kTextureSize;
|
||||||
textureDescriptor.usage =
|
textureDescriptor.usage =
|
||||||
wgpu::TextureUsage::OutputAttachment | wgpu::TextureUsage::CopySrc;
|
wgpu::TextureUsage::RenderAttachment | wgpu::TextureUsage::CopySrc;
|
||||||
textureDescriptor.format = format;
|
textureDescriptor.format = format;
|
||||||
wgpu::Texture texture = device.CreateTexture(&textureDescriptor);
|
wgpu::Texture texture = device.CreateTexture(&textureDescriptor);
|
||||||
|
|
||||||
|
@ -60,7 +60,7 @@ class RenderPassTest : public DawnTest {
|
|||||||
descriptor.sampleCount = 1;
|
descriptor.sampleCount = 1;
|
||||||
descriptor.format = kFormat;
|
descriptor.format = kFormat;
|
||||||
descriptor.mipLevelCount = 1;
|
descriptor.mipLevelCount = 1;
|
||||||
descriptor.usage = wgpu::TextureUsage::OutputAttachment | wgpu::TextureUsage::CopySrc;
|
descriptor.usage = wgpu::TextureUsage::RenderAttachment | wgpu::TextureUsage::CopySrc;
|
||||||
return device.CreateTexture(&descriptor);
|
return device.CreateTexture(&descriptor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -495,7 +495,7 @@ class StorageTextureTests : public DawnTest {
|
|||||||
utils::ComboRenderPipelineDescriptor desc(device);
|
utils::ComboRenderPipelineDescriptor desc(device);
|
||||||
desc.vertexStage.module = vsModule;
|
desc.vertexStage.module = vsModule;
|
||||||
desc.cFragmentStage.module = fsModule;
|
desc.cFragmentStage.module = fsModule;
|
||||||
desc.cColorStates[0].format = kOutputAttachmentFormat;
|
desc.cColorStates[0].format = kRenderAttachmentFormat;
|
||||||
desc.primitiveTopology = wgpu::PrimitiveTopology::PointList;
|
desc.primitiveTopology = wgpu::PrimitiveTopology::PointList;
|
||||||
return device.CreateRenderPipeline(&desc);
|
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.
|
// Clear the output attachment to red at the beginning of the render pass.
|
||||||
wgpu::Texture outputTexture =
|
wgpu::Texture outputTexture =
|
||||||
CreateTexture(kOutputAttachmentFormat,
|
CreateTexture(kRenderAttachmentFormat,
|
||||||
wgpu::TextureUsage::OutputAttachment | wgpu::TextureUsage::CopySrc, 1, 1);
|
wgpu::TextureUsage::RenderAttachment | wgpu::TextureUsage::CopySrc, 1, 1);
|
||||||
utils::ComboRenderPassDescriptor renderPassDescriptor({outputTexture.CreateView()});
|
utils::ComboRenderPassDescriptor renderPassDescriptor({outputTexture.CreateView()});
|
||||||
renderPassDescriptor.cColorAttachments[0].loadOp = wgpu::LoadOp::Clear;
|
renderPassDescriptor.cColorAttachments[0].loadOp = wgpu::LoadOp::Clear;
|
||||||
renderPassDescriptor.cColorAttachments[0].clearColor = {1.f, 0.f, 0.f, 1.f};
|
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
|
// TODO(jiawei.shao@intel.com): remove the output attachment when Dawn supports beginning a
|
||||||
// render pass with no attachments.
|
// render pass with no attachments.
|
||||||
wgpu::Texture dummyOutputTexture =
|
wgpu::Texture dummyOutputTexture =
|
||||||
CreateTexture(kOutputAttachmentFormat,
|
CreateTexture(kRenderAttachmentFormat,
|
||||||
wgpu::TextureUsage::OutputAttachment | wgpu::TextureUsage::CopySrc, 1, 1);
|
wgpu::TextureUsage::RenderAttachment | wgpu::TextureUsage::CopySrc, 1, 1);
|
||||||
utils::ComboRenderPassDescriptor renderPassDescriptor({dummyOutputTexture.CreateView()});
|
utils::ComboRenderPassDescriptor renderPassDescriptor({dummyOutputTexture.CreateView()});
|
||||||
wgpu::RenderPassEncoder renderPassEncoder = encoder.BeginRenderPass(&renderPassDescriptor);
|
wgpu::RenderPassEncoder renderPassEncoder = encoder.BeginRenderPass(&renderPassDescriptor);
|
||||||
renderPassEncoder.SetBindGroup(0, bindGroup);
|
renderPassEncoder.SetBindGroup(0, bindGroup);
|
||||||
@ -660,7 +660,7 @@ class StorageTextureTests : public DawnTest {
|
|||||||
|
|
||||||
static constexpr size_t kWidth = 4u;
|
static constexpr size_t kWidth = 4u;
|
||||||
static constexpr size_t kHeight = 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"(
|
const char* kSimpleVertexShader = R"(
|
||||||
#version 450
|
#version 450
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
#include "utils/WGPUHelpers.h"
|
#include "utils/WGPUHelpers.h"
|
||||||
|
|
||||||
// Test that rendering to a subresource of a texture works.
|
// Test that rendering to a subresource of a texture works.
|
||||||
class SubresourceOutputAttachmentTest : public DawnTest {
|
class SubresourceRenderAttachmentTest : public DawnTest {
|
||||||
constexpr static uint32_t kRTSize = 2;
|
constexpr static uint32_t kRTSize = 2;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
@ -125,7 +125,7 @@ class SubresourceOutputAttachmentTest : public DawnTest {
|
|||||||
renderTargetDesc.sampleCount = 1;
|
renderTargetDesc.sampleCount = 1;
|
||||||
renderTargetDesc.format = format;
|
renderTargetDesc.format = format;
|
||||||
renderTargetDesc.mipLevelCount = kMipLevelCount;
|
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);
|
wgpu::Texture renderTarget = device.CreateTexture(&renderTargetDesc);
|
||||||
|
|
||||||
@ -139,22 +139,22 @@ class SubresourceOutputAttachmentTest : public DawnTest {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Test rendering into a subresource of a color texture
|
// Test rendering into a subresource of a color texture
|
||||||
TEST_P(SubresourceOutputAttachmentTest, ColorTexture) {
|
TEST_P(SubresourceRenderAttachmentTest, ColorTexture) {
|
||||||
DoTest(Type::Color);
|
DoTest(Type::Color);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test rendering into a subresource of a depth texture
|
// Test rendering into a subresource of a depth texture
|
||||||
TEST_P(SubresourceOutputAttachmentTest, DepthTexture) {
|
TEST_P(SubresourceRenderAttachmentTest, DepthTexture) {
|
||||||
DoTest(Type::Depth);
|
DoTest(Type::Depth);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test rendering into a subresource of a stencil texture
|
// Test rendering into a subresource of a stencil texture
|
||||||
// TODO(crbug.com/dawn/439): sample / copy of the stencil aspect.
|
// TODO(crbug.com/dawn/439): sample / copy of the stencil aspect.
|
||||||
TEST_P(SubresourceOutputAttachmentTest, DISABLED_StencilTexture) {
|
TEST_P(SubresourceRenderAttachmentTest, DISABLED_StencilTexture) {
|
||||||
DoTest(Type::Stencil);
|
DoTest(Type::Stencil);
|
||||||
}
|
}
|
||||||
|
|
||||||
DAWN_INSTANTIATE_TEST(SubresourceOutputAttachmentTest,
|
DAWN_INSTANTIATE_TEST(SubresourceRenderAttachmentTest,
|
||||||
D3D12Backend(),
|
D3D12Backend(),
|
||||||
D3D12Backend({}, {"use_d3d12_render_pass"}),
|
D3D12Backend({}, {"use_d3d12_render_pass"}),
|
||||||
MetalBackend(),
|
MetalBackend(),
|
@ -53,7 +53,7 @@ class SwapChainTests : public DawnTest {
|
|||||||
|
|
||||||
baseDescriptor.width = width;
|
baseDescriptor.width = width;
|
||||||
baseDescriptor.height = height;
|
baseDescriptor.height = height;
|
||||||
baseDescriptor.usage = wgpu::TextureUsage::OutputAttachment;
|
baseDescriptor.usage = wgpu::TextureUsage::RenderAttachment;
|
||||||
baseDescriptor.format = wgpu::TextureFormat::BGRA8Unorm;
|
baseDescriptor.format = wgpu::TextureFormat::BGRA8Unorm;
|
||||||
baseDescriptor.presentMode = wgpu::PresentMode::Mailbox;
|
baseDescriptor.presentMode = wgpu::PresentMode::Mailbox;
|
||||||
}
|
}
|
||||||
|
@ -46,7 +46,7 @@ class SwapChainValidationTests : public DawnTest {
|
|||||||
|
|
||||||
goodDescriptor.width = 1;
|
goodDescriptor.width = 1;
|
||||||
goodDescriptor.height = 1;
|
goodDescriptor.height = 1;
|
||||||
goodDescriptor.usage = wgpu::TextureUsage::OutputAttachment;
|
goodDescriptor.usage = wgpu::TextureUsage::RenderAttachment;
|
||||||
goodDescriptor.format = wgpu::TextureFormat::BGRA8Unorm;
|
goodDescriptor.format = wgpu::TextureFormat::BGRA8Unorm;
|
||||||
goodDescriptor.presentMode = wgpu::PresentMode::Mailbox;
|
goodDescriptor.presentMode = wgpu::PresentMode::Mailbox;
|
||||||
|
|
||||||
@ -69,12 +69,12 @@ class SwapChainValidationTests : public DawnTest {
|
|||||||
wgpu::SwapChainDescriptor goodDescriptor;
|
wgpu::SwapChainDescriptor goodDescriptor;
|
||||||
wgpu::SwapChainDescriptor badDescriptor;
|
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) {
|
void CheckTextureViewIsError(wgpu::TextureView view) {
|
||||||
CheckTextureView(view, true, false);
|
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) {
|
void CheckTextureViewIsDestroyed(wgpu::TextureView view) {
|
||||||
CheckTextureView(view, false, true);
|
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) {
|
TEST_P(SwapChainValidationTests, InvalidCreationUsage) {
|
||||||
wgpu::SwapChainDescriptor desc = goodDescriptor;
|
wgpu::SwapChainDescriptor desc = goodDescriptor;
|
||||||
desc.usage = wgpu::TextureUsage::Sampled;
|
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
|
// 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.
|
// size of the view matches the size of this texture.
|
||||||
wgpu::TextureDescriptor textureDesc;
|
wgpu::TextureDescriptor textureDesc;
|
||||||
textureDesc.usage = wgpu::TextureUsage::OutputAttachment;
|
textureDesc.usage = wgpu::TextureUsage::RenderAttachment;
|
||||||
textureDesc.dimension = wgpu::TextureDimension::e2D;
|
textureDesc.dimension = wgpu::TextureDimension::e2D;
|
||||||
textureDesc.size = {1, 1, 1};
|
textureDesc.size = {1, 1, 1};
|
||||||
textureDesc.format = wgpu::TextureFormat::R8Unorm;
|
textureDesc.format = wgpu::TextureFormat::R8Unorm;
|
||||||
@ -257,7 +257,7 @@ TEST_P(SwapChainValidationTests, ReturnedViewCharacteristics) {
|
|||||||
wgpu::TextureView view = swapchain.GetCurrentTextureView();
|
wgpu::TextureView view = swapchain.GetCurrentTextureView();
|
||||||
|
|
||||||
// Validation will also check the dimension of the view is 2D, and it's usage contains
|
// Validation will also check the dimension of the view is 2D, and it's usage contains
|
||||||
// OutputAttachment
|
// RenderAttachment
|
||||||
utils::ComboRenderPassDescriptor renderPassDesc({view, secondTexture.CreateView()});
|
utils::ComboRenderPassDescriptor renderPassDesc({view, secondTexture.CreateView()});
|
||||||
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
|
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
|
||||||
wgpu::RenderPassEncoder pass = encoder.BeginRenderPass(&renderPassDesc);
|
wgpu::RenderPassEncoder pass = encoder.BeginRenderPass(&renderPassDesc);
|
||||||
|
@ -215,7 +215,7 @@ class TextureFormatTest : public DawnTest {
|
|||||||
ASSERT(expectedRenderDataSize == width * renderFormatInfo.texelByteSize);
|
ASSERT(expectedRenderDataSize == width * renderFormatInfo.texelByteSize);
|
||||||
|
|
||||||
wgpu::TextureDescriptor renderTargetDesc;
|
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.size = {width, 1, 1};
|
||||||
renderTargetDesc.format = renderFormatInfo.format;
|
renderTargetDesc.format = renderFormatInfo.format;
|
||||||
|
|
||||||
|
@ -140,7 +140,7 @@ TEST_P(TextureSubresourceTest, MipmapLevelsTest) {
|
|||||||
// Create a texture with 2 mipmap levels and 1 layer
|
// Create a texture with 2 mipmap levels and 1 layer
|
||||||
wgpu::Texture texture =
|
wgpu::Texture texture =
|
||||||
CreateTexture(2, 1,
|
CreateTexture(2, 1,
|
||||||
wgpu::TextureUsage::Sampled | wgpu::TextureUsage::OutputAttachment |
|
wgpu::TextureUsage::Sampled | wgpu::TextureUsage::RenderAttachment |
|
||||||
wgpu::TextureUsage::CopySrc);
|
wgpu::TextureUsage::CopySrc);
|
||||||
|
|
||||||
// Create two views on different mipmap levels.
|
// 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
|
// Create a texture with 1 mipmap level and 2 layers
|
||||||
wgpu::Texture texture =
|
wgpu::Texture texture =
|
||||||
CreateTexture(1, 2,
|
CreateTexture(1, 2,
|
||||||
wgpu::TextureUsage::Sampled | wgpu::TextureUsage::OutputAttachment |
|
wgpu::TextureUsage::Sampled | wgpu::TextureUsage::RenderAttachment |
|
||||||
wgpu::TextureUsage::CopySrc);
|
wgpu::TextureUsage::CopySrc);
|
||||||
|
|
||||||
// Create two views on different layers
|
// Create two views on different layers
|
||||||
|
@ -462,7 +462,7 @@ class TextureViewRenderingTest : public DawnTest {
|
|||||||
ASSERT_LT(textureViewBaseLevel, levelCount);
|
ASSERT_LT(textureViewBaseLevel, levelCount);
|
||||||
|
|
||||||
constexpr wgpu::TextureUsage kUsage =
|
constexpr wgpu::TextureUsage kUsage =
|
||||||
wgpu::TextureUsage::OutputAttachment | wgpu::TextureUsage::CopySrc;
|
wgpu::TextureUsage::RenderAttachment | wgpu::TextureUsage::CopySrc;
|
||||||
wgpu::Texture texture = Create2DTexture(device, textureWidthLevel0, textureHeightLevel0,
|
wgpu::Texture texture = Create2DTexture(device, textureWidthLevel0, textureHeightLevel0,
|
||||||
layerCount, levelCount, kUsage);
|
layerCount, levelCount, kUsage);
|
||||||
|
|
||||||
|
@ -123,7 +123,7 @@ class TextureZeroInitTest : public DawnTest {
|
|||||||
// This tests that the code path of CopyTextureToBuffer clears correctly to Zero after first usage
|
// This tests that the code path of CopyTextureToBuffer clears correctly to Zero after first usage
|
||||||
TEST_P(TextureZeroInitTest, CopyTextureToBufferSource) {
|
TEST_P(TextureZeroInitTest, CopyTextureToBufferSource) {
|
||||||
wgpu::TextureDescriptor descriptor = CreateTextureDescriptor(
|
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);
|
wgpu::Texture texture = device.CreateTexture(&descriptor);
|
||||||
|
|
||||||
// Texture's first usage is in EXPECT_PIXEL_RGBA8_EQ's call to CopyTextureToBuffer
|
// 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;
|
constexpr uint32_t kArrayLayers = 6u;
|
||||||
|
|
||||||
const wgpu::TextureDescriptor descriptor = CreateTextureDescriptor(
|
const wgpu::TextureDescriptor descriptor = CreateTextureDescriptor(
|
||||||
1, kArrayLayers, wgpu::TextureUsage::OutputAttachment | wgpu::TextureUsage::CopySrc,
|
1, kArrayLayers, wgpu::TextureUsage::RenderAttachment | wgpu::TextureUsage::CopySrc,
|
||||||
kColorFormat);
|
kColorFormat);
|
||||||
wgpu::Texture texture = device.CreateTexture(&descriptor);
|
wgpu::Texture texture = device.CreateTexture(&descriptor);
|
||||||
|
|
||||||
@ -183,7 +183,7 @@ TEST_P(TextureZeroInitTest, RenderingMipMapClearsToZero) {
|
|||||||
uint32_t layerCount = 1;
|
uint32_t layerCount = 1;
|
||||||
|
|
||||||
wgpu::TextureDescriptor descriptor = CreateTextureDescriptor(
|
wgpu::TextureDescriptor descriptor = CreateTextureDescriptor(
|
||||||
levelCount, layerCount, wgpu::TextureUsage::OutputAttachment | wgpu::TextureUsage::CopySrc,
|
levelCount, layerCount, wgpu::TextureUsage::RenderAttachment | wgpu::TextureUsage::CopySrc,
|
||||||
kColorFormat);
|
kColorFormat);
|
||||||
wgpu::Texture texture = device.CreateTexture(&descriptor);
|
wgpu::Texture texture = device.CreateTexture(&descriptor);
|
||||||
|
|
||||||
@ -228,7 +228,7 @@ TEST_P(TextureZeroInitTest, RenderingArrayLayerClearsToZero) {
|
|||||||
uint32_t layerCount = 4;
|
uint32_t layerCount = 4;
|
||||||
|
|
||||||
wgpu::TextureDescriptor descriptor = CreateTextureDescriptor(
|
wgpu::TextureDescriptor descriptor = CreateTextureDescriptor(
|
||||||
levelCount, layerCount, wgpu::TextureUsage::OutputAttachment | wgpu::TextureUsage::CopySrc,
|
levelCount, layerCount, wgpu::TextureUsage::RenderAttachment | wgpu::TextureUsage::CopySrc,
|
||||||
kColorFormat);
|
kColorFormat);
|
||||||
wgpu::Texture texture = device.CreateTexture(&descriptor);
|
wgpu::Texture texture = device.CreateTexture(&descriptor);
|
||||||
|
|
||||||
@ -374,7 +374,7 @@ TEST_P(TextureZeroInitTest, CopyTextureToTexture) {
|
|||||||
|
|
||||||
wgpu::TextureDescriptor dstDescriptor =
|
wgpu::TextureDescriptor dstDescriptor =
|
||||||
CreateTextureDescriptor(1, 1,
|
CreateTextureDescriptor(1, 1,
|
||||||
wgpu::TextureUsage::OutputAttachment | wgpu::TextureUsage::CopyDst |
|
wgpu::TextureUsage::RenderAttachment | wgpu::TextureUsage::CopyDst |
|
||||||
wgpu::TextureUsage::CopySrc,
|
wgpu::TextureUsage::CopySrc,
|
||||||
kColorFormat);
|
kColorFormat);
|
||||||
wgpu::Texture dstTexture = device.CreateTexture(&dstDescriptor);
|
wgpu::Texture dstTexture = device.CreateTexture(&dstDescriptor);
|
||||||
@ -429,7 +429,7 @@ TEST_P(TextureZeroInitTest, CopyTextureToTextureHalf) {
|
|||||||
|
|
||||||
wgpu::TextureDescriptor dstDescriptor =
|
wgpu::TextureDescriptor dstDescriptor =
|
||||||
CreateTextureDescriptor(1, 1,
|
CreateTextureDescriptor(1, 1,
|
||||||
wgpu::TextureUsage::OutputAttachment | wgpu::TextureUsage::CopyDst |
|
wgpu::TextureUsage::RenderAttachment | wgpu::TextureUsage::CopyDst |
|
||||||
wgpu::TextureUsage::CopySrc,
|
wgpu::TextureUsage::CopySrc,
|
||||||
kColorFormat);
|
kColorFormat);
|
||||||
wgpu::Texture dstTexture = device.CreateTexture(&dstDescriptor);
|
wgpu::Texture dstTexture = device.CreateTexture(&dstDescriptor);
|
||||||
@ -462,12 +462,12 @@ TEST_P(TextureZeroInitTest, RenderingLoadingDepth) {
|
|||||||
wgpu::TextureDescriptor srcDescriptor =
|
wgpu::TextureDescriptor srcDescriptor =
|
||||||
CreateTextureDescriptor(1, 1,
|
CreateTextureDescriptor(1, 1,
|
||||||
wgpu::TextureUsage::CopySrc | wgpu::TextureUsage::CopyDst |
|
wgpu::TextureUsage::CopySrc | wgpu::TextureUsage::CopyDst |
|
||||||
wgpu::TextureUsage::OutputAttachment,
|
wgpu::TextureUsage::RenderAttachment,
|
||||||
kColorFormat);
|
kColorFormat);
|
||||||
wgpu::Texture srcTexture = device.CreateTexture(&srcDescriptor);
|
wgpu::Texture srcTexture = device.CreateTexture(&srcDescriptor);
|
||||||
|
|
||||||
wgpu::TextureDescriptor depthStencilDescriptor = CreateTextureDescriptor(
|
wgpu::TextureDescriptor depthStencilDescriptor = CreateTextureDescriptor(
|
||||||
1, 1, wgpu::TextureUsage::OutputAttachment | wgpu::TextureUsage::CopySrc,
|
1, 1, wgpu::TextureUsage::RenderAttachment | wgpu::TextureUsage::CopySrc,
|
||||||
kDepthStencilFormat);
|
kDepthStencilFormat);
|
||||||
wgpu::Texture depthStencilTexture = device.CreateTexture(&depthStencilDescriptor);
|
wgpu::Texture depthStencilTexture = device.CreateTexture(&depthStencilDescriptor);
|
||||||
|
|
||||||
@ -504,12 +504,12 @@ TEST_P(TextureZeroInitTest, RenderingLoadingStencil) {
|
|||||||
wgpu::TextureDescriptor srcDescriptor =
|
wgpu::TextureDescriptor srcDescriptor =
|
||||||
CreateTextureDescriptor(1, 1,
|
CreateTextureDescriptor(1, 1,
|
||||||
wgpu::TextureUsage::CopySrc | wgpu::TextureUsage::CopyDst |
|
wgpu::TextureUsage::CopySrc | wgpu::TextureUsage::CopyDst |
|
||||||
wgpu::TextureUsage::OutputAttachment,
|
wgpu::TextureUsage::RenderAttachment,
|
||||||
kColorFormat);
|
kColorFormat);
|
||||||
wgpu::Texture srcTexture = device.CreateTexture(&srcDescriptor);
|
wgpu::Texture srcTexture = device.CreateTexture(&srcDescriptor);
|
||||||
|
|
||||||
wgpu::TextureDescriptor depthStencilDescriptor = CreateTextureDescriptor(
|
wgpu::TextureDescriptor depthStencilDescriptor = CreateTextureDescriptor(
|
||||||
1, 1, wgpu::TextureUsage::OutputAttachment | wgpu::TextureUsage::CopySrc,
|
1, 1, wgpu::TextureUsage::RenderAttachment | wgpu::TextureUsage::CopySrc,
|
||||||
kDepthStencilFormat);
|
kDepthStencilFormat);
|
||||||
wgpu::Texture depthStencilTexture = device.CreateTexture(&depthStencilDescriptor);
|
wgpu::Texture depthStencilTexture = device.CreateTexture(&depthStencilDescriptor);
|
||||||
|
|
||||||
@ -546,12 +546,12 @@ TEST_P(TextureZeroInitTest, RenderingLoadingDepthStencil) {
|
|||||||
wgpu::TextureDescriptor srcDescriptor =
|
wgpu::TextureDescriptor srcDescriptor =
|
||||||
CreateTextureDescriptor(1, 1,
|
CreateTextureDescriptor(1, 1,
|
||||||
wgpu::TextureUsage::CopySrc | wgpu::TextureUsage::CopyDst |
|
wgpu::TextureUsage::CopySrc | wgpu::TextureUsage::CopyDst |
|
||||||
wgpu::TextureUsage::OutputAttachment,
|
wgpu::TextureUsage::RenderAttachment,
|
||||||
kColorFormat);
|
kColorFormat);
|
||||||
wgpu::Texture srcTexture = device.CreateTexture(&srcDescriptor);
|
wgpu::Texture srcTexture = device.CreateTexture(&srcDescriptor);
|
||||||
|
|
||||||
wgpu::TextureDescriptor depthStencilDescriptor = CreateTextureDescriptor(
|
wgpu::TextureDescriptor depthStencilDescriptor = CreateTextureDescriptor(
|
||||||
1, 1, wgpu::TextureUsage::OutputAttachment | wgpu::TextureUsage::CopySrc,
|
1, 1, wgpu::TextureUsage::RenderAttachment | wgpu::TextureUsage::CopySrc,
|
||||||
kDepthStencilFormat);
|
kDepthStencilFormat);
|
||||||
wgpu::Texture depthStencilTexture = device.CreateTexture(&depthStencilDescriptor);
|
wgpu::Texture depthStencilTexture = device.CreateTexture(&depthStencilDescriptor);
|
||||||
|
|
||||||
@ -585,7 +585,7 @@ TEST_P(TextureZeroInitTest, IndependentDepthStencilLoadAfterDiscard) {
|
|||||||
DAWN_SKIP_TEST_IF(IsMetal() && IsIntel());
|
DAWN_SKIP_TEST_IF(IsMetal() && IsIntel());
|
||||||
|
|
||||||
wgpu::TextureDescriptor depthStencilDescriptor = CreateTextureDescriptor(
|
wgpu::TextureDescriptor depthStencilDescriptor = CreateTextureDescriptor(
|
||||||
1, 1, wgpu::TextureUsage::OutputAttachment | wgpu::TextureUsage::CopySrc,
|
1, 1, wgpu::TextureUsage::RenderAttachment | wgpu::TextureUsage::CopySrc,
|
||||||
kDepthStencilFormat);
|
kDepthStencilFormat);
|
||||||
wgpu::Texture depthStencilTexture = device.CreateTexture(&depthStencilDescriptor);
|
wgpu::Texture depthStencilTexture = device.CreateTexture(&depthStencilDescriptor);
|
||||||
|
|
||||||
@ -620,7 +620,7 @@ TEST_P(TextureZeroInitTest, IndependentDepthStencilLoadAfterDiscard) {
|
|||||||
wgpu::TextureDescriptor colorDescriptor =
|
wgpu::TextureDescriptor colorDescriptor =
|
||||||
CreateTextureDescriptor(1, 1,
|
CreateTextureDescriptor(1, 1,
|
||||||
wgpu::TextureUsage::CopySrc | wgpu::TextureUsage::CopyDst |
|
wgpu::TextureUsage::CopySrc | wgpu::TextureUsage::CopyDst |
|
||||||
wgpu::TextureUsage::OutputAttachment,
|
wgpu::TextureUsage::RenderAttachment,
|
||||||
kColorFormat);
|
kColorFormat);
|
||||||
wgpu::Texture colorTexture = device.CreateTexture(&colorDescriptor);
|
wgpu::Texture colorTexture = device.CreateTexture(&colorDescriptor);
|
||||||
|
|
||||||
@ -694,7 +694,7 @@ TEST_P(TextureZeroInitTest, IndependentDepthStencilLoadAfterDiscard) {
|
|||||||
wgpu::TextureDescriptor colorDescriptor =
|
wgpu::TextureDescriptor colorDescriptor =
|
||||||
CreateTextureDescriptor(1, 1,
|
CreateTextureDescriptor(1, 1,
|
||||||
wgpu::TextureUsage::CopySrc | wgpu::TextureUsage::CopyDst |
|
wgpu::TextureUsage::CopySrc | wgpu::TextureUsage::CopyDst |
|
||||||
wgpu::TextureUsage::OutputAttachment,
|
wgpu::TextureUsage::RenderAttachment,
|
||||||
kColorFormat);
|
kColorFormat);
|
||||||
wgpu::Texture colorTexture = device.CreateTexture(&colorDescriptor);
|
wgpu::Texture colorTexture = device.CreateTexture(&colorDescriptor);
|
||||||
|
|
||||||
@ -747,7 +747,7 @@ TEST_P(TextureZeroInitTest, IndependentDepthStencilCopyAfterDiscard) {
|
|||||||
DAWN_SKIP_TEST_IF(IsMetal() && IsIntel());
|
DAWN_SKIP_TEST_IF(IsMetal() && IsIntel());
|
||||||
|
|
||||||
wgpu::TextureDescriptor depthStencilDescriptor = CreateTextureDescriptor(
|
wgpu::TextureDescriptor depthStencilDescriptor = CreateTextureDescriptor(
|
||||||
1, 1, wgpu::TextureUsage::OutputAttachment | wgpu::TextureUsage::CopySrc,
|
1, 1, wgpu::TextureUsage::RenderAttachment | wgpu::TextureUsage::CopySrc,
|
||||||
kDepthStencilFormat);
|
kDepthStencilFormat);
|
||||||
wgpu::Texture depthStencilTexture = device.CreateTexture(&depthStencilDescriptor);
|
wgpu::Texture depthStencilTexture = device.CreateTexture(&depthStencilDescriptor);
|
||||||
|
|
||||||
@ -792,7 +792,7 @@ TEST_P(TextureZeroInitTest, IndependentDepthStencilCopyAfterDiscard) {
|
|||||||
wgpu::TextureDescriptor colorDescriptor =
|
wgpu::TextureDescriptor colorDescriptor =
|
||||||
CreateTextureDescriptor(1, 1,
|
CreateTextureDescriptor(1, 1,
|
||||||
wgpu::TextureUsage::CopySrc | wgpu::TextureUsage::CopyDst |
|
wgpu::TextureUsage::CopySrc | wgpu::TextureUsage::CopyDst |
|
||||||
wgpu::TextureUsage::OutputAttachment,
|
wgpu::TextureUsage::RenderAttachment,
|
||||||
kColorFormat);
|
kColorFormat);
|
||||||
wgpu::Texture colorTexture = device.CreateTexture(&colorDescriptor);
|
wgpu::Texture colorTexture = device.CreateTexture(&colorDescriptor);
|
||||||
|
|
||||||
@ -820,7 +820,7 @@ TEST_P(TextureZeroInitTest, IndependentDepthStencilCopyAfterDiscard) {
|
|||||||
// This tests the color attachments clear to 0s
|
// This tests the color attachments clear to 0s
|
||||||
TEST_P(TextureZeroInitTest, ColorAttachmentsClear) {
|
TEST_P(TextureZeroInitTest, ColorAttachmentsClear) {
|
||||||
wgpu::TextureDescriptor descriptor = CreateTextureDescriptor(
|
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);
|
wgpu::Texture texture = device.CreateTexture(&descriptor);
|
||||||
utils::BasicRenderPass renderPass = utils::BasicRenderPass(kSize, kSize, texture, kColorFormat);
|
utils::BasicRenderPass renderPass = utils::BasicRenderPass(kSize, kSize, texture, kColorFormat);
|
||||||
renderPass.renderPassInfo.cColorAttachments[0].loadOp = wgpu::LoadOp::Load;
|
renderPass.renderPassInfo.cColorAttachments[0].loadOp = wgpu::LoadOp::Load;
|
||||||
@ -848,7 +848,7 @@ TEST_P(TextureZeroInitTest, RenderPassSampledTextureClear) {
|
|||||||
wgpu::Texture texture = device.CreateTexture(&descriptor);
|
wgpu::Texture texture = device.CreateTexture(&descriptor);
|
||||||
|
|
||||||
wgpu::TextureDescriptor renderTextureDescriptor = CreateTextureDescriptor(
|
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::Texture renderTexture = device.CreateTexture(&renderTextureDescriptor);
|
||||||
|
|
||||||
wgpu::SamplerDescriptor samplerDesc = utils::GetDefaultSamplerDescriptor();
|
wgpu::SamplerDescriptor samplerDesc = utils::GetDefaultSamplerDescriptor();
|
||||||
@ -1053,7 +1053,7 @@ TEST_P(TextureZeroInitTest, RenderPassStoreOpClear) {
|
|||||||
wgpu::Texture texture = device.CreateTexture(&descriptor);
|
wgpu::Texture texture = device.CreateTexture(&descriptor);
|
||||||
|
|
||||||
wgpu::TextureDescriptor renderTextureDescriptor = CreateTextureDescriptor(
|
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::Texture renderTexture = device.CreateTexture(&renderTextureDescriptor);
|
||||||
|
|
||||||
wgpu::SamplerDescriptor samplerDesc = utils::GetDefaultSamplerDescriptor();
|
wgpu::SamplerDescriptor samplerDesc = utils::GetDefaultSamplerDescriptor();
|
||||||
@ -1121,13 +1121,13 @@ TEST_P(TextureZeroInitTest, RenderingLoadingDepthStencilStoreOpClear) {
|
|||||||
wgpu::TextureDescriptor srcDescriptor =
|
wgpu::TextureDescriptor srcDescriptor =
|
||||||
CreateTextureDescriptor(1, 1,
|
CreateTextureDescriptor(1, 1,
|
||||||
wgpu::TextureUsage::CopySrc | wgpu::TextureUsage::CopyDst |
|
wgpu::TextureUsage::CopySrc | wgpu::TextureUsage::CopyDst |
|
||||||
wgpu::TextureUsage::OutputAttachment,
|
wgpu::TextureUsage::RenderAttachment,
|
||||||
kColorFormat);
|
kColorFormat);
|
||||||
wgpu::Texture srcTexture = device.CreateTexture(&srcDescriptor);
|
wgpu::Texture srcTexture = device.CreateTexture(&srcDescriptor);
|
||||||
|
|
||||||
wgpu::TextureDescriptor depthStencilDescriptor =
|
wgpu::TextureDescriptor depthStencilDescriptor =
|
||||||
CreateTextureDescriptor(1, 1,
|
CreateTextureDescriptor(1, 1,
|
||||||
wgpu::TextureUsage::OutputAttachment | wgpu::TextureUsage::CopySrc |
|
wgpu::TextureUsage::RenderAttachment | wgpu::TextureUsage::CopySrc |
|
||||||
wgpu::TextureUsage::CopyDst,
|
wgpu::TextureUsage::CopyDst,
|
||||||
kDepthStencilFormat);
|
kDepthStencilFormat);
|
||||||
wgpu::Texture depthStencilTexture = device.CreateTexture(&depthStencilDescriptor);
|
wgpu::Texture depthStencilTexture = device.CreateTexture(&depthStencilDescriptor);
|
||||||
@ -1203,7 +1203,7 @@ TEST_P(TextureZeroInitTest, PreservesInitializedMip) {
|
|||||||
wgpu::Sampler sampler = device.CreateSampler(&samplerDesc);
|
wgpu::Sampler sampler = device.CreateSampler(&samplerDesc);
|
||||||
|
|
||||||
wgpu::TextureDescriptor renderTextureDescriptor = CreateTextureDescriptor(
|
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::Texture renderTexture = device.CreateTexture(&renderTextureDescriptor);
|
||||||
|
|
||||||
// Fill the sample texture's second mip with data
|
// Fill the sample texture's second mip with data
|
||||||
@ -1282,7 +1282,7 @@ TEST_P(TextureZeroInitTest, PreservesInitializedArrayLayer) {
|
|||||||
wgpu::Sampler sampler = device.CreateSampler(&samplerDesc);
|
wgpu::Sampler sampler = device.CreateSampler(&samplerDesc);
|
||||||
|
|
||||||
wgpu::TextureDescriptor renderTextureDescriptor = CreateTextureDescriptor(
|
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::Texture renderTexture = device.CreateTexture(&renderTextureDescriptor);
|
||||||
|
|
||||||
// Fill the sample texture's second array layer with data
|
// Fill the sample texture's second array layer with data
|
||||||
|
@ -113,7 +113,7 @@ class ViewportTest : public DawnTest {
|
|||||||
wgpu::TextureDescriptor depthDesc;
|
wgpu::TextureDescriptor depthDesc;
|
||||||
depthDesc.size = {3, 1, 1};
|
depthDesc.size = {3, 1, 1};
|
||||||
depthDesc.format = wgpu::TextureFormat::Depth32Float;
|
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);
|
wgpu::Texture depthTexture = device.CreateTexture(&depthDesc);
|
||||||
|
|
||||||
// Render the three points with the viewport call.
|
// Render the three points with the viewport call.
|
||||||
|
@ -285,7 +285,7 @@ void DrawCallPerf::SetUp() {
|
|||||||
descriptor.size.width = kTextureSize;
|
descriptor.size.width = kTextureSize;
|
||||||
descriptor.size.height = kTextureSize;
|
descriptor.size.height = kTextureSize;
|
||||||
descriptor.size.depth = 1;
|
descriptor.size.depth = 1;
|
||||||
descriptor.usage = wgpu::TextureUsage::OutputAttachment;
|
descriptor.usage = wgpu::TextureUsage::RenderAttachment;
|
||||||
|
|
||||||
descriptor.format = wgpu::TextureFormat::RGBA8Unorm;
|
descriptor.format = wgpu::TextureFormat::RGBA8Unorm;
|
||||||
mColorAttachment = device.CreateTexture(&descriptor).CreateView();
|
mColorAttachment = device.CreateTexture(&descriptor).CreateView();
|
||||||
|
@ -287,7 +287,7 @@ TEST_F(BindGroupValidationTest, TextureUsage) {
|
|||||||
|
|
||||||
// Make an output attachment texture and try to set it for a SampledTexture binding
|
// Make an output attachment texture and try to set it for a SampledTexture binding
|
||||||
wgpu::Texture outputTexture =
|
wgpu::Texture outputTexture =
|
||||||
CreateTexture(wgpu::TextureUsage::OutputAttachment, wgpu::TextureFormat::RGBA8Unorm, 1);
|
CreateTexture(wgpu::TextureUsage::RenderAttachment, wgpu::TextureFormat::RGBA8Unorm, 1);
|
||||||
wgpu::TextureView outputTextureView = outputTexture.CreateView();
|
wgpu::TextureView outputTextureView = outputTexture.CreateView();
|
||||||
ASSERT_DEVICE_ERROR(utils::MakeBindGroup(device, layout, {{0, outputTextureView}}));
|
ASSERT_DEVICE_ERROR(utils::MakeBindGroup(device, layout, {{0, outputTextureView}}));
|
||||||
}
|
}
|
||||||
|
@ -800,7 +800,7 @@ TEST_F(CopyCommandTest_B2T, CopyToStencilAspect) {
|
|||||||
|
|
||||||
wgpu::Texture destination =
|
wgpu::Texture destination =
|
||||||
Create2DTexture(16, 16, 1, 1, wgpu::TextureFormat::Depth24PlusStencil8,
|
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},
|
TestB2TCopy(utils::Expectation::Failure, source, 0, 256, 0, destination, 0, {0, 0, 0},
|
||||||
{15, 15, 1}, wgpu::TextureAspect::StencilOnly);
|
{15, 15, 1}, wgpu::TextureAspect::StencilOnly);
|
||||||
@ -817,7 +817,7 @@ TEST_F(CopyCommandTest_B2T, CopyToStencilAspect) {
|
|||||||
|
|
||||||
wgpu::Texture destination =
|
wgpu::Texture destination =
|
||||||
Create2DTexture(16, 16, 2, 1, wgpu::TextureFormat::Depth24PlusStencil8,
|
Create2DTexture(16, 16, 2, 1, wgpu::TextureFormat::Depth24PlusStencil8,
|
||||||
wgpu::TextureUsage::CopyDst | wgpu::TextureUsage::OutputAttachment);
|
wgpu::TextureUsage::CopyDst | wgpu::TextureUsage::RenderAttachment);
|
||||||
|
|
||||||
// Whole mip is success
|
// Whole mip is success
|
||||||
TestB2TCopy(utils::Expectation::Success, source, 0, 256, 0, destination, 1, {0, 0, 0},
|
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 =
|
wgpu::Texture destination =
|
||||||
Create2DTexture(17, 17, 2, 1, wgpu::TextureFormat::Depth24PlusStencil8,
|
Create2DTexture(17, 17, 2, 1, wgpu::TextureFormat::Depth24PlusStencil8,
|
||||||
wgpu::TextureUsage::CopyDst | wgpu::TextureUsage::OutputAttachment);
|
wgpu::TextureUsage::CopyDst | wgpu::TextureUsage::RenderAttachment);
|
||||||
|
|
||||||
// Whole mip is success
|
// Whole mip is success
|
||||||
TestB2TCopy(utils::Expectation::Success, source, 0, 256, 0, destination, 1, {0, 0, 0},
|
TestB2TCopy(utils::Expectation::Success, source, 0, 256, 0, destination, 1, {0, 0, 0},
|
||||||
|
@ -851,7 +851,7 @@ TEST_F(RenderBundleValidationTest, RenderPassColorFormatMismatch) {
|
|||||||
wgpu::RenderBundle renderBundle = renderBundleEncoder.Finish();
|
wgpu::RenderBundle renderBundle = renderBundleEncoder.Finish();
|
||||||
|
|
||||||
wgpu::TextureDescriptor textureDesc = {};
|
wgpu::TextureDescriptor textureDesc = {};
|
||||||
textureDesc.usage = wgpu::TextureUsage::OutputAttachment;
|
textureDesc.usage = wgpu::TextureUsage::RenderAttachment;
|
||||||
textureDesc.size = wgpu::Extent3D({400, 400, 1});
|
textureDesc.size = wgpu::Extent3D({400, 400, 1});
|
||||||
|
|
||||||
textureDesc.format = wgpu::TextureFormat::RGBA8Unorm;
|
textureDesc.format = wgpu::TextureFormat::RGBA8Unorm;
|
||||||
@ -921,7 +921,7 @@ TEST_F(RenderBundleValidationTest, RenderPassDepthStencilFormatMismatch) {
|
|||||||
wgpu::RenderBundle renderBundle = renderBundleEncoder.Finish();
|
wgpu::RenderBundle renderBundle = renderBundleEncoder.Finish();
|
||||||
|
|
||||||
wgpu::TextureDescriptor textureDesc = {};
|
wgpu::TextureDescriptor textureDesc = {};
|
||||||
textureDesc.usage = wgpu::TextureUsage::OutputAttachment;
|
textureDesc.usage = wgpu::TextureUsage::RenderAttachment;
|
||||||
textureDesc.size = wgpu::Extent3D({400, 400, 1});
|
textureDesc.size = wgpu::Extent3D({400, 400, 1});
|
||||||
|
|
||||||
textureDesc.format = wgpu::TextureFormat::RGBA8Unorm;
|
textureDesc.format = wgpu::TextureFormat::RGBA8Unorm;
|
||||||
@ -978,7 +978,7 @@ TEST_F(RenderBundleValidationTest, RenderPassSampleCountMismatch) {
|
|||||||
wgpu::RenderBundle renderBundle = renderBundleEncoder.Finish();
|
wgpu::RenderBundle renderBundle = renderBundleEncoder.Finish();
|
||||||
|
|
||||||
wgpu::TextureDescriptor textureDesc = {};
|
wgpu::TextureDescriptor textureDesc = {};
|
||||||
textureDesc.usage = wgpu::TextureUsage::OutputAttachment;
|
textureDesc.usage = wgpu::TextureUsage::RenderAttachment;
|
||||||
textureDesc.size = wgpu::Extent3D({400, 400, 1});
|
textureDesc.size = wgpu::Extent3D({400, 400, 1});
|
||||||
|
|
||||||
textureDesc.format = wgpu::TextureFormat::RGBA8Unorm;
|
textureDesc.format = wgpu::TextureFormat::RGBA8Unorm;
|
||||||
|
@ -50,7 +50,7 @@ namespace {
|
|||||||
uint32_t arrayLayerCount,
|
uint32_t arrayLayerCount,
|
||||||
uint32_t mipLevelCount,
|
uint32_t mipLevelCount,
|
||||||
uint32_t sampleCount = 1,
|
uint32_t sampleCount = 1,
|
||||||
wgpu::TextureUsage usage = wgpu::TextureUsage::OutputAttachment) {
|
wgpu::TextureUsage usage = wgpu::TextureUsage::RenderAttachment) {
|
||||||
wgpu::TextureDescriptor descriptor;
|
wgpu::TextureDescriptor descriptor;
|
||||||
descriptor.dimension = dimension;
|
descriptor.dimension = dimension;
|
||||||
descriptor.size.width = width;
|
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
|
// It is not allowed to use a resolve target which is created from a texture whose usage does
|
||||||
// not include wgpu::TextureUsage::OutputAttachment.
|
// not include wgpu::TextureUsage::RenderAttachment.
|
||||||
TEST_F(MultisampledRenderPassDescriptorValidationTest, ResolveTargetUsageNoOutputAttachment) {
|
TEST_F(MultisampledRenderPassDescriptorValidationTest, ResolveTargetUsageNoRenderAttachment) {
|
||||||
constexpr wgpu::TextureUsage kUsage =
|
constexpr wgpu::TextureUsage kUsage =
|
||||||
wgpu::TextureUsage::CopyDst | wgpu::TextureUsage::CopySrc;
|
wgpu::TextureUsage::CopyDst | wgpu::TextureUsage::CopySrc;
|
||||||
wgpu::Texture nonColorUsageResolveTexture =
|
wgpu::Texture nonColorUsageResolveTexture =
|
||||||
|
@ -229,7 +229,7 @@ TEST_F(RenderPipelineValidationTest, SampleCountCompatibilityWithRenderPass) {
|
|||||||
baseTextureDescriptor.size.depth = 1;
|
baseTextureDescriptor.size.depth = 1;
|
||||||
baseTextureDescriptor.mipLevelCount = 1;
|
baseTextureDescriptor.mipLevelCount = 1;
|
||||||
baseTextureDescriptor.dimension = wgpu::TextureDimension::e2D;
|
baseTextureDescriptor.dimension = wgpu::TextureDimension::e2D;
|
||||||
baseTextureDescriptor.usage = wgpu::TextureUsage::OutputAttachment;
|
baseTextureDescriptor.usage = wgpu::TextureUsage::RenderAttachment;
|
||||||
|
|
||||||
utils::ComboRenderPipelineDescriptor nonMultisampledPipelineDescriptor(device);
|
utils::ComboRenderPipelineDescriptor nonMultisampledPipelineDescriptor(device);
|
||||||
nonMultisampledPipelineDescriptor.sampleCount = 1;
|
nonMultisampledPipelineDescriptor.sampleCount = 1;
|
||||||
|
@ -900,7 +900,7 @@ namespace {
|
|||||||
{
|
{
|
||||||
// Create a texture
|
// Create a texture
|
||||||
wgpu::Texture texture =
|
wgpu::Texture texture =
|
||||||
CreateTexture(wgpu::TextureUsage::Sampled | wgpu::TextureUsage::OutputAttachment);
|
CreateTexture(wgpu::TextureUsage::Sampled | wgpu::TextureUsage::RenderAttachment);
|
||||||
wgpu::TextureView view = texture.CreateView();
|
wgpu::TextureView view = texture.CreateView();
|
||||||
|
|
||||||
// Create a bind group to use the texture as sampled binding
|
// Create a bind group to use the texture as sampled binding
|
||||||
@ -969,7 +969,7 @@ namespace {
|
|||||||
{
|
{
|
||||||
// Create a texture
|
// Create a texture
|
||||||
wgpu::Texture texture =
|
wgpu::Texture texture =
|
||||||
CreateTexture(wgpu::TextureUsage::Storage | wgpu::TextureUsage::OutputAttachment);
|
CreateTexture(wgpu::TextureUsage::Storage | wgpu::TextureUsage::RenderAttachment);
|
||||||
wgpu::TextureView view = texture.CreateView();
|
wgpu::TextureView view = texture.CreateView();
|
||||||
|
|
||||||
// Create a bind group to use the texture as writeonly storage binding
|
// 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
|
// Create textures that will be used as both a sampled texture and a render target
|
||||||
wgpu::Texture t0 =
|
wgpu::Texture t0 =
|
||||||
CreateTexture(wgpu::TextureUsage::Sampled | wgpu::TextureUsage::OutputAttachment);
|
CreateTexture(wgpu::TextureUsage::Sampled | wgpu::TextureUsage::RenderAttachment);
|
||||||
wgpu::TextureView v0 = t0.CreateView();
|
wgpu::TextureView v0 = t0.CreateView();
|
||||||
wgpu::Texture t1 =
|
wgpu::Texture t1 =
|
||||||
CreateTexture(wgpu::TextureUsage::Sampled | wgpu::TextureUsage::OutputAttachment);
|
CreateTexture(wgpu::TextureUsage::Sampled | wgpu::TextureUsage::RenderAttachment);
|
||||||
wgpu::TextureView v1 = t1.CreateView();
|
wgpu::TextureView v1 = t1.CreateView();
|
||||||
|
|
||||||
// Create bind groups to use the texture as sampled
|
// Create bind groups to use the texture as sampled
|
||||||
@ -1312,7 +1312,7 @@ namespace {
|
|||||||
wgpu::Texture texture0 = CreateTexture(wgpu::TextureUsage::CopySrc);
|
wgpu::Texture texture0 = CreateTexture(wgpu::TextureUsage::CopySrc);
|
||||||
wgpu::Texture texture1 =
|
wgpu::Texture texture1 =
|
||||||
CreateTexture(wgpu::TextureUsage::CopyDst | wgpu::TextureUsage::Sampled |
|
CreateTexture(wgpu::TextureUsage::CopyDst | wgpu::TextureUsage::Sampled |
|
||||||
wgpu::TextureUsage::OutputAttachment);
|
wgpu::TextureUsage::RenderAttachment);
|
||||||
wgpu::TextureView view0 = texture0.CreateView();
|
wgpu::TextureView view0 = texture0.CreateView();
|
||||||
wgpu::TextureView view1 = texture1.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
|
// Create textures that will be used as both a sampled texture and a render target
|
||||||
wgpu::Texture texture0 =
|
wgpu::Texture texture0 =
|
||||||
CreateTexture(wgpu::TextureUsage::Sampled | wgpu::TextureUsage::OutputAttachment);
|
CreateTexture(wgpu::TextureUsage::Sampled | wgpu::TextureUsage::RenderAttachment);
|
||||||
wgpu::TextureView view0 = texture0.CreateView();
|
wgpu::TextureView view0 = texture0.CreateView();
|
||||||
wgpu::Texture texture1 =
|
wgpu::Texture texture1 =
|
||||||
CreateTexture(wgpu::TextureUsage::Sampled | wgpu::TextureUsage::OutputAttachment);
|
CreateTexture(wgpu::TextureUsage::Sampled | wgpu::TextureUsage::RenderAttachment);
|
||||||
wgpu::TextureView view1 = texture1.CreateView();
|
wgpu::TextureView view1 = texture1.CreateView();
|
||||||
|
|
||||||
// Create the bind group to use the texture as sampled
|
// Create the bind group to use the texture as sampled
|
||||||
@ -1516,7 +1516,7 @@ namespace {
|
|||||||
TEST_F(ResourceUsageTrackingTest, TextureUsageConflictWithInvisibleStageInBindGroup) {
|
TEST_F(ResourceUsageTrackingTest, TextureUsageConflictWithInvisibleStageInBindGroup) {
|
||||||
// Create texture and texture view
|
// Create texture and texture view
|
||||||
wgpu::Texture texture =
|
wgpu::Texture texture =
|
||||||
CreateTexture(wgpu::TextureUsage::Storage | wgpu::TextureUsage::OutputAttachment);
|
CreateTexture(wgpu::TextureUsage::Storage | wgpu::TextureUsage::RenderAttachment);
|
||||||
wgpu::TextureView view = texture.CreateView();
|
wgpu::TextureView view = texture.CreateView();
|
||||||
|
|
||||||
// Test render pass
|
// Test render pass
|
||||||
|
@ -658,7 +658,7 @@ TEST_F(StorageTextureValidationTests, StorageTextureUsageInBindGroup) {
|
|||||||
constexpr std::array<wgpu::TextureUsage, 6> kTextureUsages = {
|
constexpr std::array<wgpu::TextureUsage, 6> kTextureUsages = {
|
||||||
wgpu::TextureUsage::CopySrc, wgpu::TextureUsage::CopyDst,
|
wgpu::TextureUsage::CopySrc, wgpu::TextureUsage::CopyDst,
|
||||||
wgpu::TextureUsage::Sampled, wgpu::TextureUsage::Storage,
|
wgpu::TextureUsage::Sampled, wgpu::TextureUsage::Storage,
|
||||||
wgpu::TextureUsage::OutputAttachment, wgpu::TextureUsage::Present};
|
wgpu::TextureUsage::RenderAttachment, wgpu::TextureUsage::Present};
|
||||||
|
|
||||||
for (wgpu::BindingType storageBindingType : kSupportedStorageTextureBindingTypes) {
|
for (wgpu::BindingType storageBindingType : kSupportedStorageTextureBindingTypes) {
|
||||||
// Create a bind group layout.
|
// Create a bind group layout.
|
||||||
@ -800,7 +800,7 @@ TEST_F(StorageTextureValidationTests, StorageTextureInRenderPass) {
|
|||||||
constexpr wgpu::TextureFormat kFormat = wgpu::TextureFormat::RGBA8Unorm;
|
constexpr wgpu::TextureFormat kFormat = wgpu::TextureFormat::RGBA8Unorm;
|
||||||
wgpu::Texture storageTexture = CreateTexture(wgpu::TextureUsage::Storage, kFormat);
|
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()});
|
utils::ComboRenderPassDescriptor renderPassDescriptor({outputAttachment.CreateView()});
|
||||||
|
|
||||||
for (wgpu::BindingType storageTextureType : kSupportedStorageTextureBindingTypes) {
|
for (wgpu::BindingType storageTextureType : kSupportedStorageTextureBindingTypes) {
|
||||||
@ -831,7 +831,7 @@ TEST_F(StorageTextureValidationTests, StorageTextureAndSampledTextureInOneRender
|
|||||||
wgpu::Texture storageTexture =
|
wgpu::Texture storageTexture =
|
||||||
CreateTexture(wgpu::TextureUsage::Storage | wgpu::TextureUsage::Sampled, kFormat);
|
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()});
|
utils::ComboRenderPassDescriptor renderPassDescriptor({outputAttachment.CreateView()});
|
||||||
|
|
||||||
// Create a bind group that contains a storage texture and a sampled texture.
|
// 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)
|
// 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.
|
// and output attachment in one render pass.
|
||||||
TEST_F(StorageTextureValidationTests, StorageTextureAndOutputAttachmentInOneRenderPass) {
|
TEST_F(StorageTextureValidationTests, StorageTextureAndRenderAttachmentInOneRenderPass) {
|
||||||
constexpr wgpu::TextureFormat kFormat = wgpu::TextureFormat::RGBA8Unorm;
|
constexpr wgpu::TextureFormat kFormat = wgpu::TextureFormat::RGBA8Unorm;
|
||||||
wgpu::Texture storageTexture =
|
wgpu::Texture storageTexture =
|
||||||
CreateTexture(wgpu::TextureUsage::Storage | wgpu::TextureUsage::OutputAttachment, kFormat);
|
CreateTexture(wgpu::TextureUsage::Storage | wgpu::TextureUsage::RenderAttachment, kFormat);
|
||||||
utils::ComboRenderPassDescriptor renderPassDescriptor({storageTexture.CreateView()});
|
utils::ComboRenderPassDescriptor renderPassDescriptor({storageTexture.CreateView()});
|
||||||
|
|
||||||
for (wgpu::BindingType storageTextureType : kSupportedStorageTextureBindingTypes) {
|
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
|
// It is invalid to use a texture as both read-only storage texture and write-only storage
|
||||||
// texture in one render pass.
|
// 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()});
|
utils::ComboRenderPassDescriptor renderPassDescriptor({outputAttachment.CreateView()});
|
||||||
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
|
wgpu::CommandEncoder encoder = device.CreateCommandEncoder();
|
||||||
wgpu::RenderPassEncoder renderPassEncoder = encoder.BeginRenderPass(&renderPassDescriptor);
|
wgpu::RenderPassEncoder renderPassEncoder = encoder.BeginRenderPass(&renderPassDescriptor);
|
||||||
|
@ -129,7 +129,7 @@ namespace {
|
|||||||
// Create texture with 2 mipmap levels and 1 layer
|
// Create texture with 2 mipmap levels and 1 layer
|
||||||
wgpu::Texture texture =
|
wgpu::Texture texture =
|
||||||
CreateTexture(2, 1,
|
CreateTexture(2, 1,
|
||||||
wgpu::TextureUsage::Sampled | wgpu::TextureUsage::OutputAttachment |
|
wgpu::TextureUsage::Sampled | wgpu::TextureUsage::RenderAttachment |
|
||||||
wgpu::TextureUsage::Storage);
|
wgpu::TextureUsage::Storage);
|
||||||
|
|
||||||
// Create two views on different mipmap levels.
|
// Create two views on different mipmap levels.
|
||||||
@ -143,7 +143,7 @@ namespace {
|
|||||||
// Create texture with 1 mipmap level and 2 layers
|
// Create texture with 1 mipmap level and 2 layers
|
||||||
wgpu::Texture texture =
|
wgpu::Texture texture =
|
||||||
CreateTexture(1, 2,
|
CreateTexture(1, 2,
|
||||||
wgpu::TextureUsage::Sampled | wgpu::TextureUsage::OutputAttachment |
|
wgpu::TextureUsage::Sampled | wgpu::TextureUsage::RenderAttachment |
|
||||||
wgpu::TextureUsage::Storage);
|
wgpu::TextureUsage::Storage);
|
||||||
|
|
||||||
// Create two views on different layers.
|
// Create two views on different layers.
|
||||||
|
@ -36,7 +36,7 @@ namespace {
|
|||||||
descriptor.sampleCount = kDefaultSampleCount;
|
descriptor.sampleCount = kDefaultSampleCount;
|
||||||
descriptor.dimension = wgpu::TextureDimension::e2D;
|
descriptor.dimension = wgpu::TextureDimension::e2D;
|
||||||
descriptor.format = kDefaultTextureFormat;
|
descriptor.format = kDefaultTextureFormat;
|
||||||
descriptor.usage = wgpu::TextureUsage::OutputAttachment | wgpu::TextureUsage::Sampled;
|
descriptor.usage = wgpu::TextureUsage::RenderAttachment | wgpu::TextureUsage::Sampled;
|
||||||
return descriptor;
|
return descriptor;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -329,11 +329,11 @@ namespace {
|
|||||||
ASSERT_DEVICE_ERROR(queue.Submit(1, &commands));
|
ASSERT_DEVICE_ERROR(queue.Submit(1, &commands));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test it is an error to create an OutputAttachment texture with a non-renderable format.
|
// Test it is an error to create an RenderAttachment texture with a non-renderable format.
|
||||||
TEST_F(TextureValidationTest, NonRenderableAndOutputAttachment) {
|
TEST_F(TextureValidationTest, NonRenderableAndRenderAttachment) {
|
||||||
wgpu::TextureDescriptor descriptor;
|
wgpu::TextureDescriptor descriptor;
|
||||||
descriptor.size = {1, 1, 1};
|
descriptor.size = {1, 1, 1};
|
||||||
descriptor.usage = wgpu::TextureUsage::OutputAttachment;
|
descriptor.usage = wgpu::TextureUsage::RenderAttachment;
|
||||||
|
|
||||||
// Succeeds because RGBA8Unorm is renderable
|
// Succeeds because RGBA8Unorm is renderable
|
||||||
descriptor.format = wgpu::TextureFormat::RGBA8Unorm;
|
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
|
// Test that only CopySrc, CopyDst and Sampled are accepted as the texture usage of the
|
||||||
// textures in BC formats.
|
// textures in BC formats.
|
||||||
wgpu::TextureUsage invalidUsages[] = {
|
wgpu::TextureUsage invalidUsages[] = {
|
||||||
wgpu::TextureUsage::OutputAttachment,
|
wgpu::TextureUsage::RenderAttachment,
|
||||||
wgpu::TextureUsage::Storage,
|
wgpu::TextureUsage::Storage,
|
||||||
wgpu::TextureUsage::Present,
|
wgpu::TextureUsage::Present,
|
||||||
};
|
};
|
||||||
|
@ -348,7 +348,7 @@ namespace {
|
|||||||
TEST_F(TextureViewValidationTest, AspectMustExist) {
|
TEST_F(TextureViewValidationTest, AspectMustExist) {
|
||||||
wgpu::TextureDescriptor descriptor = {};
|
wgpu::TextureDescriptor descriptor = {};
|
||||||
descriptor.size = {1, 1, 1};
|
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
|
// Can select: All and DepthOnly from Depth32Float, but not StencilOnly
|
||||||
{
|
{
|
||||||
|
@ -130,7 +130,7 @@ ValidationTest::DummyRenderPass::DummyRenderPass(const wgpu::Device& device)
|
|||||||
descriptor.sampleCount = 1;
|
descriptor.sampleCount = 1;
|
||||||
descriptor.format = attachmentFormat;
|
descriptor.format = attachmentFormat;
|
||||||
descriptor.mipLevelCount = 1;
|
descriptor.mipLevelCount = 1;
|
||||||
descriptor.usage = wgpu::TextureUsage::OutputAttachment;
|
descriptor.usage = wgpu::TextureUsage::RenderAttachment;
|
||||||
attachment = device.CreateTexture(&descriptor);
|
attachment = device.CreateTexture(&descriptor);
|
||||||
|
|
||||||
wgpu::TextureView view = attachment.CreateView();
|
wgpu::TextureView view = attachment.CreateView();
|
||||||
|
@ -69,7 +69,7 @@ class D3D12DescriptorHeapTests : public DawnTest {
|
|||||||
descriptor.sampleCount = 1;
|
descriptor.sampleCount = 1;
|
||||||
descriptor.format = format;
|
descriptor.format = format;
|
||||||
descriptor.mipLevelCount = 1;
|
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);
|
wgpu::Texture color = device.CreateTexture(&descriptor);
|
||||||
|
|
||||||
return utils::BasicRenderPass(width, height, color);
|
return utils::BasicRenderPass(width, height, color);
|
||||||
@ -739,7 +739,7 @@ TEST_P(D3D12DescriptorHeapTests, EncodeManyUBOAndSamplers) {
|
|||||||
descriptor.sampleCount = 1;
|
descriptor.sampleCount = 1;
|
||||||
descriptor.format = wgpu::TextureFormat::RGBA8Unorm;
|
descriptor.format = wgpu::TextureFormat::RGBA8Unorm;
|
||||||
descriptor.mipLevelCount = 1;
|
descriptor.mipLevelCount = 1;
|
||||||
descriptor.usage = wgpu::TextureUsage::Sampled | wgpu::TextureUsage::OutputAttachment |
|
descriptor.usage = wgpu::TextureUsage::Sampled | wgpu::TextureUsage::RenderAttachment |
|
||||||
wgpu::TextureUsage::CopySrc;
|
wgpu::TextureUsage::CopySrc;
|
||||||
wgpu::Texture texture = device.CreateTexture(&descriptor);
|
wgpu::Texture texture = device.CreateTexture(&descriptor);
|
||||||
wgpu::TextureView textureView = texture.CreateView();
|
wgpu::TextureView textureView = texture.CreateView();
|
||||||
|
@ -50,7 +50,7 @@ namespace dawn_native { namespace vulkan {
|
|||||||
defaultDescriptor.size = {1, 1, 1};
|
defaultDescriptor.size = {1, 1, 1};
|
||||||
defaultDescriptor.sampleCount = 1;
|
defaultDescriptor.sampleCount = 1;
|
||||||
defaultDescriptor.mipLevelCount = 1;
|
defaultDescriptor.mipLevelCount = 1;
|
||||||
defaultDescriptor.usage = wgpu::TextureUsage::OutputAttachment |
|
defaultDescriptor.usage = wgpu::TextureUsage::RenderAttachment |
|
||||||
wgpu::TextureUsage::CopySrc | wgpu::TextureUsage::CopyDst;
|
wgpu::TextureUsage::CopySrc | wgpu::TextureUsage::CopyDst;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -234,7 +234,7 @@ namespace dawn_native { namespace vulkan {
|
|||||||
defaultDescriptor.size = {1, 1, 1};
|
defaultDescriptor.size = {1, 1, 1};
|
||||||
defaultDescriptor.sampleCount = 1;
|
defaultDescriptor.sampleCount = 1;
|
||||||
defaultDescriptor.mipLevelCount = 1;
|
defaultDescriptor.mipLevelCount = 1;
|
||||||
defaultDescriptor.usage = wgpu::TextureUsage::OutputAttachment |
|
defaultDescriptor.usage = wgpu::TextureUsage::RenderAttachment |
|
||||||
wgpu::TextureUsage::CopySrc | wgpu::TextureUsage::CopyDst;
|
wgpu::TextureUsage::CopySrc | wgpu::TextureUsage::CopyDst;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -401,7 +401,7 @@ namespace dawn_native { namespace vulkan {
|
|||||||
defaultDescriptor.size = {1, 1, 1};
|
defaultDescriptor.size = {1, 1, 1};
|
||||||
defaultDescriptor.sampleCount = 1;
|
defaultDescriptor.sampleCount = 1;
|
||||||
defaultDescriptor.mipLevelCount = 1;
|
defaultDescriptor.mipLevelCount = 1;
|
||||||
defaultDescriptor.usage = wgpu::TextureUsage::OutputAttachment |
|
defaultDescriptor.usage = wgpu::TextureUsage::RenderAttachment |
|
||||||
wgpu::TextureUsage::CopySrc | wgpu::TextureUsage::CopyDst;
|
wgpu::TextureUsage::CopySrc | wgpu::TextureUsage::CopyDst;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -65,7 +65,7 @@ namespace utils {
|
|||||||
[mLayer setDrawableSize:size];
|
[mLayer setDrawableSize:size];
|
||||||
|
|
||||||
constexpr uint32_t kFramebufferOnlyTextureUsages =
|
constexpr uint32_t kFramebufferOnlyTextureUsages =
|
||||||
WGPUTextureUsage_OutputAttachment | WGPUTextureUsage_Present;
|
WGPUTextureUsage_RenderAttachment | WGPUTextureUsage_Present;
|
||||||
bool hasOnlyFramebufferUsages = !(usage & (~kFramebufferOnlyTextureUsages));
|
bool hasOnlyFramebufferUsages = !(usage & (~kFramebufferOnlyTextureUsages));
|
||||||
if (hasOnlyFramebufferUsages) {
|
if (hasOnlyFramebufferUsages) {
|
||||||
[mLayer setFramebufferOnly:YES];
|
[mLayer setFramebufferOnly:YES];
|
||||||
|
@ -262,7 +262,7 @@ namespace utils {
|
|||||||
descriptor.sampleCount = 1;
|
descriptor.sampleCount = 1;
|
||||||
descriptor.format = BasicRenderPass::kDefaultColorFormat;
|
descriptor.format = BasicRenderPass::kDefaultColorFormat;
|
||||||
descriptor.mipLevelCount = 1;
|
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);
|
wgpu::Texture color = device.CreateTexture(&descriptor);
|
||||||
|
|
||||||
return BasicRenderPass(width, height, color);
|
return BasicRenderPass(width, height, color);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user