Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add support for TEGRA #449

Open
wmjb opened this issue Nov 15, 2023 · 4 comments
Open

add support for TEGRA #449

wmjb opened this issue Nov 15, 2023 · 4 comments

Comments

@wmjb
Copy link

wmjb commented Nov 15, 2023

trying to port this to tegra30/114 hardware. as far as i can tell the only difference is that tegra doesn't support 24 bit depth and 16 would need to be used instead. any idea how the code could be modified to suit?

@ptitSeb
Copy link
Owner

ptitSeb commented Nov 15, 2023

tegra doesn't have full opengl driver support?

@ptitSeb
Copy link
Owner

ptitSeb commented Nov 15, 2023

there must be code already in there to force 16bits depth, I'm pretty sure of this. Look around in the glx folder

@wmjb
Copy link
Author

wmjb commented Nov 15, 2023

thanks, manages to get it to go a bit further overriding the depth to 16, then it was crashing on the testGLSL function in glx/hardext.c to test the verion so i bypassed that as the tegra is on version 100. it's now finishing the load of the libGL and now i'm hitting this warning

LOGD("Warning, get_config_default: XGetVisualInfo gives 0 VisualInfo for %d depth and TrueColor class\n", glx_default_depth);

executing glxheads

LIBGL: v1.1.5 built on Nov 15 2023 04:01:10
LIBGL: Using GLES 2.0 backend
LIBGL: loaded: libGLESv2.so
LIBGL: loaded: libEGL.so
LIBGL: Using GLES 2.0 backend
LIBGL: Hardware Limited NPOT detected and used
LIBGL: FBO are in core, and so used
LIBGL: PointSprite are in core, and so used
LIBGL: CubeMap are in core, and so used
LIBGL: BlendColor is in core, and so used
LIBGL: Blend Subtract is in core, and so used
LIBGL: Blend Function and Equation Separation is in core, and so used
LIBGL: Texture Mirrored Repeat is in core, and so used
LIBGL: Extension GL_OES_mapbuffer  detected
LIBGL: Extension GL_OES_depth24  detected and used
LIBGL: Extension GL_OES_rgb8_rgba8  detected and used
LIBGL: Extension GL_EXT_texture_format_BGRA8888  detected and used
LIBGL: Extension GL_OES_depth_texture  detected and used
LIBGL: Extension GL_EXT_texture_rg  detected and used
LIBGL: Extension GL_OES_texture_half_float  detected and used
LIBGL: Extension GL_EXT_color_buffer_half_float  detected and used
LIBGL: Extension GL_EXT_frag_depth  detected and used
LIBGL: Max vertex attrib: 16
LIBGL: Extension GL_OES_standard_derivatives  detected and used
LIBGL: Max texture size: 4096
LIBGL: Max Varying Vector: 15
LIBGL: Texture Units: 16/16 (hardware: 16), Max lights: 8, Max planes: 6
LIBGL: Extension GL_EXT_texture_filter_anisotropic  detected and used
LIBGL: Max Anisotropic filtering: 15
LIBGL: Max Color Attachments: 1 / Draw buffers: 1
LIBGL: Hardware vendor is NVIDIA Corporation
LIBGL: EGLImage from Pixmap supported
LIBGL: EGLImage to Texture2D supported
LIBGL: EGLImage to RenderBuffer supported
LIBGL: Targeting OpenGL 2.1
LIBGL: Not forcing NPOT support
LIBGL: Not trying to batch small subsequent glDrawXXXX
LIBGL: try to use VBO
LIBGL: Force texture for Attachment color0 on FBO
LIBGL: Hack to trigger a SwapBuffers when a Full Framebuffer Blit on default FBO is done
LIBGL: glX Will try to recycle EGL Surface
LIBGL: Current folder is:/root/gl4es
LIBGL: Not using PSA (prgbin_n=0, notexarray=0)
glxheads: exercise multiple GLX connections (any key = exit)
Usage:
  glxheads xdisplayname ...
Example:
  glxheads :0 mars:0 venus:1
LIBGL: Warning, gl4es_glXChooseVisual: XGetVisualInfo gives 0 VisualInfo for 16 depth and TrueColor class
LIBGL: Shuting down
Error on display :0 - Unable to find RGB, double-buffered visual

@wmjb
Copy link
Author

wmjb commented Nov 17, 2023

this is the diff so far to get to that point. mayeb i've made some changes that don't make sense

index 0398a1b..dcdbd3a 100644
--- a/src/gl/init.c
+++ b/src/gl/init.c
@@ -473,7 +473,7 @@ void initialize_gl4es() {
           SHUT_LOGD("Avoid 24bits textures\n");
 	        break;
 	      default:
-          globals4es.avoid24bits = 0;
+          globals4es.avoid24bits = 2;
 	        break;
     	}
     }
@@ -754,3 +754,4 @@ void (*const gl4es_ctors[])() = { initialize_gl4es, dll_init_done };
 void (*const gl4es_dtor)() = close_gl4es;
 #pragma const_seg()
 #endif
+
diff --git a/src/glx/glx.c b/src/glx/glx.c
index 06dce28..7b25f79 100644
--- a/src/glx/glx.c
+++ b/src/glx/glx.c
@@ -61,7 +61,7 @@ static EGLContext eglContext  = EGL_NO_CONTEXT;
 static int maxEGLConfig = 0;
 static GLXFBConfig allFBConfig = NULL;
 #endif
-static int glx_default_depth=0;
+static int glx_default_depth=16;
 #ifdef PANDORA
 static struct sockaddr_un sun;
 static int sock = -2;
@@ -338,11 +338,11 @@ static int get_config_default(Display *display, int attribute, int *value) {
                 XVisualInfo *visuals = XGetVisualInfo(display, VisualDepthMask|VisualClassMask, &xvinfo, &n);
                 if (!n) {
                     LOGD("Warning, get_config_default: XGetVisualInfo gives 0 VisualInfo for %d depth and TrueColor class\n", glx_default_depth);
-                    *value = 0;
-                } else {
+                    // *value = 0;
+                } //else {
                     *value = visuals[0].visualid;
                     XFree(visuals);
-                }
+                //}
             }
             break;
         case GLX_FBCONFIG_ID:
@@ -416,7 +416,7 @@ static void fill1GLXFBConfig(Display *display, EGLConfig eglConfig, int DB, GLXF
     egl_eglGetConfigAttrib(eglDisplay, eglConfig, EGL_NATIVE_VISUAL_ID, &fbConfig->associatedVisualId);
     if(!fbConfig->associatedVisualId || globals4es.usefb || globals4es.usefbo || globals4es.usepbuffer) {
         // when using some FB driver, lets take a default VisualID, as the one from the EGLConfig is probably not the correct one
-        glx_default_depth = XDefaultDepth(display, 0);
+        glx_default_depth = 16;//XDefaultDepth(display, 0);
         XVisualInfo xvinfo = {0};
         xvinfo.depth = glx_default_depth;
         xvinfo.class = TrueColor;
@@ -1135,7 +1135,7 @@ XVisualInfo *gl4es_glXChooseVisual(Display *display,
         if(!ask_rgba)
             return NULL;    // only TrueColor profile...
     }
-    glx_default_depth = XDefaultDepth(display, screen);
+    glx_default_depth = 16;//XDefaultDepth(display, screen);
     if (glx_default_depth != 16 && glx_default_depth != 24  && glx_default_depth != 32)
         LOGD("unusual desktop color depth %d\n", glx_default_depth);
 
@@ -1147,7 +1147,7 @@ XVisualInfo *gl4es_glXChooseVisual(Display *display,
 #endif
 
     XVisualInfo xvinfo = {0};
-    xvinfo.depth = glx_default_depth;
+    xvinfo.depth = 16;//glx_default_depth;
     xvinfo.class = TrueColor;
     int n;
     XVisualInfo *visuals = XGetVisualInfo(display, VisualDepthMask|VisualClassMask, &xvinfo, &n);
@@ -2051,7 +2051,7 @@ XVisualInfo *gl4es_glXGetVisualFromFBConfig(Display *display, GLXFBConfig config
         g_display = XOpenDisplay(NULL);
     }*/
     if (glx_default_depth==0)
-        glx_default_depth = XDefaultDepth(display, 0);
+        glx_default_depth = 16; //XDefaultDepth(display, 0);
 
     int depth = glx_default_depth;
     /*if(config) {  // seems to upset Colin McRea Rally (Unity game)
diff --git a/src/glx/hardext.c b/src/glx/hardext.c
index 46e35bb..7ddd04b 100644
--- a/src/glx/hardext.c
+++ b/src/glx/hardext.c
@@ -424,14 +424,14 @@ void GetHardwareExtensions(int notest)
         hardext.vendor = VEND_ARM;
     else if(strstr(vendor, "Imagination Technologies"))
         hardext.vendor = VEND_IMGTEC;
-    if(hardext.esversion>1) {
-        if(testGLSL("#version 120", 1))
+//    if(hardext.esversion>1) {
+       // if(testGLSL("#version 100", 1))
             hardext.glsl120 = 1;
-        if(testGLSL("#version 300 es", 0))
-            hardext.glsl300es = 1;
-        if(testGLSL("#version 310 es", 1))
-            hardext.glsl310es = 1;
-    }
+       // if(testGLSL("#version 300 es", 0))
+         //   hardext.glsl300es = 1;
+   //     if(testGLSL("#version 310 es", 1))
+     //       hardext.glsl310es = 1;
+ //   }
     if(hardext.glsl120) {
         SHUT_LOGD("GLSL 120 supported and used\n");
     }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants