mirror of
https://github.com/thunderbrewhq/thunderbrew
synced 2025-04-16 01:55:21 +03:00
feat(gx): set supported texture formats in gx caps
This commit is contained in:
parent
907c3faf8f
commit
9fe6bc9cd6
@ -14,11 +14,9 @@ class CGxCaps {
|
||||
EGxColorFormat m_colorFormat = GxCF_argb;
|
||||
uint32_t m_maxIndex = 0;
|
||||
int32_t m_generateMipMaps = 0;
|
||||
int32_t m_texFmt[GxTexFormats_Last] = { 0 };
|
||||
int32_t m_texTarget[GxTexTargets_Last];
|
||||
uint32_t m_texMaxSize[GxTexTargets_Last];
|
||||
int32_t m_texFmtDxt1 = 0;
|
||||
int32_t m_texFmtDxt3 = 0;
|
||||
int32_t m_texFmtDxt5 = 0;
|
||||
EGxShVS m_vertexShaderTarget = GxShVS_none;
|
||||
EGxShPS m_pixelShaderTarget = GxShPS_none;
|
||||
int32_t m_texFilterTrilinear = 0;
|
||||
|
@ -394,7 +394,7 @@ void GetDefaultTexture(uint32_t height, uint32_t width) {
|
||||
void GetTextureFormats(PIXEL_FORMAT* pixFormat, EGxTexFormat* gxTexFormat, PIXEL_FORMAT preferredFormat, int32_t alphaBits) {
|
||||
switch (preferredFormat) {
|
||||
case PIXEL_DXT1:
|
||||
if (GxCaps().m_texFmtDxt1) {
|
||||
if (GxCaps().m_texFmt[GxTex_Dxt1]) {
|
||||
*gxTexFormat = GxTex_Dxt1;
|
||||
*pixFormat = PIXEL_DXT1;
|
||||
} else if (alphaBits) {
|
||||
@ -408,7 +408,7 @@ void GetTextureFormats(PIXEL_FORMAT* pixFormat, EGxTexFormat* gxTexFormat, PIXEL
|
||||
break;
|
||||
|
||||
case PIXEL_DXT3:
|
||||
if (GxCaps().m_texFmtDxt3) {
|
||||
if (GxCaps().m_texFmt[GxTex_Dxt3]) {
|
||||
*gxTexFormat = GxTex_Dxt3;
|
||||
*pixFormat = PIXEL_DXT3;
|
||||
} else {
|
||||
@ -443,7 +443,7 @@ void GetTextureFormats(PIXEL_FORMAT* pixFormat, EGxTexFormat* gxTexFormat, PIXEL
|
||||
break;
|
||||
|
||||
case PIXEL_DXT5:
|
||||
if (GxCaps().m_texFmtDxt5) {
|
||||
if (GxCaps().m_texFmt[GxTex_Dxt5]) {
|
||||
*gxTexFormat = GxTex_Dxt5;
|
||||
*pixFormat = PIXEL_DXT5;
|
||||
} else {
|
||||
|
@ -480,6 +480,7 @@ int32_t CGxDeviceD3d::ICreateD3dDevice(const CGxFormat& format) {
|
||||
if (SUCCEEDED(this->m_d3d->CreateDevice(0, D3DDEVTYPE_HAL, this->m_hwnd, behaviorFlags, &d3dpp, &this->m_d3dDevice))) {
|
||||
// TODO
|
||||
|
||||
this->m_devAdapterFormat = d3dpp.BackBufferFormat;
|
||||
this->m_context = 1;
|
||||
|
||||
// TODO
|
||||
@ -702,7 +703,22 @@ void CGxDeviceD3d::ISetCaps(const CGxFormat& format) {
|
||||
|
||||
// TODO modify shader targets based on format
|
||||
|
||||
// TODO
|
||||
// Texture formats
|
||||
|
||||
for (int32_t i = 0; i < GxTexFormats_Last; i++) {
|
||||
if (i == GxTex_Unknown) {
|
||||
this->m_caps.m_texFmt[i] = 0;
|
||||
} else {
|
||||
this->m_caps.m_texFmt[i] = this->m_d3d->CheckDeviceFormat(
|
||||
0,
|
||||
D3DDEVTYPE_HAL,
|
||||
this->m_devAdapterFormat,
|
||||
0,
|
||||
D3DRTYPE_TEXTURE,
|
||||
CGxDeviceD3d::s_GxTexFmtToD3dFmt[i]
|
||||
) == D3D_OK;
|
||||
}
|
||||
}
|
||||
|
||||
this->m_caps.m_generateMipMaps = (this->m_d3dCaps.Caps2 & D3DCAPS2_CANAUTOGENMIPMAP) != 0;
|
||||
|
||||
|
@ -218,6 +218,7 @@ class CGxDeviceD3d : public CGxDevice {
|
||||
D3DCAPS9 m_d3dCaps;
|
||||
int32_t m_d3dIsHwDevice = 0;
|
||||
D3DDISPLAYMODE m_desktopDisplayMode;
|
||||
D3DFORMAT m_devAdapterFormat;
|
||||
uint32_t m_deviceStates[DeviceStates_Last];
|
||||
|
||||
// Virtual member functions
|
||||
|
@ -672,9 +672,9 @@ void CGxDeviceGLL::ISetCaps(const CGxFormat& format) {
|
||||
|
||||
this->m_caps.m_generateMipMaps = 1;
|
||||
|
||||
this->m_caps.m_texFmtDxt1 = 1;
|
||||
this->m_caps.m_texFmtDxt3 = 1;
|
||||
this->m_caps.m_texFmtDxt5 = 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;
|
||||
|
||||
this->m_caps.m_vertexShaderTarget = GxShVS_arbvp1;
|
||||
this->m_caps.m_pixelShaderTarget = GxShPS_arbfp1;
|
||||
|
Loading…
Reference in New Issue
Block a user