mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-09-05 04:05:27 +02:00
Pass the VertexDecoder pointer around
This commit is contained in:
@@ -1038,10 +1038,10 @@ bool DrawEngineCommon::SubmitPrim(const void *verts, const void *inds, GEPrimiti
|
||||
return true;
|
||||
}
|
||||
|
||||
void DrawEngineCommon::DecodeVerts(u8 *dest) {
|
||||
void DrawEngineCommon::DecodeVerts(VertexDecoder *dec, u8 *dest) {
|
||||
// Note that this should be able to continue a partial decode - we don't necessarily start from zero here (although we do most of the time).
|
||||
int i = decodeVertsCounter_;
|
||||
int stride = (int)dec_->GetDecVtxFmt().stride;
|
||||
int stride = (int)dec->GetDecVtxFmt().stride;
|
||||
for (; i < numDrawVerts_; i++) {
|
||||
DeferredVerts &dv = drawVerts_[i];
|
||||
|
||||
@@ -1056,7 +1056,7 @@ void DrawEngineCommon::DecodeVerts(u8 *dest) {
|
||||
}
|
||||
|
||||
// Decode the verts (and at the same time apply morphing/skinning). Simple.
|
||||
dec_->DecodeVerts(dest + numDecodedVerts_ * stride, dv.verts, &dv.uvScale, indexLowerBound, indexUpperBound);
|
||||
dec->DecodeVerts(dest + numDecodedVerts_ * stride, dv.verts, &dv.uvScale, indexLowerBound, indexUpperBound);
|
||||
numDecodedVerts_ += indexUpperBound - indexLowerBound + 1;
|
||||
}
|
||||
decodeVertsCounter_ = i;
|
||||
|
||||
@@ -109,7 +109,7 @@ public:
|
||||
|
||||
void FlushSkin() {
|
||||
if (dec_->skinInDecode) {
|
||||
DecodeVerts(decoded_);
|
||||
DecodeVerts(dec_, decoded_);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -153,7 +153,7 @@ protected:
|
||||
virtual bool UpdateUseHWTessellation(bool enabled) const { return enabled; }
|
||||
void UpdatePlanes();
|
||||
|
||||
void DecodeVerts(u8 *dest);
|
||||
void DecodeVerts(VertexDecoder *dec, u8 *dest);
|
||||
int DecodeInds();
|
||||
|
||||
// Preprocessing for spline/bezier
|
||||
|
||||
@@ -282,7 +282,7 @@ void DrawEngineD3D11::Flush() {
|
||||
int vertexCount;
|
||||
int maxIndex;
|
||||
bool useElements;
|
||||
DecodeVerts(decoded_);
|
||||
DecodeVerts(dec_, decoded_);
|
||||
DecodeIndsAndGetData(&prim, &vertexCount, &maxIndex, &useElements, false);
|
||||
gpuStats.numUncachedVertsDrawn += vertexCount;
|
||||
|
||||
@@ -351,7 +351,7 @@ void DrawEngineD3D11::Flush() {
|
||||
lastVType_ |= (1 << 26);
|
||||
dec_ = GetVertexDecoder(lastVType_);
|
||||
}
|
||||
DecodeVerts(decoded_);
|
||||
DecodeVerts(dec_, decoded_);
|
||||
int vertexCount = DecodeInds();
|
||||
|
||||
bool hasColor = (lastVType_ & GE_VTYPE_COL_MASK) != GE_VTYPE_COL_NONE;
|
||||
|
||||
@@ -80,7 +80,7 @@ public:
|
||||
void Flush() override;
|
||||
|
||||
void FinishDeferred() {
|
||||
DecodeVerts(decoded_);
|
||||
DecodeVerts(dec_, decoded_);
|
||||
}
|
||||
|
||||
void NotifyConfigChanged() override;
|
||||
|
||||
@@ -256,7 +256,7 @@ void DrawEngineDX9::Flush() {
|
||||
int vertexCount;
|
||||
int maxIndex;
|
||||
bool useElements;
|
||||
DecodeVerts(decoded_);
|
||||
DecodeVerts(dec_, decoded_);
|
||||
DecodeIndsAndGetData(&prim, &vertexCount, &maxIndex, &useElements, false);
|
||||
gpuStats.numUncachedVertsDrawn += vertexCount;
|
||||
|
||||
@@ -306,7 +306,7 @@ void DrawEngineDX9::Flush() {
|
||||
lastVType_ |= (1 << 26);
|
||||
dec_ = GetVertexDecoder(lastVType_);
|
||||
}
|
||||
DecodeVerts(decoded_);
|
||||
DecodeVerts(dec_, decoded_);
|
||||
int vertexCount = DecodeInds();
|
||||
|
||||
bool hasColor = (lastVType_ & GE_VTYPE_COL_MASK) != GE_VTYPE_COL_NONE;
|
||||
|
||||
@@ -71,7 +71,7 @@ public:
|
||||
void Flush() override;
|
||||
|
||||
void FinishDeferred() {
|
||||
DecodeVerts(decoded_);
|
||||
DecodeVerts(dec_, decoded_);
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
@@ -274,7 +274,7 @@ void DrawEngineGLES::Flush() {
|
||||
if (vshader->UseHWTransform()) {
|
||||
if (applySkinInDecode_ && (lastVType_ & GE_VTYPE_WEIGHT_MASK)) {
|
||||
// If software skinning, we're predecoding into "decoded". So make sure we're done, then push that content.
|
||||
DecodeVerts(decoded_);
|
||||
DecodeVerts(dec_, decoded_);
|
||||
uint32_t size = numDecodedVerts_ * dec_->GetDecVtxFmt().stride;
|
||||
u8 *dest = (u8 *)frameData.pushVertex->Allocate(size, 4, &vertexBuffer, &vertexBufferOffset);
|
||||
memcpy(dest, decoded_, size);
|
||||
@@ -282,13 +282,13 @@ void DrawEngineGLES::Flush() {
|
||||
// Figure out how much pushbuffer space we need to allocate.
|
||||
int vertsToDecode = ComputeNumVertsToDecode();
|
||||
u8 *dest = (u8 *)frameData.pushVertex->Allocate(vertsToDecode * dec_->GetDecVtxFmt().stride, 4, &vertexBuffer, &vertexBufferOffset);
|
||||
DecodeVerts(dest);
|
||||
DecodeVerts(dec_, dest);
|
||||
}
|
||||
|
||||
int vertexCount;
|
||||
int maxIndex;
|
||||
bool useElements;
|
||||
DecodeVerts(decoded_);
|
||||
DecodeVerts(dec_, decoded_);
|
||||
DecodeIndsAndGetData(&prim, &vertexCount, &maxIndex, &useElements, false);
|
||||
|
||||
if (useElements) {
|
||||
@@ -333,7 +333,7 @@ void DrawEngineGLES::Flush() {
|
||||
lastVType_ |= (1 << 26);
|
||||
dec_ = GetVertexDecoder(lastVType_);
|
||||
}
|
||||
DecodeVerts(decoded_);
|
||||
DecodeVerts(dec_, decoded_);
|
||||
int vertexCount = DecodeInds();
|
||||
|
||||
bool hasColor = (lastVType_ & GE_VTYPE_COL_MASK) != GE_VTYPE_COL_NONE;
|
||||
|
||||
@@ -260,7 +260,7 @@ void DrawEngineVulkan::Flush() {
|
||||
VkBuffer vbuf = VK_NULL_HANDLE;
|
||||
if (applySkinInDecode_ && (lastVType_ & GE_VTYPE_WEIGHT_MASK)) {
|
||||
// If software skinning, we're predecoding into "decoded". So make sure we're done, then push that content.
|
||||
DecodeVerts(decoded_);
|
||||
DecodeVerts(dec_, decoded_);
|
||||
VkDeviceSize size = numDecodedVerts_ * dec_->GetDecVtxFmt().stride;
|
||||
u8 *dest = (u8 *)pushVertex_->Allocate(size, 4, &vbuf, &vbOffset);
|
||||
memcpy(dest, decoded_, size);
|
||||
@@ -269,7 +269,7 @@ void DrawEngineVulkan::Flush() {
|
||||
int vertsToDecode = ComputeNumVertsToDecode();
|
||||
// Decode directly into the pushbuffer
|
||||
u8 *dest = pushVertex_->Allocate(vertsToDecode * dec_->GetDecVtxFmt().stride, 4, &vbuf, &vbOffset);
|
||||
DecodeVerts(dest);
|
||||
DecodeVerts(dec_, dest);
|
||||
}
|
||||
|
||||
int vertexCount;
|
||||
@@ -381,6 +381,7 @@ void DrawEngineVulkan::Flush() {
|
||||
}
|
||||
} else {
|
||||
PROFILE_THIS_SCOPE("soft");
|
||||
|
||||
if (!applySkinInDecode_) {
|
||||
applySkinInDecode_ = true;
|
||||
lastVType_ |= (1 << 26);
|
||||
@@ -388,7 +389,7 @@ void DrawEngineVulkan::Flush() {
|
||||
}
|
||||
int prevDecodedVerts = numDecodedVerts_;
|
||||
|
||||
DecodeVerts(decoded_);
|
||||
DecodeVerts(dec_, decoded_);
|
||||
int vertexCount = DecodeInds();
|
||||
|
||||
bool hasColor = (lastVType_ & GE_VTYPE_COL_MASK) != GE_VTYPE_COL_NONE;
|
||||
|
||||
Reference in New Issue
Block a user