huge ass ogl api refactor
idk just screwing around credits lactozilla https://git.srb2.org/Lactozilla/SRB2/-/commit/8df6702bfc0cf9d7f9cdc2470b939d01ee37d50b
This commit is contained in:
1 parent
83de4399fd
commit
7393e752ca
23 files changed
+363
-437
No files matched your search
+2
-1
@@ -469,6 +469,7 @@ if(${SRB2_CONFIG_HWRENDER})
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_cache.c
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_clip.c
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_draw.c
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_gpu.c
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_main.c
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_portal.c
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_md2.c
|
||||
@@ -485,7 +486,7 @@ if(${SRB2_CONFIG_HWRENDER})
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_data.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_defs.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_dll.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_drv.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_gpu.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_glob.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_main.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_portal.c
|
||||
|
||||
+3
-3
@@ -295,7 +295,7 @@ ifdef NOHW
|
||||
else
|
||||
OPTS+=-DHWRENDER
|
||||
OBJS+=$(OBJDIR)/hw_bsp.o $(OBJDIR)/hw_draw.o \
|
||||
$(OBJDIR)/hw_main.o $(OBJDIR)/hw_clip.o $(OBJDIR)/hw_md2.o $(OBJDIR)/hw_cache.o $(OBJDIR)/hw_portal.o\
|
||||
$(OBJDIR)/hw_main.o $(OBJDIR)/hw_gpu.o $(OBJDIR)/hw_clip.o $(OBJDIR)/hw_md2.o $(OBJDIR)/hw_cache.o $(OBJDIR)/hw_portal.o\
|
||||
$(OBJDIR)/hw_md2load.o $(OBJDIR)/hw_md3load.o $(OBJDIR)/hw_model.o $(OBJDIR)/u_list.o $(OBJDIR)/hw_batching.o $(OBJDIR)/hw_shaders.o
|
||||
endif
|
||||
|
||||
@@ -741,7 +741,7 @@ else
|
||||
ifdef SDL
|
||||
ifdef MINGW
|
||||
$(OBJDIR)/r_opengl.o: hardware/r_opengl/r_opengl.c hardware/r_opengl/r_opengl.h \
|
||||
doomdef.h doomtype.h g_state.h m_swap.h hardware/hw_drv.h screen.h \
|
||||
doomdef.h doomtype.h g_state.h m_swap.h hardware/hw_gpu.h screen.h \
|
||||
command.h hardware/hw_data.h hardware/hw_defs.h hardware/hw_md2.h \
|
||||
hardware/hw_glob.h hardware/hw_main.h hardware/hw_clip.h hardware/hw_portal.h\
|
||||
hardware/hw_md2load.h hardware/hw_md3load.h hardware/hw_model.h hardware/u_list.h \
|
||||
@@ -750,7 +750,7 @@ $(OBJDIR)/r_opengl.o: hardware/r_opengl/r_opengl.c hardware/r_opengl/r_opengl.h
|
||||
$(CC) $(CFLAGS) $(WFLAGS) -c $< -o $@
|
||||
else
|
||||
$(OBJDIR)/r_opengl.o: hardware/r_opengl/r_opengl.c hardware/r_opengl/r_opengl.h \
|
||||
doomdef.h doomtype.h g_state.h m_swap.h hardware/hw_drv.h screen.h \
|
||||
doomdef.h doomtype.h g_state.h m_swap.h hardware/hw_gpu.h screen.h \
|
||||
command.h hardware/hw_data.h hardware/hw_defs.h hardware/hw_md2.h \
|
||||
hardware/hw_glob.h hardware/hw_main.h hardware/hw_clip.h hardware/hw_portal.h \
|
||||
hardware/hw_md2load.h hardware/hw_md3load.h hardware/hw_model.h hardware/u_list.h \
|
||||
|
||||
@@ -76,7 +76,7 @@ void HWR_SetCurrentTexture(GLMipmap_t *texture)
|
||||
}
|
||||
else
|
||||
{
|
||||
HWD.pfnSetTexture(texture);
|
||||
GPU->SetTexture(texture);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -130,8 +130,8 @@ void HWR_ProcessPolygon(FSurfaceInfo *pSurf, FOutVector *pOutVerts, FUINT iNumPt
|
||||
}
|
||||
else
|
||||
{
|
||||
HWD.pfnSetShader((shader_target != SHADER_NONE) ? HWR_GetShaderFromTarget(shader_target) : shader_target);
|
||||
HWD.pfnDrawPolygon(pSurf, pOutVerts, iNumPts, PolyFlags);
|
||||
GPU->SetShader((shader_target != SHADER_NONE) ? HWR_GetShaderFromTarget(shader_target) : shader_target);
|
||||
GPU->DrawPolygon(pSurf, pOutVerts, iNumPts, PolyFlags);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -295,13 +295,13 @@ void HWR_RenderBatches(void)
|
||||
|
||||
if (cv_glshaders.value && gl_shadersavailable)
|
||||
{
|
||||
HWD.pfnSetShader(currentShader);
|
||||
GPU->SetShader(currentShader);
|
||||
}
|
||||
|
||||
if (currentPolyFlags & PF_NoTexture)
|
||||
currentTexture = NULL;
|
||||
else
|
||||
HWD.pfnSetTexture(currentTexture);
|
||||
GPU->SetTexture(currentTexture);
|
||||
|
||||
while (1)// note: remember handling notexture polyflag as having texture number 0 (also in comparePolygons)
|
||||
{
|
||||
@@ -417,7 +417,7 @@ void HWR_RenderBatches(void)
|
||||
if (changeState || stopFlag)
|
||||
{
|
||||
// execute draw call
|
||||
HWD.pfnDrawIndexedTriangles(¤tSurfaceInfo, finalVertexArray, finalIndexWritePos, currentPolyFlags, finalVertexIndexArray);
|
||||
GPU->DrawIndexedTriangles(¤tSurfaceInfo, finalVertexArray, finalIndexWritePos, currentPolyFlags, finalVertexIndexArray);
|
||||
// update stats
|
||||
ps_hw_numcalls.value.i++;
|
||||
ps_hw_numverts.value.i += finalIndexWritePos;
|
||||
@@ -435,7 +435,7 @@ void HWR_RenderBatches(void)
|
||||
{
|
||||
if (changeShader)
|
||||
{
|
||||
HWD.pfnSetShader(nextShader);
|
||||
GPU->SetShader(nextShader);
|
||||
currentShader = nextShader;
|
||||
changeShader = false;
|
||||
|
||||
@@ -444,7 +444,7 @@ void HWR_RenderBatches(void)
|
||||
if (changeTexture)
|
||||
{
|
||||
// texture should be already ready for use from calls to SetTexture during batch collection
|
||||
HWD.pfnSetTexture(nextTexture);
|
||||
GPU->SetTexture(nextTexture);
|
||||
currentTexture = nextTexture;
|
||||
changeTexture = false;
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
|
||||
#include "hw_defs.h"
|
||||
#include "hw_data.h"
|
||||
#include "hw_drv.h"
|
||||
#include "hw_gpu.h"
|
||||
|
||||
typedef struct
|
||||
{
|
||||
|
||||
+15
-15
@@ -16,7 +16,7 @@
|
||||
#ifdef HWRENDER
|
||||
#include "hw_main.h"
|
||||
#include "hw_glob.h"
|
||||
#include "hw_drv.h"
|
||||
#include "hw_gpu.h"
|
||||
#include "hw_batching.h"
|
||||
|
||||
#include "../doomstat.h" //gamemode
|
||||
@@ -497,7 +497,7 @@ static void FreeMipmapColormap(INT32 patchnum, void *patch)
|
||||
if (next->data)
|
||||
Z_Free(next->data);
|
||||
next->data = NULL;
|
||||
HWD.pfnDeleteTexture(next);
|
||||
GPU->DeleteTexture(next);
|
||||
|
||||
// Free the old colormap mipmap from memory.
|
||||
free(next);
|
||||
@@ -508,7 +508,7 @@ void HWR_FreeMipmapCache(void)
|
||||
{
|
||||
INT32 i;
|
||||
// free references to the textures
|
||||
HWD.pfnClearMipMapCache();
|
||||
GPU->ClearMipMapCache();
|
||||
|
||||
// free all hardware-converted graphics cached in the heap
|
||||
// our gool is only the textures since user of the texture is the texture cache
|
||||
@@ -575,7 +575,7 @@ GLMapTexture_t *HWR_GetTexture(INT32 tex, boolean noencore)
|
||||
|
||||
// If hardware does not have the texture, then call pfnSetTexture to upload it
|
||||
if (!gltex->mipmap.downloaded)
|
||||
HWD.pfnSetTexture(&gltex->mipmap);
|
||||
GPU->SetTexture(&gltex->mipmap);
|
||||
HWR_SetCurrentTexture(&gltex->mipmap);
|
||||
|
||||
// The system-memory data can be purged now.
|
||||
@@ -663,7 +663,7 @@ void HWR_GetFlat(lumpnum_t flatlumpnum, boolean noencoremap)
|
||||
|
||||
// If hardware does not have the texture, then call pfnSetTexture to upload it
|
||||
if (!glmip->downloaded)
|
||||
HWD.pfnSetTexture(glmip);
|
||||
GPU->SetTexture(glmip);
|
||||
HWR_SetCurrentTexture(glmip);
|
||||
|
||||
// The system-memory data can be purged now.
|
||||
@@ -692,7 +692,7 @@ static void HWR_LoadMappedPatch(GLMipmap_t *glmip, GLPatch_t *gpatch)
|
||||
|
||||
// If hardware does not have the texture, then call pfnSetTexture to upload it
|
||||
if (!glmip->downloaded)
|
||||
HWD.pfnSetTexture(glmip);
|
||||
GPU->SetTexture(glmip);
|
||||
HWR_SetCurrentTexture(glmip);
|
||||
|
||||
// The system-memory data can be purged now.
|
||||
@@ -722,7 +722,7 @@ void HWR_GetPatch(GLPatch_t *gpatch)
|
||||
|
||||
// If hardware does not have the texture, then call pfnSetTexture to upload it
|
||||
if (!gpatch->mipmap->downloaded)
|
||||
HWD.pfnSetTexture(gpatch->mipmap);
|
||||
GPU->SetTexture(gpatch->mipmap);
|
||||
HWR_SetCurrentTexture(gpatch->mipmap);
|
||||
|
||||
// The system-memory patch data can be purged now.
|
||||
@@ -897,7 +897,7 @@ void HWR_GetFadeMask(lumpnum_t fademasklumpnum)
|
||||
if (!glmip->downloaded && !glmip->data)
|
||||
HWR_CacheFadeMask(glmip, fademasklumpnum);
|
||||
|
||||
HWD.pfnSetTexture(glmip);
|
||||
GPU->SetTexture(glmip);
|
||||
|
||||
// The system-memory data can be purged now.
|
||||
Z_ChangeTag(glmip->data, PU_HWRCACHE_UNLOCKED);
|
||||
@@ -930,11 +930,11 @@ void HWR_SetPalette(RGBA_t *palette)
|
||||
crushed_palette[i].s.blue = (UINT8)(fblue / 31.0f * 255.0f);
|
||||
crushed_palette[i].s.alpha = 255;
|
||||
}
|
||||
HWD.pfnSetScreenPalette(crushed_palette);
|
||||
GPU->SetScreenPalette(crushed_palette);
|
||||
}
|
||||
else
|
||||
{
|
||||
HWD.pfnSetScreenPalette(palette);
|
||||
GPU->SetScreenPalette(palette);
|
||||
}
|
||||
|
||||
// this part is responsible for keeping track of the palette OUTSIDE of a level.
|
||||
@@ -944,7 +944,7 @@ void HWR_SetPalette(RGBA_t *palette)
|
||||
else
|
||||
{
|
||||
// set the palette for the textures
|
||||
HWD.pfnSetTexturePalette(palette);
|
||||
GPU->SetPalette(palette);
|
||||
// reset mapPalette so next call to HWR_SetMapPalette will update everything correctly
|
||||
memset(mapPalette, 0, sizeof(mapPalette));
|
||||
// hardware driver will flush there own cache if cache is non paletized
|
||||
@@ -977,7 +977,7 @@ static void HWR_SetPaletteLookup(RGBA_t *palette)
|
||||
}
|
||||
}
|
||||
#undef STEP_SIZE
|
||||
HWD.pfnSetPaletteLookup(lut);
|
||||
GPU->SetPaletteLookup(lut);
|
||||
Z_Free(lut);
|
||||
}
|
||||
|
||||
@@ -1025,7 +1025,7 @@ void HWR_SetMapPalette(void)
|
||||
// in palette rendering mode, this means that all rgba textures now have wrong colors
|
||||
// and the lookup table is outdated
|
||||
HWR_SetPaletteLookup(mapPalette);
|
||||
HWD.pfnSetTexturePalette(mapPalette);
|
||||
GPU->SetPalette(mapPalette);
|
||||
|
||||
if (patchformat == GL_TEXFMT_RGBA || textureformat == GL_TEXFMT_RGBA)
|
||||
{
|
||||
@@ -1048,7 +1048,7 @@ UINT32 HWR_CreateLightTable(UINT8 *lighttable)
|
||||
for (i = 0; i < 256 * 32; i++)
|
||||
hw_lighttable[i] = palette[lighttable[i]];
|
||||
|
||||
id = HWD.pfnCreateLightTable(hw_lighttable);
|
||||
id = GPU->CreateLightTable(hw_lighttable);
|
||||
Z_Free(hw_lighttable);
|
||||
return id;
|
||||
}
|
||||
@@ -1084,7 +1084,7 @@ UINT32 HWR_GetLightTableID(extracolormap_t *colormap)
|
||||
void HWR_ClearLightTables(void)
|
||||
{
|
||||
if (vid.glstate == VID_GL_LIBRARY_LOADED)
|
||||
HWD.pfnClearLightTables();
|
||||
GPU->ClearLightTables();
|
||||
}
|
||||
|
||||
#endif //HWRENDER
|
||||
+21
-21
@@ -20,7 +20,7 @@
|
||||
#ifdef HWRENDER
|
||||
#include "hw_main.h"
|
||||
#include "hw_glob.h"
|
||||
#include "hw_drv.h"
|
||||
#include "hw_gpu.h"
|
||||
|
||||
#include "../m_misc.h" //FIL_WriteFile()
|
||||
#include "../r_draw.h" //viewborderlump
|
||||
@@ -122,7 +122,7 @@ void HWR_DrawPatch(GLPatch_t *gpatch, INT32 x, INT32 y, INT32 option)
|
||||
flags |= PF_ForceWrapY;
|
||||
|
||||
// clip it since it is used for bunny scroll in doom I
|
||||
HWD.pfnDrawPolygon(NULL, v, 4, flags);
|
||||
GPU->DrawPolygon(NULL, v, 4, flags);
|
||||
}
|
||||
|
||||
void HWR_DrawStretchyFixedPatch(GLPatch_t *gpatch, fixed_t x, fixed_t y, fixed_t pscale, fixed_t vscale, INT32 option, const UINT8 *colormap)
|
||||
@@ -303,10 +303,10 @@ void HWR_DrawStretchyFixedPatch(GLPatch_t *gpatch, fixed_t x, fixed_t y, fixed_t
|
||||
else if (alphalevel == 15) Surf.PolyColor.s.alpha = softwaretranstogl_hi[hudtrans];
|
||||
else Surf.PolyColor.s.alpha = softwaretranstogl[10-alphalevel];
|
||||
flags |= PF_Modulated;
|
||||
HWD.pfnDrawPolygon(&Surf, v, 4, flags);
|
||||
GPU->DrawPolygon(&Surf, v, 4, flags);
|
||||
}
|
||||
else
|
||||
HWD.pfnDrawPolygon(NULL, v, 4, flags);
|
||||
GPU->DrawPolygon(NULL, v, 4, flags);
|
||||
}
|
||||
|
||||
void HWR_DrawCroppedPatch(GLPatch_t *gpatch, fixed_t x, fixed_t y, fixed_t pscale, INT32 option, fixed_t sx, fixed_t sy, fixed_t w, fixed_t h)
|
||||
@@ -460,10 +460,10 @@ void HWR_DrawCroppedPatch(GLPatch_t *gpatch, fixed_t x, fixed_t y, fixed_t pscal
|
||||
else if (alphalevel == 15) Surf.PolyColor.s.alpha = softwaretranstogl_hi[cv_translucenthud.value];
|
||||
else Surf.PolyColor.s.alpha = softwaretranstogl[10-alphalevel];
|
||||
flags |= PF_Modulated;
|
||||
HWD.pfnDrawPolygon(&Surf, v, 4, flags);
|
||||
GPU->DrawPolygon(&Surf, v, 4, flags);
|
||||
}
|
||||
else
|
||||
HWD.pfnDrawPolygon(NULL, v, 4, flags);
|
||||
GPU->DrawPolygon(NULL, v, 4, flags);
|
||||
}
|
||||
|
||||
// ==========================================================================
|
||||
@@ -539,7 +539,7 @@ void HWR_DrawFlatFill (INT32 x, INT32 y, INT32 w, INT32 h, lumpnum_t flatlumpnum
|
||||
// BTW, I see we put 0 for PFs, and If I'm right, that
|
||||
// means we take the previous PFs as default
|
||||
// how can we be sure they are ok?
|
||||
HWD.pfnDrawPolygon(NULL, v, 4, PF_NoDepthTest); //PF_Translucent);
|
||||
GPU->DrawPolygon(NULL, v, 4, PF_NoDepthTest); //PF_Translucent);
|
||||
}
|
||||
|
||||
|
||||
@@ -575,10 +575,10 @@ void HWR_FadeScreenMenuBack(UINT16 color, UINT8 strength)
|
||||
|
||||
Surf.LightTableId = HWR_GetLightTableID(NULL);
|
||||
Surf.LightInfo.light_level = strength;
|
||||
HWD.pfnMakeScreenTexture(scr_tex);
|
||||
HWD.pfnSetShader(HWR_GetShaderFromTarget(SHADER_UI_COLORMAP_FADE));
|
||||
HWD.pfnDrawScreenTexture(scr_tex, &Surf, PF_ColorMapped|PF_NoDepthTest);
|
||||
HWD.pfnUnSetShader();
|
||||
GPU->MakeScreenTexture(scr_tex);
|
||||
GPU->SetShader(HWR_GetShaderFromTarget(SHADER_UI_COLORMAP_FADE));
|
||||
GPU->DrawScreenTexture(scr_tex, &Surf, PF_ColorMapped|PF_NoDepthTest);
|
||||
GPU->UnSetShader();
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -602,7 +602,7 @@ void HWR_FadeScreenMenuBack(UINT16 color, UINT8 strength)
|
||||
poly_flags |= PF_Translucent;
|
||||
}
|
||||
|
||||
HWD.pfnDrawPolygon(&Surf, v, 4, poly_flags);
|
||||
GPU->DrawPolygon(&Surf, v, 4, poly_flags);
|
||||
}
|
||||
|
||||
// Draw the console background with translucency support
|
||||
@@ -629,7 +629,7 @@ void HWR_DrawConsoleBack(UINT32 color, INT32 height)
|
||||
Surf.PolyColor.rgba = UINT2RGBA(color);
|
||||
Surf.PolyColor.s.alpha = 0x80;
|
||||
|
||||
HWD.pfnDrawPolygon(&Surf, v, 4, PF_NoTexture|PF_Modulated|PF_Translucent|PF_NoDepthTest);
|
||||
GPU->DrawPolygon(&Surf, v, 4, PF_NoTexture|PF_Modulated|PF_Translucent|PF_NoDepthTest);
|
||||
}
|
||||
|
||||
|
||||
@@ -785,7 +785,7 @@ void HWR_drawAMline(const fline_t *fl, INT32 color)
|
||||
v2.x = ((float)fl->b.x-(vid.width/2.0f))*(2.0f/vid.width);
|
||||
v2.y = ((float)fl->b.y-(vid.height/2.0f))*(2.0f/vid.height);
|
||||
|
||||
HWD.pfnDraw2DLine(&v1, &v2, color_rgba);
|
||||
GPU->Draw2DLine(&v1, &v2, color_rgba);
|
||||
}
|
||||
|
||||
// -----------------+
|
||||
@@ -879,7 +879,7 @@ void HWR_DrawDiag(INT32 x, INT32 y, INT32 wh, INT32 color)
|
||||
|
||||
Surf.PolyColor = palette[color&0xFF];
|
||||
|
||||
HWD.pfnDrawPolygon(&Surf, v, 4,
|
||||
GPU->DrawPolygon(&Surf, v, 4,
|
||||
PF_Modulated|PF_NoTexture|PF_NoDepthTest);
|
||||
}
|
||||
|
||||
@@ -918,7 +918,7 @@ void HWR_DrawConsoleFill(INT32 x, INT32 y, INT32 w, INT32 h, UINT32 color, INT32
|
||||
clearColour.green = (float)rgbaColour.s.green / 255;
|
||||
clearColour.blue = (float)rgbaColour.s.blue / 255;
|
||||
clearColour.alpha = 1;
|
||||
HWD.pfnClearBuffer(true, false, false, &clearColour);
|
||||
GPU->ClearBuffer(true, false, false, &clearColour);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -989,7 +989,7 @@ void HWR_DrawConsoleFill(INT32 x, INT32 y, INT32 w, INT32 h, UINT32 color, INT32
|
||||
Surf.PolyColor.rgba = UINT2RGBA(color);
|
||||
Surf.PolyColor.s.alpha = 0x80;
|
||||
|
||||
HWD.pfnDrawPolygon(&Surf, v, 4, PF_NoTexture|PF_Modulated|PF_Translucent|PF_NoDepthTest);
|
||||
GPU->DrawPolygon(&Surf, v, 4, PF_NoTexture|PF_Modulated|PF_Translucent|PF_NoDepthTest);
|
||||
}
|
||||
|
||||
// -----------------+
|
||||
@@ -1029,7 +1029,7 @@ void HWR_DrawFill(INT32 x, INT32 y, INT32 w, INT32 h, INT32 color)
|
||||
clearColour.green = (float)rgbaColour.s.green / 255;
|
||||
clearColour.blue = (float)rgbaColour.s.blue / 255;
|
||||
clearColour.alpha = 1;
|
||||
HWD.pfnClearBuffer(true, false, false, &clearColour);
|
||||
GPU->ClearBuffer(true, false, false, &clearColour);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1107,7 +1107,7 @@ void HWR_DrawFill(INT32 x, INT32 y, INT32 w, INT32 h, INT32 color)
|
||||
else Surf.PolyColor.s.alpha = softwaretranstogl[10-alphalevel];
|
||||
}
|
||||
|
||||
HWD.pfnDrawPolygon(&Surf, v, 4, PF_NoTexture|PF_Modulated|PF_Translucent|PF_NoDepthTest);
|
||||
GPU->DrawPolygon(&Surf, v, 4, PF_NoTexture|PF_Modulated|PF_Translucent|PF_NoDepthTest);
|
||||
}
|
||||
|
||||
#ifdef HAVE_PNG
|
||||
@@ -1191,7 +1191,7 @@ UINT8 *HWR_GetScreenshot(void)
|
||||
return NULL;
|
||||
|
||||
// returns 24bit 888 RGB
|
||||
HWD.pfnReadScreenTexture(HWD_SCREENTEXTURE_GENERIC2, (void *)buf);
|
||||
GPU->ReadScreenTexture(HWD_SCREENTEXTURE_GENERIC2, (void *)buf);
|
||||
return buf;
|
||||
}
|
||||
|
||||
@@ -1207,7 +1207,7 @@ boolean HWR_Screenshot(const char *pathname)
|
||||
}
|
||||
|
||||
// returns 24bit 888 RGB
|
||||
HWD.pfnReadScreenTexture(HWD_SCREENTEXTURE_GENERIC2, (void *)buf);
|
||||
GPU->ReadScreenTexture(HWD_SCREENTEXTURE_GENERIC2, (void *)buf);
|
||||
|
||||
#ifdef USE_PNG
|
||||
ret = M_SavePNG(pathname, buf, vid.width, vid.height, NULL);
|
||||
|
||||
@@ -1,142 +0,0 @@
|
||||
// SONIC ROBO BLAST 2
|
||||
//-----------------------------------------------------------------------------
|
||||
// Copyright (C) 1993-1996 by id Software, Inc.
|
||||
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
||||
// Copyright (C) 1999-2019 by Sonic Team Junior.
|
||||
//
|
||||
// This program is free software distributed under the
|
||||
// terms of the GNU General Public License, version 2.
|
||||
// See the 'LICENSE' file for more details.
|
||||
//-----------------------------------------------------------------------------
|
||||
/// \file
|
||||
/// \brief imports/exports for the GPU hardware low-level interface API
|
||||
|
||||
#ifndef __HWR_DRV_H__
|
||||
#define __HWR_DRV_H__
|
||||
|
||||
// this must be here 19991024 by Kin
|
||||
#include "../screen.h"
|
||||
#include "hw_data.h"
|
||||
#include "hw_defs.h"
|
||||
#include "hw_md2.h"
|
||||
|
||||
#include "hw_dll.h"
|
||||
#include "../doomdef.h"
|
||||
|
||||
// ==========================================================================
|
||||
// STANDARD DLL EXPORTS
|
||||
// ==========================================================================
|
||||
|
||||
EXPORT boolean HWRAPI(Init) (void);
|
||||
EXPORT void HWRAPI(SetupGLInfo) (void);
|
||||
EXPORT void HWRAPI(SetTexturePalette) (RGBA_t *ppal);
|
||||
EXPORT void HWRAPI(FinishUpdate) (INT32 waitvbl);
|
||||
EXPORT void HWRAPI(Draw2DLine) (F2DCoord *v1, F2DCoord *v2, RGBA_t Color);
|
||||
EXPORT void HWRAPI(DrawPolygon) (FSurfaceInfo *pSurf, FOutVector *pOutVerts, FUINT iNumPts, FBITFIELD PolyFlags);
|
||||
EXPORT void HWRAPI(DrawIndexedTriangles) (FSurfaceInfo *pSurf, FOutVector *pOutVerts, FUINT iNumPts, FBITFIELD PolyFlags, unsigned int *IndexArray);
|
||||
EXPORT void HWRAPI(SetBlend) (FBITFIELD PolyFlags);
|
||||
EXPORT void HWRAPI(ClearBuffer) (FBOOLEAN ColorMask, FBOOLEAN DepthMask, FBOOLEAN StencilMask, FRGBAFloat *ClearColor);
|
||||
EXPORT void HWRAPI(SetTexture) (GLMipmap_t *TexInfo);
|
||||
EXPORT void HWRAPI(UpdateTexture) (GLMipmap_t *TexInfo);
|
||||
EXPORT void HWRAPI(DeleteTexture) (GLMipmap_t *TexInfo);
|
||||
EXPORT void HWRAPI(ReadScreenTexture) (int tex, UINT16 *dst_data);
|
||||
EXPORT void HWRAPI(GClipRect) (INT32 minx, INT32 miny, INT32 maxx, INT32 maxy, float nearclip, float farclip);
|
||||
EXPORT void HWRAPI(ClearMipMapCache) (void);
|
||||
|
||||
//Hurdler: added for backward compatibility
|
||||
EXPORT void HWRAPI(SetSpecialState) (hwdspecialstate_t IdState, INT32 Value);
|
||||
|
||||
//Hurdler: added for new development
|
||||
|
||||
EXPORT void HWRAPI(DrawModel) (model_t *model, INT32 frameIndex, float duration, float tics, INT32 nextFrameIndex, FTransform *pos, float hscale, float vscale, UINT8 flipped, UINT8 hflipped, FSurfaceInfo *Surface);
|
||||
|
||||
EXPORT void HWRAPI(CreateModelVBOs) (model_t *model);
|
||||
EXPORT void HWRAPI(SetTransform) (FTransform *stransform);
|
||||
EXPORT INT32 HWRAPI(GetTextureUsed) (void);
|
||||
|
||||
EXPORT void HWRAPI(RenderSkyDome) (INT32 tex, INT32 texture_width, INT32 texture_height, FTransform transform);
|
||||
|
||||
EXPORT void HWRAPI(FlushScreenTextures) (void);
|
||||
EXPORT void HWRAPI(DoScreenWipe) (int wipeStart, int wipeEnd);
|
||||
EXPORT void HWRAPI(DrawScreenTexture) (int tex, FSurfaceInfo *surf, FBITFIELD polyflags);
|
||||
EXPORT void HWRAPI(MakeScreenTexture) (int tex);
|
||||
EXPORT void HWRAPI(DrawScreenFinalTexture) (int tex, INT32 width, INT32 height);
|
||||
|
||||
EXPORT void HWRAPI(RenderVhsEffect) (fixed_t upbary, fixed_t downbary, UINT8 updistort, UINT8 downdistort, UINT8 barsize);
|
||||
|
||||
#define SCREENVERTS 10
|
||||
EXPORT void HWRAPI(PostImgRedraw) (float points[SCREENVERTS][SCREENVERTS][2]);
|
||||
|
||||
// jimita
|
||||
EXPORT boolean HWRAPI(InitShaders) (void);
|
||||
EXPORT void HWRAPI(LoadShader) (int slot, char *code, hwdshaderstage_t stage);
|
||||
EXPORT boolean HWRAPI(CompileShader) (int slot);
|
||||
EXPORT void HWRAPI(SetShader) (int slot);
|
||||
EXPORT void HWRAPI(UnSetShader) (void);
|
||||
|
||||
EXPORT void HWRAPI(SetShaderInfo) (hwdshaderinfo_t info, INT32 value);
|
||||
|
||||
EXPORT void HWRAPI(SetPaletteLookup)(UINT8 *lut);
|
||||
EXPORT UINT32 HWRAPI(CreateLightTable)(RGBA_t *hw_lighttable);
|
||||
EXPORT void HWRAPI(ClearLightTables)(void);
|
||||
EXPORT void HWRAPI(SetScreenPalette)(RGBA_t *palette);
|
||||
|
||||
// ==========================================================================
|
||||
// HWR DRIVER OBJECT, FOR CLIENT PROGRAM
|
||||
// ==========================================================================
|
||||
|
||||
#if !defined (_CREATE_DLL_)
|
||||
|
||||
struct hwdriver_s
|
||||
{
|
||||
Init pfnInit;
|
||||
SetupGLInfo pfnSetupGLInfo;
|
||||
SetTexturePalette pfnSetTexturePalette;
|
||||
FinishUpdate pfnFinishUpdate;
|
||||
Draw2DLine pfnDraw2DLine;
|
||||
DrawPolygon pfnDrawPolygon;
|
||||
DrawIndexedTriangles pfnDrawIndexedTriangles;
|
||||
SetBlend pfnSetBlend;
|
||||
ClearBuffer pfnClearBuffer;
|
||||
SetTexture pfnSetTexture;
|
||||
UpdateTexture pfnUpdateTexture;
|
||||
DeleteTexture pfnDeleteTexture;
|
||||
ReadScreenTexture pfnReadScreenTexture;
|
||||
GClipRect pfnGClipRect;
|
||||
ClearMipMapCache pfnClearMipMapCache;
|
||||
SetSpecialState pfnSetSpecialState;
|
||||
DrawModel pfnDrawModel;
|
||||
CreateModelVBOs pfnCreateModelVBOs;
|
||||
SetTransform pfnSetTransform;
|
||||
GetTextureUsed pfnGetTextureUsed;
|
||||
PostImgRedraw pfnPostImgRedraw;
|
||||
FlushScreenTextures pfnFlushScreenTextures;
|
||||
DoScreenWipe pfnDoScreenWipe;
|
||||
DrawScreenTexture pfnDrawScreenTexture;
|
||||
MakeScreenTexture pfnMakeScreenTexture;
|
||||
RenderVhsEffect pfnRenderVhsEffect;
|
||||
DrawScreenFinalTexture pfnDrawScreenFinalTexture;
|
||||
|
||||
RenderSkyDome pfnRenderSkyDome;
|
||||
|
||||
InitShaders pfnInitShaders;
|
||||
LoadShader pfnLoadShader;
|
||||
CompileShader pfnCompileShader;
|
||||
SetShader pfnSetShader;
|
||||
UnSetShader pfnUnSetShader;
|
||||
|
||||
SetShaderInfo pfnSetShaderInfo;
|
||||
|
||||
SetPaletteLookup pfnSetPaletteLookup;
|
||||
CreateLightTable pfnCreateLightTable;
|
||||
ClearLightTables pfnClearLightTables;
|
||||
SetScreenPalette pfnSetScreenPalette;
|
||||
};
|
||||
|
||||
extern struct hwdriver_s hwdriver;
|
||||
|
||||
#define HWD hwdriver
|
||||
|
||||
#endif //not defined _CREATE_DLL_
|
||||
|
||||
#endif //__HWR_DRV_H__
|
||||
@@ -0,0 +1,26 @@
|
||||
// SONIC ROBO BLAST 2
|
||||
//-----------------------------------------------------------------------------
|
||||
// Copyright (C) 2020 by Jaime "Lactozilla" Passos.
|
||||
//
|
||||
// This program is free software distributed under the
|
||||
// terms of the GNU General Public License, version 2.
|
||||
// See the 'LICENSE' file for more details.
|
||||
//-----------------------------------------------------------------------------
|
||||
/// \file hw_gpu.c
|
||||
/// \brief GPU low-level interface API
|
||||
|
||||
#ifdef HWRENDER
|
||||
|
||||
#include "r_opengl/r_opengl.h"
|
||||
|
||||
// ==========================================================================
|
||||
// the hardware driver object
|
||||
// ==========================================================================
|
||||
struct GPURenderingAPI *GPU = NULL;
|
||||
|
||||
void GPUInterface_Load(struct GPURenderingAPI **api)
|
||||
{
|
||||
*api = &GLInterfaceAPI;
|
||||
}
|
||||
|
||||
#endif // HWRENDER
|
||||
@@ -0,0 +1,81 @@
|
||||
// SONIC ROBO BLAST 2
|
||||
//-----------------------------------------------------------------------------
|
||||
// Copyright (C) 2020 by Jaime "Lactozilla" Passos.
|
||||
//
|
||||
// This program is free software distributed under the
|
||||
// terms of the GNU General Public License, version 2.
|
||||
// See the 'LICENSE' file for more details.
|
||||
//-----------------------------------------------------------------------------
|
||||
/// \file hw_gpu.h
|
||||
/// \brief GPU low-level interface API
|
||||
|
||||
#ifndef __HWR_GPU_H__
|
||||
#define __HWR_GPU_H__
|
||||
|
||||
#include "../screen.h"
|
||||
#include "hw_data.h"
|
||||
#include "hw_defs.h"
|
||||
#include "hw_md2.h"
|
||||
|
||||
#define SCREENVERTS 10
|
||||
|
||||
struct GPURenderingAPI
|
||||
{
|
||||
boolean (*Init) (void);
|
||||
void (*FinishUpdate) (INT32 waitvbl);
|
||||
void (*SetupGLInfo) (void);
|
||||
|
||||
void (*SetSpecialState) (hwdspecialstate_t IdState, INT32 Value);
|
||||
void (*SetTransform) (FTransform *stransform);
|
||||
void (*SetBlend) (FBITFIELD PolyFlags);
|
||||
void (*SetPalette) (RGBA_t *palette);
|
||||
void (*ClearBuffer) (FBOOLEAN ColorMask, FBOOLEAN DepthMask, FBOOLEAN StencilMask, FRGBAFloat * ClearColor);
|
||||
|
||||
void (*DrawPolygon) (FSurfaceInfo *pSurf, FOutVector *pOutVerts, FUINT iNumPts, FBITFIELD PolyFlags);
|
||||
void (*DrawIndexedTriangles) (FSurfaceInfo *pSurf, FOutVector *pOutVerts, FUINT iNumPts, FBITFIELD PolyFlags, unsigned int *IndexArray);
|
||||
|
||||
void (*Draw2DLine) (F2DCoord *v1, F2DCoord *v2, RGBA_t Color);
|
||||
void (*DrawModel) (model_t *model, INT32 frameIndex, float duration, float tics, INT32 nextFrameIndex, FTransform *pos, float hscale, float vscale, UINT8 flipped, UINT8 hflipped, FSurfaceInfo *Surface);
|
||||
void (*RenderSkyDome) (INT32 tex, INT32 texture_width, INT32 texture_height, FTransform transform);
|
||||
|
||||
void (*SetTexture) (GLMipmap_t *pTexInfo);
|
||||
void (*UpdateTexture) (GLMipmap_t *pTexInfo);
|
||||
void (*DeleteTexture) (GLMipmap_t *pTexInfo);
|
||||
|
||||
void (*ClearMipMapCache) (void);
|
||||
INT32 (*GetTextureUsed) (void);
|
||||
|
||||
void (*CreateModelVBOs) (model_t *model);
|
||||
|
||||
void (*ReadScreenTexture) (int tex, UINT16 *dst_data);
|
||||
void (*GClipRect) (INT32 minx, INT32 miny, INT32 maxx, INT32 maxy, float nearclip, float farclip);
|
||||
|
||||
void (*MakeScreenTexture) (int tex);
|
||||
void (*FlushScreenTextures) (void);
|
||||
|
||||
void (*DrawScreenTexture)(int tex, FSurfaceInfo *surf, FBITFIELD polyflags);
|
||||
void (*DoScreenWipe) (int wipeStart, int wipeEnd);
|
||||
void (*RenderVhsEffect) (fixed_t upbary, fixed_t downbary, UINT8 updistort, UINT8 downdistort, UINT8 barsize);
|
||||
void (*DrawScreenFinalTexture) (int tex, INT32 width, INT32 height);
|
||||
|
||||
void (*PostImgRedraw) (float points[SCREENVERTS][SCREENVERTS][2]);
|
||||
|
||||
boolean (*InitShaders) (void);
|
||||
void (*LoadShader) (int slot, char *code, hwdshaderstage_t stage);
|
||||
boolean (*CompileShader) (int slot);
|
||||
void (*SetShader) (int slot);
|
||||
void (*UnSetShader) (void);
|
||||
|
||||
void (*SetShaderInfo) (hwdshaderinfo_t info, INT32 value);
|
||||
|
||||
void (*SetPaletteLookup) (UINT8 *lut);
|
||||
UINT32 (*CreateLightTable) (RGBA_t *hw_lighttable);
|
||||
void (*ClearLightTables) (void);
|
||||
void (*SetScreenPalette) (RGBA_t *palette);
|
||||
};
|
||||
|
||||
extern struct GPURenderingAPI *GPU;
|
||||
|
||||
void GPUInterface_Load(struct GPURenderingAPI **api);
|
||||
|
||||
#endif // __HWR_GPU_H__
|
||||
+48
-50
@@ -21,7 +21,7 @@
|
||||
#ifdef HWRENDER
|
||||
#include "hw_main.h"
|
||||
#include "hw_glob.h"
|
||||
#include "hw_drv.h"
|
||||
#include "hw_gpu.h"
|
||||
#include "hw_batching.h"
|
||||
#include "hw_md2.h"
|
||||
#include "hw_clip.h"
|
||||
@@ -64,8 +64,6 @@
|
||||
#define ABS(x) ((x) < 0 ? -(x) : (x))
|
||||
#define SOFTLIGHT(llevel) HWR_ShouldUsePaletteRendering() ? ((llevel) >> LIGHTSEGSHIFT) << LIGHTSEGSHIFT : (llevel)
|
||||
|
||||
struct hwdriver_s hwdriver;
|
||||
|
||||
// false if shaders have not been initialized yet, or if shaders are not available
|
||||
boolean gl_shadersavailable = false;
|
||||
|
||||
@@ -243,7 +241,7 @@ static void CV_screentextures_OnChange(void)
|
||||
CV_SetValue(&cv_glframebuffer, 0);
|
||||
#endif
|
||||
}
|
||||
HWD.pfnSetSpecialState(HWD_SET_SCREEN_TEXTURES, cv_glscreentextures.value);
|
||||
GPU->SetSpecialState(HWD_SET_SCREEN_TEXTURES, cv_glscreentextures.value);
|
||||
M_UpdateOGLMenu();
|
||||
}
|
||||
|
||||
@@ -255,7 +253,7 @@ static void CV_glframebuffer_OnChange(void)
|
||||
CV_SetValue(&cv_glframebuffer, 0);
|
||||
|
||||
if (supportFBO)
|
||||
HWD.pfnSetSpecialState(HWD_SET_FRAMEBUFFER, cv_glframebuffer.value);
|
||||
GPU->SetSpecialState(HWD_SET_FRAMEBUFFER, cv_glframebuffer.value);
|
||||
I_DownSample();
|
||||
RefreshOGLSDLSurface();
|
||||
M_UpdateOGLMenu();
|
||||
@@ -286,13 +284,13 @@ static void CV_gllightdithering_OnChange(void)
|
||||
static void CV_filtermode_OnChange(void)
|
||||
{
|
||||
ONLY_IF_GL_LOADED
|
||||
HWD.pfnSetSpecialState(HWD_SET_TEXTUREFILTERMODE, cv_glfiltermode.value);
|
||||
GPU->SetSpecialState(HWD_SET_TEXTUREFILTERMODE, cv_glfiltermode.value);
|
||||
}
|
||||
|
||||
static void CV_anisotropic_OnChange(void)
|
||||
{
|
||||
ONLY_IF_GL_LOADED
|
||||
HWD.pfnSetSpecialState(HWD_SET_TEXTUREANISOTROPICMODE, cv_glanisotropicmode.value);
|
||||
GPU->SetSpecialState(HWD_SET_TEXTUREANISOTROPICMODE, cv_glanisotropicmode.value);
|
||||
}
|
||||
|
||||
static void CV_glpaletterendering_OnChange(void)
|
||||
@@ -327,7 +325,7 @@ boolean HWR_UseShader(void)
|
||||
|
||||
static void HWR_SetShaderState(void)
|
||||
{
|
||||
HWD.pfnSetSpecialState(HWD_SET_SHADERS, HWR_UseShader() ? 1 : 0);
|
||||
GPU->SetSpecialState(HWD_SET_SHADERS, HWR_UseShader() ? 1 : 0);
|
||||
}
|
||||
|
||||
boolean HWR_ShouldUsePaletteRendering(void)
|
||||
@@ -1157,10 +1155,10 @@ static void HWR_DrawSkyWallList(void)
|
||||
surf.PolyColor.rgba = 0xFFFFFFFF;
|
||||
|
||||
HWR_SetCurrentTexture(NULL);
|
||||
HWD.pfnUnSetShader();
|
||||
GPU->UnSetShader();
|
||||
for (i = 0; i < skyWallVertexArraySize; i++)
|
||||
{
|
||||
//HWD.pfnDrawPolygon(&surf, skyWallVertexArray + i * 4, 4, PF_Occlude|PF_Invisible|PF_NoTexture);
|
||||
//GPU->DrawPolygon(&surf, skyWallVertexArray + i * 4, 4, PF_Occlude|PF_Invisible|PF_NoTexture);
|
||||
HWR_ProcessPolygon(&surf, skyWallVertexArray + i * 4, 4, PF_Occlude|PF_Invisible|PF_NoTexture, SHADER_NONE, false);
|
||||
}
|
||||
}
|
||||
@@ -4269,7 +4267,7 @@ static void HWR_RenderDrawNodes(void)
|
||||
PS_START_TIMING(ps_hw_nodedrawtime);
|
||||
|
||||
// Okay! Let's draw it all! Woo!
|
||||
HWD.pfnSetTransform(&atransform);
|
||||
GPU->SetTransform(&atransform);
|
||||
|
||||
for (i = 0; i < numdrawnodes; i++)
|
||||
{
|
||||
@@ -4965,8 +4963,8 @@ static void HWR_DrawSkyBackground(float fpov)
|
||||
|
||||
HWR_GetTexture(texturetranslation[skytexture], false);
|
||||
if (HWR_UseShader())
|
||||
HWD.pfnSetShader(HWR_GetShaderFromTarget(SHADER_SKY));// sky shader
|
||||
HWD.pfnRenderSkyDome(skytexture, textures[skytexture]->width, textures[skytexture]->height, dometransform);
|
||||
GPU->SetShader(HWR_GetShaderFromTarget(SHADER_SKY));// sky shader
|
||||
GPU->RenderSkyDome(skytexture, textures[skytexture]->width, textures[skytexture]->height, dometransform);
|
||||
}
|
||||
|
||||
|
||||
@@ -4975,12 +4973,12 @@ static void HWR_DrawSkyBackground(float fpov)
|
||||
// -----------------+
|
||||
static inline void HWR_ClearView(void)
|
||||
{
|
||||
HWD.pfnGClipRect((INT32)gl_viewwindowx,
|
||||
GPU->GClipRect((INT32)gl_viewwindowx,
|
||||
(INT32)gl_viewwindowy,
|
||||
(INT32)(gl_viewwindowx + gl_viewwidth),
|
||||
(INT32)(gl_viewwindowy + gl_viewheight),
|
||||
ZCLIP_PLANE, FAR_ZCLIP_DEFAULT);
|
||||
HWD.pfnClearBuffer(false, true, true, NULL);
|
||||
GPU->ClearBuffer(false, true, true, NULL);
|
||||
}
|
||||
|
||||
|
||||
@@ -5002,7 +5000,7 @@ void HWR_SetViewSize(void)
|
||||
gl_baseviewwindowy = 0;
|
||||
gl_baseviewwindowx = 0;
|
||||
|
||||
HWD.pfnFlushScreenTextures();
|
||||
GPU->FlushScreenTextures();
|
||||
}
|
||||
|
||||
// Set view aiming, for the sky dome, the skybox,
|
||||
@@ -5067,7 +5065,7 @@ void HWR_SetTransform(float fpov, player_t *player)
|
||||
atransform.mirrorflip = true;
|
||||
|
||||
// Set transform.
|
||||
HWD.pfnSetTransform(&atransform);
|
||||
GPU->SetTransform(&atransform);
|
||||
}
|
||||
|
||||
void HWR_ClearClipper(void)
|
||||
@@ -5084,8 +5082,8 @@ void HWR_ClearClipper(void)
|
||||
void HWR_SetStencilState(int state, int level)
|
||||
{
|
||||
if (level > -1)
|
||||
HWD.pfnSetSpecialState(HWD_SET_STENCIL_LEVEL, level);
|
||||
HWD.pfnSetSpecialState(HWD_SET_PORTAL_MODE, state);
|
||||
GPU->SetSpecialState(HWD_SET_STENCIL_LEVEL, level);
|
||||
GPU->SetSpecialState(HWD_SET_PORTAL_MODE, state);
|
||||
}
|
||||
|
||||
// Renders the current viewpoint, though takes portal arguments for recursive portals.
|
||||
@@ -5141,7 +5139,7 @@ void HWR_RenderViewpoint(gl_portal_t *rootportal, const float fpov, player_t *pl
|
||||
}
|
||||
|
||||
// Set transform.
|
||||
HWD.pfnSetTransform(&atransform);
|
||||
GPU->SetTransform(&atransform);
|
||||
|
||||
validcount++;
|
||||
|
||||
@@ -5185,7 +5183,7 @@ void HWR_RenderViewpoint(gl_portal_t *rootportal, const float fpov, player_t *pl
|
||||
drewsky = false;
|
||||
HWR_DrawSkyBackground(fpov);
|
||||
HWR_SetStencilState(HWR_STENCIL_NORMAL, 0);
|
||||
HWD.pfnClearBuffer(false, false, true, 0);// clear skywall markings from the stencil buffer
|
||||
GPU->ClearBuffer(false, false, true, 0);// clear skywall markings from the stencil buffer
|
||||
HWR_SetTransform(fpov, player);// restore transform
|
||||
}
|
||||
gl_collect_skywalls = false;
|
||||
@@ -5256,7 +5254,7 @@ static void HWR_RenderFrame(INT32 viewnumber, player_t *player, boolean skybox)
|
||||
|
||||
if (!skybox && cv_glrenderdistance.value)
|
||||
{
|
||||
HWD.pfnGClipRect((INT32)gl_viewwindowx,
|
||||
GPU->GClipRect((INT32)gl_viewwindowx,
|
||||
(INT32)gl_viewwindowy,
|
||||
(INT32)(gl_viewwindowx + gl_viewwidth),
|
||||
(INT32)(gl_viewwindowy + gl_viewheight),
|
||||
@@ -5268,8 +5266,8 @@ static void HWR_RenderFrame(INT32 viewnumber, player_t *player, boolean skybox)
|
||||
HWR_RenderViewpoint(NULL, fpov, player, 0, !skybox);
|
||||
|
||||
// Unset transform and shader
|
||||
HWD.pfnSetTransform(NULL);
|
||||
HWD.pfnUnSetShader();
|
||||
GPU->SetTransform(NULL);
|
||||
GPU->UnSetShader();
|
||||
|
||||
// Run post processor effects
|
||||
if (!skybox)
|
||||
@@ -5277,7 +5275,7 @@ static void HWR_RenderFrame(INT32 viewnumber, player_t *player, boolean skybox)
|
||||
|
||||
// added by Hurdler for correct splitscreen
|
||||
// moved here by hurdler so it works with the new near clipping plane
|
||||
HWD.pfnGClipRect(0, 0, vid.width, vid.height, NZCLIP_PLANE, FAR_ZCLIP_DEFAULT);
|
||||
GPU->GClipRect(0, 0, vid.width, vid.height, NZCLIP_PLANE, FAR_ZCLIP_DEFAULT);
|
||||
}
|
||||
|
||||
// ==========================================================================
|
||||
@@ -5307,20 +5305,20 @@ void HWR_RenderPlayerView(INT32 viewnumber, player_t *player)
|
||||
ClearColor.blue = 0.0f;
|
||||
ClearColor.alpha = 1.0f;
|
||||
|
||||
HWD.pfnClearBuffer(true, false, false, &ClearColor);
|
||||
GPU->ClearBuffer(true, false, false, &ClearColor);
|
||||
}
|
||||
|
||||
if (HWR_UseShader())
|
||||
{
|
||||
if (cv_ripplewater.value)
|
||||
HWD.pfnSetShaderInfo(HWD_SHADERINFO_LEVELTIME, (INT32)leveltime); // The water surface shader needs the leveltime.
|
||||
GPU->SetShaderInfo(HWD_SHADERINFO_LEVELTIME, (INT32)leveltime); // The water surface shader needs the leveltime.
|
||||
const angle_t light_angle = maplighting.angle - viewangle + ANGLE_90; // I fucking hate OGL's coordinate system
|
||||
HWD.pfnSetShaderInfo(HWD_SHADERINFO_LIGHT_X, FINECOSINE(light_angle >> ANGLETOFINESHIFT));
|
||||
HWD.pfnSetShaderInfo(HWD_SHADERINFO_LIGHT_Y, 0);
|
||||
HWD.pfnSetShaderInfo(HWD_SHADERINFO_LIGHT_Z, -FINESINE(light_angle >> ANGLETOFINESHIFT));
|
||||
GPU->SetShaderInfo(HWD_SHADERINFO_LIGHT_X, FINECOSINE(light_angle >> ANGLETOFINESHIFT));
|
||||
GPU->SetShaderInfo(HWD_SHADERINFO_LIGHT_Y, 0);
|
||||
GPU->SetShaderInfo(HWD_SHADERINFO_LIGHT_Z, -FINESINE(light_angle >> ANGLETOFINESHIFT));
|
||||
|
||||
HWD.pfnSetShaderInfo(HWD_SHADERINFO_LIGHT_CONTRAST, maplighting.contrast);
|
||||
HWD.pfnSetShaderInfo(HWD_SHADERINFO_LIGHT_BACKLIGHT, maplighting.backlight);
|
||||
GPU->SetShaderInfo(HWD_SHADERINFO_LIGHT_CONTRAST, maplighting.contrast);
|
||||
GPU->SetShaderInfo(HWD_SHADERINFO_LIGHT_BACKLIGHT, maplighting.backlight);
|
||||
}
|
||||
|
||||
if (viewnumber > 3)
|
||||
@@ -5384,7 +5382,7 @@ static void HWR_TogglePaletteRendering(void)
|
||||
// If the r_opengl "texture palette" stays the same during this switch, these textures
|
||||
// will not be cleared out. However they are still out of date since the
|
||||
// composite texture blending method has changed. Therefore they need to be cleared.
|
||||
HWD.pfnClearMipMapCache();
|
||||
GPU->ClearMipMapCache();
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -5398,7 +5396,7 @@ static void HWR_TogglePaletteRendering(void)
|
||||
// If the r_opengl "texture palette" stays the same during this switch, these textures
|
||||
// will not be cleared out. However they are still out of date since the
|
||||
// composite texture blending method has changed. Therefore they need to be cleared.
|
||||
HWD.pfnClearMipMapCache();
|
||||
GPU->ClearMipMapCache();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5469,11 +5467,11 @@ void HWR_Startup(void)
|
||||
|
||||
#ifdef USE_FBO_OGL
|
||||
if (supportFBO)
|
||||
HWD.pfnSetSpecialState(HWD_SET_FRAMEBUFFER, cv_glframebuffer.value);
|
||||
GPU->SetSpecialState(HWD_SET_FRAMEBUFFER, cv_glframebuffer.value);
|
||||
#endif
|
||||
|
||||
if (msaa)
|
||||
HWD.pfnSetSpecialState(HWD_SET_MSAA, a2c ? 2 : 1);
|
||||
GPU->SetSpecialState(HWD_SET_MSAA, a2c ? 2 : 1);
|
||||
}
|
||||
startupdone = true;
|
||||
}
|
||||
@@ -5487,7 +5485,7 @@ void HWR_Shutdown(void)
|
||||
HWR_FreeExtraSubsectors();
|
||||
HWR_FreeMipmapCache();
|
||||
HWR_FreeTextureCache();
|
||||
HWD.pfnFlushScreenTextures();
|
||||
GPU->FlushScreenTextures();
|
||||
#ifdef USE_FBO_OGL
|
||||
GLFramebuffer_Disable();
|
||||
#endif
|
||||
@@ -5532,12 +5530,12 @@ static void HWR_RenderWall(FOutVector *wallVerts, FSurfaceInfo *pSurf, FBITFIELD
|
||||
|
||||
INT32 HWR_GetTextureUsed(void)
|
||||
{
|
||||
return HWD.pfnGetTextureUsed();
|
||||
return GPU->GetTextureUsed();
|
||||
}
|
||||
|
||||
static void HWR_DoPostProcessor(player_t *player)
|
||||
{
|
||||
HWD.pfnUnSetShader();
|
||||
GPU->UnSetShader();
|
||||
|
||||
// Armageddon Blast Flash!
|
||||
// Could this even be considered postprocessor?
|
||||
@@ -5561,7 +5559,7 @@ static void HWR_DoPostProcessor(player_t *player)
|
||||
|
||||
Surf.PolyColor.s.alpha = 0xc0; // match software mode
|
||||
|
||||
HWD.pfnDrawPolygon(&Surf, v, 4, PF_Modulated|PF_Translucent|PF_NoTexture|PF_NoDepthTest);
|
||||
GPU->DrawPolygon(&Surf, v, 4, PF_Modulated|PF_Translucent|PF_NoTexture|PF_NoDepthTest);
|
||||
}
|
||||
|
||||
if (cv_glscreentextures.value != 2) // screen textures are needed for the rest of the effects
|
||||
@@ -5569,7 +5567,7 @@ static void HWR_DoPostProcessor(player_t *player)
|
||||
|
||||
// Capture the screen for intermission and screen waving
|
||||
if (gamestate != GS_INTERMISSION)
|
||||
HWD.pfnMakeScreenTexture(HWD_SCREENTEXTURE_GENERIC1);
|
||||
GPU->MakeScreenTexture(HWD_SCREENTEXTURE_GENERIC1);
|
||||
|
||||
if (splitscreen) // Not supported in splitscreen - someone want to add support?
|
||||
return;
|
||||
@@ -5609,28 +5607,28 @@ static void HWR_DoPostProcessor(player_t *player)
|
||||
v[x][y][1] = (y/((float)(SCREENVERTS-1.0f)/9.0f))-4.5f;
|
||||
}
|
||||
}
|
||||
HWD.pfnPostImgRedraw(v);
|
||||
GPU->PostImgRedraw(v);
|
||||
|
||||
// Capture the screen again for screen waving on the intermission
|
||||
if (gamestate != GS_INTERMISSION)
|
||||
HWD.pfnMakeScreenTexture(HWD_SCREENTEXTURE_GENERIC1);
|
||||
GPU->MakeScreenTexture(HWD_SCREENTEXTURE_GENERIC1);
|
||||
}
|
||||
// Flipping of the screen isn't done here anymore
|
||||
}
|
||||
|
||||
void HWR_StartScreenWipe(void)
|
||||
{
|
||||
HWD.pfnMakeScreenTexture(HWD_SCREENTEXTURE_WIPE_START);
|
||||
GPU->MakeScreenTexture(HWD_SCREENTEXTURE_WIPE_START);
|
||||
}
|
||||
|
||||
void HWR_EndScreenWipe(void)
|
||||
{
|
||||
HWD.pfnMakeScreenTexture(HWD_SCREENTEXTURE_WIPE_END);
|
||||
GPU->MakeScreenTexture(HWD_SCREENTEXTURE_WIPE_END);
|
||||
}
|
||||
|
||||
void HWR_DrawIntermissionBG(void)
|
||||
{
|
||||
HWD.pfnDrawScreenTexture(HWD_SCREENTEXTURE_GENERIC1, NULL, 0);
|
||||
GPU->DrawScreenTexture(HWD_SCREENTEXTURE_GENERIC1, NULL, 0);
|
||||
}
|
||||
|
||||
void HWR_DoWipe(UINT8 wipenum, UINT8 scrnnum)
|
||||
@@ -5664,22 +5662,22 @@ void HWR_DoWipe(UINT8 wipenum, UINT8 scrnnum)
|
||||
}
|
||||
|
||||
HWR_GetFadeMask(lumpnum);
|
||||
HWD.pfnDoScreenWipe(HWD_SCREENTEXTURE_WIPE_START, HWD_SCREENTEXTURE_WIPE_END);
|
||||
GPU->DoScreenWipe(HWD_SCREENTEXTURE_WIPE_START, HWD_SCREENTEXTURE_WIPE_END);
|
||||
}
|
||||
|
||||
void HWR_RenderVhsEffect(fixed_t upbary, fixed_t downbary, UINT8 updistort, UINT8 downdistort, UINT8 barsize)
|
||||
{
|
||||
HWD.pfnRenderVhsEffect(upbary, downbary, updistort, downdistort, barsize);
|
||||
GPU->RenderVhsEffect(upbary, downbary, updistort, downdistort, barsize);
|
||||
}
|
||||
|
||||
void HWR_MakeScreenFinalTexture(void)
|
||||
{
|
||||
HWD.pfnMakeScreenTexture(HWD_SCREENTEXTURE_GENERIC2);
|
||||
GPU->MakeScreenTexture(HWD_SCREENTEXTURE_GENERIC2);
|
||||
}
|
||||
|
||||
void HWR_DrawScreenFinalTexture(INT32 width, INT32 height)
|
||||
{
|
||||
HWD.pfnDrawScreenFinalTexture(HWD_SCREENTEXTURE_GENERIC2, width, height);
|
||||
GPU->DrawScreenFinalTexture(HWD_SCREENTEXTURE_GENERIC2, width, height);
|
||||
}
|
||||
|
||||
#endif // HWRENDER
|
||||
+10
-10
@@ -25,7 +25,7 @@
|
||||
#include "../doomstat.h"
|
||||
|
||||
#ifdef HWRENDER
|
||||
#include "hw_drv.h"
|
||||
#include "hw_gpu.h"
|
||||
#include "hw_md2.h"
|
||||
#include "../d_main.h"
|
||||
#include "../r_bsp.h"
|
||||
@@ -418,7 +418,7 @@ static void md2_loadTexture(md2_t *model)
|
||||
}
|
||||
}
|
||||
}
|
||||
HWD.pfnSetTexture(glpatch->mipmap);
|
||||
GPU->SetTexture(glpatch->mipmap);
|
||||
HWR_UnlockCachedPatch(glpatch);
|
||||
}
|
||||
|
||||
@@ -468,7 +468,7 @@ static void md2_loadBlendTexture(md2_t *model)
|
||||
glpatch->mipmap->width = (UINT16)w;
|
||||
glpatch->mipmap->height = (UINT16)h;
|
||||
}
|
||||
HWD.pfnSetTexture(glpatch->mipmap); // We do need to do this so that it can be cleared and knows to recreate it when necessary
|
||||
GPU->SetTexture(glpatch->mipmap); // We do need to do this so that it can be cleared and knows to recreate it when necessary
|
||||
HWR_UnlockCachedPatch(glpatch);
|
||||
|
||||
Z_Free(filename);
|
||||
@@ -1049,7 +1049,7 @@ static void HWR_GetBlendedTexture(GLPatch_t *gpatch, GLPatch_t *blendgpatch, INT
|
||||
if (colormap == colormaps || colormap == NULL)
|
||||
{
|
||||
// Don't do any blending
|
||||
HWD.pfnSetTexture(gpatch->mipmap);
|
||||
GPU->SetTexture(gpatch->mipmap);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1062,7 +1062,7 @@ static void HWR_GetBlendedTexture(GLPatch_t *gpatch, GLPatch_t *blendgpatch, INT
|
||||
{
|
||||
if (glmip->downloaded && glmip->data)
|
||||
{
|
||||
HWD.pfnSetTexture(glmip); // found the colormap, set it to the correct texture
|
||||
GPU->SetTexture(glmip); // found the colormap, set it to the correct texture
|
||||
Z_ChangeTag(glmip->data, PU_HWRCACHE_UNLOCKED);
|
||||
return;
|
||||
}
|
||||
@@ -1084,7 +1084,7 @@ static void HWR_GetBlendedTexture(GLPatch_t *gpatch, GLPatch_t *blendgpatch, INT
|
||||
|
||||
HWR_CreateBlendedTexture(gpatch, blendgpatch, newmip, skinnum, color);
|
||||
|
||||
HWD.pfnSetTexture(newmip);
|
||||
GPU->SetTexture(newmip);
|
||||
Z_ChangeTag(newmip->data, PU_HWRCACHE_UNLOCKED);
|
||||
}
|
||||
|
||||
@@ -1236,7 +1236,7 @@ void HWR_DrawMD2(gl_vissprite_t *spr)
|
||||
if (md2->model)
|
||||
{
|
||||
md2_printModelInfo(md2->model);
|
||||
HWD.pfnCreateModelVBOs(md2->model);
|
||||
GPU->CreateModelVBOs(md2->model);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1291,7 +1291,7 @@ void HWR_DrawMD2(gl_vissprite_t *spr)
|
||||
else
|
||||
{
|
||||
// This is safe, since we know the texture has been downloaded
|
||||
HWD.pfnSetTexture(gpatch->mipmap);
|
||||
GPU->SetTexture(gpatch->mipmap);
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -1467,7 +1467,7 @@ void HWR_DrawMD2(gl_vissprite_t *spr)
|
||||
p.mirror = atransform.mirror; // from Kart
|
||||
#endif
|
||||
|
||||
HWD.pfnSetShader(SHADER_MODEL); // model shader
|
||||
GPU->SetShader(SHADER_MODEL); // model shader
|
||||
{
|
||||
SINT8 flipfactor = flip ? -1 : 1;
|
||||
|
||||
@@ -1484,7 +1484,7 @@ void HWR_DrawMD2(gl_vissprite_t *spr)
|
||||
p.y += ox * gl_viewcos;
|
||||
p.z += oy;
|
||||
|
||||
HWD.pfnDrawModel(md2->model, frame, durs, tics, nextFrame, &p, md2->scale * xs, md2->scale * ys, flip, hflip, &Surf);
|
||||
GPU->DrawModel(md2->model, frame, durs, tics, nextFrame, &p, md2->scale * xs, md2->scale * ys, flip, hflip, &Surf);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
#include "../z_zone.h"
|
||||
|
||||
#include "hw_clip.h"
|
||||
#include "hw_drv.h"
|
||||
#include "hw_gpu.h"
|
||||
#include "hw_defs.h"
|
||||
#include "hw_main.h"
|
||||
#include "hw_portal.h"
|
||||
@@ -158,7 +158,7 @@ void HWR_RenderPortalSeg(gl_portal_t* portal, SINT8 state)
|
||||
gl_drawing_stencil = false;
|
||||
// need to work around the r_opengl PF_Invisible bug with this call
|
||||
// similarly as in the linkdraw hack in HWR_DrawSprites
|
||||
HWD.pfnSetBlend(PF_Translucent|PF_Occlude|PF_Masked);
|
||||
GPU->SetBlend(PF_Translucent|PF_Occlude|PF_Masked);
|
||||
}
|
||||
|
||||
// Renders a single portal from the current viewpoint.
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
|
||||
#include "hw_main.h"
|
||||
#include "hw_glob.h"
|
||||
#include "hw_drv.h"
|
||||
#include "hw_gpu.h"
|
||||
#include "hw_shaders.h"
|
||||
#include "../z_zone.h"
|
||||
|
||||
@@ -93,7 +93,7 @@ boolean HWR_InitShaders(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (!HWD.pfnInitShaders())
|
||||
if (!GPU->InitShaders())
|
||||
return false;
|
||||
|
||||
for (i = 0; i < NUMSHADERTARGETS; i++)
|
||||
@@ -372,16 +372,16 @@ static void HWR_CompileShader(int index)
|
||||
{
|
||||
char *preprocessed = HWR_PreprocessShader(vertex_source);
|
||||
if (!preprocessed) return;
|
||||
HWD.pfnLoadShader(index, preprocessed, HWD_SHADERSTAGE_VERTEX);
|
||||
GPU->LoadShader(index, preprocessed, HWD_SHADERSTAGE_VERTEX);
|
||||
}
|
||||
if (fragment_source)
|
||||
{
|
||||
char *preprocessed = HWR_PreprocessShader(fragment_source);
|
||||
if (!preprocessed) return;
|
||||
HWD.pfnLoadShader(index, preprocessed, HWD_SHADERSTAGE_FRAGMENT);
|
||||
GPU->LoadShader(index, preprocessed, HWD_SHADERSTAGE_FRAGMENT);
|
||||
}
|
||||
|
||||
gl_shaders[index].compiled = HWD.pfnCompileShader(index);
|
||||
gl_shaders[index].compiled = GPU->CompileShader(index);
|
||||
}
|
||||
|
||||
// compile or recompile shaders
|
||||
|
||||
@@ -526,7 +526,7 @@ EXPORT void HWRAPI(Shutdown) (void)
|
||||
// -----------------+
|
||||
// FinishUpdate : Swap front and back buffers
|
||||
// -----------------+
|
||||
EXPORT void HWRAPI(FinishUpdate) (INT32 waitvbl)
|
||||
void FinishUpdate (INT32 waitvbl)
|
||||
{
|
||||
#ifdef USE_WGL_SWAP
|
||||
static INT32 oldwaitvbl = 0;
|
||||
|
||||
@@ -797,7 +797,7 @@ static boolean GLFramebuffer_IsFuncAvailible(void)
|
||||
}
|
||||
#endif
|
||||
|
||||
EXPORT boolean HWRAPI(InitShaders) (void)
|
||||
static boolean InitShaders (void)
|
||||
{
|
||||
if (!pglUseProgram)
|
||||
return false;
|
||||
@@ -814,7 +814,7 @@ EXPORT boolean HWRAPI(InitShaders) (void)
|
||||
return true;
|
||||
}
|
||||
|
||||
EXPORT void HWRAPI(LoadShader) (int slot, char *code, hwdshaderstage_t stage)
|
||||
static void LoadShader (int slot, char *code, hwdshaderstage_t stage)
|
||||
{
|
||||
gl_shader_t *shader;
|
||||
|
||||
@@ -839,7 +839,7 @@ EXPORT void HWRAPI(LoadShader) (int slot, char *code, hwdshaderstage_t stage)
|
||||
#undef LOADSHADER
|
||||
}
|
||||
|
||||
EXPORT boolean HWRAPI(CompileShader) (int slot)
|
||||
static boolean CompileShader (int slot)
|
||||
{
|
||||
if (slot < 0 || slot >= HWR_MAXSHADERS)
|
||||
I_Error("CompileShader: Invalid slot %d", slot);
|
||||
@@ -860,7 +860,7 @@ EXPORT boolean HWRAPI(CompileShader) (int slot)
|
||||
// Those are given to the uniforms.
|
||||
//
|
||||
|
||||
EXPORT void HWRAPI(SetShaderInfo) (hwdshaderinfo_t info, INT32 value)
|
||||
static void SetShaderInfo (hwdshaderinfo_t info, INT32 value)
|
||||
{
|
||||
switch (info)
|
||||
{
|
||||
@@ -887,11 +887,11 @@ EXPORT void HWRAPI(SetShaderInfo) (hwdshaderinfo_t info, INT32 value)
|
||||
}
|
||||
}
|
||||
|
||||
EXPORT void HWRAPI(SetShader) (int slot)
|
||||
static void SetShader (int slot)
|
||||
{
|
||||
if (slot == SHADER_NONE)
|
||||
{
|
||||
UnSetShader();
|
||||
GPU->UnSetShader();
|
||||
return;
|
||||
}
|
||||
if (gl_allowshaders)
|
||||
@@ -918,7 +918,7 @@ EXPORT void HWRAPI(SetShader) (int slot)
|
||||
gl_shadersenabled = false;
|
||||
}
|
||||
|
||||
EXPORT void HWRAPI(UnSetShader) (void)
|
||||
static void UnSetShader (void)
|
||||
{
|
||||
if (gl_shadersenabled) // don't repeatedly call glUseProgram if not needed
|
||||
{
|
||||
@@ -1025,7 +1025,7 @@ void SetStates(void)
|
||||
|
||||
// this set CurrentPolyFlags to the actual configuration
|
||||
CurrentPolyFlags = 0xffffffff;
|
||||
SetBlend(0);
|
||||
GPU->SetBlend(0);
|
||||
|
||||
tex_downloaded = 0;
|
||||
SetNoTexture();
|
||||
@@ -1040,7 +1040,7 @@ void SetStates(void)
|
||||
// -----------------+
|
||||
// DeleteTexture : Deletes a texture from the GPU and frees its data
|
||||
// -----------------+
|
||||
EXPORT void HWRAPI(DeleteTexture) (GLMipmap_t *pTexInfo)
|
||||
static void DeleteTexture (GLMipmap_t *pTexInfo)
|
||||
{
|
||||
FTextureInfo *head = TexCacheHead;
|
||||
|
||||
@@ -1104,7 +1104,7 @@ static void GLFramebuffer_GenerateAttachments(void)
|
||||
pglFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_STENCIL_ATTACHMENT, GL_RENDERBUFFER, RenderbufferObject);
|
||||
|
||||
// Clear the renderbuffer
|
||||
ClearBuffer(true, true, true, NULL);
|
||||
GPU->ClearBuffer(true, true, true, NULL);
|
||||
|
||||
pglBindRenderbuffer(GL_RENDERBUFFER, 0);
|
||||
}
|
||||
@@ -1261,16 +1261,16 @@ INT32 isExtAvailable(const char *extension, const GLubyte *start)
|
||||
// Init : Initialise the OpenGL interface API
|
||||
// Returns :
|
||||
// -----------------+
|
||||
EXPORT boolean HWRAPI(Init) (void)
|
||||
static boolean Init (void)
|
||||
{
|
||||
return LoadGL();
|
||||
return SetupGLfunc();
|
||||
}
|
||||
|
||||
|
||||
// -----------------+
|
||||
// SetupGLInfo : Retreive and store currently loaded OpenGL version
|
||||
// -----------------+
|
||||
EXPORT void HWRAPI(SetupGLInfo) (void)
|
||||
static void SetupGLInfo (void)
|
||||
{
|
||||
const GLubyte *versionGL = pglGetString(GL_VERSION);
|
||||
CONS_Printf("Loaded OpenGL version %s\n", (const char*)versionGL);
|
||||
@@ -1281,7 +1281,7 @@ EXPORT void HWRAPI(SetupGLInfo) (void)
|
||||
// -----------------+
|
||||
// ClearMipMapCache : Flush OpenGL textures from memory
|
||||
// -----------------+
|
||||
EXPORT void HWRAPI(ClearMipMapCache) (void)
|
||||
static void ClearMipMapCache (void)
|
||||
{
|
||||
Flush();
|
||||
}
|
||||
@@ -1289,7 +1289,7 @@ EXPORT void HWRAPI(ClearMipMapCache) (void)
|
||||
// Writes screen texture tex into dst_data.
|
||||
// Pixel format is 24-bit RGB. Row order is top to bottom.
|
||||
// Dimensions are screen_width * screen_height.
|
||||
EXPORT void HWRAPI(ReadScreenTexture) (int tex, UINT16 *dst_data)
|
||||
static void ReadScreenTexture (int tex, UINT16 *dst_data)
|
||||
{
|
||||
INT32 i;
|
||||
int dst_stride = screen_width * 3; // stride between rows of image data
|
||||
@@ -1302,11 +1302,11 @@ EXPORT void HWRAPI(ReadScreenTexture) (int tex, UINT16 *dst_data)
|
||||
// and draw generic2 back after reading the framebuffer.
|
||||
// this hack is for some reason **much** faster than the simple solution of using glGetTexImage.
|
||||
if (tex != HWD_SCREENTEXTURE_GENERIC2)
|
||||
DrawScreenTexture(tex, NULL, 0);
|
||||
GPU->DrawScreenTexture(tex, NULL, 0);
|
||||
pglPixelStorei(GL_PACK_ALIGNMENT, 1);
|
||||
pglReadPixels(0, 0, screen_width, screen_height, GL_RGB, GL_UNSIGNED_BYTE, dst_data);
|
||||
if (tex != HWD_SCREENTEXTURE_GENERIC2)
|
||||
DrawScreenTexture(HWD_SCREENTEXTURE_GENERIC2, NULL, 0);
|
||||
GPU->DrawScreenTexture(HWD_SCREENTEXTURE_GENERIC2, NULL, 0);
|
||||
// Flip image upside down.
|
||||
// In other words, convert OpenGL's "bottom->top" row order into "top->bottom".
|
||||
for(i = 0; i < screen_height/2; i++)
|
||||
@@ -1320,10 +1320,27 @@ EXPORT void HWRAPI(ReadScreenTexture) (int tex, UINT16 *dst_data)
|
||||
free(row);
|
||||
}
|
||||
|
||||
// -----------------+
|
||||
// SetPalette : Changes the current texture palette
|
||||
// -----------------+
|
||||
static void SetPalette (RGBA_t *palette)
|
||||
{
|
||||
INT32 i;
|
||||
|
||||
for (i = 0; i < 256; i++)
|
||||
{
|
||||
myPaletteData[i].s.red = palette[i].s.red;
|
||||
myPaletteData[i].s.green = palette[i].s.green;
|
||||
myPaletteData[i].s.blue = palette[i].s.blue;
|
||||
myPaletteData[i].s.alpha = palette[i].s.alpha;
|
||||
}
|
||||
Flush();
|
||||
}
|
||||
|
||||
// -----------------+
|
||||
// GClipRect : Defines the 2D hardware clipping window
|
||||
// -----------------+
|
||||
EXPORT void HWRAPI(GClipRect) (INT32 minx, INT32 miny, INT32 maxx, INT32 maxy, float nearclip, float farclip)
|
||||
static void GClipRect (INT32 minx, INT32 miny, INT32 maxx, INT32 maxy, float nearclip, float farclip)
|
||||
{
|
||||
//GL_DBG_Printf("GClipRect(%d, %d, %d, %d)\n", minx, miny, maxx, maxy);
|
||||
|
||||
@@ -1346,7 +1363,7 @@ EXPORT void HWRAPI(GClipRect) (INT32 minx, INT32 miny, INT32 maxx, INT32 maxy, f
|
||||
// -----------------+
|
||||
// ClearBuffer : Clear the color/alpha/depth buffer(s)
|
||||
// -----------------+
|
||||
EXPORT void HWRAPI(ClearBuffer) (FBOOLEAN ColorMask,
|
||||
static void ClearBuffer (FBOOLEAN ColorMask,
|
||||
FBOOLEAN DepthMask,
|
||||
FBOOLEAN StencilMask,
|
||||
FRGBAFloat * ClearColor)
|
||||
@@ -1371,7 +1388,7 @@ EXPORT void HWRAPI(ClearBuffer) (FBOOLEAN ColorMask,
|
||||
ClearMask |= GL_DEPTH_BUFFER_BIT;
|
||||
}
|
||||
|
||||
SetBlend(DepthMask ? PF_Occlude | CurrentPolyFlags : CurrentPolyFlags&~PF_Occlude);
|
||||
GPU->SetBlend(DepthMask ? PF_Occlude | CurrentPolyFlags : CurrentPolyFlags&~PF_Occlude);
|
||||
|
||||
if (StencilMask)
|
||||
ClearMask |= GL_STENCIL_BUFFER_BIT;// looks like sometimes stencil buffer needs clearing? had a problem with random black screens
|
||||
@@ -1384,7 +1401,7 @@ EXPORT void HWRAPI(ClearBuffer) (FBOOLEAN ColorMask,
|
||||
// -----------------+
|
||||
// HWRAPI Draw2DLine: Render a 2D line
|
||||
// -----------------+
|
||||
EXPORT void HWRAPI(Draw2DLine) (F2DCoord * v1,
|
||||
static void Draw2DLine (F2DCoord * v1,
|
||||
F2DCoord * v2,
|
||||
RGBA_t Color)
|
||||
{
|
||||
@@ -1434,7 +1451,7 @@ static void Clamp2D(GLenum pname)
|
||||
// -----------------+
|
||||
// PF_Masked - we could use an ALPHA_TEST of GL_EQUAL, and alpha ref of 0,
|
||||
// is it faster when pixels are discarded ?
|
||||
EXPORT void HWRAPI(SetBlend) (FBITFIELD PolyFlags)
|
||||
static void SetBlend (FBITFIELD PolyFlags)
|
||||
{
|
||||
FBITFIELD Xor;
|
||||
Xor = CurrentPolyFlags^PolyFlags;
|
||||
@@ -1581,7 +1598,7 @@ static void AllocTextureBuffer(GLMipmap_t *pTexInfo)
|
||||
// -----------------+
|
||||
// UpdateTexture : Updates texture data.
|
||||
// -----------------+
|
||||
EXPORT void HWRAPI(UpdateTexture) (GLMipmap_t *pTexInfo)
|
||||
static void UpdateTexture (GLMipmap_t *pTexInfo)
|
||||
{
|
||||
// Upload a texture
|
||||
GLuint num = pTexInfo->downloaded;
|
||||
@@ -1792,7 +1809,7 @@ EXPORT void HWRAPI(UpdateTexture) (GLMipmap_t *pTexInfo)
|
||||
// -----------------+
|
||||
// SetTexture : The mipmap becomes the current texture source
|
||||
// -----------------+
|
||||
EXPORT void HWRAPI(SetTexture) (GLMipmap_t *pTexInfo)
|
||||
static void SetTexture (GLMipmap_t *pTexInfo)
|
||||
{
|
||||
if (!pTexInfo)
|
||||
{
|
||||
@@ -2128,7 +2145,7 @@ static void PreparePolygon(FSurfaceInfo *pSurf, FBITFIELD PolyFlags)
|
||||
// -----------------+
|
||||
// DrawPolygon : Render a polygon, set the texture, set render mode
|
||||
// -----------------+
|
||||
EXPORT void HWRAPI(DrawPolygon) (FSurfaceInfo *pSurf, FOutVector *pOutVerts, FUINT iNumPts, FBITFIELD PolyFlags)
|
||||
static void DrawPolygon (FSurfaceInfo *pSurf, FOutVector *pOutVerts, FUINT iNumPts, FBITFIELD PolyFlags)
|
||||
{
|
||||
PreparePolygon(pSurf, PolyFlags);
|
||||
|
||||
@@ -2146,7 +2163,7 @@ EXPORT void HWRAPI(DrawPolygon) (FSurfaceInfo *pSurf, FOutVector *pOutVerts, FUI
|
||||
Clamp2D(GL_TEXTURE_WRAP_T);
|
||||
}
|
||||
|
||||
EXPORT void HWRAPI(DrawIndexedTriangles) (FSurfaceInfo *pSurf, FOutVector *pOutVerts, FUINT iNumPts, FBITFIELD PolyFlags, unsigned int *IndexArray)
|
||||
static void DrawIndexedTriangles (FSurfaceInfo *pSurf, FOutVector *pOutVerts, FUINT iNumPts, FBITFIELD PolyFlags, unsigned int *IndexArray)
|
||||
{
|
||||
PreparePolygon(pSurf, PolyFlags);
|
||||
|
||||
@@ -2401,10 +2418,10 @@ static void RenderDome(INT32 skytexnum)
|
||||
pglDisableClientState(GL_COLOR_ARRAY);
|
||||
}
|
||||
|
||||
EXPORT void HWRAPI(RenderSkyDome) (INT32 tex, INT32 texture_width, INT32 texture_height, FTransform transform)
|
||||
static void RenderSkyDome (INT32 tex, INT32 texture_width, INT32 texture_height, FTransform transform)
|
||||
{
|
||||
SetBlend(PF_Translucent|PF_NoDepthTest|PF_Modulated);
|
||||
SetTransform(&transform);
|
||||
GPU->SetTransform(&transform);
|
||||
texw = texture_width;
|
||||
texh = texture_height;
|
||||
RenderDome(tex);
|
||||
@@ -2414,7 +2431,7 @@ EXPORT void HWRAPI(RenderSkyDome) (INT32 tex, INT32 texture_width, INT32 texture
|
||||
// ==========================================================================
|
||||
//
|
||||
// ==========================================================================
|
||||
EXPORT void HWRAPI(SetSpecialState) (hwdspecialstate_t IdState, INT32 Value)
|
||||
static void SetSpecialState (hwdspecialstate_t IdState, INT32 Value)
|
||||
{
|
||||
switch (IdState)
|
||||
{
|
||||
@@ -2729,7 +2746,7 @@ static void CreateModelVBOTiny(mesh_t *mesh, tinyframe_t *frame)
|
||||
pglBindBuffer(GL_ARRAY_BUFFER, 0);
|
||||
}
|
||||
|
||||
EXPORT void HWRAPI(CreateModelVBOs) (model_t *model)
|
||||
static void CreateModelVBOs (model_t *model)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < model->numMeshes; i++)
|
||||
@@ -2996,7 +3013,7 @@ static void DrawModelEx(model_t *model, INT32 frameIndex, float duration, float
|
||||
// -----------------+
|
||||
// HWRAPI DrawModel : Draw a model
|
||||
// -----------------+
|
||||
EXPORT void HWRAPI(DrawModel) (model_t *model, INT32 frameIndex, float duration, float tics, INT32 nextFrameIndex, FTransform *pos, float hscale, float vscale, UINT8 flipped, UINT8 hflipped, FSurfaceInfo *Surface)
|
||||
static void DrawModel (model_t *model, INT32 frameIndex, float duration, float tics, INT32 nextFrameIndex, FTransform *pos, float hscale, float vscale, UINT8 flipped, UINT8 hflipped, FSurfaceInfo *Surface)
|
||||
{
|
||||
DrawModelEx(model, frameIndex, duration, tics, nextFrameIndex, pos, hscale, vscale, flipped, hflipped, Surface);
|
||||
}
|
||||
@@ -3004,7 +3021,7 @@ EXPORT void HWRAPI(DrawModel) (model_t *model, INT32 frameIndex, float duration,
|
||||
// -----------------+
|
||||
// SetTransform :
|
||||
// -----------------+
|
||||
EXPORT void HWRAPI(SetTransform) (FTransform *stransform)
|
||||
static void SetTransform (FTransform *stransform)
|
||||
{
|
||||
static boolean special_splitscreen;
|
||||
GLdouble used_fov;
|
||||
@@ -3075,7 +3092,7 @@ EXPORT void HWRAPI(SetTransform) (FTransform *stransform)
|
||||
pglGetFloatv(GL_MODELVIEW_MATRIX, modelMatrix); // added for new coronas' code (without depth buffer)
|
||||
}
|
||||
|
||||
EXPORT INT32 HWRAPI(GetTextureUsed) (void)
|
||||
static INT32 GetTextureUsed (void)
|
||||
{
|
||||
FTextureInfo *tmp = TexCacheHead;
|
||||
INT32 res = 0;
|
||||
@@ -3100,7 +3117,7 @@ EXPORT INT32 HWRAPI(GetTextureUsed) (void)
|
||||
return res;
|
||||
}
|
||||
|
||||
EXPORT void HWRAPI(PostImgRedraw) (float points[SCREENVERTS][SCREENVERTS][2])
|
||||
static void PostImgRedraw (float points[SCREENVERTS][SCREENVERTS][2])
|
||||
{
|
||||
INT32 x, y;
|
||||
float float_x, float_y, float_nextx, float_nexty;
|
||||
@@ -3188,7 +3205,7 @@ EXPORT void HWRAPI(PostImgRedraw) (float points[SCREENVERTS][SCREENVERTS][2])
|
||||
|
||||
// Sryder: This needs to be called whenever the screen changes resolution in order to reset the screen textures to use
|
||||
// a new size
|
||||
EXPORT void HWRAPI(FlushScreenTextures) (void)
|
||||
static void FlushScreenTextures (void)
|
||||
{
|
||||
int i;
|
||||
pglDeleteTextures(NUMSCREENTEXTURES, screenTextures);
|
||||
@@ -3196,7 +3213,7 @@ EXPORT void HWRAPI(FlushScreenTextures) (void)
|
||||
screenTextures[i] = 0;
|
||||
}
|
||||
|
||||
EXPORT void HWRAPI(DrawScreenTexture)(int tex, FSurfaceInfo *surf, FBITFIELD polyflags)
|
||||
static void DrawScreenTexture(int tex, FSurfaceInfo *surf, FBITFIELD polyflags)
|
||||
{
|
||||
float xfix, yfix;
|
||||
INT32 texsize = 512;
|
||||
@@ -3250,7 +3267,7 @@ EXPORT void HWRAPI(DrawScreenTexture)(int tex, FSurfaceInfo *surf, FBITFIELD pol
|
||||
|
||||
|
||||
// Do screen fades!
|
||||
EXPORT void HWRAPI(DoScreenWipe)(int wipeStart, int wipeEnd)
|
||||
static void DoScreenWipe (int wipeStart, int wipeEnd)
|
||||
{
|
||||
INT32 texsize = 512;
|
||||
float xfix, yfix;
|
||||
@@ -3341,7 +3358,7 @@ EXPORT void HWRAPI(DoScreenWipe)(int wipeStart, int wipeEnd)
|
||||
tex_downloaded = screenTextures[wipeEnd];
|
||||
}
|
||||
|
||||
EXPORT void HWRAPI(RenderVhsEffect) (fixed_t upbary, fixed_t downbary, UINT8 updistort, UINT8 downdistort, UINT8 barsize)
|
||||
static void RenderVhsEffect (fixed_t upbary, fixed_t downbary, UINT8 updistort, UINT8 downdistort, UINT8 barsize)
|
||||
{
|
||||
INT32 texsize = 512;
|
||||
float xfix, yfix;
|
||||
@@ -3368,7 +3385,7 @@ EXPORT void HWRAPI(RenderVhsEffect) (fixed_t upbary, fixed_t downbary, UINT8 upd
|
||||
yfix = 1/((float)(texsize)/((float)((screen_height))));
|
||||
|
||||
// Slight fuzziness
|
||||
MakeScreenTexture(HWD_SCREENTEXTURE_GENERIC1);
|
||||
GPU->MakeScreenTexture(HWD_SCREENTEXTURE_GENERIC1);
|
||||
SetBlend(PF_Modulated|PF_Translucent|PF_NoDepthTest);
|
||||
//pglBindTexture(GL_TEXTURE_2D, screentexture);
|
||||
|
||||
@@ -3392,7 +3409,7 @@ EXPORT void HWRAPI(RenderVhsEffect) (fixed_t upbary, fixed_t downbary, UINT8 upd
|
||||
}
|
||||
|
||||
// Upward bar
|
||||
MakeScreenTexture(HWD_SCREENTEXTURE_GENERIC1);
|
||||
GPU->MakeScreenTexture(HWD_SCREENTEXTURE_GENERIC1);
|
||||
//pglBindTexture(GL_TEXTURE_2D, screentexture);
|
||||
color[0] = color[1] = color[2] = 190;
|
||||
color[3] = 250;
|
||||
@@ -3420,7 +3437,7 @@ EXPORT void HWRAPI(RenderVhsEffect) (fixed_t upbary, fixed_t downbary, UINT8 upd
|
||||
pglDrawArrays(GL_TRIANGLE_FAN, 0, 4);
|
||||
|
||||
// Downward bar
|
||||
MakeScreenTexture(HWD_SCREENTEXTURE_GENERIC1);
|
||||
GPU->MakeScreenTexture(HWD_SCREENTEXTURE_GENERIC1);
|
||||
//pglBindTexture(GL_TEXTURE_2D, screentexture);
|
||||
|
||||
fix[0] = 0.0f;
|
||||
@@ -3446,7 +3463,7 @@ EXPORT void HWRAPI(RenderVhsEffect) (fixed_t upbary, fixed_t downbary, UINT8 upd
|
||||
}
|
||||
|
||||
// Create a texture from the screen.
|
||||
EXPORT void HWRAPI(MakeScreenTexture) (int tex)
|
||||
static void MakeScreenTexture (int tex)
|
||||
{
|
||||
INT32 texsize = 512;
|
||||
boolean firstTime = (screenTextures[tex] == 0);
|
||||
@@ -3477,7 +3494,7 @@ EXPORT void HWRAPI(MakeScreenTexture) (int tex)
|
||||
tex_downloaded = screenTextures[tex];
|
||||
}
|
||||
|
||||
EXPORT void HWRAPI(DrawScreenFinalTexture)(int tex, INT32 width, INT32 height)
|
||||
static void DrawScreenFinalTexture(int tex, INT32 width, INT32 height)
|
||||
{
|
||||
float xfix, yfix;
|
||||
float origaspect, newaspect;
|
||||
@@ -3539,8 +3556,8 @@ EXPORT void HWRAPI(DrawScreenFinalTexture)(int tex, INT32 width, INT32 height)
|
||||
|
||||
clearColour.red = clearColour.green = clearColour.blue = 0;
|
||||
clearColour.alpha = 1;
|
||||
ClearBuffer(true, false, false, &clearColour);
|
||||
SetBlend(PF_NoDepthTest);
|
||||
GPU->ClearBuffer(true, false, false, &clearColour);
|
||||
GPU->SetBlend(PF_NoDepthTest);
|
||||
|
||||
pglBindTexture(GL_TEXTURE_2D, screenTextures[tex]);
|
||||
|
||||
@@ -3564,7 +3581,7 @@ EXPORT void HWRAPI(DrawScreenFinalTexture)(int tex, INT32 width, INT32 height)
|
||||
tex_downloaded = screenTextures[tex];
|
||||
}
|
||||
|
||||
EXPORT void HWRAPI(SetPaletteLookup)(UINT8 *lut)
|
||||
static void SetPaletteLookup(UINT8 *lut)
|
||||
{
|
||||
GLenum internalFormat;
|
||||
if (gl_version[0] == '1' || gl_version[0] == '2')
|
||||
@@ -3591,7 +3608,7 @@ EXPORT void HWRAPI(SetPaletteLookup)(UINT8 *lut)
|
||||
pglActiveTexture(GL_TEXTURE0);
|
||||
}
|
||||
|
||||
EXPORT UINT32 HWRAPI(CreateLightTable)(RGBA_t *hw_lighttable)
|
||||
static UINT32 CreateLightTable(RGBA_t *hw_lighttable)
|
||||
{
|
||||
LTListItem *item = malloc(sizeof(LTListItem));
|
||||
if (!LightTablesTail)
|
||||
@@ -3617,7 +3634,7 @@ EXPORT UINT32 HWRAPI(CreateLightTable)(RGBA_t *hw_lighttable)
|
||||
}
|
||||
|
||||
// Delete light table textures, ids given before become invalid and must not be used.
|
||||
EXPORT void HWRAPI(ClearLightTables)(void)
|
||||
static void ClearLightTables(void)
|
||||
{
|
||||
while (LightTablesHead)
|
||||
{
|
||||
@@ -3634,7 +3651,7 @@ EXPORT void HWRAPI(ClearLightTables)(void)
|
||||
}
|
||||
|
||||
// This palette is used for the palette rendering postprocessing step.
|
||||
EXPORT void HWRAPI(SetScreenPalette)(RGBA_t *palette)
|
||||
static void SetScreenPalette(RGBA_t *palette)
|
||||
{
|
||||
if (memcmp(screenPalette, palette, sizeof(screenPalette)))
|
||||
{
|
||||
@@ -3650,4 +3667,57 @@ EXPORT void HWRAPI(SetScreenPalette)(RGBA_t *palette)
|
||||
}
|
||||
}
|
||||
|
||||
struct GPURenderingAPI GLInterfaceAPI = {
|
||||
Init,
|
||||
NULL,
|
||||
SetupGLInfo,
|
||||
|
||||
SetSpecialState,
|
||||
SetTransform,
|
||||
SetBlend,
|
||||
SetPalette,
|
||||
ClearBuffer,
|
||||
|
||||
DrawPolygon,
|
||||
DrawIndexedTriangles,
|
||||
Draw2DLine,
|
||||
DrawModel,
|
||||
RenderSkyDome,
|
||||
|
||||
SetTexture,
|
||||
UpdateTexture,
|
||||
DeleteTexture,
|
||||
|
||||
ClearMipMapCache,
|
||||
GetTextureUsed,
|
||||
|
||||
CreateModelVBOs,
|
||||
|
||||
ReadScreenTexture,
|
||||
GClipRect,
|
||||
|
||||
MakeScreenTexture,
|
||||
FlushScreenTextures,
|
||||
|
||||
DrawScreenTexture,
|
||||
DoScreenWipe,
|
||||
RenderVhsEffect,
|
||||
DrawScreenFinalTexture,
|
||||
|
||||
PostImgRedraw,
|
||||
|
||||
InitShaders,
|
||||
LoadShader,
|
||||
CompileShader,
|
||||
SetShader,
|
||||
UnSetShader,
|
||||
|
||||
SetShaderInfo,
|
||||
|
||||
SetPaletteLookup,
|
||||
CreateLightTable,
|
||||
ClearLightTables,
|
||||
SetScreenPalette,
|
||||
};
|
||||
|
||||
#endif //HWRENDER
|
||||
@@ -44,7 +44,7 @@
|
||||
|
||||
#define _CREATE_DLL_ // necessary for Unix AND Windows
|
||||
#include "../../doomdef.h"
|
||||
#include "../hw_drv.h"
|
||||
#include "../hw_gpu.h"
|
||||
#include "../../z_zone.h"
|
||||
|
||||
// ==========================================================================
|
||||
@@ -65,7 +65,8 @@ extern FILE *gllogstream;
|
||||
// PROTOS
|
||||
// ==========================================================================
|
||||
|
||||
boolean LoadGL(void);
|
||||
FUNCPRINTF void GL_DBG_Printf(const char *format, ...);
|
||||
|
||||
void *GetGLFunc(const char *proc);
|
||||
boolean SetupGLfunc(void);
|
||||
void SetupGLFunc4(void);
|
||||
@@ -134,6 +135,8 @@ extern GLbyte screen_depth;
|
||||
extern GLint maximumAnisotropy;
|
||||
extern boolean supportMipMap;
|
||||
|
||||
extern struct GPURenderingAPI GLInterfaceAPI;
|
||||
|
||||
/** \brief OpenGL flags for video driver
|
||||
*/
|
||||
extern INT32 oglflags;
|
||||
|
||||
+1
-1
@@ -572,7 +572,7 @@ SOURCE=..\hardware\hw_draw.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\hardware\hw_drv.h
|
||||
SOURCE=..\hardware\hw_gpu.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
|
||||
+1
-57
@@ -43,14 +43,6 @@
|
||||
|
||||
#define _CREATE_DLL_ // necessary for Unix AND Windows
|
||||
|
||||
#ifdef HWRENDER
|
||||
#include "../hardware/hw_drv.h"
|
||||
#include "ogl_sdl.h"
|
||||
#ifdef STATIC_OPENGL
|
||||
#include "../hardware/r_opengl/r_opengl.h"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef HW3SOUND
|
||||
#include "../hardware/hw3dsdrv.h"
|
||||
#endif
|
||||
@@ -73,55 +65,7 @@
|
||||
void *hwSym(const char *funcName,void *handle)
|
||||
{
|
||||
void *funcPointer = NULL;
|
||||
#ifdef HWRENDER
|
||||
if (0 == strcmp("SetTexturePalette", funcName))
|
||||
funcPointer = &OglSdlSetPalette;
|
||||
|
||||
GETFUNC(Init);
|
||||
GETFUNC(SetupGLInfo);
|
||||
GETFUNC(Draw2DLine);
|
||||
GETFUNC(DrawPolygon);
|
||||
GETFUNC(DrawIndexedTriangles);
|
||||
GETFUNC(SetBlend);
|
||||
GETFUNC(ClearBuffer);
|
||||
GETFUNC(SetTexture);
|
||||
GETFUNC(UpdateTexture);
|
||||
GETFUNC(DeleteTexture);
|
||||
GETFUNC(ReadScreenTexture);
|
||||
GETFUNC(GClipRect);
|
||||
GETFUNC(ClearMipMapCache);
|
||||
GETFUNC(SetSpecialState);
|
||||
GETFUNC(GetTextureUsed);
|
||||
GETFUNC(DrawModel);
|
||||
GETFUNC(CreateModelVBOs);
|
||||
GETFUNC(SetTransform);
|
||||
GETFUNC(PostImgRedraw);
|
||||
GETFUNC(FlushScreenTextures);
|
||||
GETFUNC(DoScreenWipe);
|
||||
GETFUNC(DrawScreenTexture);
|
||||
GETFUNC(MakeScreenTexture);
|
||||
GETFUNC(RenderVhsEffect);
|
||||
GETFUNC(DrawScreenFinalTexture);
|
||||
|
||||
GETFUNC(RenderSkyDome);
|
||||
|
||||
GETFUNC(InitShaders);
|
||||
GETFUNC(LoadShader);
|
||||
GETFUNC(CompileShader);
|
||||
GETFUNC(SetShader);
|
||||
GETFUNC(UnSetShader);
|
||||
|
||||
GETFUNC(SetShaderInfo);
|
||||
|
||||
GETFUNC(SetPaletteLookup);
|
||||
GETFUNC(CreateLightTable);
|
||||
GETFUNC(ClearLightTables);
|
||||
GETFUNC(SetScreenPalette);
|
||||
|
||||
#else //HWRENDER
|
||||
if (0 == strcmp("FinishUpdate", funcName))
|
||||
return funcPointer; //&FinishUpdate;
|
||||
#endif //!HWRENDER
|
||||
if (0) ;
|
||||
#ifdef STATIC3DS
|
||||
GETFUNC(Startup);
|
||||
GETFUNC(AddSfx);
|
||||
|
||||
+3
-43
@@ -79,7 +79,7 @@
|
||||
#include "../hu_stuff.h" // for chat_on
|
||||
#ifdef HWRENDER
|
||||
#include "../hardware/hw_main.h"
|
||||
#include "../hardware/hw_drv.h"
|
||||
#include "../hardware/hw_gpu.h"
|
||||
#include "../hardware/r_opengl/r_opengl.h" //for supportFBO
|
||||
// For dynamic referencing of HW rendering functions
|
||||
#include "hwsym_sdl.h"
|
||||
@@ -2132,50 +2132,10 @@ void I_StartupGraphics(void)
|
||||
#ifdef HWRENDER
|
||||
if (rendermode == render_opengl)
|
||||
{
|
||||
HWD.pfnInit = hwSym("Init",NULL);
|
||||
HWD.pfnSetupGLInfo = hwSym("SetupGLInfo",NULL);
|
||||
HWD.pfnFinishUpdate = NULL;
|
||||
HWD.pfnDraw2DLine = hwSym("Draw2DLine",NULL);
|
||||
HWD.pfnDrawPolygon = hwSym("DrawPolygon",NULL);
|
||||
HWD.pfnDrawIndexedTriangles = hwSym("DrawIndexedTriangles",NULL);
|
||||
HWD.pfnSetBlend = hwSym("SetBlend",NULL);
|
||||
HWD.pfnClearBuffer = hwSym("ClearBuffer",NULL);
|
||||
HWD.pfnSetTexture = hwSym("SetTexture",NULL);
|
||||
HWD.pfnUpdateTexture = hwSym("UpdateTexture",NULL);
|
||||
HWD.pfnDeleteTexture = hwSym("DeleteTexture",NULL);
|
||||
HWD.pfnReadScreenTexture= hwSym("ReadScreenTexture",NULL);
|
||||
HWD.pfnGClipRect = hwSym("GClipRect",NULL);
|
||||
HWD.pfnClearMipMapCache = hwSym("ClearMipMapCache",NULL);
|
||||
HWD.pfnSetSpecialState = hwSym("SetSpecialState",NULL);
|
||||
HWD.pfnSetTexturePalette= hwSym("SetTexturePalette",NULL);
|
||||
HWD.pfnGetTextureUsed = hwSym("GetTextureUsed",NULL);
|
||||
HWD.pfnDrawModel = hwSym("DrawModel",NULL);
|
||||
HWD.pfnCreateModelVBOs = hwSym("CreateModelVBOs",NULL);
|
||||
HWD.pfnSetTransform = hwSym("SetTransform",NULL);
|
||||
HWD.pfnPostImgRedraw = hwSym("PostImgRedraw",NULL);
|
||||
HWD.pfnFlushScreenTextures=hwSym("FlushScreenTextures",NULL);
|
||||
HWD.pfnDoScreenWipe = hwSym("DoScreenWipe",NULL);
|
||||
HWD.pfnDrawScreenTexture= hwSym("DrawScreenTexture",NULL);
|
||||
HWD.pfnMakeScreenTexture= hwSym("MakeScreenTexture",NULL);
|
||||
HWD.pfnRenderVhsEffect = hwSym("RenderVhsEffect",NULL);
|
||||
HWD.pfnDrawScreenFinalTexture=hwSym("DrawScreenFinalTexture",NULL);
|
||||
GPUInterface_Load(&GPU);
|
||||
|
||||
HWD.pfnRenderSkyDome = hwSym("RenderSkyDome",NULL);
|
||||
vid.glstate = (VID_LoadGPUAPI() && GPU->Init()) ? VID_GL_LIBRARY_LOADED : VID_GL_LIBRARY_ERROR;
|
||||
|
||||
HWD.pfnInitShaders = hwSym("InitShaders",NULL);
|
||||
HWD.pfnLoadShader = hwSym("LoadShader",NULL);
|
||||
HWD.pfnCompileShader = hwSym("CompileShader",NULL);
|
||||
HWD.pfnSetShader = hwSym("SetShader",NULL);
|
||||
HWD.pfnUnSetShader = hwSym("UnSetShader",NULL);
|
||||
|
||||
HWD.pfnSetShaderInfo = hwSym("SetShaderInfo",NULL);
|
||||
|
||||
HWD.pfnSetPaletteLookup = hwSym("SetPaletteLookup",NULL);
|
||||
HWD.pfnCreateLightTable = hwSym("CreateLightTable",NULL);
|
||||
HWD.pfnClearLightTables = hwSym("ClearLightTables",NULL);
|
||||
HWD.pfnSetScreenPalette = hwSym("SetScreenPalette",NULL);
|
||||
|
||||
vid.glstate = HWD.pfnInit() ? VID_GL_LIBRARY_LOADED : VID_GL_LIBRARY_ERROR; // let load the OpenGL library
|
||||
if (vid.glstate == VID_GL_LIBRARY_ERROR)
|
||||
{
|
||||
rendermode = render_soft;
|
||||
|
||||
@@ -1060,8 +1060,8 @@
|
||||
8417773A085A106C000C01D8 = {
|
||||
fileEncoding = 30;
|
||||
isa = PBXFileReference;
|
||||
name = hw_drv.h;
|
||||
path = ../../hardware/hw_drv.h;
|
||||
name = hw_gpu.h;
|
||||
path = ../../hardware/hw_gpu.h;
|
||||
refType = 2;
|
||||
};
|
||||
8417773C085A106C000C01D8 = {
|
||||
|
||||
@@ -180,7 +180,7 @@
|
||||
1E44AE630B67CC2B00BAD059 /* hw3sound.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = hw3sound.c; path = ../../hardware/hw3sound.c; sourceTree = SOURCE_ROOT; };
|
||||
1E44AE640B67CC2B00BAD059 /* hw_cache.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = hw_cache.c; path = ../../hardware/hw_cache.c; sourceTree = SOURCE_ROOT; };
|
||||
1E44AE650B67CC2B00BAD059 /* hw_dll.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = hw_dll.h; path = ../../hardware/hw_dll.h; sourceTree = SOURCE_ROOT; };
|
||||
1E44AE660B67CC2B00BAD059 /* hw_drv.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = hw_drv.h; path = ../../hardware/hw_drv.h; sourceTree = SOURCE_ROOT; };
|
||||
1E44AE660B67CC2B00BAD059 /* hw_gpu.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = hw_gpu.h; path = ../../hardware/hw_gpu.h; sourceTree = SOURCE_ROOT; };
|
||||
1E44AE680B67CC2B00BAD059 /* hw_light.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = hw_light.c; path = ../../hardware/hw_light.c; sourceTree = SOURCE_ROOT; };
|
||||
1E44AE690B67CC2B00BAD059 /* hw_light.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = hw_light.h; path = ../../hardware/hw_light.h; sourceTree = SOURCE_ROOT; };
|
||||
1E44AE6A0B67CC2B00BAD059 /* hw3sound.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = hw3sound.h; path = ../../hardware/hw3sound.h; sourceTree = SOURCE_ROOT; };
|
||||
@@ -533,7 +533,7 @@
|
||||
1E44AE630B67CC2B00BAD059 /* hw3sound.c */,
|
||||
1E44AE640B67CC2B00BAD059 /* hw_cache.c */,
|
||||
1E44AE650B67CC2B00BAD059 /* hw_dll.h */,
|
||||
1E44AE660B67CC2B00BAD059 /* hw_drv.h */,
|
||||
1E44AE660B67CC2B00BAD059 /* hw_gpu.h */,
|
||||
1E44AE680B67CC2B00BAD059 /* hw_light.c */,
|
||||
1E44AE690B67CC2B00BAD059 /* hw_light.h */,
|
||||
1E44AE6A0B67CC2B00BAD059 /* hw3sound.h */,
|
||||
|
||||
+6
-19
@@ -38,6 +38,7 @@
|
||||
#ifdef HWRENDER
|
||||
#include "../hardware/r_opengl/r_opengl.h"
|
||||
#include "../hardware/hw_main.h"
|
||||
#include "../hardware/hw_gpu.h"
|
||||
#include "ogl_sdl.h"
|
||||
#include "../i_system.h"
|
||||
#include "hwsym_sdl.h"
|
||||
@@ -84,7 +85,7 @@ void *GetGLFunc(const char *proc)
|
||||
return SDL_GL_GetProcAddress(proc);
|
||||
}
|
||||
|
||||
boolean LoadGL(void)
|
||||
boolean VID_LoadGPUAPI(void)
|
||||
{
|
||||
#ifndef STATIC_OPENGL
|
||||
const char *OGLLibname = NULL;
|
||||
@@ -101,7 +102,7 @@ boolean LoadGL(void)
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
return SetupGLfunc();
|
||||
return true;
|
||||
}
|
||||
|
||||
/** \brief The OglSdlSurface function
|
||||
@@ -158,7 +159,7 @@ boolean OglSdlSurface(INT32 w, INT32 h)
|
||||
"- GPU drivers are missing or broken. You may need to update your drivers.");
|
||||
}
|
||||
|
||||
SetupGLInfo();
|
||||
GPU->SetupGLInfo();
|
||||
|
||||
SetupGLFunc4();
|
||||
|
||||
@@ -195,7 +196,7 @@ boolean OglSdlSurface(INT32 w, INT32 h)
|
||||
// The screen textures need to be flushed if the width or height change so that they be remade for the correct size
|
||||
if (screen_width != w || screen_height != h)
|
||||
{
|
||||
FlushScreenTextures();
|
||||
GPU->FlushScreenTextures();
|
||||
|
||||
#ifdef USE_FBO_OGL
|
||||
GLFramebuffer_DeleteAttachments();
|
||||
@@ -290,7 +291,7 @@ void OglSdlFinishUpdate(boolean waitvbl)
|
||||
|
||||
SDL_GL_SwapWindow(window);
|
||||
|
||||
GClipRect(0, 0, realwidth, realheight, NZCLIP_PLANE, FAR_ZCLIP_DEFAULT);
|
||||
GPU->GClipRect(0, 0, realwidth, realheight, NZCLIP_PLANE, FAR_ZCLIP_DEFAULT);
|
||||
|
||||
// Sryder: We need to draw the final screen texture again into the other buffer in the original position so that
|
||||
// effects that want to take the old screen can do so after this
|
||||
@@ -298,19 +299,5 @@ void OglSdlFinishUpdate(boolean waitvbl)
|
||||
HWR_DrawScreenFinalTexture(realwidth, realheight);
|
||||
}
|
||||
|
||||
EXPORT void HWRAPI(OglSdlSetPalette) (RGBA_t *palette)
|
||||
{
|
||||
INT32 i;
|
||||
|
||||
for (i = 0; i < 256; i++)
|
||||
{
|
||||
myPaletteData[i].s.red = palette[i].s.red;
|
||||
myPaletteData[i].s.green = palette[i].s.green;
|
||||
myPaletteData[i].s.blue = palette[i].s.blue;
|
||||
myPaletteData[i].s.alpha = palette[i].s.alpha;
|
||||
}
|
||||
Flush();
|
||||
}
|
||||
|
||||
#endif //HWRENDER
|
||||
#endif //SDL
|
||||
+1
-3
@@ -27,12 +27,10 @@ extern boolean isnvidiagpu;
|
||||
#endif
|
||||
|
||||
void OglSdlFinishUpdate(boolean vidwait);
|
||||
boolean VID_LoadGPUAPI(void);
|
||||
|
||||
extern SDL_Renderer *renderer;
|
||||
extern SDL_GLContext sdlglcontext;
|
||||
extern Uint16 realwidth;
|
||||
extern Uint16 realheight;
|
||||
|
||||
#ifdef _CREATE_DLL_
|
||||
EXPORT void HWRAPI( OglSdlSetPalette ) (RGBA_t *palette);
|
||||
#endif
|
||||
Reference in new issue
Block a user