DEADSOFTWARE

gl: do not used max bound texture size automatically
authorDeaDDooMER <deaddoomer@deadsoftware.ru>
Sun, 19 Feb 2023 23:18:38 +0000 (02:18 +0300)
committerDeaDDooMER <deaddoomer@deadsoftware.ru>
Fri, 9 Jun 2023 09:18:56 +0000 (12:18 +0300)
src/game/renders/opengl/r_render.pas
src/game/renders/opengl/r_textures.pas

index 88c507977fe20c58463e93d20fa9c0e37fd1803f..76adb8ed193901f5252b8083e80ae280c89da652 100644 (file)
@@ -216,12 +216,16 @@ implementation
 {$ENDIF}
 
   procedure r_Render_LogGLInfo;
+    var size: GLint;
   begin
+    size := 0;
+    glGetIntegerv(GL_MAX_TEXTURE_SIZE, @size);
     e_LogWritefln('GL Vendor: %s', [glGetString(GL_VENDOR)]);
     e_LogWritefln('GL Renderer: %s', [glGetString(GL_RENDERER)]);
     e_LogWritefln('GL Version: %s', [glGetString(GL_VERSION)]);
     e_LogWritefln('GL Shaders: %s', [glGetString(GL_SHADING_LANGUAGE_VERSION)]);
     e_LogWritefln('GL Extensions: %s', [glGetString(GL_EXTENSIONS)]);
+    e_LogWritefln('GL Texture: %s', [size]);
   end;
 
   procedure r_Render_Initialize;
index 97d572c5776b02fac7f16af63070b832cc4933c0..56d2656c8c17e0e556e70e8525fc06e7e718537e 100644 (file)
@@ -465,7 +465,8 @@ implementation
     begin
       // auto, max possible reccomended by driver
       glGetIntegerv(GL_MAX_TEXTURE_SIZE, @size);
-      if size < 1 then size := 64;
+      size := size div 2; (* hack: on some devices max size may produce invalid texture *)
+      if size < 64 then size := 64; (* at least 64x64 are guarantied by specification *)
     end
     else
     begin
@@ -482,7 +483,7 @@ implementation
   begin
     currentTexture2D := 0;
     maxTileSize := r_Textures_GetMaxHardwareSize();
-    e_LogWritefln('TEXTURE SIZE: %s', [maxTileSize]);
+    e_LogWritefln('Texture Tile Size: %s', [maxTileSize]);
   end;
 
   procedure r_Textures_Finalize;