Add support for multisampled sampling

This CL adds support for multisampled sampling on the D3D12 backend.
This was already working on other backends. It also adds tests that all
of the sample locations are correct.

Bug: dawn:431
Change-Id: I6849e5e2d708ad4824e6db2665d668d43a4ef5ea
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/23245
Commit-Queue: Austin Eng <enga@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
This commit is contained in:
Austin Eng
2020-06-19 16:21:33 +00:00
committed by Commit Bot service account
parent 4e4ebe87ad
commit 8f9523eb38
15 changed files with 605 additions and 72 deletions

View File

@@ -46,11 +46,15 @@ namespace dawn_native { namespace opengl {
}
GLenum TargetForTextureViewDimension(wgpu::TextureViewDimension dimension,
uint32_t arrayLayerCount,
uint32_t sampleCount) {
switch (dimension) {
case wgpu::TextureViewDimension::e2D:
return (sampleCount > 1) ? GL_TEXTURE_2D_MULTISAMPLE : GL_TEXTURE_2D;
case wgpu::TextureViewDimension::e2DArray:
if (arrayLayerCount == 1) {
return (sampleCount > 1) ? GL_TEXTURE_2D_MULTISAMPLE : GL_TEXTURE_2D;
}
ASSERT(sampleCount == 1);
return GL_TEXTURE_2D_ARRAY;
case wgpu::TextureViewDimension::Cube:
@@ -387,7 +391,8 @@ namespace dawn_native { namespace opengl {
TextureView::TextureView(TextureBase* texture, const TextureViewDescriptor* descriptor)
: TextureViewBase(texture, descriptor), mOwnsHandle(false) {
mTarget = TargetForTextureViewDimension(descriptor->dimension, texture->GetSampleCount());
mTarget = TargetForTextureViewDimension(descriptor->dimension, descriptor->arrayLayerCount,
texture->GetSampleCount());
if (!UsageNeedsTextureView(texture->GetUsage())) {
mHandle = 0;