Commit e0a28ba4 by Alexis Hetu Committed by Commit Bot

Add blendable checks to GL_EXT_color_buffer_float

The GL_EXT_color_buffer_float spec https://www.khronos.org/registry/OpenGL/extensions/EXT/EXT_color_buffer_float.txt mentions that some of the formats must be blendable: "Blending applies only if the color buffer has a fixed-point or floating-point format. If the color buffer has an integer format, proceed to the next operation. Furthermore, an INVALID_OPERATION error is generated by DrawArrays and the other drawing commands defined in section 2.8.3 (10.5 in ES 3.1) if blending is enabled and any draw buffer has 32-bit floating-point format components." So any non 32-bit floating-point must be blendable. Bug: angleproject:4291 Change-Id: I850fb13b71e4ad03fd07e2a265896c9106bc0ce1 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2001478 Commit-Queue: Alexis Hétu <sugoi@chromium.org> Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org>
parent 920ef28a
...@@ -635,11 +635,21 @@ static bool DetermineColorBufferFloatRGBASupport(const TextureCapsMap &textureCa ...@@ -635,11 +635,21 @@ static bool DetermineColorBufferFloatRGBASupport(const TextureCapsMap &textureCa
// Check for GL_EXT_color_buffer_float // Check for GL_EXT_color_buffer_float
static bool DetermineColorBufferFloatSupport(const TextureCapsMap &textureCaps) static bool DetermineColorBufferFloatSupport(const TextureCapsMap &textureCaps)
{ {
constexpr GLenum requiredFormats[] = { constexpr GLenum nonBlendableFormats[] = {
GL_R16F, GL_RG16F, GL_RGBA16F, GL_R32F, GL_RG32F, GL_RGBA32F, GL_R11F_G11F_B10F, GL_R32F,
GL_RG32F,
GL_RGBA32F,
}; };
return GetFormatSupport(textureCaps, requiredFormats, true, false, true, true, false); constexpr GLenum blendableFormats[] = {
GL_R16F,
GL_RG16F,
GL_RGBA16F,
GL_R11F_G11F_B10F,
};
return GetFormatSupport(textureCaps, nonBlendableFormats, true, false, true, true, false) &&
GetFormatSupport(textureCaps, blendableFormats, true, false, true, true, true);
} }
// Check for GL_EXT_texture_norm16 // Check for GL_EXT_texture_norm16
......
...@@ -110,6 +110,7 @@ gl::TextureCaps GenerateTextureFormatCaps(gl::Version maxClientVersion, ...@@ -110,6 +110,7 @@ gl::TextureCaps GenerateTextureFormatCaps(gl::Version maxClientVersion,
(support.query(formatInfo.rtvFormat, D3D11_FORMAT_SUPPORT_RENDER_TARGET)) || (support.query(formatInfo.rtvFormat, D3D11_FORMAT_SUPPORT_RENDER_TARGET)) ||
(support.query(formatInfo.dsvFormat, D3D11_FORMAT_SUPPORT_DEPTH_STENCIL)); (support.query(formatInfo.dsvFormat, D3D11_FORMAT_SUPPORT_DEPTH_STENCIL));
textureCaps.renderbuffer = textureCaps.textureAttachment; textureCaps.renderbuffer = textureCaps.textureAttachment;
textureCaps.blendable = textureCaps.renderbuffer;
DXGI_FORMAT renderFormat = DXGI_FORMAT_UNKNOWN; DXGI_FORMAT renderFormat = DXGI_FORMAT_UNKNOWN;
if (formatInfo.dsvFormat != DXGI_FORMAT_UNKNOWN) if (formatInfo.dsvFormat != DXGI_FORMAT_UNKNOWN)
......
...@@ -459,6 +459,7 @@ static gl::TextureCaps GenerateTextureFormatCaps(GLenum internalFormat, ...@@ -459,6 +459,7 @@ static gl::TextureCaps GenerateTextureFormatCaps(GLenum internalFormat,
D3DRTYPE_TEXTURE, d3dFormatInfo.renderFormat)); D3DRTYPE_TEXTURE, d3dFormatInfo.renderFormat));
} }
textureCaps.renderbuffer = textureCaps.textureAttachment; textureCaps.renderbuffer = textureCaps.textureAttachment;
textureCaps.blendable = textureCaps.renderbuffer;
textureCaps.sampleCounts.insert(1); textureCaps.sampleCounts.insert(1);
for (unsigned int i = D3DMULTISAMPLE_2_SAMPLES; i <= D3DMULTISAMPLE_16_SAMPLES; i++) for (unsigned int i = D3DMULTISAMPLE_2_SAMPLES; i <= D3DMULTISAMPLE_16_SAMPLES; i++)
......
...@@ -255,6 +255,7 @@ static gl::TextureCaps GenerateTextureFormatCaps(const FunctionsGL *functions, ...@@ -255,6 +255,7 @@ static gl::TextureCaps GenerateTextureFormatCaps(const FunctionsGL *functions,
textureCaps.texturable && MeetsRequirements(functions, formatInfo.filter); textureCaps.texturable && MeetsRequirements(functions, formatInfo.filter);
textureCaps.textureAttachment = MeetsRequirements(functions, formatInfo.textureAttachment); textureCaps.textureAttachment = MeetsRequirements(functions, formatInfo.textureAttachment);
textureCaps.renderbuffer = MeetsRequirements(functions, formatInfo.renderbuffer); textureCaps.renderbuffer = MeetsRequirements(functions, formatInfo.renderbuffer);
textureCaps.blendable = textureCaps.renderbuffer || textureCaps.textureAttachment;
// Do extra renderability validation for some formats. // Do extra renderability validation for some formats.
// We require GL_RGBA16F is renderable to expose EXT_color_buffer_half_float but we can't know // We require GL_RGBA16F is renderable to expose EXT_color_buffer_half_float but we can't know
......
...@@ -32,6 +32,8 @@ void FillTextureFormatCaps(RendererVk *renderer, VkFormat format, gl::TextureCap ...@@ -32,6 +32,8 @@ void FillTextureFormatCaps(RendererVk *renderer, VkFormat format, gl::TextureCap
renderer->hasImageFormatFeatureBits(format, VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT); renderer->hasImageFormatFeatureBits(format, VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT);
outTextureCaps->filterable = renderer->hasImageFormatFeatureBits( outTextureCaps->filterable = renderer->hasImageFormatFeatureBits(
format, VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_LINEAR_BIT); format, VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_LINEAR_BIT);
outTextureCaps->blendable =
renderer->hasImageFormatFeatureBits(format, VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BLEND_BIT);
// For renderbuffer and texture attachments we require transfer and sampling for // For renderbuffer and texture attachments we require transfer and sampling for
// GLES 2.0 CopyTexImage support. Sampling is also required for other features like // GLES 2.0 CopyTexImage support. Sampling is also required for other features like
......
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