-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
handle cull mode by indices, refer to issue #10172 #10973
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1530,8 +1530,11 @@ void GPUCommon::Execute_Prim(u32 op, u32 diff) { | |
int bytesRead = 0; | ||
UpdateUVScaleOffset(); | ||
|
||
// cull mode | ||
int cullMode = gstate.isCullEnabled() ? gstate.getCullMode() : -1; | ||
|
||
uint32_t vertTypeID = GetVertTypeID(vertexType, gstate.getUVGenMode()); | ||
drawEngineCommon_->SubmitPrim(verts, inds, prim, count, vertTypeID, &bytesRead); | ||
drawEngineCommon_->SubmitPrim(verts, inds, prim, count, vertTypeID, cullMode, &bytesRead); | ||
// After drawing, we advance the vertexAddr (when non indexed) or indexAddr (when indexed). | ||
// Some games rely on this, they don't bother reloading VADDR and IADDR. | ||
// The VADDR/IADDR registers are NOT updated. | ||
|
@@ -1577,7 +1580,14 @@ void GPUCommon::Execute_Prim(u32 op, u32 diff) { | |
inds = Memory::GetPointerUnchecked(gstate_c.indexAddr); | ||
} | ||
|
||
drawEngineCommon_->SubmitPrim(verts, inds, newPrim, count, vertTypeID, &bytesRead); | ||
if (newPrim != GE_PRIM_TRIANGLE_STRIP && cullMode != -1 && cullMode != gstate.getCullMode()) { | ||
DEBUG_LOG(G3D, "flush cull mode before prim: %d", newPrim); | ||
drawEngineCommon_->DispatchFlush(); | ||
gstate.cmdmem[GE_CMD_CULL] ^= 1; | ||
gstate_c.Dirty(DIRTY_RASTER_STATE); | ||
} | ||
|
||
drawEngineCommon_->SubmitPrim(verts, inds, newPrim, count, vertTypeID, cullMode, &bytesRead); | ||
AdvanceVerts(vertexType, count, bytesRead); | ||
totalVertCount += count; | ||
break; | ||
|
@@ -1604,6 +1614,10 @@ void GPUCommon::Execute_Prim(u32 op, u32 diff) { | |
case GE_CMD_BASE: | ||
gstate.cmdmem[GE_CMD_BASE] = data; | ||
break; | ||
case GE_CMD_CULL: | ||
// flip face by indices for GE_PRIM_TRIANGLE_STRIP | ||
cullMode = data & 1; | ||
break; | ||
case GE_CMD_NOP: | ||
case GE_CMD_NOP_FF: | ||
break; | ||
|
@@ -1618,6 +1632,14 @@ void GPUCommon::Execute_Prim(u32 op, u32 diff) { | |
gstate.cmdmem[GE_CMD_TEXSCALEV] = data; | ||
gstate_c.uv.vScale = getFloat24(data); | ||
break; | ||
case GE_CMD_TEXOFFSETU: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Tomb Raider use GE_CMD_TEXOFFSETU and GE_CMD_TEXOFFSETV frequently, but not quite useful.:grimacing: There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think it's some engine, there's other games that do that too (basically the whole point of the -[Unknown] |
||
gstate.cmdmem[GE_CMD_TEXOFFSETU] = data; | ||
gstate_c.uv.uOff = getFloat24(data); | ||
break; | ||
case GE_CMD_TEXOFFSETV: | ||
gstate.cmdmem[GE_CMD_TEXOFFSETV] = data; | ||
gstate_c.uv.vOff = getFloat24(data); | ||
break; | ||
case GE_CMD_TEXLEVEL: | ||
// Same Gran Turismo hack from Execute_TexLevel | ||
if ((data & 3) != GE_TEXLEVEL_MODE_AUTO && (0x00FF0000 & data) != 0) { | ||
|
@@ -1654,6 +1676,12 @@ void GPUCommon::Execute_Prim(u32 op, u32 diff) { | |
if (cmdCount > 0) { | ||
UpdatePC(currentList->pc, currentList->pc + cmdCount * 4); | ||
currentList->pc += cmdCount * 4; | ||
// flush back cull mode | ||
if (cullMode != -1 && cullMode != gstate.getCullMode()) { | ||
drawEngineCommon_->DispatchFlush(); | ||
gstate.cmdmem[GE_CMD_CULL] ^= 1; | ||
gstate_c.Dirty(DIRTY_RASTER_STATE); | ||
} | ||
} | ||
|
||
gpuStats.vertexGPUCycles += vertexCost_ * totalVertCount; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Didn't use these below?
-[Unknown]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will fx it now.:flushed: