Commit 33027d3e by Alexis Hetu Committed by Commit Bot

Enable GL_OES_depth_texture_cube_map with Vulkan backend

GL_OES_depth_texture_cube_map depends on depthTextureOES, but adds the same new texture format/type requirements as GL_OES_packed_depth_stencil, so instead of adding a specific check for GL_OES_depth_texture_cube_map, the Vulkan backend checks for a combination of GL_OES_depth_texture and GL_OES_depth_texture_cube_map to enable GL_OES_depth_texture_cube_map. ANGLE has no specific checks for whether a format is "cubemappable", but Vulkan has no restrictions of the format of cubemaps, so if the proper formats are supported, creating a cube of any of these formats should be implicitly supported. Bug: angleproject:4293 Change-Id: I968dbe8869ba0f50de18dd41f1195e847c06b520 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2026027 Commit-Queue: Alexis Hétu <sugoi@chromium.org> Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org>
parent 09d51a57
...@@ -622,12 +622,6 @@ static bool DetermineDepthTextureOESSupport(const TextureCapsMap &textureCaps) ...@@ -622,12 +622,6 @@ static bool DetermineDepthTextureOESSupport(const TextureCapsMap &textureCaps)
return GetFormatSupport(textureCaps, requiredFormats, true, true, true, true, false); return GetFormatSupport(textureCaps, requiredFormats, true, true, true, true, false);
} }
// Check for GL_OES_depth_texture_cube_map support
static bool DetermineDepthTextureCubeMapOESSupport(const TextureCapsMap &textureCaps)
{
return false;
}
// Check for GL_OES_depth24 // Check for GL_OES_depth24
static bool DetermineDepth24OESSupport(const TextureCapsMap &textureCaps) static bool DetermineDepth24OESSupport(const TextureCapsMap &textureCaps)
{ {
...@@ -805,7 +799,6 @@ void Extensions::setTextureExtensionSupport(const TextureCapsMap &textureCaps) ...@@ -805,7 +799,6 @@ void Extensions::setTextureExtensionSupport(const TextureCapsMap &textureCaps)
sRGB = DetermineSRGBTextureSupport(textureCaps); sRGB = DetermineSRGBTextureSupport(textureCaps);
depthTextureANGLE = DetermineDepthTextureANGLESupport(textureCaps); depthTextureANGLE = DetermineDepthTextureANGLESupport(textureCaps);
depthTextureOES = DetermineDepthTextureOESSupport(textureCaps); depthTextureOES = DetermineDepthTextureOESSupport(textureCaps);
depthTextureCubeMapOES = DetermineDepthTextureCubeMapOESSupport(textureCaps);
depth24OES = DetermineDepth24OESSupport(textureCaps); depth24OES = DetermineDepth24OESSupport(textureCaps);
depth32OES = DetermineDepth32Support(textureCaps); depth32OES = DetermineDepth32Support(textureCaps);
colorBufferFloatRGB = DetermineColorBufferFloatRGBSupport(textureCaps); colorBufferFloatRGB = DetermineColorBufferFloatRGBSupport(textureCaps);
...@@ -887,7 +880,7 @@ const ExtensionInfoMap &GetExtensionInfoMap() ...@@ -887,7 +880,7 @@ const ExtensionInfoMap &GetExtensionInfoMap()
map["GL_EXT_sRGB"] = enableableExtension(&Extensions::sRGB); map["GL_EXT_sRGB"] = enableableExtension(&Extensions::sRGB);
map["GL_ANGLE_depth_texture"] = esOnlyExtension(&Extensions::depthTextureANGLE); map["GL_ANGLE_depth_texture"] = esOnlyExtension(&Extensions::depthTextureANGLE);
map["GL_OES_depth_texture"] = esOnlyExtension(&Extensions::depthTextureOES); map["GL_OES_depth_texture"] = esOnlyExtension(&Extensions::depthTextureOES);
map["GL_OES_depth_texture_cube_map"] = esOnlyExtension(&Extensions::depthTextureCubeMapOES); map["GL_OES_depth_texture_cube_map"] = enableableExtension(&Extensions::depthTextureCubeMapOES);
map["GL_OES_depth24"] = esOnlyExtension(&Extensions::depth24OES); map["GL_OES_depth24"] = esOnlyExtension(&Extensions::depth24OES);
map["GL_OES_depth32"] = esOnlyExtension(&Extensions::depth32OES); map["GL_OES_depth32"] = esOnlyExtension(&Extensions::depth32OES);
map["GL_OES_texture_3D"] = enableableExtension(&Extensions::texture3DOES); map["GL_OES_texture_3D"] = enableableExtension(&Extensions::texture3DOES);
......
...@@ -141,6 +141,11 @@ void RendererVk::ensureCapsInitialized() const ...@@ -141,6 +141,11 @@ void RendererVk::ensureCapsInitialized() const
// We support getting image data for Textures and Renderbuffers. // We support getting image data for Textures and Renderbuffers.
mNativeExtensions.getImageANGLE = true; mNativeExtensions.getImageANGLE = true;
// Vulkan has no restrictions of the format of cubemaps, so if the proper formats are supported,
// creating a cube of any of these formats should be implicitly supported.
mNativeExtensions.depthTextureCubeMapOES =
mNativeExtensions.depthTextureOES && mNativeExtensions.packedDepthStencilOES;
mNativeExtensions.gpuShader5EXT = vk::CanSupportGPUShader5EXT(mPhysicalDeviceFeatures); mNativeExtensions.gpuShader5EXT = vk::CanSupportGPUShader5EXT(mPhysicalDeviceFeatures);
// https://vulkan.lunarg.com/doc/view/1.0.30.0/linux/vkspec.chunked/ch31s02.html // https://vulkan.lunarg.com/doc/view/1.0.30.0/linux/vkspec.chunked/ch31s02.html
......
...@@ -776,7 +776,8 @@ bool ValidateES2CopyTexImageParameters(Context *context, ...@@ -776,7 +776,8 @@ bool ValidateES2CopyTexImageParameters(Context *context,
case GL_DEPTH_STENCIL_OES: case GL_DEPTH_STENCIL_OES:
case GL_DEPTH24_STENCIL8_OES: case GL_DEPTH24_STENCIL8_OES:
if (context->getExtensions().depthTextureAny() || if (context->getExtensions().depthTextureAny() ||
context->getExtensions().packedDepthStencilOES) context->getExtensions().packedDepthStencilOES ||
context->getExtensions().depthTextureCubeMapOES)
{ {
context->validationError(GL_INVALID_OPERATION, kInvalidFormat); context->validationError(GL_INVALID_OPERATION, kInvalidFormat);
return false; return false;
...@@ -1656,17 +1657,36 @@ bool ValidateES2TexImageParametersBase(Context *context, ...@@ -1656,17 +1657,36 @@ bool ValidateES2TexImageParametersBase(Context *context,
case GL_DEPTH_COMPONENT: case GL_DEPTH_COMPONENT:
case GL_DEPTH_STENCIL_OES: case GL_DEPTH_STENCIL_OES:
if (!context->getExtensions().depthTextureANGLE && if (!context->getExtensions().depthTextureANGLE &&
!(context->getExtensions().packedDepthStencilOES && !((context->getExtensions().packedDepthStencilOES ||
context->getExtensions().depthTextureCubeMapOES) &&
context->getExtensions().depthTextureOES)) context->getExtensions().depthTextureOES))
{ {
context->validationError(GL_INVALID_ENUM, kEnumNotSupported); context->validationError(GL_INVALID_ENUM, kEnumNotSupported);
return false; return false;
} }
if (target != TextureTarget::_2D)
switch (target)
{ {
context->validationError(GL_INVALID_OPERATION, kMismatchedTargetAndFormat); case TextureTarget::_2D:
return false; break;
case TextureTarget::CubeMapNegativeX:
case TextureTarget::CubeMapNegativeY:
case TextureTarget::CubeMapNegativeZ:
case TextureTarget::CubeMapPositiveX:
case TextureTarget::CubeMapPositiveY:
case TextureTarget::CubeMapPositiveZ:
if (!context->getExtensions().depthTextureCubeMapOES)
{
context->validationError(GL_INVALID_OPERATION,
kMismatchedTargetAndFormat);
return false;
}
break;
default:
context->validationError(GL_INVALID_OPERATION, kMismatchedTargetAndFormat);
return false;
} }
// OES_depth_texture supports loading depth data and multiple levels, // OES_depth_texture supports loading depth data and multiple levels,
// but ANGLE_depth_texture does not // but ANGLE_depth_texture does not
if (!context->getExtensions().depthTextureOES) if (!context->getExtensions().depthTextureOES)
...@@ -1759,7 +1779,8 @@ bool ValidateES2TexImageParametersBase(Context *context, ...@@ -1759,7 +1779,8 @@ bool ValidateES2TexImageParametersBase(Context *context,
case GL_DEPTH_STENCIL: case GL_DEPTH_STENCIL:
if (!(context->getExtensions().depthTextureANGLE || if (!(context->getExtensions().depthTextureANGLE ||
context->getExtensions().packedDepthStencilOES)) context->getExtensions().packedDepthStencilOES ||
context->getExtensions().depthTextureCubeMapOES))
{ {
context->validationError(GL_INVALID_ENUM, kInvalidFormat); context->validationError(GL_INVALID_ENUM, kInvalidFormat);
return false; return false;
...@@ -2116,11 +2137,23 @@ bool ValidateES2TexStorageParameters(Context *context, ...@@ -2116,11 +2137,23 @@ bool ValidateES2TexStorageParameters(Context *context,
context->validationError(GL_INVALID_ENUM, kEnumNotSupported); context->validationError(GL_INVALID_ENUM, kEnumNotSupported);
return false; return false;
} }
if (target != TextureType::_2D)
switch (target)
{ {
context->validationError(GL_INVALID_OPERATION, kInvalidTextureTarget); case TextureType::_2D:
return false; break;
case TextureType::CubeMap:
if (!context->getExtensions().depthTextureCubeMapOES)
{
context->validationError(GL_INVALID_OPERATION, kInvalidTextureTarget);
return false;
}
break;
default:
context->validationError(GL_INVALID_OPERATION, kInvalidTextureTarget);
return false;
} }
// ANGLE_depth_texture only supports 1-level textures // ANGLE_depth_texture only supports 1-level textures
if (!context->getExtensions().depthTextureOES) if (!context->getExtensions().depthTextureOES)
{ {
...@@ -2133,18 +2166,32 @@ bool ValidateES2TexStorageParameters(Context *context, ...@@ -2133,18 +2166,32 @@ bool ValidateES2TexStorageParameters(Context *context,
break; break;
case GL_DEPTH24_STENCIL8_OES: case GL_DEPTH24_STENCIL8_OES:
if (!(context->getExtensions().depthTextureANGLE || if (!(context->getExtensions().depthTextureANGLE ||
(context->getExtensions().packedDepthStencilOES && ((context->getExtensions().packedDepthStencilOES ||
context->getExtensions().depthTextureCubeMapOES) &&
context->getExtensions().textureStorage))) context->getExtensions().textureStorage)))
{ {
context->validationError(GL_INVALID_ENUM, kEnumNotSupported); context->validationError(GL_INVALID_ENUM, kEnumNotSupported);
return false; return false;
} }
if (target != TextureType::_2D)
switch (target)
{ {
context->validationError(GL_INVALID_OPERATION, kInvalidTextureTarget); case TextureType::_2D:
return false; break;
case TextureType::CubeMap:
if (!context->getExtensions().depthTextureCubeMapOES)
{
context->validationError(GL_INVALID_OPERATION, kInvalidTextureTarget);
return false;
}
break;
default:
context->validationError(GL_INVALID_OPERATION, kInvalidTextureTarget);
return false;
} }
if (!context->getExtensions().packedDepthStencilOES)
if (!context->getExtensions().packedDepthStencilOES &&
!context->getExtensions().depthTextureCubeMapOES)
{ {
// ANGLE_depth_texture only supports 1-level textures // ANGLE_depth_texture only supports 1-level textures
if (levels != 1) if (levels != 1)
......
...@@ -198,7 +198,8 @@ TEST_P(DepthStencilFormatsTest, PackedDepthStencil) ...@@ -198,7 +198,8 @@ TEST_P(DepthStencilFormatsTest, PackedDepthStencil)
EXPECT_EQ(shouldHaveRenderbufferSupport, EXPECT_EQ(shouldHaveRenderbufferSupport,
checkRenderbufferFormatSupport(GL_DEPTH24_STENCIL8_OES)); checkRenderbufferFormatSupport(GL_DEPTH24_STENCIL8_OES));
bool shouldHaveTextureSupport = (IsGLExtensionEnabled("GL_OES_packed_depth_stencil") && bool shouldHaveTextureSupport = ((IsGLExtensionEnabled("GL_OES_packed_depth_stencil") ||
IsGLExtensionEnabled("GL_OES_depth_texture_cube_map")) &&
IsGLExtensionEnabled("GL_OES_depth_texture")) || IsGLExtensionEnabled("GL_OES_depth_texture")) ||
IsGLExtensionEnabled("GL_ANGLE_depth_texture"); IsGLExtensionEnabled("GL_ANGLE_depth_texture");
EXPECT_EQ(shouldHaveTextureSupport, EXPECT_EQ(shouldHaveTextureSupport,
...@@ -236,6 +237,8 @@ void main() ...@@ -236,6 +237,8 @@ void main()
ANGLE_SKIP_TEST_IF(!IsGLExtensionEnabled("GL_OES_depth_texture") && ANGLE_SKIP_TEST_IF(!IsGLExtensionEnabled("GL_OES_depth_texture") &&
!IsGLExtensionEnabled("GL_ANGLE_depth_texture")); !IsGLExtensionEnabled("GL_ANGLE_depth_texture"));
bool depthTextureCubeSupport = IsGLExtensionEnabled("GL_OES_depth_texture_cube_map");
// http://anglebug.com/3454 // http://anglebug.com/3454
ANGLE_SKIP_TEST_IF(IsIntel() && IsWindows() && IsD3D9()); ANGLE_SKIP_TEST_IF(IsIntel() && IsWindows() && IsD3D9());
...@@ -301,7 +304,14 @@ void main() ...@@ -301,7 +304,14 @@ void main()
for (const GLuint target : targets) for (const GLuint target : targets)
{ {
glTexImage2D(target, 0, type.format, 1, 1, 0, type.format, type.type, nullptr); glTexImage2D(target, 0, type.format, 1, 1, 0, type.format, type.type, nullptr);
EXPECT_GL_ERROR(GL_INVALID_OPERATION); if (depthTextureCubeSupport)
{
ASSERT_GL_NO_ERROR();
}
else
{
EXPECT_GL_ERROR(GL_INVALID_OPERATION);
}
} }
std::vector<GLuint> filterModes = {GL_LINEAR, GL_NEAREST}; std::vector<GLuint> filterModes = {GL_LINEAR, GL_NEAREST};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment