Commit ddb99f21 by Alexis Hetu Committed by Commit Bot

Support blendable capability

Vulkan distinguishes between a texture format that can be used as a render target (VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT) and one that supports blending (VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BLEND_BIT). This cl adds a blendable capability and sets it based on the appropriate bit. It also adds the check in GetFormatSupportBase(), but all uses of it are currently set to false. In terms of behavior, this cl should be noop. Bug: angleproject:4291 Change-Id: Ib151ac8ab7b69311b7fdef15ad87186d13e3ed78 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1999494 Commit-Queue: Alexis Hétu <sugoi@chromium.org> Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org>
parent 50a69a14
......@@ -159,7 +159,8 @@ static bool GetFormatSupportBase(const TextureCapsMap &textureCaps,
bool requiresTexturing,
bool requiresFiltering,
bool requiresAttachingTexture,
bool requiresRenderbufferSupport)
bool requiresRenderbufferSupport,
bool requiresBlending)
{
for (size_t i = 0; i < requiredFormatsSize; i++)
{
......@@ -184,6 +185,11 @@ static bool GetFormatSupportBase(const TextureCapsMap &textureCaps,
{
return false;
}
if (requiresBlending && !cap.blendable)
{
return false;
}
}
return true;
......@@ -195,11 +201,12 @@ static bool GetFormatSupport(const TextureCapsMap &textureCaps,
bool requiresTexturing,
bool requiresFiltering,
bool requiresAttachingTexture,
bool requiresRenderbufferSupport)
bool requiresRenderbufferSupport,
bool requiresBlending)
{
return GetFormatSupportBase(textureCaps, requiredFormats, N, requiresTexturing,
requiresFiltering, requiresAttachingTexture,
requiresRenderbufferSupport);
requiresRenderbufferSupport, requiresBlending);
}
// Check for GL_OES_packed_depth_stencil
......@@ -209,7 +216,7 @@ static bool DeterminePackedDepthStencilSupport(const TextureCapsMap &textureCaps
GL_DEPTH24_STENCIL8,
};
return GetFormatSupport(textureCaps, requiredFormats, false, false, true, true);
return GetFormatSupport(textureCaps, requiredFormats, false, false, true, true, false);
}
// Checks for GL_OES_rgb8_rgba8 support
......@@ -220,7 +227,7 @@ static bool DetermineRGB8AndRGBA8TextureSupport(const TextureCapsMap &textureCap
GL_RGBA8,
};
return GetFormatSupport(textureCaps, requiredFormats, false, false, false, true);
return GetFormatSupport(textureCaps, requiredFormats, false, false, false, true, false);
}
// Checks for GL_EXT_texture_format_BGRA8888 support
......@@ -230,7 +237,7 @@ static bool DetermineBGRA8TextureSupport(const TextureCapsMap &textureCaps)
GL_BGRA8_EXT,
};
return GetFormatSupport(textureCaps, requiredFormats, true, true, true, true);
return GetFormatSupport(textureCaps, requiredFormats, true, true, true, true, false);
}
// Checks for GL_OES_color_buffer_half_float support
......@@ -243,7 +250,7 @@ static bool DetermineColorBufferHalfFloatSupport(const TextureCapsMap &textureCa
GL_RGBA16F,
};
return GetFormatSupport(textureCaps, requiredFormats, false, false, true, true);
return GetFormatSupport(textureCaps, requiredFormats, false, false, true, true, false);
}
// Checks for GL_OES_texture_half_float support
......@@ -253,7 +260,7 @@ static bool DetermineHalfFloatTextureSupport(const TextureCapsMap &textureCaps)
GL_RGBA16F, GL_RGB16F, GL_LUMINANCE_ALPHA16F_EXT, GL_LUMINANCE16F_EXT, GL_ALPHA16F_EXT,
};
return GetFormatSupport(textureCaps, requiredFormats, true, false, false, false);
return GetFormatSupport(textureCaps, requiredFormats, true, false, false, false, false);
}
// Checks for GL_OES_texture_half_float_linear support
......@@ -267,12 +274,12 @@ static bool DetermineHalfFloatTextureFilteringSupport(const TextureCapsMap &text
GL_ALPHA16F_EXT};
if (checkLegacyFormats &&
!GetFormatSupport(textureCaps, requiredFormatsES2, false, true, false, false))
!GetFormatSupport(textureCaps, requiredFormatsES2, false, true, false, false, false))
{
return false;
}
return GetFormatSupport(textureCaps, requiredFormats, false, true, false, false);
return GetFormatSupport(textureCaps, requiredFormats, false, true, false, false, false);
}
// Checks for GL_OES_texture_float support
......@@ -282,7 +289,7 @@ static bool DetermineFloatTextureSupport(const TextureCapsMap &textureCaps)
GL_RGBA32F, GL_RGB32F, GL_LUMINANCE_ALPHA32F_EXT, GL_LUMINANCE32F_EXT, GL_ALPHA32F_EXT,
};
return GetFormatSupport(textureCaps, requiredFormats, true, false, false, false);
return GetFormatSupport(textureCaps, requiredFormats, true, false, false, false, false);
}
// Checks for GL_OES_texture_float_linear support
......@@ -302,12 +309,12 @@ static bool DetermineFloatTextureFilteringSupport(const TextureCapsMap &textureC
};
if (checkLegacyFormats &&
!GetFormatSupport(textureCaps, requiredFormatsES2, false, true, false, false))
!GetFormatSupport(textureCaps, requiredFormatsES2, false, true, false, false, false))
{
return false;
}
return GetFormatSupport(textureCaps, requiredFormats, false, true, false, false);
return GetFormatSupport(textureCaps, requiredFormats, false, true, false, false, false);
}
// Checks for GL_EXT_texture_rg support
......@@ -329,18 +336,18 @@ static bool DetermineRGTextureSupport(const TextureCapsMap &textureCaps,
};
if (checkHalfFloatFormats &&
!GetFormatSupport(textureCaps, requiredHalfFloatFormats, true, false, false, false))
!GetFormatSupport(textureCaps, requiredHalfFloatFormats, true, false, false, false, false))
{
return false;
}
if (checkFloatFormats &&
!GetFormatSupport(textureCaps, requiredFloatFormats, true, false, false, false))
!GetFormatSupport(textureCaps, requiredFloatFormats, true, false, false, false, false))
{
return false;
}
return GetFormatSupport(textureCaps, requiredFormats, true, true, true, true);
return GetFormatSupport(textureCaps, requiredFormats, true, true, true, true, false);
}
// Check for GL_EXT_texture_compression_dxt1
......@@ -351,7 +358,7 @@ static bool DetermineDXT1TextureSupport(const TextureCapsMap &textureCaps)
GL_COMPRESSED_RGBA_S3TC_DXT1_EXT,
};
return GetFormatSupport(textureCaps, requiredFormats, true, true, false, false);
return GetFormatSupport(textureCaps, requiredFormats, true, true, false, false, false);
}
// Check for GL_ANGLE_texture_compression_dxt3
......@@ -361,7 +368,7 @@ static bool DetermineDXT3TextureSupport(const TextureCapsMap &textureCaps)
GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE,
};
return GetFormatSupport(textureCaps, requiredFormats, true, true, false, false);
return GetFormatSupport(textureCaps, requiredFormats, true, true, false, false, false);
}
// Check for GL_ANGLE_texture_compression_dxt5
......@@ -371,7 +378,7 @@ static bool DetermineDXT5TextureSupport(const TextureCapsMap &textureCaps)
GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE,
};
return GetFormatSupport(textureCaps, requiredFormats, true, true, false, false);
return GetFormatSupport(textureCaps, requiredFormats, true, true, false, false, false);
}
// Check for GL_EXT_texture_compression_s3tc_srgb
......@@ -384,7 +391,7 @@ static bool DetermineS3TCsRGBTextureSupport(const TextureCapsMap &textureCaps)
GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT,
};
return GetFormatSupport(textureCaps, requiredFormats, true, true, false, false);
return GetFormatSupport(textureCaps, requiredFormats, true, true, false, false, false);
}
// Check for GL_KHR_texture_compression_astc_ldr
......@@ -407,7 +414,7 @@ static bool DetermineASTCLDRTextureSupport(const TextureCapsMap &textureCaps)
GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR,
};
return GetFormatSupport(textureCaps, requiredFormats, true, true, false, false);
return GetFormatSupport(textureCaps, requiredFormats, true, true, false, false, false);
}
// Check for GL_OES_texture_compression_astc
......@@ -432,7 +439,7 @@ static bool DetermineASTCOESTExtureSupport(const TextureCapsMap &textureCaps)
GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6x5_OES, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6x6_OES,
};
return GetFormatSupport(textureCaps, requiredFormats, true, true, false, false);
return GetFormatSupport(textureCaps, requiredFormats, true, true, false, false, false);
}
// Check for GL_ETC1_RGB8_OES
......@@ -442,7 +449,7 @@ static bool DetermineETC1RGB8TextureSupport(const TextureCapsMap &textureCaps)
GL_ETC1_RGB8_OES,
};
return GetFormatSupport(textureCaps, requiredFormats, true, true, false, false);
return GetFormatSupport(textureCaps, requiredFormats, true, true, false, false, false);
}
// Check for OES_compressed_ETC2_RGB8_texture
......@@ -452,7 +459,7 @@ static bool DetermineETC2RGB8TextureSupport(const TextureCapsMap &textureCaps)
GL_COMPRESSED_RGB8_ETC2,
};
return GetFormatSupport(textureCaps, requiredFormats, true, true, false, false);
return GetFormatSupport(textureCaps, requiredFormats, true, true, false, false, false);
}
// Check for OES_compressed_ETC2_sRGB8_texture
......@@ -462,7 +469,7 @@ static bool DetermineETC2sRGB8TextureSupport(const TextureCapsMap &textureCaps)
GL_COMPRESSED_SRGB8_ETC2,
};
return GetFormatSupport(textureCaps, requiredFormats, true, true, false, false);
return GetFormatSupport(textureCaps, requiredFormats, true, true, false, false, false);
}
// Check for OES_compressed_ETC2_punchthroughA_RGBA8_texture
......@@ -472,7 +479,7 @@ static bool DetermineETC2PunchthroughARGB8TextureSupport(const TextureCapsMap &t
GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2,
};
return GetFormatSupport(textureCaps, requiredFormats, true, true, false, false);
return GetFormatSupport(textureCaps, requiredFormats, true, true, false, false, false);
}
// Check for OES_compressed_ETC2_punchthroughA_sRGB8_alpha_texture
......@@ -482,7 +489,7 @@ static bool DetermineETC2PunchthroughAsRGB8AlphaTextureSupport(const TextureCaps
GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2,
};
return GetFormatSupport(textureCaps, requiredFormats, true, true, false, false);
return GetFormatSupport(textureCaps, requiredFormats, true, true, false, false, false);
}
// Check for OES_compressed_ETC2_RGBA8_texture
......@@ -492,7 +499,7 @@ static bool DetermineETC2RGBA8TextureSupport(const TextureCapsMap &textureCaps)
GL_COMPRESSED_RGBA8_ETC2_EAC,
};
return GetFormatSupport(textureCaps, requiredFormats, true, true, false, false);
return GetFormatSupport(textureCaps, requiredFormats, true, true, false, false, false);
}
// Check for OES_compressed_ETC2_sRGB8_alpha8_texture
......@@ -502,7 +509,7 @@ static bool DetermineETC2sRGB8Alpha8TextureSupport(const TextureCapsMap &texture
GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC,
};
return GetFormatSupport(textureCaps, requiredFormats, true, true, false, false);
return GetFormatSupport(textureCaps, requiredFormats, true, true, false, false, false);
}
// Check for OES_compressed_EAC_R11_unsigned_texture
......@@ -512,7 +519,7 @@ static bool DetermineEACR11UnsignedTextureSupport(const TextureCapsMap &textureC
GL_COMPRESSED_R11_EAC,
};
return GetFormatSupport(textureCaps, requiredFormats, true, true, false, false);
return GetFormatSupport(textureCaps, requiredFormats, true, true, false, false, false);
}
// Check for OES_compressed_EAC_R11_signed_texture
......@@ -522,7 +529,7 @@ static bool DetermineEACR11SignedTextureSupport(const TextureCapsMap &textureCap
GL_COMPRESSED_SIGNED_R11_EAC,
};
return GetFormatSupport(textureCaps, requiredFormats, true, true, false, false);
return GetFormatSupport(textureCaps, requiredFormats, true, true, false, false, false);
}
// Check for OES_compressed_EAC_RG11_unsigned_texture
......@@ -532,7 +539,7 @@ static bool DetermineEACRG11UnsignedTextureSupport(const TextureCapsMap &texture
GL_COMPRESSED_RG11_EAC,
};
return GetFormatSupport(textureCaps, requiredFormats, true, true, false, false);
return GetFormatSupport(textureCaps, requiredFormats, true, true, false, false, false);
}
// Check for OES_compressed_EAC_RG11_signed_texture
......@@ -542,7 +549,7 @@ static bool DetermineEACRG11SignedTextureSupport(const TextureCapsMap &textureCa
GL_COMPRESSED_SIGNED_RG11_EAC,
};
return GetFormatSupport(textureCaps, requiredFormats, true, true, false, false);
return GetFormatSupport(textureCaps, requiredFormats, true, true, false, false, false);
}
// Check for GL_EXT_sRGB
......@@ -557,8 +564,8 @@ static bool DetermineSRGBTextureSupport(const TextureCapsMap &textureCaps)
GL_SRGB8_ALPHA8,
};
return GetFormatSupport(textureCaps, requiredFilterFormats, true, true, false, false) &&
GetFormatSupport(textureCaps, requiredRenderFormats, true, false, true, true);
return GetFormatSupport(textureCaps, requiredFilterFormats, true, true, false, false, false) &&
GetFormatSupport(textureCaps, requiredRenderFormats, true, false, true, true, false);
}
// Check for GL_ANGLE_depth_texture
......@@ -570,7 +577,7 @@ static bool DetermineDepthTextureANGLESupport(const TextureCapsMap &textureCaps)
GL_DEPTH24_STENCIL8_OES,
};
return GetFormatSupport(textureCaps, requiredFormats, true, true, true, true);
return GetFormatSupport(textureCaps, requiredFormats, true, true, true, true, false);
}
// Check for GL_OES_depth_texture
......@@ -581,7 +588,7 @@ static bool DetermineDepthTextureOESSupport(const TextureCapsMap &textureCaps)
GL_DEPTH_COMPONENT32_OES,
};
return GetFormatSupport(textureCaps, requiredFormats, true, true, true, true);
return GetFormatSupport(textureCaps, requiredFormats, true, true, true, true, false);
}
// Check for GL_OES_depth24
......@@ -591,7 +598,7 @@ static bool DetermineDepth24OESSupport(const TextureCapsMap &textureCaps)
GL_DEPTH_COMPONENT24_OES,
};
return GetFormatSupport(textureCaps, requiredFormats, false, false, false, true);
return GetFormatSupport(textureCaps, requiredFormats, false, false, false, true, false);
}
// Check for GL_OES_depth32
......@@ -601,7 +608,7 @@ static bool DetermineDepth32Support(const TextureCapsMap &textureCaps)
GL_DEPTH_COMPONENT32_OES,
};
return GetFormatSupport(textureCaps, requiredFormats, false, false, true, true);
return GetFormatSupport(textureCaps, requiredFormats, false, false, true, true, false);
}
// Check for GL_CHROMIUM_color_buffer_float_rgb
......@@ -611,7 +618,7 @@ static bool DetermineColorBufferFloatRGBSupport(const TextureCapsMap &textureCap
GL_RGB32F,
};
return GetFormatSupport(textureCaps, requiredFormats, true, false, true, false);
return GetFormatSupport(textureCaps, requiredFormats, true, false, true, false, false);
}
// Check for GL_CHROMIUM_color_buffer_float_rgba
......@@ -621,7 +628,7 @@ static bool DetermineColorBufferFloatRGBASupport(const TextureCapsMap &textureCa
GL_RGBA32F,
};
return GetFormatSupport(textureCaps, requiredFormats, true, false, true, true);
return GetFormatSupport(textureCaps, requiredFormats, true, false, true, true, false);
}
// Check for GL_EXT_color_buffer_float
......@@ -631,7 +638,7 @@ static bool DetermineColorBufferFloatSupport(const TextureCapsMap &textureCaps)
GL_R16F, GL_RG16F, GL_RGBA16F, GL_R32F, GL_RG32F, GL_RGBA32F, GL_R11F_G11F_B10F,
};
return GetFormatSupport(textureCaps, requiredFormats, true, false, true, true);
return GetFormatSupport(textureCaps, requiredFormats, true, false, true, true, false);
}
// Check for GL_EXT_texture_norm16
......@@ -648,8 +655,8 @@ static bool DetermineTextureNorm16Support(const TextureCapsMap &textureCaps)
GL_RGBA16_EXT,
};
return GetFormatSupport(textureCaps, requiredFilterFormats, true, true, false, false) &&
GetFormatSupport(textureCaps, requiredRenderFormats, true, false, true, true);
return GetFormatSupport(textureCaps, requiredFilterFormats, true, true, false, false, false) &&
GetFormatSupport(textureCaps, requiredRenderFormats, true, false, true, true, false);
}
// Check for EXT_texture_compression_bptc
......@@ -659,7 +666,7 @@ static bool DetermineBPTCTextureSupport(const TextureCapsMap &textureCaps)
GL_COMPRESSED_RGBA_BPTC_UNORM_EXT, GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT,
GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT, GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT};
return GetFormatSupport(textureCaps, requiredFormats, true, true, false, false);
return GetFormatSupport(textureCaps, requiredFormats, true, true, false, false, false);
}
// Check for GL_IMG_texture_compression_pvrtc
......@@ -669,7 +676,7 @@ static bool DeterminePVRTCTextureSupport(const TextureCapsMap &textureCaps)
GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG, GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG,
GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG, GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG};
return GetFormatSupport(textureCaps, requiredFormats, true, true, false, false);
return GetFormatSupport(textureCaps, requiredFormats, true, true, false, false, false);
}
// Check for GL_EXT_pvrtc_sRGB
......@@ -679,7 +686,7 @@ static bool DeterminePVRTCsRGBTextureSupport(const TextureCapsMap &textureCaps)
GL_COMPRESSED_SRGB_PVRTC_2BPPV1_EXT, GL_COMPRESSED_SRGB_PVRTC_4BPPV1_EXT,
GL_COMPRESSED_SRGB_ALPHA_PVRTC_2BPPV1_EXT, GL_COMPRESSED_SRGB_ALPHA_PVRTC_4BPPV1_EXT};
return GetFormatSupport(textureCaps, requiredFormats, true, true, false, false);
return GetFormatSupport(textureCaps, requiredFormats, true, true, false, false, false);
}
bool DetermineCompressedTextureETCSupport(const TextureCapsMap &textureCaps)
......@@ -695,7 +702,7 @@ bool DetermineCompressedTextureETCSupport(const TextureCapsMap &textureCaps)
GL_COMPRESSED_RGBA8_ETC2_EAC,
GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC};
return GetFormatSupport(textureCaps, requiredFormats, true, true, false, false);
return GetFormatSupport(textureCaps, requiredFormats, true, true, false, false, false);
}
void Extensions::setTextureExtensionSupport(const TextureCapsMap &textureCaps)
......
......@@ -41,6 +41,9 @@ struct TextureCaps
// Support for being used as a renderbuffer format, i.e. glFramebufferRenderbuffer
bool renderbuffer = false;
// Support for blend modes while being used as a framebuffer attachment
bool blendable = false;
// Set of supported sample counts, only guaranteed to be valid in ES3.
SupportedSampleSet sampleCounts;
......
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