Refactor OpenGL library handling #147
No files matched your search
+1
-1
@@ -487,7 +487,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_gl.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_glob.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_main.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/hardware/hw_portal.h
|
||||
|
||||
+2
-2
@@ -738,7 +738,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_gl.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 \
|
||||
@@ -747,7 +747,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_gl.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 \
|
||||
|
||||
+12
-10
@@ -15,6 +15,8 @@
|
||||
#include "hw_main.h"
|
||||
#include "../i_system.h"
|
||||
|
||||
#include "../doomdef.h"
|
||||
|
||||
#include "../qs22j.h"
|
||||
|
||||
// The texture for the next polygon given to HWR_ProcessPolygon.
|
||||
@@ -63,7 +65,7 @@ void HWR_StartBatching(void)
|
||||
currently_batching = true;
|
||||
}
|
||||
|
||||
// This replaces the direct calls to pfnSetTexture in cases where batching is available.
|
||||
// This replaces the direct calls to GL_SetTexture in cases where batching is available.
|
||||
// The texture selection is saved for the next HWR_ProcessPolygon call.
|
||||
// Doing this was easier than getting a texture pointer to HWR_ProcessPolygon.
|
||||
void HWR_SetCurrentTexture(GLMipmap_t *texture)
|
||||
@@ -74,7 +76,7 @@ void HWR_SetCurrentTexture(GLMipmap_t *texture)
|
||||
}
|
||||
else
|
||||
{
|
||||
HWD.pfnSetTexture(texture);
|
||||
GL_SetTexture(texture);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -128,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);
|
||||
GL_SetShader((shader_target != SHADER_NONE) ? HWR_GetShaderFromTarget(shader_target) : shader_target);
|
||||
GL_DrawPolygon(pSurf, pOutVerts, iNumPts, PolyFlags);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -290,13 +292,13 @@ void HWR_RenderBatches(void)
|
||||
|
||||
if (cv_glshaders.value && gl_shadersavailable)
|
||||
{
|
||||
HWD.pfnSetShader(currentShader);
|
||||
GL_SetShader(currentShader);
|
||||
}
|
||||
|
||||
if (currentPolyFlags & PF_NoTexture)
|
||||
currentTexture = NULL;
|
||||
else
|
||||
HWD.pfnSetTexture(currentTexture);
|
||||
GL_SetTexture(currentTexture);
|
||||
|
||||
while (1)// note: remember handling notexture polyflag as having texture number 0 (also in comparePolygons)
|
||||
{
|
||||
@@ -411,7 +413,7 @@ void HWR_RenderBatches(void)
|
||||
if (changeState || stopFlag)
|
||||
{
|
||||
// execute draw call
|
||||
HWD.pfnDrawIndexedTriangles(¤tSurfaceInfo, finalVertexArray, finalIndexWritePos, currentPolyFlags, finalVertexIndexArray);
|
||||
GL_DrawIndexedTriangles(¤tSurfaceInfo, finalVertexArray, finalIndexWritePos, currentPolyFlags, finalVertexIndexArray);
|
||||
// update stats
|
||||
ps_hw_numcalls.value.i++;
|
||||
ps_hw_numverts.value.i += finalIndexWritePos;
|
||||
@@ -429,7 +431,7 @@ void HWR_RenderBatches(void)
|
||||
{
|
||||
if (changeShader)
|
||||
{
|
||||
HWD.pfnSetShader(nextShader);
|
||||
GL_SetShader(nextShader);
|
||||
currentShader = nextShader;
|
||||
changeShader = false;
|
||||
|
||||
@@ -437,8 +439,8 @@ void HWR_RenderBatches(void)
|
||||
}
|
||||
if (changeTexture)
|
||||
{
|
||||
// texture should be already ready for use from calls to SetTexture during batch collection
|
||||
HWD.pfnSetTexture(nextTexture);
|
||||
// texture should be already ready for use from calls to GL_SetTexture during batch collection
|
||||
GL_SetTexture(nextTexture);
|
||||
currentTexture = nextTexture;
|
||||
changeTexture = false;
|
||||
|
||||
|
||||
@@ -15,7 +15,9 @@
|
||||
|
||||
#include "hw_defs.h"
|
||||
#include "hw_data.h"
|
||||
#include "hw_drv.h"
|
||||
#include "hw_gl.h"
|
||||
|
||||
extern boolean currently_batching;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
|
||||
+16
-15
@@ -14,9 +14,10 @@
|
||||
#include "../doomdef.h"
|
||||
|
||||
#ifdef HWRENDER
|
||||
|
||||
#include "hw_main.h"
|
||||
#include "hw_glob.h"
|
||||
#include "hw_drv.h"
|
||||
#include "hw_gl.h"
|
||||
#include "hw_batching.h"
|
||||
|
||||
#include "../doomstat.h" //gamemode
|
||||
@@ -496,7 +497,7 @@ static void FreeMipmapColormap(INT32 patchnum, void *patch)
|
||||
if (next->data)
|
||||
Z_Free(next->data);
|
||||
next->data = NULL;
|
||||
HWD.pfnDeleteTexture(next);
|
||||
GL_DeleteTexture(next);
|
||||
|
||||
// Free the old colormap mipmap from memory.
|
||||
free(next);
|
||||
@@ -507,7 +508,7 @@ void HWR_FreeMipmapCache(void)
|
||||
{
|
||||
INT32 i;
|
||||
// free references to the textures
|
||||
HWD.pfnClearMipMapCache();
|
||||
GL_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
|
||||
@@ -574,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);
|
||||
GL_SetTexture(&gltex->mipmap);
|
||||
HWR_SetCurrentTexture(&gltex->mipmap);
|
||||
|
||||
// The system-memory data can be purged now.
|
||||
@@ -662,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 (!glMipmap->downloaded)
|
||||
HWD.pfnSetTexture(glMipmap);
|
||||
GL_SetTexture(glMipmap);
|
||||
HWR_SetCurrentTexture(glMipmap);
|
||||
|
||||
// The system-memory data can be purged now.
|
||||
@@ -691,7 +692,7 @@ static void HWR_LoadMappedPatch(GLMipmap_t *glMipmap, GLPatch_t *glPatch)
|
||||
|
||||
// If hardware does not have the texture, then call pfnSetTexture to upload it
|
||||
if (!glMipmap->downloaded)
|
||||
HWD.pfnSetTexture(glMipmap);
|
||||
GL_SetTexture(glMipmap);
|
||||
HWR_SetCurrentTexture(glMipmap);
|
||||
|
||||
// The system-memory data can be purged now.
|
||||
@@ -721,7 +722,7 @@ void HWR_GetPatch(GLPatch_t *glPatch)
|
||||
|
||||
// If hardware does not have the texture, then call pfnSetTexture to upload it
|
||||
if (!glPatch->mipmap->downloaded)
|
||||
HWD.pfnSetTexture(glPatch->mipmap);
|
||||
GL_SetTexture(glPatch->mipmap);
|
||||
HWR_SetCurrentTexture(glPatch->mipmap);
|
||||
|
||||
// The system-memory patch data can be purged now.
|
||||
@@ -896,7 +897,7 @@ void HWR_GetFadeMask(lumpnum_t fademasklumpnum)
|
||||
if (!glMipmap->downloaded && !glMipmap->data)
|
||||
HWR_CacheFadeMask(glMipmap, fademasklumpnum);
|
||||
|
||||
HWD.pfnSetTexture(glMipmap);
|
||||
GL_SetTexture(glMipmap);
|
||||
|
||||
// The system-memory data can be purged now.
|
||||
Z_ChangeTag(glMipmap->data, PU_HWRCACHE_UNLOCKED);
|
||||
@@ -929,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);
|
||||
GL_SetScreenPalette(crushed_palette);
|
||||
}
|
||||
else
|
||||
{
|
||||
HWD.pfnSetScreenPalette(palette);
|
||||
GL_SetScreenPalette(palette);
|
||||
}
|
||||
|
||||
// this part is responsible for keeping track of the palette OUTSIDE of a level.
|
||||
@@ -943,7 +944,7 @@ void HWR_SetPalette(RGBA_t *palette)
|
||||
else
|
||||
{
|
||||
// set the palette for the textures
|
||||
HWD.pfnSetTexturePalette(palette);
|
||||
GL_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
|
||||
@@ -976,7 +977,7 @@ static void HWR_SetPaletteLookup(RGBA_t *palette)
|
||||
}
|
||||
}
|
||||
#undef STEP_SIZE
|
||||
HWD.pfnSetPaletteLookup(lut);
|
||||
GL_SetPaletteLookup(lut);
|
||||
Z_Free(lut);
|
||||
}
|
||||
|
||||
@@ -1024,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);
|
||||
GL_SetPalette(mapPalette);
|
||||
|
||||
if (patchformat == GL_TEXFMT_RGBA || textureformat == GL_TEXFMT_RGBA)
|
||||
{
|
||||
@@ -1047,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 = GL_CreateLightTable(hw_lighttable);
|
||||
Z_Free(hw_lighttable);
|
||||
return id;
|
||||
}
|
||||
@@ -1083,7 +1084,7 @@ UINT32 HWR_GetLightTableID(extracolormap_t *colormap)
|
||||
void HWR_ClearLightTables(void)
|
||||
{
|
||||
if (vid.glstate == VID_GL_LIBRARY_LOADED)
|
||||
HWD.pfnClearLightTables();
|
||||
GL_ClearLightTables();
|
||||
}
|
||||
|
||||
#endif //HWRENDER
|
||||
+22
-21
@@ -18,9 +18,10 @@
|
||||
#include "../doomdef.h"
|
||||
|
||||
#ifdef HWRENDER
|
||||
|
||||
#include "hw_main.h"
|
||||
#include "hw_glob.h"
|
||||
#include "hw_drv.h"
|
||||
#include "hw_gl.h"
|
||||
|
||||
#include "../m_misc.h" //FIL_WriteFile()
|
||||
#include "../r_draw.h" //viewborderlump
|
||||
@@ -122,7 +123,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);
|
||||
GL_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 +304,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);
|
||||
GL_DrawPolygon(&Surf, v, 4, flags);
|
||||
}
|
||||
else
|
||||
HWD.pfnDrawPolygon(NULL, v, 4, flags);
|
||||
GL_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 +461,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);
|
||||
GL_DrawPolygon(&Surf, v, 4, flags);
|
||||
}
|
||||
else
|
||||
HWD.pfnDrawPolygon(NULL, v, 4, flags);
|
||||
GL_DrawPolygon(NULL, v, 4, flags);
|
||||
}
|
||||
|
||||
// ==========================================================================
|
||||
@@ -539,7 +540,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);
|
||||
GL_DrawPolygon(NULL, v, 4, PF_NoDepthTest); //PF_Translucent);
|
||||
}
|
||||
|
||||
|
||||
@@ -575,10 +576,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();
|
||||
GL_MakeScreenTexture(scr_tex);
|
||||
GL_SetShader(HWR_GetShaderFromTarget(SHADER_UI_COLORMAP_FADE));
|
||||
GL_DrawScreenTexture(scr_tex, &Surf, PF_ColorMapped|PF_NoDepthTest);
|
||||
GL_UnSetShader();
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -602,7 +603,7 @@ void HWR_FadeScreenMenuBack(UINT16 color, UINT8 strength)
|
||||
poly_flags |= PF_Translucent;
|
||||
}
|
||||
|
||||
HWD.pfnDrawPolygon(&Surf, v, 4, poly_flags);
|
||||
GL_DrawPolygon(&Surf, v, 4, poly_flags);
|
||||
}
|
||||
|
||||
// Draw the console background with translucency support
|
||||
@@ -629,7 +630,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);
|
||||
GL_DrawPolygon(&Surf, v, 4, PF_NoTexture|PF_Modulated|PF_Translucent|PF_NoDepthTest);
|
||||
}
|
||||
|
||||
|
||||
@@ -785,7 +786,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);
|
||||
GL_Draw2DLine(&v1, &v2, color_rgba);
|
||||
}
|
||||
|
||||
// -----------------+
|
||||
@@ -879,7 +880,7 @@ void HWR_DrawDiag(INT32 x, INT32 y, INT32 wh, INT32 color)
|
||||
|
||||
Surf.PolyColor = palette[color&0xFF];
|
||||
|
||||
HWD.pfnDrawPolygon(&Surf, v, 4,
|
||||
GL_DrawPolygon(&Surf, v, 4,
|
||||
PF_Modulated|PF_NoTexture|PF_NoDepthTest);
|
||||
}
|
||||
|
||||
@@ -918,7 +919,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);
|
||||
GL_ClearBuffer(true, false, false, &clearColour);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -989,7 +990,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);
|
||||
GL_DrawPolygon(&Surf, v, 4, PF_NoTexture|PF_Modulated|PF_Translucent|PF_NoDepthTest);
|
||||
}
|
||||
|
||||
// -----------------+
|
||||
@@ -1029,7 +1030,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);
|
||||
GL_ClearBuffer(true, false, false, &clearColour);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1107,7 +1108,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);
|
||||
GL_DrawPolygon(&Surf, v, 4, PF_NoTexture|PF_Modulated|PF_Translucent|PF_NoDepthTest);
|
||||
}
|
||||
|
||||
#ifdef HAVE_PNG
|
||||
@@ -1191,7 +1192,7 @@ UINT8 *HWR_GetScreenshot(void)
|
||||
return NULL;
|
||||
|
||||
// returns 24bit 888 RGB
|
||||
HWD.pfnReadScreenTexture(HWD_SCREENTEXTURE_GENERIC2, (void *)buf);
|
||||
GL_ReadScreenTexture(HWD_SCREENTEXTURE_GENERIC2, (void *)buf);
|
||||
return buf;
|
||||
}
|
||||
|
||||
@@ -1207,7 +1208,7 @@ boolean HWR_Screenshot(const char *pathname)
|
||||
}
|
||||
|
||||
// returns 24bit 888 RGB
|
||||
HWD.pfnReadScreenTexture(HWD_SCREENTEXTURE_GENERIC2, (void *)buf);
|
||||
GL_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) (gl_sky_t *sky);
|
||||
|
||||
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, boolean useshader);
|
||||
|
||||
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,79 @@
|
||||
// SONIC ROBO BLAST 2 Kart
|
||||
//-----------------------------------------------------------------------------
|
||||
// Copyright (C) 2020 by Jaime "Lactozilla" Passos.
|
||||
// Copyright (C) 2020 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 hw_gl.h
|
||||
/// \brief OpenGL low-level interface API
|
||||
|
||||
#ifndef __HWR_GL_H__
|
||||
#define __HWR_GL_H__
|
||||
|
||||
#include "../screen.h"
|
||||
|
||||
#include "hw_data.h"
|
||||
#include "hw_defs.h"
|
||||
#include "hw_md2.h"
|
||||
|
||||
#define SCREENVERTS 10
|
||||
|
||||
boolean GL_Init(void);
|
||||
void GL_FinishUpdate(INT32 waitvbl);
|
||||
void SetupGLInfo(void);
|
||||
|
||||
void GL_SetSpecialState(hwdspecialstate_t IdState, INT32 Value);
|
||||
void GL_SetTransform(FTransform *stransform);
|
||||
void GL_SetBlend(FBITFIELD PolyFlags);
|
||||
void GL_SetPalette(RGBA_t *palette);
|
||||
void GL_ClearBuffer(FBOOLEAN ColorMask, FBOOLEAN DepthMask, FBOOLEAN StencilMask, FRGBAFloat * ClearColor);
|
||||
|
||||
void GL_DrawPolygon(FSurfaceInfo *pSurf, FOutVector *pOutVerts, FUINT iNumPts, FBITFIELD PolyFlags);
|
||||
void GL_DrawIndexedTriangles(FSurfaceInfo *pSurf, FOutVector *pOutVerts, FUINT iNumPts, FBITFIELD PolyFlags, unsigned int *IndexArray);
|
||||
void GL_Draw2DLine(F2DCoord *v1, F2DCoord *v2, RGBA_t Color);
|
||||
|
||||
void GL_DrawModelEx(model_t *model, INT32 frameIndex, float duration, float tics, INT32 nextFrameIndex, FTransform *pos, float hscale, float vscale, UINT8 flipped, UINT8 hflipped, FSurfaceInfo *Surface);
|
||||
#define GL_DrawModel(model, frameIndex, duration, tics, nextFrameIndex, pos, hscale, vscale, flipped, hflipped, Surface) GL_DrawModelEx(model, frameIndex, duration, tics, nextFrameIndex, pos, hscale, vscale, flipped, hflipped, Surface)
|
||||
|
||||
void GL_RenderSkyDome(gl_sky_t *sky);
|
||||
|
||||
void GL_SetTexture(GLMipmap_t *pTexInfo);
|
||||
void GL_DeleteTexture(GLMipmap_t *pTexInfo);
|
||||
|
||||
void GL_Flush(void);
|
||||
#define GL_ClearMipMapCache GL_Flush
|
||||
|
||||
INT32 GL_GetTextureUsed(void);
|
||||
|
||||
void GL_CreateModelVBOs(model_t *model);
|
||||
|
||||
void GL_ReadScreenTexture(int tex, UINT16 *dst_data);
|
||||
void GL_GClipRect(INT32 minx, INT32 miny, INT32 maxx, INT32 maxy, float nearclip, float farclip);
|
||||
|
||||
void GL_MakeScreenTexture(int tex);
|
||||
void GL_FlushScreenTextures(void);
|
||||
|
||||
void GL_DrawScreenTexture(int tex, FSurfaceInfo *surf, FBITFIELD polyflags);
|
||||
void GL_DoScreenWipe(int wipeStart, int wipeEnd);
|
||||
void GL_RenderVhsEffect(fixed_t upbary, fixed_t downbary, UINT8 updistort, UINT8 downdistort, UINT8 barsize);
|
||||
void GL_DrawScreenFinalTexture(int tex, INT32 width, INT32 height, boolean useshader);
|
||||
|
||||
void GL_PostImgRedraw(float points[SCREENVERTS][SCREENVERTS][2]);
|
||||
|
||||
boolean GL_InitShaders(void);
|
||||
void GL_LoadShader(int slot, char *code, hwdshaderstage_t stage);
|
||||
boolean GL_CompileShader(int slot);
|
||||
void GL_SetShader(int slot);
|
||||
void GL_UnSetShader(void);
|
||||
|
||||
void GL_SetShaderInfo(hwdshaderinfo_t info, INT32 value);
|
||||
|
||||
void GL_SetPaletteLookup(UINT8 *lut);
|
||||
UINT32 GL_CreateLightTable(RGBA_t *hw_lighttable);
|
||||
void GL_ClearLightTables(void);
|
||||
void GL_SetScreenPalette(RGBA_t *palette);
|
||||
|
||||
#endif // __HWR_GL_H__
|
||||
+58
-56
@@ -14,13 +14,13 @@
|
||||
#include <math.h>
|
||||
|
||||
#include "../doomstat.h"
|
||||
|
||||
#include "../qs22j.h"
|
||||
#include "../doomdef.h"
|
||||
|
||||
#ifdef HWRENDER
|
||||
|
||||
#include "hw_main.h"
|
||||
#include "hw_glob.h"
|
||||
#include "hw_drv.h"
|
||||
#include "hw_gl.h"
|
||||
#include "hw_batching.h"
|
||||
#include "hw_md2.h"
|
||||
#include "hw_clip.h"
|
||||
@@ -56,6 +56,8 @@
|
||||
#include "../w_wad.h"
|
||||
#include "../z_zone.h"
|
||||
|
||||
#include "../qs22j.h" // fast qsort
|
||||
|
||||
// ==========================================================================
|
||||
// Globals
|
||||
// ==========================================================================
|
||||
@@ -63,8 +65,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;
|
||||
|
||||
@@ -244,7 +244,7 @@ static void CV_screentextures_OnChange(void)
|
||||
CV_SetValue(&cv_glframebuffer, 0);
|
||||
#endif
|
||||
}
|
||||
HWD.pfnSetSpecialState(HWD_SET_SCREEN_TEXTURES, cv_glscreentextures.value);
|
||||
GL_SetSpecialState(HWD_SET_SCREEN_TEXTURES, cv_glscreentextures.value);
|
||||
M_UpdateOGLMenu();
|
||||
}
|
||||
|
||||
@@ -285,13 +285,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);
|
||||
GL_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);
|
||||
GL_SetSpecialState(HWD_SET_TEXTUREANISOTROPICMODE, cv_glanisotropicmode.value);
|
||||
}
|
||||
|
||||
static void CV_glpaletterendering_OnChange(void)
|
||||
@@ -326,7 +326,7 @@ boolean HWR_UseShader(void)
|
||||
|
||||
static void HWR_SetShaderState(void)
|
||||
{
|
||||
HWD.pfnSetSpecialState(HWD_SET_SHADERS, HWR_UseShader() ? 1 : 0);
|
||||
GL_SetSpecialState(HWD_SET_SHADERS, HWR_UseShader() ? 1 : 0);
|
||||
}
|
||||
|
||||
boolean HWR_ShouldUsePaletteRendering(void)
|
||||
@@ -1116,10 +1116,10 @@ static void HWR_DrawSkyWallList(void)
|
||||
surf.PolyColor.rgba = 0xFFFFFFFF;
|
||||
|
||||
HWR_SetCurrentTexture(NULL);
|
||||
HWD.pfnUnSetShader();
|
||||
GL_UnSetShader();
|
||||
for (i = 0; i < skyWallVertexArraySize; i++)
|
||||
{
|
||||
HWD.pfnDrawPolygon(&surf, skyWallVertexArray + i * 4, 4, PF_Occlude|PF_Invisible|PF_NoTexture);
|
||||
GL_DrawPolygon(&surf, skyWallVertexArray + i * 4, 4, PF_Occlude|PF_Invisible|PF_NoTexture);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4202,7 +4202,7 @@ static void HWR_RenderDrawNodes(void)
|
||||
PS_START_TIMING(ps_hw_nodedrawtime);
|
||||
|
||||
// Okay! Let's draw it all! Woo!
|
||||
HWD.pfnSetTransform(&atransform);
|
||||
GL_SetTransform(&atransform);
|
||||
|
||||
for (i = 0; i < numdrawnodes; i++)
|
||||
{
|
||||
@@ -5042,7 +5042,7 @@ static void HWR_DrawSkyBackground(void)
|
||||
if (drewsky)
|
||||
return;
|
||||
|
||||
HWD.pfnSetBlend(PF_Translucent|PF_NoDepthTest|PF_Modulated);
|
||||
GL_SetBlend(PF_Translucent|PF_NoDepthTest|PF_Modulated);
|
||||
|
||||
memcpy(&dometransform, &atransform, sizeof(FTransform));
|
||||
|
||||
@@ -5064,9 +5064,9 @@ static void HWR_DrawSkyBackground(void)
|
||||
}
|
||||
|
||||
if (HWR_UseShader())
|
||||
HWD.pfnSetShader(HWR_GetShaderFromTarget(SHADER_SKY));
|
||||
HWD.pfnSetTransform(&dometransform);
|
||||
HWD.pfnRenderSkyDome(&gl_sky);
|
||||
GL_SetShader(HWR_GetShaderFromTarget(SHADER_SKY));
|
||||
GL_SetTransform(&dometransform);
|
||||
GL_RenderSkyDome(&gl_sky);
|
||||
}
|
||||
|
||||
// -----------------+
|
||||
@@ -5074,12 +5074,12 @@ static void HWR_DrawSkyBackground(void)
|
||||
// -----------------+
|
||||
static inline void HWR_ClearView(void)
|
||||
{
|
||||
HWD.pfnGClipRect((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);
|
||||
GL_GClipRect((INT32)gl_viewwindowx,
|
||||
(INT32)gl_viewwindowy,
|
||||
(INT32)(gl_viewwindowx + gl_viewwidth),
|
||||
(INT32)(gl_viewwindowy + gl_viewheight),
|
||||
ZCLIP_PLANE, FAR_ZCLIP_DEFAULT);
|
||||
GL_ClearBuffer(false, true, true, NULL);
|
||||
}
|
||||
|
||||
|
||||
@@ -5101,7 +5101,7 @@ void HWR_SetViewSize(void)
|
||||
gl_baseviewwindowy = 0;
|
||||
gl_baseviewwindowx = 0;
|
||||
|
||||
HWD.pfnFlushScreenTextures();
|
||||
GL_FlushScreenTextures();
|
||||
}
|
||||
|
||||
// Set view aiming, for the sky dome, the skybox,
|
||||
@@ -5166,7 +5166,7 @@ void HWR_SetTransform(float fpov, player_t *player)
|
||||
atransform.mirrorflip = true;
|
||||
|
||||
// Set transform.
|
||||
HWD.pfnSetTransform(&atransform);
|
||||
GL_SetTransform(&atransform);
|
||||
}
|
||||
|
||||
void HWR_ClearClipper(void)
|
||||
@@ -5183,8 +5183,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);
|
||||
GL_SetSpecialState(HWD_SET_STENCIL_LEVEL, level);
|
||||
GL_SetSpecialState(HWD_SET_PORTAL_MODE, state);
|
||||
}
|
||||
|
||||
// Renders the current viewpoint, though takes portal arguments for recursive portals.
|
||||
@@ -5240,7 +5240,7 @@ void HWR_RenderViewpoint(gl_portal_t *rootportal, const float fpov, player_t *pl
|
||||
}
|
||||
|
||||
// Set transform.
|
||||
HWD.pfnSetTransform(&atransform);
|
||||
GL_SetTransform(&atransform);
|
||||
|
||||
validcount++;
|
||||
|
||||
@@ -5284,7 +5284,7 @@ void HWR_RenderViewpoint(gl_portal_t *rootportal, const float fpov, player_t *pl
|
||||
drewsky = false;
|
||||
HWR_DrawSkyBackground();
|
||||
HWR_SetStencilState(HWR_STENCIL_NORMAL, 0);
|
||||
HWD.pfnClearBuffer(false, false, true, 0);// clear skywall markings from the stencil buffer
|
||||
GL_ClearBuffer(false, false, true, 0);// clear skywall markings from the stencil buffer
|
||||
HWR_SetTransform(fpov, player);// restore transform
|
||||
}
|
||||
gl_collect_skywalls = false;
|
||||
@@ -5355,11 +5355,11 @@ static void HWR_RenderFrame(INT32 viewnumber, player_t *player, boolean skybox)
|
||||
|
||||
if (!skybox && cv_glrenderdistance.value)
|
||||
{
|
||||
HWD.pfnGClipRect((INT32)gl_viewwindowx,
|
||||
(INT32)gl_viewwindowy,
|
||||
(INT32)(gl_viewwindowx + gl_viewwidth),
|
||||
(INT32)(gl_viewwindowy + gl_viewheight),
|
||||
ZCLIP_PLANE, clipping_distances[cv_glrenderdistance.value - 1]);
|
||||
GL_GClipRect((INT32)gl_viewwindowx,
|
||||
(INT32)gl_viewwindowy,
|
||||
(INT32)(gl_viewwindowx + gl_viewwidth),
|
||||
(INT32)(gl_viewwindowy + gl_viewheight),
|
||||
ZCLIP_PLANE, clipping_distances[cv_glrenderdistance.value - 1]);
|
||||
current_bsp_culling_distance = bsp_culling_distances[cv_glrenderdistance.value - 1];
|
||||
}
|
||||
|
||||
@@ -5367,8 +5367,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();
|
||||
GL_SetTransform(NULL);
|
||||
GL_UnSetShader();
|
||||
|
||||
// Run post processor effects
|
||||
if (!skybox)
|
||||
@@ -5376,7 +5376,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);
|
||||
GL_GClipRect(0, 0, vid.width, vid.height, NZCLIP_PLANE, FAR_ZCLIP_DEFAULT);
|
||||
}
|
||||
|
||||
// ==========================================================================
|
||||
@@ -5406,11 +5406,13 @@ void HWR_RenderPlayerView(INT32 viewnumber, player_t *player)
|
||||
ClearColor.blue = 0.0f;
|
||||
ClearColor.alpha = 1.0f;
|
||||
|
||||
HWD.pfnClearBuffer(true, false, false, &ClearColor);
|
||||
GL_ClearBuffer(true, false, false, &ClearColor);
|
||||
}
|
||||
|
||||
if (HWR_UseShader() && cv_ripplewater.value)
|
||||
HWD.pfnSetShaderInfo(HWD_SHADERINFO_LEVELTIME, (INT32)leveltime); // The water surface shader needs the leveltime.
|
||||
{
|
||||
GL_SetShaderInfo(HWD_SHADERINFO_LEVELTIME, (INT32)leveltime); // The water surface shader needs the leveltime.
|
||||
}
|
||||
|
||||
if (viewnumber > 3)
|
||||
return;
|
||||
@@ -5477,7 +5479,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();
|
||||
GL_ClearMipMapCache();
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -5491,7 +5493,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();
|
||||
GL_ClearMipMapCache();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5562,7 +5564,7 @@ void HWR_Startup(void)
|
||||
|
||||
if (msaa)
|
||||
HWD.pfnSetSpecialState(HWD_SET_MSAA, a2c ? 2 : 1);
|
||||
|
||||
|
||||
HWR_RegisterCommands();
|
||||
}
|
||||
startupdone = true;
|
||||
@@ -5645,9 +5647,9 @@ void HWR_Shutdown(void)
|
||||
HWR_FreeExtraSubsectors();
|
||||
HWR_FreeMipmapCache();
|
||||
HWR_FreeTextureCache();
|
||||
HWD.pfnFlushScreenTextures();
|
||||
GL_FlushScreenTextures();
|
||||
#ifdef USE_FBO_OGL
|
||||
GLFramebuffer_Disable();
|
||||
GL_Framebuffer_Disable();
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -5690,12 +5692,12 @@ static void HWR_RenderWall(FOutVector *wallVerts, FSurfaceInfo *pSurf, FBITFIELD
|
||||
|
||||
INT32 HWR_GetTextureUsed(void)
|
||||
{
|
||||
return HWD.pfnGetTextureUsed();
|
||||
return GL_GetTextureUsed();
|
||||
}
|
||||
|
||||
static void HWR_DoPostProcessor(player_t *player)
|
||||
{
|
||||
HWD.pfnUnSetShader();
|
||||
GL_UnSetShader();
|
||||
|
||||
// Armageddon Blast Flash!
|
||||
// Could this even be considered postprocessor?
|
||||
@@ -5719,7 +5721,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);
|
||||
GL_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
|
||||
@@ -5727,7 +5729,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);
|
||||
GL_MakeScreenTexture(HWD_SCREENTEXTURE_GENERIC1);
|
||||
|
||||
if (splitscreen) // Not supported in splitscreen - someone want to add support?
|
||||
return;
|
||||
@@ -5767,28 +5769,28 @@ static void HWR_DoPostProcessor(player_t *player)
|
||||
v[x][y][1] = (y/((float)(SCREENVERTS-1.0f)/9.0f))-4.5f;
|
||||
}
|
||||
}
|
||||
HWD.pfnPostImgRedraw(v);
|
||||
GL_PostImgRedraw(v);
|
||||
|
||||
// Capture the screen again for screen waving on the intermission
|
||||
if (gamestate != GS_INTERMISSION)
|
||||
HWD.pfnMakeScreenTexture(HWD_SCREENTEXTURE_GENERIC1);
|
||||
GL_MakeScreenTexture(HWD_SCREENTEXTURE_GENERIC1);
|
||||
}
|
||||
// Flipping of the screen isn't done here anymore
|
||||
}
|
||||
|
||||
void HWR_StartScreenWipe(void)
|
||||
{
|
||||
HWD.pfnMakeScreenTexture(HWD_SCREENTEXTURE_WIPE_START);
|
||||
GL_MakeScreenTexture(HWD_SCREENTEXTURE_WIPE_START);
|
||||
}
|
||||
|
||||
void HWR_EndScreenWipe(void)
|
||||
{
|
||||
HWD.pfnMakeScreenTexture(HWD_SCREENTEXTURE_WIPE_END);
|
||||
GL_MakeScreenTexture(HWD_SCREENTEXTURE_WIPE_END);
|
||||
}
|
||||
|
||||
void HWR_DrawIntermissionBG(void)
|
||||
{
|
||||
HWD.pfnDrawScreenTexture(HWD_SCREENTEXTURE_GENERIC1, NULL, 0);
|
||||
GL_DrawScreenTexture(HWD_SCREENTEXTURE_GENERIC1, NULL, 0);
|
||||
}
|
||||
|
||||
void HWR_DoWipe(UINT8 wipenum, UINT8 scrnnum)
|
||||
@@ -5822,22 +5824,22 @@ void HWR_DoWipe(UINT8 wipenum, UINT8 scrnnum)
|
||||
}
|
||||
|
||||
HWR_GetFadeMask(lumpnum);
|
||||
HWD.pfnDoScreenWipe(HWD_SCREENTEXTURE_WIPE_START, HWD_SCREENTEXTURE_WIPE_END);
|
||||
GL_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);
|
||||
GL_RenderVhsEffect(upbary, downbary, updistort, downdistort, barsize);
|
||||
}
|
||||
|
||||
void HWR_MakeScreenFinalTexture(void)
|
||||
{
|
||||
HWD.pfnMakeScreenTexture(HWD_SCREENTEXTURE_GENERIC2);
|
||||
GL_MakeScreenTexture(HWD_SCREENTEXTURE_GENERIC2);
|
||||
}
|
||||
|
||||
void HWR_DrawScreenFinalTexture(INT32 width, INT32 height, boolean useshader)
|
||||
{
|
||||
HWD.pfnDrawScreenFinalTexture(HWD_SCREENTEXTURE_GENERIC2, width, height, useshader);
|
||||
GL_DrawScreenFinalTexture(HWD_SCREENTEXTURE_GENERIC2, width, height, useshader);
|
||||
}
|
||||
|
||||
#endif // HWRENDER
|
||||
+15
-12
@@ -25,12 +25,14 @@
|
||||
#include "../doomstat.h"
|
||||
|
||||
#ifdef HWRENDER
|
||||
#include "hw_drv.h"
|
||||
|
||||
#include "hw_gl.h"
|
||||
#include "hw_md2.h"
|
||||
#include "../d_main.h"
|
||||
#include "../r_bsp.h"
|
||||
#include "../r_fps.h"
|
||||
#include "../r_main.h"
|
||||
#include "../p_setup.h"
|
||||
#include "../m_misc.h"
|
||||
#include "../w_wad.h"
|
||||
#include "../z_zone.h"
|
||||
@@ -43,8 +45,8 @@
|
||||
|
||||
#include "hw_main.h"
|
||||
#include "../v_video.h"
|
||||
#ifdef HAVE_PNG
|
||||
|
||||
#ifdef HAVE_PNG
|
||||
#ifndef _MSC_VER
|
||||
#ifndef _LARGEFILE64_SOURCE
|
||||
#define _LARGEFILE64_SOURCE
|
||||
@@ -417,7 +419,7 @@ static void md2_loadTexture(md2_t *model)
|
||||
}
|
||||
}
|
||||
}
|
||||
HWD.pfnSetTexture(glpatch->mipmap);
|
||||
GL_SetTexture(glpatch->mipmap);
|
||||
HWR_UnlockCachedPatch(glpatch);
|
||||
}
|
||||
|
||||
@@ -467,7 +469,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
|
||||
GL_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);
|
||||
@@ -1048,11 +1050,11 @@ 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);
|
||||
GL_SetTexture(gpatch->mipmap);
|
||||
return;
|
||||
}
|
||||
|
||||
// search for the Mipmap
|
||||
// search for the mimmap
|
||||
// skip the first (no colormap translated)
|
||||
for (glMipmap = gpatch->mipmap; glMipmap->nextcolormap; )
|
||||
{
|
||||
@@ -1063,7 +1065,7 @@ static void HWR_GetBlendedTexture(GLPatch_t *gpatch, GLPatch_t *blendgpatch, INT
|
||||
|
||||
if (glMipmap->downloaded && glMipmap->data)
|
||||
{
|
||||
HWD.pfnSetTexture(glMipmap); // found the colormap, set it to the correct texture
|
||||
GL_SetTexture(glMipmap); // found the colormap, set it to the correct texture
|
||||
Z_ChangeTag(glMipmap->data, PU_HWRCACHE_UNLOCKED);
|
||||
return;
|
||||
}
|
||||
@@ -1084,10 +1086,11 @@ static void HWR_GetBlendedTexture(GLPatch_t *gpatch, GLPatch_t *blendgpatch, INT
|
||||
|
||||
HWR_CreateBlendedTexture(gpatch, blendgpatch, newMipmap, skinnum, color);
|
||||
|
||||
HWD.pfnSetTexture(newMipmap);
|
||||
GL_SetTexture(newMipmap);
|
||||
Z_ChangeTag(newMipmap->data, PU_HWRCACHE_UNLOCKED);
|
||||
}
|
||||
|
||||
|
||||
// -----------------+
|
||||
// HWR_DrawMD2 : Draw MD2
|
||||
// :
|
||||
@@ -1233,7 +1236,7 @@ void HWR_DrawMD2(gl_vissprite_t *spr)
|
||||
if (md2->model)
|
||||
{
|
||||
md2_printModelInfo(md2->model);
|
||||
HWD.pfnCreateModelVBOs(md2->model);
|
||||
GL_CreateModelVBOs(md2->model);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1288,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);
|
||||
GL_SetTexture(gpatch->mipmap);
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -1461,7 +1464,7 @@ void HWR_DrawMD2(gl_vissprite_t *spr)
|
||||
p.mirror = atransform.mirror; // from Kart
|
||||
#endif
|
||||
|
||||
HWD.pfnSetShader(SHADER_MODEL); // model shader
|
||||
GL_SetShader(SHADER_MODEL); // model shader
|
||||
{
|
||||
SINT8 flipfactor = flip ? -1 : 1;
|
||||
|
||||
@@ -1478,7 +1481,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);
|
||||
GL_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_gl.h"
|
||||
#include "hw_defs.h"
|
||||
#include "hw_main.h"
|
||||
#include "hw_portal.h"
|
||||
@@ -153,7 +153,7 @@ static void HWR_RenderPortalSeg(gl_portal_t* portal, SINT8 state)
|
||||
|
||||
// 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);
|
||||
GL_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_gl.h"
|
||||
#include "hw_shaders.h"
|
||||
#include "../z_zone.h"
|
||||
|
||||
@@ -87,7 +87,7 @@ boolean HWR_InitShaders(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (!HWD.pfnInitShaders())
|
||||
if (!GL_InitShaders())
|
||||
return false;
|
||||
|
||||
for (i = 0; i < NUMSHADERTARGETS; i++)
|
||||
@@ -366,16 +366,16 @@ static void HWR_CompileShader(int index)
|
||||
{
|
||||
char *preprocessed = HWR_PreprocessShader(vertex_source);
|
||||
if (!preprocessed) return;
|
||||
HWD.pfnLoadShader(index, preprocessed, HWD_SHADERSTAGE_VERTEX);
|
||||
GL_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);
|
||||
GL_LoadShader(index, preprocessed, HWD_SHADERSTAGE_FRAGMENT);
|
||||
}
|
||||
|
||||
gl_shaders[index].compiled = HWD.pfnCompileShader(index);
|
||||
gl_shaders[index].compiled = GL_CompileShader(index);
|
||||
}
|
||||
|
||||
// compile or recompile shaders
|
||||
|
||||
@@ -99,6 +99,7 @@
|
||||
GLSL_DOOM_COLORMAP_NODITHER \
|
||||
"#endif\n" \
|
||||
"}\n"
|
||||
|
||||
// lighting cap adjustment:
|
||||
// first num (155.0), increase to make it start to go dark sooner
|
||||
// second num (0.26), increase to make it go dark faster
|
||||
|
||||
@@ -358,8 +358,8 @@ static INT32 WINAPI SetRes(viddef_t *lvid, vmode_t *pcurrentmode)
|
||||
else
|
||||
textureformatGL = GL_RGB5_A1;
|
||||
|
||||
SetModelView(lvid->width, lvid->height);
|
||||
SetStates();
|
||||
GL_SetModelView(lvid->width, lvid->height);
|
||||
GL_SetStates();
|
||||
// we need to clear the depth buffer. Very important!!!
|
||||
pglClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
|
||||
|
||||
@@ -526,7 +526,7 @@ EXPORT void HWRAPI(Shutdown) (void)
|
||||
// -----------------+
|
||||
// FinishUpdate : Swap front and back buffers
|
||||
// -----------------+
|
||||
EXPORT void HWRAPI(FinishUpdate) (INT32 waitvbl)
|
||||
void GL_FinishUpdate (INT32 waitvbl)
|
||||
{
|
||||
#ifdef USE_WGL_SWAP
|
||||
static INT32 oldwaitvbl = 0;
|
||||
@@ -547,23 +547,4 @@ EXPORT void HWRAPI(FinishUpdate) (INT32 waitvbl)
|
||||
|
||||
SwapBuffers(hDC);
|
||||
}
|
||||
|
||||
|
||||
// -----------------+
|
||||
// SetPalette : Set the color lookup table for paletted textures
|
||||
// : in OpenGL, we store values for conversion of paletted graphics when
|
||||
// : they are downloaded to the 3D card.
|
||||
// -----------------+
|
||||
EXPORT void HWRAPI(SetPalette) (RGBA_t *pal)
|
||||
{
|
||||
INT32 i;
|
||||
|
||||
for (i = 0; i < 256; i++)
|
||||
{
|
||||
myPaletteData[i].s.red = pal[i].s.red;
|
||||
myPaletteData[i].s.green = pal[i].s.green;
|
||||
myPaletteData[i].s.blue = pal[i].s.blue;
|
||||
myPaletteData[i].s.alpha = pal[i].s.alpha;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
+348
-375
File diff suppressed because it is too large.
Load diff
@@ -43,8 +43,9 @@
|
||||
#endif
|
||||
|
||||
#define _CREATE_DLL_ // necessary for Unix AND Windows
|
||||
|
||||
#include "../../doomdef.h"
|
||||
#include "../hw_drv.h"
|
||||
#include "../hw_gl.h"
|
||||
#include "../../z_zone.h"
|
||||
|
||||
// ==========================================================================
|
||||
@@ -65,14 +66,15 @@ 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);
|
||||
void Flush(void);
|
||||
INT32 isExtAvailable(const char *extension, const GLubyte *start);
|
||||
void SetModelView(GLint w, GLint h);
|
||||
void SetStates(void);
|
||||
void GL_Flush(void);
|
||||
INT32 GL_isExtAvailable(const char *extension, const GLubyte *start);
|
||||
void GL_SetModelView(GLint w, GLint h);
|
||||
void GL_SetStates(void);
|
||||
|
||||
#ifndef GL_EXT_texture_filter_anisotropic
|
||||
#define GL_TEXTURE_MAX_ANISOTROPY_EXT 0x84FE
|
||||
@@ -101,11 +103,11 @@ extern PFNglGetString pglGetString;
|
||||
#endif
|
||||
|
||||
#ifdef USE_FBO_OGL
|
||||
void GLFramebuffer_DeleteAttachments(void);
|
||||
void GL_Framebuffer_DeleteAttachments(void);
|
||||
|
||||
void GLFramebuffer_Unbind(void);
|
||||
void GLFramebuffer_Enable(void);
|
||||
void GLFramebuffer_Disable(void);
|
||||
void GL_Framebuffer_Unbind(void);
|
||||
void GL_Framebuffer_Enable(void);
|
||||
void GL_Framebuffer_Disable(void);
|
||||
|
||||
extern GLuint FramebufferObject, FramebufferTexture, RenderbufferObject;
|
||||
extern GLboolean FrameBufferEnabled, RenderToFramebuffer;
|
||||
|
||||
+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_gl.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);
|
||||
|
||||
+7
-47
@@ -74,15 +74,17 @@
|
||||
#include "../i_video.h"
|
||||
#include "../console.h"
|
||||
#include "../command.h"
|
||||
#include "sdlmain.h"
|
||||
#include "../i_system.h"
|
||||
#include "../hu_stuff.h" // for chat_on
|
||||
|
||||
#include "sdlmain.h"
|
||||
|
||||
#ifdef HWRENDER
|
||||
#include "../hardware/hw_main.h"
|
||||
#include "../hardware/hw_drv.h"
|
||||
#include "../hardware/hw_gl.h"
|
||||
#include "../hardware/r_opengl/r_opengl.h" //for supportFBO
|
||||
// For dynamic referencing of HW rendering functions
|
||||
#include "hwsym_sdl.h"
|
||||
|
||||
#include "hwsym_sdl.h" // For dynamic referencing of HW rendering functions
|
||||
#include "ogl_sdl.h"
|
||||
#endif
|
||||
|
||||
@@ -2144,50 +2146,8 @@ 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);
|
||||
vid.glstate = (VID_LoadOGLAPI() && GL_Init()) ? VID_GL_LIBRARY_LOADED : VID_GL_LIBRARY_ERROR;
|
||||
|
||||
HWD.pfnRenderSkyDome = hwSym("RenderSkyDome",NULL);
|
||||
|
||||
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_gl.h;
|
||||
path = ../../hardware/hw_gl.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_gl.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = hw_gl.h; path = ../../hardware/hw_gl.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_gl.h */,
|
||||
1E44AE680B67CC2B00BAD059 /* hw_light.c */,
|
||||
1E44AE690B67CC2B00BAD059 /* hw_light.h */,
|
||||
1E44AE6A0B67CC2B00BAD059 /* hw3sound.h */,
|
||||
|
||||
+15
-28
@@ -38,6 +38,7 @@
|
||||
#ifdef HWRENDER
|
||||
#include "../hardware/r_opengl/r_opengl.h"
|
||||
#include "../hardware/hw_main.h"
|
||||
#include "../hardware/hw_gl.h"
|
||||
#include "ogl_sdl.h"
|
||||
#include "../i_system.h"
|
||||
#include "hwsym_sdl.h"
|
||||
@@ -94,7 +95,7 @@ void *GetGLFunc(const char *proc)
|
||||
return SDL_GL_GetProcAddress(proc);
|
||||
}
|
||||
|
||||
boolean LoadGL(void)
|
||||
boolean VID_LoadOGLAPI(void)
|
||||
{
|
||||
#ifndef STATIC_OPENGL
|
||||
const char *OGLLibname = NULL;
|
||||
@@ -111,7 +112,7 @@ boolean LoadGL(void)
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
return SetupGLfunc();
|
||||
return true;
|
||||
}
|
||||
|
||||
/** \brief The OglSdlSurface function
|
||||
@@ -179,7 +180,7 @@ boolean OglSdlSurface(INT32 w, INT32 h)
|
||||
else
|
||||
supportMipMap = true;
|
||||
|
||||
if (isExtAvailable("GL_EXT_texture_filter_anisotropic", gl_extensions))
|
||||
if (GL_isExtAvailable("GL_EXT_texture_filter_anisotropic", gl_extensions))
|
||||
pglGetIntegerv(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &maximumAnisotropy);
|
||||
else
|
||||
maximumAnisotropy = 1;
|
||||
@@ -199,25 +200,25 @@ 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();
|
||||
GL_FlushScreenTextures();
|
||||
|
||||
#ifdef USE_FBO_OGL
|
||||
GLFramebuffer_DeleteAttachments();
|
||||
GL_Framebuffer_DeleteAttachments();
|
||||
#endif
|
||||
}
|
||||
|
||||
screen_width = (GLint)w;
|
||||
screen_height = (GLint)h;
|
||||
|
||||
SetModelView(w, h);
|
||||
SetStates();
|
||||
GL_SetModelView(w, h);
|
||||
GL_SetStates();
|
||||
pglClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT|GL_STENCIL_BUFFER_BIT);
|
||||
|
||||
#ifdef USE_FBO_OGL
|
||||
if (UseScreenFBO())
|
||||
GLFramebuffer_Enable();
|
||||
GL_Framebuffer_Enable();
|
||||
else
|
||||
GLFramebuffer_Disable();
|
||||
GL_Framebuffer_Disable();
|
||||
#endif
|
||||
|
||||
if (!first_init)
|
||||
@@ -257,22 +258,22 @@ void OglSdlFinishUpdate(boolean waitvbl)
|
||||
#ifdef USE_FBO_OGL
|
||||
if (usefbo)
|
||||
{
|
||||
GLFramebuffer_Unbind();
|
||||
GL_Framebuffer_Unbind();
|
||||
}
|
||||
#endif
|
||||
|
||||
HWR_DrawScreenFinalTexture(sdlw, sdlh, HWR_ShouldUsePaletteRendering());
|
||||
|
||||
GL_DrawScreenFinalTexture(HWD_SCREENTEXTURE_GENERIC2, sdlw, sdlh, HWR_ShouldUsePaletteRendering());
|
||||
|
||||
#ifdef USE_FBO_OGL
|
||||
if (usefbo)
|
||||
{
|
||||
GLFramebuffer_Enable();
|
||||
GL_Framebuffer_Enable();
|
||||
}
|
||||
#endif
|
||||
|
||||
SDL_GL_SwapWindow(window);
|
||||
|
||||
GClipRect(0, 0, realwidth, realheight, NZCLIP_PLANE, FAR_ZCLIP_DEFAULT);
|
||||
GL_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
|
||||
@@ -291,19 +292,5 @@ void OglSdlFinishUpdate(boolean waitvbl)
|
||||
#endif
|
||||
}
|
||||
|
||||
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
@@ -21,12 +21,10 @@
|
||||
boolean OglSdlSurface(INT32 w, INT32 h);
|
||||
|
||||
void OglSdlFinishUpdate(boolean vidwait);
|
||||
boolean VID_LoadOGLAPI(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