Commit fccebffe by Jiawei Shao Committed by Commit Bot

ES31: Support adjacency draw modes for geometry shader

This patch implements adjacency primitive types as new draw modes on OpenGL back-ends. This patch also implements validations on the compatibilities among draw modes and geometry shader input primitive types. BUG=angleproject:1941 TEST=dEQP-GLES31.functional.geometry_shading.input.* dEQP-GLES31.functional.geometry_shading.negative.* Change-Id: I373ebfe88d7f50da3cc81adaf2d1b7f586b0932a Reviewed-on: https://chromium-review.googlesource.com/954715 Commit-Queue: Corentin Wallez <cwallez@chromium.org> Reviewed-by: 's avatarCorentin Wallez <cwallez@chromium.org>
parent 690c8eb7
...@@ -45,6 +45,9 @@ ERRMSG(FeedbackLoop, "Feedback loop formed between Framebuffer and active Textur ...@@ -45,6 +45,9 @@ ERRMSG(FeedbackLoop, "Feedback loop formed between Framebuffer and active Textur
ERRMSG(FramebufferIncompleteAttachment, ERRMSG(FramebufferIncompleteAttachment,
"Attachment type must be compatible with attachment object."); "Attachment type must be compatible with attachment object.");
ERRMSG(GenerateMipmapNotAllowed, "Texture format does not support mipmap generation."); ERRMSG(GenerateMipmapNotAllowed, "Texture format does not support mipmap generation.");
ERRMSG(GeometryShaderExtensionNotEnabled, "GL_EXT_geometry_shader extension not enabled.");
ERRMSG(IncompatibleDrawModeAgainstGeometryShader,
"Primitive mode is incompatible with the input primitive type of the geometry shader.");
ERRMSG(IndexExceedsMaxActiveUniform, "Index exceeds program active uniform count."); ERRMSG(IndexExceedsMaxActiveUniform, "Index exceeds program active uniform count.");
ERRMSG(IndexExceedsMaxDrawBuffer, "Index exceeds MAX_DRAW_BUFFERS."); ERRMSG(IndexExceedsMaxDrawBuffer, "Index exceeds MAX_DRAW_BUFFERS.");
ERRMSG(IndexExceedsMaxVertexAttribute, "Index exceeds MAX_VERTEX_ATTRIBS."); ERRMSG(IndexExceedsMaxVertexAttribute, "Index exceeds MAX_VERTEX_ATTRIBS.");
......
...@@ -660,6 +660,11 @@ class Program final : angle::NonCopyable, public LabeledObject ...@@ -660,6 +660,11 @@ class Program final : angle::NonCopyable, public LabeledObject
return mState.mComputeShaderLocalSize; return mState.mComputeShaderLocalSize;
} }
GLenum getGeometryShaderInputPrimitiveType() const
{
return mState.mGeometryShaderInputPrimitiveType;
}
const ProgramState &getState() const { return mState; } const ProgramState &getState() const { return mState; }
static LinkMismatchError LinkValidateVariablesBase( static LinkMismatchError LinkValidateVariablesBase(
......
...@@ -497,6 +497,30 @@ bool ValidateVertexShaderAttributeTypeMatch(Context *context) ...@@ -497,6 +497,30 @@ bool ValidateVertexShaderAttributeTypeMatch(Context *context)
return true; return true;
} }
bool IsCompatibleDrawModeWithGeometryShader(GLenum drawMode,
GLenum geometryShaderInputPrimitiveType)
{
// [EXT_geometry_shader] Section 11.1gs.1, Geometry Shader Input Primitives
switch (geometryShaderInputPrimitiveType)
{
case GL_POINTS:
return drawMode == GL_POINTS;
case GL_LINES:
return drawMode == GL_LINES || drawMode == GL_LINE_STRIP || drawMode == GL_LINE_LOOP;
case GL_LINES_ADJACENCY_EXT:
return drawMode == GL_LINES_ADJACENCY_EXT || drawMode == GL_LINE_STRIP_ADJACENCY_EXT;
case GL_TRIANGLES:
return drawMode == GL_TRIANGLES || drawMode == GL_TRIANGLE_FAN ||
drawMode == GL_TRIANGLE_STRIP;
case GL_TRIANGLES_ADJACENCY_EXT:
return drawMode == GL_TRIANGLES_ADJACENCY_EXT ||
drawMode == GL_TRIANGLE_STRIP_ADJACENCY_EXT;
default:
UNREACHABLE();
return false;
}
}
} // anonymous namespace } // anonymous namespace
bool IsETC2EACFormat(const GLenum format) bool IsETC2EACFormat(const GLenum format)
...@@ -2434,6 +2458,8 @@ bool ValidateCopyTexImageParametersBase(Context *context, ...@@ -2434,6 +2458,8 @@ bool ValidateCopyTexImageParametersBase(Context *context,
bool ValidateDrawBase(Context *context, GLenum mode, GLsizei count) bool ValidateDrawBase(Context *context, GLenum mode, GLsizei count)
{ {
const Extensions &extensions = context->getExtensions();
switch (mode) switch (mode)
{ {
case GL_POINTS: case GL_POINTS:
...@@ -2444,6 +2470,17 @@ bool ValidateDrawBase(Context *context, GLenum mode, GLsizei count) ...@@ -2444,6 +2470,17 @@ bool ValidateDrawBase(Context *context, GLenum mode, GLsizei count)
case GL_TRIANGLE_STRIP: case GL_TRIANGLE_STRIP:
case GL_TRIANGLE_FAN: case GL_TRIANGLE_FAN:
break; break;
case GL_LINES_ADJACENCY_EXT:
case GL_LINE_STRIP_ADJACENCY_EXT:
case GL_TRIANGLES_ADJACENCY_EXT:
case GL_TRIANGLE_STRIP_ADJACENCY_EXT:
if (!extensions.geometryShader)
{
ANGLE_VALIDATION_ERR(context, InvalidEnum(), GeometryShaderExtensionNotEnabled);
return false;
}
break;
default: default:
ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidDrawMode); ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidDrawMode);
return false; return false;
...@@ -2457,8 +2494,6 @@ bool ValidateDrawBase(Context *context, GLenum mode, GLsizei count) ...@@ -2457,8 +2494,6 @@ bool ValidateDrawBase(Context *context, GLenum mode, GLsizei count)
const State &state = context->getGLState(); const State &state = context->getGLState();
const Extensions &extensions = context->getExtensions();
// WebGL buffers cannot be mapped/unmapped because the MapBufferRange, FlushMappedBufferRange, // WebGL buffers cannot be mapped/unmapped because the MapBufferRange, FlushMappedBufferRange,
// and UnmapBuffer entry points are removed from the WebGL 2.0 API. // and UnmapBuffer entry points are removed from the WebGL 2.0 API.
// https://www.khronos.org/registry/webgl/specs/latest/2.0/#5.14 // https://www.khronos.org/registry/webgl/specs/latest/2.0/#5.14
...@@ -2565,6 +2600,18 @@ bool ValidateDrawBase(Context *context, GLenum mode, GLsizei count) ...@@ -2565,6 +2600,18 @@ bool ValidateDrawBase(Context *context, GLenum mode, GLsizei count)
} }
} }
// Do geometry shader specific validations
if (program->hasLinkedGeometryShader())
{
if (!IsCompatibleDrawModeWithGeometryShader(mode,
program->getGeometryShaderInputPrimitiveType()))
{
ANGLE_VALIDATION_ERR(context, InvalidOperation(),
IncompatibleDrawModeAgainstGeometryShader);
return false;
}
}
// Uniform buffer validation // Uniform buffer validation
for (unsigned int uniformBlockIndex = 0; for (unsigned int uniformBlockIndex = 0;
uniformBlockIndex < program->getActiveUniformBlockCount(); uniformBlockIndex++) uniformBlockIndex < program->getActiveUniformBlockCount(); uniformBlockIndex++)
......
...@@ -1573,6 +1573,8 @@ ...@@ -1573,6 +1573,8 @@
1941 D3D11 : dEQP-GLES31.functional.geometry_shading.instanced.geometry_* = FAIL 1941 D3D11 : dEQP-GLES31.functional.geometry_shading.instanced.geometry_* = FAIL
1941 D3D11 : dEQP-GLES31.functional.geometry_shading.instanced.invocation_output_* = FAIL 1941 D3D11 : dEQP-GLES31.functional.geometry_shading.instanced.invocation_output_* = FAIL
1941 D3D11 : dEQP-GLES31.functional.geometry_shading.instanced.draw_* = FAIL 1941 D3D11 : dEQP-GLES31.functional.geometry_shading.instanced.draw_* = FAIL
1941 D3D11 : dEQP-GLES31.functional.geometry_shading.input.* = FAIL
1941 D3D11 : dEQP-GLES31.functional.geometry_shading.negative.* = FAIL
1941 D3D11 : dEQP-GLES31.functional.shaders.linkage.es31.geometry.* = FAIL 1941 D3D11 : dEQP-GLES31.functional.shaders.linkage.es31.geometry.* = FAIL
1941 D3D11 : dEQP-GLES31.functional.debug.negative_coverage.callbacks.shader_directive.geometry_shader = FAIL 1941 D3D11 : dEQP-GLES31.functional.debug.negative_coverage.callbacks.shader_directive.geometry_shader = FAIL
1941 D3D11 : dEQP-GLES31.functional.debug.negative_coverage.log.shader_directive.geometry_shader = FAIL 1941 D3D11 : dEQP-GLES31.functional.debug.negative_coverage.log.shader_directive.geometry_shader = FAIL
...@@ -1641,8 +1643,6 @@ ...@@ -1641,8 +1643,6 @@
1941 OPENGL D3D11 : dEQP-GLES31.functional.state_query.program.geometry_shader_state_get_programiv = FAIL 1941 OPENGL D3D11 : dEQP-GLES31.functional.state_query.program.geometry_shader_state_get_programiv = FAIL
1941 OPENGL D3D11 : dEQP-GLES31.functional.geometry_shading.query.* = FAIL 1941 OPENGL D3D11 : dEQP-GLES31.functional.geometry_shading.query.* = FAIL
1941 OPENGL D3D11 : dEQP-GLES31.functional.geometry_shading.input.* = FAIL
1941 OPENGL D3D11 : dEQP-GLES31.functional.geometry_shading.negative.* = FAIL
2324 DEBUG RELEASE : dEQP-GLES31.functional.debug.negative_coverage.callbacks.compute.program_not_active = FAIL 2324 DEBUG RELEASE : dEQP-GLES31.functional.debug.negative_coverage.callbacks.compute.program_not_active = FAIL
2324 DEBUG RELEASE : dEQP-GLES31.functional.debug.negative_coverage.log.compute.program_not_active = FAIL 2324 DEBUG RELEASE : dEQP-GLES31.functional.debug.negative_coverage.log.compute.program_not_active = FAIL
......
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