VideoCommon: store the configuration used to create the AbstractPipeline on the pipeline itself, so that it's easy to duplicate pipelines with slightly altered configuration

This commit is contained in:
iwubcode
2023-01-27 18:28:52 -06:00
parent aaad0cd39f
commit d0c6b6c9ed
12 changed files with 45 additions and 38 deletions

View File

@ -28,13 +28,13 @@ static GLenum MapToGLPrimitive(PrimitiveType primitive_type)
return 0;
}
}
OGLPipeline::OGLPipeline(const GLVertexFormat* vertex_format,
OGLPipeline::OGLPipeline(const AbstractPipelineConfig& config, const GLVertexFormat* vertex_format,
const RasterizationState& rasterization_state,
const DepthState& depth_state, const BlendingState& blending_state,
PipelineProgram* program, GLuint gl_primitive)
: m_vertex_format(vertex_format), m_rasterization_state(rasterization_state),
m_depth_state(depth_state), m_blending_state(blending_state), m_program(program),
m_gl_primitive(gl_primitive)
: AbstractPipeline(config), m_vertex_format(vertex_format),
m_rasterization_state(rasterization_state), m_depth_state(depth_state),
m_blending_state(blending_state), m_program(program), m_gl_primitive(gl_primitive)
{
}
@ -90,7 +90,7 @@ std::unique_ptr<OGLPipeline> OGLPipeline::Create(const AbstractPipelineConfig& c
const GLVertexFormat* vertex_format = static_cast<const GLVertexFormat*>(config.vertex_format);
GLenum gl_primitive = MapToGLPrimitive(config.rasterization_state.primitive);
return std::make_unique<OGLPipeline>(vertex_format, config.rasterization_state,
return std::make_unique<OGLPipeline>(config, vertex_format, config.rasterization_state,
config.depth_state, config.blending_state, program,
gl_primitive);
}

View File

@ -15,7 +15,7 @@ namespace OGL
class OGLPipeline final : public AbstractPipeline
{
public:
explicit OGLPipeline(const GLVertexFormat* vertex_format,
explicit OGLPipeline(const AbstractPipelineConfig& config, const GLVertexFormat* vertex_format,
const RasterizationState& rasterization_state, const DepthState& depth_state,
const BlendingState& blending_state, PipelineProgram* program,
GLenum gl_primitive);