Commit 5cbf54da by Mohan Maiya Committed by Commit Bot

Vulkan: Fix exposure requirements for EXT_texture_format_sRGB_override

Previously we were not checking for the correct format support to expose this extension. This change fixes that, and disables the extension if we do not support the formats we need for our implementation to function. This also adds an end2end test to check each possible format that can be used with this extension. Update GLES major version to 3 for TextureSampling perf benchmark Bug: angleproject:4561 Change-Id: Ic81bb28f02f9f36e1bc83a8eea376169de9e7735 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2359482Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarShahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Mohan Maiya <m.maiya@samsung.com>
parent 1c53df78
...@@ -3161,6 +3161,7 @@ Extensions Context::generateSupportedExtensions() const ...@@ -3161,6 +3161,7 @@ Extensions Context::generateSupportedExtensions() const
supportedExtensions.drawBuffersIndexedEXT = false; supportedExtensions.drawBuffersIndexedEXT = false;
supportedExtensions.drawBuffersIndexedOES = false; supportedExtensions.drawBuffersIndexedOES = false;
supportedExtensions.eglImageArray = false; supportedExtensions.eglImageArray = false;
supportedExtensions.textureSRGBOverride = false;
// Requires glCompressedTexImage3D // Requires glCompressedTexImage3D
supportedExtensions.textureCompressionASTCOES = false; supportedExtensions.textureCompressionASTCOES = false;
......
...@@ -83,6 +83,77 @@ bool GetTextureSRGBDecodeSupport(const RendererVk *rendererVk) ...@@ -83,6 +83,77 @@ bool GetTextureSRGBDecodeSupport(const RendererVk *rendererVk)
return true; return true;
} }
bool GetTextureSRGBOverrideSupport(const RendererVk *rendererVk,
const gl::Extensions &supportedExtensions)
{
static constexpr bool kNonLinearColorspace = false;
// If the given linear format is supported, we also need to support its corresponding nonlinear
// format. If the given linear format is NOT supported, we don't care about its corresponding
// nonlinear format.
std::vector<GLenum> optionalLinearFormats = {GL_RGB8,
GL_RGBA8,
GL_COMPRESSED_RGB8_ETC2,
GL_COMPRESSED_RGBA8_ETC2_EAC,
GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2,
GL_COMPRESSED_RGBA_ASTC_4x4,
GL_COMPRESSED_RGBA_ASTC_5x4,
GL_COMPRESSED_RGBA_ASTC_5x5,
GL_COMPRESSED_RGBA_ASTC_6x5,
GL_COMPRESSED_RGBA_ASTC_6x6,
GL_COMPRESSED_RGBA_ASTC_8x5,
GL_COMPRESSED_RGBA_ASTC_8x6,
GL_COMPRESSED_RGBA_ASTC_8x8,
GL_COMPRESSED_RGBA_ASTC_10x5,
GL_COMPRESSED_RGBA_ASTC_10x6,
GL_COMPRESSED_RGBA_ASTC_10x8,
GL_COMPRESSED_RGBA_ASTC_10x10,
GL_COMPRESSED_RGBA_ASTC_12x10,
GL_COMPRESSED_RGBA_ASTC_12x12};
std::vector<GLenum> optionalS3TCLinearFormats = {
GL_COMPRESSED_RGB_S3TC_DXT1_EXT, GL_COMPRESSED_RGBA_S3TC_DXT1_EXT,
GL_COMPRESSED_RGBA_S3TC_DXT3_EXT, GL_COMPRESSED_RGBA_S3TC_DXT5_EXT};
std::vector<GLenum> optionalR8LinearFormats = {GL_R8};
std::vector<GLenum> optionalBPTCLinearFormats = {GL_COMPRESSED_RGBA_BPTC_UNORM_EXT};
if (!vk::FormatReinterpretationSupported(optionalLinearFormats, rendererVk,
kNonLinearColorspace))
{
return false;
}
if (supportedExtensions.textureCompressionS3TCsRGB == true)
{
if (!vk::FormatReinterpretationSupported(optionalS3TCLinearFormats, rendererVk,
kNonLinearColorspace))
{
return false;
}
}
if (supportedExtensions.sRGBR8EXT == true)
{
if (!vk::FormatReinterpretationSupported(optionalR8LinearFormats, rendererVk,
kNonLinearColorspace))
{
return false;
}
}
// TODO: http://anglebug.com/4932 check EXT_texture_sRGB_RG8
if (supportedExtensions.textureCompressionBPTC == true)
{
if (!vk::FormatReinterpretationSupported(optionalBPTCLinearFormats, rendererVk,
kNonLinearColorspace))
{
return false;
}
}
return true;
}
} // namespace } // namespace
} // namespace vk } // namespace vk
...@@ -253,8 +324,9 @@ void RendererVk::ensureCapsInitialized() const ...@@ -253,8 +324,9 @@ void RendererVk::ensureCapsInitialized() const
// Vulkan natively supports format reinterpretation, but we still require support for all // Vulkan natively supports format reinterpretation, but we still require support for all
// formats we may reinterpret to // formats we may reinterpret to
mNativeExtensions.textureSRGBOverride = true; mNativeExtensions.textureSRGBOverride =
mNativeExtensions.textureSRGBDecode = vk::GetTextureSRGBDecodeSupport(this); vk::GetTextureSRGBOverrideSupport(this, mNativeExtensions);
mNativeExtensions.textureSRGBDecode = vk::GetTextureSRGBDecodeSupport(this);
mNativeExtensions.gpuShader5EXT = vk::CanSupportGPUShader5EXT(mPhysicalDeviceFeatures); mNativeExtensions.gpuShader5EXT = vk::CanSupportGPUShader5EXT(mPhysicalDeviceFeatures);
......
...@@ -31,7 +31,7 @@ struct TextureSamplingParams final : public RenderTestParams ...@@ -31,7 +31,7 @@ struct TextureSamplingParams final : public RenderTestParams
iterationsPerStep = kIterationsPerStep; iterationsPerStep = kIterationsPerStep;
// Common default params // Common default params
majorVersion = 2; majorVersion = 3;
minorVersion = 0; minorVersion = 0;
windowWidth = 720; windowWidth = 720;
windowHeight = 720; windowHeight = 720;
...@@ -274,12 +274,11 @@ class TextureSamplingMutableFormatBenchmark : public TextureSamplingBenchmark ...@@ -274,12 +274,11 @@ class TextureSamplingMutableFormatBenchmark : public TextureSamplingBenchmark
void TextureSamplingMutableFormatBenchmark::initializeBenchmark() void TextureSamplingMutableFormatBenchmark::initializeBenchmark()
{ {
if (!IsGLExtensionEnabled("GL_EXT_texture_sRGB_override")) if (IsGLExtensionEnabled("GL_EXT_texture_sRGB_override"))
{ {
FAIL() << "GL_EXT_texture_sRGB_override not supported!" << std::endl; TextureSamplingBenchmark::initializeBenchmark();
initTextures();
} }
TextureSamplingBenchmark::initializeBenchmark();
initTextures();
} }
void TextureSamplingMutableFormatBenchmark::initTextures() void TextureSamplingMutableFormatBenchmark::initTextures()
...@@ -329,11 +328,13 @@ TextureSamplingParams VulkanParams() ...@@ -329,11 +328,13 @@ TextureSamplingParams VulkanParams()
TEST_P(TextureSamplingBenchmark, Run) TEST_P(TextureSamplingBenchmark, Run)
{ {
ANGLE_SKIP_TEST_IF(!IsGLExtensionEnabled("GL_EXT_texture_sRGB_override"));
run(); run();
} }
TEST_P(TextureSamplingMutableFormatBenchmark, Run) TEST_P(TextureSamplingMutableFormatBenchmark, Run)
{ {
ANGLE_SKIP_TEST_IF(!IsGLExtensionEnabled("GL_EXT_texture_sRGB_override"));
run(); run();
} }
......
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