Batch #16161 by Yommy: 0 byte-identical, 6 confirmed by peer review. - fn_02089 CRendererDX7::DrawAlphaQueues: logic confirmed by peer review (already on main) - fn_45495 CRendererDX7::FlushRenderList: logic confirmed by peer review (already on main) - fn_45496 CRendererDX7::DrawTopmostQueue: logic confirmed by peer review (already on main) - fn_45497 CRendererDX7::DrawBlendedQueue: logic confirmed by peer review (already on main) - fn_02088 CRendererDX7::DrawDepthSortedQueue: logic confirmed by peer review - fn_02091 CRendererDX7::DrawOpaqueQueues: logic confirmed by peer review (already on main) Peer-reviewed-by: alisonrag, youko Accepted without human review: peers confirmed the logic ("same" ahead by at least 3, with 70% of the votes).
73 lines
2.6 KiB
C++
73 lines
2.6 KiB
C++
#include "Render/DX7/QueuedDrawingDX7.h"
|
|
|
|
#include <algorithm>
|
|
#include <cstdint>
|
|
|
|
// INLINED
|
|
inline bool operator<(const DepthPrimitive& left, const DepthPrimitive& right) {
|
|
if (left.depth < right.depth) {
|
|
return true;
|
|
}
|
|
|
|
if (right.depth < left.depth) {
|
|
return false;
|
|
}
|
|
|
|
return left.depth == right.depth && reinterpret_cast<std::uintptr_t>(left.primitive) < reinterpret_cast<std::uintptr_t>(right.primitive);
|
|
}
|
|
|
|
// OFFSET: 0x0055B0C0
|
|
// FUNCTION: fn_02088
|
|
void CRendererDX7::DrawDepthSortedQueue() {
|
|
std::sort(this->queues.queue_0180.begin(), this->queues.queue_0180.end());
|
|
|
|
for (auto it = this->queues.queue_0180.begin(); it != this->queues.queue_0180.end(); ++it) {
|
|
RenderCommand* command = it->primitive;
|
|
this->BindTexture(static_cast<CTextureDX7*>(command->texture));
|
|
command->Draw(reinterpret_cast<int>(this->device));
|
|
}
|
|
}
|
|
|
|
// OFFSET: 0x0055B9E0
|
|
// FUNCTION: fn_02091
|
|
void CRendererDX7::DrawOpaqueQueues() {
|
|
const auto before = [](const RenderCommand* left, const RenderCommand* right) {
|
|
return reinterpret_cast<std::uintptr_t>(left->texture) < reinterpret_cast<std::uintptr_t>(right->texture);
|
|
};
|
|
|
|
this->device->SetTextureStageState(0, D3DTSS_ADDRESS, D3DTADDRESS_CLAMP);
|
|
std::sort(this->queues.queue_015C.begin(), this->queues.queue_015C.end(), before);
|
|
|
|
for (auto it = this->queues.queue_015C.begin(); it != this->queues.queue_015C.end(); ++it) {
|
|
if (RenderCommand* command = *it) {
|
|
this->BindTexture(static_cast<CTextureDX7*>(command->texture));
|
|
command->Draw(reinterpret_cast<int>(this->device));
|
|
}
|
|
}
|
|
|
|
this->device->SetTextureStageState(0, D3DTSS_ADDRESS, D3DTADDRESS_WRAP);
|
|
std::sort(this->queues.queue_01B0.begin(), this->queues.queue_01B0.end(), before);
|
|
|
|
for (auto it = this->queues.queue_01B0.begin(); it != this->queues.queue_01B0.end(); ++it) {
|
|
if (RenderCommand* command = *it) {
|
|
this->BindTexture(static_cast<CTextureDX7*>(command->texture));
|
|
command->Draw(reinterpret_cast<int>(this->device));
|
|
}
|
|
}
|
|
|
|
this->device->SetTextureStageState(0, D3DTSS_ADDRESS, D3DTADDRESS_CLAMP);
|
|
}
|
|
|
|
// OFFSET: 0x0055BC40
|
|
// FUNCTION: fn_02092
|
|
void CRendererDX7::DrawGroundBaseQueue() {
|
|
std::sort(this->queues.queue_0168.begin(), this->queues.queue_0168.end(), [](const RenderCommand* left, const RenderCommand* right) {
|
|
return reinterpret_cast<std::uintptr_t>(left->texture) < reinterpret_cast<std::uintptr_t>(right->texture);
|
|
});
|
|
|
|
for (auto it = this->queues.queue_0168.begin(); it != this->queues.queue_0168.end(); ++it) {
|
|
RenderCommand* command = *it;
|
|
this->BindTexture(static_cast<CTextureDX7*>(command->texture));
|
|
command->Draw(reinterpret_cast<int>(this->device));
|
|
}
|
|
}
|