Kode / Kha

Ultra-portable, high performance, open source multimedia framework.
http://kha.tech
zlib License
1.49k stars 174 forks source link

textureSize not supported in Linux build #1310

Open Domarius opened 3 years ago

Domarius commented 3 years ago

Describe the bug A fragment shader will fail to run in Linux (full build) if the shader uses "textureSize" anywhere in its code. The same shader will work fine in WebGL or Windows.

This is a follow up to #1308 after I worked out what was going on.

Notes from Rob: textureSize does indeed not work on older glsl versions, see https://www.khronos.org/registry/OpenGL-Refpages/gl4/html/textureSize.xhtml And for Linux we default to a very early version... because Linux and its horrible graphics drivers situation. I'll put in a warning for this, this should not silently fail. We could actually put in a workaround for systems which do not support it directly, will think about it.

To Reproduce Running the attached project shows 2 squares - the lefthand square uses a shader that uses "textureSize", it has 4 colours in it that change when you press the number keys. The righthand square is an image that uses the default shader, and doesn't use "textureSize".

Steps to reproduce the behavior:

  1. Download example project TextureSample.zip
  2. Run the project with F5
  3. Press keys 1,2,3,4 to change the colours on the lefthand square.
  4. Build the project for Linux (full build)
  5. Run the Linux build, and see that the coloured squares are missing.

Expected behavior The colours should still show as they do in the F5 WebGL preview, and Windows (full build),

Screenshots Correct output when viewed as WebGL or Windows (full build) image Incorrect output when viewed as Linux (full build) image

Execution Environment:

RobDangerous commented 3 years ago

Oh no, you are still on Kha revision ¯\(ツ)

Domarius commented 3 years ago

Yeah that's when the vscode plugin one runs. I will try cloning Kha into the sample project.

Sanva commented 3 years ago

Looks similar to #1302 — I have the same problem as you compiling your example for Linux. It works if you add --shaderversion 330 to the build command.

XANOZOID commented 3 years ago

Oh no, you are still on Kha revision ¯_(ツ)_/¯

Fixed that here: https://github.com/Kode/khamake/pull/250