get rid of unused Gfx_ApiInfo field

This commit is contained in:
UnknownShadow200 2019-07-22 23:18:54 +10:00
parent 2dc6a143f6
commit f05aece6f1

View File

@ -16,15 +16,6 @@
#define NOIME #define NOIME
struct _GfxData Gfx; struct _GfxData Gfx;
static char Gfx_ApiBuffer[7][STRING_SIZE];
String Gfx_ApiInfo[7] = {
String_FromArray(Gfx_ApiBuffer[0]), String_FromArray(Gfx_ApiBuffer[1]),
String_FromArray(Gfx_ApiBuffer[2]), String_FromArray(Gfx_ApiBuffer[3]),
String_FromArray(Gfx_ApiBuffer[4]), String_FromArray(Gfx_ApiBuffer[5]),
String_FromArray(Gfx_ApiBuffer[6]),
};
GfxResourceID Gfx_defaultIb; GfxResourceID Gfx_defaultIb;
GfxResourceID Gfx_quadVb, Gfx_texVb; GfxResourceID Gfx_quadVb, Gfx_texVb;
@ -303,9 +294,6 @@ static float totalMem;
#define D3D9_SetRenderState(state, value, name) \ #define D3D9_SetRenderState(state, value, name) \
ReturnCode res = IDirect3DDevice9_SetRenderState(device, state, value); if (res) Logger_Abort2(res, name); ReturnCode res = IDirect3DDevice9_SetRenderState(device, state, value); if (res) Logger_Abort2(res, name);
#define D3D9_SetRenderState2(state, value, name) \
res = IDirect3DDevice9_SetRenderState(device, state, value); if (res) Logger_Abort2(res, name);
static void D3D9_RestoreRenderStates(void); static void D3D9_RestoreRenderStates(void);
static void D3D9_FreeResource(GfxResourceID* resource) { static void D3D9_FreeResource(GfxResourceID* resource) {
@ -424,18 +412,18 @@ static void Gfx_RestoreState(void) {
Gfx_InitDefaultResources(); Gfx_InitDefaultResources();
gfx_batchFormat = -1; gfx_batchFormat = -1;
D3D9_SetRenderState(D3DRS_COLORVERTEX, false, "D3D9_ColorVertex"); IDirect3DDevice9_SetRenderState(device, D3DRS_COLORVERTEX, false);
D3D9_SetRenderState2(D3DRS_LIGHTING, false, "D3D9_Lighting"); IDirect3DDevice9_SetRenderState(device, D3DRS_LIGHTING, false);
D3D9_SetRenderState2(D3DRS_SPECULARENABLE, false, "D3D9_SpecularEnable"); IDirect3DDevice9_SetRenderState(device, D3DRS_SPECULARENABLE, false);
D3D9_SetRenderState2(D3DRS_LOCALVIEWER, false, "D3D9_LocalViewer"); IDirect3DDevice9_SetRenderState(device, D3DRS_LOCALVIEWER, false);
D3D9_SetRenderState2(D3DRS_DEBUGMONITORTOKEN, false, "D3D9_DebugMonitor"); IDirect3DDevice9_SetRenderState(device, D3DRS_DEBUGMONITORTOKEN, false);
/* States relevant to the game */ /* States relevant to the game */
D3D9_SetRenderState2(D3DRS_ALPHAFUNC, D3DCMP_GREATER, "D3D9_AlphaTestFunc"); IDirect3DDevice9_SetRenderState(device, D3DRS_ALPHAFUNC, D3DCMP_GREATER);
D3D9_SetRenderState2(D3DRS_ALPHAREF, 127, "D3D9_AlphaRefFunc"); IDirect3DDevice9_SetRenderState(device, D3DRS_ALPHAREF, 127);
D3D9_SetRenderState2(D3DRS_SRCBLEND, D3DBLEND_SRCALPHA, "D3D9_AlphaSrcBlend"); IDirect3DDevice9_SetRenderState(device, D3DRS_SRCBLEND, D3DBLEND_SRCALPHA);
D3D9_SetRenderState2(D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA, "D3D9_AlphaDstBlend"); IDirect3DDevice9_SetRenderState(device, D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA);
D3D9_SetRenderState2(D3DRS_ZFUNC, D3DCMP_LESSEQUAL, "D3D9_SetDepthTestFunc"); IDirect3DDevice9_SetRenderState(device, D3DRS_ZFUNC, D3DCMP_LESSEQUAL);
D3D9_RestoreRenderStates(); D3D9_RestoreRenderStates();
} }
@ -566,17 +554,13 @@ void Gfx_SetTexturing(bool enabled) {
} }
void Gfx_EnableMipmaps(void) { void Gfx_EnableMipmaps(void) {
if (Gfx.Mipmaps) { if (!Gfx.Mipmaps) return;
ReturnCode res = IDirect3DDevice9_SetSamplerState(device, 0, D3DSAMP_MIPFILTER, D3DTEXF_LINEAR); IDirect3DDevice9_SetSamplerState(device, 0, D3DSAMP_MIPFILTER, D3DTEXF_LINEAR);
if (res) Logger_Abort2(res, "D3D9_EnableMipmaps");
}
} }
void Gfx_DisableMipmaps(void) { void Gfx_DisableMipmaps(void) {
if (Gfx.Mipmaps) { if (!Gfx.Mipmaps) return;
ReturnCode res = IDirect3DDevice9_SetSamplerState(device, 0, D3DSAMP_MIPFILTER, D3DTEXF_NONE); IDirect3DDevice9_SetSamplerState(device, 0, D3DSAMP_MIPFILTER, D3DTEXF_NONE);
if (res) Logger_Abort2(res, "D3D9_DisableMipmaps");
}
} }
@ -597,7 +581,7 @@ void Gfx_SetFog(bool enabled) {
gfx_fogEnabled = enabled; gfx_fogEnabled = enabled;
if (Gfx.LostContext) return; if (Gfx.LostContext) return;
D3D9_SetRenderState(D3DRS_FOGENABLE, enabled, "D3D9_SetFog"); IDirect3DDevice9_SetRenderState(device, D3DRS_FOGENABLE, enabled);
} }
void Gfx_SetFogCol(PackedCol col) { void Gfx_SetFogCol(PackedCol col) {
@ -605,7 +589,7 @@ void Gfx_SetFogCol(PackedCol col) {
gfx_fogCol = col; gfx_fogCol = col;
if (Gfx.LostContext) return; if (Gfx.LostContext) return;
D3D9_SetRenderState(D3DRS_FOGCOLOR, gfx_fogCol._raw, "D3D9_SetFogColour"); IDirect3DDevice9_SetRenderState(device, D3DRS_FOGCOLOR, gfx_fogCol._raw);
} }
void Gfx_SetFogDensity(float value) { void Gfx_SetFogDensity(float value) {
@ -615,7 +599,7 @@ void Gfx_SetFogDensity(float value) {
if (Gfx.LostContext) return; if (Gfx.LostContext) return;
raw.f = value; raw.f = value;
D3D9_SetRenderState(D3DRS_FOGDENSITY, raw.u, "D3D9_SetFogDensity"); IDirect3DDevice9_SetRenderState(device, D3DRS_FOGDENSITY, raw.u);
} }
void Gfx_SetFogEnd(float value) { void Gfx_SetFogEnd(float value) {
@ -625,7 +609,7 @@ void Gfx_SetFogEnd(float value) {
if (Gfx.LostContext) return; if (Gfx.LostContext) return;
raw.f = value; raw.f = value;
D3D9_SetRenderState(D3DRS_FOGEND, raw.u, "D3D9_SetFogEnd"); IDirect3DDevice9_SetRenderState(device, D3DRS_FOGEND, raw.u);
} }
void Gfx_SetFogMode(FogFunc func) { void Gfx_SetFogMode(FogFunc func) {
@ -635,25 +619,24 @@ void Gfx_SetFogMode(FogFunc func) {
gfx_fogMode = mode; gfx_fogMode = mode;
if (Gfx.LostContext) return; if (Gfx.LostContext) return;
D3D9_SetRenderState(D3DRS_FOGTABLEMODE, mode, "D3D9_SetFogMode"); IDirect3DDevice9_SetRenderState(device, D3DRS_FOGTABLEMODE, mode);
} }
void Gfx_SetAlphaTest(bool enabled) { void Gfx_SetAlphaTest(bool enabled) {
if (gfx_alphaTesting == enabled) return; if (gfx_alphaTesting == enabled) return;
gfx_alphaTesting = enabled; gfx_alphaTesting = enabled;
D3D9_SetRenderState(D3DRS_ALPHATESTENABLE, enabled, "D3D9_SetAlphaTest"); IDirect3DDevice9_SetRenderState(device, D3DRS_ALPHATESTENABLE, enabled);
} }
void Gfx_SetAlphaBlending(bool enabled) { void Gfx_SetAlphaBlending(bool enabled) {
if (gfx_alphaBlending == enabled) return; if (gfx_alphaBlending == enabled) return;
gfx_alphaBlending = enabled; gfx_alphaBlending = enabled;
D3D9_SetRenderState(D3DRS_ALPHABLENDENABLE, enabled, "D3D9_SetAlphaBlending"); IDirect3DDevice9_SetRenderState(device, D3DRS_ALPHABLENDENABLE, enabled);
} }
void Gfx_SetAlphaArgBlend(bool enabled) { void Gfx_SetAlphaArgBlend(bool enabled) {
D3DTEXTUREOP op = enabled ? D3DTOP_MODULATE : D3DTOP_SELECTARG1; D3DTEXTUREOP op = enabled ? D3DTOP_MODULATE : D3DTOP_SELECTARG1;
ReturnCode res = IDirect3DDevice9_SetTextureStageState(device, 0, D3DTSS_ALPHAOP, op); IDirect3DDevice9_SetTextureStageState(device, 0, D3DTSS_ALPHAOP, op);
if (res) Logger_Abort2(res, "D3D9_SetAlphaArgBlend");
} }
void Gfx_ClearCol(PackedCol col) { gfx_clearCol = col; } void Gfx_ClearCol(PackedCol col) { gfx_clearCol = col; }
@ -664,29 +647,29 @@ void Gfx_SetColWriteMask(bool r, bool g, bool b, bool a) {
void Gfx_SetDepthTest(bool enabled) { void Gfx_SetDepthTest(bool enabled) {
gfx_depthTesting = enabled; gfx_depthTesting = enabled;
D3D9_SetRenderState(D3DRS_ZENABLE, enabled, "D3D9_SetDepthTest"); IDirect3DDevice9_SetRenderState(device, D3DRS_ZENABLE, enabled);
} }
void Gfx_SetDepthWrite(bool enabled) { void Gfx_SetDepthWrite(bool enabled) {
gfx_depthWriting = enabled; gfx_depthWriting = enabled;
D3D9_SetRenderState(D3DRS_ZWRITEENABLE, enabled, "D3D9_SetDepthWrite"); IDirect3DDevice9_SetRenderState(device, D3DRS_ZWRITEENABLE, enabled);
} }
static void D3D9_RestoreRenderStates(void) { static void D3D9_RestoreRenderStates(void) {
union IntAndFloat raw; union IntAndFloat raw;
D3D9_SetRenderState(D3DRS_ALPHATESTENABLE, gfx_alphaTesting, "D3D9_AlphaTest"); IDirect3DDevice9_SetRenderState(device, D3DRS_ALPHATESTENABLE, gfx_alphaTesting);
D3D9_SetRenderState2(D3DRS_ALPHABLENDENABLE, gfx_alphaBlending, "D3D9_AlphaBlend"); IDirect3DDevice9_SetRenderState(device, D3DRS_ALPHABLENDENABLE, gfx_alphaBlending);
D3D9_SetRenderState2(D3DRS_FOGENABLE, gfx_fogEnabled, "D3D9_Fog"); IDirect3DDevice9_SetRenderState(device, D3DRS_FOGENABLE, gfx_fogEnabled);
D3D9_SetRenderState2(D3DRS_FOGCOLOR, gfx_fogCol._raw, "gfx_fogColor"); IDirect3DDevice9_SetRenderState(device, D3DRS_FOGCOLOR, gfx_fogCol._raw);
raw.f = gfx_fogDensity; raw.f = gfx_fogDensity;
D3D9_SetRenderState2(D3DRS_FOGDENSITY, raw.u, "gfx_fogDensity"); IDirect3DDevice9_SetRenderState(device, D3DRS_FOGDENSITY, raw.u);
raw.f = gfx_fogEnd; raw.f = gfx_fogEnd;
D3D9_SetRenderState2(D3DRS_FOGEND, raw.u, "gfx_fogEnd"); IDirect3DDevice9_SetRenderState(device, D3DRS_FOGEND, raw.u);
D3D9_SetRenderState2(D3DRS_FOGTABLEMODE, gfx_fogMode, "D3D9_FogMode"); IDirect3DDevice9_SetRenderState(device, D3DRS_FOGTABLEMODE, gfx_fogMode);
D3D9_SetRenderState2(D3DRS_ZENABLE, gfx_depthTesting, "D3D9_DepthTest"); IDirect3DDevice9_SetRenderState(device, D3DRS_ZENABLE, gfx_depthTesting);
D3D9_SetRenderState2(D3DRS_ZWRITEENABLE, gfx_depthWriting, "D3D9_DepthWrite"); IDirect3DDevice9_SetRenderState(device, D3DRS_ZWRITEENABLE, gfx_depthWriting);
} }
@ -818,8 +801,7 @@ void Gfx_LoadMatrix(MatrixType type, struct Matrix* matrix) {
} }
if (Gfx.LostContext) return; if (Gfx.LostContext) return;
res = IDirect3DDevice9_SetTransform(device, matrix_modes[type], (const D3DMATRIX*)matrix); IDirect3DDevice9_SetTransform(device, matrix_modes[type], (const D3DMATRIX*)matrix);
if (res) Logger_Abort2(res, "D3D9_LoadMatrix");
} }
void Gfx_LoadIdentityMatrix(MatrixType type) { void Gfx_LoadIdentityMatrix(MatrixType type) {
@ -829,8 +811,7 @@ void Gfx_LoadIdentityMatrix(MatrixType type) {
} }
if (Gfx.LostContext) return; if (Gfx.LostContext) return;
res = IDirect3DDevice9_SetTransform(device, matrix_modes[type], (const D3DMATRIX*)&Matrix_Identity); IDirect3DDevice9_SetTransform(device, matrix_modes[type], (const D3DMATRIX*)&Matrix_Identity);
if (res) Logger_Abort2(res, "D3D9_LoadIdentityMatrix");
} }
#define d3d9_zN -10000.0f #define d3d9_zN -10000.0f