Closed mittorn closed 4 years ago
Changing format to GL_RGBA fixed decals in VBO renderer, but not in legacy renderer and not fixed fonts. Alpha test seems broken somewhere too
I need to try it at home. I may have broken a conversion somehow, and the intermediary format is not correct in the end. What is the internal and external format used for it? (that's an impressive list of extension, AMD Raven?)
https://github.com/FWGS/xash3d-fwgs/blob/master/ref_gl/gl_rsurf.c#L2361 - vbo decal render (works after setting GL_RGBA) https://github.com/FWGS/xash3d-fwgs/blob/master/ref_gl/gl_decals.c#L883 - legacy decal code (GL_RGBA does not help, black quads) https://github.com/FWGS/xash3d-fwgs/blob/master/ref_gl/gl_image.c#L717 - internal format selection format is usually GL_RGBA. imagelib unpacks all uncompressed textures to RGBA and hopes that driver will convert it. On all gles targets texture format selection was not used before (bits=0) and set as internalformat=format at wrapper side (causing bugs with menu buttons and hud with holes), but now it helps only for decals fonts and sprites enables ALPHA_TEST with rendermode switch, non-monochrome sprites and alpha-tested world geometry seems draw correctly
As we do not have any texture converters in gl-wes-v2/nanogl, we use internalformat=format everywhere and if required internalformat does not have alpha, set alpha to 0xFF in TexImage wrapper, it solves bugs with hud holes and menu buttons
I have to test that, and make some traces. Format L8A8 should be supported by gl4es.
Also, decal code in XashXT renderer renders nothing: https://github.com/FWGS/xashxt-fwgs/blob/master/client/render/r_brushdecals.cpp#L109 but i do not know if vertex attribs in glBegin even supported and first, need to fix texturre and alpha test issues
Oh no, glVertexAttribXX inside glBegin() / glEnd() is not supported. Adding support for that doesn't seems easy. I'll think about it.
I'll rewrite this code to DrawArrays. There is no reason to keep glBegin/glEnd here. And maybe need to move decals to VBO like in engine vbo render, as it does not change between frames
in r_showtextures decals are solid squares too and not only L8 affected, so it is separate bug Also, screen depth texture seems to copy screen image. Is it possible to read depth in gles?
decals:
[21:18:08] 801: 48 48 11.99 Kb RGBA 2D diffuse default clamp 1 {blood2
[21:18:08] 802: 96 96 47.99 Kb RGBA 2D diffuse default clamp 1 {scorch2
[21:18:08] 803: 16 16 1.33 Kb RGBA 2D diffuse default clamp 1 {shot4
[21:18:08] 804: 16 16 1.33 Kb RGBA 2D diffuse default clamp 1 {shot5
[21:18:08] 805: 16 16 1.33 Kb RGBA 2D diffuse default clamp 1 {shot1
[21:18:08] 806: 16 16 1.33 Kb RGBA 2D diffuse default clamp 1 {shot2
[21:18:08] 807: 16 16 1.33 Kb RGBA 2D diffuse default clamp 1 {shot3
[21:18:08] 808: 48 48 11.99 Kb RGBA 2D diffuse default clamp 1 {blood3
[21:18:08] 809: 32 32 5.33 Kb RGBA 2D diffuse default clamp 1 {yblood5
[21:18:08] 810: 32 32 5.33 Kb RGBA 2D diffuse default clamp 1 {yblood4
[21:18:08] 811: 48 48 11.99 Kb RGBA 2D diffuse default clamp 1 {yblood1
[21:18:08] 812: 16 16 1.33 Kb RGBA 2D diffuse default clamp 1 {yblood6
[21:18:08] 813: 48 48 11.99 Kb RGBA 2D diffuse default clamp 1 {blood1
[21:18:08] 814: 64 64 21.33 Kb RGBA 2D diffuse default clamp 1 {blood5
sprites that are working correctly:
[21:18:08] 778: 64 64 16.00 Kb RGB 2D diffuse default repeat 1 #sprites/muzzleflash1(frame:00).spr
[21:18:08] 779: 64 64 16.00 Kb RGB 2D diffuse default repeat 1 #sprites/muzzleflash1(frame:01).spr
[21:18:08] 780: 256 256 341.33 Kb RGBA 2D diffuse default repeat 1 #HUD/sprites/640hud3(frame:00).spr
[21:18:08] 781: 256 128 170.67 Kb RGBA 2D diffuse default repeat 1 #HUD/sprites/640hud7(frame:00).spr
[21:18:08] 782: 256 64 85.34 Kb RGBA 2D diffuse default repeat 1 #HUD/sprites/640hud8(frame:00).spr
[21:18:08] 783: 256 64 85.34 Kb RGBA 2D diffuse default repeat 1 #HUD/sprites/640hud9(frame:00).spr
[21:18:08] 784: 256 256 341.33 Kb RGBA 2D diffuse default repeat 1 #HUD/sprites/640hud5(frame:00).spr
seems that clamp is broken
It is after enabling 16TMU before enabling it:
[01:52:42] GL_MAX_TEXTURE_SIZE: 16384
[01:52:42] GL_MAX_TEXTURE_UNITS_ARB: 8
[01:52:42] GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB: 16384
[01:52:42] GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT: 16.0
[01:52:42] GL_MAX_RECTANGLE_TEXTURE_SIZE: 16384
[01:52:42] GL_MAX_TEXTURE_COORDS_ARB: 8
[01:52:42] GL_MAX_TEXTURE_IMAGE_UNITS_ARB: 8
[01:52:42] GL_MAX_VERTEX_UNIFORM_COMPONENTS_ARB: 16384
[01:52:42] GL_MAX_VERTEX_ATTRIBS_ARB: 16
[01:52:42]
After:
[01:51:12] GL_MAX_TEXTURE_SIZE: 16384
[01:51:12] GL_MAX_TEXTURE_UNITS_ARB: 16
[01:51:12] GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB: 16384
[01:51:12] GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT: 16.0
[01:51:12] GL_MAX_RECTANGLE_TEXTURE_SIZE: 16384
[01:51:12] GL_MAX_TEXTURE_COORDS_ARB: 16
[01:51:12] GL_MAX_TEXTURE_IMAGE_UNITS_ARB: 16
[01:51:12] GL_MAX_VERTEX_UNIFORM_COMPONENTS_ARB: 16384
[01:51:12] GL_MAX_VERTEX_ATTRIBS_ARB: 16
[01:51:12]
Before this commit decals/sprites/fonts works correctly
Ah ok. So there is a bug that is left somewhere.
Can you try something?
Using latest sources, in src/hardext.c
, ca you change lines 330-331 from
if(hardext.maxtex>MAX_TEX) hardext.maxtex=MAX_TEX; // caping, as there are some fixed-sized array...
if(hardext.maxteximage>MAX_TEX) hardext.maxteximage=MAX_TEX;
to
if(hardext.maxtex>8) hardext.maxtex=8; // caping, as there are some fixed-sized array...
if(hardext.maxteximage>8) hardext.maxteximage=8;
I guess it will not work, but that's just to be sure.
No, it does not help. It seems not bug in tmu detection, but somewhere in tmu code or data structures in fpe
Yeah, it's some flags of the fpe structure I guess. I'll try to reproduce on my side.
Changing MAX_TEX to 8 seems to fix it
Oh, so maybe I forgot to resize a structure somewhere!
I couldn't reproduce the issue on the Pandora, using latest xash3d code... I'll try tomorow on other platform if I can.
In the mean time, I tried, blindly, a potential fix with commit 1e7e87e726a9bc8f582312ff90385aee26f6dba7 , if you can try it...
About reading depth: most GLES hardware (at least until GLES2) doesn't let read depth. It seems your hardware support it with GL_NV_read_depth, but it seems to have some restrictions (and gl4es doesn't enforce them for now: I'll add that to my TODO).
no, still black font backgrounds
I have changed again the FPE flags, but I'm still unable to reproduce the issue.
Can you use "LIBGL_DBGSHADERCONV=1" to get all shader generated, and try to isolate the one used in font drawing (not an easy task), and put fragment shader here?
It is FPE, not shaderconv as happens in pure xash3d (not xashxt mod) without any shaders. Latest commit helped
Ah it's fixed, great ! Now I'm just missing the glVertexAttribXX things inside glBegin(...) / glEnd(). I'll work on that soon.
I rewrited this code to VAO. And rewrited postprocess code depth texture usage too, it uses FBO instead of texture copy now and shows. XashXT seems to fully work on mesa (except of features using texture arrays), but i have not tested on mobile device. Need to implement API to pass gl4es from engine renderer to mod renderer, it exist now, but not implemented correctly on engine side
postprocessing (sunshafts effect) and 3d sky
Is it possible to get original gl vendor and extensions with gl4es?
Oh, wow, that look nice! Looks like some HDR effect like in latest HalfLife2 Lost Coast episode!
Is it possible to get original gl vendor and extensions with gl4es?
For now, there is no mecanism, but I can think of something, some pass-through mecanism in glGetString(...)
, using special GL_XXXX constants.
Maybe add somethink like GL_GL4ES_GL_VENDOR? Or any api that returns unwrapped glGetString?
What about glGetString(GL_VENDOR | 0x10000)
and glGetString(GL_EXTENSIONS | 0x10000)
, with also those GL_GL4ES_VENDOR and GL_GL4ES_EXTENSIONS defined in "gl4eshint.h" ?
Ok, more like:
#define GL_VENDOR_GL4ES (GL_VENDOR | 0x10000)
#define GL_EXTENSIONS_GL4ES (GL_EXTENSIONS | 0x10000)
For consistancy
seems to be ok user may request this only if detected gl4es as GL_VENDOR. I want to add extra lines to r_info command command to allow testers collect all data by single command
yeah sure, seems handy.
Ok, done and pushed... using GL_VERSION | 0x10000 you can also query the version of the GLES2 driver...
Thank you
Affected fonts and decals (texture loader detects monochrome textures automatically), decals just turns black, fonts have solid background