OpenGLES: simulate glTextureView() with texture-to-texture copies.
This is obviously a non-optimal solution, but works in all cases except compressed textures. Change-Id: I3fd5fd89ef4978a18917b068632f25f75527c594 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/84160 Reviewed-by: Austin Eng <enga@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Stephen White <senorblanco@google.com>
This commit is contained in:
parent
03e1aaece5
commit
ca4a8cf02a
|
@ -244,6 +244,17 @@ namespace dawn::native::opengl {
|
||||||
const auto& indices = ToBackend(mPipelineLayout)->GetBindingIndexInfo()[index];
|
const auto& indices = ToBackend(mPipelineLayout)->GetBindingIndexInfo()[index];
|
||||||
uint32_t currentDynamicOffsetIndex = 0;
|
uint32_t currentDynamicOffsetIndex = 0;
|
||||||
|
|
||||||
|
for (BindingIndex bindingIndex{0};
|
||||||
|
bindingIndex < group->GetLayout()->GetBindingCount(); ++bindingIndex) {
|
||||||
|
const BindingInfo& bindingInfo =
|
||||||
|
group->GetLayout()->GetBindingInfo(bindingIndex);
|
||||||
|
|
||||||
|
if (bindingInfo.bindingType == BindingInfoType::Texture) {
|
||||||
|
TextureView* view = ToBackend(group->GetBindingAsTextureView(bindingIndex));
|
||||||
|
view->CopyIfNeeded();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
for (BindingIndex bindingIndex{0};
|
for (BindingIndex bindingIndex{0};
|
||||||
bindingIndex < group->GetLayout()->GetBindingCount(); ++bindingIndex) {
|
bindingIndex < group->GetLayout()->GetBindingCount(); ++bindingIndex) {
|
||||||
const BindingInfo& bindingInfo =
|
const BindingInfo& bindingInfo =
|
||||||
|
@ -361,6 +372,7 @@ namespace dawn::native::opengl {
|
||||||
gl.BindImageTexture(imageIndex, handle, view->GetBaseMipLevel(),
|
gl.BindImageTexture(imageIndex, handle, view->GetBaseMipLevel(),
|
||||||
isLayered, view->GetBaseArrayLayer(), access,
|
isLayered, view->GetBaseArrayLayer(), access,
|
||||||
texture->GetGLFormat().internalFormat);
|
texture->GetGLFormat().internalFormat);
|
||||||
|
texture->Touch();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -402,6 +414,7 @@ namespace dawn::native::opengl {
|
||||||
gl.BlitFramebuffer(0, 0, renderPass->width, renderPass->height, 0, 0,
|
gl.BlitFramebuffer(0, 0, renderPass->width, renderPass->height, 0, 0,
|
||||||
renderPass->width, renderPass->height, GL_COLOR_BUFFER_BIT,
|
renderPass->width, renderPass->height, GL_COLOR_BUFFER_BIT,
|
||||||
GL_NEAREST);
|
GL_NEAREST);
|
||||||
|
ToBackend(resolveView->GetTexture())->Touch();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -552,6 +565,7 @@ namespace dawn::native::opengl {
|
||||||
DoTexSubImage(gl, dst, reinterpret_cast<void*>(src.offset), dataLayout,
|
DoTexSubImage(gl, dst, reinterpret_cast<void*>(src.offset), dataLayout,
|
||||||
copy->copySize);
|
copy->copySize);
|
||||||
gl.BindBuffer(GL_PIXEL_UNPACK_BUFFER, 0);
|
gl.BindBuffer(GL_PIXEL_UNPACK_BUFFER, 0);
|
||||||
|
ToBackend(dst.texture)->Touch();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -698,6 +712,7 @@ namespace dawn::native::opengl {
|
||||||
srcTexture->GetGLTarget(), src.mipLevel, src.origin,
|
srcTexture->GetGLTarget(), src.mipLevel, src.origin,
|
||||||
dstTexture->GetHandle(), dstTexture->GetGLTarget(),
|
dstTexture->GetHandle(), dstTexture->GetGLTarget(),
|
||||||
dst.mipLevel, dst.origin, copySize);
|
dst.mipLevel, dst.origin, copySize);
|
||||||
|
ToBackend(dst.texture)->Touch();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1134,6 +1149,17 @@ namespace dawn::native::opengl {
|
||||||
case Command::EndRenderPass: {
|
case Command::EndRenderPass: {
|
||||||
mCommands.NextCommand<EndRenderPassCmd>();
|
mCommands.NextCommand<EndRenderPassCmd>();
|
||||||
|
|
||||||
|
for (ColorAttachmentIndex i :
|
||||||
|
IterateBitSet(renderPass->attachmentState->GetColorAttachmentsMask())) {
|
||||||
|
TextureView* textureView =
|
||||||
|
ToBackend(renderPass->colorAttachments[i].view.Get());
|
||||||
|
ToBackend(textureView->GetTexture())->Touch();
|
||||||
|
}
|
||||||
|
if (renderPass->attachmentState->HasDepthStencilAttachment()) {
|
||||||
|
TextureView* textureView =
|
||||||
|
ToBackend(renderPass->depthStencilAttachment.view.Get());
|
||||||
|
ToBackend(textureView->GetTexture())->Touch();
|
||||||
|
}
|
||||||
if (renderPass->attachmentState->GetSampleCount() > 1) {
|
if (renderPass->attachmentState->GetSampleCount() > 1) {
|
||||||
ResolveMultisampledRenderTargets(gl, renderPass);
|
ResolveMultisampledRenderTargets(gl, renderPass);
|
||||||
}
|
}
|
||||||
|
|
|
@ -74,6 +74,7 @@ namespace dawn::native::opengl {
|
||||||
ToBackend(destination.texture)->EnsureSubresourceContentInitialized(range);
|
ToBackend(destination.texture)->EnsureSubresourceContentInitialized(range);
|
||||||
}
|
}
|
||||||
DoTexSubImage(ToBackend(GetDevice())->gl, textureCopy, data, dataLayout, writeSizePixel);
|
DoTexSubImage(ToBackend(GetDevice())->gl, textureCopy, data, dataLayout, writeSizePixel);
|
||||||
|
ToBackend(destination.texture)->Touch();
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -199,6 +199,14 @@ namespace dawn::native::opengl {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Texture::Touch() {
|
||||||
|
mGenID++;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32_t Texture::GetGenID() const {
|
||||||
|
return mGenID;
|
||||||
|
}
|
||||||
|
|
||||||
Texture::Texture(Device* device,
|
Texture::Texture(Device* device,
|
||||||
const TextureDescriptor* descriptor,
|
const TextureDescriptor* descriptor,
|
||||||
GLuint handle,
|
GLuint handle,
|
||||||
|
@ -538,6 +546,7 @@ namespace dawn::native::opengl {
|
||||||
SetIsSubresourceContentInitialized(true, range);
|
SetIsSubresourceContentInitialized(true, range);
|
||||||
device->IncrementLazyClearCountForTesting();
|
device->IncrementLazyClearCountForTesting();
|
||||||
}
|
}
|
||||||
|
Touch();
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -565,23 +574,19 @@ namespace dawn::native::opengl {
|
||||||
if (!RequiresCreatingNewTextureView(texture, descriptor)) {
|
if (!RequiresCreatingNewTextureView(texture, descriptor)) {
|
||||||
mHandle = ToBackend(texture)->GetHandle();
|
mHandle = ToBackend(texture)->GetHandle();
|
||||||
} else {
|
} else {
|
||||||
// glTextureView() is supported on OpenGL version >= 4.3
|
|
||||||
// TODO(crbug.com/dawn/593): support texture view on OpenGL version <= 4.2 and ES
|
|
||||||
const OpenGLFunctions& gl = ToBackend(GetDevice())->gl;
|
const OpenGLFunctions& gl = ToBackend(GetDevice())->gl;
|
||||||
mHandle = GenTexture(gl);
|
if (gl.IsAtLeastGL(4, 3)) {
|
||||||
const Texture* textureGL = ToBackend(texture);
|
mHandle = GenTexture(gl);
|
||||||
|
const Texture* textureGL = ToBackend(texture);
|
||||||
const Format& textureFormat = GetTexture()->GetFormat();
|
gl.TextureView(mHandle, mTarget, textureGL->GetHandle(), GetInternalFormat(),
|
||||||
// Depth/stencil don't support reinterpretation, and the aspect is specified at
|
descriptor->baseMipLevel, descriptor->mipLevelCount,
|
||||||
// bind time. In that case, we use the base texture format.
|
descriptor->baseArrayLayer, descriptor->arrayLayerCount);
|
||||||
const GLFormat& glFormat = textureFormat.HasDepthOrStencil()
|
mOwnsHandle = true;
|
||||||
? ToBackend(GetDevice())->GetGLFormat(textureFormat)
|
} else {
|
||||||
: ToBackend(GetDevice())->GetGLFormat(GetFormat());
|
// Simulate glTextureView() with texture-to-texture copies.
|
||||||
|
mUseCopy = true;
|
||||||
gl.TextureView(mHandle, mTarget, textureGL->GetHandle(), glFormat.internalFormat,
|
mHandle = 0;
|
||||||
descriptor->baseMipLevel, descriptor->mipLevelCount,
|
}
|
||||||
descriptor->baseArrayLayer, descriptor->arrayLayerCount);
|
|
||||||
mOwnsHandle = true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -632,4 +637,50 @@ namespace dawn::native::opengl {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TextureView::CopyIfNeeded() {
|
||||||
|
if (!mUseCopy) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const Texture* texture = ToBackend(GetTexture());
|
||||||
|
if (mGenID == texture->GetGenID()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Device* device = ToBackend(GetDevice());
|
||||||
|
const OpenGLFunctions& gl = device->gl;
|
||||||
|
uint32_t srcLevel = GetBaseMipLevel();
|
||||||
|
uint32_t numLevels = GetLevelCount();
|
||||||
|
|
||||||
|
uint32_t width = texture->GetWidth() >> srcLevel;
|
||||||
|
uint32_t height = texture->GetHeight() >> srcLevel;
|
||||||
|
Extent3D size{width, height, GetLayerCount()};
|
||||||
|
|
||||||
|
if (mHandle == 0) {
|
||||||
|
mHandle = GenTexture(gl);
|
||||||
|
gl.BindTexture(mTarget, mHandle);
|
||||||
|
AllocateTexture(gl, mTarget, texture->GetSampleCount(), numLevels, GetInternalFormat(),
|
||||||
|
size);
|
||||||
|
mOwnsHandle = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
Origin3D src{0, 0, GetBaseArrayLayer()};
|
||||||
|
Origin3D dst{0, 0, 0};
|
||||||
|
for (GLuint level = 0; level < numLevels; ++level) {
|
||||||
|
CopyImageSubData(gl, GetAspects(), texture->GetHandle(), texture->GetGLTarget(),
|
||||||
|
srcLevel + level, src, mHandle, mTarget, level, dst, size);
|
||||||
|
}
|
||||||
|
|
||||||
|
mGenID = texture->GetGenID();
|
||||||
|
}
|
||||||
|
|
||||||
|
GLenum TextureView::GetInternalFormat() const {
|
||||||
|
// Depth/stencil don't support reinterpretation, and the aspect is specified at
|
||||||
|
// bind time. In that case, we use the base texture format.
|
||||||
|
const Format& format =
|
||||||
|
GetFormat().HasDepthOrStencil() ? GetTexture()->GetFormat() : GetFormat();
|
||||||
|
const GLFormat& glFormat = ToBackend(GetDevice())->GetGLFormat(format);
|
||||||
|
return glFormat.internalFormat;
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace dawn::native::opengl
|
} // namespace dawn::native::opengl
|
||||||
|
|
|
@ -35,6 +35,8 @@ namespace dawn::native::opengl {
|
||||||
GLuint GetHandle() const;
|
GLuint GetHandle() const;
|
||||||
GLenum GetGLTarget() const;
|
GLenum GetGLTarget() const;
|
||||||
const GLFormat& GetGLFormat() const;
|
const GLFormat& GetGLFormat() const;
|
||||||
|
uint32_t GetGenID() const;
|
||||||
|
void Touch();
|
||||||
|
|
||||||
void EnsureSubresourceContentInitialized(const SubresourceRange& range);
|
void EnsureSubresourceContentInitialized(const SubresourceRange& range);
|
||||||
|
|
||||||
|
@ -46,6 +48,7 @@ namespace dawn::native::opengl {
|
||||||
|
|
||||||
GLuint mHandle;
|
GLuint mHandle;
|
||||||
GLenum mTarget;
|
GLenum mTarget;
|
||||||
|
uint32_t mGenID = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
class TextureView final : public TextureViewBase {
|
class TextureView final : public TextureViewBase {
|
||||||
|
@ -55,15 +58,19 @@ namespace dawn::native::opengl {
|
||||||
GLuint GetHandle() const;
|
GLuint GetHandle() const;
|
||||||
GLenum GetGLTarget() const;
|
GLenum GetGLTarget() const;
|
||||||
void BindToFramebuffer(GLenum target, GLenum attachment);
|
void BindToFramebuffer(GLenum target, GLenum attachment);
|
||||||
|
void CopyIfNeeded();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
~TextureView() override;
|
~TextureView() override;
|
||||||
void DestroyImpl() override;
|
void DestroyImpl() override;
|
||||||
|
GLenum GetInternalFormat() const;
|
||||||
|
|
||||||
// TODO(crbug.com/dawn/1355): Delete this handle on texture destroy.
|
// TODO(crbug.com/dawn/1355): Delete this handle on texture destroy.
|
||||||
GLuint mHandle;
|
GLuint mHandle;
|
||||||
GLenum mTarget;
|
GLenum mTarget;
|
||||||
bool mOwnsHandle;
|
bool mOwnsHandle;
|
||||||
|
bool mUseCopy = false;
|
||||||
|
uint32_t mGenID = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace dawn::native::opengl
|
} // namespace dawn::native::opengl
|
||||||
|
|
|
@ -960,9 +960,6 @@ TEST_P(BufferZeroInitTest, Copy2DTextureToBuffer) {
|
||||||
// Test that the code path of CopyTextureToBuffer clears the destination buffer correctly when it is
|
// Test that the code path of CopyTextureToBuffer clears the destination buffer correctly when it is
|
||||||
// the first use of the buffer and the texture is a 2D array texture.
|
// the first use of the buffer and the texture is a 2D array texture.
|
||||||
TEST_P(BufferZeroInitTest, Copy2DArrayTextureToBuffer) {
|
TEST_P(BufferZeroInitTest, Copy2DArrayTextureToBuffer) {
|
||||||
// TODO(crbug.com/dawn/593): This test uses glTextureView() which is not supported on OpenGL ES.
|
|
||||||
DAWN_TEST_UNSUPPORTED_IF(IsOpenGLES());
|
|
||||||
|
|
||||||
constexpr wgpu::Extent3D kTextureSize = {64u, 4u, 3u};
|
constexpr wgpu::Extent3D kTextureSize = {64u, 4u, 3u};
|
||||||
|
|
||||||
// bytesPerRow == texelBlockSizeInBytes * copySize.width && rowsPerImage == copySize.height &&
|
// bytesPerRow == texelBlockSizeInBytes * copySize.width && rowsPerImage == copySize.height &&
|
||||||
|
|
|
@ -694,7 +694,7 @@ TEST_P(CompressedTextureFormatTest, CopyIntoNonZeroArrayLayer) {
|
||||||
|
|
||||||
DAWN_TEST_UNSUPPORTED_IF(!IsFormatSupported());
|
DAWN_TEST_UNSUPPORTED_IF(!IsFormatSupported());
|
||||||
|
|
||||||
// This test uses glTextureView() which is not supported in OpenGL ES.
|
// TODO(crbug.com/dawn/1328): ES3.1 does not support subsetting of compressed textures.
|
||||||
DAWN_TEST_UNSUPPORTED_IF(IsOpenGLES());
|
DAWN_TEST_UNSUPPORTED_IF(IsOpenGLES());
|
||||||
|
|
||||||
constexpr uint32_t kArrayLayerCount = 3;
|
constexpr uint32_t kArrayLayerCount = 3;
|
||||||
|
@ -714,7 +714,7 @@ TEST_P(CompressedTextureFormatTest, CopyBufferIntoNonZeroMipmapLevel) {
|
||||||
|
|
||||||
DAWN_TEST_UNSUPPORTED_IF(!IsFormatSupported());
|
DAWN_TEST_UNSUPPORTED_IF(!IsFormatSupported());
|
||||||
|
|
||||||
// This test uses glTextureView() which is not supported in OpenGL ES.
|
// TODO(crbug.com/dawn/1328): ES3.1 does not support subsetting of compressed textures.
|
||||||
DAWN_TEST_UNSUPPORTED_IF(IsOpenGLES());
|
DAWN_TEST_UNSUPPORTED_IF(IsOpenGLES());
|
||||||
|
|
||||||
CopyConfig config = GetDefaultFullConfig();
|
CopyConfig config = GetDefaultFullConfig();
|
||||||
|
@ -732,7 +732,7 @@ TEST_P(CompressedTextureFormatTest, CopyWholeTextureSubResourceIntoNonZeroMipmap
|
||||||
|
|
||||||
DAWN_TEST_UNSUPPORTED_IF(!IsFormatSupported());
|
DAWN_TEST_UNSUPPORTED_IF(!IsFormatSupported());
|
||||||
|
|
||||||
// This test uses glTextureView() which is not supported in OpenGL ES.
|
// TODO(crbug.com/dawn/1328): ES3.1 does not support subsetting of compressed textures.
|
||||||
DAWN_TEST_UNSUPPORTED_IF(IsOpenGLES());
|
DAWN_TEST_UNSUPPORTED_IF(IsOpenGLES());
|
||||||
|
|
||||||
// TODO(crbug.com/dawn/816): This consistently fails on with the 12th pixel being opaque
|
// TODO(crbug.com/dawn/816): This consistently fails on with the 12th pixel being opaque
|
||||||
|
@ -1083,7 +1083,7 @@ TEST_P(CompressedTextureFormatTest, LargeImageHeightAndClampedCopyExtent) {
|
||||||
|
|
||||||
DAWN_TEST_UNSUPPORTED_IF(!IsFormatSupported());
|
DAWN_TEST_UNSUPPORTED_IF(!IsFormatSupported());
|
||||||
|
|
||||||
// This test uses glTextureView() which is not supported in OpenGL ES.
|
// TODO(crbug.com/dawn/1328): ES3.1 does not support subsetting of compressed textures.
|
||||||
DAWN_TEST_UNSUPPORTED_IF(IsOpenGLES());
|
DAWN_TEST_UNSUPPORTED_IF(IsOpenGLES());
|
||||||
|
|
||||||
CopyConfig config = GetDefaultFullConfig();
|
CopyConfig config = GetDefaultFullConfig();
|
||||||
|
@ -1105,7 +1105,7 @@ TEST_P(CompressedTextureFormatTest, CopyWhole2DArrayTexture) {
|
||||||
|
|
||||||
DAWN_TEST_UNSUPPORTED_IF(!IsFormatSupported());
|
DAWN_TEST_UNSUPPORTED_IF(!IsFormatSupported());
|
||||||
|
|
||||||
// This test uses glTextureView() which is not supported in OpenGL ES.
|
// TODO(crbug.com/dawn/1328): ES3.1 does not support subsetting of compressed textures.
|
||||||
DAWN_TEST_UNSUPPORTED_IF(IsOpenGLES());
|
DAWN_TEST_UNSUPPORTED_IF(IsOpenGLES());
|
||||||
|
|
||||||
constexpr uint32_t kArrayLayerCount = 3;
|
constexpr uint32_t kArrayLayerCount = 3;
|
||||||
|
@ -1125,7 +1125,7 @@ TEST_P(CompressedTextureFormatTest, CopyMultiple2DArrayLayers) {
|
||||||
|
|
||||||
DAWN_TEST_UNSUPPORTED_IF(!IsFormatSupported());
|
DAWN_TEST_UNSUPPORTED_IF(!IsFormatSupported());
|
||||||
|
|
||||||
// This test uses glTextureView() which is not supported in OpenGL ES.
|
// TODO(crbug.com/dawn/1328): ES3.1 does not support subsetting of compressed textures.
|
||||||
DAWN_TEST_UNSUPPORTED_IF(IsOpenGLES());
|
DAWN_TEST_UNSUPPORTED_IF(IsOpenGLES());
|
||||||
|
|
||||||
constexpr uint32_t kArrayLayerCount = 3;
|
constexpr uint32_t kArrayLayerCount = 3;
|
||||||
|
@ -1276,7 +1276,7 @@ TEST_P(CompressedTextureWriteTextureTest, WriteMultiple2DArrayLayers) {
|
||||||
// TODO(crbug.com/dawn/976): Failing on Linux Intel OpenGL drivers.
|
// TODO(crbug.com/dawn/976): Failing on Linux Intel OpenGL drivers.
|
||||||
DAWN_SUPPRESS_TEST_IF(IsIntel() && IsOpenGL() && IsLinux());
|
DAWN_SUPPRESS_TEST_IF(IsIntel() && IsOpenGL() && IsLinux());
|
||||||
|
|
||||||
// TODO(crbug.com/dawn/593): This test uses glTextureView() which is not supported on OpenGLES.
|
// TODO(crbug.com/dawn/1328): ES3.1 does not support subsetting of compressed textures.
|
||||||
DAWN_TEST_UNSUPPORTED_IF(IsOpenGLES());
|
DAWN_TEST_UNSUPPORTED_IF(IsOpenGLES());
|
||||||
|
|
||||||
// TODO(b/198674734): Width multiplier set to 7 because 5 results in square size for ASTC6x5.
|
// TODO(b/198674734): Width multiplier set to 7 because 5 results in square size for ASTC6x5.
|
||||||
|
@ -1309,7 +1309,7 @@ TEST_P(CompressedTextureWriteTextureTest,
|
||||||
// TODO(crbug.com/dawn/976): Failing on Linux Intel OpenGL drivers.
|
// TODO(crbug.com/dawn/976): Failing on Linux Intel OpenGL drivers.
|
||||||
DAWN_SUPPRESS_TEST_IF(IsIntel() && IsOpenGL() && IsLinux());
|
DAWN_SUPPRESS_TEST_IF(IsIntel() && IsOpenGL() && IsLinux());
|
||||||
|
|
||||||
// TODO(crbug.com/dawn/593): This test uses glTextureView() which is not supported on OpenGLES.
|
// TODO(crbug.com/dawn/1328): ES3.1 does not support subsetting of compressed textures.
|
||||||
DAWN_TEST_UNSUPPORTED_IF(IsOpenGLES());
|
DAWN_TEST_UNSUPPORTED_IF(IsOpenGLES());
|
||||||
|
|
||||||
CopyConfig config = GetDefaultFullConfig();
|
CopyConfig config = GetDefaultFullConfig();
|
||||||
|
|
|
@ -604,8 +604,8 @@ class DepthStencilSamplingTest : public DawnTestWithParams<DepthStencilSamplingT
|
||||||
// Test that sampling a depth/stencil texture at components 1, 2, and 3 yield 0, 0, and 1
|
// Test that sampling a depth/stencil texture at components 1, 2, and 3 yield 0, 0, and 1
|
||||||
// respectively
|
// respectively
|
||||||
TEST_P(DepthStencilSamplingTest, SampleExtraComponents) {
|
TEST_P(DepthStencilSamplingTest, SampleExtraComponents) {
|
||||||
// TODO(crbug.com/dawn/593): This test requires glTextureView, which is unsupported on GLES.
|
// This test fails on SwANGLE (although it passes on other ANGLE backends).
|
||||||
DAWN_TEST_UNSUPPORTED_IF(IsOpenGLES());
|
DAWN_TEST_UNSUPPORTED_IF(IsANGLE());
|
||||||
|
|
||||||
wgpu::TextureFormat format = GetParam().mTextureFormat;
|
wgpu::TextureFormat format = GetParam().mTextureFormat;
|
||||||
|
|
||||||
|
@ -622,9 +622,6 @@ TEST_P(DepthStencilSamplingTest, SampleExtraComponents) {
|
||||||
|
|
||||||
// Test sampling both depth and stencil with a render/compute pipeline works.
|
// Test sampling both depth and stencil with a render/compute pipeline works.
|
||||||
TEST_P(DepthStencilSamplingTest, SampleDepthAndStencilRender) {
|
TEST_P(DepthStencilSamplingTest, SampleDepthAndStencilRender) {
|
||||||
// TODO(crbug.com/dawn/593): This test requires glTextureView, which is unsupported on GLES.
|
|
||||||
DAWN_TEST_UNSUPPORTED_IF(IsOpenGLES());
|
|
||||||
|
|
||||||
wgpu::TextureFormat format = GetParam().mTextureFormat;
|
wgpu::TextureFormat format = GetParam().mTextureFormat;
|
||||||
|
|
||||||
wgpu::SamplerDescriptor samplerDesc;
|
wgpu::SamplerDescriptor samplerDesc;
|
||||||
|
@ -787,8 +784,8 @@ class StencilSamplingTest : public DepthStencilSamplingTest {};
|
||||||
|
|
||||||
// Test that sampling a stencil texture with a render/compute pipeline works
|
// Test that sampling a stencil texture with a render/compute pipeline works
|
||||||
TEST_P(StencilSamplingTest, SampleStencilOnly) {
|
TEST_P(StencilSamplingTest, SampleStencilOnly) {
|
||||||
// TODO(crbug.com/dawn/593): This test requires glTextureView, which is unsupported on GLES.
|
// This test fails on SwANGLE (although it passes on other ANGLE backends).
|
||||||
DAWN_TEST_UNSUPPORTED_IF(IsOpenGLES());
|
DAWN_TEST_UNSUPPORTED_IF(IsANGLE());
|
||||||
|
|
||||||
wgpu::TextureFormat format = GetParam().mTextureFormat;
|
wgpu::TextureFormat format = GetParam().mTextureFormat;
|
||||||
|
|
||||||
|
|
|
@ -111,12 +111,6 @@ namespace {
|
||||||
DAWN_SUPPRESS_TEST_IF(GetParam().mFormat == wgpu::TextureFormat::Depth24PlusStencil8 &&
|
DAWN_SUPPRESS_TEST_IF(GetParam().mFormat == wgpu::TextureFormat::Depth24PlusStencil8 &&
|
||||||
GetParam().mAspect == wgpu::TextureAspect::StencilOnly &&
|
GetParam().mAspect == wgpu::TextureAspect::StencilOnly &&
|
||||||
HasToggleEnabled("disable_depth_stencil_read"));
|
HasToggleEnabled("disable_depth_stencil_read"));
|
||||||
|
|
||||||
// TODO(crbug.com/dawn/593): Test depends on glTextureView which is unsupported on GLES.
|
|
||||||
DAWN_SUPPRESS_TEST_IF(GetParam().mFormat == wgpu::TextureFormat::Depth24PlusStencil8 &&
|
|
||||||
GetParam().mAspect == wgpu::TextureAspect::DepthOnly &&
|
|
||||||
IsOpenGLES());
|
|
||||||
|
|
||||||
// GL may support the feature, but reading data back is not implemented.
|
// GL may support the feature, but reading data back is not implemented.
|
||||||
DAWN_TEST_UNSUPPORTED_IF(GetParam().mFormat == wgpu::TextureFormat::BC1RGBAUnorm &&
|
DAWN_TEST_UNSUPPORTED_IF(GetParam().mFormat == wgpu::TextureFormat::BC1RGBAUnorm &&
|
||||||
(IsOpenGL() || IsOpenGLES()));
|
(IsOpenGL() || IsOpenGLES()));
|
||||||
|
|
|
@ -138,9 +138,6 @@ class TextureSubresourceTest : public DawnTest {
|
||||||
|
|
||||||
// Test different mipmap levels
|
// Test different mipmap levels
|
||||||
TEST_P(TextureSubresourceTest, MipmapLevelsTest) {
|
TEST_P(TextureSubresourceTest, MipmapLevelsTest) {
|
||||||
// TODO(crbug.com/dawn/593): This test requires glTextureView, which is unsupported on GLES.
|
|
||||||
DAWN_TEST_UNSUPPORTED_IF(IsOpenGLES());
|
|
||||||
|
|
||||||
// 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,
|
||||||
|
@ -167,8 +164,6 @@ TEST_P(TextureSubresourceTest, MipmapLevelsTest) {
|
||||||
|
|
||||||
// Test different array layers
|
// Test different array layers
|
||||||
TEST_P(TextureSubresourceTest, ArrayLayersTest) {
|
TEST_P(TextureSubresourceTest, ArrayLayersTest) {
|
||||||
// TODO(crbug.com/dawn/593): This test requires glTextureView, which is unsupported on GLES.
|
|
||||||
DAWN_TEST_UNSUPPORTED_IF(IsOpenGLES());
|
|
||||||
// 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,
|
||||||
|
|
|
@ -203,8 +203,6 @@ class TextureViewSamplingTest : public DawnTest {
|
||||||
uint32_t textureMipLevels,
|
uint32_t textureMipLevels,
|
||||||
uint32_t textureViewBaseLayer,
|
uint32_t textureViewBaseLayer,
|
||||||
uint32_t textureViewBaseMipLevel) {
|
uint32_t textureViewBaseMipLevel) {
|
||||||
// TODO(crbug.com/dawn/593): This test requires glTextureView, which is unsupported on GLES.
|
|
||||||
DAWN_TEST_UNSUPPORTED_IF(IsOpenGLES());
|
|
||||||
ASSERT(textureViewBaseLayer < textureArrayLayers);
|
ASSERT(textureViewBaseLayer < textureArrayLayers);
|
||||||
ASSERT(textureViewBaseMipLevel < textureMipLevels);
|
ASSERT(textureViewBaseMipLevel < textureMipLevels);
|
||||||
|
|
||||||
|
@ -236,8 +234,6 @@ class TextureViewSamplingTest : public DawnTest {
|
||||||
uint32_t textureMipLevels,
|
uint32_t textureMipLevels,
|
||||||
uint32_t textureViewBaseLayer,
|
uint32_t textureViewBaseLayer,
|
||||||
uint32_t textureViewBaseMipLevel) {
|
uint32_t textureViewBaseMipLevel) {
|
||||||
// TODO(crbug.com/dawn/593): This test requires glTextureView, which is unsupported on GLES.
|
|
||||||
DAWN_TEST_UNSUPPORTED_IF(IsOpenGLES());
|
|
||||||
ASSERT(textureViewBaseLayer < textureArrayLayers);
|
ASSERT(textureViewBaseLayer < textureArrayLayers);
|
||||||
ASSERT(textureViewBaseMipLevel < textureMipLevels);
|
ASSERT(textureViewBaseMipLevel < textureMipLevels);
|
||||||
|
|
||||||
|
@ -316,9 +312,9 @@ class TextureViewSamplingTest : public DawnTest {
|
||||||
uint32_t textureViewBaseLayer,
|
uint32_t textureViewBaseLayer,
|
||||||
uint32_t textureViewLayerCount,
|
uint32_t textureViewLayerCount,
|
||||||
bool isCubeMapArray) {
|
bool isCubeMapArray) {
|
||||||
// TODO(crbug.com/dawn/600): In OpenGL ES, cube map textures cannot be treated as arrays
|
// TODO(crbug.com/dawn/1300): OpenGLES does not support cube map arrays.
|
||||||
// of 2D textures. Find a workaround.
|
DAWN_TEST_UNSUPPORTED_IF(isCubeMapArray && IsOpenGLES());
|
||||||
DAWN_TEST_UNSUPPORTED_IF(IsOpenGLES());
|
|
||||||
constexpr uint32_t kMipLevels = 1u;
|
constexpr uint32_t kMipLevels = 1u;
|
||||||
InitTexture(textureArrayLayers, kMipLevels);
|
InitTexture(textureArrayLayers, kMipLevels);
|
||||||
|
|
||||||
|
@ -396,8 +392,6 @@ TEST_P(TextureViewSamplingTest, Texture2DArrayViewOn2DArrayTexture) {
|
||||||
// Test sampling from a 2D array texture view created on a 2D texture with one layer.
|
// Test sampling from a 2D array texture view created on a 2D texture with one layer.
|
||||||
// Regression test for crbug.com/dawn/1309.
|
// Regression test for crbug.com/dawn/1309.
|
||||||
TEST_P(TextureViewSamplingTest, Texture2DArrayViewOnSingleLayer2DTexture) {
|
TEST_P(TextureViewSamplingTest, Texture2DArrayViewOnSingleLayer2DTexture) {
|
||||||
// TODO(crbug.com/dawn/593): This test requires glTextureView, which is unsupported on GLES.
|
|
||||||
DAWN_TEST_UNSUPPORTED_IF(IsOpenGLES());
|
|
||||||
InitTexture(1 /* array layer count */, 1 /* mip level count */);
|
InitTexture(1 /* array layer count */, 1 /* mip level count */);
|
||||||
|
|
||||||
wgpu::TextureViewDescriptor descriptor = mDefaultTextureViewDescriptor;
|
wgpu::TextureViewDescriptor descriptor = mDefaultTextureViewDescriptor;
|
||||||
|
|
|
@ -899,9 +899,6 @@ TEST_P(TextureZeroInitTest, RenderPassSampledTextureClear) {
|
||||||
// sampled and attachment (with LoadOp::Clear so the lazy clear can be skipped) then the sampled
|
// sampled and attachment (with LoadOp::Clear so the lazy clear can be skipped) then the sampled
|
||||||
// subresource is correctly cleared.
|
// subresource is correctly cleared.
|
||||||
TEST_P(TextureZeroInitTest, TextureBothSampledAndAttachmentClear) {
|
TEST_P(TextureZeroInitTest, TextureBothSampledAndAttachmentClear) {
|
||||||
// TODO(crbug.com/dawn/593): This test uses glTextureView() which is not supported on OpenGL ES.
|
|
||||||
DAWN_TEST_UNSUPPORTED_IF(IsOpenGLES());
|
|
||||||
|
|
||||||
// Create a 2D array texture, layer 0 will be used as attachment, layer 1 as sampled.
|
// Create a 2D array texture, layer 0 will be used as attachment, layer 1 as sampled.
|
||||||
wgpu::TextureDescriptor texDesc;
|
wgpu::TextureDescriptor texDesc;
|
||||||
texDesc.usage = wgpu::TextureUsage::TextureBinding | wgpu::TextureUsage::RenderAttachment |
|
texDesc.usage = wgpu::TextureUsage::TextureBinding | wgpu::TextureUsage::RenderAttachment |
|
||||||
|
@ -1342,9 +1339,6 @@ TEST_P(TextureZeroInitTest, PreservesInitializedMip) {
|
||||||
// Test that if one layer of a texture is initialized and another is uninitialized, lazy clearing
|
// Test that if one layer of a texture is initialized and another is uninitialized, lazy clearing
|
||||||
// the uninitialized layer does not clear the initialized layer.
|
// the uninitialized layer does not clear the initialized layer.
|
||||||
TEST_P(TextureZeroInitTest, PreservesInitializedArrayLayer) {
|
TEST_P(TextureZeroInitTest, PreservesInitializedArrayLayer) {
|
||||||
// TODO(crbug.com/dawn/593): This test uses glTextureView() which is not supported on OpenGL ES.
|
|
||||||
DAWN_TEST_UNSUPPORTED_IF(IsOpenGLES());
|
|
||||||
|
|
||||||
wgpu::TextureDescriptor sampleTextureDescriptor =
|
wgpu::TextureDescriptor sampleTextureDescriptor =
|
||||||
CreateTextureDescriptor(1, 2,
|
CreateTextureDescriptor(1, 2,
|
||||||
wgpu::TextureUsage::CopySrc | wgpu::TextureUsage::CopyDst |
|
wgpu::TextureUsage::CopySrc | wgpu::TextureUsage::CopyDst |
|
||||||
|
@ -1875,7 +1869,7 @@ TEST_P(CompressedTextureZeroInitTest, HalfCopyBufferToTexture) {
|
||||||
// Test that 0 lazy clear count happens when we copy buffer to texture to a nonzero mip level
|
// Test that 0 lazy clear count happens when we copy buffer to texture to a nonzero mip level
|
||||||
// (with physical size different from the virtual mip size)
|
// (with physical size different from the virtual mip size)
|
||||||
TEST_P(CompressedTextureZeroInitTest, FullCopyToNonZeroMipLevel) {
|
TEST_P(CompressedTextureZeroInitTest, FullCopyToNonZeroMipLevel) {
|
||||||
// TODO(crbug.com/dawn/593): This test uses glTextureView() which is not supported on OpenGL ES.
|
// TODO(crbug.com/dawn/1328): ES3.1 does not support subsetting of compressed textures.
|
||||||
DAWN_TEST_UNSUPPORTED_IF(IsOpenGLES());
|
DAWN_TEST_UNSUPPORTED_IF(IsOpenGLES());
|
||||||
|
|
||||||
wgpu::TextureDescriptor textureDescriptor;
|
wgpu::TextureDescriptor textureDescriptor;
|
||||||
|
@ -1924,7 +1918,7 @@ TEST_P(CompressedTextureZeroInitTest, HalfCopyToNonZeroMipLevel) {
|
||||||
|
|
||||||
// Test that 0 lazy clear count happens when we copy buffer to nonzero array layer
|
// Test that 0 lazy clear count happens when we copy buffer to nonzero array layer
|
||||||
TEST_P(CompressedTextureZeroInitTest, FullCopyToNonZeroArrayLayer) {
|
TEST_P(CompressedTextureZeroInitTest, FullCopyToNonZeroArrayLayer) {
|
||||||
// TODO(crbug.com/dawn/593): This test uses glTextureView() which is not supported on OpenGL ES.
|
// TODO(crbug.com/dawn/1328): ES3.1 does not support subsetting of compressed textures.
|
||||||
DAWN_TEST_UNSUPPORTED_IF(IsOpenGLES());
|
DAWN_TEST_UNSUPPORTED_IF(IsOpenGLES());
|
||||||
|
|
||||||
wgpu::TextureDescriptor textureDescriptor;
|
wgpu::TextureDescriptor textureDescriptor;
|
||||||
|
@ -1964,7 +1958,7 @@ TEST_P(CompressedTextureZeroInitTest, HalfCopyToNonZeroArrayLayer) {
|
||||||
|
|
||||||
// full copy texture to texture, 0 lazy clears are needed
|
// full copy texture to texture, 0 lazy clears are needed
|
||||||
TEST_P(CompressedTextureZeroInitTest, FullCopyTextureToTextureMipLevel) {
|
TEST_P(CompressedTextureZeroInitTest, FullCopyTextureToTextureMipLevel) {
|
||||||
// TODO(crbug.com/dawn/593): This test uses glTextureView() which is not supported on OpenGL ES.
|
// TODO(crbug.com/dawn/1328): ES3.1 does not support subsetting of compressed textures.
|
||||||
DAWN_TEST_UNSUPPORTED_IF(IsOpenGLES());
|
DAWN_TEST_UNSUPPORTED_IF(IsOpenGLES());
|
||||||
|
|
||||||
// create srcTexture and fill it with data
|
// create srcTexture and fill it with data
|
||||||
|
|
Loading…
Reference in New Issue