gl4es icon indicating copy to clipboard operation
gl4es copied to clipboard

Shaders (Pojavlauncher Shaders development) only support one framebuffer

Open GFPCoder opened this issue 5 years ago • 20 comments

Shaders only support gl_FragData[0] to pass info to post-process (composite and final files). We need more than this for make basically all effects (even the most basic like torchlight need pass the lightmap using the gl_FragData[1]) and other like: Direct light (need pass normals using gl_FragData[2]), specular, Screen Space Reflections, SSAO,

ex: gl_FragData[1] gl_FragData[2] gl_FragData[3] gl_FragData[4]

Screenshot_2021-02-06-21-25-18-598_net kdt pojavlaunch

I made bloom, but I can't apply this to the image because we have only the gl_FragData[0] avaible to use.

sorry for my bad english.

GFPCoder avatar Feb 07 '21 00:02 GFPCoder

Any news pttitseb?a way to help us to use shaders on minecraft java for android(pojavlauncher )?

pedrosouzabrasil avatar Feb 08 '21 21:02 pedrosouzabrasil

Not yet. I haven't checked that. The multiple FragData is not supported on default gles2, it needs an extension, but I suppose the extension needs to be activated in the shader. But again, I haven't checked yet.

ptitSeb avatar Feb 08 '21 22:02 ptitSeb

So we're still waiting for GLES 3.0, 3.1 or even 3.2 to have a huge speed boost. And more things.

RusJJ avatar Feb 13 '21 11:02 RusJJ

Not yet. I haven't checked that. The multiple FragData is not supported on default gles2, it needs an extension, but I suppose the extension needs to be activated in the shader. But again, I haven't checked yet.

I hope we can receive this update soon for make shaders. Also I find another error, we can't use alpha channel of colored shadows sampler.

GFPCoder avatar Feb 13 '21 12:02 GFPCoder

I closed this by accident, I'm learning how use github sorry.

GFPCoder avatar Feb 13 '21 12:02 GFPCoder

@ptitSeb So, seems like this extension is in core of OpenGL ES 3... And that's why it's not listed on most devices. Maybe add a check for it? Or an env var that the user can set?

artdeell avatar Feb 16 '21 03:02 artdeell

So, seems like this extension is in core of OpenGL ES 3...

GL_EXT_draw_buffers are for ES2 and supported by default in ES3 (not under extension type),so I added some checks to ignore checking GL_EXT_draw_buffers if LIBGL_ES=3

diff --git a/src/glx/hardext.c b/src/glx/hardext.c
index 34eb767..5b763e6 100644
--- a/src/glx/hardext.c
+++ b/src/glx/hardext.c
@@ -257,6 +257,10 @@ void GetHardwareExtensions(int notest)
     }
     S("GL_EXT_blend_minmax ", blendminmax, 1);
     S("GL_EXT_draw_buffers ", drawbuffers, 1);
+    if (hardext.esversion == 3) {
+        SHUT_LOGD("Extension GL_EXT_draw_buffers is in core ES3, and so used\n");
+        hardext.drawbuffers = 1;
+    }
     /*if(hardext.blendcolor==0) {
         // try by just loading the function
         LOAD_GLES_OR_OES(glBlendColor);

I'm unsure if it works...

khanhduytran0 avatar Feb 17 '21 06:02 khanhduytran0

gl4es doesn't support ES3 yet. As I wrote before, the issue is in a shader, the extension probably need to be declared in shader header in ES2 (but not in ES3 probably).

ptitSeb avatar Feb 17 '21 07:02 ptitSeb

gl4es doesn't support ES3 yet.

But gl4es supports GLSL ES 300+ right? So, he can use gl_FragData[n] without #extension enable... (EDIT: the one he tested is from ES2 context)

khanhduytran0 avatar Feb 17 '21 22:02 khanhduytran0

So, according to this https://github.com/ptitSeb/gl4es/issues/268#issuecomment-762309029 and enabled LIBGL_DBGSHADERCONV, the converted is always #version 100. Maybe another patch that will detect GLES3 context and use GLSL ES 3.x :eyes: But I’m wondering why? While GL4ES prints LIBGL: GLSL 3xx es supported and used but only GLSL 1.00 is being used.

khanhduytran0 avatar Mar 02 '21 13:03 khanhduytran0

@ptitSeb please don’t ignore this.

https://github.com/ptitSeb/gl4es/blob/b1928320bd353f10d92718965c0f885edb132b31/src/gl/shaderconv.c#L495 This check is never true, since versionString is always NULL or empty, even #version 120 is defined.

Also, https://github.com/ptitSeb/gl4es/blob/b1928320bd353f10d92718965c0f885edb132b31/src/gl/shaderconv.c#L288-L289 GLSL version code stick with es, this will cause compile error (but I haven’t seen any report because 1st check is always false).

khanhduytran0 avatar Mar 02 '21 23:03 khanhduytran0

@kvazar-git shut up

AjGamingPHOfficial avatar Mar 02 '21 23:03 AjGamingPHOfficial

@kvazar-git shut up

Emm...?

QuasyStellar avatar Mar 03 '21 04:03 QuasyStellar

@ptitSeb please don’t ignore this.

https://github.com/ptitSeb/gl4es/blob/b1928320bd353f10d92718965c0f885edb132b31/src/gl/shaderconv.c#L495

This check is never true, since versionString is always NULL or empty, even #version 120 is defined.

Is it? That's strange. I need to debug this. "preproc" is supposed to fill in this one.

Also, https://github.com/ptitSeb/gl4es/blob/b1928320bd353f10d92718965c0f885edb132b31/src/gl/shaderconv.c#L288-L289

GLSL version code stick with es, this will cause compile error (but I haven’t seen any report because 1st check is always false).

Correct. I'll fix that when I found the empty "versionString" issue.

ptitSeb avatar Mar 03 '21 07:03 ptitSeb

ok @khanhduytran0 the version detection should be fixed, and using higher GLSL version number should work now. That may help a few issue.

ptitSeb avatar Mar 03 '21 07:03 ptitSeb

Shaders only support gl_FragData[0] to pass info to post-process (composite and final files). We need more than this for make basically all effects (even the most basic like torchlight need pass the lightmap using the gl_FragData[1]) and other like: Direct light (need pass normals using gl_FragData[2]), specular, Screen Space Reflections, SSAO,

ex: gl_FragData[1] gl_FragData[2] gl_FragData[3] gl_FragData[4]

Screenshot_2021-02-06-21-25-18-598_net kdt pojavlaunch

I made bloom, but I can't apply this to the image because we have only the gl_FragData[0] avaible to use.

sorry for my bad english.

Link to the shaders

WesleyVanNeck avatar Mar 03 '21 09:03 WesleyVanNeck

So, seems like this extension is in core of OpenGL ES 3...

GL_EXT_draw_buffers are for ES2 and supported by default in ES3 (not under extension type),so I added some checks to ignore checking GL_EXT_draw_buffers if LIBGL_ES=3

diff --git a/src/glx/hardext.c b/src/glx/hardext.c
index 34eb767..5b763e6 100644
--- a/src/glx/hardext.c
+++ b/src/glx/hardext.c
@@ -257,6 +257,10 @@ void GetHardwareExtensions(int notest)
     }
     S("GL_EXT_blend_minmax ", blendminmax, 1);
     S("GL_EXT_draw_buffers ", drawbuffers, 1);
+    if (hardext.esversion == 3) {
+        SHUT_LOGD("Extension GL_EXT_draw_buffers is in core ES3, and so used\n");
+        hardext.drawbuffers = 1;
+    }
     /*if(hardext.blendcolor==0) {
         // try by just loading the function
         LOAD_GLES_OR_OES(glBlendColor);

I'm unsure if it works...

I works, but ES3.0 context is not supported in gl4es yet. so hardext.esversion is never more than 2 for now.

ptitSeb avatar Mar 05 '21 07:03 ptitSeb

Mhm so u all are talking about shaders can i be a part of this conversation

ghost avatar Mar 06 '21 09:03 ghost

I saw that you’ve reverted it :( actually gl_FragData is not easy to emulate to layout qualifiers?

khanhduytran0 avatar Mar 11 '21 10:03 khanhduytran0

It should be fairly easy, but still, it's not automatique and need some adaptations in shaderconv.

ptitSeb avatar Mar 11 '21 15:03 ptitSeb