diff options
| author | Jules Blok <jules.blok@gmail.com> | 2016-08-19 02:11:37 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2016-08-19 02:11:37 +0200 |
| commit | 40f4308dc2120ce4e105008f3cb46b6a1c553e64 (patch) | |
| tree | a3a83299c9d3f3873f94b2c75991877bb7b928a6 /Source/Core/VideoCommon/GeometryShaderGen.cpp | |
| parent | 0015d2e86b76772a57fb4554c84c4b47adce341e (diff) | |
| parent | e86d7cbc999223ca113af7b4c0aac6850c1854fe (diff) | |
Merge pull request #4085 from Armada651/vertex-depth
VideoCommon: Implement depth range equation in vertex shader.
Diffstat (limited to 'Source/Core/VideoCommon/GeometryShaderGen.cpp')
| -rw-r--r-- | Source/Core/VideoCommon/GeometryShaderGen.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/Source/Core/VideoCommon/GeometryShaderGen.cpp b/Source/Core/VideoCommon/GeometryShaderGen.cpp index 4d90e6f10d..83b30943bc 100644 --- a/Source/Core/VideoCommon/GeometryShaderGen.cpp +++ b/Source/Core/VideoCommon/GeometryShaderGen.cpp @@ -7,6 +7,7 @@ #include "Common/CommonTypes.h" #include "VideoCommon/BPMemory.h" +#include "VideoCommon/DriverDetails.h" #include "VideoCommon/GeometryShaderGen.h" #include "VideoCommon/LightingShaderGen.h" #include "VideoCommon/VideoCommon.h" @@ -211,6 +212,15 @@ ShaderCode GenerateGeometryShaderCode(APIType ApiType, const geometry_shader_uid { out.Write("\tVS_OUTPUT f;\n"); AssignVSOutputMembers(out, "f", "vs[i]", uid_data->numTexGens, uid_data->pixel_lighting); + + if (g_ActiveConfig.backend_info.bSupportsDepthClamp && + DriverDetails::HasBug(DriverDetails::BUG_BROKENCLIPDISTANCE)) + { + // On certain GPUs we have to consume the clip distance from the vertex shader + // or else the other vertex shader outputs will get corrupted. + out.Write("\tf.clipDist0 = gl_in[i].gl_ClipDistance[0];\n"); + out.Write("\tf.clipDist1 = gl_in[i].gl_ClipDistance[1];\n"); + } } else { @@ -312,6 +322,11 @@ static void EmitVertex(ShaderCode& out, const geometry_shader_uid_data* uid_data if (ApiType == APIType::OpenGL) { out.Write("\tgl_Position = %s.pos;\n", vertex); + if (g_ActiveConfig.backend_info.bSupportsDepthClamp) + { + out.Write("\tgl_ClipDistance[0] = %s.clipDist0;\n", vertex); + out.Write("\tgl_ClipDistance[1] = %s.clipDist1;\n", vertex); + } AssignVSOutputMembers(out, "ps", vertex, uid_data->numTexGens, uid_data->pixel_lighting); } else |
