Kha icon indicating copy to clipboard operation
Kha copied to clipboard

textureSize not supported in Linux build

Open Domarius opened this issue 4 years ago • 4 comments

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:

  • Host system (where you compile your code): Windows or Linux
  • Target system (where you run your code): Windows or Linux
  • IDE used (if any): VSCode
  • Kha revision: Latest as of 15/03/2021
  • Kha build output (Using Kha...): (¯\_(ツ)_/¯) <--That is literally the version that shows up
  • Application output (if it runs):

Domarius avatar Mar 19 '21 04:03 Domarius

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

RobDangerous avatar Mar 19 '21 06:03 RobDangerous

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

Domarius avatar Mar 19 '21 07:03 Domarius

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.

Sanva avatar Mar 19 '21 09:03 Sanva

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

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

XANOZOID avatar Sep 08 '21 23:09 XANOZOID