Commit b1e91380 by Jiawei Shao Committed by Commit Bot

ES31: Implement EXT_geometry_shader framebuffer default layers on OpenGL

This patch implements FRAMEBUFFER_DEFAULT_LAYERS_EXT as a legal framebuffer parameter required in OpenGL ES 3.1 extension EXT_geometry_shader on OpenGL back-ends. The query on FRAMEBUFFER_DEFAULT_LAYERS_EXT specifies the layer count used when the framebuffer has no attachments. BUG=angleproject:1941 TEST=dEQP-GLES31.functional.geometry_shading.query.framebuffer_default_layers Change-Id: I888465dfe23da53541ec2fedb8616027df532466 Reviewed-on: https://chromium-review.googlesource.com/1063560Reviewed-by: 's avatarJiajia Qin <jiajia.qin@intel.com> Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarCorentin Wallez <cwallez@chromium.org> Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
parent 9b1462a0
......@@ -89,6 +89,8 @@ ERRMSG(InvalidFormat, "Invalid format.");
ERRMSG(InvalidFramebufferTarget, "Invalid framebuffer target.");
ERRMSG(InvalidFramebufferTextureLevel, "Mipmap level must be 0 when attaching a texture.");
ERRMSG(InvalidFramebufferAttachmentParameter, "Invalid parameter name for framebuffer attachment.");
ERRMSG(InvalidFramebufferLayer,
"Framebuffer layer cannot be less than 0 or greater than GL_MAX_FRAMEBUFFER_LAYERS_EXT.");
ERRMSG(InvalidImageUnit,
"Image unit cannot be greater than or equal to the value of MAX_IMAGE_UNITS.");
ERRMSG(InvalidInternalFormat, "Invalid internal format.");
......
......@@ -261,6 +261,7 @@ FramebufferState::FramebufferState()
mDefaultHeight(0),
mDefaultSamples(0),
mDefaultFixedSampleLocations(GL_FALSE),
mDefaultLayers(0),
mWebGLDepthStencilConsistent(true)
{
ASSERT(mDrawBufferStates.size() > 0);
......@@ -277,6 +278,7 @@ FramebufferState::FramebufferState(const Caps &caps)
mDefaultHeight(0),
mDefaultSamples(0),
mDefaultFixedSampleLocations(GL_FALSE),
mDefaultLayers(0),
mWebGLDepthStencilConsistent(true)
{
ASSERT(mDrawBufferStates.size() > 0);
......@@ -1901,6 +1903,11 @@ bool Framebuffer::getDefaultFixedSampleLocations() const
return mState.getDefaultFixedSampleLocations();
}
GLint Framebuffer::getDefaultLayers() const
{
return mState.getDefaultLayers();
}
void Framebuffer::setDefaultWidth(GLint defaultWidth)
{
mState.mDefaultWidth = defaultWidth;
......@@ -1929,6 +1936,12 @@ void Framebuffer::setDefaultFixedSampleLocations(bool defaultFixedSampleLocation
invalidateCompletenessCache();
}
void Framebuffer::setDefaultLayers(GLint defaultLayers)
{
mState.mDefaultLayers = defaultLayers;
mDirtyBits.set(DIRTY_BIT_DEFAULT_LAYERS);
}
GLsizei Framebuffer::getNumViews() const
{
return mState.getNumViews();
......
......@@ -89,6 +89,7 @@ class FramebufferState final : angle::NonCopyable
GLint getDefaultHeight() const { return mDefaultHeight; };
GLint getDefaultSamples() const { return mDefaultSamples; };
bool getDefaultFixedSampleLocations() const { return mDefaultFixedSampleLocations; };
GLint getDefaultLayers() const { return mDefaultLayers; }
bool hasDepth() const;
bool hasStencil() const;
......@@ -120,6 +121,7 @@ class FramebufferState final : angle::NonCopyable
GLint mDefaultHeight;
GLint mDefaultSamples;
bool mDefaultFixedSampleLocations;
GLint mDefaultLayers;
// It's necessary to store all this extra state so we can restore attachments
// when DEPTH_STENCIL/DEPTH/STENCIL is unbound in WebGL 1.
......@@ -221,10 +223,12 @@ class Framebuffer final : public angle::ObserverInterface, public LabeledObject
GLint getDefaultHeight() const;
GLint getDefaultSamples() const;
bool getDefaultFixedSampleLocations() const;
GLint getDefaultLayers() const;
void setDefaultWidth(GLint defaultWidth);
void setDefaultHeight(GLint defaultHeight);
void setDefaultSamples(GLint defaultSamples);
void setDefaultFixedSampleLocations(bool defaultFixedSampleLocations);
void setDefaultLayers(GLint defaultLayers);
void invalidateCompletenessCache();
......@@ -293,6 +297,7 @@ class Framebuffer final : public angle::ObserverInterface, public LabeledObject
DIRTY_BIT_DEFAULT_HEIGHT,
DIRTY_BIT_DEFAULT_SAMPLES,
DIRTY_BIT_DEFAULT_FIXED_SAMPLE_LOCATIONS,
DIRTY_BIT_DEFAULT_LAYERS,
DIRTY_BIT_UNKNOWN,
DIRTY_BIT_MAX = DIRTY_BIT_UNKNOWN
};
......
......@@ -1268,6 +1268,9 @@ void QueryFramebufferParameteriv(const Framebuffer *framebuffer, GLenum pname, G
case GL_FRAMEBUFFER_DEFAULT_FIXED_SAMPLE_LOCATIONS:
*params = ConvertToGLBoolean(framebuffer->getDefaultFixedSampleLocations());
break;
case GL_FRAMEBUFFER_DEFAULT_LAYERS_EXT:
*params = framebuffer->getDefaultLayers();
break;
default:
UNREACHABLE();
break;
......@@ -1374,6 +1377,9 @@ void SetFramebufferParameteri(Framebuffer *framebuffer, GLenum pname, GLint para
case GL_FRAMEBUFFER_DEFAULT_FIXED_SAMPLE_LOCATIONS:
framebuffer->setDefaultFixedSampleLocations(ConvertToBool(param));
break;
case GL_FRAMEBUFFER_DEFAULT_LAYERS_EXT:
framebuffer->setDefaultLayers(param);
break;
default:
UNREACHABLE();
break;
......
......@@ -689,6 +689,10 @@ gl::Error FramebufferGL::syncState(const gl::Context *context,
GL_FRAMEBUFFER, GL_FRAMEBUFFER_DEFAULT_FIXED_SAMPLE_LOCATIONS,
gl::ConvertToGLBoolean(mState.getDefaultFixedSampleLocations()));
break;
case Framebuffer::DIRTY_BIT_DEFAULT_LAYERS:
functions->framebufferParameteri(GL_FRAMEBUFFER, GL_FRAMEBUFFER_DEFAULT_LAYERS_EXT,
mState.getDefaultLayers());
break;
default:
{
ASSERT(Framebuffer::DIRTY_BIT_COLOR_ATTACHMENT_0 == 0 &&
......
......@@ -1176,6 +1176,21 @@ bool ValidateFramebufferParameteri(Context *context, GLenum target, GLenum pname
{
break;
}
case GL_FRAMEBUFFER_DEFAULT_LAYERS_EXT:
{
if (!context->getExtensions().geometryShader)
{
ANGLE_VALIDATION_ERR(context, InvalidEnum(), GeometryShaderExtensionNotEnabled);
return false;
}
GLint maxLayers = context->getCaps().maxFramebufferLayers;
if (param < 0 || param > maxLayers)
{
ANGLE_VALIDATION_ERR(context, InvalidValue(), InvalidFramebufferLayer);
return false;
}
break;
}
default:
{
ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidPname);
......@@ -1214,6 +1229,13 @@ bool ValidateGetFramebufferParameteriv(Context *context, GLenum target, GLenum p
case GL_FRAMEBUFFER_DEFAULT_SAMPLES:
case GL_FRAMEBUFFER_DEFAULT_FIXED_SAMPLE_LOCATIONS:
break;
case GL_FRAMEBUFFER_DEFAULT_LAYERS_EXT:
if (!context->getExtensions().geometryShader)
{
ANGLE_VALIDATION_ERR(context, InvalidEnum(), GeometryShaderExtensionNotEnabled);
return false;
}
break;
default:
ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidPname);
return false;
......
......@@ -49,7 +49,8 @@
1442 OPENGL D3D11 : dEQP-GLES31.functional.image_load_store.* = SKIP
// TODO(jiawei.shao@intel.com): Implement FramebufferTextureEXT entry point defined in OpenGL ES 3.1 extension GL_EXT_geometry_shader
1941 OPENGL D3D11 : dEQP-GLES31.functional.geometry_shading.query.framebuffer_* = SKIP
1941 OPENGL D3D11 : dEQP-GLES31.functional.geometry_shading.query.framebuffer_attachment_layered = SKIP
1941 OPENGL D3D11 : dEQP-GLES31.functional.geometry_shading.query.framebuffer_incomplete_layer_targets = SKIP
1941 OPENGL D3D11 : dEQP-GLES31.functional.geometry_shading.layered.* = SKIP
1941 OPENGL D3D11 : dEQP-GLES31.functional.geometry_shading.instanced.invocation_per_layer_* = SKIP
1941 OPENGL D3D11 : dEQP-GLES31.functional.geometry_shading.instanced.multiple_layers_per_invocation_* = SKIP
......
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