rename stuff to use "GL_" prefix

might get chaotic without a prefix lol
This commit is contained in:
Alug committed 2024-10-29 08:55:30 +01:00
1 parent cd78d6f0c7
commit 79f46931f4
17 files changed
+391 -442

No files matched your search

-1
View File
@@ -469,7 +469,6 @@ 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
+1 -1
View File
@@ -295,7 +295,7 @@ ifdef NOHW
else
OPTS+=-DHWRENDER
OBJS+=$(OBJDIR)/hw_bsp.o $(OBJDIR)/hw_draw.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_main.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
+10 -10
View File
@@ -65,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)
@@ -76,7 +76,7 @@ void HWR_SetCurrentTexture(GLMipmap_t *texture)
}
else
{
SetTexture(texture);
GL_SetTexture(texture);
}
}
@@ -130,8 +130,8 @@ void HWR_ProcessPolygon(FSurfaceInfo *pSurf, FOutVector *pOutVerts, FUINT iNumPt
}
else
{
SetShader((shader_target != SHADER_NONE) ? HWR_GetShaderFromTarget(shader_target) : shader_target);
DrawPolygon(pSurf, pOutVerts, iNumPts, PolyFlags);
GL_SetShader((shader_target != SHADER_NONE) ? HWR_GetShaderFromTarget(shader_target) : shader_target);
GL_DrawPolygon(pSurf, pOutVerts, iNumPts, PolyFlags);
}
}
@@ -295,13 +295,13 @@ void HWR_RenderBatches(void)
if (cv_glshaders.value && gl_shadersavailable)
{
SetShader(currentShader);
GL_SetShader(currentShader);
}
if (currentPolyFlags & PF_NoTexture)
currentTexture = NULL;
else
SetTexture(currentTexture);
GL_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
DrawIndexedTriangles(&currentSurfaceInfo, finalVertexArray, finalIndexWritePos, currentPolyFlags, finalVertexIndexArray);
GL_DrawIndexedTriangles(&currentSurfaceInfo, 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)
{
SetShader(nextShader);
GL_SetShader(nextShader);
currentShader = nextShader;
changeShader = false;
@@ -443,8 +443,8 @@ void HWR_RenderBatches(void)
}
if (changeTexture)
{
// texture should be already ready for use from calls to SetTexture during batch collection
SetTexture(nextTexture);
// texture should be already ready for use from calls to GL_SetTexture during batch collection
GL_SetTexture(nextTexture);
currentTexture = nextTexture;
changeTexture = false;
+14 -14
View File
@@ -497,7 +497,7 @@ static void FreeMipmapColormap(INT32 patchnum, void *patch)
if (next->data)
Z_Free(next->data);
next->data = NULL;
DeleteTexture(next);
GL_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
ClearMipMapCache();
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
@@ -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)
SetTexture(&gltex->mipmap);
GL_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)
SetTexture(glmip);
GL_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)
SetTexture(glmip);
GL_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)
SetTexture(gpatch->mipmap);
GL_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);
SetTexture(glmip);
GL_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;
}
SetScreenPalette(crushed_palette);
GL_SetScreenPalette(crushed_palette);
}
else
{
SetScreenPalette(palette);
GL_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
SetPalette(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
@@ -977,7 +977,7 @@ static void HWR_SetPaletteLookup(RGBA_t *palette)
}
}
#undef STEP_SIZE
SetPaletteLookup(lut);
GL_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);
SetPalette(mapPalette);
GL_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 = CreateLightTable(hw_lighttable);
id = GL_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)
ClearLightTables();
GL_ClearLightTables();
}
#endif //HWRENDER
+37 -37
View File
@@ -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
DrawPolygon(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 +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;
DrawPolygon(&Surf, v, 4, flags);
GL_DrawPolygon(&Surf, v, 4, flags);
}
else
DrawPolygon(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 +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;
DrawPolygon(&Surf, v, 4, flags);
GL_DrawPolygon(&Surf, v, 4, flags);
}
else
DrawPolygon(NULL, v, 4, flags);
GL_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?
DrawPolygon(NULL, v, 4, PF_NoDepthTest); //PF_Translucent);
GL_DrawPolygon(NULL, v, 4, PF_NoDepthTest); //PF_Translucent);
}
@@ -552,33 +552,33 @@ void HWR_DrawFlatFill (INT32 x, INT32 y, INT32 w, INT32 h, lumpnum_t flatlumpnum
// 0--1
void HWR_FadeScreenMenuBack(UINT16 color, UINT8 strength)
{
FOutVector v[4];
FSurfaceInfo Surf;
FOutVector v[4];
FSurfaceInfo Surf;
FBITFIELD poly_flags = PF_NoTexture|PF_Modulated|PF_NoDepthTest;
v[0].x = v[3].x = -1.0f;
v[2].x = v[1].x = 1.0f;
v[0].y = v[1].y = -1.0f;
v[2].y = v[3].y = 1.0f;
v[0].z = v[1].z = v[2].z = v[3].z = 1.0f;
v[0].x = v[3].x = -1.0f;
v[2].x = v[1].x = 1.0f;
v[0].y = v[1].y = -1.0f;
v[2].y = v[3].y = 1.0f;
v[0].z = v[1].z = v[2].z = v[3].z = 1.0f;
v[0].s = v[3].s = 0.0f;
v[2].s = v[1].s = 1.0f;
v[0].t = v[1].t = 1.0f;
v[2].t = v[3].t = 0.0f;
v[0].s = v[3].s = 0.0f;
v[2].s = v[1].s = 1.0f;
v[0].t = v[1].t = 1.0f;
v[2].t = v[3].t = 0.0f;
if (color & 0xFF00) // Do COLORMAP fade.
{
if (color & 0xFF00) // Do COLORMAP fade.
{
if (HWR_ShouldUsePaletteRendering() && cv_glscreentextures.value)
{
const hwdscreentexture_t scr_tex = HWD_SCREENTEXTURE_GENERIC2;
Surf.LightTableId = HWR_GetLightTableID(NULL);
Surf.LightInfo.light_level = strength;
MakeScreenTexture(scr_tex);
SetShader(HWR_GetShaderFromTarget(SHADER_UI_COLORMAP_FADE));
DrawScreenTexture(scr_tex, &Surf, PF_ColorMapped|PF_NoDepthTest);
UnSetShader();
GL_MakeScreenTexture(scr_tex);
GL_SetShader(HWR_GetShaderFromTarget(SHADER_UI_COLORMAP_FADE));
GL_DrawScreenTexture(scr_tex, &Surf, PF_ColorMapped|PF_NoDepthTest);
GL_UnSetShader();
return;
}
@@ -588,9 +588,9 @@ void HWR_FadeScreenMenuBack(UINT16 color, UINT8 strength)
Surf.PolyColor.s.alpha = (strength*8);
poly_flags |= PF_Translucent;
}
}
else // Do TRANSMAP** fade.
{
}
else // Do TRANSMAP** fade.
{
RGBA_t *palette = HWR_GetTexturePalette();
Surf.PolyColor.rgba = palette[color&0xFF].rgba;
@@ -600,9 +600,9 @@ void HWR_FadeScreenMenuBack(UINT16 color, UINT8 strength)
Surf.PolyColor.s.alpha = (UINT8)(strength*25.5f);
poly_flags |= PF_Translucent;
}
}
DrawPolygon(&Surf, v, 4, poly_flags);
GL_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;
DrawPolygon(&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 +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);
Draw2DLine(&v1, &v2, color_rgba);
GL_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];
DrawPolygon(&Surf, v, 4,
GL_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;
ClearBuffer(true, false, false, &clearColour);
GL_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;
DrawPolygon(&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 +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;
ClearBuffer(true, false, false, &clearColour);
GL_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];
}
DrawPolygon(&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 +1191,7 @@ UINT8 *HWR_GetScreenshot(void)
return NULL;
// returns 24bit 888 RGB
ReadScreenTexture(HWD_SCREENTEXTURE_GENERIC2, (void *)buf);
GL_ReadScreenTexture(HWD_SCREENTEXTURE_GENERIC2, (void *)buf);
return buf;
}
@@ -1207,7 +1207,7 @@ boolean HWR_Screenshot(const char *pathname)
}
// returns 24bit 888 RGB
ReadScreenTexture(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);
-18
View File
@@ -1,18 +0,0 @@
// 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"
#endif // HWRENDER
+42 -37
View File
@@ -19,55 +19,60 @@
#define SCREENVERTS 10
boolean Init (void);
void FinishUpdate (INT32 waitvbl);
boolean GL_Init (void);
void GL_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 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 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 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_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 GL_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 GL_SetTexture (GLMipmap_t *pTexInfo);
void GL_UpdateTexture (GLMipmap_t *pTexInfo);
void GL_DeleteTexture (GLMipmap_t *pTexInfo);
void ClearMipMapCache (void);
INT32 GetTextureUsed (void);
void GL_Flush(void);
static inline void GL_ClearMipMapCache (void)
{
GL_Flush();
}
void CreateModelVBOs (model_t *model);
INT32 GL_GetTextureUsed (void);
void ReadScreenTexture (int tex, UINT16 *dst_data);
void GClipRect (INT32 minx, INT32 miny, INT32 maxx, INT32 maxy, float nearclip, float farclip);
void GL_CreateModelVBOs (model_t *model);
void MakeScreenTexture (int tex);
void FlushScreenTextures (void);
void GL_ReadScreenTexture (int tex, UINT16 *dst_data);
void GL_GClipRect (INT32 minx, INT32 miny, INT32 maxx, INT32 maxy, float nearclip, float farclip);
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 GL_MakeScreenTexture (int tex);
void GL_FlushScreenTextures (void);
void PostImgRedraw (float points[SCREENVERTS][SCREENVERTS][2]);
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 InitShaders (void);
void LoadShader (int slot, char *code, hwdshaderstage_t stage);
boolean CompileShader (int slot);
void SetShader (int slot);
void UnSetShader (void);
void GL_PostImgRedraw (float points[SCREENVERTS][SCREENVERTS][2]);
void SetShaderInfo (hwdshaderinfo_t info, INT32 value);
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 SetPaletteLookup (UINT8 *lut);
UINT32 CreateLightTable (RGBA_t *hw_lighttable);
void ClearLightTables (void);
void SetScreenPalette (RGBA_t *palette);
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_GPU_H__
+56 -56
View File
@@ -241,7 +241,7 @@ static void CV_screentextures_OnChange(void)
CV_SetValue(&cv_glframebuffer, 0);
#endif
}
SetSpecialState(HWD_SET_SCREEN_TEXTURES, cv_glscreentextures.value);
GL_SetSpecialState(HWD_SET_SCREEN_TEXTURES, cv_glscreentextures.value);
M_UpdateOGLMenu();
}
@@ -253,7 +253,7 @@ static void CV_glframebuffer_OnChange(void)
CV_SetValue(&cv_glframebuffer, 0);
if (supportFBO)
SetSpecialState(HWD_SET_FRAMEBUFFER, cv_glframebuffer.value);
GL_SetSpecialState(HWD_SET_FRAMEBUFFER, cv_glframebuffer.value);
I_DownSample();
RefreshOGLSDLSurface();
M_UpdateOGLMenu();
@@ -284,13 +284,13 @@ static void CV_gllightdithering_OnChange(void)
static void CV_filtermode_OnChange(void)
{
ONLY_IF_GL_LOADED
SetSpecialState(HWD_SET_TEXTUREFILTERMODE, cv_glfiltermode.value);
GL_SetSpecialState(HWD_SET_TEXTUREFILTERMODE, cv_glfiltermode.value);
}
static void CV_anisotropic_OnChange(void)
{
ONLY_IF_GL_LOADED
SetSpecialState(HWD_SET_TEXTUREANISOTROPICMODE, cv_glanisotropicmode.value);
GL_SetSpecialState(HWD_SET_TEXTUREANISOTROPICMODE, cv_glanisotropicmode.value);
}
static void CV_glpaletterendering_OnChange(void)
@@ -325,7 +325,7 @@ boolean HWR_UseShader(void)
static void HWR_SetShaderState(void)
{
SetSpecialState(HWD_SET_SHADERS, HWR_UseShader() ? 1 : 0);
GL_SetSpecialState(HWD_SET_SHADERS, HWR_UseShader() ? 1 : 0);
}
boolean HWR_ShouldUsePaletteRendering(void)
@@ -1155,10 +1155,10 @@ static void HWR_DrawSkyWallList(void)
surf.PolyColor.rgba = 0xFFFFFFFF;
HWR_SetCurrentTexture(NULL);
UnSetShader();
GL_UnSetShader();
for (i = 0; i < skyWallVertexArraySize; i++)
{
DrawPolygon(&surf, skyWallVertexArray + i * 4, 4, PF_Occlude|PF_Invisible|PF_NoTexture);
GL_DrawPolygon(&surf, skyWallVertexArray + i * 4, 4, PF_Occlude|PF_Invisible|PF_NoTexture);
}
}
@@ -4266,7 +4266,7 @@ static void HWR_RenderDrawNodes(void)
PS_START_TIMING(ps_hw_nodedrawtime);
// Okay! Let's draw it all! Woo!
SetTransform(&atransform);
GL_SetTransform(&atransform);
for (i = 0; i < numdrawnodes; i++)
{
@@ -4962,8 +4962,8 @@ static void HWR_DrawSkyBackground(float fpov)
HWR_GetTexture(texturetranslation[skytexture], false);
if (HWR_UseShader())
SetShader(HWR_GetShaderFromTarget(SHADER_SKY));// sky shader
RenderSkyDome(skytexture, textures[skytexture]->width, textures[skytexture]->height, dometransform);
GL_SetShader(HWR_GetShaderFromTarget(SHADER_SKY));// sky shader
GL_RenderSkyDome(skytexture, textures[skytexture]->width, textures[skytexture]->height, dometransform);
}
@@ -4972,12 +4972,12 @@ static void HWR_DrawSkyBackground(float fpov)
// -----------------+
static inline void HWR_ClearView(void)
{
GClipRect((INT32)gl_viewwindowx,
(INT32)gl_viewwindowy,
(INT32)(gl_viewwindowx + gl_viewwidth),
(INT32)(gl_viewwindowy + gl_viewheight),
ZCLIP_PLANE, FAR_ZCLIP_DEFAULT);
ClearBuffer(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);
}
@@ -4999,7 +4999,7 @@ void HWR_SetViewSize(void)
gl_baseviewwindowy = 0;
gl_baseviewwindowx = 0;
FlushScreenTextures();
GL_FlushScreenTextures();
}
// Set view aiming, for the sky dome, the skybox,
@@ -5064,7 +5064,7 @@ void HWR_SetTransform(float fpov, player_t *player)
atransform.mirrorflip = true;
// Set transform.
SetTransform(&atransform);
GL_SetTransform(&atransform);
}
void HWR_ClearClipper(void)
@@ -5081,8 +5081,8 @@ void HWR_ClearClipper(void)
void HWR_SetStencilState(int state, int level)
{
if (level > -1)
SetSpecialState(HWD_SET_STENCIL_LEVEL, level);
SetSpecialState(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.
@@ -5138,7 +5138,7 @@ void HWR_RenderViewpoint(gl_portal_t *rootportal, const float fpov, player_t *pl
}
// Set transform.
SetTransform(&atransform);
GL_SetTransform(&atransform);
validcount++;
@@ -5182,7 +5182,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);
ClearBuffer(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;
@@ -5253,11 +5253,11 @@ static void HWR_RenderFrame(INT32 viewnumber, player_t *player, boolean skybox)
if (!skybox && cv_glrenderdistance.value)
{
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]);
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];
}
@@ -5265,8 +5265,8 @@ static void HWR_RenderFrame(INT32 viewnumber, player_t *player, boolean skybox)
HWR_RenderViewpoint(NULL, fpov, player, 0, !skybox);
// Unset transform and shader
SetTransform(NULL);
UnSetShader();
GL_SetTransform(NULL);
GL_UnSetShader();
// Run post processor effects
if (!skybox)
@@ -5274,7 +5274,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
GClipRect(0, 0, vid.width, vid.height, NZCLIP_PLANE, FAR_ZCLIP_DEFAULT);
GL_GClipRect(0, 0, vid.width, vid.height, NZCLIP_PLANE, FAR_ZCLIP_DEFAULT);
}
// ==========================================================================
@@ -5304,20 +5304,20 @@ void HWR_RenderPlayerView(INT32 viewnumber, player_t *player)
ClearColor.blue = 0.0f;
ClearColor.alpha = 1.0f;
ClearBuffer(true, false, false, &ClearColor);
GL_ClearBuffer(true, false, false, &ClearColor);
}
if (HWR_UseShader())
{
if (cv_ripplewater.value)
SetShaderInfo(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.
const angle_t light_angle = maplighting.angle - viewangle + ANGLE_90; // I fucking hate OGL's coordinate system
SetShaderInfo(HWD_SHADERINFO_LIGHT_X, FINECOSINE(light_angle >> ANGLETOFINESHIFT));
SetShaderInfo(HWD_SHADERINFO_LIGHT_Y, 0);
SetShaderInfo(HWD_SHADERINFO_LIGHT_Z, -FINESINE(light_angle >> ANGLETOFINESHIFT));
GL_SetShaderInfo(HWD_SHADERINFO_LIGHT_X, FINECOSINE(light_angle >> ANGLETOFINESHIFT));
GL_SetShaderInfo(HWD_SHADERINFO_LIGHT_Y, 0);
GL_SetShaderInfo(HWD_SHADERINFO_LIGHT_Z, -FINESINE(light_angle >> ANGLETOFINESHIFT));
SetShaderInfo(HWD_SHADERINFO_LIGHT_CONTRAST, maplighting.contrast);
SetShaderInfo(HWD_SHADERINFO_LIGHT_BACKLIGHT, maplighting.backlight);
GL_SetShaderInfo(HWD_SHADERINFO_LIGHT_CONTRAST, maplighting.contrast);
GL_SetShaderInfo(HWD_SHADERINFO_LIGHT_BACKLIGHT, maplighting.backlight);
}
if (viewnumber > 3)
@@ -5381,7 +5381,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.
ClearMipMapCache();
GL_ClearMipMapCache();
}
}
else
@@ -5395,7 +5395,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.
ClearMipMapCache();
GL_ClearMipMapCache();
}
}
}
@@ -5466,11 +5466,11 @@ void HWR_Startup(void)
#ifdef USE_FBO_OGL
if (supportFBO)
SetSpecialState(HWD_SET_FRAMEBUFFER, cv_glframebuffer.value);
GL_SetSpecialState(HWD_SET_FRAMEBUFFER, cv_glframebuffer.value);
#endif
if (msaa)
SetSpecialState(HWD_SET_MSAA, a2c ? 2 : 1);
GL_SetSpecialState(HWD_SET_MSAA, a2c ? 2 : 1);
}
startupdone = true;
}
@@ -5484,9 +5484,9 @@ void HWR_Shutdown(void)
HWR_FreeExtraSubsectors();
HWR_FreeMipmapCache();
HWR_FreeTextureCache();
FlushScreenTextures();
GL_FlushScreenTextures();
#ifdef USE_FBO_OGL
GLFramebuffer_Disable();
GL_Framebuffer_Disable();
#endif
}
@@ -5529,12 +5529,12 @@ static void HWR_RenderWall(FOutVector *wallVerts, FSurfaceInfo *pSurf, FBITFIELD
INT32 HWR_GetTextureUsed(void)
{
return GetTextureUsed();
return GL_GetTextureUsed();
}
static void HWR_DoPostProcessor(player_t *player)
{
UnSetShader();
GL_UnSetShader();
// Armageddon Blast Flash!
// Could this even be considered postprocessor?
@@ -5558,7 +5558,7 @@ static void HWR_DoPostProcessor(player_t *player)
Surf.PolyColor.s.alpha = 0xc0; // match software mode
DrawPolygon(&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
@@ -5566,7 +5566,7 @@ static void HWR_DoPostProcessor(player_t *player)
// Capture the screen for intermission and screen waving
if (gamestate != GS_INTERMISSION)
MakeScreenTexture(HWD_SCREENTEXTURE_GENERIC1);
GL_MakeScreenTexture(HWD_SCREENTEXTURE_GENERIC1);
if (splitscreen) // Not supported in splitscreen - someone want to add support?
return;
@@ -5606,28 +5606,28 @@ static void HWR_DoPostProcessor(player_t *player)
v[x][y][1] = (y/((float)(SCREENVERTS-1.0f)/9.0f))-4.5f;
}
}
PostImgRedraw(v);
GL_PostImgRedraw(v);
// Capture the screen again for screen waving on the intermission
if (gamestate != GS_INTERMISSION)
MakeScreenTexture(HWD_SCREENTEXTURE_GENERIC1);
GL_MakeScreenTexture(HWD_SCREENTEXTURE_GENERIC1);
}
// Flipping of the screen isn't done here anymore
}
void HWR_StartScreenWipe(void)
{
MakeScreenTexture(HWD_SCREENTEXTURE_WIPE_START);
GL_MakeScreenTexture(HWD_SCREENTEXTURE_WIPE_START);
}
void HWR_EndScreenWipe(void)
{
MakeScreenTexture(HWD_SCREENTEXTURE_WIPE_END);
GL_MakeScreenTexture(HWD_SCREENTEXTURE_WIPE_END);
}
void HWR_DrawIntermissionBG(void)
{
DrawScreenTexture(HWD_SCREENTEXTURE_GENERIC1, NULL, 0);
GL_DrawScreenTexture(HWD_SCREENTEXTURE_GENERIC1, NULL, 0);
}
void HWR_DoWipe(UINT8 wipenum, UINT8 scrnnum)
@@ -5661,22 +5661,22 @@ void HWR_DoWipe(UINT8 wipenum, UINT8 scrnnum)
}
HWR_GetFadeMask(lumpnum);
DoScreenWipe(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)
{
RenderVhsEffect(upbary, downbary, updistort, downdistort, barsize);
GL_RenderVhsEffect(upbary, downbary, updistort, downdistort, barsize);
}
void HWR_MakeScreenFinalTexture(void)
{
MakeScreenTexture(HWD_SCREENTEXTURE_GENERIC2);
GL_MakeScreenTexture(HWD_SCREENTEXTURE_GENERIC2);
}
void HWR_DrawScreenFinalTexture(INT32 width, INT32 height)
{
DrawScreenFinalTexture(HWD_SCREENTEXTURE_GENERIC2, width, height);
GL_DrawScreenFinalTexture(HWD_SCREENTEXTURE_GENERIC2, width, height);
}
#endif // HWRENDER
+9 -9
View File
@@ -418,7 +418,7 @@ static void md2_loadTexture(md2_t *model)
}
}
}
SetTexture(glpatch->mipmap);
GL_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;
}
SetTexture(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);
@@ -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
SetTexture(gpatch->mipmap);
GL_SetTexture(gpatch->mipmap);
return;
}
@@ -1062,7 +1062,7 @@ static void HWR_GetBlendedTexture(GLPatch_t *gpatch, GLPatch_t *blendgpatch, INT
{
if (glmip->downloaded && glmip->data)
{
SetTexture(glmip); // found the colormap, set it to the correct texture
GL_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);
SetTexture(newmip);
GL_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);
CreateModelVBOs(md2->model);
GL_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
SetTexture(gpatch->mipmap);
GL_SetTexture(gpatch->mipmap);
}
}
else
@@ -1467,7 +1467,7 @@ void HWR_DrawMD2(gl_vissprite_t *spr)
p.mirror = atransform.mirror; // from Kart
#endif
SetShader(SHADER_MODEL); // model shader
GL_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;
DrawModel(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);
}
}
}
+5 -1
View File
@@ -149,16 +149,20 @@ void HWR_PortalFrame(gl_portal_t* portal)
void HWR_RenderPortalSeg(gl_portal_t* portal, SINT8 state)
{
gl_drawing_stencil = true; // do not draw outside of the stencil buffer, idiot.
// set our portal state and prepare to render the seg
HWR_SetPortalState(state);
gl_curline = portal->seg;
gl_frontsector = portal->seg->frontsector;
gl_backsector = portal->seg->backsector;
HWR_ProcessSeg();
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
SetBlend(PF_Translucent|PF_Occlude|PF_Masked);
GL_SetBlend(PF_Translucent|PF_Occlude|PF_Masked);
}
// Renders a single portal from the current viewpoint.
+4 -4
View File
@@ -93,7 +93,7 @@ boolean HWR_InitShaders(void)
{
int i;
if (!InitShaders())
if (!GL_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;
LoadShader(index, preprocessed, HWD_SHADERSTAGE_VERTEX);
GL_LoadShader(index, preprocessed, HWD_SHADERSTAGE_VERTEX);
}
if (fragment_source)
{
char *preprocessed = HWR_PreprocessShader(fragment_source);
if (!preprocessed) return;
LoadShader(index, preprocessed, HWD_SHADERSTAGE_FRAGMENT);
GL_LoadShader(index, preprocessed, HWD_SHADERSTAGE_FRAGMENT);
}
gl_shaders[index].compiled = CompileShader(index);
gl_shaders[index].compiled = GL_CompileShader(index);
}
// compile or recompile shaders
+3 -22
View File
@@ -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
// -----------------+
void FinishUpdate (INT32 waitvbl)
void GL_FinishUpdate (INT32 waitvbl)
{
#ifdef USE_WGL_SWAP
static INT32 oldwaitvbl = 0;
@@ -547,23 +547,4 @@ void 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
+126 -144
View File
@@ -713,8 +713,8 @@ static INT32 shader_light_contrast = 0;
static INT32 shader_light_backlight = 0;
// Lactozilla: Shader functions
static boolean Shader_CompileProgram(gl_shader_t *shader, GLint i);
static void Shader_SetUniforms(FSurfaceInfo *Surface, GLRGBAFloat *poly, GLRGBAFloat *tint, GLRGBAFloat *fade);
static boolean GL_Shader_CompileProgram(gl_shader_t *shader, GLint i);
static void GL_Shader_SetUniforms(FSurfaceInfo *Surface, GLRGBAFloat *poly, GLRGBAFloat *tint, GLRGBAFloat *fade);
static GLRGBAFloat shader_defaultcolor = {1.0f, 1.0f, 1.0f, 1.0f};
@@ -791,13 +791,13 @@ static boolean GLFramebuffer_IsFuncAvailible(void)
if (majorGL < 3)
return false;
return (isExtAvailable("GL_ARB_framebuffer_no_attachments",gl_extensions) && isExtAvailable("GL_ARB_framebuffer_object",gl_extensions) && isExtAvailable("GL_ARB_framebuffer_sRGB",gl_extensions));
return (GL_isExtAvailable("GL_ARB_framebuffer_no_attachments",gl_extensions) && GL_isExtAvailable("GL_ARB_framebuffer_object",gl_extensions) && GL_isExtAvailable("GL_ARB_framebuffer_sRGB",gl_extensions));
return false;
}
#endif
boolean InitShaders (void)
boolean GL_InitShaders(void)
{
if (!pglUseProgram)
return false;
@@ -805,7 +805,7 @@ boolean InitShaders (void)
gl_fallback_shader.vertex_shader = Z_StrDup(GLSL_FALLBACK_VERTEX_SHADER);
gl_fallback_shader.fragment_shader = Z_StrDup(GLSL_FALLBACK_FRAGMENT_SHADER);
if (!Shader_CompileProgram(&gl_fallback_shader, -1))
if (!GL_Shader_CompileProgram(&gl_fallback_shader, -1))
{
GL_MSG_Error("Failed to compile the fallback shader program!\n");
return false;
@@ -814,7 +814,7 @@ boolean InitShaders (void)
return true;
}
void LoadShader (int slot, char *code, hwdshaderstage_t stage)
void GL_LoadShader(int slot, char *code, hwdshaderstage_t stage)
{
gl_shader_t *shader;
@@ -839,12 +839,12 @@ void LoadShader (int slot, char *code, hwdshaderstage_t stage)
#undef LOADSHADER
}
boolean CompileShader (int slot)
boolean GL_CompileShader(int slot)
{
if (slot < 0 || slot >= HWR_MAXSHADERS)
I_Error("CompileShader: Invalid slot %d", slot);
if (Shader_CompileProgram(&gl_shaders[slot], slot))
if (GL_Shader_CompileProgram(&gl_shaders[slot], slot))
{
return true;
}
@@ -860,7 +860,7 @@ boolean CompileShader (int slot)
// Those are given to the uniforms.
//
void SetShaderInfo (hwdshaderinfo_t info, INT32 value)
void GL_SetShaderInfo(hwdshaderinfo_t info, INT32 value)
{
switch (info)
{
@@ -887,11 +887,11 @@ void SetShaderInfo (hwdshaderinfo_t info, INT32 value)
}
}
void SetShader (int slot)
void GL_SetShader(int slot)
{
if (slot == SHADER_NONE)
{
UnSetShader();
GL_UnSetShader();
return;
}
if (gl_allowshaders)
@@ -918,7 +918,7 @@ void SetShader (int slot)
gl_shadersenabled = false;
}
void UnSetShader (void)
void GL_UnSetShader(void)
{
if (gl_shadersenabled) // don't repeatedly call glUseProgram if not needed
{
@@ -937,7 +937,7 @@ void UnSetShader (void)
// -----------------+
// SetNoTexture : Disable texture
// -----------------+
static void SetNoTexture(void)
static void GL_SetNoTexture(void)
{
// Disable texture.
if (tex_downloaded != NOTEXTURE_NUM)
@@ -949,7 +949,10 @@ static void SetNoTexture(void)
}
}
static void GLPerspective(GLfloat fovy, GLfloat aspect)
// -----------------+
// Perspective :
// -----------------+
static void GL_Perspective(GLfloat fovy, GLfloat aspect)
{
GLfloat m[4][4] =
{
@@ -979,11 +982,10 @@ static void GLPerspective(GLfloat fovy, GLfloat aspect)
pglMultMatrixf(&m[0][0]);
}
// -----------------+
// SetModelView :
// -----------------+
void SetModelView(GLint w, GLint h)
void GL_SetModelView(GLint w, GLint h)
{
//GL_DBG_Printf("SetModelView(): %dx%d\n", (int)w, (int)h);
@@ -995,7 +997,7 @@ void SetModelView(GLint w, GLint h)
pglMatrixMode(GL_MODELVIEW);
pglLoadIdentity();
GLPerspective(fov, ASPECT_RATIO);
GL_Perspective(fov, ASPECT_RATIO);
// added for new coronas' code (without depth buffer)
pglGetIntegerv(GL_VIEWPORT, viewport);
@@ -1005,7 +1007,7 @@ void SetModelView(GLint w, GLint h)
// -----------------+
// SetStates : Set permanent states
// -----------------+
void SetStates(void)
void GL_SetStates(void)
{
pglEnable(GL_TEXTURE_2D); // two-dimensional texturing
pglTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
@@ -1025,10 +1027,10 @@ void SetStates(void)
// this set CurrentPolyFlags to the actual configuration
CurrentPolyFlags = 0xffffffff;
SetBlend(0);
GL_SetBlend(0);
tex_downloaded = 0;
SetNoTexture();
GL_SetNoTexture();
pglPolygonOffset(-1.0f, -1.0f);
@@ -1037,10 +1039,11 @@ void SetStates(void)
pglScalef(1.0f, 1.0f, -1.0f);
pglGetFloatv(GL_MODELVIEW_MATRIX, modelMatrix); // added for new coronas' code (without depth buffer)
}
// -----------------+
// DeleteTexture : Deletes a texture from the GPU and frees its data
// -----------------+
void DeleteTexture (GLMipmap_t *pTexInfo)
void GL_DeleteTexture(GLMipmap_t *pTexInfo)
{
FTextureInfo *head = TexCacheHead;
@@ -1072,7 +1075,7 @@ void DeleteTexture (GLMipmap_t *pTexInfo)
}
#ifdef USE_FBO_OGL
static void GLFramebuffer_GenerateAttachments(void)
static void GL_Framebuffer_GenerateAttachments(void)
{
if (!supportFBO)
return;
@@ -1104,7 +1107,7 @@ static void GLFramebuffer_GenerateAttachments(void)
pglFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_STENCIL_ATTACHMENT, GL_RENDERBUFFER, RenderbufferObject);
// Clear the renderbuffer
ClearBuffer(true, true, true, NULL);
GL_ClearBuffer(true, true, true, NULL);
pglBindRenderbuffer(GL_RENDERBUFFER, 0);
}
@@ -1113,7 +1116,7 @@ static void GLFramebuffer_GenerateAttachments(void)
pglBindFramebuffer(GL_FRAMEBUFFER, 0);
}
void GLFramebuffer_DeleteAttachments(void)
void GL_Framebuffer_DeleteAttachments(void)
{
if (!supportFBO)
return;
@@ -1132,7 +1135,7 @@ void GLFramebuffer_DeleteAttachments(void)
RenderbufferObject = 0;
}
static void GLFramebuffer_Generate(void)
static void GL_Framebuffer_Generate(void)
{
if (!supportFBO)
return;
@@ -1142,10 +1145,10 @@ static void GLFramebuffer_Generate(void)
pglGenFramebuffers(1, &FramebufferObject);
if (pglCheckFramebufferStatus(GL_FRAMEBUFFER) == GL_FRAMEBUFFER_COMPLETE)
GLFramebuffer_GenerateAttachments();
GL_Framebuffer_GenerateAttachments();
}
static void GLFramebuffer_Delete(void)
static void GL_Framebuffer_Delete(void)
{
if (!supportFBO)
return;
@@ -1153,11 +1156,11 @@ static void GLFramebuffer_Delete(void)
if (FramebufferObject)
pglDeleteFramebuffers(1, &FramebufferObject);
GLFramebuffer_DeleteAttachments();
GL_Framebuffer_DeleteAttachments();
FramebufferObject = 0;
}
inline void GLFramebuffer_Unbind(void)
inline void GL_Framebuffer_Unbind(void)
{
if (!supportFBO)
return;
@@ -1166,21 +1169,21 @@ inline void GLFramebuffer_Unbind(void)
pglBindRenderbuffer(GL_RENDERBUFFER, 0);
}
inline void GLFramebuffer_Enable(void)
inline void GL_Framebuffer_Enable(void)
{
if (!supportFBO)
return;
if (FramebufferObject == 0)
GLFramebuffer_Generate();
GL_Framebuffer_Generate();
else if (FramebufferTexture == 0 || RenderbufferObject == 0)
GLFramebuffer_GenerateAttachments();
GL_Framebuffer_GenerateAttachments();
pglBindFramebuffer(GL_FRAMEBUFFER, FramebufferObject);
pglBindRenderbuffer(GL_RENDERBUFFER, RenderbufferObject);
}
void GLFramebuffer_Disable(void)
void GL_Framebuffer_Disable(void)
{
if (!supportFBO)
return;
@@ -1190,7 +1193,7 @@ void GLFramebuffer_Disable(void)
pglBindFramebuffer(GL_FRAMEBUFFER, 0);
pglBindRenderbuffer(GL_RENDERBUFFER, 0);
GLFramebuffer_Delete();
GL_Framebuffer_Delete();
}
#endif
@@ -1198,10 +1201,8 @@ void GLFramebuffer_Disable(void)
// Flush : flush OpenGL textures
// : Clear list of downloaded mipmaps
// -----------------+
void Flush(void)
void GL_Flush(void)
{
//GL_DBG_Printf ("HWR_Flush()\n");
while (TexCacheHead)
{
FTextureInfo *pTexInfo = TexCacheHead;
@@ -1228,12 +1229,11 @@ void Flush(void)
textureBufferSize = 0;
}
// -----------------+
// isExtAvailable : Look if an OpenGL extension is available
// Returns : true if extension available
// -----------------+
INT32 isExtAvailable(const char *extension, const GLubyte *start)
INT32 GL_isExtAvailable(const char *extension, const GLubyte *start)
{
GLubyte *where, *terminator;
@@ -1256,40 +1256,29 @@ INT32 isExtAvailable(const char *extension, const GLubyte *start)
return 0;
}
// -----------------+
// Init : Initialise the OpenGL interface API
// Returns :
// -----------------+
boolean Init (void)
boolean GL_Init (void)
{
return SetupGLfunc();
}
// -----------------+
// SetupGLInfo : Retreive and store currently loaded OpenGL version
// -----------------+
void SetupGLInfo (void)
void SetupGLInfo(void)
{
const GLubyte *versionGL = pglGetString(GL_VERSION);
CONS_Printf("Loaded OpenGL version %s\n", (const char*)versionGL);
sscanf((const char*)versionGL, "%d.%d", &majorGL, &minorGL);
}
// -----------------+
// ClearMipMapCache : Flush OpenGL textures from memory
// -----------------+
void ClearMipMapCache (void)
{
Flush();
}
// 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.
void ReadScreenTexture (int tex, UINT16 *dst_data)
void GL_ReadScreenTexture(int tex, UINT16 *dst_data)
{
INT32 i;
int dst_stride = screen_width * 3; // stride between rows of image data
@@ -1302,11 +1291,11 @@ void 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);
GL_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);
GL_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++)
@@ -1323,7 +1312,7 @@ void ReadScreenTexture (int tex, UINT16 *dst_data)
// -----------------+
// SetPalette : Changes the current texture palette
// -----------------+
void SetPalette (RGBA_t *palette)
void GL_SetPalette(RGBA_t *palette)
{
INT32 i;
@@ -1334,13 +1323,13 @@ void SetPalette (RGBA_t *palette)
myPaletteData[i].s.blue = palette[i].s.blue;
myPaletteData[i].s.alpha = palette[i].s.alpha;
}
Flush();
GL_Flush();
}
// -----------------+
// GClipRect : Defines the 2D hardware clipping window
// -----------------+
void GClipRect (INT32 minx, INT32 miny, INT32 maxx, INT32 maxy, float nearclip, float farclip)
void GL_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);
@@ -1351,7 +1340,7 @@ void GClipRect (INT32 minx, INT32 miny, INT32 maxx, INT32 maxy, float nearclip,
//pglScissor(minx, screen_height-maxy, maxx-minx, maxy-miny);
pglMatrixMode(GL_PROJECTION);
pglLoadIdentity();
GLPerspective(fov, ASPECT_RATIO);
GL_Perspective(fov, ASPECT_RATIO);
pglMatrixMode(GL_MODELVIEW);
// added for new coronas' code (without depth buffer)
@@ -1363,7 +1352,7 @@ void GClipRect (INT32 minx, INT32 miny, INT32 maxx, INT32 maxy, float nearclip,
// -----------------+
// ClearBuffer : Clear the color/alpha/depth buffer(s)
// -----------------+
void ClearBuffer (FBOOLEAN ColorMask, FBOOLEAN DepthMask, FBOOLEAN StencilMask, FRGBAFloat * ClearColor)
void GL_ClearBuffer(FBOOLEAN ColorMask, FBOOLEAN DepthMask, FBOOLEAN StencilMask, FRGBAFloat * ClearColor)
{
//GL_DBG_Printf("ClearBuffer(%d)\n", alpha);
GLbitfield ClearMask = 0;
@@ -1385,7 +1374,7 @@ void ClearBuffer (FBOOLEAN ColorMask, FBOOLEAN DepthMask, FBOOLEAN StencilMask,
ClearMask |= GL_DEPTH_BUFFER_BIT;
}
SetBlend(DepthMask ? PF_Occlude | CurrentPolyFlags : CurrentPolyFlags&~PF_Occlude);
GL_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
@@ -1398,7 +1387,7 @@ void ClearBuffer (FBOOLEAN ColorMask, FBOOLEAN DepthMask, FBOOLEAN StencilMask,
// -----------------+
// HWRAPI Draw2DLine: Render a 2D line
// -----------------+
void Draw2DLine (F2DCoord * v1, F2DCoord * v2, RGBA_t Color)
void GL_Draw2DLine(F2DCoord * v1, F2DCoord * v2, RGBA_t Color)
{
//GL_DBG_Printf("DrawLine(): %f %f, %f %f\n", v1->x, v1->y, v2->x, v2->y);
GLfloat p[12];
@@ -1440,13 +1429,12 @@ static void Clamp2D(GLenum pname)
#endif
}
// -----------------+
// SetBlend : Set render mode
// -----------------+
// PF_Masked - we could use an ALPHA_TEST of GL_EQUAL, and alpha ref of 0,
// is it faster when pixels are discarded ?
void SetBlend (FBITFIELD PolyFlags)
void GL_SetBlend(FBITFIELD PolyFlags)
{
FBITFIELD Xor;
Xor = CurrentPolyFlags^PolyFlags;
@@ -1573,12 +1561,12 @@ void SetBlend (FBITFIELD PolyFlags)
}
}
if (PolyFlags & PF_NoTexture)
SetNoTexture();
GL_SetNoTexture();
}
CurrentPolyFlags = PolyFlags;
}
static void AllocTextureBuffer(GLMipmap_t *pTexInfo)
static void GL_AllocTextureBuffer(GLMipmap_t *pTexInfo)
{
size_t size = pTexInfo->width * pTexInfo->height;
if (size > textureBufferSize)
@@ -1593,7 +1581,7 @@ static void AllocTextureBuffer(GLMipmap_t *pTexInfo)
// -----------------+
// UpdateTexture : Updates texture data.
// -----------------+
void UpdateTexture (GLMipmap_t *pTexInfo)
void GL_UpdateTexture(GLMipmap_t *pTexInfo)
{
// Upload a texture
GLuint num = pTexInfo->downloaded;
@@ -1618,7 +1606,7 @@ void UpdateTexture (GLMipmap_t *pTexInfo)
if ((pTexInfo->format == GL_TEXFMT_P_8) || (pTexInfo->format == GL_TEXFMT_AP_88))
{
AllocTextureBuffer(pTexInfo);
GL_AllocTextureBuffer(pTexInfo);
ptex = tex = textureBuffer;
#pragma omp simd
@@ -1662,7 +1650,7 @@ void UpdateTexture (GLMipmap_t *pTexInfo)
}
else if (pTexInfo->format == GL_TEXFMT_ALPHA_INTENSITY_88)
{
AllocTextureBuffer(pTexInfo);
GL_AllocTextureBuffer(pTexInfo);
ptex = tex = textureBuffer;
#pragma omp simd
@@ -1682,7 +1670,7 @@ void UpdateTexture (GLMipmap_t *pTexInfo)
}
else if (pTexInfo->format == GL_TEXFMT_ALPHA_8) // Used for fade masks
{
AllocTextureBuffer(pTexInfo);
GL_AllocTextureBuffer(pTexInfo);
ptex = tex = textureBuffer;
#pragma omp simd
@@ -1804,11 +1792,11 @@ void UpdateTexture (GLMipmap_t *pTexInfo)
// -----------------+
// SetTexture : The mipmap becomes the current texture source
// -----------------+
void SetTexture (GLMipmap_t *pTexInfo)
void GL_SetTexture(GLMipmap_t *pTexInfo)
{
if (!pTexInfo)
{
SetNoTexture();
GL_SetNoTexture();
return;
}
else if (pTexInfo->downloaded)
@@ -1823,7 +1811,7 @@ void SetTexture (GLMipmap_t *pTexInfo)
{
FTextureInfo *newTex = calloc(1, sizeof (*newTex));
UpdateTexture(pTexInfo);
GL_UpdateTexture(pTexInfo);
newTex->texture = pTexInfo;
newTex->downloaded = (UINT32)pTexInfo->downloaded;
@@ -1843,7 +1831,7 @@ void SetTexture (GLMipmap_t *pTexInfo)
}
}
void Shader_SetUniforms(FSurfaceInfo *Surface, GLRGBAFloat *poly, GLRGBAFloat *tint, GLRGBAFloat *fade)
static void GL_Shader_SetUniforms(FSurfaceInfo *Surface, GLRGBAFloat *poly, GLRGBAFloat *tint, GLRGBAFloat *fade)
{
gl_shader_t *shader = gl_shaderstate.current;
@@ -1929,7 +1917,7 @@ void SetTexture (GLMipmap_t *pTexInfo)
}
}
boolean Shader_CompileProgram(gl_shader_t *shader, GLint i)
static boolean GL_Shader_CompileProgram(gl_shader_t *shader, GLint i)
{
GLuint gl_vertShader = 0;
GLuint gl_fragShader = 0;
@@ -2088,13 +2076,13 @@ boolean Shader_CompileProgram(gl_shader_t *shader, GLint i)
// code that is common between DrawPolygon and DrawIndexedTriangles
// DrawScreenTexture also can use this function for fancier screen texture drawing
// the corona thing is there too, i have no idea if that stuff works with DrawIndexedTriangles and batching
static void PreparePolygon(FSurfaceInfo *pSurf, FBITFIELD PolyFlags)
static void GL_PreparePolygon(FSurfaceInfo *pSurf, FBITFIELD PolyFlags)
{
static GLRGBAFloat poly = {0,0,0,0};
static GLRGBAFloat tint = {0,0,0,0};
static GLRGBAFloat fade = {0,0,0,0};
SetBlend(PolyFlags); //TODO: inline (#pragma..)
GL_SetBlend(PolyFlags); //TODO: inline (#pragma..)
if (pSurf)
{
@@ -2134,15 +2122,15 @@ static void PreparePolygon(FSurfaceInfo *pSurf, FBITFIELD PolyFlags)
}
}
Shader_SetUniforms(pSurf, &poly, &tint, &fade);
GL_Shader_SetUniforms(pSurf, &poly, &tint, &fade);
}
// -----------------+
// DrawPolygon : Render a polygon, set the texture, set render mode
// -----------------+
void DrawPolygon (FSurfaceInfo *pSurf, FOutVector *pOutVerts, FUINT iNumPts, FBITFIELD PolyFlags)
void GL_DrawPolygon(FSurfaceInfo *pSurf, FOutVector *pOutVerts, FUINT iNumPts, FBITFIELD PolyFlags)
{
PreparePolygon(pSurf, PolyFlags);
GL_PreparePolygon(pSurf, PolyFlags);
pglVertexPointer(3, GL_FLOAT, sizeof(FOutVector), &pOutVerts[0].x);
pglTexCoordPointer(2, GL_FLOAT, sizeof(FOutVector), &pOutVerts[0].s);
@@ -2158,9 +2146,9 @@ void DrawPolygon (FSurfaceInfo *pSurf, FOutVector *pOutVerts, FUINT iNumPts, FBI
Clamp2D(GL_TEXTURE_WRAP_T);
}
void DrawIndexedTriangles (FSurfaceInfo *pSurf, FOutVector *pOutVerts, FUINT iNumPts, FBITFIELD PolyFlags, unsigned int *IndexArray)
void GL_DrawIndexedTriangles(FSurfaceInfo *pSurf, FOutVector *pOutVerts, FUINT iNumPts, FBITFIELD PolyFlags, unsigned int *IndexArray)
{
PreparePolygon(pSurf, PolyFlags);
GL_PreparePolygon(pSurf, PolyFlags);
pglVertexPointer(3, GL_FLOAT, sizeof(FOutVector), &pOutVerts[0].x);
pglTexCoordPointer(2, GL_FLOAT, sizeof(FOutVector), &pOutVerts[0].s);
@@ -2215,7 +2203,7 @@ static INT32 lasttex = -1;
#define MAP_COEFF 128.0f
static void SkyVertex(vbo_vertex_t *vbo, int r, int c)
static void GL_SkyVertex(vbo_vertex_t *vbo, int r, int c)
{
const float radians = (float)(M_PIl / 180.0f);
const float scale = 10000.0f;
@@ -2302,7 +2290,7 @@ static void gld_BuildSky(int row_count, int col_count)
foglayer = true;
for (c = 0; c < col_count; c++)
{
SkyVertex(vertex_p, 1, c);
GL_SkyVertex(vertex_p, 1, c);
vertex_p->r = 255;
vertex_p->g = 255;
vertex_p->b = 255;
@@ -2323,20 +2311,14 @@ static void gld_BuildSky(int row_count, int col_count)
for (c = 0; c <= col_count; c++)
{
SkyVertex(vertex_p++, r + (yflip ? 1 : 0), (c ? c : 0));
SkyVertex(vertex_p++, r + (yflip ? 0 : 1), (c ? c : 0));
GL_SkyVertex(vertex_p++, r + (yflip ? 1 : 0), (c ? c : 0));
GL_SkyVertex(vertex_p++, r + (yflip ? 0 : 1), (c ? c : 0));
}
}
}
}
//-----------------------------------------------------------------------------
//
//
//
//-----------------------------------------------------------------------------
static void RenderDome(INT32 skytexnum)
static void GL_RenderDome(INT32 skytexnum)
{
int i, j;
int vbosize;
@@ -2413,20 +2395,20 @@ static void RenderDome(INT32 skytexnum)
pglDisableClientState(GL_COLOR_ARRAY);
}
void RenderSkyDome (INT32 tex, INT32 texture_width, INT32 texture_height, FTransform transform)
void GL_RenderSkyDome(INT32 tex, INT32 texture_width, INT32 texture_height, FTransform transform)
{
SetBlend(PF_Translucent|PF_NoDepthTest|PF_Modulated);
SetTransform(&transform);
GL_SetBlend(PF_Translucent|PF_NoDepthTest|PF_Modulated);
GL_SetTransform(&transform);
texw = texture_width;
texh = texture_height;
RenderDome(tex);
SetBlend(0);
GL_RenderDome(tex);
GL_SetBlend(0);
}
// ==========================================================================
//
// ==========================================================================
void SetSpecialState (hwdspecialstate_t IdState, INT32 Value)
void GL_SetSpecialState(hwdspecialstate_t IdState, INT32 Value)
{
switch (IdState)
{
@@ -2485,7 +2467,7 @@ void SetSpecialState (hwdspecialstate_t IdState, INT32 Value)
min_filter = GL_LINEAR;
}
Flush(); //??? if we want to change filter mode by texture, remove this
GL_Flush(); //??? if we want to change filter mode by texture, remove this
break;
case HWD_SET_MSAA:
@@ -2500,7 +2482,7 @@ void SetSpecialState (hwdspecialstate_t IdState, INT32 Value)
case HWD_SET_TEXTUREANISOTROPICMODE:
anisotropic_filter = min(Value,maximumAnisotropy);
if (maximumAnisotropy)
Flush(); //??? if we want to change filter mode by texture, remove this
GL_Flush(); //??? if we want to change filter mode by texture, remove this
break;
case HWD_SET_SCREEN_TEXTURES:
@@ -2586,7 +2568,7 @@ static size_t lerpTinyBufferSize = 0;
// Static temporary buffer for doing frame interpolation
// 'size' is the vertex size
static void AllocLerpBuffer(size_t size)
static void GL_AllocLerpBuffer(size_t size)
{
if (lerpBufferSize >= size)
return;
@@ -2604,7 +2586,7 @@ static void AllocLerpBuffer(size_t size)
// Static temporary buffer for doing frame interpolation
// 'size' is the vertex size
static void AllocLerpTinyBuffer(size_t size)
static void GL_AllocLerpTinyBuffer(size_t size)
{
if (lerpTinyBufferSize >= size)
return;
@@ -2628,7 +2610,7 @@ static void AllocLerpTinyBuffer(size_t size)
#define GL_ARRAY_BUFFER 0x8892
#endif
static void CreateModelVBO(mesh_t *mesh, mdlframe_t *frame)
static void GL_CreateModelVBO(mesh_t *mesh, mdlframe_t *frame)
{
int bufferSize = sizeof(vbo64_t)*mesh->numTriangles * 3;
vbo64_t *buffer = (vbo64_t*)malloc(bufferSize);
@@ -2696,7 +2678,7 @@ static void CreateModelVBO(mesh_t *mesh, mdlframe_t *frame)
pglBindBuffer(GL_ARRAY_BUFFER, 0);
}
static void CreateModelVBOTiny(mesh_t *mesh, tinyframe_t *frame)
static void GL_CreateModelVBOTiny(mesh_t *mesh, tinyframe_t *frame)
{
int bufferSize = sizeof(vbotiny_t)*mesh->numTriangles * 3;
vbotiny_t *buffer = (vbotiny_t*)malloc(bufferSize);
@@ -2741,9 +2723,10 @@ static void CreateModelVBOTiny(mesh_t *mesh, tinyframe_t *frame)
pglBindBuffer(GL_ARRAY_BUFFER, 0);
}
void CreateModelVBOs (model_t *model)
void GL_CreateModelVBOs(model_t *model)
{
int i;
for (i = 0; i < model->numMeshes; i++)
{
mesh_t *mesh = &model->meshes[i];
@@ -2757,7 +2740,7 @@ void CreateModelVBOs (model_t *model)
if (frame->vboID)
pglDeleteBuffers(1, &frame->vboID);
frame->vboID = 0;
CreateModelVBO(mesh, frame);
GL_CreateModelVBO(mesh, frame);
}
}
else if (mesh->tinyframes)
@@ -2769,7 +2752,7 @@ void CreateModelVBOs (model_t *model)
if (frame->vboID)
pglDeleteBuffers(1, &frame->vboID);
frame->vboID = 0;
CreateModelVBOTiny(mesh, frame);
GL_CreateModelVBOTiny(mesh, frame);
}
}
}
@@ -2777,7 +2760,7 @@ void CreateModelVBOs (model_t *model)
#define BUFFER_OFFSET(i) ((char*)(i))
static void DrawModelEx(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 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)
{
static GLRGBAFloat poly = {0,0,0,0};
static GLRGBAFloat tint = {0,0,0,0};
@@ -2816,9 +2799,9 @@ static void DrawModelEx(model_t *model, INT32 frameIndex, float duration, float
poly.alpha = byte2float[Surface->PolyColor.s.alpha];
if (poly.alpha < 1)
SetBlend(PF_Translucent|PF_Modulated);
GL_SetBlend(PF_Translucent|PF_Modulated);
else
SetBlend(PF_Masked|PF_Modulated|PF_Occlude);
GL_SetBlend(PF_Masked|PF_Modulated|PF_Occlude);
pglColor4ubv((GLubyte*)&Surface->PolyColor.s);
@@ -2840,7 +2823,7 @@ static void DrawModelEx(model_t *model, INT32 frameIndex, float duration, float
lt_downloaded = Surface->LightTableId;
}
Shader_SetUniforms(Surface, &poly, &tint, &fade);
GL_Shader_SetUniforms(Surface, &poly, &tint, &fade);
pglEnable(GL_CULL_FACE);
pglEnable(GL_NORMALIZE);
@@ -2936,7 +2919,7 @@ static void DrawModelEx(model_t *model, INT32 frameIndex, float duration, float
int j = 0;
// Dangit, I soooo want to do this in a GLSL shader...
AllocLerpTinyBuffer(mesh->numVertices * sizeof(short) * 3);
GL_AllocLerpTinyBuffer(mesh->numVertices * sizeof(short) * 3);
vertPtr = vertTinyBuffer;
normPtr = normTinyBuffer;
@@ -2979,7 +2962,7 @@ static void DrawModelEx(model_t *model, INT32 frameIndex, float duration, float
int j = 0;
// Dangit, I soooo want to do this in a GLSL shader...
AllocLerpBuffer(mesh->numVertices * sizeof(float) * 3);
GL_AllocLerpBuffer(mesh->numVertices * sizeof(float) * 3);
vertPtr = vertBuffer;
normPtr = normBuffer;
@@ -3008,15 +2991,15 @@ static void DrawModelEx(model_t *model, INT32 frameIndex, float duration, float
// -----------------+
// HWRAPI DrawModel : Draw a model
// -----------------+
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 GL_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);
GL_DrawModelEx(model, frameIndex, duration, tics, nextFrameIndex, pos, hscale, vscale, flipped, hflipped, Surface);
}
// -----------------+
// SetTransform :
// -----------------+
void SetTransform (FTransform *stransform)
void GL_SetTransform(FTransform *stransform)
{
static boolean special_splitscreen;
GLdouble used_fov;
@@ -3076,10 +3059,10 @@ void SetTransform (FTransform *stransform)
if (special_splitscreen)
{
used_fov = (float)(atan(tan(used_fov*M_PI/360)*0.8)*360/M_PI);
GLPerspective((GLfloat)used_fov, 2*ASPECT_RATIO);
GL_Perspective((GLfloat)used_fov, 2*ASPECT_RATIO);
}
else
GLPerspective((GLfloat)used_fov, ASPECT_RATIO);
GL_Perspective((GLfloat)used_fov, ASPECT_RATIO);
pglGetFloatv(GL_PROJECTION_MATRIX, projMatrix); // added for new coronas' code (without depth buffer)
pglMatrixMode(GL_MODELVIEW);
@@ -3087,7 +3070,7 @@ void SetTransform (FTransform *stransform)
pglGetFloatv(GL_MODELVIEW_MATRIX, modelMatrix); // added for new coronas' code (without depth buffer)
}
INT32 GetTextureUsed (void)
INT32 GL_GetTextureUsed(void)
{
FTextureInfo *tmp = TexCacheHead;
INT32 res = 0;
@@ -3112,7 +3095,7 @@ INT32 GetTextureUsed (void)
return res;
}
void PostImgRedraw (float points[SCREENVERTS][SCREENVERTS][2])
void GL_PostImgRedraw(float points[SCREENVERTS][SCREENVERTS][2])
{
INT32 x, y;
float float_x, float_y, float_nextx, float_nexty;
@@ -3149,9 +3132,9 @@ void PostImgRedraw (float points[SCREENVERTS][SCREENVERTS][2])
pglDrawArrays(GL_TRIANGLE_FAN, 0, 4);
pglEnableClientState(GL_TEXTURE_COORD_ARRAY);
for(x=0;x<SCREENVERTS-1;x++)
for(x = 0; x < SCREENVERTS-1;x ++)
{
for(y=0;y<SCREENVERTS-1;y++)
for(y = 0; y < SCREENVERTS-1; y++)
{
float stCoords[8];
float vertCoords[12];
@@ -3200,15 +3183,14 @@ void 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
void FlushScreenTextures (void)
void GL_FlushScreenTextures(void)
{
int i;
pglDeleteTextures(NUMSCREENTEXTURES, screenTextures);
for (i = 0; i < NUMSCREENTEXTURES; i++)
for (int i = 0; i < NUMSCREENTEXTURES; i++)
screenTextures[i] = 0;
}
void DrawScreenTexture(int tex, FSurfaceInfo *surf, FBITFIELD polyflags)
void GL_DrawScreenTexture(int tex, FSurfaceInfo *surf, FBITFIELD polyflags)
{
float xfix, yfix;
INT32 texsize = 512;
@@ -3249,7 +3231,7 @@ void DrawScreenTexture(int tex, FSurfaceInfo *surf, FBITFIELD polyflags)
pglBindTexture(GL_TEXTURE_2D, screenTextures[tex]);
PreparePolygon(surf, surf ? polyflags : (PF_NoDepthTest));
GL_PreparePolygon(surf, surf ? polyflags : (PF_NoDepthTest));
if (!surf)
pglColor4ubv(white);
@@ -3262,7 +3244,7 @@ void DrawScreenTexture(int tex, FSurfaceInfo *surf, FBITFIELD polyflags)
// Do screen fades!
void DoScreenWipe (int wipeStart, int wipeEnd)
void GL_DoScreenWipe(int wipeStart, int wipeEnd)
{
INT32 texsize = 512;
float xfix, yfix;
@@ -3311,7 +3293,7 @@ void DoScreenWipe (int wipeStart, int wipeEnd)
pglClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
SetBlend(PF_Modulated|PF_NoDepthTest);
GL_SetBlend(PF_Modulated|PF_NoDepthTest);
pglEnable(GL_TEXTURE_2D);
// Draw the original screen
@@ -3321,7 +3303,7 @@ void DoScreenWipe (int wipeStart, int wipeEnd)
pglVertexPointer(3, GL_FLOAT, 0, screenVerts);
pglDrawArrays(GL_TRIANGLE_FAN, 0, 4);
SetBlend(PF_Modulated|PF_Translucent|PF_NoDepthTest);
GL_SetBlend(PF_Modulated|PF_Translucent|PF_NoDepthTest);
// Draw the end screen that fades in
pglActiveTexture(GL_TEXTURE0);
@@ -3353,7 +3335,7 @@ void DoScreenWipe (int wipeStart, int wipeEnd)
tex_downloaded = screenTextures[wipeEnd];
}
void RenderVhsEffect (fixed_t upbary, fixed_t downbary, UINT8 updistort, UINT8 downdistort, UINT8 barsize)
void GL_RenderVhsEffect(fixed_t upbary, fixed_t downbary, UINT8 updistort, UINT8 downdistort, UINT8 barsize)
{
INT32 texsize = 512;
float xfix, yfix;
@@ -3380,8 +3362,8 @@ void RenderVhsEffect (fixed_t upbary, fixed_t downbary, UINT8 updistort, UINT8 d
yfix = 1/((float)(texsize)/((float)((screen_height))));
// Slight fuzziness
MakeScreenTexture(HWD_SCREENTEXTURE_GENERIC1);
SetBlend(PF_Modulated|PF_Translucent|PF_NoDepthTest);
GL_MakeScreenTexture(HWD_SCREENTEXTURE_GENERIC1);
GL_SetBlend(PF_Modulated|PF_Translucent|PF_NoDepthTest);
//pglBindTexture(GL_TEXTURE_2D, screentexture);
for (i = 0; i < 1; i += 2.f/vid.height)
@@ -3404,7 +3386,7 @@ void RenderVhsEffect (fixed_t upbary, fixed_t downbary, UINT8 updistort, UINT8 d
}
// Upward bar
MakeScreenTexture(HWD_SCREENTEXTURE_GENERIC1);
GL_MakeScreenTexture(HWD_SCREENTEXTURE_GENERIC1);
//pglBindTexture(GL_TEXTURE_2D, screentexture);
color[0] = color[1] = color[2] = 190;
color[3] = 250;
@@ -3432,7 +3414,7 @@ void RenderVhsEffect (fixed_t upbary, fixed_t downbary, UINT8 updistort, UINT8 d
pglDrawArrays(GL_TRIANGLE_FAN, 0, 4);
// Downward bar
MakeScreenTexture(HWD_SCREENTEXTURE_GENERIC1);
GL_MakeScreenTexture(HWD_SCREENTEXTURE_GENERIC1);
//pglBindTexture(GL_TEXTURE_2D, screentexture);
fix[0] = 0.0f;
@@ -3458,7 +3440,7 @@ void RenderVhsEffect (fixed_t upbary, fixed_t downbary, UINT8 updistort, UINT8 d
}
// Create a texture from the screen.
void MakeScreenTexture (int tex)
void GL_MakeScreenTexture(int tex)
{
INT32 texsize = 512;
boolean firstTime = (screenTextures[tex] == 0);
@@ -3489,7 +3471,7 @@ void MakeScreenTexture (int tex)
tex_downloaded = screenTextures[tex];
}
void DrawScreenFinalTexture(int tex, INT32 width, INT32 height)
void GL_DrawScreenFinalTexture(int tex, INT32 width, INT32 height)
{
float xfix, yfix;
float origaspect, newaspect;
@@ -3551,8 +3533,8 @@ void 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);
GL_ClearBuffer(true, false, false, &clearColour);
GL_SetBlend(PF_NoDepthTest);
pglBindTexture(GL_TEXTURE_2D, screenTextures[tex]);
@@ -3576,7 +3558,7 @@ void DrawScreenFinalTexture(int tex, INT32 width, INT32 height)
tex_downloaded = screenTextures[tex];
}
void SetPaletteLookup(UINT8 *lut)
void GL_SetPaletteLookup(UINT8 *lut)
{
GLenum internalFormat;
if (gl_version[0] == '1' || gl_version[0] == '2')
@@ -3603,7 +3585,7 @@ void SetPaletteLookup(UINT8 *lut)
pglActiveTexture(GL_TEXTURE0);
}
UINT32 CreateLightTable(RGBA_t *hw_lighttable)
UINT32 GL_CreateLightTable(RGBA_t *hw_lighttable)
{
LTListItem *item = malloc(sizeof(LTListItem));
if (!LightTablesTail)
@@ -3629,7 +3611,7 @@ UINT32 CreateLightTable(RGBA_t *hw_lighttable)
}
// Delete light table textures, ids given before become invalid and must not be used.
void ClearLightTables(void)
void GL_ClearLightTables(void)
{
while (LightTablesHead)
{
@@ -3646,7 +3628,7 @@ void ClearLightTables(void)
}
// This palette is used for the palette rendering postprocessing step.
void SetScreenPalette(RGBA_t *palette)
void GL_SetScreenPalette(RGBA_t *palette)
{
if (memcmp(screenPalette, palette, sizeof(screenPalette)))
{
+8 -12
View File
@@ -70,10 +70,10 @@ 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
@@ -99,18 +99,14 @@ typedef void (APIENTRY * PFNglGetIntegerv) (GLenum pname, GLint *params);
extern PFNglGetIntegerv pglGetIntegerv;
typedef const GLubyte* (APIENTRY * PFNglGetString) (GLenum name);
extern PFNglGetString pglGetString;
#if 0
typedef void (APIENTRY * PFNglEnableClientState) (GLenum cap); // redefined in r_opengl.c
static PFNglEnableClientState pglEnableClientState;
#endif
#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;
+64 -64
View File
@@ -2003,27 +2003,27 @@ void I_StartupGraphics(void)
else if (M_CheckParm("-opengl"))
rendermode = render_opengl;
msaa = 0; boolean msaa_set = false;
a2c = false; boolean a2c_set = false;
msaa = 0; boolean msaa_set = false;
a2c = false; boolean a2c_set = false;
if (M_CheckParm("-msaa") && M_IsNextParm())
{
const char* str = M_GetNextParm();
if (sscanf(str, "%u", &msaa))
{
msaa_set = true;
}
}
if (M_CheckParm("-msaa") && M_IsNextParm())
{
const char* str = M_GetNextParm();
if (sscanf(str, "%u", &msaa))
{
msaa_set = true;
}
}
if (M_CheckParm("-a2c"))
{
a2c = true;
a2c_set = true;
}
else if (M_CheckParm("-noa2c"))
{
a2c_set = true;
}
if (M_CheckParm("-a2c"))
{
a2c = true;
a2c_set = true;
}
else if (M_CheckParm("-noa2c"))
{
a2c_set = true;
}
{
char line[16];
@@ -2033,52 +2033,52 @@ void I_StartupGraphics(void)
{
while (fgets(line, sizeof line, file) != NULL)
{
word = strtok(line, " \n");
word = strtok(line, " \n");
if (rendermode == render_none)
{
if (strcasecmp(word, "software") == 0)
{
rendermode = render_soft;
}
else if (strcasecmp(word, "opengl") == 0)
{
rendermode = render_opengl;
}
if (rendermode == render_none)
{
if (strcasecmp(word, "software") == 0)
{
rendermode = render_soft;
}
else if (strcasecmp(word, "opengl") == 0)
{
rendermode = render_opengl;
}
if (rendermode != render_none)
{
CONS_Printf("Using last known renderer: %s\n", line);
}
if (rendermode != render_none)
{
CONS_Printf("Using last known renderer: %s\n", line);
}
}
if (!msaa_set)
{
if (strcasecmp(word, "msaa") == 0)
{
const char *nextword = strtok(NULL, " \n");
if (!msaa_set)
{
if (strcasecmp(word, "msaa") == 0)
{
const char *nextword = strtok(NULL, " \n");
if (!nextword || !sscanf(nextword, "%u", &msaa))
{
CONS_Alert(CONS_ERROR, "Malformed MSAA entry in renderer.txt\n");
}
else
{
CONS_Printf("Using last know MSAA value: %u\n", msaa);
}
}
}
if (!nextword || !sscanf(nextword, "%u", &msaa))
{
CONS_Alert(CONS_ERROR, "Malformed MSAA entry in renderer.txt\n");
}
else
{
CONS_Printf("Using last know MSAA value: %u\n", msaa);
}
}
}
if (!a2c_set)
{
if (strcasecmp(word, "a2c") == 0)
{
a2c = true;
if (!a2c_set)
{
if (strcasecmp(word, "a2c") == 0)
{
a2c = true;
CONS_Printf("Using a2c because it was specified to be used earlier\n");
}
}
}
CONS_Printf("Using a2c because it was specified to be used earlier\n");
}
}
}
fclose(file);
}
@@ -2110,13 +2110,13 @@ void I_StartupGraphics(void)
}
#ifdef HWRENDER
fprintf(file, "msaa %u\n", msaa);
fprintf(file, "msaa %u\n", msaa);
if (a2c)
fputs("a2c\n", file);
if (a2c)
fputs("a2c\n", file);
#endif
fclose(file);
fclose(file);
}
else
{
@@ -2127,12 +2127,12 @@ void I_StartupGraphics(void)
usesdl2soft = M_CheckParm("-softblit");
borderlesswindow = M_CheckParm("-borderless");
//SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY>>1,SDL_DEFAULT_REPEAT_INTERVAL<<2);
VID_Command_ModeList_f();
#ifdef HWRENDER
if (rendermode == render_opengl)
{
vid.glstate = (VID_LoadGPUAPI() && Init()) ? VID_GL_LIBRARY_LOADED : VID_GL_LIBRARY_ERROR;
vid.glstate = (VID_LoadOGLAPI() && GL_Init()) ? VID_GL_LIBRARY_LOADED : VID_GL_LIBRARY_ERROR;
if (vid.glstate == VID_GL_LIBRARY_ERROR)
{
+11 -11
View File
@@ -85,7 +85,7 @@ void *GetGLFunc(const char *proc)
return SDL_GL_GetProcAddress(proc);
}
boolean VID_LoadGPUAPI(void)
boolean VID_LoadOGLAPI(void)
{
#ifndef STATIC_OPENGL
const char *OGLLibname = NULL;
@@ -168,7 +168,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;
@@ -196,18 +196,18 @@ 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
@@ -218,9 +218,9 @@ boolean OglSdlSurface(INT32 w, INT32 h)
);
if (RenderToFramebuffer)
GLFramebuffer_Enable();
GL_Framebuffer_Enable();
else
GLFramebuffer_Disable();
GL_Framebuffer_Disable();
if (RenderToFramebuffer && HWR_UseShader())
{
@@ -274,7 +274,7 @@ void OglSdlFinishUpdate(boolean waitvbl)
if (RenderToFramebuffer)
{
GLFramebuffer_Unbind();
GL_Framebuffer_Unbind();
fbo_shader = true; // only need to run this here to not cause brightness + performance issues, its a bool since im a lazy ass
}
#endif
@@ -284,14 +284,14 @@ void OglSdlFinishUpdate(boolean waitvbl)
#ifdef USE_FBO_OGL
if (RenderToFramebuffer)
{
GLFramebuffer_Enable();
GL_Framebuffer_Enable();
fbo_shader = false;
}
#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
+1 -1
View File
@@ -27,7 +27,7 @@ extern boolean isnvidiagpu;
#endif
void OglSdlFinishUpdate(boolean vidwait);
boolean VID_LoadGPUAPI(void);
boolean VID_LoadOGLAPI(void);
extern SDL_Renderer *renderer;
extern SDL_GLContext sdlglcontext;