mirror of
https://github.com/thunderbrewhq/thunderbrew
synced 2025-04-16 01:55:21 +03:00
feat(gx): clean up draw calls across gll and d3d backends
This commit is contained in:
parent
d869c6d898
commit
02ddaa106f
@ -111,7 +111,7 @@ class CGxDevice {
|
||||
virtual void SceneClear(uint32_t, CImVector) {};
|
||||
virtual void XformSetProjection(const C44Matrix&);
|
||||
virtual void XformSetView(const C44Matrix&);
|
||||
virtual void Draw(CGxBatch*, int32_t) {};
|
||||
virtual void Draw(CGxBatch* batch, int32_t indexed) {};
|
||||
virtual void ValidateDraw(CGxBatch*, int32_t);
|
||||
virtual void MasterEnableSet(EGxMasterEnables, int32_t);
|
||||
virtual void PoolSizeSet(CGxPool*, uint32_t) = 0;
|
||||
|
@ -1,8 +1,8 @@
|
||||
#include "gx/Draw.hpp"
|
||||
#include "gx/Device.hpp"
|
||||
|
||||
void GxDraw(CGxBatch* batches, int32_t count) {
|
||||
g_theGxDevicePtr->Draw(batches, count);
|
||||
void GxDraw(CGxBatch* batch, int32_t indexed) {
|
||||
g_theGxDevicePtr->Draw(batch, indexed);
|
||||
}
|
||||
|
||||
void GxSceneClear(uint32_t mask, CImVector color) {
|
||||
|
@ -8,7 +8,7 @@
|
||||
class C3Vector;
|
||||
class CImVector;
|
||||
|
||||
void GxDraw(CGxBatch*, int32_t);
|
||||
void GxDraw(CGxBatch* batch, int32_t indexed);
|
||||
|
||||
void GxSceneClear(uint32_t, CImVector);
|
||||
|
||||
|
@ -357,7 +357,7 @@ void CGxDeviceD3d::DeviceWM(EGxWM wm, uintptr_t param1, uintptr_t param2) {
|
||||
// TODO
|
||||
}
|
||||
|
||||
void CGxDeviceD3d::Draw(CGxBatch* batch, int32_t count) {
|
||||
void CGxDeviceD3d::Draw(CGxBatch* batch, int32_t indexed) {
|
||||
if (!this->m_context || this->intF5C) {
|
||||
return;
|
||||
}
|
||||
@ -369,7 +369,7 @@ void CGxDeviceD3d::Draw(CGxBatch* batch, int32_t count) {
|
||||
baseIndex = this->m_primVertexFormatBuf[0]->m_index / this->m_primVertexFormatBuf[0]->m_itemSize;
|
||||
}
|
||||
|
||||
if (count) {
|
||||
if (indexed) {
|
||||
this->m_d3dDevice->DrawIndexedPrimitive(
|
||||
CGxDeviceD3d::s_primitiveConversion[batch->m_primType],
|
||||
baseIndex,
|
||||
|
@ -230,7 +230,7 @@ class CGxDeviceD3d : public CGxDevice {
|
||||
virtual void DeviceWM(EGxWM wm, uintptr_t param1, uintptr_t param2);
|
||||
virtual void CapsWindowSize(CRect& dst);
|
||||
virtual void CapsWindowSizeInScreenCoords(CRect& dst);
|
||||
virtual void Draw(CGxBatch* batch, int32_t count);
|
||||
virtual void Draw(CGxBatch* batch, int32_t indexed);
|
||||
virtual void PoolSizeSet(CGxPool* pool, uint32_t size);
|
||||
virtual char* BufLock(CGxBuf* buf);
|
||||
virtual int32_t BufUnlock(CGxBuf* buf, uint32_t size);
|
||||
|
@ -334,7 +334,7 @@ int32_t CGxDeviceGLL::DeviceSetFormat(const CGxFormat& format) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
void CGxDeviceGLL::Draw(CGxBatch* batch, int32_t count) {
|
||||
void CGxDeviceGLL::Draw(CGxBatch* batch, int32_t indexed) {
|
||||
if (!this->m_context) {
|
||||
return;
|
||||
}
|
||||
@ -343,28 +343,26 @@ void CGxDeviceGLL::Draw(CGxBatch* batch, int32_t count) {
|
||||
// unk conditional check early return
|
||||
|
||||
this->IStateSync();
|
||||
this->ValidateDraw(batch, count);
|
||||
this->ValidateDraw(batch, indexed);
|
||||
|
||||
int32_t v4 = 0;
|
||||
uint32_t baseIndex = 0;
|
||||
if (!this->m_caps.int10) {
|
||||
baseIndex = this->m_primVertexFormatBuf[0]->m_index / this->m_primVertexFormatBuf[0]->m_itemSize;
|
||||
}
|
||||
|
||||
// TODO
|
||||
// if (!this->unk0[154]) {
|
||||
// v4 = (this->unk6[56] + 24) / (this->unk6[56] + 12);
|
||||
// }
|
||||
|
||||
if (count) {
|
||||
if (indexed) {
|
||||
this->m_glDevice.DrawIndexed(
|
||||
CGxDeviceGLL::s_primitiveConversion[batch->m_primType],
|
||||
batch->m_minIndex,
|
||||
batch->m_maxIndex,
|
||||
v4,
|
||||
batch->m_start + (this->m_primIndexBuf->m_index >> 1),
|
||||
baseIndex,
|
||||
batch->m_start + (this->m_primIndexBuf->m_index / 2),
|
||||
batch->m_count
|
||||
);
|
||||
} else {
|
||||
this->m_glDevice.Draw(
|
||||
CGxDeviceGLL::s_primitiveConversion[batch->m_primType],
|
||||
v4,
|
||||
baseIndex,
|
||||
batch->m_count
|
||||
);
|
||||
}
|
||||
@ -672,6 +670,8 @@ void CGxDeviceGLL::ISetCaps(const CGxFormat& format) {
|
||||
|
||||
this->m_caps.m_generateMipMaps = 1;
|
||||
|
||||
this->m_caps.int10 = 1;
|
||||
|
||||
this->m_caps.m_texFmt[GxTex_Dxt1] = 1;
|
||||
this->m_caps.m_texFmt[GxTex_Dxt3] = 1;
|
||||
this->m_caps.m_texFmt[GxTex_Dxt5] = 1;
|
||||
|
@ -38,7 +38,7 @@ class CGxDeviceGLL : public CGxDevice {
|
||||
virtual void SceneClear(uint32_t, CImVector);
|
||||
virtual void XformSetProjection(const C44Matrix&);
|
||||
virtual void XformSetView(const C44Matrix&);
|
||||
virtual void Draw(CGxBatch*, int32_t);
|
||||
virtual void Draw(CGxBatch* batch, int32_t indexed);
|
||||
virtual void PoolSizeSet(CGxPool*, uint32_t);
|
||||
virtual char* BufLock(CGxBuf*);
|
||||
virtual int32_t BufUnlock(CGxBuf*, uint32_t);
|
||||
|
Loading…
Reference in New Issue
Block a user