TEST call all ogl funcs directly
This commit is contained in:
1 parent
7393e752ca
commit
cd78d6f0c7
12 files changed
+196
-273
No files matched your search
@@ -76,7 +76,7 @@ void HWR_SetCurrentTexture(GLMipmap_t *texture)
|
||||
}
|
||||
else
|
||||
{
|
||||
GPU->SetTexture(texture);
|
||||
SetTexture(texture);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -130,8 +130,8 @@ void HWR_ProcessPolygon(FSurfaceInfo *pSurf, FOutVector *pOutVerts, FUINT iNumPt
|
||||
}
|
||||
else
|
||||
{
|
||||
GPU->SetShader((shader_target != SHADER_NONE) ? HWR_GetShaderFromTarget(shader_target) : shader_target);
|
||||
GPU->DrawPolygon(pSurf, pOutVerts, iNumPts, PolyFlags);
|
||||
SetShader((shader_target != SHADER_NONE) ? HWR_GetShaderFromTarget(shader_target) : shader_target);
|
||||
DrawPolygon(pSurf, pOutVerts, iNumPts, PolyFlags);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -295,13 +295,13 @@ void HWR_RenderBatches(void)
|
||||
|
||||
if (cv_glshaders.value && gl_shadersavailable)
|
||||
{
|
||||
GPU->SetShader(currentShader);
|
||||
SetShader(currentShader);
|
||||
}
|
||||
|
||||
if (currentPolyFlags & PF_NoTexture)
|
||||
currentTexture = NULL;
|
||||
else
|
||||
GPU->SetTexture(currentTexture);
|
||||
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
|
||||
GPU->DrawIndexedTriangles(¤tSurfaceInfo, finalVertexArray, finalIndexWritePos, currentPolyFlags, finalVertexIndexArray);
|
||||
DrawIndexedTriangles(¤tSurfaceInfo, finalVertexArray, finalIndexWritePos, currentPolyFlags, finalVertexIndexArray);
|
||||
// update stats
|
||||
ps_hw_numcalls.value.i++;
|
||||
ps_hw_numverts.value.i += finalIndexWritePos;
|
||||
@@ -435,7 +435,7 @@ void HWR_RenderBatches(void)
|
||||
{
|
||||
if (changeShader)
|
||||
{
|
||||
GPU->SetShader(nextShader);
|
||||
SetShader(nextShader);
|
||||
currentShader = nextShader;
|
||||
changeShader = false;
|
||||
|
||||
@@ -444,7 +444,7 @@ void HWR_RenderBatches(void)
|
||||
if (changeTexture)
|
||||
{
|
||||
// texture should be already ready for use from calls to SetTexture during batch collection
|
||||
GPU->SetTexture(nextTexture);
|
||||
SetTexture(nextTexture);
|
||||
currentTexture = nextTexture;
|
||||
changeTexture = false;
|
||||
|
||||
|
||||
+14
-14
@@ -497,7 +497,7 @@ static void FreeMipmapColormap(INT32 patchnum, void *patch)
|
||||
if (next->data)
|
||||
Z_Free(next->data);
|
||||
next->data = NULL;
|
||||
GPU->DeleteTexture(next);
|
||||
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
|
||||
GPU->ClearMipMapCache();
|
||||
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)
|
||||
GPU->SetTexture(&gltex->mipmap);
|
||||
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)
|
||||
GPU->SetTexture(glmip);
|
||||
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)
|
||||
GPU->SetTexture(glmip);
|
||||
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)
|
||||
GPU->SetTexture(gpatch->mipmap);
|
||||
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);
|
||||
|
||||
GPU->SetTexture(glmip);
|
||||
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;
|
||||
}
|
||||
GPU->SetScreenPalette(crushed_palette);
|
||||
SetScreenPalette(crushed_palette);
|
||||
}
|
||||
else
|
||||
{
|
||||
GPU->SetScreenPalette(palette);
|
||||
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
|
||||
GPU->SetPalette(palette);
|
||||
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
|
||||
GPU->SetPaletteLookup(lut);
|
||||
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);
|
||||
GPU->SetPalette(mapPalette);
|
||||
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 = GPU->CreateLightTable(hw_lighttable);
|
||||
id = 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)
|
||||
GPU->ClearLightTables();
|
||||
ClearLightTables();
|
||||
}
|
||||
|
||||
#endif //HWRENDER
|
||||
+20
-20
@@ -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
|
||||
GPU->DrawPolygon(NULL, v, 4, flags);
|
||||
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;
|
||||
GPU->DrawPolygon(&Surf, v, 4, flags);
|
||||
DrawPolygon(&Surf, v, 4, flags);
|
||||
}
|
||||
else
|
||||
GPU->DrawPolygon(NULL, v, 4, flags);
|
||||
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;
|
||||
GPU->DrawPolygon(&Surf, v, 4, flags);
|
||||
DrawPolygon(&Surf, v, 4, flags);
|
||||
}
|
||||
else
|
||||
GPU->DrawPolygon(NULL, v, 4, flags);
|
||||
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?
|
||||
GPU->DrawPolygon(NULL, v, 4, PF_NoDepthTest); //PF_Translucent);
|
||||
DrawPolygon(NULL, v, 4, PF_NoDepthTest); //PF_Translucent);
|
||||
}
|
||||
|
||||
|
||||
@@ -575,10 +575,10 @@ void HWR_FadeScreenMenuBack(UINT16 color, UINT8 strength)
|
||||
|
||||
Surf.LightTableId = HWR_GetLightTableID(NULL);
|
||||
Surf.LightInfo.light_level = strength;
|
||||
GPU->MakeScreenTexture(scr_tex);
|
||||
GPU->SetShader(HWR_GetShaderFromTarget(SHADER_UI_COLORMAP_FADE));
|
||||
GPU->DrawScreenTexture(scr_tex, &Surf, PF_ColorMapped|PF_NoDepthTest);
|
||||
GPU->UnSetShader();
|
||||
MakeScreenTexture(scr_tex);
|
||||
SetShader(HWR_GetShaderFromTarget(SHADER_UI_COLORMAP_FADE));
|
||||
DrawScreenTexture(scr_tex, &Surf, PF_ColorMapped|PF_NoDepthTest);
|
||||
UnSetShader();
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -602,7 +602,7 @@ void HWR_FadeScreenMenuBack(UINT16 color, UINT8 strength)
|
||||
poly_flags |= PF_Translucent;
|
||||
}
|
||||
|
||||
GPU->DrawPolygon(&Surf, v, 4, poly_flags);
|
||||
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;
|
||||
|
||||
GPU->DrawPolygon(&Surf, v, 4, PF_NoTexture|PF_Modulated|PF_Translucent|PF_NoDepthTest);
|
||||
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);
|
||||
|
||||
GPU->Draw2DLine(&v1, &v2, color_rgba);
|
||||
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];
|
||||
|
||||
GPU->DrawPolygon(&Surf, v, 4,
|
||||
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;
|
||||
GPU->ClearBuffer(true, false, false, &clearColour);
|
||||
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;
|
||||
|
||||
GPU->DrawPolygon(&Surf, v, 4, PF_NoTexture|PF_Modulated|PF_Translucent|PF_NoDepthTest);
|
||||
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;
|
||||
GPU->ClearBuffer(true, false, false, &clearColour);
|
||||
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];
|
||||
}
|
||||
|
||||
GPU->DrawPolygon(&Surf, v, 4, PF_NoTexture|PF_Modulated|PF_Translucent|PF_NoDepthTest);
|
||||
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
|
||||
GPU->ReadScreenTexture(HWD_SCREENTEXTURE_GENERIC2, (void *)buf);
|
||||
ReadScreenTexture(HWD_SCREENTEXTURE_GENERIC2, (void *)buf);
|
||||
return buf;
|
||||
}
|
||||
|
||||
@@ -1207,7 +1207,7 @@ boolean HWR_Screenshot(const char *pathname)
|
||||
}
|
||||
|
||||
// returns 24bit 888 RGB
|
||||
GPU->ReadScreenTexture(HWD_SCREENTEXTURE_GENERIC2, (void *)buf);
|
||||
ReadScreenTexture(HWD_SCREENTEXTURE_GENERIC2, (void *)buf);
|
||||
|
||||
#ifdef USE_PNG
|
||||
ret = M_SavePNG(pathname, buf, vid.width, vid.height, NULL);
|
||||
|
||||
@@ -13,14 +13,6 @@
|
||||
|
||||
#include "r_opengl/r_opengl.h"
|
||||
|
||||
// ==========================================================================
|
||||
// the hardware driver object
|
||||
// ==========================================================================
|
||||
struct GPURenderingAPI *GPU = NULL;
|
||||
|
||||
void GPUInterface_Load(struct GPURenderingAPI **api)
|
||||
{
|
||||
*api = &GLInterfaceAPI;
|
||||
}
|
||||
|
||||
#endif // HWRENDER
|
||||
+38
-46
@@ -19,63 +19,55 @@
|
||||
|
||||
#define SCREENVERTS 10
|
||||
|
||||
struct GPURenderingAPI
|
||||
{
|
||||
boolean (*Init) (void);
|
||||
void (*FinishUpdate) (INT32 waitvbl);
|
||||
void (*SetupGLInfo) (void);
|
||||
boolean Init (void);
|
||||
void FinishUpdate (INT32 waitvbl);
|
||||
void SetupGLInfo (void);
|
||||
|
||||
void (*SetSpecialState) (hwdspecialstate_t IdState, INT32 Value);
|
||||
void (*SetTransform) (FTransform *stransform);
|
||||
void (*SetBlend) (FBITFIELD PolyFlags);
|
||||
void (*SetPalette) (RGBA_t *palette);
|
||||
void (*ClearBuffer) (FBOOLEAN ColorMask, FBOOLEAN DepthMask, FBOOLEAN StencilMask, FRGBAFloat * ClearColor);
|
||||
void SetSpecialState (hwdspecialstate_t IdState, INT32 Value);
|
||||
void SetTransform (FTransform *stransform);
|
||||
void SetBlend (FBITFIELD PolyFlags);
|
||||
void SetPalette (RGBA_t *palette);
|
||||
void ClearBuffer (FBOOLEAN ColorMask, FBOOLEAN DepthMask, FBOOLEAN StencilMask, FRGBAFloat * ClearColor);
|
||||
|
||||
void (*DrawPolygon) (FSurfaceInfo *pSurf, FOutVector *pOutVerts, FUINT iNumPts, FBITFIELD PolyFlags);
|
||||
void (*DrawIndexedTriangles) (FSurfaceInfo *pSurf, FOutVector *pOutVerts, FUINT iNumPts, FBITFIELD PolyFlags, unsigned int *IndexArray);
|
||||
void 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 (*Draw2DLine) (F2DCoord *v1, F2DCoord *v2, RGBA_t Color);
|
||||
void (*DrawModel) (model_t *model, INT32 frameIndex, float duration, float tics, INT32 nextFrameIndex, FTransform *pos, float hscale, float vscale, UINT8 flipped, UINT8 hflipped, FSurfaceInfo *Surface);
|
||||
void (*RenderSkyDome) (INT32 tex, INT32 texture_width, INT32 texture_height, FTransform transform);
|
||||
void SetTexture (GLMipmap_t *pTexInfo);
|
||||
void UpdateTexture (GLMipmap_t *pTexInfo);
|
||||
void DeleteTexture (GLMipmap_t *pTexInfo);
|
||||
|
||||
void (*SetTexture) (GLMipmap_t *pTexInfo);
|
||||
void (*UpdateTexture) (GLMipmap_t *pTexInfo);
|
||||
void (*DeleteTexture) (GLMipmap_t *pTexInfo);
|
||||
void ClearMipMapCache (void);
|
||||
INT32 GetTextureUsed (void);
|
||||
|
||||
void (*ClearMipMapCache) (void);
|
||||
INT32 (*GetTextureUsed) (void);
|
||||
void CreateModelVBOs (model_t *model);
|
||||
|
||||
void (*CreateModelVBOs) (model_t *model);
|
||||
void ReadScreenTexture (int tex, UINT16 *dst_data);
|
||||
void GClipRect (INT32 minx, INT32 miny, INT32 maxx, INT32 maxy, float nearclip, float farclip);
|
||||
|
||||
void (*ReadScreenTexture) (int tex, UINT16 *dst_data);
|
||||
void (*GClipRect) (INT32 minx, INT32 miny, INT32 maxx, INT32 maxy, float nearclip, float farclip);
|
||||
void MakeScreenTexture (int tex);
|
||||
void FlushScreenTextures (void);
|
||||
|
||||
void (*MakeScreenTexture) (int tex);
|
||||
void (*FlushScreenTextures) (void);
|
||||
void DrawScreenTexture(int tex, FSurfaceInfo *surf, FBITFIELD polyflags);
|
||||
void DoScreenWipe (int wipeStart, int wipeEnd);
|
||||
void RenderVhsEffect (fixed_t upbary, fixed_t downbary, UINT8 updistort, UINT8 downdistort, UINT8 barsize);
|
||||
void DrawScreenFinalTexture (int tex, INT32 width, INT32 height);
|
||||
|
||||
void (*DrawScreenTexture)(int tex, FSurfaceInfo *surf, FBITFIELD polyflags);
|
||||
void (*DoScreenWipe) (int wipeStart, int wipeEnd);
|
||||
void (*RenderVhsEffect) (fixed_t upbary, fixed_t downbary, UINT8 updistort, UINT8 downdistort, UINT8 barsize);
|
||||
void (*DrawScreenFinalTexture) (int tex, INT32 width, INT32 height);
|
||||
void PostImgRedraw (float points[SCREENVERTS][SCREENVERTS][2]);
|
||||
|
||||
void (*PostImgRedraw) (float points[SCREENVERTS][SCREENVERTS][2]);
|
||||
boolean InitShaders (void);
|
||||
void LoadShader (int slot, char *code, hwdshaderstage_t stage);
|
||||
boolean CompileShader (int slot);
|
||||
void SetShader (int slot);
|
||||
void UnSetShader (void);
|
||||
|
||||
boolean (*InitShaders) (void);
|
||||
void (*LoadShader) (int slot, char *code, hwdshaderstage_t stage);
|
||||
boolean (*CompileShader) (int slot);
|
||||
void (*SetShader) (int slot);
|
||||
void (*UnSetShader) (void);
|
||||
void SetShaderInfo (hwdshaderinfo_t info, INT32 value);
|
||||
|
||||
void (*SetShaderInfo) (hwdshaderinfo_t info, INT32 value);
|
||||
|
||||
void (*SetPaletteLookup) (UINT8 *lut);
|
||||
UINT32 (*CreateLightTable) (RGBA_t *hw_lighttable);
|
||||
void (*ClearLightTables) (void);
|
||||
void (*SetScreenPalette) (RGBA_t *palette);
|
||||
};
|
||||
|
||||
extern struct GPURenderingAPI *GPU;
|
||||
|
||||
void GPUInterface_Load(struct GPURenderingAPI **api);
|
||||
void SetPaletteLookup (UINT8 *lut);
|
||||
UINT32 CreateLightTable (RGBA_t *hw_lighttable);
|
||||
void ClearLightTables (void);
|
||||
void SetScreenPalette (RGBA_t *palette);
|
||||
|
||||
#endif // __HWR_GPU_H__
|
||||
+47
-48
@@ -241,7 +241,7 @@ static void CV_screentextures_OnChange(void)
|
||||
CV_SetValue(&cv_glframebuffer, 0);
|
||||
#endif
|
||||
}
|
||||
GPU->SetSpecialState(HWD_SET_SCREEN_TEXTURES, cv_glscreentextures.value);
|
||||
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)
|
||||
GPU->SetSpecialState(HWD_SET_FRAMEBUFFER, cv_glframebuffer.value);
|
||||
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
|
||||
GPU->SetSpecialState(HWD_SET_TEXTUREFILTERMODE, cv_glfiltermode.value);
|
||||
SetSpecialState(HWD_SET_TEXTUREFILTERMODE, cv_glfiltermode.value);
|
||||
}
|
||||
|
||||
static void CV_anisotropic_OnChange(void)
|
||||
{
|
||||
ONLY_IF_GL_LOADED
|
||||
GPU->SetSpecialState(HWD_SET_TEXTUREANISOTROPICMODE, cv_glanisotropicmode.value);
|
||||
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)
|
||||
{
|
||||
GPU->SetSpecialState(HWD_SET_SHADERS, HWR_UseShader() ? 1 : 0);
|
||||
SetSpecialState(HWD_SET_SHADERS, HWR_UseShader() ? 1 : 0);
|
||||
}
|
||||
|
||||
boolean HWR_ShouldUsePaletteRendering(void)
|
||||
@@ -1155,11 +1155,10 @@ static void HWR_DrawSkyWallList(void)
|
||||
surf.PolyColor.rgba = 0xFFFFFFFF;
|
||||
|
||||
HWR_SetCurrentTexture(NULL);
|
||||
GPU->UnSetShader();
|
||||
UnSetShader();
|
||||
for (i = 0; i < skyWallVertexArraySize; i++)
|
||||
{
|
||||
//GPU->DrawPolygon(&surf, skyWallVertexArray + i * 4, 4, PF_Occlude|PF_Invisible|PF_NoTexture);
|
||||
HWR_ProcessPolygon(&surf, skyWallVertexArray + i * 4, 4, PF_Occlude|PF_Invisible|PF_NoTexture, SHADER_NONE, false);
|
||||
DrawPolygon(&surf, skyWallVertexArray + i * 4, 4, PF_Occlude|PF_Invisible|PF_NoTexture);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4267,7 +4266,7 @@ static void HWR_RenderDrawNodes(void)
|
||||
PS_START_TIMING(ps_hw_nodedrawtime);
|
||||
|
||||
// Okay! Let's draw it all! Woo!
|
||||
GPU->SetTransform(&atransform);
|
||||
SetTransform(&atransform);
|
||||
|
||||
for (i = 0; i < numdrawnodes; i++)
|
||||
{
|
||||
@@ -4963,8 +4962,8 @@ static void HWR_DrawSkyBackground(float fpov)
|
||||
|
||||
HWR_GetTexture(texturetranslation[skytexture], false);
|
||||
if (HWR_UseShader())
|
||||
GPU->SetShader(HWR_GetShaderFromTarget(SHADER_SKY));// sky shader
|
||||
GPU->RenderSkyDome(skytexture, textures[skytexture]->width, textures[skytexture]->height, dometransform);
|
||||
SetShader(HWR_GetShaderFromTarget(SHADER_SKY));// sky shader
|
||||
RenderSkyDome(skytexture, textures[skytexture]->width, textures[skytexture]->height, dometransform);
|
||||
}
|
||||
|
||||
|
||||
@@ -4973,12 +4972,12 @@ static void HWR_DrawSkyBackground(float fpov)
|
||||
// -----------------+
|
||||
static inline void HWR_ClearView(void)
|
||||
{
|
||||
GPU->GClipRect((INT32)gl_viewwindowx,
|
||||
GClipRect((INT32)gl_viewwindowx,
|
||||
(INT32)gl_viewwindowy,
|
||||
(INT32)(gl_viewwindowx + gl_viewwidth),
|
||||
(INT32)(gl_viewwindowy + gl_viewheight),
|
||||
ZCLIP_PLANE, FAR_ZCLIP_DEFAULT);
|
||||
GPU->ClearBuffer(false, true, true, NULL);
|
||||
ClearBuffer(false, true, true, NULL);
|
||||
}
|
||||
|
||||
|
||||
@@ -5000,7 +4999,7 @@ void HWR_SetViewSize(void)
|
||||
gl_baseviewwindowy = 0;
|
||||
gl_baseviewwindowx = 0;
|
||||
|
||||
GPU->FlushScreenTextures();
|
||||
FlushScreenTextures();
|
||||
}
|
||||
|
||||
// Set view aiming, for the sky dome, the skybox,
|
||||
@@ -5065,7 +5064,7 @@ void HWR_SetTransform(float fpov, player_t *player)
|
||||
atransform.mirrorflip = true;
|
||||
|
||||
// Set transform.
|
||||
GPU->SetTransform(&atransform);
|
||||
SetTransform(&atransform);
|
||||
}
|
||||
|
||||
void HWR_ClearClipper(void)
|
||||
@@ -5082,8 +5081,8 @@ void HWR_ClearClipper(void)
|
||||
void HWR_SetStencilState(int state, int level)
|
||||
{
|
||||
if (level > -1)
|
||||
GPU->SetSpecialState(HWD_SET_STENCIL_LEVEL, level);
|
||||
GPU->SetSpecialState(HWD_SET_PORTAL_MODE, state);
|
||||
SetSpecialState(HWD_SET_STENCIL_LEVEL, level);
|
||||
SetSpecialState(HWD_SET_PORTAL_MODE, state);
|
||||
}
|
||||
|
||||
// Renders the current viewpoint, though takes portal arguments for recursive portals.
|
||||
@@ -5139,7 +5138,7 @@ void HWR_RenderViewpoint(gl_portal_t *rootportal, const float fpov, player_t *pl
|
||||
}
|
||||
|
||||
// Set transform.
|
||||
GPU->SetTransform(&atransform);
|
||||
SetTransform(&atransform);
|
||||
|
||||
validcount++;
|
||||
|
||||
@@ -5183,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);
|
||||
GPU->ClearBuffer(false, false, true, 0);// clear skywall markings from the stencil buffer
|
||||
ClearBuffer(false, false, true, 0);// clear skywall markings from the stencil buffer
|
||||
HWR_SetTransform(fpov, player);// restore transform
|
||||
}
|
||||
gl_collect_skywalls = false;
|
||||
@@ -5254,7 +5253,7 @@ static void HWR_RenderFrame(INT32 viewnumber, player_t *player, boolean skybox)
|
||||
|
||||
if (!skybox && cv_glrenderdistance.value)
|
||||
{
|
||||
GPU->GClipRect((INT32)gl_viewwindowx,
|
||||
GClipRect((INT32)gl_viewwindowx,
|
||||
(INT32)gl_viewwindowy,
|
||||
(INT32)(gl_viewwindowx + gl_viewwidth),
|
||||
(INT32)(gl_viewwindowy + gl_viewheight),
|
||||
@@ -5266,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
|
||||
GPU->SetTransform(NULL);
|
||||
GPU->UnSetShader();
|
||||
SetTransform(NULL);
|
||||
UnSetShader();
|
||||
|
||||
// Run post processor effects
|
||||
if (!skybox)
|
||||
@@ -5275,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
|
||||
GPU->GClipRect(0, 0, vid.width, vid.height, NZCLIP_PLANE, FAR_ZCLIP_DEFAULT);
|
||||
GClipRect(0, 0, vid.width, vid.height, NZCLIP_PLANE, FAR_ZCLIP_DEFAULT);
|
||||
}
|
||||
|
||||
// ==========================================================================
|
||||
@@ -5305,20 +5304,20 @@ void HWR_RenderPlayerView(INT32 viewnumber, player_t *player)
|
||||
ClearColor.blue = 0.0f;
|
||||
ClearColor.alpha = 1.0f;
|
||||
|
||||
GPU->ClearBuffer(true, false, false, &ClearColor);
|
||||
ClearBuffer(true, false, false, &ClearColor);
|
||||
}
|
||||
|
||||
if (HWR_UseShader())
|
||||
{
|
||||
if (cv_ripplewater.value)
|
||||
GPU->SetShaderInfo(HWD_SHADERINFO_LEVELTIME, (INT32)leveltime); // The water surface shader needs the leveltime.
|
||||
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
|
||||
GPU->SetShaderInfo(HWD_SHADERINFO_LIGHT_X, FINECOSINE(light_angle >> ANGLETOFINESHIFT));
|
||||
GPU->SetShaderInfo(HWD_SHADERINFO_LIGHT_Y, 0);
|
||||
GPU->SetShaderInfo(HWD_SHADERINFO_LIGHT_Z, -FINESINE(light_angle >> ANGLETOFINESHIFT));
|
||||
SetShaderInfo(HWD_SHADERINFO_LIGHT_X, FINECOSINE(light_angle >> ANGLETOFINESHIFT));
|
||||
SetShaderInfo(HWD_SHADERINFO_LIGHT_Y, 0);
|
||||
SetShaderInfo(HWD_SHADERINFO_LIGHT_Z, -FINESINE(light_angle >> ANGLETOFINESHIFT));
|
||||
|
||||
GPU->SetShaderInfo(HWD_SHADERINFO_LIGHT_CONTRAST, maplighting.contrast);
|
||||
GPU->SetShaderInfo(HWD_SHADERINFO_LIGHT_BACKLIGHT, maplighting.backlight);
|
||||
SetShaderInfo(HWD_SHADERINFO_LIGHT_CONTRAST, maplighting.contrast);
|
||||
SetShaderInfo(HWD_SHADERINFO_LIGHT_BACKLIGHT, maplighting.backlight);
|
||||
}
|
||||
|
||||
if (viewnumber > 3)
|
||||
@@ -5382,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.
|
||||
GPU->ClearMipMapCache();
|
||||
ClearMipMapCache();
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -5396,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.
|
||||
GPU->ClearMipMapCache();
|
||||
ClearMipMapCache();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5467,11 +5466,11 @@ void HWR_Startup(void)
|
||||
|
||||
#ifdef USE_FBO_OGL
|
||||
if (supportFBO)
|
||||
GPU->SetSpecialState(HWD_SET_FRAMEBUFFER, cv_glframebuffer.value);
|
||||
SetSpecialState(HWD_SET_FRAMEBUFFER, cv_glframebuffer.value);
|
||||
#endif
|
||||
|
||||
if (msaa)
|
||||
GPU->SetSpecialState(HWD_SET_MSAA, a2c ? 2 : 1);
|
||||
SetSpecialState(HWD_SET_MSAA, a2c ? 2 : 1);
|
||||
}
|
||||
startupdone = true;
|
||||
}
|
||||
@@ -5485,7 +5484,7 @@ void HWR_Shutdown(void)
|
||||
HWR_FreeExtraSubsectors();
|
||||
HWR_FreeMipmapCache();
|
||||
HWR_FreeTextureCache();
|
||||
GPU->FlushScreenTextures();
|
||||
FlushScreenTextures();
|
||||
#ifdef USE_FBO_OGL
|
||||
GLFramebuffer_Disable();
|
||||
#endif
|
||||
@@ -5530,12 +5529,12 @@ static void HWR_RenderWall(FOutVector *wallVerts, FSurfaceInfo *pSurf, FBITFIELD
|
||||
|
||||
INT32 HWR_GetTextureUsed(void)
|
||||
{
|
||||
return GPU->GetTextureUsed();
|
||||
return GetTextureUsed();
|
||||
}
|
||||
|
||||
static void HWR_DoPostProcessor(player_t *player)
|
||||
{
|
||||
GPU->UnSetShader();
|
||||
UnSetShader();
|
||||
|
||||
// Armageddon Blast Flash!
|
||||
// Could this even be considered postprocessor?
|
||||
@@ -5559,7 +5558,7 @@ static void HWR_DoPostProcessor(player_t *player)
|
||||
|
||||
Surf.PolyColor.s.alpha = 0xc0; // match software mode
|
||||
|
||||
GPU->DrawPolygon(&Surf, v, 4, PF_Modulated|PF_Translucent|PF_NoTexture|PF_NoDepthTest);
|
||||
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
|
||||
@@ -5567,7 +5566,7 @@ static void HWR_DoPostProcessor(player_t *player)
|
||||
|
||||
// Capture the screen for intermission and screen waving
|
||||
if (gamestate != GS_INTERMISSION)
|
||||
GPU->MakeScreenTexture(HWD_SCREENTEXTURE_GENERIC1);
|
||||
MakeScreenTexture(HWD_SCREENTEXTURE_GENERIC1);
|
||||
|
||||
if (splitscreen) // Not supported in splitscreen - someone want to add support?
|
||||
return;
|
||||
@@ -5607,28 +5606,28 @@ static void HWR_DoPostProcessor(player_t *player)
|
||||
v[x][y][1] = (y/((float)(SCREENVERTS-1.0f)/9.0f))-4.5f;
|
||||
}
|
||||
}
|
||||
GPU->PostImgRedraw(v);
|
||||
PostImgRedraw(v);
|
||||
|
||||
// Capture the screen again for screen waving on the intermission
|
||||
if (gamestate != GS_INTERMISSION)
|
||||
GPU->MakeScreenTexture(HWD_SCREENTEXTURE_GENERIC1);
|
||||
MakeScreenTexture(HWD_SCREENTEXTURE_GENERIC1);
|
||||
}
|
||||
// Flipping of the screen isn't done here anymore
|
||||
}
|
||||
|
||||
void HWR_StartScreenWipe(void)
|
||||
{
|
||||
GPU->MakeScreenTexture(HWD_SCREENTEXTURE_WIPE_START);
|
||||
MakeScreenTexture(HWD_SCREENTEXTURE_WIPE_START);
|
||||
}
|
||||
|
||||
void HWR_EndScreenWipe(void)
|
||||
{
|
||||
GPU->MakeScreenTexture(HWD_SCREENTEXTURE_WIPE_END);
|
||||
MakeScreenTexture(HWD_SCREENTEXTURE_WIPE_END);
|
||||
}
|
||||
|
||||
void HWR_DrawIntermissionBG(void)
|
||||
{
|
||||
GPU->DrawScreenTexture(HWD_SCREENTEXTURE_GENERIC1, NULL, 0);
|
||||
DrawScreenTexture(HWD_SCREENTEXTURE_GENERIC1, NULL, 0);
|
||||
}
|
||||
|
||||
void HWR_DoWipe(UINT8 wipenum, UINT8 scrnnum)
|
||||
@@ -5662,22 +5661,22 @@ void HWR_DoWipe(UINT8 wipenum, UINT8 scrnnum)
|
||||
}
|
||||
|
||||
HWR_GetFadeMask(lumpnum);
|
||||
GPU->DoScreenWipe(HWD_SCREENTEXTURE_WIPE_START, HWD_SCREENTEXTURE_WIPE_END);
|
||||
DoScreenWipe(HWD_SCREENTEXTURE_WIPE_START, HWD_SCREENTEXTURE_WIPE_END);
|
||||
}
|
||||
|
||||
void HWR_RenderVhsEffect(fixed_t upbary, fixed_t downbary, UINT8 updistort, UINT8 downdistort, UINT8 barsize)
|
||||
{
|
||||
GPU->RenderVhsEffect(upbary, downbary, updistort, downdistort, barsize);
|
||||
RenderVhsEffect(upbary, downbary, updistort, downdistort, barsize);
|
||||
}
|
||||
|
||||
void HWR_MakeScreenFinalTexture(void)
|
||||
{
|
||||
GPU->MakeScreenTexture(HWD_SCREENTEXTURE_GENERIC2);
|
||||
MakeScreenTexture(HWD_SCREENTEXTURE_GENERIC2);
|
||||
}
|
||||
|
||||
void HWR_DrawScreenFinalTexture(INT32 width, INT32 height)
|
||||
{
|
||||
GPU->DrawScreenFinalTexture(HWD_SCREENTEXTURE_GENERIC2, width, height);
|
||||
DrawScreenFinalTexture(HWD_SCREENTEXTURE_GENERIC2, width, height);
|
||||
}
|
||||
|
||||
#endif // HWRENDER
|
||||
@@ -418,7 +418,7 @@ static void md2_loadTexture(md2_t *model)
|
||||
}
|
||||
}
|
||||
}
|
||||
GPU->SetTexture(glpatch->mipmap);
|
||||
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;
|
||||
}
|
||||
GPU->SetTexture(glpatch->mipmap); // We do need to do this so that it can be cleared and knows to recreate it when necessary
|
||||
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
|
||||
GPU->SetTexture(gpatch->mipmap);
|
||||
SetTexture(gpatch->mipmap);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1062,7 +1062,7 @@ static void HWR_GetBlendedTexture(GLPatch_t *gpatch, GLPatch_t *blendgpatch, INT
|
||||
{
|
||||
if (glmip->downloaded && glmip->data)
|
||||
{
|
||||
GPU->SetTexture(glmip); // found the colormap, set it to the correct texture
|
||||
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);
|
||||
|
||||
GPU->SetTexture(newmip);
|
||||
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);
|
||||
GPU->CreateModelVBOs(md2->model);
|
||||
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
|
||||
GPU->SetTexture(gpatch->mipmap);
|
||||
SetTexture(gpatch->mipmap);
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -1467,7 +1467,7 @@ void HWR_DrawMD2(gl_vissprite_t *spr)
|
||||
p.mirror = atransform.mirror; // from Kart
|
||||
#endif
|
||||
|
||||
GPU->SetShader(SHADER_MODEL); // model shader
|
||||
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;
|
||||
|
||||
GPU->DrawModel(md2->model, frame, durs, tics, nextFrame, &p, md2->scale * xs, md2->scale * ys, flip, hflip, &Surf);
|
||||
DrawModel(md2->model, frame, durs, tics, nextFrame, &p, md2->scale * xs, md2->scale * ys, flip, hflip, &Surf);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -158,7 +158,7 @@ void HWR_RenderPortalSeg(gl_portal_t* portal, SINT8 state)
|
||||
gl_drawing_stencil = false;
|
||||
// need to work around the r_opengl PF_Invisible bug with this call
|
||||
// similarly as in the linkdraw hack in HWR_DrawSprites
|
||||
GPU->SetBlend(PF_Translucent|PF_Occlude|PF_Masked);
|
||||
SetBlend(PF_Translucent|PF_Occlude|PF_Masked);
|
||||
}
|
||||
|
||||
// Renders a single portal from the current viewpoint.
|
||||
|
||||
@@ -93,7 +93,7 @@ boolean HWR_InitShaders(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (!GPU->InitShaders())
|
||||
if (!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;
|
||||
GPU->LoadShader(index, preprocessed, HWD_SHADERSTAGE_VERTEX);
|
||||
LoadShader(index, preprocessed, HWD_SHADERSTAGE_VERTEX);
|
||||
}
|
||||
if (fragment_source)
|
||||
{
|
||||
char *preprocessed = HWR_PreprocessShader(fragment_source);
|
||||
if (!preprocessed) return;
|
||||
GPU->LoadShader(index, preprocessed, HWD_SHADERSTAGE_FRAGMENT);
|
||||
LoadShader(index, preprocessed, HWD_SHADERSTAGE_FRAGMENT);
|
||||
}
|
||||
|
||||
gl_shaders[index].compiled = GPU->CompileShader(index);
|
||||
gl_shaders[index].compiled = CompileShader(index);
|
||||
}
|
||||
|
||||
// compile or recompile shaders
|
||||
|
||||
@@ -797,7 +797,7 @@ static boolean GLFramebuffer_IsFuncAvailible(void)
|
||||
}
|
||||
#endif
|
||||
|
||||
static boolean InitShaders (void)
|
||||
boolean InitShaders (void)
|
||||
{
|
||||
if (!pglUseProgram)
|
||||
return false;
|
||||
@@ -814,7 +814,7 @@ static boolean InitShaders (void)
|
||||
return true;
|
||||
}
|
||||
|
||||
static void LoadShader (int slot, char *code, hwdshaderstage_t stage)
|
||||
void LoadShader (int slot, char *code, hwdshaderstage_t stage)
|
||||
{
|
||||
gl_shader_t *shader;
|
||||
|
||||
@@ -839,7 +839,7 @@ static void LoadShader (int slot, char *code, hwdshaderstage_t stage)
|
||||
#undef LOADSHADER
|
||||
}
|
||||
|
||||
static boolean CompileShader (int slot)
|
||||
boolean CompileShader (int slot)
|
||||
{
|
||||
if (slot < 0 || slot >= HWR_MAXSHADERS)
|
||||
I_Error("CompileShader: Invalid slot %d", slot);
|
||||
@@ -860,7 +860,7 @@ static boolean CompileShader (int slot)
|
||||
// Those are given to the uniforms.
|
||||
//
|
||||
|
||||
static void SetShaderInfo (hwdshaderinfo_t info, INT32 value)
|
||||
void SetShaderInfo (hwdshaderinfo_t info, INT32 value)
|
||||
{
|
||||
switch (info)
|
||||
{
|
||||
@@ -887,11 +887,11 @@ static void SetShaderInfo (hwdshaderinfo_t info, INT32 value)
|
||||
}
|
||||
}
|
||||
|
||||
static void SetShader (int slot)
|
||||
void SetShader (int slot)
|
||||
{
|
||||
if (slot == SHADER_NONE)
|
||||
{
|
||||
GPU->UnSetShader();
|
||||
UnSetShader();
|
||||
return;
|
||||
}
|
||||
if (gl_allowshaders)
|
||||
@@ -918,7 +918,7 @@ static void SetShader (int slot)
|
||||
gl_shadersenabled = false;
|
||||
}
|
||||
|
||||
static void UnSetShader (void)
|
||||
void UnSetShader (void)
|
||||
{
|
||||
if (gl_shadersenabled) // don't repeatedly call glUseProgram if not needed
|
||||
{
|
||||
@@ -1025,7 +1025,7 @@ void SetStates(void)
|
||||
|
||||
// this set CurrentPolyFlags to the actual configuration
|
||||
CurrentPolyFlags = 0xffffffff;
|
||||
GPU->SetBlend(0);
|
||||
SetBlend(0);
|
||||
|
||||
tex_downloaded = 0;
|
||||
SetNoTexture();
|
||||
@@ -1040,7 +1040,7 @@ void SetStates(void)
|
||||
// -----------------+
|
||||
// DeleteTexture : Deletes a texture from the GPU and frees its data
|
||||
// -----------------+
|
||||
static void DeleteTexture (GLMipmap_t *pTexInfo)
|
||||
void DeleteTexture (GLMipmap_t *pTexInfo)
|
||||
{
|
||||
FTextureInfo *head = TexCacheHead;
|
||||
|
||||
@@ -1104,7 +1104,7 @@ static void GLFramebuffer_GenerateAttachments(void)
|
||||
pglFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_STENCIL_ATTACHMENT, GL_RENDERBUFFER, RenderbufferObject);
|
||||
|
||||
// Clear the renderbuffer
|
||||
GPU->ClearBuffer(true, true, true, NULL);
|
||||
ClearBuffer(true, true, true, NULL);
|
||||
|
||||
pglBindRenderbuffer(GL_RENDERBUFFER, 0);
|
||||
}
|
||||
@@ -1261,7 +1261,7 @@ INT32 isExtAvailable(const char *extension, const GLubyte *start)
|
||||
// Init : Initialise the OpenGL interface API
|
||||
// Returns :
|
||||
// -----------------+
|
||||
static boolean Init (void)
|
||||
boolean Init (void)
|
||||
{
|
||||
return SetupGLfunc();
|
||||
}
|
||||
@@ -1270,7 +1270,7 @@ static boolean Init (void)
|
||||
// -----------------+
|
||||
// SetupGLInfo : Retreive and store currently loaded OpenGL version
|
||||
// -----------------+
|
||||
static void SetupGLInfo (void)
|
||||
void SetupGLInfo (void)
|
||||
{
|
||||
const GLubyte *versionGL = pglGetString(GL_VERSION);
|
||||
CONS_Printf("Loaded OpenGL version %s\n", (const char*)versionGL);
|
||||
@@ -1281,7 +1281,7 @@ static void SetupGLInfo (void)
|
||||
// -----------------+
|
||||
// ClearMipMapCache : Flush OpenGL textures from memory
|
||||
// -----------------+
|
||||
static void ClearMipMapCache (void)
|
||||
void ClearMipMapCache (void)
|
||||
{
|
||||
Flush();
|
||||
}
|
||||
@@ -1289,7 +1289,7 @@ static void ClearMipMapCache (void)
|
||||
// Writes screen texture tex into dst_data.
|
||||
// Pixel format is 24-bit RGB. Row order is top to bottom.
|
||||
// Dimensions are screen_width * screen_height.
|
||||
static void ReadScreenTexture (int tex, UINT16 *dst_data)
|
||||
void ReadScreenTexture (int tex, UINT16 *dst_data)
|
||||
{
|
||||
INT32 i;
|
||||
int dst_stride = screen_width * 3; // stride between rows of image data
|
||||
@@ -1302,11 +1302,11 @@ static 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)
|
||||
GPU->DrawScreenTexture(tex, NULL, 0);
|
||||
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)
|
||||
GPU->DrawScreenTexture(HWD_SCREENTEXTURE_GENERIC2, NULL, 0);
|
||||
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 +1323,7 @@ static void ReadScreenTexture (int tex, UINT16 *dst_data)
|
||||
// -----------------+
|
||||
// SetPalette : Changes the current texture palette
|
||||
// -----------------+
|
||||
static void SetPalette (RGBA_t *palette)
|
||||
void SetPalette (RGBA_t *palette)
|
||||
{
|
||||
INT32 i;
|
||||
|
||||
@@ -1340,7 +1340,7 @@ static void SetPalette (RGBA_t *palette)
|
||||
// -----------------+
|
||||
// GClipRect : Defines the 2D hardware clipping window
|
||||
// -----------------+
|
||||
static void GClipRect (INT32 minx, INT32 miny, INT32 maxx, INT32 maxy, float nearclip, float farclip)
|
||||
void GClipRect (INT32 minx, INT32 miny, INT32 maxx, INT32 maxy, float nearclip, float farclip)
|
||||
{
|
||||
//GL_DBG_Printf("GClipRect(%d, %d, %d, %d)\n", minx, miny, maxx, maxy);
|
||||
|
||||
@@ -1363,10 +1363,7 @@ static void GClipRect (INT32 minx, INT32 miny, INT32 maxx, INT32 maxy, float nea
|
||||
// -----------------+
|
||||
// ClearBuffer : Clear the color/alpha/depth buffer(s)
|
||||
// -----------------+
|
||||
static void ClearBuffer (FBOOLEAN ColorMask,
|
||||
FBOOLEAN DepthMask,
|
||||
FBOOLEAN StencilMask,
|
||||
FRGBAFloat * ClearColor)
|
||||
void ClearBuffer (FBOOLEAN ColorMask, FBOOLEAN DepthMask, FBOOLEAN StencilMask, FRGBAFloat * ClearColor)
|
||||
{
|
||||
//GL_DBG_Printf("ClearBuffer(%d)\n", alpha);
|
||||
GLbitfield ClearMask = 0;
|
||||
@@ -1388,7 +1385,7 @@ static void ClearBuffer (FBOOLEAN ColorMask,
|
||||
ClearMask |= GL_DEPTH_BUFFER_BIT;
|
||||
}
|
||||
|
||||
GPU->SetBlend(DepthMask ? PF_Occlude | CurrentPolyFlags : CurrentPolyFlags&~PF_Occlude);
|
||||
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
|
||||
@@ -1401,9 +1398,7 @@ static void ClearBuffer (FBOOLEAN ColorMask,
|
||||
// -----------------+
|
||||
// HWRAPI Draw2DLine: Render a 2D line
|
||||
// -----------------+
|
||||
static void Draw2DLine (F2DCoord * v1,
|
||||
F2DCoord * v2,
|
||||
RGBA_t Color)
|
||||
void 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];
|
||||
@@ -1451,7 +1446,7 @@ static void Clamp2D(GLenum pname)
|
||||
// -----------------+
|
||||
// PF_Masked - we could use an ALPHA_TEST of GL_EQUAL, and alpha ref of 0,
|
||||
// is it faster when pixels are discarded ?
|
||||
static void SetBlend (FBITFIELD PolyFlags)
|
||||
void SetBlend (FBITFIELD PolyFlags)
|
||||
{
|
||||
FBITFIELD Xor;
|
||||
Xor = CurrentPolyFlags^PolyFlags;
|
||||
@@ -1598,7 +1593,7 @@ static void AllocTextureBuffer(GLMipmap_t *pTexInfo)
|
||||
// -----------------+
|
||||
// UpdateTexture : Updates texture data.
|
||||
// -----------------+
|
||||
static void UpdateTexture (GLMipmap_t *pTexInfo)
|
||||
void UpdateTexture (GLMipmap_t *pTexInfo)
|
||||
{
|
||||
// Upload a texture
|
||||
GLuint num = pTexInfo->downloaded;
|
||||
@@ -1809,7 +1804,7 @@ static void UpdateTexture (GLMipmap_t *pTexInfo)
|
||||
// -----------------+
|
||||
// SetTexture : The mipmap becomes the current texture source
|
||||
// -----------------+
|
||||
static void SetTexture (GLMipmap_t *pTexInfo)
|
||||
void SetTexture (GLMipmap_t *pTexInfo)
|
||||
{
|
||||
if (!pTexInfo)
|
||||
{
|
||||
@@ -1848,7 +1843,7 @@ static void SetTexture (GLMipmap_t *pTexInfo)
|
||||
}
|
||||
}
|
||||
|
||||
static void Shader_SetUniforms(FSurfaceInfo *Surface, GLRGBAFloat *poly, GLRGBAFloat *tint, GLRGBAFloat *fade)
|
||||
void Shader_SetUniforms(FSurfaceInfo *Surface, GLRGBAFloat *poly, GLRGBAFloat *tint, GLRGBAFloat *fade)
|
||||
{
|
||||
gl_shader_t *shader = gl_shaderstate.current;
|
||||
|
||||
@@ -1934,7 +1929,7 @@ static void Shader_SetUniforms(FSurfaceInfo *Surface, GLRGBAFloat *poly, GLRGBAF
|
||||
}
|
||||
}
|
||||
|
||||
static boolean Shader_CompileProgram(gl_shader_t *shader, GLint i)
|
||||
boolean Shader_CompileProgram(gl_shader_t *shader, GLint i)
|
||||
{
|
||||
GLuint gl_vertShader = 0;
|
||||
GLuint gl_fragShader = 0;
|
||||
@@ -2145,7 +2140,7 @@ static void PreparePolygon(FSurfaceInfo *pSurf, FBITFIELD PolyFlags)
|
||||
// -----------------+
|
||||
// DrawPolygon : Render a polygon, set the texture, set render mode
|
||||
// -----------------+
|
||||
static void DrawPolygon (FSurfaceInfo *pSurf, FOutVector *pOutVerts, FUINT iNumPts, FBITFIELD PolyFlags)
|
||||
void DrawPolygon (FSurfaceInfo *pSurf, FOutVector *pOutVerts, FUINT iNumPts, FBITFIELD PolyFlags)
|
||||
{
|
||||
PreparePolygon(pSurf, PolyFlags);
|
||||
|
||||
@@ -2163,7 +2158,7 @@ static void DrawPolygon (FSurfaceInfo *pSurf, FOutVector *pOutVerts, FUINT iNumP
|
||||
Clamp2D(GL_TEXTURE_WRAP_T);
|
||||
}
|
||||
|
||||
static void DrawIndexedTriangles (FSurfaceInfo *pSurf, FOutVector *pOutVerts, FUINT iNumPts, FBITFIELD PolyFlags, unsigned int *IndexArray)
|
||||
void DrawIndexedTriangles (FSurfaceInfo *pSurf, FOutVector *pOutVerts, FUINT iNumPts, FBITFIELD PolyFlags, unsigned int *IndexArray)
|
||||
{
|
||||
PreparePolygon(pSurf, PolyFlags);
|
||||
|
||||
@@ -2418,10 +2413,10 @@ static void RenderDome(INT32 skytexnum)
|
||||
pglDisableClientState(GL_COLOR_ARRAY);
|
||||
}
|
||||
|
||||
static void RenderSkyDome (INT32 tex, INT32 texture_width, INT32 texture_height, FTransform transform)
|
||||
void RenderSkyDome (INT32 tex, INT32 texture_width, INT32 texture_height, FTransform transform)
|
||||
{
|
||||
SetBlend(PF_Translucent|PF_NoDepthTest|PF_Modulated);
|
||||
GPU->SetTransform(&transform);
|
||||
SetTransform(&transform);
|
||||
texw = texture_width;
|
||||
texh = texture_height;
|
||||
RenderDome(tex);
|
||||
@@ -2431,7 +2426,7 @@ static void RenderSkyDome (INT32 tex, INT32 texture_width, INT32 texture_height,
|
||||
// ==========================================================================
|
||||
//
|
||||
// ==========================================================================
|
||||
static void SetSpecialState (hwdspecialstate_t IdState, INT32 Value)
|
||||
void SetSpecialState (hwdspecialstate_t IdState, INT32 Value)
|
||||
{
|
||||
switch (IdState)
|
||||
{
|
||||
@@ -2746,7 +2741,7 @@ static void CreateModelVBOTiny(mesh_t *mesh, tinyframe_t *frame)
|
||||
pglBindBuffer(GL_ARRAY_BUFFER, 0);
|
||||
}
|
||||
|
||||
static void CreateModelVBOs (model_t *model)
|
||||
void CreateModelVBOs (model_t *model)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < model->numMeshes; i++)
|
||||
@@ -3013,7 +3008,7 @@ static void DrawModelEx(model_t *model, INT32 frameIndex, float duration, float
|
||||
// -----------------+
|
||||
// HWRAPI DrawModel : Draw a model
|
||||
// -----------------+
|
||||
static void DrawModel (model_t *model, INT32 frameIndex, float duration, float tics, INT32 nextFrameIndex, FTransform *pos, float hscale, float vscale, UINT8 flipped, UINT8 hflipped, FSurfaceInfo *Surface)
|
||||
void DrawModel (model_t *model, INT32 frameIndex, float duration, float tics, INT32 nextFrameIndex, FTransform *pos, float hscale, float vscale, UINT8 flipped, UINT8 hflipped, FSurfaceInfo *Surface)
|
||||
{
|
||||
DrawModelEx(model, frameIndex, duration, tics, nextFrameIndex, pos, hscale, vscale, flipped, hflipped, Surface);
|
||||
}
|
||||
@@ -3021,7 +3016,7 @@ static void DrawModel (model_t *model, INT32 frameIndex, float duration, float t
|
||||
// -----------------+
|
||||
// SetTransform :
|
||||
// -----------------+
|
||||
static void SetTransform (FTransform *stransform)
|
||||
void SetTransform (FTransform *stransform)
|
||||
{
|
||||
static boolean special_splitscreen;
|
||||
GLdouble used_fov;
|
||||
@@ -3092,7 +3087,7 @@ static void SetTransform (FTransform *stransform)
|
||||
pglGetFloatv(GL_MODELVIEW_MATRIX, modelMatrix); // added for new coronas' code (without depth buffer)
|
||||
}
|
||||
|
||||
static INT32 GetTextureUsed (void)
|
||||
INT32 GetTextureUsed (void)
|
||||
{
|
||||
FTextureInfo *tmp = TexCacheHead;
|
||||
INT32 res = 0;
|
||||
@@ -3117,7 +3112,7 @@ static INT32 GetTextureUsed (void)
|
||||
return res;
|
||||
}
|
||||
|
||||
static void PostImgRedraw (float points[SCREENVERTS][SCREENVERTS][2])
|
||||
void PostImgRedraw (float points[SCREENVERTS][SCREENVERTS][2])
|
||||
{
|
||||
INT32 x, y;
|
||||
float float_x, float_y, float_nextx, float_nexty;
|
||||
@@ -3205,7 +3200,7 @@ static 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
|
||||
static void FlushScreenTextures (void)
|
||||
void FlushScreenTextures (void)
|
||||
{
|
||||
int i;
|
||||
pglDeleteTextures(NUMSCREENTEXTURES, screenTextures);
|
||||
@@ -3213,7 +3208,7 @@ static void FlushScreenTextures (void)
|
||||
screenTextures[i] = 0;
|
||||
}
|
||||
|
||||
static void DrawScreenTexture(int tex, FSurfaceInfo *surf, FBITFIELD polyflags)
|
||||
void DrawScreenTexture(int tex, FSurfaceInfo *surf, FBITFIELD polyflags)
|
||||
{
|
||||
float xfix, yfix;
|
||||
INT32 texsize = 512;
|
||||
@@ -3267,7 +3262,7 @@ static void DrawScreenTexture(int tex, FSurfaceInfo *surf, FBITFIELD polyflags)
|
||||
|
||||
|
||||
// Do screen fades!
|
||||
static void DoScreenWipe (int wipeStart, int wipeEnd)
|
||||
void DoScreenWipe (int wipeStart, int wipeEnd)
|
||||
{
|
||||
INT32 texsize = 512;
|
||||
float xfix, yfix;
|
||||
@@ -3358,7 +3353,7 @@ static void DoScreenWipe (int wipeStart, int wipeEnd)
|
||||
tex_downloaded = screenTextures[wipeEnd];
|
||||
}
|
||||
|
||||
static void RenderVhsEffect (fixed_t upbary, fixed_t downbary, UINT8 updistort, UINT8 downdistort, UINT8 barsize)
|
||||
void RenderVhsEffect (fixed_t upbary, fixed_t downbary, UINT8 updistort, UINT8 downdistort, UINT8 barsize)
|
||||
{
|
||||
INT32 texsize = 512;
|
||||
float xfix, yfix;
|
||||
@@ -3385,7 +3380,7 @@ static void RenderVhsEffect (fixed_t upbary, fixed_t downbary, UINT8 updistort,
|
||||
yfix = 1/((float)(texsize)/((float)((screen_height))));
|
||||
|
||||
// Slight fuzziness
|
||||
GPU->MakeScreenTexture(HWD_SCREENTEXTURE_GENERIC1);
|
||||
MakeScreenTexture(HWD_SCREENTEXTURE_GENERIC1);
|
||||
SetBlend(PF_Modulated|PF_Translucent|PF_NoDepthTest);
|
||||
//pglBindTexture(GL_TEXTURE_2D, screentexture);
|
||||
|
||||
@@ -3409,7 +3404,7 @@ static void RenderVhsEffect (fixed_t upbary, fixed_t downbary, UINT8 updistort,
|
||||
}
|
||||
|
||||
// Upward bar
|
||||
GPU->MakeScreenTexture(HWD_SCREENTEXTURE_GENERIC1);
|
||||
MakeScreenTexture(HWD_SCREENTEXTURE_GENERIC1);
|
||||
//pglBindTexture(GL_TEXTURE_2D, screentexture);
|
||||
color[0] = color[1] = color[2] = 190;
|
||||
color[3] = 250;
|
||||
@@ -3437,7 +3432,7 @@ static void RenderVhsEffect (fixed_t upbary, fixed_t downbary, UINT8 updistort,
|
||||
pglDrawArrays(GL_TRIANGLE_FAN, 0, 4);
|
||||
|
||||
// Downward bar
|
||||
GPU->MakeScreenTexture(HWD_SCREENTEXTURE_GENERIC1);
|
||||
MakeScreenTexture(HWD_SCREENTEXTURE_GENERIC1);
|
||||
//pglBindTexture(GL_TEXTURE_2D, screentexture);
|
||||
|
||||
fix[0] = 0.0f;
|
||||
@@ -3463,7 +3458,7 @@ static void RenderVhsEffect (fixed_t upbary, fixed_t downbary, UINT8 updistort,
|
||||
}
|
||||
|
||||
// Create a texture from the screen.
|
||||
static void MakeScreenTexture (int tex)
|
||||
void MakeScreenTexture (int tex)
|
||||
{
|
||||
INT32 texsize = 512;
|
||||
boolean firstTime = (screenTextures[tex] == 0);
|
||||
@@ -3494,7 +3489,7 @@ static void MakeScreenTexture (int tex)
|
||||
tex_downloaded = screenTextures[tex];
|
||||
}
|
||||
|
||||
static void DrawScreenFinalTexture(int tex, INT32 width, INT32 height)
|
||||
void DrawScreenFinalTexture(int tex, INT32 width, INT32 height)
|
||||
{
|
||||
float xfix, yfix;
|
||||
float origaspect, newaspect;
|
||||
@@ -3556,8 +3551,8 @@ static void DrawScreenFinalTexture(int tex, INT32 width, INT32 height)
|
||||
|
||||
clearColour.red = clearColour.green = clearColour.blue = 0;
|
||||
clearColour.alpha = 1;
|
||||
GPU->ClearBuffer(true, false, false, &clearColour);
|
||||
GPU->SetBlend(PF_NoDepthTest);
|
||||
ClearBuffer(true, false, false, &clearColour);
|
||||
SetBlend(PF_NoDepthTest);
|
||||
|
||||
pglBindTexture(GL_TEXTURE_2D, screenTextures[tex]);
|
||||
|
||||
@@ -3581,7 +3576,7 @@ static void DrawScreenFinalTexture(int tex, INT32 width, INT32 height)
|
||||
tex_downloaded = screenTextures[tex];
|
||||
}
|
||||
|
||||
static void SetPaletteLookup(UINT8 *lut)
|
||||
void SetPaletteLookup(UINT8 *lut)
|
||||
{
|
||||
GLenum internalFormat;
|
||||
if (gl_version[0] == '1' || gl_version[0] == '2')
|
||||
@@ -3608,7 +3603,7 @@ static void SetPaletteLookup(UINT8 *lut)
|
||||
pglActiveTexture(GL_TEXTURE0);
|
||||
}
|
||||
|
||||
static UINT32 CreateLightTable(RGBA_t *hw_lighttable)
|
||||
UINT32 CreateLightTable(RGBA_t *hw_lighttable)
|
||||
{
|
||||
LTListItem *item = malloc(sizeof(LTListItem));
|
||||
if (!LightTablesTail)
|
||||
@@ -3634,7 +3629,7 @@ static UINT32 CreateLightTable(RGBA_t *hw_lighttable)
|
||||
}
|
||||
|
||||
// Delete light table textures, ids given before become invalid and must not be used.
|
||||
static void ClearLightTables(void)
|
||||
void ClearLightTables(void)
|
||||
{
|
||||
while (LightTablesHead)
|
||||
{
|
||||
@@ -3651,7 +3646,7 @@ static void ClearLightTables(void)
|
||||
}
|
||||
|
||||
// This palette is used for the palette rendering postprocessing step.
|
||||
static void SetScreenPalette(RGBA_t *palette)
|
||||
void SetScreenPalette(RGBA_t *palette)
|
||||
{
|
||||
if (memcmp(screenPalette, palette, sizeof(screenPalette)))
|
||||
{
|
||||
@@ -3667,57 +3662,4 @@ static void SetScreenPalette(RGBA_t *palette)
|
||||
}
|
||||
}
|
||||
|
||||
struct GPURenderingAPI GLInterfaceAPI = {
|
||||
Init,
|
||||
NULL,
|
||||
SetupGLInfo,
|
||||
|
||||
SetSpecialState,
|
||||
SetTransform,
|
||||
SetBlend,
|
||||
SetPalette,
|
||||
ClearBuffer,
|
||||
|
||||
DrawPolygon,
|
||||
DrawIndexedTriangles,
|
||||
Draw2DLine,
|
||||
DrawModel,
|
||||
RenderSkyDome,
|
||||
|
||||
SetTexture,
|
||||
UpdateTexture,
|
||||
DeleteTexture,
|
||||
|
||||
ClearMipMapCache,
|
||||
GetTextureUsed,
|
||||
|
||||
CreateModelVBOs,
|
||||
|
||||
ReadScreenTexture,
|
||||
GClipRect,
|
||||
|
||||
MakeScreenTexture,
|
||||
FlushScreenTextures,
|
||||
|
||||
DrawScreenTexture,
|
||||
DoScreenWipe,
|
||||
RenderVhsEffect,
|
||||
DrawScreenFinalTexture,
|
||||
|
||||
PostImgRedraw,
|
||||
|
||||
InitShaders,
|
||||
LoadShader,
|
||||
CompileShader,
|
||||
SetShader,
|
||||
UnSetShader,
|
||||
|
||||
SetShaderInfo,
|
||||
|
||||
SetPaletteLookup,
|
||||
CreateLightTable,
|
||||
ClearLightTables,
|
||||
SetScreenPalette,
|
||||
};
|
||||
|
||||
#endif //HWRENDER
|
||||
+1
-3
@@ -2132,9 +2132,7 @@ void I_StartupGraphics(void)
|
||||
#ifdef HWRENDER
|
||||
if (rendermode == render_opengl)
|
||||
{
|
||||
GPUInterface_Load(&GPU);
|
||||
|
||||
vid.glstate = (VID_LoadGPUAPI() && GPU->Init()) ? VID_GL_LIBRARY_LOADED : VID_GL_LIBRARY_ERROR;
|
||||
vid.glstate = (VID_LoadGPUAPI() && Init()) ? VID_GL_LIBRARY_LOADED : VID_GL_LIBRARY_ERROR;
|
||||
|
||||
if (vid.glstate == VID_GL_LIBRARY_ERROR)
|
||||
{
|
||||
|
||||
+3
-3
@@ -159,7 +159,7 @@ boolean OglSdlSurface(INT32 w, INT32 h)
|
||||
"- GPU drivers are missing or broken. You may need to update your drivers.");
|
||||
}
|
||||
|
||||
GPU->SetupGLInfo();
|
||||
SetupGLInfo();
|
||||
|
||||
SetupGLFunc4();
|
||||
|
||||
@@ -196,7 +196,7 @@ boolean OglSdlSurface(INT32 w, INT32 h)
|
||||
// The screen textures need to be flushed if the width or height change so that they be remade for the correct size
|
||||
if (screen_width != w || screen_height != h)
|
||||
{
|
||||
GPU->FlushScreenTextures();
|
||||
FlushScreenTextures();
|
||||
|
||||
#ifdef USE_FBO_OGL
|
||||
GLFramebuffer_DeleteAttachments();
|
||||
@@ -291,7 +291,7 @@ void OglSdlFinishUpdate(boolean waitvbl)
|
||||
|
||||
SDL_GL_SwapWindow(window);
|
||||
|
||||
GPU->GClipRect(0, 0, realwidth, realheight, NZCLIP_PLANE, FAR_ZCLIP_DEFAULT);
|
||||
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
|
||||
|
||||
Reference in new issue
Block a user