Skip to content

Commit

Permalink
D3/Q4/Prey: support OpenGL desktop version
Browse files Browse the repository at this point in the history
  • Loading branch information
glKarin committed Jan 6, 2025
1 parent 21a3414 commit 1938c9a
Show file tree
Hide file tree
Showing 29 changed files with 2,893 additions and 239 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/android.changelog
Original file line number Diff line number Diff line change
@@ -1 +1 @@
etw
dbg
2 changes: 1 addition & 1 deletion .github/workflows/win_linux.changelog
Original file line number Diff line number Diff line change
@@ -1 +1 @@
x
desktop gl
8 changes: 8 additions & 0 deletions Q3E/src/main/jni/doom3/neo/framework/CVarSystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1381,3 +1381,11 @@ void idCVarSystemLocal::Restart_f(const idCmdArgs &args)
cvar->Reset();
}
}

void idCVar::SetReadonly(bool on)
{
if(on)
internalVar->flags |= CVAR_ROM;
else
internalVar->flags &= ~CVAR_ROM;
}
7 changes: 1 addition & 6 deletions Q3E/src/main/jni/doom3/neo/framework/CVarSystem.h
Original file line number Diff line number Diff line change
Expand Up @@ -200,12 +200,7 @@ class idCVar
internalVar = cvar;
}

void SetReadonly(bool on = true) {
if(on)
internalVar->flags |= CVAR_ROM;
else
internalVar->flags &= ~CVAR_ROM;
}
void SetReadonly(bool on = true);

static void RegisterStaticVars(void);

Expand Down
32 changes: 3 additions & 29 deletions Q3E/src/main/jni/doom3/neo/framework/Common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3263,36 +3263,10 @@ void idCommonLocal::Init(int argc, const char **argv, const char *cmdline)

// override cvars from command line
StartupVariable(NULL, false);
#ifdef _MULTITHREAD
#if !defined(__ANDROID__) //karin: enable multithreading-rendering from command cvar
multithreadActive = cvarSystem->GetCVarBool("harm_r_multithread");
if(multithreadActive)
Sys_Printf("[Harmattan]: Enable multi-threading rendering\n");
else
Sys_Printf("[Harmattan]: Disable multi-threading rendering\n");
#endif
#endif
#ifdef _OPENGLES3

#if !defined(__ANDROID__) //karin: check OpenGL version from command cvar
const char *openglVersion = cvarSystem->GetCVarString("harm_r_openglVersion");
if(openglVersion && openglVersion[0])
{
extern int gl_version;
extern bool USING_GLES3;
Sys_Printf("[Harmattan]: harm_r_openglVersion = %s\n", openglVersion);
if(!idStr::Icmp("GLES2", openglVersion))
{
gl_version = 0x00020000;
Sys_Printf("[Harmattan]: Using OpenGLES2\n");
}
else
{
gl_version = 0x00030000;
Sys_Printf("[Harmattan]: Using OpenGLES3\n");
}
USING_GLES3 = gl_version != 0x00020000;
}
#endif
extern void GLimp_Startup(void);
GLimp_Startup();
#endif

if (!idAsyncNetwork::serverDedicated.GetInteger() && Sys_AlreadyRunning()) {
Expand Down
2 changes: 2 additions & 0 deletions Q3E/src/main/jni/doom3/neo/framework/EditField.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -516,6 +516,7 @@ void idEditField::KeyDownEvent(int key)
ClearAutoComplete();
}

//karin: begin
// ctrl-v = paste
if (tolower(key) == 'v' && idKeyInput::IsDown(K_CTRL)) {
ClearAutoComplete();
Expand Down Expand Up @@ -567,6 +568,7 @@ void idEditField::KeyDownEvent(int key)
}
return;
}
//karin: end
}

/*
Expand Down
44 changes: 33 additions & 11 deletions Q3E/src/main/jni/doom3/neo/renderer/RenderSystem_init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,11 @@ static void R_CheckPortableExtensions(void)
} else
#endif
{
if (R_CheckExtension("GL_EXT_texture_compression_s3tc")&&r_useDXT.GetBool())
if (R_CheckExtension("GL_EXT_texture_compression_s3tc") && r_useDXT.GetBool()
#if !defined(__ANDROID__)
&& USING_GL
#endif
)
glConfig.textureCompressionAvailable = true;
else
glConfig.textureCompressionAvailable = false;
Expand Down Expand Up @@ -1113,12 +1117,35 @@ void R_ShowglConfig_f(const idCmdArgs &args)
return;
}

extern int gl_version;
idStr glVersionName;
switch(gl_version)
{
case GL_VERSION_GL_ES2:
glVersionName = "OpenGL ES2";
break;
#if !defined(__ANDROID__)
case GL_VERSION_GL_CORE:
glVersionName = "OpenGL Core";
break;
case GL_VERSION_GL_COMPATIBILITY:
glVersionName = "OpenGL Compatibility";
break;
#endif
case GL_VERSION_GL_ES3:
glVersionName = "OpenGL ES3";
break;
default:
#ifdef GL_ES_VERSION_3_0
if(USING_GLES3)
common->Printf("OpenGLES 3.0\n");
else
if(USING_GLES3)
glVersionName = "OpenGL ES3";
else
#endif
common->Printf("OpenGLES 2.0\n");
glVersionName = "OpenGL ES2";
break;
}

common->Printf("%s\n", glVersionName.c_str());

common->Printf("Renderer: %s\n", glConfig.renderer_string);
common->Printf("Version: %s\n", glConfig.version_string);
Expand Down Expand Up @@ -1182,12 +1209,7 @@ void R_ShowglConfig_f(const idCmdArgs &args)
common->Printf("r_usePackColorAsDepth: %d\n", r_usePackColorAsDepth);
#endif

#ifdef GL_ES_VERSION_3_0
if(USING_GLES3)
common->Printf("OpenGLES 3.0\n");
else
#endif
common->Printf("OpenGLES 2.0\n");
common->Printf("%s\n", glVersionName.c_str());
}

#ifdef _MULTITHREAD
Expand Down
Loading

0 comments on commit 1938c9a

Please sign in to comment.