DrawEngineCommon: Rename decoded to decoded_

This commit is contained in:
Henrik Rydgård 2023-05-23 16:46:43 +02:00
parent d7ea2ebf8a
commit d51d1413a3
9 changed files with 42 additions and 42 deletions

View file

@ -41,12 +41,12 @@ DrawEngineCommon::DrawEngineCommon() : decoderMap_(16) {
}
transformed = (TransformedVertex *)AllocateMemoryPages(TRANSFORMED_VERTEX_BUFFER_SIZE, MEM_PROT_READ | MEM_PROT_WRITE);
transformedExpanded = (TransformedVertex *)AllocateMemoryPages(3 * TRANSFORMED_VERTEX_BUFFER_SIZE, MEM_PROT_READ | MEM_PROT_WRITE);
decoded = (u8 *)AllocateMemoryPages(DECODED_VERTEX_BUFFER_SIZE, MEM_PROT_READ | MEM_PROT_WRITE);
decoded_ = (u8 *)AllocateMemoryPages(DECODED_VERTEX_BUFFER_SIZE, MEM_PROT_READ | MEM_PROT_WRITE);
decIndex = (u16 *)AllocateMemoryPages(DECODED_INDEX_BUFFER_SIZE, MEM_PROT_READ | MEM_PROT_WRITE);
}
DrawEngineCommon::~DrawEngineCommon() {
FreeMemoryPages(decoded, DECODED_VERTEX_BUFFER_SIZE);
FreeMemoryPages(decoded_, DECODED_VERTEX_BUFFER_SIZE);
FreeMemoryPages(decIndex, DECODED_INDEX_BUFFER_SIZE);
FreeMemoryPages(transformed, TRANSFORMED_VERTEX_BUFFER_SIZE);
FreeMemoryPages(transformedExpanded, 3 * TRANSFORMED_VERTEX_BUFFER_SIZE);
@ -255,8 +255,8 @@ void DrawEngineCommon::DispatchSubmitImm(GEPrimitiveType prim, TransformedVertex
// It does the simplest and safest test possible: If all points of a bbox is outside a single of
// our clipping planes, we reject the box. Tighter bounds would be desirable but would take more calculations.
bool DrawEngineCommon::TestBoundingBox(const void *control_points, const void *inds, int vertexCount, u32 vertType) {
SimpleVertex *corners = (SimpleVertex *)(decoded + 65536 * 12);
float *verts = (float *)(decoded + 65536 * 18);
SimpleVertex *corners = (SimpleVertex *)(decoded_ + 65536 * 12);
float *verts = (float *)(decoded_ + 65536 * 18);
// Although this may lead to drawing that shouldn't happen, the viewport is more complex on VR.
// Let's always say objects are within bounds.
@ -279,7 +279,7 @@ bool DrawEngineCommon::TestBoundingBox(const void *control_points, const void *i
}
} else {
// Simplify away indices, bones, and morph before proceeding.
u8 *temp_buffer = decoded + 65536 * 24;
u8 *temp_buffer = decoded_ + 65536 * 24;
int vertexSize = 0;
u16 indexLowerBound = 0;
@ -849,7 +849,7 @@ void DrawEngineCommon::SubmitPrim(const void *verts, const void *inds, GEPrimiti
vertexCountInDrawCalls_ += vertexCount;
if (decOptions_.applySkinInDecode && (vertTypeID & GE_VTYPE_WEIGHT_MASK)) {
DecodeVertsStep(decoded, decodeCounter_, decodedVerts_);
DecodeVertsStep(decoded_, decodeCounter_, decodedVerts_);
decodeCounter_++;
}

View file

@ -185,7 +185,7 @@ protected:
bool everUsedExactEqualDepth_ = false;
// Vertex collector buffers
u8 *decoded = nullptr;
u8 *decoded_ = nullptr;
u16 *decIndex = nullptr;
// Cached vertex decoders

View file

@ -498,7 +498,7 @@ void DrawEngineCommon::SubmitCurve(const void *control_points, const void *indic
if (surface.num_points_u < 4 || surface.num_points_v < 4)
return;
SimpleBufferManager managedBuf(decoded, DECODED_VERTEX_BUFFER_SIZE / 2);
SimpleBufferManager managedBuf(decoded_, DECODED_VERTEX_BUFFER_SIZE / 2);
int num_points = surface.num_points_u * surface.num_points_v;
u16 index_lower_bound = 0;
@ -544,7 +544,7 @@ void DrawEngineCommon::SubmitCurve(const void *control_points, const void *indic
points[idx] = simplified_control_points + (indices ? ConvertIndex(idx) : idx);
OutputBuffers output;
output.vertices = (SimpleVertex *)(decoded + DECODED_VERTEX_BUFFER_SIZE / 2);
output.vertices = (SimpleVertex *)(decoded_ + DECODED_VERTEX_BUFFER_SIZE / 2);
output.indices = decIndex;
output.count = 0;

View file

@ -380,7 +380,7 @@ void DrawEngineD3D11::DoFlush() {
vai->minihash = ComputeMiniHash();
vai->status = VertexArrayInfoD3D11::VAI_HASHING;
vai->drawsUntilNextFullHash = 0;
DecodeVerts(decoded); // writes to indexGen
DecodeVerts(decoded_); // writes to indexGen
vai->numVerts = indexGen.VertexCount();
vai->prim = indexGen.Prim();
vai->maxIndex = indexGen.MaxIndex();
@ -405,7 +405,7 @@ void DrawEngineD3D11::DoFlush() {
}
if (newMiniHash != vai->minihash || newHash != vai->hash) {
MarkUnreliable(vai);
DecodeVerts(decoded);
DecodeVerts(decoded_);
goto rotateVBO;
}
if (vai->numVerts > 64) {
@ -424,13 +424,13 @@ void DrawEngineD3D11::DoFlush() {
u32 newMiniHash = ComputeMiniHash();
if (newMiniHash != vai->minihash) {
MarkUnreliable(vai);
DecodeVerts(decoded);
DecodeVerts(decoded_);
goto rotateVBO;
}
}
if (vai->vbo == 0) {
DecodeVerts(decoded);
DecodeVerts(decoded_);
vai->numVerts = indexGen.VertexCount();
vai->prim = indexGen.Prim();
vai->maxIndex = indexGen.MaxIndex();
@ -445,7 +445,7 @@ void DrawEngineD3D11::DoFlush() {
// TODO: Combine these two into one buffer?
u32 size = dec_->GetDecVtxFmt().stride * indexGen.MaxIndex();
D3D11_BUFFER_DESC desc{ size, D3D11_USAGE_IMMUTABLE, D3D11_BIND_VERTEX_BUFFER, 0 };
D3D11_SUBRESOURCE_DATA data{ decoded };
D3D11_SUBRESOURCE_DATA data{ decoded_ };
ASSERT_SUCCESS(device_->CreateBuffer(&desc, &data, &vai->vbo));
if (useElements) {
u32 size = sizeof(short) * indexGen.VertexCount();
@ -496,14 +496,14 @@ void DrawEngineD3D11::DoFlush() {
if (vai->lastFrame != gpuStats.numFlips) {
vai->numFrames++;
}
DecodeVerts(decoded);
DecodeVerts(decoded_);
goto rotateVBO;
}
}
vai->lastFrame = gpuStats.numFlips;
} else {
DecodeVerts(decoded);
DecodeVerts(decoded_);
rotateVBO:
gpuStats.numUncachedVertsDrawn += indexGen.VertexCount();
useElements = !indexGen.SeenOnlyPurePrims() || prim == GE_PRIM_TRIANGLE_FAN;
@ -548,7 +548,7 @@ rotateVBO:
UINT vOffset;
int vSize = (maxIndex + 1) * dec_->GetDecVtxFmt().stride;
uint8_t *vptr = pushVerts_->BeginPush(context_, &vOffset, vSize);
memcpy(vptr, decoded, vSize);
memcpy(vptr, decoded_, vSize);
pushVerts_->EndPush(context_);
ID3D11Buffer *buf = pushVerts_->Buf();
context_->IASetVertexBuffers(0, 1, &buf, &stride, &vOffset);
@ -580,7 +580,7 @@ rotateVBO:
lastVType_ |= (1 << 26);
dec_ = GetVertexDecoder(lastVType_);
}
DecodeVerts(decoded);
DecodeVerts(decoded_);
bool hasColor = (lastVType_ & GE_VTYPE_COL_MASK) != GE_VTYPE_COL_NONE;
if (gstate.isModeThrough()) {
gstate_c.vertexFullAlpha = gstate_c.vertexFullAlpha && (hasColor || gstate.getMaterialAmbientA() == 255);
@ -598,7 +598,7 @@ rotateVBO:
u16 *inds = decIndex;
SoftwareTransformResult result{};
SoftwareTransformParams params{};
params.decoded = decoded;
params.decoded = decoded_;
params.transformed = transformed;
params.transformedExpanded = transformedExpanded;
params.fbman = framebufferManager_;

View file

@ -146,7 +146,7 @@ public:
void FinishDeferred() {
if (!numDrawCalls)
return;
DecodeVerts(decoded);
DecodeVerts(decoded_);
}
void DispatchFlush() override {

View file

@ -361,7 +361,7 @@ void DrawEngineDX9::DoFlush() {
vai->minihash = ComputeMiniHash();
vai->status = VertexArrayInfoDX9::VAI_HASHING;
vai->drawsUntilNextFullHash = 0;
DecodeVerts(decoded); // writes to indexGen
DecodeVerts(decoded_); // writes to indexGen
vai->numVerts = indexGen.VertexCount();
vai->prim = indexGen.Prim();
vai->maxIndex = indexGen.MaxIndex();
@ -387,7 +387,7 @@ void DrawEngineDX9::DoFlush() {
}
if (newMiniHash != vai->minihash || newHash != vai->hash) {
MarkUnreliable(vai);
DecodeVerts(decoded);
DecodeVerts(decoded_);
goto rotateVBO;
}
if (vai->numVerts > 64) {
@ -406,13 +406,13 @@ void DrawEngineDX9::DoFlush() {
u32 newMiniHash = ComputeMiniHash();
if (newMiniHash != vai->minihash) {
MarkUnreliable(vai);
DecodeVerts(decoded);
DecodeVerts(decoded_);
goto rotateVBO;
}
}
if (vai->vbo == 0) {
DecodeVerts(decoded);
DecodeVerts(decoded_);
vai->numVerts = indexGen.VertexCount();
vai->prim = indexGen.Prim();
vai->maxIndex = indexGen.MaxIndex();
@ -428,7 +428,7 @@ void DrawEngineDX9::DoFlush() {
u32 size = dec_->GetDecVtxFmt().stride * indexGen.MaxIndex();
device_->CreateVertexBuffer(size, D3DUSAGE_WRITEONLY, 0, D3DPOOL_DEFAULT, &vai->vbo, NULL);
vai->vbo->Lock(0, size, &pVb, 0);
memcpy(pVb, decoded, size);
memcpy(pVb, decoded_, size);
vai->vbo->Unlock();
if (useElements) {
void * pIb;
@ -481,14 +481,14 @@ void DrawEngineDX9::DoFlush() {
if (vai->lastFrame != gpuStats.numFlips) {
vai->numFrames++;
}
DecodeVerts(decoded);
DecodeVerts(decoded_);
goto rotateVBO;
}
}
vai->lastFrame = gpuStats.numFlips;
} else {
DecodeVerts(decoded);
DecodeVerts(decoded_);
rotateVBO:
gpuStats.numUncachedVertsDrawn += indexGen.VertexCount();
useElements = !indexGen.SeenOnlyPurePrims();
@ -521,9 +521,9 @@ rotateVBO:
device_->SetVertexDeclaration(pHardwareVertexDecl);
if (vb_ == NULL) {
if (useElements) {
device_->DrawIndexedPrimitiveUP(d3d_prim[prim], 0, maxIndex + 1, D3DPrimCount(d3d_prim[prim], vertexCount), decIndex, D3DFMT_INDEX16, decoded, dec_->GetDecVtxFmt().stride);
device_->DrawIndexedPrimitiveUP(d3d_prim[prim], 0, maxIndex + 1, D3DPrimCount(d3d_prim[prim], vertexCount), decIndex, D3DFMT_INDEX16, decoded_, dec_->GetDecVtxFmt().stride);
} else {
device_->DrawPrimitiveUP(d3d_prim[prim], D3DPrimCount(d3d_prim[prim], vertexCount), decoded, dec_->GetDecVtxFmt().stride);
device_->DrawPrimitiveUP(d3d_prim[prim], D3DPrimCount(d3d_prim[prim], vertexCount), decoded_, dec_->GetDecVtxFmt().stride);
}
} else {
device_->SetStreamSource(0, vb_, 0, dec_->GetDecVtxFmt().stride);
@ -543,7 +543,7 @@ rotateVBO:
lastVType_ |= (1 << 26);
dec_ = GetVertexDecoder(lastVType_);
}
DecodeVerts(decoded);
DecodeVerts(decoded_);
bool hasColor = (lastVType_ & GE_VTYPE_COL_MASK) != GE_VTYPE_COL_NONE;
if (gstate.isModeThrough()) {
gstate_c.vertexFullAlpha = gstate_c.vertexFullAlpha && (hasColor || gstate.getMaterialAmbientA() == 255);
@ -561,7 +561,7 @@ rotateVBO:
u16 *inds = decIndex;
SoftwareTransformResult result{};
SoftwareTransformParams params{};
params.decoded = decoded;
params.decoded = decoded_;
params.transformed = transformed;
params.transformedExpanded = transformedExpanded;
params.fbman = framebufferManager_;

View file

@ -136,7 +136,7 @@ public:
void FinishDeferred() {
if (!numDrawCalls)
return;
DecodeVerts(decoded);
DecodeVerts(decoded_);
}
void DispatchFlush() override {

View file

@ -226,7 +226,7 @@ GLRInputLayout *DrawEngineGLES::SetupDecFmtForDraw(LinkedShader *program, const
}
void *DrawEngineGLES::DecodeVertsToPushBuffer(GLPushBuffer *push, uint32_t *bindOffset, GLRBuffer **buf) {
u8 *dest = decoded;
u8 *dest = decoded_;
// Figure out how much pushbuffer space we need to allocate.
if (push) {
@ -288,10 +288,10 @@ void DrawEngineGLES::DoFlush() {
bool useElements = true;
if (decOptions_.applySkinInDecode && (lastVType_ & GE_VTYPE_WEIGHT_MASK)) {
// If software skinning, we've already predecoded into "decoded". So push that content.
// If software skinning, we've already predecoded into "decoded_". So push that content.
uint32_t size = decodedVerts_ * dec_->GetDecVtxFmt().stride;
u8 *dest = (u8 *)frameData.pushVertex->Allocate(size, 4, &vertexBuffer, &vertexBufferOffset);
memcpy(dest, decoded, size);
memcpy(dest, decoded_, size);
} else {
// Decode directly into the pushbuffer
u8 *dest = (u8 *)DecodeVertsToPushBuffer(frameData.pushVertex, &vertexBufferOffset, &vertexBuffer);
@ -347,7 +347,7 @@ void DrawEngineGLES::DoFlush() {
lastVType_ |= (1 << 26);
dec_ = GetVertexDecoder(lastVType_);
}
DecodeVerts(decoded);
DecodeVerts(decoded_);
bool hasColor = (lastVType_ & GE_VTYPE_COL_MASK) != GE_VTYPE_COL_NONE;
if (gstate.isModeThrough()) {
@ -366,7 +366,7 @@ void DrawEngineGLES::DoFlush() {
SoftwareTransformResult result{};
// TODO: Keep this static? Faster than repopulating?
SoftwareTransformParams params{};
params.decoded = decoded;
params.decoded = decoded_;
params.transformed = transformed;
params.transformedExpanded = transformedExpanded;
params.fbman = framebufferManager_;

View file

@ -352,7 +352,7 @@ void DrawEngineVulkan::EndFrame() {
}
void DrawEngineVulkan::DecodeVertsToPushBuffer(VulkanPushBuffer *push, uint32_t *bindOffset, VkBuffer *vkbuf) {
u8 *dest = decoded;
u8 *dest = decoded_;
// Figure out how much pushbuffer space we need to allocate.
if (push) {
@ -363,7 +363,7 @@ void DrawEngineVulkan::DecodeVertsToPushBuffer(VulkanPushBuffer *push, uint32_t
}
void DrawEngineVulkan::DecodeVertsToPushPool(VulkanPushPool *push, uint32_t *bindOffset, VkBuffer *vkbuf) {
u8 *dest = decoded;
u8 *dest = decoded_;
// Figure out how much pushbuffer space we need to allocate.
if (push) {
@ -742,7 +742,7 @@ void DrawEngineVulkan::DoFlush() {
// If software skinning, we've already predecoded into "decoded". So push that content.
VkDeviceSize size = decodedVerts_ * dec_->GetDecVtxFmt().stride;
u8 *dest = (u8 *)pushVertex_->Allocate(size, 4, &vbuf, &vbOffset);
memcpy(dest, decoded, size);
memcpy(dest, decoded_, size);
} else {
// Decode directly into the pushbuffer
DecodeVertsToPushPool(pushVertex_, &vbOffset, &vbuf);
@ -841,7 +841,7 @@ void DrawEngineVulkan::DoFlush() {
lastVType_ |= (1 << 26);
dec_ = GetVertexDecoder(lastVType_);
}
DecodeVerts(decoded);
DecodeVerts(decoded_);
bool hasColor = (lastVType_ & GE_VTYPE_COL_MASK) != GE_VTYPE_COL_NONE;
if (gstate.isModeThrough()) {
gstate_c.vertexFullAlpha = gstate_c.vertexFullAlpha && (hasColor || gstate.getMaterialAmbientA() == 255);
@ -858,7 +858,7 @@ void DrawEngineVulkan::DoFlush() {
u16 *inds = decIndex;
SoftwareTransformResult result{};
SoftwareTransformParams params{};
params.decoded = decoded;
params.decoded = decoded_;
params.transformed = transformed;
params.transformedExpanded = transformedExpanded;
params.fbman = framebufferManager_;