Răsfoiți Sursa

Merge pull request #1108 from Subv/front_facing

Shaders: Implemented the gl_FrontFacing input attribute (attr 63).
bunnei 8 ani în urmă
părinte
comite
9baf5de90c

+ 3 - 0
src/video_core/engines/shader_bytecode.h

@@ -79,6 +79,9 @@ union Attribute {
         // shader, and a tuple of (TessCoord.x, TessCoord.y, TessCoord.z, ~) when inside a Tess Eval
         // shader, and a tuple of (TessCoord.x, TessCoord.y, TessCoord.z, ~) when inside a Tess Eval
         // shader.
         // shader.
         TessCoordInstanceIDVertexID = 47,
         TessCoordInstanceIDVertexID = 47,
+        // This attribute contains a tuple of (Unk, Unk, Unk, gl_FrontFacing) when inside a fragment
+        // shader. It is unknown what the other values contain.
+        FrontFacing = 63,
     };
     };
 
 
     union {
     union {

+ 4 - 0
src/video_core/renderer_opengl/gl_shader_decompiler.cpp

@@ -542,6 +542,10 @@ private:
             // shader.
             // shader.
             ASSERT(stage == Maxwell3D::Regs::ShaderStage::Vertex);
             ASSERT(stage == Maxwell3D::Regs::ShaderStage::Vertex);
             return "vec4(0, 0, uintBitsToFloat(instance_id.x), uintBitsToFloat(gl_VertexID))";
             return "vec4(0, 0, uintBitsToFloat(instance_id.x), uintBitsToFloat(gl_VertexID))";
+        case Attribute::Index::FrontFacing:
+            // TODO(Subv): Find out what the values are for the other elements.
+            ASSERT(stage == Maxwell3D::Regs::ShaderStage::Fragment);
+            return "vec4(0, 0, 0, uintBitsToFloat(gl_FrontFacing ? 1 : 0))";
         default:
         default:
             const u32 index{static_cast<u32>(attribute) -
             const u32 index{static_cast<u32>(attribute) -
                             static_cast<u32>(Attribute::Index::Attribute_0)};
                             static_cast<u32>(Attribute::Index::Attribute_0)};