Skip to content

GitLab

  • Menu
Projects Groups Snippets
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
    • Switch to GitLab Next
  • Sign in / Register
  • solarus solarus
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 222
    • Issues 222
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
    • Requirements
  • Merge requests 8
    • Merge requests 8
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
    • Test Cases
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Packages & Registries
    • Packages & Registries
    • Package Registry
    • Container Registry
    • Infrastructure Registry
  • Analytics
    • Analytics
    • CI/CD
    • Code review
    • Insights
    • Issue
    • Repository
    • Value stream
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Solarus Games
  • solarussolarus
  • Issues
  • #394

Closed
Open
Created Jan 05, 2014 by Christopho@christophoOwner

Shaders implementation

Created by: vlag

I open this issue to keep a trace of some informations, and because we should discuss some point before fully implement shaders. This is also the last part to let the display fully handled by the GPU.

Since shader filter for the SDL_Texture's GL_TEXTURE_RECTANGLE_ARB encapsulation is implemented, I discovered some very interesting features and projects.

So firstly, we still need to support GL_TEXTURE_2D on the engine side too (GL ES seems to not support GL_ARB). I opened this thread on the SDL forum to be able to get the encapsulated texture type by the current SDL way (and then be sure that the specific code will never be broken). I opened it on the bug tracker too.

This also means that there is a hope to have a reliable shader abstraction on the user side. Here is some interesting projects to cross-compile shaders :

  • MojoShader , currently used in Unity (mercurial).
  • hlsl2glsl (fork) , was used in Unity 3.0 (github page).
  • HLSLCrossCompiler.
  • Angle , a GLSL to HLSL Cross compiler, used in SDL2.

On another hand, some projects like the Love2D framework use a few language abstraction for driver and sampler-specific calls. I don't know if it's reliable, especially to handle HLSL shaders, but it should be enough to write GL and GLES shaders without manually handle the driver, sampler and language version in the script, and then avoid some technical issues.

To finish, here is a GLSL optimizer, used in Unity too (github page).

I know shader implementation is not prioritary, especially not the user abstraction, so I just open this issue to not forget ;)


Edit : Point to clarify before going further with the shader system :

  • Implement GLES and HLSL, or discuss about implementing an abstraction shader feature (probably a third party lib).
  • How to pass Textures to the renderer (one render by layer to allow a different shader by layer, one render for the whole frame, one render for the map and another for the HUD) ?
  • Parameters to share between engine and shader scripts (or make the shader class exportable to lua to let the decision to quest makers ?).
  • How to handle shader files and structure (keep one big lua file or separate into 3 files, make shader class exportable to lua, still list shader files dynamically ?).
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking