Browse Source

Stubbed out the remaining OpenGL calls, disabled everything SDL, ifdef'ed out OpenGL 2.0-related code, and added a new stub for remaining VID_ and GL_ calls. Portable configuration compiles now, though it still crashes at run-time.

console
Nico de Poel 5 years ago
parent
commit
d271f9b7e2
  1. 6
      engine/Quake/gl_mesh.c
  2. 2
      engine/Quake/gl_model.c
  3. 4
      engine/Quake/gl_rmain.c
  4. 7
      engine/Quake/gl_rmisc.c
  5. 2
      engine/Quake/gl_screen.c
  6. 2
      engine/Quake/main_sdl.c
  7. 6
      engine/Quake/r_alias.c
  8. 4
      engine/Quake/r_brush.c
  9. 6
      engine/Quake/r_world.c
  10. 1
      engine/Quake/sys_sdl_win.c
  11. 8
      engine/UniQuake/stub/stub_opengl.c
  12. 42
      engine/UniQuake/stub/stub_vidgl.c
  13. 2
      engine/UniQuake/sys_uniquake.c
  14. 9
      engine/Windows/VisualStudio/uniquake.vcxproj
  15. 3
      engine/Windows/VisualStudio/uniquake.vcxproj.filters

6
engine/Quake/gl_mesh.c

@ -349,10 +349,14 @@ void GL_MakeAliasModelDisplayLists (qmodel_t *m, aliashdr_t *hdr)
for (j=0 ; j<numorder ; j++)
*verts++ = poseverts[i][vertexorder[j]];
#ifdef USE_OPENGL
// ericw
GL_MakeAliasModelDisplayLists_VBO ();
#endif // USE_OPENGL
}
#ifdef USE_OPENGL
unsigned int r_meshindexbuffer = 0;
unsigned int r_meshvertexbuffer = 0;
@ -612,3 +616,5 @@ void GLMesh_DeleteVertexBuffers (void)
GL_ClearBufferBindings ();
}
#endif // USE_OPENGL

2
engine/Quake/gl_model.c

@ -231,8 +231,10 @@ void Mod_ResetAll (void)
int i;
qmodel_t *mod;
#ifdef USE_OPENGL
//ericw -- free alias model VBOs
GLMesh_DeleteVertexBuffers ();
#endif // USE_OPENGL
for (i=0 , mod=mod_known ; i<mod_numknown ; i++, mod++)
{

4
engine/Quake/gl_rmain.c

@ -114,6 +114,8 @@ qboolean r_drawflat_cheatsafe, r_fullbright_cheatsafe, r_lightmap_cheatsafe, r_d
cvar_t r_scale = {"r_scale", "1", CVAR_ARCHIVE};
#ifdef USE_OPENGL
//==============================================================================
//
// GLSL GAMMA CORRECTION
@ -261,6 +263,8 @@ void GLSLGamma_GammaCorrect (void)
GL_ClearBindings ();
}
#endif // USE_OPENGL
/*
=================
R_CullBox -- johnfitz -- replaced with new function from lordhavoc

7
engine/Quake/gl_rmisc.c

@ -398,8 +398,11 @@ void R_NewMap (void)
R_ClearParticles ();
GL_BuildLightmaps ();
#ifdef USE_OPENGL
GL_BuildBModelVertexBuffer ();
//ericw -- no longer load alias models into a VBO here, it's done in Mod_LoadAliasModel
#endif // USE_OPENGL
UQ_GL_UploadBrushModel(cl.worldmodel);
@ -450,6 +453,8 @@ void D_FlushCaches (void)
{
}
#ifdef USE_OPENGL
static GLuint gl_programs[16];
static int gl_num_programs;
@ -651,3 +656,5 @@ void GL_ClearBufferBindings ()
GL_BindBufferFunc (GL_ARRAY_BUFFER, 0);
GL_BindBufferFunc (GL_ELEMENT_ARRAY_BUFFER, 0);
}
#endif // USE_OPENGL

2
engine/Quake/gl_screen.c

@ -1126,7 +1126,9 @@ void SCR_UpdateScreen (void)
V_UpdateBlend (); //johnfitz -- V_UpdatePalette cleaned up and renamed
#ifdef USE_OPENGL
GLSLGamma_GammaCorrect ();
#endif // USE_OPENGL
GL_EndRendering ();
}

2
engine/Quake/main_sdl.c

@ -20,6 +20,7 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifdef USE_LIBSDL
#include "quakedef.h"
#if defined(SDL_FRAMEWORK) || defined(NO_SDL_CONFIG)
@ -191,3 +192,4 @@ int main(int argc, char *argv[])
return 0;
}
#endif // USE_LIBSDL

6
engine/Quake/r_alias.c

@ -66,6 +66,8 @@ typedef struct {
} lerpdata_t;
//johnfitz
#ifdef USE_OPENGL
static GLuint r_alias_program;
// uniforms used in vert shader
@ -292,6 +294,8 @@ void GL_DrawAliasFrame_GLSL (aliashdr_t *paliashdr, lerpdata_t lerpdata, gltextu
rs_aliaspasses += paliashdr->numtris;
}
#endif // USE_OPENGL
/*
=============
GL_DrawAliasFrame -- johnfitz -- rewritten to support colored light, lerping, entalpha, multitexture, and r_drawflat
@ -748,12 +752,14 @@ void R_DrawAliasModel (entity_t *e)
GL_DrawAliasFrame (paliashdr, lerpdata);
glEnable (GL_TEXTURE_2D);
}
#ifdef USE_OPENGL
// call fast path if possible. if the shader compliation failed for some reason,
// r_alias_program will be 0.
else if (r_alias_program != 0)
{
GL_DrawAliasFrame_GLSL (paliashdr, lerpdata, tx, fb);
}
#endif // USE_OPENGL
else if (overbright)
{
if (gl_texture_env_combine && gl_mtexable && gl_texture_env_add && fb) //case 1: everything in one pass

4
engine/Quake/r_brush.c

@ -951,6 +951,8 @@ void GL_BuildLightmaps (void)
//johnfitz
}
#ifdef USE_OPENGL
/*
=============================================================
@ -1037,6 +1039,8 @@ void GL_BuildBModelVertexBuffer (void)
GL_ClearBufferBindings ();
}
#endif // USE_OPENGL
/*
===============
R_AddDynamicLights

6
engine/Quake/r_world.c

@ -796,6 +796,8 @@ void R_DrawLightmapChains (void)
}
}
#ifdef USE_OPENGL
static GLuint r_world_program;
// uniforms used in vert shader
@ -1013,6 +1015,8 @@ void R_DrawTextureChains_GLSL (qmodel_t *model, entity_t *ent, texchain_t chain)
}
}
#endif // USE_OPENGL
/*
=============
R_DrawWorld -- johnfitz -- rewritten
@ -1072,6 +1076,7 @@ void R_DrawTextureChains (qmodel_t *model, entity_t *ent, texchain_t chain)
R_DrawTextureChains_NoTexture (model, chain);
#ifdef USE_OPENGL
// OpenGL 2 fast path
if (r_world_program != 0)
{
@ -1080,6 +1085,7 @@ void R_DrawTextureChains (qmodel_t *model, entity_t *ent, texchain_t chain)
R_DrawTextureChains_GLSL (model, ent, chain);
return;
}
#endif // USE_OPENGL
if (gl_overbright.value)
{

1
engine/Quake/sys_sdl_win.c

@ -48,7 +48,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
qboolean Win95, Win95old, WinNT, WinVista;
cvar_t sys_throttle = {"sys_throttle", "0.02", CVAR_ARCHIVE};
static HANDLE hinput, houtput;

8
engine/UniQuake/stub/stub_opengl.c

@ -286,4 +286,12 @@ GLAPI void GLAPIENTRY glScissor(GLint x, GLint y, GLsizei width, GLsizei height)
{
}
GLAPI void GLAPIENTRY GL_MTexCoord2fFunc(GLenum target, GLfloat s, GLfloat t)
{
}
GLAPI void GLAPIENTRY GL_SelectTextureFunc(GLenum target)
{
}
#endif // !USE_OPENGL

42
engine/UniQuake/stub/stub_vidgl.c

@ -0,0 +1,42 @@
#if !defined(USE_LIBSDL) && !defined(USE_OPENGL)
#include "quakedef.h"
int gl_stencilbits = 0;
qboolean gl_texture_NPOT = false;
qboolean gl_glsl_gamma_able = false;
qboolean gl_mtexable = false;
float gl_max_anisotropy = 1;
qboolean gl_texture_env_combine = false;
qboolean gl_texture_env_add = false;
cvar_t vid_gamma = { "gamma", "1", CVAR_ARCHIVE };
cvar_t vid_contrast = { "contrast", "1", CVAR_ARCHIVE };
void VID_Init(void)
{
Cvar_RegisterVariable(&vid_gamma);
Cvar_RegisterVariable(&vid_contrast);
}
void VID_Shutdown(void)
{
}
void VID_Toggle(void)
{
}
void VID_Lock(void)
{
}
void GL_BeginRendering(int *x, int *y, int *width, int *height)
{
}
void GL_EndRendering(void)
{
}
#endif // !USE_LIBSDL && !USE_OPENGL

2
engine/UniQuake/sys_uniquake.c

@ -4,6 +4,8 @@
qboolean isDedicated;
cvar_t sys_throttle = { "sys_throttle", "0.02", CVAR_ARCHIVE };
typedef struct unity_syscalls_s
{
void *target;

9
engine/Windows/VisualStudio/uniquake.vcxproj

@ -149,7 +149,7 @@
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>..\SDL2\include;..\..\FMOD\inc;..\..\Quake;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>UNIQUAKE_EXPORTS;WIN32;_DEBUG;_WINDOWS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;USE_FMOD;USE_SDL2;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>UNIQUAKE_EXPORTS;WIN32;_DEBUG;_WINDOWS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;USE_FMOD;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>true</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
@ -168,7 +168,7 @@
<TargetMachine>MachineX86</TargetMachine>
</Link>
<PostBuildEvent>
<Command>copy $(TargetDir)$(TargetName).dll $(SolutionDir)..\..\..\Assets\Plugins\windows\x86\uniquake.dll</Command>
<Command>copy "$(TargetDir)$(TargetName).dll" $(SolutionDir)..\..\..\Assets\Plugins\windows\x86\uniquake.dll</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
@ -233,7 +233,7 @@ copy "$(SolutionDir)\..\SDL2\lib\*.dll" "$(TargetDir)"</Command>
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>..\SDL2\include;..\..\FMOD\inc;..\..\Quake;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>UNIQUAKE_EXPORTS;WIN32;_DEBUG;_WINDOWS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;USE_FMOD;USE_SDL2;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>UNIQUAKE_EXPORTS;WIN32;_DEBUG;_WINDOWS;_CRT_NONSTDC_NO_DEPRECATE;_CRT_SECURE_NO_WARNINGS;USE_FMOD;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>true</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
@ -252,7 +252,7 @@ copy "$(SolutionDir)\..\SDL2\lib\*.dll" "$(TargetDir)"</Command>
<TargetMachine>MachineX64</TargetMachine>
</Link>
<PostBuildEvent>
<Command>copy $(TargetDir)$(TargetName).dll $(SolutionDir)..\..\..\Assets\Plugins\windows\x86_64\uniquake.dll</Command>
<Command>copy "$(TargetDir)$(TargetName).dll" $(SolutionDir)..\..\..\Assets\Plugins\windows\x86_64\uniquake.dll</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
@ -363,6 +363,7 @@ copy "$(SolutionDir)\..\SDL2\lib64\*.dll" "$(TargetDir)"</Command>
<ClCompile Include="..\..\UniQuake\stub\stub_opengl.c" />
<ClCompile Include="..\..\UniQuake\in_uniquake.c" />
<ClCompile Include="..\..\UniQuake\net_uniquake.c" />
<ClCompile Include="..\..\UniQuake\stub\stub_vidgl.c" />
<ClCompile Include="..\..\UniQuake\sys_uniquake.c" />
<ClCompile Include="..\..\UniQuake\uniquake.c" />
</ItemGroup>

3
engine/Windows/VisualStudio/uniquake.vcxproj.filters

@ -238,6 +238,9 @@
<ClCompile Include="..\..\UniQuake\in_uniquake.c">
<Filter>uniquake</Filter>
</ClCompile>
<ClCompile Include="..\..\UniQuake\stub\stub_vidgl.c">
<Filter>stub</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\Quake\anorm_dots.h">

Loading…
Cancel
Save