2014-03-15 16:59:03 +00:00
|
|
|
// Emacs style mode select -*- C++ -*-
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// Copyright (C) 1998-2000 by DooM Legacy Team.
|
|
|
|
//
|
|
|
|
// This program is free software; you can redistribute it and/or
|
|
|
|
// modify it under the terms of the GNU General Public License
|
|
|
|
// as published by the Free Software Foundation; either version 2
|
|
|
|
// of the License, or (at your option) any later version.
|
|
|
|
//
|
|
|
|
// This program is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
// GNU General Public License for more details.
|
|
|
|
|
|
|
|
/// \file
|
|
|
|
/// \brief Tool for dynamic referencing of hardware rendering functions
|
|
|
|
///
|
|
|
|
/// Declaration and definition of the HW rendering
|
|
|
|
/// functions do have the same name. Originally, the
|
|
|
|
/// implementation was stored in a separate library.
|
|
|
|
/// For SDL, we need some function to return the addresses,
|
|
|
|
/// otherwise we have a conflict with the compiler.
|
|
|
|
|
|
|
|
#include "hwsym_sdl.h"
|
|
|
|
#include "../doomdef.h"
|
|
|
|
|
|
|
|
#ifdef _MSC_VER
|
|
|
|
#pragma warning(disable : 4214 4244)
|
|
|
|
#endif
|
|
|
|
|
2014-07-25 23:10:24 +00:00
|
|
|
#ifdef HAVE_SDL
|
2014-03-15 16:59:03 +00:00
|
|
|
|
|
|
|
#include "SDL.h"
|
|
|
|
|
|
|
|
#ifdef _MSC_VER
|
|
|
|
#pragma warning(default : 4214 4244)
|
|
|
|
#endif
|
|
|
|
|
2017-09-15 16:15:06 +00:00
|
|
|
#ifndef NOLOADSO
|
|
|
|
#include "SDL_loadso.h"
|
2014-03-15 16:59:03 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#define _CREATE_DLL_ // necessary for Unix AND Windows
|
|
|
|
|
|
|
|
#ifdef HWRENDER
|
|
|
|
#include "../hardware/hw_drv.h"
|
|
|
|
#include "ogl_sdl.h"
|
|
|
|
#ifdef STATIC_OPENGL
|
|
|
|
#include "../hardware/r_opengl/r_opengl.h"
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef HW3SOUND
|
|
|
|
#include "../hardware/hw3dsdrv.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#define GETFUNC(func) \
|
|
|
|
else if (0 == strcmp(#func, funcName)) \
|
|
|
|
funcPointer = &func \
|
|
|
|
//
|
|
|
|
//
|
|
|
|
/** \brief The *hwSym function
|
|
|
|
|
|
|
|
Stupid function to return function addresses
|
|
|
|
|
|
|
|
\param funcName the name of the function
|
|
|
|
\param handle an object to look in(NULL for self)
|
|
|
|
|
|
|
|
\return void
|
|
|
|
*/
|
|
|
|
//
|
|
|
|
void *hwSym(const char *funcName,void *handle)
|
|
|
|
{
|
|
|
|
void *funcPointer = NULL;
|
|
|
|
#ifdef HWRENDER
|
|
|
|
if (0 == strcmp("SetPalette", funcName))
|
2019-12-25 19:22:01 +00:00
|
|
|
funcPointer = &OglSdlSetPalette;
|
|
|
|
|
2014-03-15 16:59:03 +00:00
|
|
|
GETFUNC(Init);
|
|
|
|
GETFUNC(Draw2DLine);
|
|
|
|
GETFUNC(DrawPolygon);
|
2020-06-07 18:20:52 +00:00
|
|
|
GETFUNC(DrawIndexedTriangles);
|
2019-09-18 02:38:04 +00:00
|
|
|
GETFUNC(RenderSkyDome);
|
2014-03-15 16:59:03 +00:00
|
|
|
GETFUNC(SetBlend);
|
|
|
|
GETFUNC(ClearBuffer);
|
|
|
|
GETFUNC(SetTexture);
|
2020-01-28 03:16:38 +00:00
|
|
|
GETFUNC(UpdateTexture);
|
2020-08-08 08:16:47 +00:00
|
|
|
GETFUNC(DeleteTexture);
|
2014-03-15 16:59:03 +00:00
|
|
|
GETFUNC(ReadRect);
|
|
|
|
GETFUNC(GClipRect);
|
|
|
|
GETFUNC(ClearMipMapCache);
|
|
|
|
GETFUNC(SetSpecialState);
|
|
|
|
GETFUNC(GetTextureUsed);
|
2018-12-16 01:57:11 +00:00
|
|
|
GETFUNC(DrawModel);
|
2018-12-26 15:58:37 +00:00
|
|
|
GETFUNC(CreateModelVBOs);
|
2014-03-15 16:59:03 +00:00
|
|
|
GETFUNC(SetTransform);
|
|
|
|
GETFUNC(PostImgRedraw);
|
2018-03-07 05:19:06 +00:00
|
|
|
GETFUNC(FlushScreenTextures);
|
2014-03-15 16:59:03 +00:00
|
|
|
GETFUNC(StartScreenWipe);
|
|
|
|
GETFUNC(EndScreenWipe);
|
|
|
|
GETFUNC(DoScreenWipe);
|
|
|
|
GETFUNC(DrawIntermissionBG);
|
|
|
|
GETFUNC(MakeScreenTexture);
|
2014-11-14 00:06:38 +00:00
|
|
|
GETFUNC(MakeScreenFinalTexture);
|
|
|
|
GETFUNC(DrawScreenFinalTexture);
|
2019-12-25 19:22:01 +00:00
|
|
|
|
|
|
|
GETFUNC(LoadShaders);
|
|
|
|
GETFUNC(KillShaders);
|
|
|
|
GETFUNC(SetShader);
|
|
|
|
GETFUNC(UnSetShader);
|
|
|
|
|
2020-01-24 00:25:54 +00:00
|
|
|
GETFUNC(SetShaderInfo);
|
2019-12-25 19:22:01 +00:00
|
|
|
GETFUNC(LoadCustomShader);
|
|
|
|
GETFUNC(InitCustomShaders);
|
|
|
|
|
2014-03-15 16:59:03 +00:00
|
|
|
#else //HWRENDER
|
|
|
|
if (0 == strcmp("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
|
|
|
|
#ifdef NOLOADSO
|
|
|
|
else
|
|
|
|
funcPointer = handle;
|
|
|
|
#else
|
|
|
|
else if (handle)
|
|
|
|
funcPointer = SDL_LoadFunction(handle,funcName);
|
|
|
|
#endif
|
|
|
|
if (!funcPointer)
|
|
|
|
I_OutputMsg("hwSym for %s: %s\n", funcName, SDL_GetError());
|
|
|
|
return funcPointer;
|
|
|
|
}
|
|
|
|
|
|
|
|
/** \brief The *hwOpen function
|
|
|
|
|
|
|
|
\param hwfile Open a handle to the SO
|
|
|
|
|
|
|
|
\return Handle to SO
|
|
|
|
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
void *hwOpen(const char *hwfile)
|
|
|
|
{
|
|
|
|
#ifdef NOLOADSO
|
|
|
|
(void)hwfile;
|
|
|
|
return NULL;
|
|
|
|
#else
|
|
|
|
void *tempso = NULL;
|
|
|
|
tempso = SDL_LoadObject(hwfile);
|
|
|
|
if (!tempso) I_OutputMsg("hwOpen of %s: %s\n", hwfile, SDL_GetError());
|
|
|
|
return tempso;
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
/** \brief The hwClose function
|
|
|
|
|
|
|
|
\param handle Close the handle of the SO
|
|
|
|
|
|
|
|
\return void
|
|
|
|
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
void hwClose(void *handle)
|
|
|
|
{
|
|
|
|
#ifdef NOLOADSO
|
|
|
|
(void)handle;
|
|
|
|
#else
|
|
|
|
SDL_UnloadObject(handle);
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
#endif
|