mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-04-02 11:01:50 -04:00
We never draw non-indexed in software transform mode, so get rid of the path.
This commit is contained in:
parent
665f03ff62
commit
6b1e57a840
6 changed files with 23 additions and 52 deletions
|
@ -497,13 +497,11 @@ void SoftwareTransform::BuildDrawingParams(int prim, int vertexCount, u32 vertTy
|
|||
|
||||
if (prim == GE_PRIM_RECTANGLES) {
|
||||
if (!ExpandRectangles(vertexCount, numDecodedVerts, vertsSize, inds, indsSize, transformed, transformedExpanded, numTrans, throughmode, &result->pixelMapped)) {
|
||||
result->drawIndexed = false;
|
||||
result->drawNumTrans = 0;
|
||||
result->pixelMapped = false;
|
||||
return;
|
||||
}
|
||||
result->drawBuffer = transformedExpanded;
|
||||
result->drawIndexed = true;
|
||||
|
||||
// We don't know the color until here, so we have to do it now, instead of in StateMapping.
|
||||
// Might want to reconsider the order of things later...
|
||||
|
@ -521,25 +519,20 @@ void SoftwareTransform::BuildDrawingParams(int prim, int vertexCount, u32 vertTy
|
|||
} else if (prim == GE_PRIM_POINTS) {
|
||||
result->pixelMapped = false;
|
||||
if (!ExpandPoints(vertexCount, numDecodedVerts, vertsSize, inds, indsSize, transformed, transformedExpanded, numTrans, throughmode)) {
|
||||
result->drawIndexed = false;
|
||||
result->drawNumTrans = 0;
|
||||
return;
|
||||
}
|
||||
result->drawBuffer = transformedExpanded;
|
||||
result->drawIndexed = true;
|
||||
} else if (prim == GE_PRIM_LINES) {
|
||||
result->pixelMapped = false;
|
||||
if (!ExpandLines(vertexCount, numDecodedVerts, vertsSize, inds, indsSize, transformed, transformedExpanded, numTrans, throughmode)) {
|
||||
result->drawIndexed = false;
|
||||
result->drawNumTrans = 0;
|
||||
return;
|
||||
}
|
||||
result->drawBuffer = transformedExpanded;
|
||||
result->drawIndexed = true;
|
||||
} else {
|
||||
// We can simply draw the unexpanded buffer.
|
||||
numTrans = vertexCount;
|
||||
result->drawIndexed = true;
|
||||
result->pixelMapped = false;
|
||||
|
||||
// If we don't support custom cull in the shader, process it here.
|
||||
|
@ -635,7 +628,7 @@ void SoftwareTransform::BuildDrawingParams(int prim, int vertexCount, u32 vertTy
|
|||
gpuStats.numClears++;
|
||||
}
|
||||
|
||||
result->action = SW_DRAW_PRIMITIVES;
|
||||
result->action = SW_DRAW_INDEXED;
|
||||
result->drawNumTrans = numTrans;
|
||||
}
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ class TextureCacheCommon;
|
|||
|
||||
enum SoftwareTransformAction {
|
||||
SW_NOT_READY,
|
||||
SW_DRAW_PRIMITIVES,
|
||||
SW_DRAW_INDEXED,
|
||||
SW_CLEAR,
|
||||
};
|
||||
|
||||
|
@ -44,8 +44,6 @@ struct SoftwareTransformResult {
|
|||
|
||||
TransformedVertex *drawBuffer;
|
||||
int drawNumTrans;
|
||||
bool drawIndexed;
|
||||
|
||||
bool pixelMapped;
|
||||
};
|
||||
|
||||
|
|
|
@ -424,7 +424,7 @@ void DrawEngineD3D11::DoFlush() {
|
|||
|
||||
ApplyDrawStateLate(result.setStencil, result.stencilValue);
|
||||
|
||||
if (result.action == SW_DRAW_PRIMITIVES) {
|
||||
if (result.action == SW_DRAW_INDEXED) {
|
||||
D3D11VertexShader *vshader;
|
||||
D3D11FragmentShader *fshader;
|
||||
shaderManager_->GetShaders(prim, dec_, &vshader, &fshader, pipelineState_, false, false, decOptions_.expandAllWeightsToFloat, true);
|
||||
|
@ -452,17 +452,13 @@ void DrawEngineD3D11::DoFlush() {
|
|||
pushVerts_->EndPush(context_);
|
||||
ID3D11Buffer *buf = pushVerts_->Buf();
|
||||
context_->IASetVertexBuffers(0, 1, &buf, &stride, &vOffset);
|
||||
if (result.drawIndexed) {
|
||||
UINT iOffset;
|
||||
int iSize = sizeof(uint16_t) * result.drawNumTrans;
|
||||
uint8_t *iptr = pushInds_->BeginPush(context_, &iOffset, iSize);
|
||||
memcpy(iptr, inds, iSize);
|
||||
pushInds_->EndPush(context_);
|
||||
context_->IASetIndexBuffer(pushInds_->Buf(), DXGI_FORMAT_R16_UINT, iOffset);
|
||||
context_->DrawIndexed(result.drawNumTrans, 0, 0);
|
||||
} else {
|
||||
context_->Draw(result.drawNumTrans, 0);
|
||||
}
|
||||
UINT iOffset;
|
||||
int iSize = sizeof(uint16_t) * result.drawNumTrans;
|
||||
uint8_t *iptr = pushInds_->BeginPush(context_, &iOffset, iSize);
|
||||
memcpy(iptr, inds, iSize);
|
||||
pushInds_->EndPush(context_);
|
||||
context_->IASetIndexBuffer(pushInds_->Buf(), DXGI_FORMAT_R16_UINT, iOffset);
|
||||
context_->DrawIndexed(result.drawNumTrans, 0, 0);
|
||||
} else if (result.action == SW_CLEAR) {
|
||||
u32 clearColor = result.color;
|
||||
float clearDepth = result.depth;
|
||||
|
|
|
@ -382,7 +382,7 @@ void DrawEngineDX9::DoFlush() {
|
|||
|
||||
VSShader *vshader = shaderManager_->ApplyShader(false, false, dec_, decOptions_.expandAllWeightsToFloat, true, pipelineState_);
|
||||
|
||||
if (result.action == SW_DRAW_PRIMITIVES) {
|
||||
if (result.action == SW_DRAW_INDEXED) {
|
||||
if (result.setStencil) {
|
||||
dxstate.stencilFunc.set(D3DCMP_ALWAYS);
|
||||
dxstate.stencilRef.set(result.stencilValue);
|
||||
|
@ -393,11 +393,7 @@ void DrawEngineDX9::DoFlush() {
|
|||
// Might help for text drawing.
|
||||
|
||||
device_->SetVertexDeclaration(transformedVertexDecl_);
|
||||
if (result.drawIndexed) {
|
||||
device_->DrawIndexedPrimitiveUP(d3d_prim[prim], 0, numDecodedVerts_, D3DPrimCount(d3d_prim[prim], result.drawNumTrans), inds, D3DFMT_INDEX16, result.drawBuffer, sizeof(TransformedVertex));
|
||||
} else {
|
||||
device_->DrawPrimitiveUP(d3d_prim[prim], D3DPrimCount(d3d_prim[prim], result.drawNumTrans), result.drawBuffer, sizeof(TransformedVertex));
|
||||
}
|
||||
device_->DrawIndexedPrimitiveUP(d3d_prim[prim], 0, numDecodedVerts_, D3DPrimCount(d3d_prim[prim], result.drawNumTrans), inds, D3DFMT_INDEX16, result.drawBuffer, sizeof(TransformedVertex));
|
||||
} else if (result.action == SW_CLEAR) {
|
||||
u32 clearColor = result.color;
|
||||
float clearDepth = result.depth;
|
||||
|
|
|
@ -415,18 +415,12 @@ void DrawEngineGLES::DoFlush() {
|
|||
goto bail;
|
||||
}
|
||||
|
||||
if (result.action == SW_DRAW_PRIMITIVES) {
|
||||
if (result.drawIndexed) {
|
||||
vertexBufferOffset = (uint32_t)frameData.pushVertex->Push(result.drawBuffer, numDecodedVerts_ * sizeof(TransformedVertex), 4, &vertexBuffer);
|
||||
indexBufferOffset = (uint32_t)frameData.pushIndex->Push(inds, sizeof(uint16_t) * result.drawNumTrans, 2, &indexBuffer);
|
||||
render_->DrawIndexed(
|
||||
softwareInputLayout_, vertexBuffer, vertexBufferOffset, indexBuffer, indexBufferOffset,
|
||||
glprim[prim], result.drawNumTrans, GL_UNSIGNED_SHORT);
|
||||
} else {
|
||||
vertexBufferOffset = (uint32_t)frameData.pushVertex->Push(result.drawBuffer, result.drawNumTrans * sizeof(TransformedVertex), 4, &vertexBuffer);
|
||||
render_->Draw(
|
||||
softwareInputLayout_, vertexBuffer, vertexBufferOffset, glprim[prim], 0, result.drawNumTrans);
|
||||
}
|
||||
if (result.action == SW_DRAW_INDEXED) {
|
||||
vertexBufferOffset = (uint32_t)frameData.pushVertex->Push(result.drawBuffer, numDecodedVerts_ * sizeof(TransformedVertex), 4, &vertexBuffer);
|
||||
indexBufferOffset = (uint32_t)frameData.pushIndex->Push(inds, sizeof(uint16_t) * result.drawNumTrans, 2, &indexBuffer);
|
||||
render_->DrawIndexed(
|
||||
softwareInputLayout_, vertexBuffer, vertexBufferOffset, indexBuffer, indexBufferOffset,
|
||||
glprim[prim], result.drawNumTrans, GL_UNSIGNED_SHORT);
|
||||
} else if (result.action == SW_CLEAR) {
|
||||
u32 clearColor = result.color;
|
||||
float clearDepth = result.depth;
|
||||
|
|
|
@ -448,7 +448,7 @@ void DrawEngineVulkan::DoFlush() {
|
|||
|
||||
// Only here, where we know whether to clear or to draw primitives, should we actually set the current framebuffer! Because that gives use the opportunity
|
||||
// to use a "pre-clear" render pass, for high efficiency on tilers.
|
||||
if (result.action == SW_DRAW_PRIMITIVES) {
|
||||
if (result.action == SW_DRAW_INDEXED) {
|
||||
if (textureNeedsApply) {
|
||||
gstate_c.pixelMapped = result.pixelMapped;
|
||||
textureCache_->ApplyTexture();
|
||||
|
@ -525,16 +525,10 @@ void DrawEngineVulkan::DoFlush() {
|
|||
|
||||
PROFILE_THIS_SCOPE("renderman_q");
|
||||
|
||||
if (result.drawIndexed) {
|
||||
VkBuffer vbuf, ibuf;
|
||||
vbOffset = (uint32_t)pushVertex_->Push(result.drawBuffer, numDecodedVerts_ * sizeof(TransformedVertex), 4, &vbuf);
|
||||
ibOffset = (uint32_t)pushIndex_->Push(inds, sizeof(short) * result.drawNumTrans, 4, &ibuf);
|
||||
renderManager->DrawIndexed(descSetIndex, ARRAY_SIZE(dynamicUBOOffsets), dynamicUBOOffsets, vbuf, vbOffset, ibuf, ibOffset, result.drawNumTrans, 1);
|
||||
} else {
|
||||
VkBuffer vbuf;
|
||||
vbOffset = (uint32_t)pushVertex_->Push(result.drawBuffer, result.drawNumTrans * sizeof(TransformedVertex), 4, &vbuf);
|
||||
renderManager->Draw(descSetIndex, ARRAY_SIZE(dynamicUBOOffsets), dynamicUBOOffsets, vbuf, vbOffset, result.drawNumTrans);
|
||||
}
|
||||
VkBuffer vbuf, ibuf;
|
||||
vbOffset = (uint32_t)pushVertex_->Push(result.drawBuffer, numDecodedVerts_ * sizeof(TransformedVertex), 4, &vbuf);
|
||||
ibOffset = (uint32_t)pushIndex_->Push(inds, sizeof(short) * result.drawNumTrans, 4, &ibuf);
|
||||
renderManager->DrawIndexed(descSetIndex, ARRAY_SIZE(dynamicUBOOffsets), dynamicUBOOffsets, vbuf, vbOffset, ibuf, ibOffset, result.drawNumTrans, 1);
|
||||
} else if (result.action == SW_CLEAR) {
|
||||
// Note: we won't get here if the clear is alpha but not color, or color but not alpha.
|
||||
bool clearColor = gstate.isClearModeColorMask();
|
||||
|
|
Loading…
Add table
Reference in a new issue