Commit 2dae09e8 by Shahbaz Youssefi Committed by Commit Bot

Fix draw mode validation of PPOs with geometry/tessellation

The properties related to geometry and tessellation shaders were not being copied from the Program's exectuble to the Program Pipeline's. Bug: angleproject:5557 Bug: angleproject:5579 Change-Id: Ied6ff82c7e30f24504c9a3f5c008181b179b07ff Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2653909Reviewed-by: 's avatarTim Van Patten <timvp@google.com> Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
parent ddba70da
...@@ -323,6 +323,46 @@ void ProgramPipeline::updateImageBindings() ...@@ -323,6 +323,46 @@ void ProgramPipeline::updateImageBindings()
} }
} }
void ProgramPipeline::updateExecutableGeometryProperties()
{
Program *geometryProgram = getShaderProgram(gl::ShaderType::Geometry);
if (!geometryProgram)
{
return;
}
const ProgramExecutable &geometryExecutable = geometryProgram->getExecutable();
mState.mExecutable->mGeometryShaderInputPrimitiveType =
geometryExecutable.mGeometryShaderInputPrimitiveType;
mState.mExecutable->mGeometryShaderOutputPrimitiveType =
geometryExecutable.mGeometryShaderOutputPrimitiveType;
mState.mExecutable->mGeometryShaderInvocations = geometryExecutable.mGeometryShaderInvocations;
mState.mExecutable->mGeometryShaderMaxVertices = geometryExecutable.mGeometryShaderMaxVertices;
}
void ProgramPipeline::updateExecutableTessellationProperties()
{
Program *tessControlProgram = getShaderProgram(gl::ShaderType::TessControl);
Program *tessEvalProgram = getShaderProgram(gl::ShaderType::TessEvaluation);
if (tessControlProgram)
{
const ProgramExecutable &tessControlExecutable = tessControlProgram->getExecutable();
mState.mExecutable->mTessControlShaderVertices =
tessControlExecutable.mTessControlShaderVertices;
}
if (tessEvalProgram)
{
const ProgramExecutable &tessEvalExecutable = tessEvalProgram->getExecutable();
mState.mExecutable->mTessGenMode = tessEvalExecutable.mTessGenMode;
mState.mExecutable->mTessGenSpacing = tessEvalExecutable.mTessGenSpacing;
mState.mExecutable->mTessGenVertexOrder = tessEvalExecutable.mTessGenVertexOrder;
mState.mExecutable->mTessGenPointMode = tessEvalExecutable.mTessGenPointMode;
}
}
void ProgramPipeline::updateHasBooleans() void ProgramPipeline::updateHasBooleans()
{ {
// Need to check all of the shader stages, not just linked, so we handle Compute correctly. // Need to check all of the shader stages, not just linked, so we handle Compute correctly.
...@@ -402,6 +442,12 @@ void ProgramPipeline::updateExecutable() ...@@ -402,6 +442,12 @@ void ProgramPipeline::updateExecutable()
updateShaderStorageBlocks(); updateShaderStorageBlocks();
updateImageBindings(); updateImageBindings();
// Geometry Shader ProgramExecutable properties
updateExecutableGeometryProperties();
// Tessellation Shaders ProgramExecutable properties
updateExecutableTessellationProperties();
// All Shader ProgramExecutable properties // All Shader ProgramExecutable properties
mState.updateExecutableTextures(); mState.updateExecutableTextures();
......
...@@ -151,6 +151,8 @@ class ProgramPipeline final : public RefCountObject<ProgramPipelineID>, ...@@ -151,6 +151,8 @@ class ProgramPipeline final : public RefCountObject<ProgramPipelineID>,
void updateTransformFeedbackMembers(); void updateTransformFeedbackMembers();
void updateShaderStorageBlocks(); void updateShaderStorageBlocks();
void updateImageBindings(); void updateImageBindings();
void updateExecutableGeometryProperties();
void updateExecutableTessellationProperties();
void updateHasBooleans(); void updateHasBooleans();
void updateExecutable(); void updateExecutable();
......
...@@ -3949,14 +3949,14 @@ void RecordDrawModeError(const Context *context, PrimitiveMode mode) ...@@ -3949,14 +3949,14 @@ void RecordDrawModeError(const Context *context, PrimitiveMode mode)
// If we are running GLES1, there is no current program. // If we are running GLES1, there is no current program.
if (context->getClientVersion() >= Version(2, 0)) if (context->getClientVersion() >= Version(2, 0))
{ {
Program *program = context->getActiveLinkedProgram(); const ProgramExecutable *executable = state.getProgramExecutable();
ASSERT(program); ASSERT(executable);
// Do geometry shader specific validations // Do geometry shader specific validations
if (program->getExecutable().hasLinkedShaderStage(ShaderType::Geometry)) if (executable->hasLinkedShaderStage(ShaderType::Geometry))
{ {
if (!IsCompatibleDrawModeWithGeometryShader( if (!IsCompatibleDrawModeWithGeometryShader(
mode, program->getGeometryShaderInputPrimitiveType())) mode, executable->getGeometryShaderInputPrimitiveType()))
{ {
context->validationError(GL_INVALID_OPERATION, context->validationError(GL_INVALID_OPERATION,
kIncompatibleDrawModeAgainstGeometryShader); kIncompatibleDrawModeAgainstGeometryShader);
...@@ -3964,16 +3964,14 @@ void RecordDrawModeError(const Context *context, PrimitiveMode mode) ...@@ -3964,16 +3964,14 @@ void RecordDrawModeError(const Context *context, PrimitiveMode mode)
} }
} }
if (program->getExecutable().hasLinkedTessellationShader() && if (executable->hasLinkedTessellationShader() && mode != PrimitiveMode::Patches)
mode != PrimitiveMode::Patches)
{ {
context->validationError(GL_INVALID_OPERATION, context->validationError(GL_INVALID_OPERATION,
kIncompatibleDrawModeWithTessellationShader); kIncompatibleDrawModeWithTessellationShader);
return; return;
} }
if (!program->getExecutable().hasLinkedTessellationShader() && if (!executable->hasLinkedTessellationShader() && mode == PrimitiveMode::Patches)
mode == PrimitiveMode::Patches)
{ {
context->validationError(GL_INVALID_OPERATION, context->validationError(GL_INVALID_OPERATION,
kIncompatibleDrawModeWithoutTessellationShader); kIncompatibleDrawModeWithoutTessellationShader);
......
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