mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-04-27 14:58:32 +00:00
Renderer: Move cull mode to a rasterization state object
Also moves logic for primitive handling to VideoCommon.
This commit is contained in:
parent
2869c570f1
commit
836b9b9acb
38 changed files with 389 additions and 450 deletions
|
@ -221,7 +221,8 @@ void ProgramShaderCache::UploadConstants()
|
|||
}
|
||||
}
|
||||
|
||||
SHADER* ProgramShaderCache::SetShader(u32 primitive_type, const GLVertexFormat* vertex_format)
|
||||
SHADER* ProgramShaderCache::SetShader(PrimitiveType primitive_type,
|
||||
const GLVertexFormat* vertex_format)
|
||||
{
|
||||
if (g_ActiveConfig.bDisableSpecializedShaders)
|
||||
return SetUberShader(primitive_type, vertex_format);
|
||||
|
@ -292,7 +293,8 @@ SHADER* ProgramShaderCache::SetShader(u32 primitive_type, const GLVertexFormat*
|
|||
return &last_entry->shader;
|
||||
}
|
||||
|
||||
SHADER* ProgramShaderCache::SetUberShader(u32 primitive_type, const GLVertexFormat* vertex_format)
|
||||
SHADER* ProgramShaderCache::SetUberShader(PrimitiveType primitive_type,
|
||||
const GLVertexFormat* vertex_format)
|
||||
{
|
||||
UBERSHADERUID uid;
|
||||
std::memset(&uid, 0, sizeof(uid));
|
||||
|
@ -1295,7 +1297,7 @@ void ProgramShaderCache::DestroyPrerenderArrays(SharedContextData* data)
|
|||
}
|
||||
}
|
||||
|
||||
void ProgramShaderCache::DrawPrerenderArray(const SHADER& shader, u32 primitive_type)
|
||||
void ProgramShaderCache::DrawPrerenderArray(const SHADER& shader, PrimitiveType primitive_type)
|
||||
{
|
||||
// This is called on a worker thread, so we don't want to use the normal binding process.
|
||||
glUseProgram(shader.glprogid);
|
||||
|
@ -1303,15 +1305,18 @@ void ProgramShaderCache::DrawPrerenderArray(const SHADER& shader, u32 primitive_
|
|||
// The number of primitives drawn depends on the type.
|
||||
switch (primitive_type)
|
||||
{
|
||||
case PRIMITIVE_POINTS:
|
||||
case PrimitiveType::Points:
|
||||
glDrawElements(GL_POINTS, 1, GL_UNSIGNED_SHORT, nullptr);
|
||||
break;
|
||||
case PRIMITIVE_LINES:
|
||||
case PrimitiveType::Lines:
|
||||
glDrawElements(GL_LINES, 2, GL_UNSIGNED_SHORT, nullptr);
|
||||
break;
|
||||
case PRIMITIVE_TRIANGLES:
|
||||
case PrimitiveType::Triangles:
|
||||
glDrawElements(GL_TRIANGLES, 3, GL_UNSIGNED_SHORT, nullptr);
|
||||
break;
|
||||
case PrimitiveType::TriangleStrip:
|
||||
glDrawElements(GL_TRIANGLE_STRIP, 3, GL_UNSIGNED_SHORT, nullptr);
|
||||
break;
|
||||
}
|
||||
|
||||
// Has to be finished by the time the main thread picks it up.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue