mirror of
https://github.com/thunderbrewhq/thunderbrew
synced 2025-12-12 11:12:29 +00:00
feat(gx): implement draw calls in d3d backend
This commit is contained in:
parent
34c7593ddb
commit
d869c6d898
4 changed files with 78 additions and 0 deletions
|
|
@ -1,4 +1,5 @@
|
|||
#include "gx/d3d/CGxDeviceD3d.hpp"
|
||||
#include "gx/CGxBatch.hpp"
|
||||
#include "gx/texture/CGxTex.hpp"
|
||||
#include <algorithm>
|
||||
|
||||
|
|
@ -55,6 +56,15 @@ EGxTexFormat CGxDeviceD3d::s_GxTexFmtToUse[] = {
|
|||
GxTex_D24X8,
|
||||
};
|
||||
|
||||
D3DPRIMITIVETYPE CGxDeviceD3d::s_primitiveConversion[] = {
|
||||
D3DPT_POINTLIST, // GxPrim_Points
|
||||
D3DPT_LINELIST, // GxPrim_Lines
|
||||
D3DPT_LINESTRIP, // GxPrim_LineStrip
|
||||
D3DPT_TRIANGLELIST, // GxPrim_Triangles
|
||||
D3DPT_TRIANGLESTRIP, // GxPrim_TriangleStrip
|
||||
D3DPT_TRIANGLEFAN, // GxPrim_TriangleFan
|
||||
};
|
||||
|
||||
EGxTexFormat CGxDeviceD3d::s_tolerableTexFmtMapping[] = {
|
||||
GxTex_Unknown, // GxTex_Unknown
|
||||
GxTex_Argb4444, // GxTex_Abgr8888
|
||||
|
|
@ -347,6 +357,36 @@ void CGxDeviceD3d::DeviceWM(EGxWM wm, uintptr_t param1, uintptr_t param2) {
|
|||
// TODO
|
||||
}
|
||||
|
||||
void CGxDeviceD3d::Draw(CGxBatch* batch, int32_t count) {
|
||||
if (!this->m_context || this->intF5C) {
|
||||
return;
|
||||
}
|
||||
|
||||
this->IStateSync();
|
||||
|
||||
int32_t baseIndex = 0;
|
||||
if (!this->m_caps.int10) {
|
||||
baseIndex = this->m_primVertexFormatBuf[0]->m_index / this->m_primVertexFormatBuf[0]->m_itemSize;
|
||||
}
|
||||
|
||||
if (count) {
|
||||
this->m_d3dDevice->DrawIndexedPrimitive(
|
||||
CGxDeviceD3d::s_primitiveConversion[batch->m_primType],
|
||||
baseIndex,
|
||||
batch->m_minIndex,
|
||||
batch->m_maxIndex - batch->m_minIndex + 1,
|
||||
batch->m_start + (this->m_primIndexBuf->m_index / 2),
|
||||
CGxDevice::PrimCalcCount(batch->m_primType, batch->m_count)
|
||||
);
|
||||
} else {
|
||||
this->m_d3dDevice->DrawPrimitive(
|
||||
CGxDeviceD3d::s_primitiveConversion[batch->m_primType],
|
||||
baseIndex,
|
||||
CGxDevice::PrimCalcCount(batch->m_primType, batch->m_count)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
void CGxDeviceD3d::DsSet(EDeviceState state, uint32_t val) {
|
||||
// TODO
|
||||
}
|
||||
|
|
@ -883,6 +923,10 @@ void CGxDeviceD3d::IShaderCreateVertex(CGxShader* shader) {
|
|||
}
|
||||
}
|
||||
|
||||
void CGxDeviceD3d::IStateSync() {
|
||||
// TODO
|
||||
}
|
||||
|
||||
void CGxDeviceD3d::ITexCreate(CGxTex* texId) {
|
||||
uint32_t width, height, startLevel, endLevel;
|
||||
this->ITexWHDStartEnd(texId, width, height, startLevel, endLevel);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue