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()
}
}
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()
{
// Need to check all of the shader stages, not just linked, so we handle Compute correctly.
......@@ -402,6 +442,12 @@ void ProgramPipeline::updateExecutable()
updateShaderStorageBlocks();
updateImageBindings();
// Geometry Shader ProgramExecutable properties
updateExecutableGeometryProperties();
// Tessellation Shaders ProgramExecutable properties
updateExecutableTessellationProperties();
// All Shader ProgramExecutable properties
mState.updateExecutableTextures();
......
......@@ -151,6 +151,8 @@ class ProgramPipeline final : public RefCountObject<ProgramPipelineID>,
void updateTransformFeedbackMembers();
void updateShaderStorageBlocks();
void updateImageBindings();
void updateExecutableGeometryProperties();
void updateExecutableTessellationProperties();
void updateHasBooleans();
void updateExecutable();
......
......@@ -3949,14 +3949,14 @@ void RecordDrawModeError(const Context *context, PrimitiveMode mode)
// If we are running GLES1, there is no current program.
if (context->getClientVersion() >= Version(2, 0))
{
Program *program = context->getActiveLinkedProgram();
ASSERT(program);
const ProgramExecutable *executable = state.getProgramExecutable();
ASSERT(executable);
// Do geometry shader specific validations
if (program->getExecutable().hasLinkedShaderStage(ShaderType::Geometry))
if (executable->hasLinkedShaderStage(ShaderType::Geometry))
{
if (!IsCompatibleDrawModeWithGeometryShader(
mode, program->getGeometryShaderInputPrimitiveType()))
mode, executable->getGeometryShaderInputPrimitiveType()))
{
context->validationError(GL_INVALID_OPERATION,
kIncompatibleDrawModeAgainstGeometryShader);
......@@ -3964,16 +3964,14 @@ void RecordDrawModeError(const Context *context, PrimitiveMode mode)
}
}
if (program->getExecutable().hasLinkedTessellationShader() &&
mode != PrimitiveMode::Patches)
if (executable->hasLinkedTessellationShader() && mode != PrimitiveMode::Patches)
{
context->validationError(GL_INVALID_OPERATION,
kIncompatibleDrawModeWithTessellationShader);
return;
}
if (!program->getExecutable().hasLinkedTessellationShader() &&
mode == PrimitiveMode::Patches)
if (!executable->hasLinkedTessellationShader() && mode == PrimitiveMode::Patches)
{
context->validationError(GL_INVALID_OPERATION,
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