parent
ed5b67c399
commit
75483f92e8
21 changed files with 293 additions and 466 deletions
|
|
@ -86,7 +86,7 @@ void HWR_SetCurrentTexture(GLMipmap_t *texture)
|
|||
}
|
||||
else
|
||||
{
|
||||
HWD.pfnSetTexture(texture);
|
||||
GL_SetTexture(texture);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -141,8 +141,8 @@ void HWR_ProcessPolygon(FSurfaceInfo *pSurf, FOutVector *pOutVerts, FUINT iNumPt
|
|||
}
|
||||
else
|
||||
{
|
||||
HWD.pfnSetShader((shader_target != SHADER_NONE) ? HWR_GetShaderFromTarget(shader_target) : shader_target);
|
||||
HWD.pfnDrawPolygon(pSurf, pOutVerts, iNumPts, PolyFlags);
|
||||
GL_SetShader((shader_target != SHADER_NONE) ? HWR_GetShaderFromTarget(shader_target) : shader_target);
|
||||
GL_DrawPolygon(pSurf, pOutVerts, iNumPts, PolyFlags);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -320,7 +320,7 @@ void HWR_RenderBatches(void)
|
|||
|
||||
if (cv_glshaders.value && gl_shadersavailable)
|
||||
{
|
||||
HWD.pfnSetShader(currentShader);
|
||||
GL_SetShader(currentShader);
|
||||
}
|
||||
|
||||
if (currentPolyFlags & PF_NoTexture)
|
||||
|
|
@ -329,9 +329,9 @@ void HWR_RenderBatches(void)
|
|||
}
|
||||
else
|
||||
{
|
||||
HWD.pfnSetTexture(currentTexture);
|
||||
GL_SetTexture(currentTexture);
|
||||
if (currentBrightmap)
|
||||
HWD.pfnSetTexture(currentBrightmap);
|
||||
GL_SetTexture(currentBrightmap);
|
||||
}
|
||||
|
||||
while (1)// note: remember handling notexture polyflag as having texture number 0 (also in comparePolygons)
|
||||
|
|
@ -449,7 +449,7 @@ void HWR_RenderBatches(void)
|
|||
if (changeState || stopFlag)
|
||||
{
|
||||
// execute draw call
|
||||
HWD.pfnDrawIndexedTriangles(¤tSurfaceInfo, finalVertexArray, finalIndexWritePos, currentPolyFlags, finalVertexIndexArray);
|
||||
GL_DrawIndexedTriangles(¤tSurfaceInfo, finalVertexArray, finalIndexWritePos, currentPolyFlags, finalVertexIndexArray);
|
||||
// update stats
|
||||
ps_hw_numcalls++;
|
||||
ps_hw_numverts += finalIndexWritePos;
|
||||
|
|
@ -465,7 +465,7 @@ void HWR_RenderBatches(void)
|
|||
// change state according to change bools and next vars, update current vars and reset bools
|
||||
if (changeShader)
|
||||
{
|
||||
HWD.pfnSetShader(nextShader);
|
||||
GL_SetShader(nextShader);
|
||||
currentShader = nextShader;
|
||||
changeShader = false;
|
||||
|
||||
|
|
@ -474,11 +474,11 @@ void HWR_RenderBatches(void)
|
|||
if (changeTexture)
|
||||
{
|
||||
// texture should be already ready for use from calls to SetTexture during batch collection
|
||||
HWD.pfnSetTexture(nextTexture);
|
||||
GL_SetTexture(nextTexture);
|
||||
currentTexture = nextTexture;
|
||||
|
||||
if (nextBrightmap)
|
||||
HWD.pfnSetTexture(nextBrightmap);
|
||||
GL_SetTexture(nextBrightmap);
|
||||
currentBrightmap = nextBrightmap;
|
||||
|
||||
changeTexture = false;
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@
|
|||
|
||||
#include "hw_defs.h"
|
||||
#include "hw_data.h"
|
||||
#include "hw_drv.h"
|
||||
#include "hw_gpu.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@
|
|||
#ifdef HWRENDER
|
||||
#include "hw_main.h"
|
||||
#include "hw_glob.h"
|
||||
#include "hw_drv.h"
|
||||
#include "hw_gpu.h"
|
||||
#include "hw_batching.h"
|
||||
|
||||
#include "../doomstat.h" //gamemode
|
||||
|
|
@ -631,7 +631,7 @@ void HWR_FreeTextureData(patch_t *patch)
|
|||
grPatch = patch->hardware;
|
||||
|
||||
if (vid.glstate == VID_GL_LIBRARY_LOADED)
|
||||
HWD.pfnDeleteTexture(grPatch->mipmap);
|
||||
GL_DeleteTexture(grPatch->mipmap);
|
||||
if (grPatch->mipmap->data)
|
||||
Z_Free(grPatch->mipmap->data);
|
||||
}
|
||||
|
|
@ -699,7 +699,7 @@ void HWR_FreeTextureColormaps(patch_t *patch)
|
|||
Z_Free(next->colormap);
|
||||
next->data = NULL;
|
||||
next->colormap = NULL;
|
||||
HWD.pfnDeleteTexture(next);
|
||||
GL_DeleteTexture(next);
|
||||
|
||||
// Free the old colormap mipmap from memory.
|
||||
free(next);
|
||||
|
|
@ -734,7 +734,7 @@ static void HWR_FreePatchCache(boolean freeall)
|
|||
// free all textures after each level
|
||||
void HWR_ClearAllTextures(void)
|
||||
{
|
||||
HWD.pfnClearMipMapCache(); // free references to the textures
|
||||
GL_ClearMipMapCache(); // free references to the textures
|
||||
HWR_FreePatchCache(true);
|
||||
}
|
||||
|
||||
|
|
@ -751,7 +751,7 @@ void HWR_InitMapTextures(void)
|
|||
|
||||
static void FreeMapTexture(GLMapTexture_t *tex)
|
||||
{
|
||||
HWD.pfnDeleteTexture(&tex->mipmap);
|
||||
GL_DeleteTexture(&tex->mipmap);
|
||||
if (tex->mipmap.data)
|
||||
Z_Free(tex->mipmap.data);
|
||||
tex->mipmap.data = NULL;
|
||||
|
|
@ -1043,7 +1043,7 @@ GLMapTexture_t *HWR_GetTexture(INT32 tex, boolean noencoremap)
|
|||
|
||||
// If hardware does not have the texture, then call pfnSetTexture to upload it
|
||||
if (!grtex->mipmap.downloaded)
|
||||
HWD.pfnSetTexture(&grtex->mipmap);
|
||||
GL_SetTexture(&grtex->mipmap);
|
||||
HWR_SetCurrentTexture(&grtex->mipmap);
|
||||
|
||||
// The system-memory data can be purged now.
|
||||
|
|
@ -1067,7 +1067,7 @@ GLMapTexture_t *HWR_GetTexture(INT32 tex, boolean noencoremap)
|
|||
|
||||
// If hardware does not have the texture, then call pfnSetTexture to upload it
|
||||
if (!grtexbright->mipmap.downloaded)
|
||||
HWD.pfnSetTexture(&grtexbright->mipmap);
|
||||
GL_SetTexture(&grtexbright->mipmap);
|
||||
HWR_SetCurrentTexture(&grtexbright->mipmap);
|
||||
|
||||
// The system-memory data can be purged now.
|
||||
|
|
@ -1165,7 +1165,7 @@ void HWR_GetRawFlat(lumpnum_t flatlumpnum, boolean noencoremap)
|
|||
|
||||
// If hardware does not have the texture, then call pfnSetTexture to upload it
|
||||
if (!grmip->downloaded)
|
||||
HWD.pfnSetTexture(grmip);
|
||||
GL_SetTexture(grmip);
|
||||
HWR_SetCurrentTexture(grmip);
|
||||
|
||||
// The system-memory data can be purged now.
|
||||
|
|
@ -1221,7 +1221,7 @@ void HWR_GetLevelFlat(levelflat_t *levelflat, boolean noencoremap)
|
|||
}
|
||||
|
||||
if (!grMipmap->downloaded)
|
||||
HWD.pfnSetTexture(&grtex->mipmap);
|
||||
GL_SetTexture(&grtex->mipmap);
|
||||
|
||||
HWR_SetCurrentTexture(&grtex->mipmap);
|
||||
|
||||
|
|
@ -1247,7 +1247,7 @@ void HWR_GetLevelFlat(levelflat_t *levelflat, boolean noencoremap)
|
|||
grtex->mipmap.flags |= TF_BRIGHTMAP;
|
||||
|
||||
if (!grMipmap->downloaded)
|
||||
HWD.pfnSetTexture(&grtex->mipmap);
|
||||
GL_SetTexture(&grtex->mipmap);
|
||||
|
||||
HWR_SetCurrentTexture(&grtex->mipmap);
|
||||
|
||||
|
|
@ -1266,7 +1266,7 @@ static void HWR_LoadPatchMipmap(patch_t *patch, GLMipmap_t *grMipmap)
|
|||
|
||||
// If hardware does not have the texture, then call pfnSetTexture to upload it
|
||||
if (!grMipmap->downloaded)
|
||||
HWD.pfnSetTexture(grMipmap);
|
||||
GL_SetTexture(grMipmap);
|
||||
HWR_SetCurrentTexture(grMipmap);
|
||||
|
||||
// The system-memory data can be purged now.
|
||||
|
|
@ -1284,9 +1284,9 @@ static void HWR_UpdatePatchMipmap(patch_t *patch, GLMipmap_t *grMipmap)
|
|||
// If hardware does not have the texture, then call pfnSetTexture to upload it
|
||||
// If it does have the texture, then call pfnUpdateTexture to update it
|
||||
if (!grMipmap->downloaded)
|
||||
HWD.pfnSetTexture(grMipmap);
|
||||
GL_SetTexture(grMipmap);
|
||||
else
|
||||
HWD.pfnUpdateTexture(grMipmap);
|
||||
GL_UpdateTexture(grMipmap);
|
||||
HWR_SetCurrentTexture(grMipmap);
|
||||
|
||||
// The system-memory data can be purged now.
|
||||
|
|
@ -1494,7 +1494,7 @@ patch_t *HWR_GetPic(lumpnum_t lumpnum)
|
|||
grPatch->mipmap->flags = 0;
|
||||
grPatch->max_s = grPatch->max_t = 1.0f;
|
||||
}
|
||||
HWD.pfnSetTexture(grPatch->mipmap);
|
||||
GL_SetTexture(grPatch->mipmap);
|
||||
//CONS_Debug(DBG_RENDER, "picloaded at %x as texture %d\n",grPatch->mipmap->data, grPatch->mipmap->downloaded);
|
||||
|
||||
return patch;
|
||||
|
|
@ -1613,7 +1613,7 @@ void HWR_GetFadeMask(lumpnum_t fademasklumpnum)
|
|||
if (!grmip->downloaded && !grmip->data)
|
||||
HWR_CacheFadeMask(grmip, fademasklumpnum);
|
||||
|
||||
HWD.pfnSetTexture(grmip);
|
||||
GL_SetTexture(grmip);
|
||||
|
||||
// The system-memory data can be purged now.
|
||||
Z_ChangeTag(grmip->data, PU_HWRCACHE_UNLOCKED);
|
||||
|
|
@ -1649,11 +1649,11 @@ void HWR_SetPalette(RGBA_t *palette)
|
|||
crushed_palette[i].s.alpha = 255;
|
||||
}
|
||||
|
||||
HWD.pfnSetScreenPalette(crushed_palette);
|
||||
GL_SetScreenPalette(crushed_palette);
|
||||
}
|
||||
else
|
||||
{
|
||||
HWD.pfnSetScreenPalette(palette);
|
||||
GL_SetScreenPalette(palette);
|
||||
}
|
||||
|
||||
// this part is responsible for keeping track of the palette OUTSIDE of a level.
|
||||
|
|
@ -1663,7 +1663,7 @@ void HWR_SetPalette(RGBA_t *palette)
|
|||
else
|
||||
{
|
||||
// set the palette for the textures
|
||||
HWD.pfnSetTexturePalette(palette);
|
||||
GL_SetPalette(palette);
|
||||
// reset mapPalette so next call to HWR_SetMapPalette will update everything correctly
|
||||
memset(mapPalette, 0, sizeof(mapPalette));
|
||||
// hardware driver will flush there own cache if cache is non paletized
|
||||
|
|
@ -1695,7 +1695,7 @@ static void HWR_SetPaletteLookup(RGBA_t *palette)
|
|||
}
|
||||
}
|
||||
#undef STEP_SIZE
|
||||
HWD.pfnSetPaletteLookup(lut);
|
||||
GL_SetPaletteLookup(lut);
|
||||
Z_Free(lut);
|
||||
}
|
||||
|
||||
|
|
@ -1764,7 +1764,7 @@ void HWR_SetMapPalette(void)
|
|||
// in palette rendering mode, this means that all rgba textures now have wrong colors
|
||||
// and the lookup table is outdated
|
||||
HWR_SetPaletteLookup(mapPalette);
|
||||
HWD.pfnSetTexturePalette(mapPalette);
|
||||
GL_SetPalette(mapPalette);
|
||||
|
||||
if (patchformat == GL_TEXFMT_RGBA || textureformat == GL_TEXFMT_RGBA)
|
||||
{
|
||||
|
|
@ -1787,7 +1787,7 @@ UINT32 HWR_CreateLightTable(UINT8 *lighttable)
|
|||
for (i = 0; i < 256 * 32; i++)
|
||||
hw_lighttable[i] = palette[lighttable[i]];
|
||||
|
||||
id = HWD.pfnCreateLightTable(hw_lighttable);
|
||||
id = GL_CreateLightTable(hw_lighttable);
|
||||
Z_Free(hw_lighttable);
|
||||
return id;
|
||||
}
|
||||
|
|
@ -1823,7 +1823,7 @@ UINT32 HWR_GetLightTableID(extracolormap_t *colormap)
|
|||
void HWR_ClearLightTables(void)
|
||||
{
|
||||
if (vid.glstate == VID_GL_LIBRARY_LOADED)
|
||||
HWD.pfnClearLightTables();
|
||||
GL_ClearLightTables();
|
||||
}
|
||||
|
||||
#endif //HWRENDER
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@
|
|||
#ifdef HWRENDER
|
||||
#include "hw_main.h"
|
||||
#include "hw_glob.h"
|
||||
#include "hw_drv.h"
|
||||
#include "hw_gpu.h"
|
||||
|
||||
#include "../r_draw.h" //viewborderlump
|
||||
#include "../r_main.h"
|
||||
|
|
@ -259,10 +259,10 @@ void HWR_DrawStretchyFixedPatch(patch_t *gpatch, fixed_t x, fixed_t y, fixed_t p
|
|||
else
|
||||
Surf.PolyColor.s.alpha = 0;
|
||||
|
||||
HWD.pfnDrawPolygon(&Surf, v, 4, flags|PF_Modulated);
|
||||
GL_DrawPolygon(&Surf, v, 4, flags|PF_Modulated);
|
||||
}
|
||||
else
|
||||
HWD.pfnDrawPolygon(NULL, v, 4, flags|PF_Translucent);
|
||||
GL_DrawPolygon(NULL, v, 4, flags|PF_Translucent);
|
||||
}
|
||||
|
||||
void HWR_DrawAffinePatch(patch_t *gpatch, fixed_t x, fixed_t y, const affine_t *transform, INT32 option, const UINT8 *colormap)
|
||||
|
|
@ -384,10 +384,10 @@ void HWR_DrawAffinePatch(patch_t *gpatch, fixed_t x, fixed_t y, const affine_t *
|
|||
else
|
||||
Surf.PolyColor.s.alpha = 0;
|
||||
|
||||
HWD.pfnDrawPolygon(&Surf, v, 4, flags|PF_Modulated);
|
||||
GL_DrawPolygon(&Surf, v, 4, flags|PF_Modulated);
|
||||
}
|
||||
else
|
||||
HWD.pfnDrawPolygon(NULL, v, 4, flags|PF_Translucent);
|
||||
GL_DrawPolygon(NULL, v, 4, flags|PF_Translucent);
|
||||
}
|
||||
|
||||
void HWR_DrawCroppedPatch(patch_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)
|
||||
|
|
@ -540,10 +540,10 @@ void HWR_DrawCroppedPatch(patch_t *gpatch, fixed_t x, fixed_t y, fixed_t pscale,
|
|||
else
|
||||
Surf.PolyColor.s.alpha = 0;
|
||||
|
||||
HWD.pfnDrawPolygon(&Surf, v, 4, flags|PF_Modulated);
|
||||
GL_DrawPolygon(&Surf, v, 4, flags|PF_Modulated);
|
||||
}
|
||||
else
|
||||
HWD.pfnDrawPolygon(NULL, v, 4, flags|PF_Translucent);
|
||||
GL_DrawPolygon(NULL, v, 4, flags|PF_Translucent);
|
||||
}
|
||||
|
||||
void HWR_DrawPic(INT32 x, INT32 y, lumpnum_t lumpnum)
|
||||
|
|
@ -578,7 +578,7 @@ void HWR_DrawPic(INT32 x, INT32 y, lumpnum_t lumpnum)
|
|||
// But then, the question is: why not 0 instead of PF_Masked ?
|
||||
// or maybe PF_Environment ??? (like what I said above)
|
||||
// BP: PF_Environment don't change anything ! and 0 is undifined
|
||||
HWD.pfnDrawPolygon(NULL, v, 4, PF_Translucent | PF_NoDepthTest);
|
||||
GL_DrawPolygon(NULL, v, 4, PF_Translucent | PF_NoDepthTest);
|
||||
}
|
||||
|
||||
// ==========================================================================
|
||||
|
|
@ -630,7 +630,7 @@ void HWR_DrawFlatFill(INT32 x, INT32 y, INT32 w, INT32 h, lumpnum_t flatlumpnum)
|
|||
// BTW, I see we put 0 for PFs, and If I'm right, that
|
||||
// means we take the previous PFs as default
|
||||
// how can we be sure they are ok?
|
||||
HWD.pfnDrawPolygon(NULL, v, 4, PF_NoDepthTest); //PF_Translucent);
|
||||
GL_DrawPolygon(NULL, v, 4, PF_NoDepthTest); //PF_Translucent);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -665,10 +665,10 @@ void HWR_FadeScreenMenuBack(UINT16 color, UINT8 strength)
|
|||
|
||||
Surf.LightTableId = HWR_GetLightTableID(NULL);
|
||||
Surf.LightInfo.light_level = strength;
|
||||
HWD.pfnMakeScreenTexture(scr_tex);
|
||||
HWD.pfnSetShader(HWR_GetShaderFromTarget(SHADER_UI_COLORMAP_FADE));
|
||||
HWD.pfnDrawScreenTexture(scr_tex, &Surf, PF_ColorMapped|PF_NoDepthTest);
|
||||
HWD.pfnUnSetShader();
|
||||
GL_MakeScreenTexture(scr_tex);
|
||||
GL_SetShader(HWR_GetShaderFromTarget(SHADER_UI_COLORMAP_FADE));
|
||||
GL_DrawScreenTexture(scr_tex, &Surf, PF_ColorMapped|PF_NoDepthTest);
|
||||
GL_UnSetShader();
|
||||
|
||||
return;
|
||||
}
|
||||
|
|
@ -681,7 +681,7 @@ void HWR_FadeScreenMenuBack(UINT16 color, UINT8 strength)
|
|||
Surf.PolyColor.rgba = palette[color&0xFF].rgba;
|
||||
Surf.PolyColor.s.alpha = softwaretranstogl[strength];
|
||||
}
|
||||
HWD.pfnDrawPolygon(&Surf, v, 4, PF_NoTexture|PF_Modulated|PF_Translucent|PF_NoDepthTest);
|
||||
GL_DrawPolygon(&Surf, v, 4, PF_NoTexture|PF_Modulated|PF_Translucent|PF_NoDepthTest);
|
||||
}
|
||||
|
||||
// -----------------+
|
||||
|
|
@ -763,7 +763,7 @@ void HWR_DrawFadeFill(INT32 x, INT32 y, INT32 w, INT32 h, INT32 color, UINT16 ac
|
|||
Surf.PolyColor.rgba = palette[actualcolor&0xFF].rgba;
|
||||
Surf.PolyColor.s.alpha = softwaretranstogl[strength];
|
||||
}
|
||||
HWD.pfnDrawPolygon(&Surf, v, 4, PF_NoTexture|PF_Modulated|PF_Translucent|PF_NoDepthTest);
|
||||
GL_DrawPolygon(&Surf, v, 4, PF_NoTexture|PF_Modulated|PF_Translucent|PF_NoDepthTest);
|
||||
}
|
||||
|
||||
// Draw the console background with translucency support
|
||||
|
|
@ -790,7 +790,7 @@ void HWR_DrawConsoleBack(UINT32 color, INT32 height)
|
|||
Surf.PolyColor.rgba = UINT2RGBA(color);
|
||||
Surf.PolyColor.s.alpha = 0x80;
|
||||
|
||||
HWD.pfnDrawPolygon(&Surf, v, 4, PF_NoTexture|PF_Modulated|PF_Translucent|PF_NoDepthTest);
|
||||
GL_DrawPolygon(&Surf, v, 4, PF_NoTexture|PF_Modulated|PF_Translucent|PF_NoDepthTest);
|
||||
}
|
||||
|
||||
void HWR_EncoreInvertScreen(void)
|
||||
|
|
@ -811,7 +811,7 @@ void HWR_EncoreInvertScreen(void)
|
|||
|
||||
Surf.PolyColor.rgba = 0xFFFFFFFF;
|
||||
|
||||
HWD.pfnDrawPolygon(&Surf, v, 4, PF_NoTexture|PF_NoDepthTest);
|
||||
GL_DrawPolygon(&Surf, v, 4, PF_NoTexture|PF_NoDepthTest);
|
||||
}
|
||||
|
||||
// Very similar to HWR_DrawConsoleBack, except we draw from the middle(-ish) of the screen to the bottom.
|
||||
|
|
@ -841,7 +841,7 @@ void HWR_DrawTutorialBack(UINT32 color, INT32 boxheight)
|
|||
Surf.PolyColor.rgba = UINT2RGBA(color);
|
||||
Surf.PolyColor.s.alpha = (color == 0 ? 0xC0 : 0x80); // make black darker, like software
|
||||
|
||||
HWD.pfnDrawPolygon(&Surf, v, 4, PF_NoTexture|PF_Modulated|PF_Translucent|PF_NoDepthTest);
|
||||
GL_DrawPolygon(&Surf, v, 4, PF_NoTexture|PF_Modulated|PF_Translucent|PF_NoDepthTest);
|
||||
}
|
||||
|
||||
// ==========================================================================
|
||||
|
|
@ -866,7 +866,7 @@ void HWR_drawAMline(const fline_t *fl, INT32 color)
|
|||
v2.x = ((float)fl->b.x-(vid.width/2.0f))*(2.0f/vid.width);
|
||||
v2.y = ((float)fl->b.y-(vid.height/2.0f))*(2.0f/vid.height);
|
||||
|
||||
HWD.pfnDraw2DLine(&v1, &v2, color_rgba);
|
||||
GL_Draw2DLine(&v1, &v2, color_rgba);
|
||||
}
|
||||
|
||||
// -----------------+
|
||||
|
|
@ -959,7 +959,7 @@ void HWR_DrawDiag(INT32 x, INT32 y, INT32 wh, INT32 color)
|
|||
|
||||
Surf.PolyColor = V_GetColor(color);
|
||||
|
||||
HWD.pfnDrawPolygon(&Surf, v, 4,
|
||||
GL_DrawPolygon(&Surf, v, 4,
|
||||
PF_Modulated|PF_NoTexture|PF_NoDepthTest);
|
||||
}
|
||||
|
||||
|
|
@ -1039,7 +1039,7 @@ void HWR_DrawConsoleFill(INT32 x, INT32 y, INT32 w, INT32 h, INT32 color, UINT32
|
|||
Surf.PolyColor.rgba = UINT2RGBA(actualcolor);
|
||||
Surf.PolyColor.s.alpha = 0x80;
|
||||
|
||||
HWD.pfnDrawPolygon(&Surf, v, 4, PF_NoTexture|PF_Modulated|PF_Translucent|PF_NoDepthTest);
|
||||
GL_DrawPolygon(&Surf, v, 4, PF_NoTexture|PF_Modulated|PF_Translucent|PF_NoDepthTest);
|
||||
}
|
||||
|
||||
// -----------------+
|
||||
|
|
@ -1075,7 +1075,7 @@ void HWR_DrawFill(INT32 x, INT32 y, INT32 w, INT32 h, INT32 color)
|
|||
clearColour.green = (float)rgbaColour.s.green / 255;
|
||||
clearColour.blue = (float)rgbaColour.s.blue / 255;
|
||||
clearColour.alpha = 1;
|
||||
HWD.pfnClearBuffer(true, false, &clearColour);
|
||||
GL_ClearBuffer(true, false, &clearColour);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
@ -1110,7 +1110,7 @@ void HWR_DrawFill(INT32 x, INT32 y, INT32 w, INT32 h, INT32 color)
|
|||
else Surf.PolyColor.s.alpha = 0;
|
||||
}
|
||||
|
||||
HWD.pfnDrawPolygon(&Surf, v, 4,
|
||||
GL_DrawPolygon(&Surf, v, 4,
|
||||
flags);
|
||||
}
|
||||
|
||||
|
|
@ -1194,7 +1194,7 @@ UINT8 *HWR_GetScreenshot(INT32 scale)
|
|||
return NULL;
|
||||
|
||||
// returns 24bit 888 RGB
|
||||
HWD.pfnReadScreenTexture(tex, (void *)buf, scale);
|
||||
GL_ReadScreenTexture(tex, (void *)buf, scale);
|
||||
return buf;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,146 +0,0 @@
|
|||
// BLANKART
|
||||
//-----------------------------------------------------------------------------
|
||||
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
||||
// Copyright (C) 1999-2020 by Sonic Team Junior.
|
||||
//
|
||||
// This program is free software distributed under the
|
||||
// terms of the GNU General Public License, version 2.
|
||||
// See the 'LICENSE' file for more details.
|
||||
//-----------------------------------------------------------------------------
|
||||
/// \file hw_drv.h
|
||||
/// \brief imports/exports for the 3D hardware low-level interface API
|
||||
|
||||
#ifndef __HWR_DRV_H__
|
||||
#define __HWR_DRV_H__
|
||||
|
||||
// this must be here 19991024 by Kin
|
||||
#include "../screen.h"
|
||||
#include "hw_data.h"
|
||||
#include "hw_defs.h"
|
||||
#include "hw_md2.h"
|
||||
|
||||
#include "hw_dll.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
// ==========================================================================
|
||||
// STANDARD DLL EXPORTS
|
||||
// ==========================================================================
|
||||
|
||||
EXPORT boolean HWRAPI(Init) (void);
|
||||
#ifndef HAVE_SDL
|
||||
EXPORT void HWRAPI(Shutdown) (void);
|
||||
#endif
|
||||
EXPORT void HWRAPI(SetTexturePalette) (RGBA_t *ppal);
|
||||
EXPORT void HWRAPI(FinishUpdate) (INT32 waitvbl);
|
||||
EXPORT void HWRAPI(Draw2DLine) (F2DCoord *v1, F2DCoord *v2, RGBA_t Color);
|
||||
EXPORT void HWRAPI(DrawPolygon) (FSurfaceInfo *pSurf, FOutVector *pOutVerts, FUINT iNumPts, FBITFIELD PolyFlags);
|
||||
EXPORT void HWRAPI(DrawIndexedTriangles) (FSurfaceInfo *pSurf, FOutVector *pOutVerts, FUINT iNumPts, FBITFIELD PolyFlags, UINT32 *IndexArray);
|
||||
EXPORT void HWRAPI(RenderSkyDome) (gl_sky_t *sky);
|
||||
EXPORT void HWRAPI(SetBlend) (FBITFIELD PolyFlags);
|
||||
EXPORT void HWRAPI(ClearBuffer) (FBOOLEAN ColorMask, FBOOLEAN DepthMask, FRGBAFloat *ClearColor);
|
||||
EXPORT void HWRAPI(SetTexture) (GLMipmap_t *TexInfo);
|
||||
EXPORT void HWRAPI(UpdateTexture) (GLMipmap_t *TexInfo);
|
||||
EXPORT void HWRAPI(DeleteTexture) (GLMipmap_t *TexInfo);
|
||||
EXPORT void HWRAPI(ReadScreenTexture) (int tex, UINT8 *restrict dest, INT32 scale);
|
||||
EXPORT void HWRAPI(GClipRect) (INT32 minx, INT32 miny, INT32 maxx, INT32 maxy, float nearclip);
|
||||
EXPORT void HWRAPI(ClearMipMapCache) (void);
|
||||
|
||||
//Hurdler: added for backward compatibility
|
||||
EXPORT void HWRAPI(SetSpecialState) (hwdspecialstate_t IdState, INT32 Value);
|
||||
|
||||
//Hurdler: added for new development
|
||||
EXPORT void HWRAPI(DrawModel) (model_t *model, INT32 frameIndex, float duration, float tics, INT32 nextFrameIndex, FTransform *pos, float hscale, float vscale, UINT8 flipped, UINT8 hflipped, FSurfaceInfo *Surface);
|
||||
EXPORT void HWRAPI(CreateModelVBOs) (model_t *model);
|
||||
EXPORT void HWRAPI(SetTransform) (FTransform *stransform);
|
||||
EXPORT INT32 HWRAPI(GetTextureUsed) (void);
|
||||
|
||||
EXPORT void HWRAPI(FlushScreenTextures) (void);
|
||||
EXPORT void HWRAPI(DoScreenWipe) (int wipeStart, int wipeEnd);
|
||||
EXPORT void HWRAPI(DrawScreenTexture) (int tex, FSurfaceInfo *surf, FBITFIELD polyflags);
|
||||
EXPORT void HWRAPI(RenderVhsEffect) (INT16 upbary, INT16 downbary, UINT8 updistort, UINT8 downdistort, UINT8 barsize);
|
||||
EXPORT void HWRAPI(MakeScreenTexture) (int tex);
|
||||
EXPORT void HWRAPI(DrawScreenFinalTexture) (int tex, int width, int height);
|
||||
|
||||
#define SCREENVERTS 10
|
||||
EXPORT void HWRAPI(PostImgRedraw) (float points[SCREENVERTS][SCREENVERTS][2]);
|
||||
|
||||
EXPORT boolean HWRAPI(InitShaders) (void);
|
||||
EXPORT void HWRAPI(LoadShader) (int slot, char *code, hwdshaderstage_t stage);
|
||||
EXPORT boolean HWRAPI(CompileShader) (int slot);
|
||||
EXPORT void HWRAPI(SetShader) (int slot);
|
||||
EXPORT void HWRAPI(UnSetShader) (void);
|
||||
|
||||
EXPORT void HWRAPI(SetShaderInfo) (hwdshaderinfo_t info, INT32 value);
|
||||
|
||||
EXPORT void HWRAPI(SetPaletteLookup)(UINT8 *lut);
|
||||
EXPORT UINT32 HWRAPI(CreateLightTable)(RGBA_t *hw_lighttable);
|
||||
EXPORT void HWRAPI(ClearLightTables)(void);
|
||||
EXPORT void HWRAPI(SetScreenPalette)(RGBA_t *palette);
|
||||
|
||||
// ==========================================================================
|
||||
// HWR DRIVER OBJECT, FOR CLIENT PROGRAM
|
||||
// ==========================================================================
|
||||
|
||||
#if !defined (_CREATE_DLL_)
|
||||
|
||||
struct hwdriver_s
|
||||
{
|
||||
Init pfnInit;
|
||||
SetTexturePalette pfnSetTexturePalette;
|
||||
FinishUpdate pfnFinishUpdate;
|
||||
Draw2DLine pfnDraw2DLine;
|
||||
DrawPolygon pfnDrawPolygon;
|
||||
DrawIndexedTriangles pfnDrawIndexedTriangles;
|
||||
RenderSkyDome pfnRenderSkyDome;
|
||||
SetBlend pfnSetBlend;
|
||||
ClearBuffer pfnClearBuffer;
|
||||
SetTexture pfnSetTexture;
|
||||
UpdateTexture pfnUpdateTexture;
|
||||
DeleteTexture pfnDeleteTexture;
|
||||
ReadScreenTexture pfnReadScreenTexture;
|
||||
GClipRect pfnGClipRect;
|
||||
ClearMipMapCache pfnClearMipMapCache;
|
||||
SetSpecialState pfnSetSpecialState;
|
||||
DrawModel pfnDrawModel;
|
||||
CreateModelVBOs pfnCreateModelVBOs;
|
||||
SetTransform pfnSetTransform;
|
||||
GetTextureUsed pfnGetTextureUsed;
|
||||
#ifndef HAVE_SDL
|
||||
Shutdown pfnShutdown;
|
||||
#endif
|
||||
PostImgRedraw pfnPostImgRedraw;
|
||||
FlushScreenTextures pfnFlushScreenTextures;
|
||||
DoScreenWipe pfnDoScreenWipe;
|
||||
RenderVhsEffect pfnRenderVhsEffect;
|
||||
DrawScreenTexture pfnDrawScreenTexture;
|
||||
MakeScreenTexture pfnMakeScreenTexture;
|
||||
DrawScreenFinalTexture pfnDrawScreenFinalTexture;
|
||||
|
||||
InitShaders pfnInitShaders;
|
||||
LoadShader pfnLoadShader;
|
||||
CompileShader pfnCompileShader;
|
||||
SetShader pfnSetShader;
|
||||
UnSetShader pfnUnSetShader;
|
||||
|
||||
SetShaderInfo pfnSetShaderInfo;
|
||||
|
||||
SetPaletteLookup pfnSetPaletteLookup;
|
||||
CreateLightTable pfnCreateLightTable;
|
||||
ClearLightTables pfnClearLightTables;
|
||||
SetScreenPalette pfnSetScreenPalette;
|
||||
};
|
||||
|
||||
extern struct hwdriver_s hwdriver;
|
||||
|
||||
#define HWD hwdriver
|
||||
|
||||
#endif //not defined _CREATE_DLL_
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
#endif
|
||||
|
||||
#endif //__HWR_DRV_H__
|
||||
78
src/hardware/hw_gpu.h
Normal file
78
src/hardware/hw_gpu.h
Normal file
|
|
@ -0,0 +1,78 @@
|
|||
// SONIC ROBO BLAST 2
|
||||
//-----------------------------------------------------------------------------
|
||||
// Copyright (C) 2020 by Jaime "Lactozilla" Passos.
|
||||
// Copyright (C) 2020 by Sonic Team Junior.
|
||||
//
|
||||
// This program is free software distributed under the
|
||||
// terms of the GNU General Public License, version 2.
|
||||
// See the 'LICENSE' file for more details.
|
||||
//-----------------------------------------------------------------------------
|
||||
/// \file hw_gpu.h
|
||||
/// \brief GPU low-level interface API
|
||||
|
||||
#ifndef __HWR_GPU_H__
|
||||
#define __HWR_GPU_H__
|
||||
|
||||
#include "../screen.h"
|
||||
|
||||
#include "hw_data.h"
|
||||
#include "hw_defs.h"
|
||||
#include "hw_md2.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
boolean GL_Init(void);
|
||||
void GL_SetPalette(RGBA_t *palette);
|
||||
void GL_FinishUpdate(INT32 waitvbl);
|
||||
void GL_Draw2DLine(F2DCoord *v1, F2DCoord *v2, RGBA_t Color);
|
||||
void GL_DrawPolygon(FSurfaceInfo *pSurf, FOutVector *pOutVerts, FUINT iNumPts, FBITFIELD PolyFlags);
|
||||
void GL_DrawIndexedTriangles(FSurfaceInfo *pSurf, FOutVector *pOutVerts, FUINT iNumPts, FBITFIELD PolyFlags, UINT32 *IndexArray);
|
||||
void GL_RenderSkyDome(gl_sky_t *sky);
|
||||
void GL_SetBlend(FBITFIELD PolyFlags);
|
||||
void GL_ClearBuffer(FBOOLEAN ColorMask, FBOOLEAN DepthMask, FRGBAFloat *ClearColor);
|
||||
void GL_SetTexture(GLMipmap_t *pTexInfo);
|
||||
void GL_UpdateTexture(GLMipmap_t *pTexInfo);
|
||||
void GL_DeleteTexture(GLMipmap_t *pTexInfo);
|
||||
void GL_ReadScreenTexture(int tex, UINT8 *restrict dest, INT32 scale);
|
||||
void GL_GClipRect(INT32 minx, INT32 miny, INT32 maxx, INT32 maxy, float nearclip);
|
||||
void GL_ClearMipMapCache(void);
|
||||
|
||||
void GL_SetSpecialState(hwdspecialstate_t IdState, INT32 Value);
|
||||
|
||||
// Hurdler: added for new development
|
||||
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_CreateModelVBOs(model_t *model);
|
||||
void GL_SetTransform(FTransform *ptransform);
|
||||
INT32 GL_GetTextureUsed(void);
|
||||
|
||||
void GL_FlushScreenTextures(void);
|
||||
void GL_DoScreenWipe(int wipeStart, int wipeEnd);
|
||||
void GL_DrawScreenTexture(int tex, FSurfaceInfo *surf, FBITFIELD polyflags);
|
||||
void GL_MakeScreenTexture(int tex);
|
||||
void GL_RenderVhsEffect(INT16 upbary, INT16 downbary, UINT8 updistort, UINT8 downdistort, UINT8 barsize);
|
||||
void GL_DrawScreenFinalTexture(int tex, int width, int height);
|
||||
|
||||
#define SCREENVERTS 10
|
||||
void GL_PostImgRedraw(float points[SCREENVERTS][SCREENVERTS][2]);
|
||||
|
||||
boolean GL_InitShaders(void);
|
||||
void GL_LoadShader(int slot, char *code, hwdshaderstage_t stage);
|
||||
boolean GL_CompileShader(int slot);
|
||||
void GL_SetShader(int slot);
|
||||
void GL_UnSetShader(void);
|
||||
|
||||
void GL_SetShaderInfo(hwdshaderinfo_t info, INT32 value);
|
||||
|
||||
void GL_SetPaletteLookup(UINT8 *lut);
|
||||
UINT32 GL_CreateLightTable(RGBA_t *hw_lighttable);
|
||||
void GL_UpdateLightTable(UINT32 id, RGBA_t *hw_lighttable);
|
||||
void GL_ClearLightTables(void);
|
||||
void GL_SetScreenPalette(RGBA_t *palette);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
#endif
|
||||
|
||||
#endif //__HWR_GPU_H__
|
||||
|
|
@ -15,7 +15,7 @@
|
|||
|
||||
#ifdef HWRENDER
|
||||
#include "hw_light.h"
|
||||
#include "hw_drv.h"
|
||||
#include "hw_gpu.h"
|
||||
#include "../i_video.h"
|
||||
#include "../z_zone.h"
|
||||
#include "../m_random.h"
|
||||
|
|
@ -881,7 +881,7 @@ void HWR_WallLighting(FOutVector *wlVerts)
|
|||
if (dynlights->mo[j]->state->nextstate == S_NULL)
|
||||
Surf.PolyColor.s.alpha = (UINT8)(((float)dynlights->mo[j]->tics/(float)dynlights->mo[j]->state->tics)*Surf.PolyColor.s.alpha);
|
||||
|
||||
HWD.pfnDrawPolygon (&Surf, wlVerts, 4, LIGHTMAPFLAGS);
|
||||
GL_DrawPolygon (&Surf, wlVerts, 4, LIGHTMAPFLAGS);
|
||||
|
||||
} // end for (j = 0; j < dynlights->nb; j++)
|
||||
}
|
||||
|
|
@ -950,7 +950,7 @@ void HWR_PlaneLighting(FOutVector *clVerts, int nrClipVerts)
|
|||
if ((dynlights->mo[j]->state->nextstate == S_NULL))
|
||||
Surf.PolyColor.s.alpha = (unsigned char)(((float)dynlights->mo[j]->tics/(float)dynlights->mo[j]->state->tics)*Surf.PolyColor.s.alpha);
|
||||
|
||||
HWD.pfnDrawPolygon (&Surf, clVerts, nrClipVerts, LIGHTMAPFLAGS);
|
||||
GL_DrawPolygon (&Surf, clVerts, nrClipVerts, LIGHTMAPFLAGS);
|
||||
|
||||
} // end for (j = 0; j < dynlights->nb; j++)
|
||||
}
|
||||
|
|
@ -1047,7 +1047,7 @@ void HWR_DoCoronasLighting(FOutVector *outVerts, gl_vissprite_t *spr)
|
|||
|
||||
HWR_GetPic(coronalumpnum); /// \todo use different coronas
|
||||
|
||||
HWD.pfnDrawPolygon (&Surf, light, 4, PF_Modulated | PF_Additive | PF_Corona | PF_NoDepthTest);
|
||||
GL_DrawPolygon (&Surf, light, 4, PF_Modulated | PF_Additive | PF_Corona | PF_NoDepthTest);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
@ -1135,7 +1135,7 @@ void HWR_DrawCoronas(void)
|
|||
light[3].y = cy+size*1.33f;
|
||||
light[3].s = 0.0f; light[3].t = 1.0f;
|
||||
|
||||
HWD.pfnDrawPolygon (&Surf, light, 4, PF_Modulated | PF_Additive | PF_NoDepthTest | PF_Corona);
|
||||
GL_DrawPolygon (&Surf, light, 4, PF_Modulated | PF_Additive | PF_NoDepthTest | PF_Corona);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
@ -1244,7 +1244,7 @@ static void HWR_SetLight(void)
|
|||
lightmappatch.mipmap->height = 128;
|
||||
lightmappatch.mipmap->flags = 0; //TF_WRAPXY; // DEBUG: view the overdraw !
|
||||
}
|
||||
HWD.pfnSetTexture(lightmappatch.mipmap);
|
||||
GL_SetTexture(lightmappatch.mipmap);
|
||||
|
||||
// The system-memory data can be purged now.
|
||||
Z_ChangeTag(lightmappatch.mipmap->data, PU_HWRCACHE_UNLOCKED);
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@
|
|||
#include "hw_clip.h"
|
||||
#include "hw_glob.h"
|
||||
#include "hw_light.h"
|
||||
#include "hw_drv.h"
|
||||
#include "hw_gpu.h"
|
||||
#include "hw_batching.h"
|
||||
|
||||
#include "../i_video.h" // for rendermode == render_glide
|
||||
|
|
@ -59,7 +59,6 @@
|
|||
// ==========================================================================
|
||||
// the hardware driver object
|
||||
// ==========================================================================
|
||||
struct hwdriver_s hwdriver;
|
||||
|
||||
// ==========================================================================
|
||||
// PROTOS
|
||||
|
|
@ -4562,7 +4561,7 @@ static void HWR_CreateDrawNodes(void)
|
|||
ps_hw_nodedrawtime = I_GetPreciseTime();
|
||||
|
||||
// Okay! Let's draw it all! Woo!
|
||||
HWD.pfnSetTransform(&atransform);
|
||||
GL_SetTransform(&atransform);
|
||||
|
||||
for (i = 0; i < p; i++)
|
||||
{
|
||||
|
|
@ -4617,9 +4616,9 @@ static void HWR_DrawSprites(void)
|
|||
boolean skipshadow = false; // skip shadow if it was drawn already for a linkdraw sprite encountered earlier in the list
|
||||
|
||||
#ifdef BAD_MODEL_OPTIONS
|
||||
HWD.pfnSetSpecialState(HWD_SET_MODEL_LIGHTING, cv_glmodellighting.value);
|
||||
GL_SetSpecialState(HWD_SET_MODEL_LIGHTING, cv_glmodellighting.value);
|
||||
#else
|
||||
HWD.pfnSetSpecialState(HWD_SET_MODEL_LIGHTING, 1);
|
||||
GL_SetSpecialState(HWD_SET_MODEL_LIGHTING, 1);
|
||||
#endif
|
||||
|
||||
for (i = 0; i < gl_visspritecount; i++)
|
||||
|
|
@ -4682,7 +4681,7 @@ static void HWR_DrawSprites(void)
|
|||
}
|
||||
}
|
||||
}
|
||||
HWD.pfnSetSpecialState(HWD_SET_MODEL_LIGHTING, 0);
|
||||
GL_SetSpecialState(HWD_SET_MODEL_LIGHTING, 0);
|
||||
|
||||
// At the end of sprite drawing, draw shapes of linkdraw sprites to z-buffer, so they
|
||||
// don't get drawn over by transparent surfaces.
|
||||
|
|
@ -4692,7 +4691,7 @@ static void HWR_DrawSprites(void)
|
|||
// (Other states probably don't matter. Here I left them same as in LinkDrawHackFinish)
|
||||
// Without this workaround the rest of the draw calls in this frame (including UI, screen texture)
|
||||
// can get drawn using an incorrect glBlendFunc, resulting in a occasional black screen.
|
||||
HWD.pfnSetBlend(PF_Translucent|PF_Occlude|PF_Masked);
|
||||
GL_SetBlend(PF_Translucent|PF_Occlude|PF_Masked);
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
|
|
@ -5640,7 +5639,7 @@ static void HWR_DrawSkyBackground(player_t *player)
|
|||
{
|
||||
UINT8 viewnum = R_GetViewNumber();
|
||||
camera_t *thiscam = &camera[viewnum];
|
||||
HWD.pfnSetBlend(PF_Translucent|PF_NoDepthTest|PF_Modulated);
|
||||
GL_SetBlend(PF_Translucent|PF_NoDepthTest|PF_Modulated);
|
||||
|
||||
if (cv_glskydome.value)
|
||||
{
|
||||
|
|
@ -5683,10 +5682,10 @@ static void HWR_DrawSkyBackground(player_t *player)
|
|||
}
|
||||
|
||||
if (HWR_UseShader())
|
||||
HWD.pfnSetShader(HWR_GetShaderFromTarget(SHADER_SKY));
|
||||
GL_SetShader(HWR_GetShaderFromTarget(SHADER_SKY));
|
||||
|
||||
HWD.pfnSetTransform(&dometransform);
|
||||
HWD.pfnRenderSkyDome(&gl_sky);
|
||||
GL_SetTransform(&dometransform);
|
||||
GL_RenderSkyDome(&gl_sky);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -5767,8 +5766,8 @@ static void HWR_DrawSkyBackground(player_t *player)
|
|||
v[0].t = v[1].t -= ((float) angle / angleturn);
|
||||
}
|
||||
|
||||
HWD.pfnUnSetShader();
|
||||
HWD.pfnDrawPolygon(NULL, v, 4, 0);
|
||||
GL_UnSetShader();
|
||||
GL_DrawPolygon(NULL, v, 4, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -5785,16 +5784,16 @@ static inline void HWR_ClearView(void)
|
|||
|
||||
/// \bug faB - enable depth mask, disable color mask
|
||||
|
||||
HWD.pfnGClipRect((INT32)gl_viewwindowx,
|
||||
GL_GClipRect((INT32)gl_viewwindowx,
|
||||
(INT32)gl_viewwindowy,
|
||||
(INT32)(gl_viewwindowx + gl_viewwidth),
|
||||
(INT32)(gl_viewwindowy + gl_viewheight),
|
||||
ZCLIP_PLANE);
|
||||
HWD.pfnClearBuffer(false, true, 0);
|
||||
GL_ClearBuffer(false, true, 0);
|
||||
|
||||
//disable clip window - set to full size
|
||||
// rem by Hurdler
|
||||
// HWD.pfnGClipRect(0, 0, vid.width, vid.height);
|
||||
// GL_GClipRect(0, 0, vid.width, vid.height);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -5829,7 +5828,7 @@ void HWR_SetViewSize(void)
|
|||
gl_pspritexscale = gl_viewwidth / BASEVIDWIDTH;
|
||||
gl_pspriteyscale = ((vid.height*gl_pspritexscale*BASEVIDWIDTH)/BASEVIDHEIGHT)/vid.width;
|
||||
|
||||
HWD.pfnFlushScreenTextures();
|
||||
GL_FlushScreenTextures();
|
||||
}
|
||||
|
||||
// -------------------+
|
||||
|
|
@ -5885,7 +5884,7 @@ static void HWR_SetTransformAiming(FTransform *trans, player_t *player, boolean
|
|||
//
|
||||
static void HWR_SetShaderState(void)
|
||||
{
|
||||
HWD.pfnSetSpecialState(HWD_SET_SHADERS, (INT32)HWR_UseShader());
|
||||
GL_SetSpecialState(HWD_SET_SHADERS, (INT32)HWR_UseShader());
|
||||
}
|
||||
|
||||
static void HWR_ClearClipper(void)
|
||||
|
|
@ -5987,7 +5986,7 @@ void HWR_RenderSkyboxView(player_t *player)
|
|||
|
||||
//04/01/2000: Hurdler: added for T&L
|
||||
// Actually it only works on Walls and Planes
|
||||
HWD.pfnSetTransform(&atransform);
|
||||
GL_SetTransform(&atransform);
|
||||
|
||||
HWR_ClearClipper();
|
||||
|
||||
|
|
@ -6031,15 +6030,15 @@ void HWR_RenderSkyboxView(player_t *player)
|
|||
HWR_CreateDrawNodes();
|
||||
}
|
||||
|
||||
HWD.pfnSetTransform(NULL);
|
||||
HWD.pfnUnSetShader();
|
||||
GL_SetTransform(NULL);
|
||||
GL_UnSetShader();
|
||||
|
||||
// Check for new console commands.
|
||||
NetUpdate();
|
||||
|
||||
// added by Hurdler for correct splitscreen
|
||||
// moved here by hurdler so it works with the new near clipping plane
|
||||
HWD.pfnGClipRect(0, 0, vid.width, vid.height, NZCLIP_PLANE);
|
||||
GL_GClipRect(0, 0, vid.width, vid.height, NZCLIP_PLANE);
|
||||
}
|
||||
|
||||
// ==========================================================================
|
||||
|
|
@ -6075,10 +6074,10 @@ void HWR_RenderPlayerView(void)
|
|||
ClearColor.alpha = 1.0f;
|
||||
|
||||
if (cv_glshaders.value)
|
||||
HWD.pfnSetShaderInfo(HWD_SHADERINFO_LEVELTIME, (INT32)leveltime); // The water surface shader needs the leveltime.
|
||||
GL_SetShaderInfo(HWD_SHADERINFO_LEVELTIME, (INT32)leveltime); // The water surface shader needs the leveltime.
|
||||
|
||||
if (viewssnum == 0) // Only do it if it's the first screen being rendered
|
||||
HWD.pfnClearBuffer(true, false, &ClearColor); // Clear the Color Buffer, stops HOMs. Also seems to fix the skybox issue on Intel GPUs.
|
||||
GL_ClearBuffer(true, false, &ClearColor); // Clear the Color Buffer, stops HOMs. Also seems to fix the skybox issue on Intel GPUs.
|
||||
|
||||
ps_hw_skyboxtime = I_GetPreciseTime();
|
||||
if (skybox) // If there's a skybox and we should be drawing the sky, draw the skybox
|
||||
|
|
@ -6180,7 +6179,7 @@ void HWR_RenderPlayerView(void)
|
|||
|
||||
//04/01/2000: Hurdler: added for T&L
|
||||
// Actually it only works on Walls and Planes
|
||||
HWD.pfnSetTransform(&atransform);
|
||||
GL_SetTransform(&atransform);
|
||||
|
||||
HWR_ClearClipper();
|
||||
|
||||
|
|
@ -6238,8 +6237,8 @@ void HWR_RenderPlayerView(void)
|
|||
HWR_CreateDrawNodes();
|
||||
}
|
||||
|
||||
HWD.pfnSetTransform(NULL);
|
||||
HWD.pfnUnSetShader();
|
||||
GL_SetTransform(NULL);
|
||||
GL_UnSetShader();
|
||||
|
||||
HWR_DoPostProcessor(player);
|
||||
|
||||
|
|
@ -6248,7 +6247,7 @@ void HWR_RenderPlayerView(void)
|
|||
|
||||
// added by Hurdler for correct splitscreen
|
||||
// moved here by hurdler so it works with the new near clipping plane
|
||||
HWD.pfnGClipRect(0, 0, vid.width, vid.height, NZCLIP_PLANE);
|
||||
GL_GClipRect(0, 0, vid.width, vid.height, NZCLIP_PLANE);
|
||||
}
|
||||
|
||||
// Returns whether palette rendering is "actually enabled."
|
||||
|
|
@ -6384,13 +6383,13 @@ consvar_t cv_glpalettedepth = CVAR_INIT ("gr_palettedepth", "16 bits", CV_SAVE|C
|
|||
static void CV_glfiltermode_OnChange(void)
|
||||
{
|
||||
ONLY_IF_GL_LOADED
|
||||
HWD.pfnSetSpecialState(HWD_SET_TEXTUREFILTERMODE, cv_glfiltermode.value);
|
||||
GL_SetSpecialState(HWD_SET_TEXTUREFILTERMODE, cv_glfiltermode.value);
|
||||
}
|
||||
|
||||
static void CV_glanisotropic_OnChange(void)
|
||||
{
|
||||
ONLY_IF_GL_LOADED
|
||||
HWD.pfnSetSpecialState(HWD_SET_TEXTUREANISOTROPICMODE, cv_glanisotropicmode.value);
|
||||
GL_SetSpecialState(HWD_SET_TEXTUREANISOTROPICMODE, cv_glanisotropicmode.value);
|
||||
}
|
||||
|
||||
void CV_glmodellighting_OnChange(void);
|
||||
|
|
@ -6515,8 +6514,8 @@ void HWR_Switch(void)
|
|||
HWR_AddSessionCommands();
|
||||
|
||||
// Set special states from CVARs
|
||||
HWD.pfnSetSpecialState(HWD_SET_TEXTUREFILTERMODE, cv_glfiltermode.value);
|
||||
HWD.pfnSetSpecialState(HWD_SET_TEXTUREANISOTROPICMODE, cv_glanisotropicmode.value);
|
||||
GL_SetSpecialState(HWD_SET_TEXTUREFILTERMODE, cv_glfiltermode.value);
|
||||
GL_SetSpecialState(HWD_SET_TEXTUREANISOTROPICMODE, cv_glanisotropicmode.value);
|
||||
|
||||
// Load textures
|
||||
HWR_LoadMapTextures(numtextures);
|
||||
|
|
@ -6538,7 +6537,7 @@ void HWR_Shutdown(void)
|
|||
HWR_FreeExtraSubsectors();
|
||||
HWR_FreePolyPool();
|
||||
HWR_FreeMapTextures();
|
||||
HWD.pfnFlushScreenTextures();
|
||||
GL_FlushScreenTextures();
|
||||
}
|
||||
|
||||
void transform(float *cx, float *cy, float *cz)
|
||||
|
|
@ -6624,12 +6623,12 @@ void HWR_RenderWall(FOutVector *wallVerts, FSurfaceInfo *pSurf, FBITFIELD blend,
|
|||
|
||||
INT32 HWR_GetTextureUsed(void)
|
||||
{
|
||||
return HWD.pfnGetTextureUsed();
|
||||
return GL_GetTextureUsed();
|
||||
}
|
||||
|
||||
void HWR_DoPostProcessor(player_t *player)
|
||||
{
|
||||
HWD.pfnUnSetShader();
|
||||
GL_UnSetShader();
|
||||
|
||||
// Armageddon Blast Flash!
|
||||
// Could this even be considered postprocessor?
|
||||
|
|
@ -6655,12 +6654,12 @@ void HWR_DoPostProcessor(player_t *player)
|
|||
|
||||
V_CubeApply(&Surf.PolyColor.s.red, &Surf.PolyColor.s.green, &Surf.PolyColor.s.blue);
|
||||
|
||||
HWD.pfnDrawPolygon(&Surf, v, 4, PF_Modulated|PF_Additive|PF_NoTexture|PF_NoDepthTest);
|
||||
GL_DrawPolygon(&Surf, v, 4, PF_Modulated|PF_Additive|PF_NoTexture|PF_NoDepthTest);
|
||||
}
|
||||
|
||||
// Capture the screen for intermission and screen waving
|
||||
if (gamestate != GS_INTERMISSION)
|
||||
HWD.pfnMakeScreenTexture(HWD_SCREENTEXTURE_GENERIC1);
|
||||
GL_MakeScreenTexture(HWD_SCREENTEXTURE_GENERIC1);
|
||||
|
||||
if (r_splitscreen) // Not supported in splitscreen - someone want to add support?
|
||||
return;
|
||||
|
|
@ -6704,11 +6703,11 @@ void HWR_DoPostProcessor(player_t *player)
|
|||
v[x][y][1] = (y/((float)(SCREENVERTS-1.0f)/9.0f))-4.5f;
|
||||
}
|
||||
}
|
||||
HWD.pfnPostImgRedraw(v);
|
||||
GL_PostImgRedraw(v);
|
||||
|
||||
// Capture the screen again for screen waving on the intermission
|
||||
if (gamestate != GS_INTERMISSION)
|
||||
HWD.pfnMakeScreenTexture(HWD_SCREENTEXTURE_GENERIC1);
|
||||
GL_MakeScreenTexture(HWD_SCREENTEXTURE_GENERIC1);
|
||||
}
|
||||
// Flipping of the screen isn't done here anymore
|
||||
}
|
||||
|
|
@ -6716,18 +6715,18 @@ void HWR_DoPostProcessor(player_t *player)
|
|||
void HWR_StartScreenWipe(void)
|
||||
{
|
||||
//CONS_Debug(DBG_RENDER, "In HWR_StartScreenWipe()\n");
|
||||
HWD.pfnMakeScreenTexture(HWD_SCREENTEXTURE_WIPE_START);
|
||||
GL_MakeScreenTexture(HWD_SCREENTEXTURE_WIPE_START);
|
||||
}
|
||||
|
||||
void HWR_EndScreenWipe(void)
|
||||
{
|
||||
//CONS_Debug(DBG_RENDER, "In HWR_EndScreenWipe()\n");
|
||||
HWD.pfnMakeScreenTexture(HWD_SCREENTEXTURE_WIPE_END);
|
||||
GL_MakeScreenTexture(HWD_SCREENTEXTURE_WIPE_END);
|
||||
}
|
||||
|
||||
void HWR_DrawIntermissionBG(void)
|
||||
{
|
||||
HWD.pfnDrawScreenTexture(HWD_SCREENTEXTURE_GENERIC1, NULL, 0);
|
||||
GL_DrawScreenTexture(HWD_SCREENTEXTURE_GENERIC1, NULL, 0);
|
||||
}
|
||||
|
||||
//
|
||||
|
|
@ -6772,7 +6771,7 @@ void HWR_DoWipe(UINT8 wipenum, UINT8 scrnnum)
|
|||
return;
|
||||
|
||||
HWR_GetFadeMask(wipelumpnum);
|
||||
HWD.pfnDoScreenWipe(HWD_SCREENTEXTURE_WIPE_START, HWD_SCREENTEXTURE_WIPE_END);
|
||||
GL_DoScreenWipe(HWD_SCREENTEXTURE_WIPE_START, HWD_SCREENTEXTURE_WIPE_END);
|
||||
}
|
||||
|
||||
void HWR_DoTintedWipe(UINT8 wipenum, UINT8 scrnnum)
|
||||
|
|
@ -6783,19 +6782,19 @@ void HWR_DoTintedWipe(UINT8 wipenum, UINT8 scrnnum)
|
|||
|
||||
void HWR_RenderVhsEffect(INT16 upbary, INT16 downbary, UINT8 updistort, UINT8 downdistort, UINT8 barsize)
|
||||
{
|
||||
HWD.pfnRenderVhsEffect(upbary, downbary, updistort, downdistort, barsize);
|
||||
GL_RenderVhsEffect(upbary, downbary, updistort, downdistort, barsize);
|
||||
}
|
||||
|
||||
void HWR_MakeScreenFinalTexture(void)
|
||||
{
|
||||
int tex = HWR_ShouldUsePaletteRendering() ? HWD_SCREENTEXTURE_GENERIC3 : HWD_SCREENTEXTURE_GENERIC2;
|
||||
HWD.pfnMakeScreenTexture(tex);
|
||||
GL_MakeScreenTexture(tex);
|
||||
}
|
||||
|
||||
void HWR_DrawScreenFinalTexture(int width, int height)
|
||||
{
|
||||
int tex = HWR_ShouldUsePaletteRendering() ? HWD_SCREENTEXTURE_GENERIC3 : HWD_SCREENTEXTURE_GENERIC2;
|
||||
HWD.pfnDrawScreenFinalTexture(tex, width, height);
|
||||
GL_DrawScreenFinalTexture(tex, width, height);
|
||||
}
|
||||
|
||||
#endif // HWRENDER
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@
|
|||
#include "../doomstat.h"
|
||||
|
||||
#ifdef HWRENDER
|
||||
#include "hw_drv.h"
|
||||
#include "hw_gpu.h"
|
||||
#include "hw_light.h"
|
||||
#include "hw_md2.h"
|
||||
#include "../d_main.h"
|
||||
|
|
@ -427,7 +427,7 @@ static void md2_loadTexture(md2_t *model)
|
|||
}
|
||||
}
|
||||
|
||||
HWD.pfnSetTexture(grPatch->mipmap);
|
||||
GL_SetTexture(grPatch->mipmap);
|
||||
}
|
||||
|
||||
// -----------------+
|
||||
|
|
@ -482,7 +482,7 @@ static void md2_loadBlendTexture(md2_t *model)
|
|||
grPatch->mipmap->height = (UINT16)h;
|
||||
}
|
||||
|
||||
HWD.pfnSetTexture(grPatch->mipmap); // We do need to do this so that it can be cleared and knows to recreate it when necessary
|
||||
GL_SetTexture(grPatch->mipmap); // We do need to do this so that it can be cleared and knows to recreate it when necessary
|
||||
|
||||
Z_Free(filename);
|
||||
}
|
||||
|
|
@ -1153,7 +1153,7 @@ static void HWR_GetBlendedTexture(patch_t *patch, patch_t *blendpatch, INT32 ski
|
|||
if (blendpatch == NULL || colormap == colormaps || colormap == NULL)
|
||||
{
|
||||
// Don't do any blending
|
||||
HWD.pfnSetTexture(grPatch->mipmap);
|
||||
GL_SetTexture(grPatch->mipmap);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -1161,7 +1161,7 @@ static void HWR_GetBlendedTexture(patch_t *patch, patch_t *blendpatch, INT32 ski
|
|||
&& (patch->width != blendpatch->width || patch->height != blendpatch->height))
|
||||
{
|
||||
// Blend image exists, but it's bad.
|
||||
HWD.pfnSetTexture(grPatch->mipmap);
|
||||
GL_SetTexture(grPatch->mipmap);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -1178,10 +1178,10 @@ static void HWR_GetBlendedTexture(patch_t *patch, patch_t *blendpatch, INT32 ski
|
|||
{
|
||||
memcpy(grMipmap->colormap->data, colormap, 256 * sizeof(UINT8));
|
||||
HWR_CreateBlendedTexture(patch, blendpatch, grMipmap, skinnum, color);
|
||||
HWD.pfnUpdateTexture(grMipmap);
|
||||
GL_UpdateTexture(grMipmap);
|
||||
}
|
||||
else
|
||||
HWD.pfnSetTexture(grMipmap); // found the colormap, set it to the correct texture
|
||||
GL_SetTexture(grMipmap); // found the colormap, set it to the correct texture
|
||||
|
||||
Z_ChangeTag(grMipmap->data, PU_HWRMODELTEXTURE_UNLOCKED);
|
||||
return;
|
||||
|
|
@ -1207,7 +1207,7 @@ static void HWR_GetBlendedTexture(patch_t *patch, patch_t *blendpatch, INT32 ski
|
|||
|
||||
HWR_CreateBlendedTexture(patch, blendpatch, newMipmap, skinnum, color);
|
||||
|
||||
HWD.pfnSetTexture(newMipmap);
|
||||
GL_SetTexture(newMipmap);
|
||||
Z_ChangeTag(newMipmap->data, PU_HWRMODELTEXTURE_UNLOCKED);
|
||||
}
|
||||
|
||||
|
|
@ -1508,7 +1508,7 @@ boolean HWR_DrawModel(gl_vissprite_t *spr)
|
|||
// note down the max_s and max_t that end up in the VBO
|
||||
md2->model->vbo_max_s = md2->model->max_s;
|
||||
md2->model->vbo_max_t = md2->model->max_t;
|
||||
HWD.pfnCreateModelVBOs(md2->model);
|
||||
GL_CreateModelVBOs(md2->model);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -1518,7 +1518,7 @@ boolean HWR_DrawModel(gl_vissprite_t *spr)
|
|||
}
|
||||
}
|
||||
|
||||
//HWD.pfnSetBlend(blend); // This seems to actually break translucency?
|
||||
//GL_SetBlend(blend); // This seems to actually break translucency?
|
||||
//Hurdler: arf, I don't like that implementation at all... too much crappy
|
||||
|
||||
if (gpatch && hwrPatch && hwrPatch->mipmap->format) // else if meant that if a texture couldn't be loaded, it would just end up using something else's texture
|
||||
|
|
@ -1726,7 +1726,7 @@ boolean HWR_DrawModel(gl_vissprite_t *spr)
|
|||
p.mirror = atransform.mirror;
|
||||
|
||||
if (HWR_UseShader())
|
||||
HWD.pfnSetShader(HWR_GetShaderFromTarget(SHADER_MODEL));
|
||||
GL_SetShader(HWR_GetShaderFromTarget(SHADER_MODEL));
|
||||
{
|
||||
float this_scale = FIXED_TO_FLOAT(interp.scale);
|
||||
fixed_t floorClip = spr->mobj->terrain ? spr->mobj->terrain->floorClip : 0;
|
||||
|
|
@ -1835,7 +1835,7 @@ boolean HWR_DrawModel(gl_vissprite_t *spr)
|
|||
p.y += yx + zy + ypiv;
|
||||
}
|
||||
|
||||
HWD.pfnDrawModel(md2->model, frame, durs, tics, nextFrame, &p, md2->scale * xs, md2->scale * ys, flip, hflip, &Surf);
|
||||
GL_DrawModel(md2->model, frame, durs, tics, nextFrame, &p, md2->scale * xs, md2->scale * ys, flip, hflip, &Surf);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@
|
|||
#ifdef HWRENDER
|
||||
|
||||
#include "hw_glob.h"
|
||||
#include "hw_drv.h"
|
||||
#include "hw_gpu.h"
|
||||
#include "hw_shaders.h"
|
||||
#include "../z_zone.h"
|
||||
|
||||
|
|
@ -88,7 +88,7 @@ boolean HWR_InitShaders(void)
|
|||
{
|
||||
int i;
|
||||
|
||||
if (!HWD.pfnInitShaders())
|
||||
if (!GL_InitShaders())
|
||||
return false;
|
||||
|
||||
for (i = 0; i < NUMSHADERTARGETS; i++)
|
||||
|
|
@ -368,16 +368,16 @@ static void HWR_CompileShader(int index)
|
|||
{
|
||||
char *preprocessed = HWR_PreprocessShader(vertex_source);
|
||||
if (!preprocessed) return;
|
||||
HWD.pfnLoadShader(index, preprocessed, HWD_SHADERSTAGE_VERTEX);
|
||||
GL_LoadShader(index, preprocessed, HWD_SHADERSTAGE_VERTEX);
|
||||
}
|
||||
if (fragment_source)
|
||||
{
|
||||
char *preprocessed = HWR_PreprocessShader(fragment_source);
|
||||
if (!preprocessed) return;
|
||||
HWD.pfnLoadShader(index, preprocessed, HWD_SHADERSTAGE_FRAGMENT);
|
||||
GL_LoadShader(index, preprocessed, HWD_SHADERSTAGE_FRAGMENT);
|
||||
}
|
||||
|
||||
gl_shaders[index].compiled = HWD.pfnCompileShader(index);
|
||||
gl_shaders[index].compiled = GL_CompileShader(index);
|
||||
}
|
||||
|
||||
// compile or recompile shaders
|
||||
|
|
|
|||
|
|
@ -392,7 +392,7 @@ static void UnSetRes(void)
|
|||
// Returns : pvidmodes - points to list of detected OpenGL video modes
|
||||
// : numvidmodes - number of detected OpenGL video modes
|
||||
// -----------------+
|
||||
EXPORT void HWRAPI(GetModeList) (vmode_t** pvidmodes, INT32 *numvidmodes)
|
||||
void GL_GetModeList(vmode_t** pvidmodes, INT32 *numvidmodes)
|
||||
{
|
||||
INT32 i;
|
||||
|
||||
|
|
@ -497,7 +497,7 @@ EXPORT void HWRAPI(GetModeList) (vmode_t** pvidmodes, INT32 *numvidmodes)
|
|||
// -----------------+
|
||||
// Shutdown : Shutdown OpenGL, restore the display mode
|
||||
// -----------------+
|
||||
EXPORT void HWRAPI(Shutdown) (void)
|
||||
void GL_Shutdown(void)
|
||||
{
|
||||
#ifdef DEBUG_TO_FILE
|
||||
long nb_centiemes;
|
||||
|
|
@ -526,7 +526,7 @@ EXPORT void HWRAPI(Shutdown) (void)
|
|||
// -----------------+
|
||||
// FinishUpdate : Swap front and back buffers
|
||||
// -----------------+
|
||||
EXPORT void HWRAPI(FinishUpdate) (INT32 waitvbl)
|
||||
void GL_FinishUpdate(INT32 waitvbl)
|
||||
{
|
||||
#ifdef USE_WGL_SWAP
|
||||
static INT32 oldwaitvbl = 0;
|
||||
|
|
@ -554,13 +554,13 @@ EXPORT void HWRAPI(FinishUpdate) (INT32 waitvbl)
|
|||
// : 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)
|
||||
void GL_SetPalette(RGBA_t *palette)
|
||||
{
|
||||
size_t palsize = (sizeof(RGBA_t) * 256);
|
||||
// on a palette change, you have to reload all of the textures
|
||||
if (memcmp(&myPaletteData, pal, palsize))
|
||||
if (memcmp(&myPaletteData, palette, palsize))
|
||||
{
|
||||
memcpy(&myPaletteData, pal, palsize);
|
||||
memcpy(&myPaletteData, palette, palsize);
|
||||
Flush();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@
|
|||
#include "r_vbo.h"
|
||||
#include "../hw_clip.h"
|
||||
#include "../hw_shaders.h"
|
||||
#include "../hw_gpu.h"
|
||||
|
||||
#if defined (HWRENDER) && !defined (NOROPENGL)
|
||||
|
||||
|
|
@ -734,7 +735,7 @@ void SetupGLFunc4(void)
|
|||
#endif
|
||||
}
|
||||
|
||||
EXPORT boolean HWRAPI(InitShaders) (void)
|
||||
boolean GL_InitShaders(void)
|
||||
{
|
||||
#ifdef GL_SHADERS
|
||||
|
||||
|
|
@ -756,7 +757,7 @@ EXPORT boolean HWRAPI(InitShaders) (void)
|
|||
#endif
|
||||
}
|
||||
|
||||
EXPORT void HWRAPI(LoadShader) (int slot, char *code, hwdshaderstage_t stage)
|
||||
void GL_LoadShader(int slot, char *code, hwdshaderstage_t stage)
|
||||
{
|
||||
#ifdef GL_SHADERS
|
||||
gl_shader_t *shader;
|
||||
|
|
@ -788,7 +789,7 @@ EXPORT void HWRAPI(LoadShader) (int slot, char *code, hwdshaderstage_t stage)
|
|||
}
|
||||
|
||||
|
||||
EXPORT boolean HWRAPI(CompileShader) (int slot)
|
||||
boolean GL_CompileShader(int slot)
|
||||
{
|
||||
#ifdef GL_SHADERS
|
||||
if (slot < 0 || slot >= HWR_MAXSHADERS)
|
||||
|
|
@ -814,7 +815,7 @@ EXPORT boolean HWRAPI(CompileShader) (int slot)
|
|||
// Those are given to the uniforms.
|
||||
//
|
||||
|
||||
EXPORT void HWRAPI(SetShaderInfo) (hwdshaderinfo_t info, INT32 value)
|
||||
void GL_SetShaderInfo(hwdshaderinfo_t info, INT32 value)
|
||||
{
|
||||
#ifdef GL_SHADERS
|
||||
switch (info)
|
||||
|
|
@ -846,12 +847,12 @@ EXPORT void HWRAPI(SetShaderInfo) (hwdshaderinfo_t info, INT32 value)
|
|||
#endif
|
||||
}
|
||||
|
||||
EXPORT void HWRAPI(SetShader) (int slot)
|
||||
void GL_SetShader(int slot)
|
||||
{
|
||||
#ifdef GL_SHADERS
|
||||
if (slot == SHADER_NONE)
|
||||
{
|
||||
UnSetShader();
|
||||
GL_UnSetShader();
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -880,7 +881,7 @@ EXPORT void HWRAPI(SetShader) (int slot)
|
|||
gl_shadersenabled = false;
|
||||
}
|
||||
|
||||
EXPORT void HWRAPI(UnSetShader) (void)
|
||||
void GL_UnSetShader(void)
|
||||
{
|
||||
#ifdef GL_SHADERS
|
||||
if (gl_shadersenabled) // don't repeatedly call glUseProgram if not needed
|
||||
|
|
@ -995,7 +996,7 @@ void SetModelView(GLint w, GLint 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();
|
||||
|
||||
screen_width = w;
|
||||
screen_height = h;
|
||||
|
|
@ -1114,7 +1115,7 @@ void SetStates(void)
|
|||
|
||||
// this set CurrentPolyFlags to the actual configuration
|
||||
CurrentPolyFlags = 0xffffffff;
|
||||
SetBlend(0);
|
||||
GL_SetBlend(0);
|
||||
|
||||
tex_downloaded = 0;
|
||||
SetNoTexture(GL_TEXTURE0);
|
||||
|
|
@ -1148,7 +1149,7 @@ void SetStates(void)
|
|||
// -----------------+
|
||||
// DeleteTexture : Deletes a texture from the GPU and frees its data
|
||||
// -----------------+
|
||||
EXPORT void HWRAPI(DeleteTexture) (GLMipmap_t *pTexInfo)
|
||||
void GL_DeleteTexture(GLMipmap_t *pTexInfo)
|
||||
{
|
||||
FTextureInfo *head = TexCacheHead;
|
||||
|
||||
|
|
@ -1246,16 +1247,15 @@ INT32 isExtAvailable(const char *extension, const GLubyte *start)
|
|||
// -----------------+
|
||||
// Init : Initialise the OpenGL interface API
|
||||
// -----------------+
|
||||
EXPORT boolean HWRAPI(Init) (void)
|
||||
boolean GL_Init(void)
|
||||
{
|
||||
return LoadGL();
|
||||
}
|
||||
|
||||
|
||||
// -----------------+
|
||||
// ClearMipMapCache : Flush OpenGL textures from memory
|
||||
// -----------------+
|
||||
EXPORT void HWRAPI(ClearMipMapCache) (void)
|
||||
void GL_ClearMipMapCache(void)
|
||||
{
|
||||
// GL_DBG_Printf ("HWR_Flush(exe)\n");
|
||||
Flush();
|
||||
|
|
@ -1264,7 +1264,7 @@ EXPORT void HWRAPI(ClearMipMapCache) (void)
|
|||
// Writes screen texture tex into dst_data.
|
||||
// Pixel format is 24-bit RGB. Row order is top to bottom.
|
||||
// Dimensions are screen_width * screen_height.
|
||||
EXPORT void HWRAPI(ReadScreenTexture) (int tex, UINT8 *restrict dest, INT32 scale)
|
||||
void GL_ReadScreenTexture(int tex, UINT8 *restrict dest, INT32 scale)
|
||||
{
|
||||
const INT32 stride = (screen_width/scale)*3;
|
||||
INT32 scanlines = screen_height;
|
||||
|
|
@ -1275,14 +1275,14 @@ EXPORT void HWRAPI(ReadScreenTexture) (int tex, UINT8 *restrict dest, INT32 scal
|
|||
// 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);
|
||||
|
||||
image = malloc(screen_width*screen_height*3);
|
||||
pglPixelStorei(GL_PACK_ALIGNMENT, 1);
|
||||
pglReadPixels(0, 0, screen_width, screen_height, GL_RGB, GL_UNSIGNED_BYTE, image);
|
||||
|
||||
if (tex != HWD_SCREENTEXTURE_GENERIC2)
|
||||
DrawScreenTexture(HWD_SCREENTEXTURE_GENERIC2, NULL, 0);
|
||||
GL_DrawScreenTexture(HWD_SCREENTEXTURE_GENERIC2, NULL, 0);
|
||||
|
||||
// TODO the downscaling happens in the screen capture code now,
|
||||
// yet we're still doing this on the CPU? sheesh...
|
||||
|
|
@ -1303,10 +1303,24 @@ EXPORT void HWRAPI(ReadScreenTexture) (int tex, UINT8 *restrict dest, INT32 scal
|
|||
}
|
||||
|
||||
|
||||
// -----------------+
|
||||
// SetPalette : Changes the current texture palette
|
||||
// -----------------+
|
||||
void GL_SetPalette(RGBA_t *palette)
|
||||
{
|
||||
size_t palsize = (sizeof(RGBA_t) * 256);
|
||||
// on a palette change, you have to reload all of the textures
|
||||
if (memcmp(&myPaletteData, palette, palsize))
|
||||
{
|
||||
memcpy(&myPaletteData, palette, palsize);
|
||||
Flush();
|
||||
}
|
||||
}
|
||||
|
||||
// -----------------+
|
||||
// GClipRect : Defines the 2D hardware clipping window
|
||||
// -----------------+
|
||||
EXPORT void HWRAPI(GClipRect) (INT32 minx, INT32 miny, INT32 maxx, INT32 maxy, float nearclip)
|
||||
void GL_GClipRect(INT32 minx, INT32 miny, INT32 maxx, INT32 maxy, float nearclip)
|
||||
{
|
||||
// GL_DBG_Printf ("GClipRect(%d, %d, %d, %d)\n", minx, miny, maxx, maxy);
|
||||
|
||||
|
|
@ -1328,7 +1342,7 @@ EXPORT void HWRAPI(GClipRect) (INT32 minx, INT32 miny, INT32 maxx, INT32 maxy, f
|
|||
// -----------------+
|
||||
// ClearBuffer : Clear the color/alpha/depth buffer(s)
|
||||
// -----------------+
|
||||
EXPORT void HWRAPI(ClearBuffer) (FBOOLEAN ColorMask,
|
||||
void GL_ClearBuffer(FBOOLEAN ColorMask,
|
||||
FBOOLEAN DepthMask,
|
||||
FRGBAFloat * ClearColor)
|
||||
{
|
||||
|
|
@ -1352,7 +1366,7 @@ EXPORT void HWRAPI(ClearBuffer) (FBOOLEAN ColorMask,
|
|||
ClearMask |= GL_DEPTH_BUFFER_BIT;
|
||||
}
|
||||
|
||||
SetBlend(DepthMask ? PF_Occlude | CurrentPolyFlags : CurrentPolyFlags&~PF_Occlude);
|
||||
GL_SetBlend(DepthMask ? PF_Occlude | CurrentPolyFlags : CurrentPolyFlags&~PF_Occlude);
|
||||
|
||||
pglClear(ClearMask);
|
||||
pglEnableClientState(GL_VERTEX_ARRAY); // We always use this one
|
||||
|
|
@ -1363,7 +1377,7 @@ EXPORT void HWRAPI(ClearBuffer) (FBOOLEAN ColorMask,
|
|||
// -----------------+
|
||||
// HWRAPI Draw2DLine: Render a 2D line
|
||||
// -----------------+
|
||||
EXPORT void HWRAPI(Draw2DLine) (F2DCoord * v1,
|
||||
void GL_Draw2DLine(F2DCoord * v1,
|
||||
F2DCoord * v2,
|
||||
RGBA_t Color)
|
||||
{
|
||||
|
|
@ -1373,7 +1387,7 @@ EXPORT void HWRAPI(Draw2DLine) (F2DCoord * v1,
|
|||
GLfloat angle;
|
||||
|
||||
// BP: we should reflect the new state in our variable
|
||||
//SetBlend(PF_Modulated|PF_NoTexture);
|
||||
//GL_SetBlend(PF_Modulated|PF_NoTexture);
|
||||
|
||||
pglDisable(GL_TEXTURE_2D);
|
||||
|
||||
|
|
@ -1492,7 +1506,7 @@ static void SetBlendMode(FBITFIELD flags)
|
|||
}
|
||||
}
|
||||
|
||||
EXPORT void HWRAPI(SetBlend) (FBITFIELD PolyFlags)
|
||||
void GL_SetBlend(FBITFIELD PolyFlags)
|
||||
{
|
||||
FBITFIELD Xor;
|
||||
Xor = CurrentPolyFlags^PolyFlags;
|
||||
|
|
@ -1609,7 +1623,7 @@ static void AllocTextureBuffer(GLMipmap_t *pTexInfo)
|
|||
// -----------------+
|
||||
// UpdateTexture : Updates texture data.
|
||||
// -----------------+
|
||||
EXPORT void HWRAPI(UpdateTexture) (GLMipmap_t *pTexInfo)
|
||||
void GL_UpdateTexture(GLMipmap_t *pTexInfo)
|
||||
{
|
||||
// Upload a texture
|
||||
GLuint num = pTexInfo->downloaded;
|
||||
|
|
@ -1778,7 +1792,7 @@ EXPORT void HWRAPI(UpdateTexture) (GLMipmap_t *pTexInfo)
|
|||
// -----------------+
|
||||
// SetTexture : The mipmap becomes the current texture source
|
||||
// -----------------+
|
||||
EXPORT void HWRAPI(SetTexture) (GLMipmap_t *pTexInfo)
|
||||
void GL_SetTexture(GLMipmap_t *pTexInfo)
|
||||
{
|
||||
if (!pTexInfo)
|
||||
{
|
||||
|
|
@ -1805,7 +1819,7 @@ EXPORT void HWRAPI(SetTexture) (GLMipmap_t *pTexInfo)
|
|||
{
|
||||
FTextureInfo *newTex = calloc(1, sizeof (*newTex));
|
||||
|
||||
UpdateTexture(pTexInfo);
|
||||
GL_UpdateTexture(pTexInfo);
|
||||
|
||||
newTex->texture = pTexInfo;
|
||||
newTex->downloaded = (UINT32)pTexInfo->downloaded;
|
||||
|
|
@ -2093,7 +2107,7 @@ static void PreparePolygon(FSurfaceInfo *pSurf, FOutVector *pOutVerts, FBITFIELD
|
|||
if ((PolyFlags & PF_Corona) && (oglflags & GLF_NOZBUFREAD))
|
||||
PolyFlags &= ~(PF_NoDepthTest|PF_Corona);
|
||||
|
||||
SetBlend(PolyFlags); //TODO: inline (#pragma..)
|
||||
GL_SetBlend(PolyFlags); //TODO: inline (#pragma..)
|
||||
|
||||
if (pSurf)
|
||||
{
|
||||
|
|
@ -2202,7 +2216,7 @@ static void PreparePolygon(FSurfaceInfo *pSurf, FOutVector *pOutVerts, FBITFIELD
|
|||
// -----------------+
|
||||
// DrawPolygon : Render a polygon, set the texture, set render mode
|
||||
// -----------------+
|
||||
EXPORT void HWRAPI(DrawPolygon) (FSurfaceInfo *pSurf, FOutVector *pOutVerts, FUINT iNumPts, FBITFIELD PolyFlags)
|
||||
void GL_DrawPolygon(FSurfaceInfo *pSurf, FOutVector *pOutVerts, FUINT iNumPts, FBITFIELD PolyFlags)
|
||||
{
|
||||
PreparePolygon(pSurf, pOutVerts, PolyFlags);
|
||||
|
||||
|
|
@ -2220,7 +2234,7 @@ EXPORT void HWRAPI(DrawPolygon) (FSurfaceInfo *pSurf, FOutVector *pOutVerts, FUI
|
|||
Clamp2D(GL_TEXTURE_WRAP_T);
|
||||
}
|
||||
|
||||
EXPORT void HWRAPI(DrawIndexedTriangles) (FSurfaceInfo *pSurf, FOutVector *pOutVerts, FUINT iNumPts, FBITFIELD PolyFlags, UINT32 *IndexArray)
|
||||
void GL_DrawIndexedTriangles(FSurfaceInfo *pSurf, FOutVector *pOutVerts, FUINT iNumPts, FBITFIELD PolyFlags, UINT32 *IndexArray)
|
||||
{
|
||||
PreparePolygon(pSurf, pOutVerts, PolyFlags);
|
||||
|
||||
|
|
@ -2236,7 +2250,7 @@ EXPORT void HWRAPI(DrawIndexedTriangles) (FSurfaceInfo *pSurf, FOutVector *pOutV
|
|||
#define sky_vbo_u ((void*)offsetof(gl_skyvertex_t, u))
|
||||
#define sky_vbo_r ((void*)offsetof(gl_skyvertex_t, r))
|
||||
|
||||
EXPORT void HWRAPI(RenderSkyDome) (gl_sky_t *sky)
|
||||
void GL_RenderSkyDome(gl_sky_t *sky)
|
||||
{
|
||||
int i, j;
|
||||
|
||||
|
|
@ -2312,7 +2326,7 @@ EXPORT void HWRAPI(RenderSkyDome) (gl_sky_t *sky)
|
|||
pglDisableClientState(GL_COLOR_ARRAY);
|
||||
}
|
||||
|
||||
EXPORT void HWRAPI(SetSpecialState) (hwdspecialstate_t IdState, INT32 Value)
|
||||
void GL_SetSpecialState(hwdspecialstate_t IdState, INT32 Value)
|
||||
{
|
||||
switch (IdState)
|
||||
{
|
||||
|
|
@ -2542,7 +2556,7 @@ static void CreateModelVBOTiny(mesh_t *mesh, tinyframe_t *frame)
|
|||
pglBindBuffer(GL_ARRAY_BUFFER, 0);
|
||||
}
|
||||
|
||||
EXPORT void HWRAPI(CreateModelVBOs) (model_t *model)
|
||||
void GL_CreateModelVBOs(model_t *model)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < model->numMeshes; i++)
|
||||
|
|
@ -2677,7 +2691,7 @@ static void DrawModelEx(model_t *model, INT32 frameIndex, float duration, float
|
|||
lt_downloaded = Surface->LightTableId;
|
||||
}
|
||||
|
||||
SetBlend(flags);
|
||||
GL_SetBlend(flags);
|
||||
Shader_SetUniforms(Surface, &poly, &tint, &fade);
|
||||
|
||||
pglEnable(GL_CULL_FACE);
|
||||
|
|
@ -2865,7 +2879,7 @@ static void DrawModelEx(model_t *model, INT32 frameIndex, float duration, float
|
|||
// -----------------+
|
||||
// HWRAPI DrawModel : Draw a model
|
||||
// -----------------+
|
||||
EXPORT void HWRAPI(DrawModel) (model_t *model, INT32 frameIndex, float duration, float tics, INT32 nextFrameIndex, FTransform *pos, float hscale, float vscale, UINT8 flipped, UINT8 hflipped, FSurfaceInfo *Surface)
|
||||
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);
|
||||
}
|
||||
|
|
@ -2873,7 +2887,7 @@ EXPORT void HWRAPI(DrawModel) (model_t *model, INT32 frameIndex, float duration,
|
|||
// -----------------+
|
||||
// SetTransform :
|
||||
// -----------------+
|
||||
EXPORT void HWRAPI(SetTransform) (FTransform *stransform)
|
||||
void GL_SetTransform(FTransform *stransform)
|
||||
{
|
||||
static boolean special_splitscreen;
|
||||
boolean shearing = false;
|
||||
|
|
@ -2936,7 +2950,7 @@ EXPORT void HWRAPI(SetTransform) (FTransform *stransform)
|
|||
|
||||
}
|
||||
|
||||
EXPORT INT32 HWRAPI(GetTextureUsed) (void)
|
||||
INT32 GL_GetTextureUsed(void)
|
||||
{
|
||||
FTextureInfo *tmp = TexCacheHead;
|
||||
INT32 res = 0;
|
||||
|
|
@ -2961,7 +2975,7 @@ EXPORT INT32 HWRAPI(GetTextureUsed) (void)
|
|||
return res;
|
||||
}
|
||||
|
||||
EXPORT void HWRAPI(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;
|
||||
|
|
@ -3047,7 +3061,7 @@ EXPORT void HWRAPI(PostImgRedraw) (float points[SCREENVERTS][SCREENVERTS][2])
|
|||
|
||||
// Sryder: This needs to be called whenever the screen changes resolution in order to reset the screen textures to use
|
||||
// a new size
|
||||
EXPORT void HWRAPI(FlushScreenTextures) (void)
|
||||
void GL_FlushScreenTextures(void)
|
||||
{
|
||||
int i;
|
||||
pglDeleteTextures(NUMSCREENTEXTURES, screenTextures);
|
||||
|
|
@ -3055,7 +3069,7 @@ EXPORT void HWRAPI(FlushScreenTextures) (void)
|
|||
screenTextures[i] = 0;
|
||||
}
|
||||
|
||||
EXPORT void HWRAPI(DrawScreenTexture)(int tex, FSurfaceInfo *surf, FBITFIELD polyflags)
|
||||
void GL_DrawScreenTexture(int tex, FSurfaceInfo *surf, FBITFIELD polyflags)
|
||||
{
|
||||
float xfix, yfix;
|
||||
|
||||
|
|
@ -3101,7 +3115,7 @@ EXPORT void HWRAPI(DrawScreenTexture)(int tex, FSurfaceInfo *surf, FBITFIELD pol
|
|||
}
|
||||
|
||||
// Do screen fades!
|
||||
EXPORT void HWRAPI(DoScreenWipe)(int wipeStart, int wipeEnd)
|
||||
void GL_DoScreenWipe(int wipeStart, int wipeEnd)
|
||||
{
|
||||
float xfix, yfix;
|
||||
|
||||
|
|
@ -3139,7 +3153,7 @@ EXPORT void HWRAPI(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
|
||||
|
|
@ -3149,7 +3163,7 @@ EXPORT void HWRAPI(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);
|
||||
|
|
@ -3180,7 +3194,7 @@ EXPORT void HWRAPI(DoScreenWipe)(int wipeStart, int wipeEnd)
|
|||
}
|
||||
|
||||
// Create a texture from the screen.
|
||||
EXPORT void HWRAPI(MakeScreenTexture) (int tex)
|
||||
void GL_MakeScreenTexture(int tex)
|
||||
{
|
||||
boolean firstTime = (screenTextures[tex] == 0);
|
||||
|
||||
|
|
@ -3203,7 +3217,7 @@ EXPORT void HWRAPI(MakeScreenTexture) (int tex)
|
|||
tex_downloaded = screenTextures[tex];
|
||||
}
|
||||
|
||||
EXPORT void HWRAPI(RenderVhsEffect) (INT16 upbary, INT16 downbary, UINT8 updistort, UINT8 downdistort, UINT8 barsize)
|
||||
void GL_RenderVhsEffect(INT16 upbary, INT16 downbary, UINT8 updistort, UINT8 downdistort, UINT8 barsize)
|
||||
{
|
||||
float xfix, yfix;
|
||||
float fix[8];
|
||||
|
|
@ -3226,8 +3240,8 @@ EXPORT void HWRAPI(RenderVhsEffect) (INT16 upbary, INT16 downbary, UINT8 updisto
|
|||
const GLfloat scrwh = (float)screen_height;
|
||||
|
||||
// Slight fuzziness
|
||||
MakeScreenTexture(HWD_SCREENTEXTURE_VHS);
|
||||
SetBlend(PF_Modulated|PF_Translucent|PF_NoDepthTest);
|
||||
GL_MakeScreenTexture(HWD_SCREENTEXTURE_VHS);
|
||||
GL_SetBlend(PF_Modulated|PF_Translucent|PF_NoDepthTest);
|
||||
pglBindTexture(GL_TEXTURE_2D, screenTextures[HWD_SCREENTEXTURE_VHS]);
|
||||
|
||||
const float stride = 2.f/scrwh;
|
||||
|
|
@ -3306,7 +3320,7 @@ EXPORT void HWRAPI(RenderVhsEffect) (INT16 upbary, INT16 downbary, UINT8 updisto
|
|||
pglDrawArrays(GL_TRIANGLE_FAN, 0, 4);
|
||||
}
|
||||
|
||||
EXPORT void HWRAPI(DrawScreenFinalTexture)(int tex, int width, int height)
|
||||
void GL_DrawScreenFinalTexture(int tex, int width, int height)
|
||||
{
|
||||
float xfix, yfix;
|
||||
float origaspect, newaspect;
|
||||
|
|
@ -3360,7 +3374,7 @@ EXPORT void HWRAPI(DrawScreenFinalTexture)(int tex, int width, int height)
|
|||
|
||||
clearColour.red = clearColour.green = clearColour.blue = 0;
|
||||
clearColour.alpha = 1;
|
||||
ClearBuffer(true, false, &clearColour);
|
||||
GL_ClearBuffer(true, false, &clearColour);
|
||||
pglBindTexture(GL_TEXTURE_2D, screenTextures[tex]);
|
||||
|
||||
pglColor4ubv(white);
|
||||
|
|
@ -3372,7 +3386,7 @@ EXPORT void HWRAPI(DrawScreenFinalTexture)(int tex, int width, int height)
|
|||
tex_downloaded = screenTextures[tex];
|
||||
}
|
||||
|
||||
EXPORT void HWRAPI(SetPaletteLookup)(UINT8 *lut)
|
||||
void GL_SetPaletteLookup(UINT8 *lut)
|
||||
{
|
||||
GLenum internalFormat;
|
||||
if (gl_version[0] == '1' || gl_version[0] == '2')
|
||||
|
|
@ -3398,7 +3412,7 @@ EXPORT void HWRAPI(SetPaletteLookup)(UINT8 *lut)
|
|||
pglActiveTexture(GL_TEXTURE0);
|
||||
}
|
||||
|
||||
EXPORT UINT32 HWRAPI(CreateLightTable)(RGBA_t *hw_lighttable)
|
||||
UINT32 GL_CreateLightTable(RGBA_t *hw_lighttable)
|
||||
{
|
||||
LTListItem *item = malloc(sizeof(LTListItem));
|
||||
if (!LightTablesTail)
|
||||
|
|
@ -3424,7 +3438,7 @@ EXPORT UINT32 HWRAPI(CreateLightTable)(RGBA_t *hw_lighttable)
|
|||
}
|
||||
|
||||
// Delete light table textures, ids given before become invalid and must not be used.
|
||||
EXPORT void HWRAPI(ClearLightTables)(void)
|
||||
void GL_ClearLightTables(void)
|
||||
{
|
||||
while (LightTablesHead)
|
||||
{
|
||||
|
|
@ -3441,7 +3455,7 @@ EXPORT void HWRAPI(ClearLightTables)(void)
|
|||
}
|
||||
|
||||
// This palette is used for the palette rendering postprocessing step.
|
||||
EXPORT void HWRAPI(SetScreenPalette)(RGBA_t *palette)
|
||||
void GL_SetScreenPalette(RGBA_t *palette)
|
||||
{
|
||||
if (memcmp(screenPalette, palette, sizeof(screenPalette)))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -36,7 +36,8 @@
|
|||
|
||||
#define _CREATE_DLL_ // necessary for Unix AND Windows
|
||||
#include "../../doomdef.h"
|
||||
#include "../hw_drv.h"
|
||||
#include "../hw_gpu.h"
|
||||
#include "../hw_dll.h"
|
||||
#include "../../z_zone.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
|
|||
|
|
@ -307,7 +307,7 @@ static ALvoid ALSetPan(ALuint sid, INT32 sep)
|
|||
* Initialise driver and listener
|
||||
*
|
||||
*****************************************************************************/
|
||||
EXPORT INT32 HWRAPI( Startup ) (I_Error_t FatalErrorFunction, snddev_t *snd_dev)
|
||||
EXPORT INT32 GL_(I_Error_t FatalErrorFunction, snddev_t *snd_dev)
|
||||
{
|
||||
ALenum model = AL_INVERSE_DISTANCE_CLAMPED;
|
||||
ALCboolean inited = ALC_FALSE;
|
||||
|
|
@ -412,7 +412,7 @@ EXPORT INT32 HWRAPI( Startup ) (I_Error_t FatalErrorFunction, snddev_t *snd_dev)
|
|||
* Shutdown 3D Sound
|
||||
*
|
||||
******************************************************************************/
|
||||
EXPORT void HWRAPI( Shutdown ) ( void )
|
||||
EXPORT void GL_( void )
|
||||
{
|
||||
ALsizei i;
|
||||
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@
|
|||
#include "hardware/hw_md2.h"
|
||||
#include "hardware/hw_glob.h"
|
||||
#include "hardware/hw_light.h"
|
||||
#include "hardware/hw_drv.h"
|
||||
#include "hardware/hw_gpu.h"
|
||||
#endif
|
||||
|
||||
// SRB2kart
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@
|
|||
#define _CREATE_DLL_ // necessary for Unix AND Windows
|
||||
|
||||
#ifdef HWRENDER
|
||||
#include "../hardware/hw_drv.h"
|
||||
#include "../hardware/hw_gpu.h"
|
||||
#include "ogl_sdl.h"
|
||||
#ifdef STATIC_OPENGL
|
||||
#include "../hardware/r_opengl/r_opengl.h"
|
||||
|
|
@ -65,73 +65,8 @@
|
|||
void *hwSym(const char *funcName,void *handle)
|
||||
{
|
||||
void *funcPointer = NULL;
|
||||
#ifdef HWRENDER
|
||||
if (fastcmp("SetTexturePalette", funcName))
|
||||
funcPointer = FUNCPTRCAST(&OglSdlSetPalette);
|
||||
|
||||
GETFUNC(Init);
|
||||
GETFUNC(Draw2DLine);
|
||||
GETFUNC(DrawPolygon);
|
||||
GETFUNC(DrawIndexedTriangles);
|
||||
GETFUNC(RenderSkyDome);
|
||||
GETFUNC(SetBlend);
|
||||
GETFUNC(ClearBuffer);
|
||||
GETFUNC(SetTexture);
|
||||
GETFUNC(UpdateTexture);
|
||||
GETFUNC(DeleteTexture);
|
||||
GETFUNC(ReadScreenTexture);
|
||||
GETFUNC(GClipRect);
|
||||
GETFUNC(ClearMipMapCache);
|
||||
GETFUNC(SetSpecialState);
|
||||
GETFUNC(GetTextureUsed);
|
||||
GETFUNC(DrawModel);
|
||||
GETFUNC(CreateModelVBOs);
|
||||
GETFUNC(SetTransform);
|
||||
GETFUNC(PostImgRedraw);
|
||||
GETFUNC(FlushScreenTextures);
|
||||
GETFUNC(DoScreenWipe);
|
||||
GETFUNC(RenderVhsEffect);
|
||||
GETFUNC(DrawScreenTexture);
|
||||
GETFUNC(MakeScreenTexture);
|
||||
GETFUNC(DrawScreenFinalTexture);
|
||||
|
||||
GETFUNC(InitShaders);
|
||||
GETFUNC(LoadShader);
|
||||
GETFUNC(CompileShader);
|
||||
GETFUNC(SetShader);
|
||||
GETFUNC(UnSetShader);
|
||||
|
||||
GETFUNC(SetShaderInfo);
|
||||
|
||||
GETFUNC(SetPaletteLookup);
|
||||
GETFUNC(CreateLightTable);
|
||||
GETFUNC(ClearLightTables);
|
||||
GETFUNC(SetScreenPalette);
|
||||
|
||||
#else //HWRENDER
|
||||
if (fastcmp("FinishUpdate", funcName))
|
||||
return funcPointer; //&FinishUpdate;
|
||||
#endif //!HWRENDER
|
||||
#ifdef STATIC3DS
|
||||
GETFUNC(Startup);
|
||||
GETFUNC(AddSfx);
|
||||
GETFUNC(AddSource);
|
||||
GETFUNC(StartSource);
|
||||
GETFUNC(StopSource);
|
||||
GETFUNC(GetHW3DSVersion);
|
||||
GETFUNC(BeginFrameUpdate);
|
||||
GETFUNC(EndFrameUpdate);
|
||||
GETFUNC(IsPlaying);
|
||||
GETFUNC(UpdateListener);
|
||||
GETFUNC(UpdateSourceParms);
|
||||
GETFUNC(SetGlobalSfxVolume);
|
||||
GETFUNC(SetCone);
|
||||
GETFUNC(Update3DSource);
|
||||
GETFUNC(ReloadSource);
|
||||
GETFUNC(KillSource);
|
||||
GETFUNC(Shutdown);
|
||||
GETFUNC(GetHW3DSTitle);
|
||||
#endif
|
||||
if (0);
|
||||
#ifdef NOLOADSO
|
||||
else
|
||||
funcPointer = handle;
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@
|
|||
#include "../i_system.h"
|
||||
#ifdef HWRENDER
|
||||
#include "../hardware/hw_main.h"
|
||||
#include "../hardware/hw_drv.h"
|
||||
#include "../hardware/hw_gpu.h"
|
||||
#include "hwsym_sdl.h"
|
||||
#include "ogl_sdl.h"
|
||||
#endif
|
||||
|
|
@ -1322,10 +1322,10 @@ void I_FinishUpdate(void)
|
|||
// Final postprocess step of palette rendering, after everything else has been drawn.
|
||||
if (HWR_ShouldUsePaletteRendering())
|
||||
{
|
||||
HWD.pfnMakeScreenTexture(HWD_SCREENTEXTURE_GENERIC2);
|
||||
HWD.pfnSetShader(HWR_GetShaderFromTarget(SHADER_PALETTE_POSTPROCESS));
|
||||
HWD.pfnDrawScreenTexture(HWD_SCREENTEXTURE_GENERIC2, NULL, 0);
|
||||
HWD.pfnUnSetShader();
|
||||
GL_MakeScreenTexture(HWD_SCREENTEXTURE_GENERIC2);
|
||||
GL_SetShader(HWR_GetShaderFromTarget(SHADER_PALETTE_POSTPROCESS));
|
||||
GL_DrawScreenTexture(HWD_SCREENTEXTURE_GENERIC2, NULL, 0);
|
||||
GL_UnSetShader();
|
||||
}
|
||||
OglSdlFinishUpdate(cv_vidwait.value);
|
||||
}
|
||||
|
|
@ -1761,47 +1761,8 @@ static void Impl_InitOpenGL(void)
|
|||
return;
|
||||
|
||||
CONS_Printf("VID_StartupOpenGL()...\n");
|
||||
*(void**)&HWD.pfnInit = hwSym("Init",NULL);
|
||||
*(void**)&HWD.pfnFinishUpdate = NULL;
|
||||
*(void**)&HWD.pfnDraw2DLine = hwSym("Draw2DLine",NULL);
|
||||
*(void**)&HWD.pfnDrawPolygon = hwSym("DrawPolygon",NULL);
|
||||
*(void**)&HWD.pfnDrawIndexedTriangles = hwSym("DrawIndexedTriangles",NULL);
|
||||
*(void**)&HWD.pfnRenderSkyDome = hwSym("RenderSkyDome",NULL);
|
||||
*(void**)&HWD.pfnSetBlend = hwSym("SetBlend",NULL);
|
||||
*(void**)&HWD.pfnClearBuffer = hwSym("ClearBuffer",NULL);
|
||||
*(void**)&HWD.pfnSetTexture = hwSym("SetTexture",NULL);
|
||||
*(void**)&HWD.pfnUpdateTexture = hwSym("UpdateTexture",NULL);
|
||||
*(void**)&HWD.pfnDeleteTexture = hwSym("DeleteTexture",NULL);
|
||||
*(void**)&HWD.pfnReadScreenTexture= hwSym("ReadScreenTexture",NULL);
|
||||
*(void**)&HWD.pfnGClipRect = hwSym("GClipRect",NULL);
|
||||
*(void**)&HWD.pfnClearMipMapCache = hwSym("ClearMipMapCache",NULL);
|
||||
*(void**)&HWD.pfnSetSpecialState = hwSym("SetSpecialState",NULL);
|
||||
*(void**)&HWD.pfnSetTexturePalette= hwSym("SetTexturePalette",NULL);
|
||||
*(void**)&HWD.pfnGetTextureUsed = hwSym("GetTextureUsed",NULL);
|
||||
*(void**)&HWD.pfnDrawModel = hwSym("DrawModel",NULL);
|
||||
*(void**)&HWD.pfnCreateModelVBOs = hwSym("CreateModelVBOs",NULL);
|
||||
*(void**)&HWD.pfnSetTransform = hwSym("SetTransform",NULL);
|
||||
*(void**)&HWD.pfnPostImgRedraw = hwSym("PostImgRedraw",NULL);
|
||||
*(void**)&HWD.pfnFlushScreenTextures=hwSym("FlushScreenTextures",NULL);
|
||||
*(void**)&HWD.pfnDoScreenWipe = hwSym("DoScreenWipe",NULL);
|
||||
*(void**)&HWD.pfnDrawScreenTexture= hwSym("DrawScreenTexture",NULL);
|
||||
*(void**)&HWD.pfnMakeScreenTexture= hwSym("MakeScreenTexture",NULL);
|
||||
*(void**)&HWD.pfnRenderVhsEffect = hwSym("RenderVhsEffect",NULL);
|
||||
*(void**)&HWD.pfnDrawScreenFinalTexture=hwSym("DrawScreenFinalTexture",NULL);
|
||||
|
||||
*(void**)&HWD.pfnInitShaders = hwSym("InitShaders",NULL);
|
||||
*(void**)&HWD.pfnLoadShader = hwSym("LoadShader",NULL);
|
||||
*(void**)&HWD.pfnCompileShader = hwSym("CompileShader",NULL);
|
||||
*(void**)&HWD.pfnSetShader = hwSym("SetShader",NULL);
|
||||
*(void**)&HWD.pfnUnSetShader = hwSym("UnSetShader",NULL);
|
||||
|
||||
*(void**)&HWD.pfnSetShaderInfo = hwSym("SetShaderInfo",NULL);
|
||||
*(void**)&HWD.pfnSetPaletteLookup = hwSym("SetPaletteLookup",NULL);
|
||||
*(void**)&HWD.pfnCreateLightTable = hwSym("CreateLightTable",NULL);
|
||||
*(void**)&HWD.pfnClearLightTables = hwSym("ClearLightTables",NULL);
|
||||
*(void**)&HWD.pfnSetScreenPalette = hwSym("SetScreenPalette",NULL);
|
||||
|
||||
if (HWD.pfnInit())
|
||||
if (GL_Init())
|
||||
vid.glstate = VID_GL_LIBRARY_LOADED;
|
||||
else
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1060,8 +1060,8 @@
|
|||
8417773A085A106C000C01D8 = {
|
||||
fileEncoding = 30;
|
||||
isa = PBXFileReference;
|
||||
name = hw_drv.h;
|
||||
path = ../../hardware/hw_drv.h;
|
||||
name = hw_gpu.h;
|
||||
path = ../../hardware/hw_gpu.h;
|
||||
refType = 2;
|
||||
};
|
||||
8417773C085A106C000C01D8 = {
|
||||
|
|
|
|||
|
|
@ -179,7 +179,7 @@
|
|||
1E44AE630B67CC2B00BAD059 /* hw3sound.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = hw3sound.c; path = ../../hardware/hw3sound.c; sourceTree = SOURCE_ROOT; };
|
||||
1E44AE640B67CC2B00BAD059 /* hw_cache.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = hw_cache.c; path = ../../hardware/hw_cache.c; sourceTree = SOURCE_ROOT; };
|
||||
1E44AE650B67CC2B00BAD059 /* hw_dll.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = hw_dll.h; path = ../../hardware/hw_dll.h; sourceTree = SOURCE_ROOT; };
|
||||
1E44AE660B67CC2B00BAD059 /* hw_drv.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = hw_drv.h; path = ../../hardware/hw_drv.h; sourceTree = SOURCE_ROOT; };
|
||||
1E44AE660B67CC2B00BAD059 /* hw_gpu.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = hw_gpu.h; path = ../../hardware/hw_gpu.h; sourceTree = SOURCE_ROOT; };
|
||||
1E44AE680B67CC2B00BAD059 /* hw_light.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = hw_light.c; path = ../../hardware/hw_light.c; sourceTree = SOURCE_ROOT; };
|
||||
1E44AE690B67CC2B00BAD059 /* hw_light.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = hw_light.h; path = ../../hardware/hw_light.h; sourceTree = SOURCE_ROOT; };
|
||||
1E44AE6A0B67CC2B00BAD059 /* hw3sound.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = hw3sound.h; path = ../../hardware/hw3sound.h; sourceTree = SOURCE_ROOT; };
|
||||
|
|
@ -531,7 +531,7 @@
|
|||
1E44AE630B67CC2B00BAD059 /* hw3sound.c */,
|
||||
1E44AE640B67CC2B00BAD059 /* hw_cache.c */,
|
||||
1E44AE650B67CC2B00BAD059 /* hw_dll.h */,
|
||||
1E44AE660B67CC2B00BAD059 /* hw_drv.h */,
|
||||
1E44AE660B67CC2B00BAD059 /* hw_gpu.h */,
|
||||
1E44AE680B67CC2B00BAD059 /* hw_light.c */,
|
||||
1E44AE690B67CC2B00BAD059 /* hw_light.h */,
|
||||
1E44AE6A0B67CC2B00BAD059 /* hw3sound.h */,
|
||||
|
|
|
|||
|
|
@ -188,24 +188,13 @@ void OglSdlFinishUpdate(boolean waitvbl)
|
|||
HWR_DrawScreenFinalTexture(sdlw, sdlh);
|
||||
SDL_GL_SwapWindow(window);
|
||||
|
||||
GClipRect(0, 0, realwidth, realheight, NZCLIP_PLANE);
|
||||
GL_GClipRect(0, 0, realwidth, realheight, NZCLIP_PLANE);
|
||||
|
||||
// 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
|
||||
// Generic2 has the screen image without palette rendering brightness adjustments.
|
||||
// Using that here will prevent brightness adjustments being applied twice.
|
||||
DrawScreenTexture(HWD_SCREENTEXTURE_GENERIC2, NULL, 0);
|
||||
}
|
||||
|
||||
EXPORT void HWRAPI(OglSdlSetPalette) (RGBA_t *palette)
|
||||
{
|
||||
size_t palsize = (sizeof(RGBA_t) * 256);
|
||||
// on a palette change, you have to reload all of the textures
|
||||
if (memcmp(&myPaletteData, palette, palsize))
|
||||
{
|
||||
memcpy(&myPaletteData, palette, palsize);
|
||||
Flush();
|
||||
}
|
||||
GL_DrawScreenTexture(HWD_SCREENTEXTURE_GENERIC2, NULL, 0);
|
||||
}
|
||||
|
||||
#endif //HWRENDER
|
||||
|
|
|
|||
|
|
@ -37,10 +37,6 @@ extern SDL_GLContext sdlglcontext;
|
|||
extern Uint16 realwidth;
|
||||
extern Uint16 realheight;
|
||||
|
||||
#ifdef _CREATE_DLL_
|
||||
EXPORT void HWRAPI( OglSdlSetPalette ) (RGBA_t *palette);
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Reference in a new issue