Completely obsolete Gfx_SetTexturing, also fixes chat input background sometimes missing on Direct3D9 backend (Thanks Flux3on)

Issue was introduced in 3e34665941867cb3b7691a3da864923e4366a3b8
This commit is contained in:
UnknownShadow200 2022-09-14 19:08:07 +10:00
parent 21b934a4c6
commit 1787c92ca5
11 changed files with 14 additions and 34 deletions

View File

@ -557,7 +557,6 @@ void Entities_RenderModels(double delta, float t) {
if (!Entities.List[i]) continue;
Entities.List[i]->VTABLE->RenderModel(Entities.List[i], delta, t);
}
Gfx_SetTexturing(false);
Gfx_SetAlphaTest(false);
}
@ -582,7 +581,6 @@ void Entities_RenderNames(void) {
}
}
Gfx_SetTexturing(false);
Gfx_SetAlphaTest(false);
if (hadFog) Gfx_SetFog(true);
}
@ -608,7 +606,6 @@ void Entities_RenderHoveredNames(void) {
}
}
Gfx_SetTexturing(false);
Gfx_SetAlphaTest(false);
Gfx_SetDepthTest(true);
if (hadFog) Gfx_SetFog(true);
@ -690,7 +687,6 @@ void Entities_DrawShadows(void) {
Gfx_SetAlphaArgBlend(false);
Gfx_SetDepthWrite(true);
Gfx_SetAlphaBlending(false);
Gfx_SetTexturing(false);
}

View File

@ -142,7 +142,6 @@ void EnvRenderer_RenderClouds(void) {
Gfx_BindVb(clouds_vb);
Gfx_DrawVb_IndexedTris(clouds_vertices);
Gfx_SetAlphaTest(false);
Gfx_SetTexturing(false);
Gfx_DisableTextureOffset();
}
@ -299,7 +298,6 @@ void EnvRenderer_RenderSkybox(void) {
Gfx_BindVb(skybox_vb);
Gfx_DrawVb_IndexedTris(SKYBOX_COUNT);
Gfx_SetTexturing(false);
Gfx_LoadMatrix(MATRIX_VIEW, &Gfx.View);
Gfx_SetDepthWrite(true);
}
@ -540,7 +538,6 @@ static void RenderBorders(BlockID block, GfxResourceID vb, GfxResourceID tex, in
Gfx_DisableMipmaps();
Gfx_RestoreAlphaState(Blocks.Draw[block]);
Gfx_SetTexturing(false);
}
void EnvRenderer_RenderMapSides(void) {

View File

@ -81,8 +81,8 @@ void Gfx_UpdateTexture(GfxResourceID texId, int x, int y, struct Bitmap* part, i
CC_API void Gfx_BindTexture(GfxResourceID texId);
/* Deletes the given texture, then sets it to 0. */
CC_API void Gfx_DeleteTexture(GfxResourceID* texId);
/* Sets whether texture colour is used when rendering vertices. */
/* NOTE: Mostly useless now. Only Gfx_SetTexturing(false) does anything */
/* NOTE: Completely useless now, and does nothing in all graphics backends */
/* (used to set whether texture colour is used when rendering vertices) */
CC_API void Gfx_SetTexturing(cc_bool enabled);
/* Turns on mipmapping. (if Gfx_Mipmaps is enabled) */
/* NOTE: You must have created textures with mipmaps true for this to work. */

View File

@ -297,8 +297,7 @@ void Gfx_DeleteTexture(GfxResourceID* texId) {
*texId = NULL;
}
void Gfx_SetTexturing(cc_bool enabled) {
}
void Gfx_SetTexturing(cc_bool enabled) { }
/*########################################################################################################################*

View File

@ -386,11 +386,7 @@ void Gfx_BindTexture(GfxResourceID texId) {
void Gfx_DeleteTexture(GfxResourceID* texId) { D3D9_FreeResource(texId); }
void Gfx_SetTexturing(cc_bool enabled) {
if (enabled) return;
cc_result res = IDirect3DDevice9_SetTexture(device, 0, NULL);
if (res) Logger_Abort2(res, "D3D9_SetTexturing");
}
void Gfx_SetTexturing(cc_bool enabled) { }
void Gfx_EnableMipmaps(void) {
if (!Gfx.Mipmaps) return;
@ -512,6 +508,7 @@ void Gfx_SetDepthWrite(cc_bool enabled) {
void Gfx_DepthOnlyRendering(cc_bool depthOnly) {
cc_bool enabled = !depthOnly;
Gfx_SetColWriteMask(enabled, enabled, enabled, enabled);
if (depthOnly) IDirect3DDevice9_SetTexture(device, 0, NULL);
}
static void D3D9_RestoreRenderStates(void) {
@ -627,6 +624,15 @@ void Gfx_SetVertexFormat(VertexFormat fmt) {
if (fmt == gfx_format) return;
gfx_format = fmt;
if (fmt == VERTEX_FORMAT_COLOURED) {
/* it's necessary to unbind the texture, otherwise the alpha from the last bound texture */
/* gets used - because D3DTSS_ALPHAOP texture stage state is still set to D3DTOP_SELECTARG1 */
IDirect3DDevice9_SetTexture(device, 0, NULL);
/* IDirect3DDevice9_SetTextureStageState(device, 0, D3DTSS_COLOROP, fmt == VERTEX_FORMAT_COLOURED ? D3DTOP_DISABLE : D3DTOP_MODULATE); */
/* IDirect3DDevice9_SetTextureStageState(device, 0, D3DTSS_ALPHAOP, fmt == VERTEX_FORMAT_COLOURED ? D3DTOP_DISABLE : D3DTOP_SELECTARG1); */
/* SetTexture(NULL) seems to be enough, not really required to call SetTextureStageState */
}
res = IDirect3DDevice9_SetFVF(device, d3d9_formatMappings[fmt]);
if (res) Logger_Abort2(res, "D3D9_SetVertexFormat");
gfx_stride = strideSizes[fmt];

View File

@ -43,7 +43,6 @@ static void HeldBlockRenderer_RenderModel(void) {
Gfx_RestoreAlphaState(Blocks.Draw[held_block]);
}
Gfx_SetTexturing(false);
Gfx_SetDepthTest(true);
Gfx_SetFaceCulling(false);
}

View File

@ -202,7 +202,6 @@ void MapRenderer_RenderNormal(double delta) {
CheckWeather(delta);
Gfx_SetAlphaTest(false);
Gfx_SetTexturing(false);
#if DEBUG_OCCLUSION
DebugPickedPos();
#endif
@ -297,7 +296,6 @@ void MapRenderer_RenderTranslucent(double delta) {
Gfx_SetAlphaTest(false);
}
Gfx_SetAlphaBlending(false);
Gfx_SetTexturing(false);
}

View File

@ -355,7 +355,6 @@ static void ListScreen_Init(void* screen) {
static void ListScreen_Render(void* screen, double delta) {
Menu_RenderBounds();
Screen_Render2Widgets(screen, delta);
Gfx_SetTexturing(false);
}
static void ListScreen_Free(void* screen) {
@ -416,7 +415,6 @@ void ListScreen_Show(void) {
static void MenuScreen_Render2(void* screen, double delta) {
Menu_RenderBounds();
Screen_Render2Widgets(screen, delta);
Gfx_SetTexturing(false);
}
@ -2160,7 +2158,6 @@ static void MenuInputOverlay_Render(void* screen, double delta) {
if (s->screenMode) Menu_RenderBounds();
Screen_Render2Widgets(screen, delta);
Gfx_SetTexturing(false);
}
static void MenuInputOverlay_Free(void* screen) {
@ -2470,7 +2467,6 @@ static void MenuOptionsScreen_Render(void* screen, double delta) {
w->width + EXTHELP_PAD * 2, w->height + EXTHELP_PAD * 2, tableColor);
Elem_Render(&s->extHelp, delta);
Gfx_SetTexturing(false);
}
static void MenuOptionsScreen_Free(void* screen) {
@ -3422,7 +3418,6 @@ static void TexIdsOverlay_Render(void* screen, double delta) {
Gfx_BindTexture(s->idAtlas.tex.ID);
Gfx_DrawVb_IndexedTris_Range(s->textVertices, offset);
Gfx_SetTexturing(false);
}
static int TexIdsOverlay_KeyDown(void* screen, int key) {

View File

@ -404,7 +404,6 @@ void Particles_Render(float t) {
Custom_Render(t);
Gfx_SetAlphaTest(false);
Gfx_SetTexturing(false);
}
static void Particles_Tick(struct ScheduledTask* task) {

View File

@ -307,7 +307,6 @@ static void HUDScreen_Render(void* screen, double delta) {
}
if (!Gui_GetBlocksWorld()) Elem_Render(&s->hotbar, delta);
Gfx_SetTexturing(false);
}
static void HUDScreen_Free(void* screen) {
@ -703,7 +702,6 @@ static void TabListOverlay_Render(void* screen, double delta) {
}
Texture_Render(&tex);
}
Gfx_SetTexturing(false);
}
static void TabListOverlay_Free(void* screen) {
@ -1327,20 +1325,17 @@ static void ChatScreen_Render(void* screen, double delta) {
if (Game_HideGui && s->grabsInput) {
Elem_Render(&s->input.base, delta);
Gfx_SetTexturing(false);
}
if (Game_HideGui) return;
if (!TabListOverlay_Instance.active && !Gui_GetBlocksWorld()) {
ChatScreen_DrawCrosshairs();
Gfx_SetTexturing(false);
}
if (s->grabsInput && !Gui.ClassicChat) {
ChatScreen_DrawChatBackground(s);
}
ChatScreen_DrawChat(s, delta);
Gfx_SetTexturing(false);
}
static void ChatScreen_Free(void* screen) {
@ -1685,7 +1680,6 @@ static void LoadingScreen_Render(void* screen, double delta) {
offset = Widget_Render2(&s->title, offset);
offset = Widget_Render2(&s->message, offset);
Gfx_SetTexturing(false);
filledWidth = (int)(s->progWidth * s->progress);
Gfx_Draw2DFlat(s->progX, s->progY, s->progWidth,
@ -1936,7 +1930,6 @@ static void DisconnectScreen_Render(void* screen, double delta) {
Gfx_Draw2DGradient(0, 0, WindowInfo.Width, WindowInfo.Height, top, bottom);
Screen_Render2Widgets(screen, delta);
Gfx_SetTexturing(false);
}
static void DisconnectScreen_Free(void* screen) { Game_SetFpsLimit(Game_FpsLimit); }
@ -2139,7 +2132,6 @@ static void TouchScreen_ContextRecreated(void* screen) {
static void TouchScreen_Render(void* screen, double delta) {
if (Gui.InputGrab) return;
Screen_Render2Widgets(screen, delta);
Gfx_SetTexturing(false);
}
static int TouchScreen_PointerDown(void* screen, int id, int x, int y) {

View File

@ -794,7 +794,6 @@ static void TableWidget_Render(void* widget, double delta) {
IsometricDrawer_EndBatch();
if (w->descTex.ID) { Texture_Render(&w->descTex); }
Gfx_SetTexturing(false);
}
static void TableWidget_Free(void* widget) {