Merge pull request #11613 from unknownbrackets/cullmode

GPU: Force use of indexes on cull mode flip
This commit is contained in:
Henrik Rydgård 2018-11-30 20:57:21 +01:00 committed by GitHub
commit d1cf34cdf3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 4 deletions

View File

@ -77,6 +77,10 @@ void IndexGenerator::AddList(int numVerts, bool clockwise) {
count_ += numVerts;
prim_ = GE_PRIM_TRIANGLES;
seenPrims_ |= 1 << GE_PRIM_TRIANGLES;
if (!clockwise) {
// Make sure we don't treat this as pure.
seenPrims_ |= 1 << GE_PRIM_TRIANGLE_STRIP;
}
}
void IndexGenerator::AddStrip(int numVerts, bool clockwise) {
@ -96,7 +100,7 @@ void IndexGenerator::AddStrip(int numVerts, bool clockwise) {
if (numTris > 0)
count_ += numTris * 3;
// This is so we can detect one single strip by just looking at seenPrims_.
if (!seenPrims_) {
if (!seenPrims_ && clockwise) {
seenPrims_ = 1 << GE_PRIM_TRIANGLE_STRIP;
prim_ = GE_PRIM_TRIANGLE_STRIP;
pureCount_ = numVerts;
@ -123,6 +127,10 @@ void IndexGenerator::AddFan(int numVerts, bool clockwise) {
count_ += numTris * 3;
prim_ = GE_PRIM_TRIANGLES;
seenPrims_ |= 1 << GE_PRIM_TRIANGLE_FAN;
if (!clockwise) {
// Make sure we don't treat this as pure.
seenPrims_ |= 1 << GE_PRIM_TRIANGLE_STRIP;
}
}
//Lines

View File

@ -176,7 +176,6 @@ struct FShaderID : ShaderID {
};
bool CanUseHardwareTransform(int prim);
void ComputeVertexShaderID(ShaderID *id, uint32_t vertexType, bool useHWTransform);
// Generates a compact string that describes the shader. Useful in a list to get an overview
// of the current flora of shaders.

View File

@ -1537,7 +1537,7 @@ void GPUCommon::Execute_Prim(u32 op, u32 diff) {
}
void *verts = Memory::GetPointerUnchecked(gstate_c.vertexAddr);
void *inds = 0;
void *inds = nullptr;
u32 vertexType = gstate.vertType;
if ((vertexType & GE_VTYPE_IDX_MASK) != GE_VTYPE_IDX_NONE) {
u32 indexAddr = gstate_c.indexAddr;
@ -1602,9 +1602,10 @@ void GPUCommon::Execute_Prim(u32 op, u32 diff) {
}
GEPrimitiveType newPrim = static_cast<GEPrimitiveType>((data >> 16) & 7);
SetDrawType(DRAW_PRIM, newPrim);
// TODO: more efficient updating of verts/inds
verts = Memory::GetPointerUnchecked(gstate_c.vertexAddr);
inds = 0;
inds = nullptr;
if ((vertexType & GE_VTYPE_IDX_MASK) != GE_VTYPE_IDX_NONE) {
inds = Memory::GetPointerUnchecked(gstate_c.indexAddr);
}