VideoCommon: Handle wireframe mode in the geometry shader.

This commit is contained in:
Jules Blok 2014-12-19 12:03:11 +01:00
parent ca18e51450
commit 925bbcb85b
4 changed files with 7 additions and 11 deletions

View File

@ -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++)

View File

@ -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)

View File

@ -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);
}
}
@ -114,12 +115,12 @@ static inline void GenerateGeometryShader(T& out, u32 primitive_type, API_TYPE A
if (g_ActiveConfig.backend_info.bSupportsGSInstancing)
{
out.Write("[maxvertexcount(%d)]\n[instance(%d)]\n", vertex_out, g_ActiveConfig.iStereoMode > 0 ? 2 : 1);
out.Write("void main(%s VS_OUTPUT o[%d], inout TriangleStream<VertexData> output, in uint InstanceID : SV_GSInstanceID)\n{\n", primitives_d3d[primitive_type], vertex_in);
out.Write("void main(%s VS_OUTPUT o[%d], inout %sStream<VertexData> output, in uint InstanceID : SV_GSInstanceID)\n{\n", primitives_d3d[primitive_type], vertex_in, g_ActiveConfig.bWireFrame ? "Line" : "Triangle");
}
else
{
out.Write("[maxvertexcount(%d)]\n", g_ActiveConfig.iStereoMode > 0 ? vertex_out * 2 : vertex_out);
out.Write("void main(%s VS_OUTPUT o[%d], inout TriangleStream<VertexData> output)\n{\n", primitives_d3d[primitive_type], vertex_in);
out.Write("void main(%s VS_OUTPUT o[%d], inout %sStream<VertexData> output)\n{\n", primitives_d3d[primitive_type], vertex_in, g_ActiveConfig.bWireFrame ? "Line" : "Triangle");
}
out.Write("\tVertexData ps;\n");
@ -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;
}

View File

@ -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()