-
-
Notifications
You must be signed in to change notification settings - Fork 205
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
[axmol-2.0] Support GLES3/OpenGL3 #1279
Comments
Remove glsl-optimizer please at the final step. Really, it is not good that axmol does not support glsl 1.0 at all. Is there some other game engine that supports only glsl 3.0 specification? Why such limitation? |
@solan-solan I don't think we're dropping support for gles 1.0 , just creating a new version of the engine that supports gles 3.0, if you want to migrate right away just pick the gles 1.0 version, otherwise you have to manually change your project to work with gles 3.0 |
@DelinWorks @halx99 |
The glslcc use spirv-cross decompile spirv-bytecode to MSL(metal), ESSL300(GLES), GLSL330(OpenGL) |
glslcc compile workflow: input shader(ESSL310/GLSL450)
--> spirv byte code
--> MSL for ios/macos/tvos
--> ESSL300 for GLES3
--> GLSL330 for DesktopGL |
Any chance you can show an example of your current usage related to macros and shaders? |
You can still use defines in your shaders, then you can pass your shader as a custom shader and it will be compiled as a user shader WITH your defines set by the C compiler. use |
@DelinWorks @halx99 @rh101 |
That would be good. I was just curious to know how you were using the shaders with macros in order to understand why it would be an issue to move to the new shaders. |
I was confused with compile word. Looks like defines could be stored to spir-v intermediate language, and no issue exists. Ok I will attach this shader in discussion a little later when will be near pc. |
do you know how to do? |
currently compiled shaders not contains any preprocesser checks, I don't know how to reserve |
Looking through the glslcc usage docs, there is this command line argument:
Doesn't that apply to the input shader file? The output file would be the result of whatever the result of the defines is. Is that how it works? For example, input shader would have a section like this:
If @solan-solan is this what you require? |
@halx99
This argument will be applied in build time anyway. I do not know which shaders I need in build time. These data's should be parsed from json according to my architecture. Think please to save old shader approach equally with new one. Shader compiling does not touch performance. It all have affect just while init application |
You mention that you do not know what shaders to use at build time, but I don't see that as a problem at all. If all shaders exist with the application, then at runtime you select which one to use based on some condition (for instance, your json data). Isn't this what you need? If that is not what you mean, then I will wait till you show an example of this so I can understand what is going on. I do now notice in your previous post where you mention that you "construct" the shader at runtime, but I've never seen this use case at all. Is this something that is commonly done? Is there any reason why you cannot provide all the shader combinations at build time, and then select which one you need at runtime? |
@rh101 Really no complaints) It is everything up to you, but your change killed one of use cases.
I do not know.
There are many different settings in my shaders, and many different models with many different settings. It is general system which supposed to be extended, and controlled with json to simplify certain shader creation. |
why not use uniforms? |
maybe you mean @DelinWorks? ) |
@DelinWorks |
then I don't see why @rh101 suggestion doesn't work out for you. You're effectively combining shaders into a single file, why not make a shader do one thing and load them at runtime based on what you need since now you don't have to write a shader for each platform you can just make shaders like wind1.frag wind2.frag wind3.frag that are written in gles 310 compliant shader code and that's it. |
although I do agree with you with branching being bad in gpus, I think that splitting them is way better, but doesn't glslcc support define that @rh101 found out? maybe it could be easy to implement. |
If I have five light sources on the third level and so on?
Effectively combine - is restriction for game design and implementation approach. Imho And now I do not need to write shader for each platform also. It is not understandable why this well tested feature should be removed |
The following is just a suggestion: Is it at all possible to modify this to add a sub-directory to the shader file lookup? What I mean is that the converted shaders would be stored in This way the filenames would not pollute the root search path, and it also makes it easier to override existing shaders at runtime. For example, if all shaders exist in First, app creates directory in the write path (let's say it's called "dlc" for downloadable content, with a "shaders" sub-dir in it), and then we download a new file named Next the app calls This way, when code tries to load This is actually more for custom shaders than the default shaders contained in Axmol. It saves us from forcing the user to download an entirely new release (APK/Installer etc) just to update a few resources, since the app can do it at runtime by using downloadable content. I realise this can be done without the |
The user can download shader files to writeablepath/any-folder-name, and add it to front searchpaths |
I understand, so all shaders will be referenced at root level as |
builtin shaders use root level, app shaders can be relative path, no limitation |
That would be good! |
done by: ac073ee |
FYI |
Released
UPDATE
GLES3/OpenGL3 support was moved to milestone 2.0, and still support GLES2.0 for old android device and android simulator marketplace of china
workflow
ESSL 310
orGLSL 450
project_root/Source/shaders
, default shader file extensions: vertex(.vert, .vsh), fragment(.frag, .fsh)glscc
compiling filesglscc
compile source shaders to target platforms: Desktop GL(GLSL330
), GLES3(ESSL300
), GLES2(GLSL100
), Apple Metal(MSL
)${CMAKE_BINARY_DIR}/runtime/axslc
) to target appapp_res_root/axslc
, andapp_res_root/axslc
will be added to search path by engine FileUtils implementation.app_res_root/axslc
by shader name.checklist
axmolengine/glslcc
1.9.0 by @halx99AXGLSLCC.cmake
cmake tool by @halx99amol-migrate-1.1
by @delin and @halx99, because glslcc(spirv-cross) only accept ESSL310 or GLSL450 as input shader.GLES
loader toglad
for auto loading GLES3 APIs , i.e.glDrawElementsInstanced
glsl-optimizer
can be removed, and it's not support compile essl 3.1 to msl, not compatible with new shader workflow.${CMAKE_BINARY_DIR}/runtime/axslc
to apps by @halx99draft works
, waiting cmake patch by @halx99 to be merge bykitware
ProgramManager
support load cusom shader program immediately and improve register mechanismCompatibility
main
is thelts
for 1.0.x currently. even through, we want merge dev in to main in the future, but before that, we will create alts
branch1.0.x
New shader looks like
vertex shader:
fragment shader:
Notes
Shader syntax migrate summary
#version 310 es
in headerattribute
in vertex shader change toin
varying
in vertex shader change toout
varying
in fragment shader change toin
gl_FragColor
need replaced by a definedout
vec4 variable in fragment shaderShader restrict or recommands
performance preview (release build)
axmol-dev:
axmol-main:
cocos2dx-3.17.1
The text was updated successfully, but these errors were encountered: