Skip to content

Commit

Permalink
VideoCommon: Handle wireframe mode in the geometry shader.
Browse files Browse the repository at this point in the history
  • Loading branch information
CrossVR committed Dec 19, 2014
1 parent 02f2215 commit 40258fd
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 9 deletions.
3 changes: 0 additions & 3 deletions Source/Core/VideoBackends/D3D/Render.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1084,10 +1084,7 @@ void Renderer::ApplyState(bool bUseDstAlpha)
{
gx_state.blend.use_dst_alpha = bUseDstAlpha;
D3D::stateman->PushBlendState(gx_state_cache.Get(gx_state.blend));

D3D::stateman->PushDepthState(gx_state_cache.Get(gx_state.zmode));

gx_state.raster.wireframe = g_ActiveConfig.bWireFrame;
D3D::stateman->PushRasterizerState(gx_state_cache.Get(gx_state.raster));

for (unsigned int stage = 0; stage < 8; stage++)
Expand Down
3 changes: 0 additions & 3 deletions Source/Core/VideoBackends/OGL/Render.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1800,9 +1800,6 @@ void Renderer::RestoreAPIState()
SetLogicOpMode();
SetViewport();

if (GLInterface->GetMode() == GLInterfaceMode::MODE_OPENGL)
glPolygonMode(GL_FRONT_AND_BACK, g_ActiveConfig.bWireFrame ? GL_LINE : GL_FILL);

VertexManager *vm = (OGL::VertexManager*)g_vertex_manager;
glBindBuffer(GL_ARRAY_BUFFER, vm->m_vertex_buffers);
if (vm->m_last_vao)
Expand Down
7 changes: 4 additions & 3 deletions Source/Core/VideoCommon/GeometryShaderGen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,18 +49,19 @@ static inline void GenerateGeometryShader(T& out, u32 primitive_type, API_TYPE A
const unsigned int vertex_out = primitive_type == PRIMITIVE_TRIANGLES ? 3 : 4;

uid_data->stereo = g_ActiveConfig.iStereoMode > 0;
uid_data->wireframe = g_ActiveConfig.bWireFrame;
if (ApiType == API_OPENGL)
{
// Insert layout parameters
if (g_ActiveConfig.backend_info.bSupportsGSInstancing)
{
out.Write("layout(%s, invocations = %d) in;\n", primitives_ogl[primitive_type], g_ActiveConfig.iStereoMode > 0 ? 2 : 1);
out.Write("layout(triangle_strip, max_vertices = %d) out;\n", vertex_out);
out.Write("layout(%s_strip, max_vertices = %d) out;\n", g_ActiveConfig.bWireFrame ? "line" : "triangle", vertex_out);
}
else
{
out.Write("layout(%s) in;\n", primitives_ogl[primitive_type]);
out.Write("layout(triangle_strip, max_vertices = %d) out;\n", g_ActiveConfig.iStereoMode > 0 ? vertex_out * 2 : vertex_out);
out.Write("layout(%s_strip, max_vertices = %d) out;\n", g_ActiveConfig.bWireFrame ? "line" : "triangle", g_ActiveConfig.iStereoMode > 0 ? vertex_out * 2 : vertex_out);
}
}

Expand Down Expand Up @@ -305,5 +306,5 @@ void GenerateGeometryShaderCode(ShaderCode& object, u32 primitive_type, API_TYPE
bool IsPassthroughGeometryShader(GeometryShaderUid& object)
{
geometry_shader_uid_data* uid_data = object.GetUidData<geometry_shader_uid_data>();
return uid_data->primitive_type == PRIMITIVE_TRIANGLES && !uid_data->stereo;
return uid_data->primitive_type == PRIMITIVE_TRIANGLES && !uid_data->stereo && !uid_data->wireframe;
}
1 change: 1 addition & 0 deletions Source/Core/VideoCommon/GeometryShaderGen.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ struct geometry_shader_uid_data
u32 numTexGens : 4;
u32 pixel_lighting : 1;
u32 primitive_type : 2;
u32 wireframe : 1;
};

#pragma pack()
Expand Down

0 comments on commit 40258fd

Please sign in to comment.