Skip to content

Commit

Permalink
Merge pull request #12372 from unknownbrackets/curves
Browse files Browse the repository at this point in the history
GPU: Generate normals for curves with lighting
  • Loading branch information
hrydgard authored Sep 29, 2019
2 parents 633d1e7 + cba6a63 commit 360e138
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
13 changes: 6 additions & 7 deletions GPU/Common/ShaderId.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,6 @@ void ComputeVertexShaderID(VShaderID *id_out, u32 vertType, bool useHWTransform)

bool doBezier = gstate_c.bezier;
bool doSpline = gstate_c.spline;
// These are the original vertType's values (normalized will always have colors, etc.)
bool hasColorTess = (gstate.vertType & GE_VTYPE_COL_MASK) != 0 && (doBezier || doSpline);
bool hasTexcoordTess = (gstate.vertType & GE_VTYPE_TC_MASK) != 0 && (doBezier || doSpline);
bool hasNormalTess = (gstate.vertType & GE_VTYPE_NRM_MASK) != 0 && (doBezier || doSpline);

bool enableFog = gstate.isFogEnabled() && !isModeThrough && !gstate.isModeClear();
bool lmode = gstate.isUsingSecondaryColor() && gstate.isLightingEnabled() && !isModeThrough;
Expand Down Expand Up @@ -138,9 +134,12 @@ void ComputeVertexShaderID(VShaderID *id_out, u32 vertType, bool useHWTransform)
if (g_Config.bHardwareTessellation) {
id.SetBit(VS_BIT_BEZIER, doBezier);
id.SetBit(VS_BIT_SPLINE, doSpline);
id.SetBit(VS_BIT_HAS_COLOR_TESS, hasColorTess);
id.SetBit(VS_BIT_HAS_TEXCOORD_TESS, hasTexcoordTess);
id.SetBit(VS_BIT_HAS_NORMAL_TESS, hasNormalTess);
if (doBezier || doSpline) {
// These are the original vertType's values (normalized will always have colors, etc.)
id.SetBit(VS_BIT_HAS_COLOR_TESS, (gstate.vertType & GE_VTYPE_COL_MASK) != 0);
id.SetBit(VS_BIT_HAS_TEXCOORD_TESS, (gstate.vertType & GE_VTYPE_TC_MASK) != 0);
id.SetBit(VS_BIT_HAS_NORMAL_TESS, (gstate.vertType & GE_VTYPE_NRM_MASK) != 0 || gstate.isLightingEnabled());
}
id.SetBit(VS_BIT_NORM_REVERSE_TESS, gstate.isPatchNormalsReversed());
}
}
Expand Down
3 changes: 2 additions & 1 deletion GPU/Common/SplineCommon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -403,6 +403,7 @@ class SubdivisionSurface {
vert.nrm *= -1.0f;
} else {
vert.nrm.SetZero();
vert.nrm.z = 1.0f;
}
}
}
Expand All @@ -417,7 +418,7 @@ class SubdivisionSurface {

static void Tessellate(OutputBuffers &output, const Surface &surface, const ControlPoints &points, const Weight2D &weights, u32 origVertType) {
const bool params[] = {
(origVertType & GE_VTYPE_NRM_MASK) != 0,
(origVertType & GE_VTYPE_NRM_MASK) != 0 || gstate.isLightingEnabled(),
(origVertType & GE_VTYPE_COL_MASK) != 0,
(origVertType & GE_VTYPE_TC_MASK) != 0,
cpu_info.bSSE4_1,
Expand Down

0 comments on commit 360e138

Please sign in to comment.