Skip to content

Commit 9e8037b

Browse files
committed
Chnage GL_RENDERER and GL_VENDOR to show underlying hardware and driver (for #502)
1 parent 1d69dd6 commit 9e8037b

2 files changed

Lines changed: 23 additions & 2 deletions

File tree

src/gl/getter.c

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,11 @@ void BuildExtensionsList() {
239239
}
240240
}
241241

242+
static char renderer_string[128] = {0};
243+
static char vendor_string[128] = {0};
244+
extern char* gl4es_original_vendor;
245+
extern char* gl4es_original_renderer;
246+
242247
const GLubyte* APIENTRY_GL4ES gl4es_glGetString(GLenum name) {
243248
DBG(printf("glGetString(%s)\n", PrintEnum(name));)
244249
errorShim(GL_NO_ERROR);
@@ -249,9 +254,15 @@ const GLubyte* APIENTRY_GL4ES gl4es_glGetString(GLenum name) {
249254
BuildExtensionsList();
250255
return glstate->extensions;
251256
case GL_VENDOR:
252-
return (GLubyte *)"ptitSeb";
257+
if(!vendor_string[0]) {
258+
snprintf(vendor_string, 127, "GL4ES wrapping %s", gl4es_original_vendor?gl4es_original_vendor:"an unknown hardware");
259+
}
260+
return (GLubyte *)vendor_string;
253261
case GL_RENDERER:
254-
return (GLubyte *)"GL4ES wrapper";
262+
if(!renderer_string[0]) {
263+
snprintf(renderer_string, 127, "GL4ES using %s", gl4es_original_renderer?gl4es_original_renderer:"an unknown renderer");
264+
}
265+
return (GLubyte *)renderer_string;
255266
case GL_SHADING_LANGUAGE_VERSION:
256267
if(globals4es.gl==21)
257268
return (GLubyte *)"1.20 via gl4es";

src/glx/hardext.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ static int tested = 0;
1818

1919
hardext_t hardext = {0};
2020

21+
char* gl4es_original_vendor = NULL;
22+
char* gl4es_original_renderer = NULL;
23+
2124
static int testGLSL(const char* version, int uniformLoc) {
2225
// check if glsl 120 shaders are supported... by compiling one !
2326
LOAD_GLES2(glCreateShader);
@@ -420,6 +423,9 @@ void GetHardwareExtensions(int notest)
420423
// get GLES driver signatures...
421424
const char *vendor = (const char *) gles_glGetString(GL_VENDOR);
422425
SHUT_LOGD("Hardware vendor is %s\n", vendor);
426+
if(!gl4es_original_vendor) {
427+
gl4es_original_vendor = strdup(vendor);
428+
}
423429
if(strstr(vendor, "ARM"))
424430
hardext.vendor = VEND_ARM;
425431
else if(strstr(vendor, "Imagination Technologies"))
@@ -432,6 +438,10 @@ void GetHardwareExtensions(int notest)
432438
if(testGLSL("#version 310 es", 1))
433439
hardext.glsl310es = 1;
434440
}
441+
if(!gl4es_original_renderer) {
442+
const char* renderer = (const char *) gles_glGetString(GL_RENDERER);
443+
gl4es_original_renderer = strdup(renderer);
444+
}
435445
if(hardext.glsl120) {
436446
SHUT_LOGD("GLSL 120 supported and used\n");
437447
}

0 commit comments

Comments
 (0)