Skip to content
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

Shader fails on Linux (full build) but not WebGL or Windows (full build) #1308

Closed
Domarius opened this issue Mar 15, 2021 · 6 comments
Closed

Comments

@Domarius
Copy link

Domarius commented Mar 15, 2021

Describe the bug
A fragment shader which works on WebGL and Windows full build, fails to work on Linux full build.

In both attached sample projects, a quad is drawn with a shader that replaces colours in the original image (paltest.png) with colours from the palette image (paltest_pal.png) by using the Red channel value from the original image as a X position, and the "palette index" as the Y position. So each row of pixels in the texture is a different "palette" that can be applied to the original image.

And then another quad is drawn using a standard shader and image, which works fine on Linux in either case.

To Reproduce
Steps to reproduce the behavior:

  1. Extract the attached sample project, and clone Kha into the empty Kha subfolder.
    Linux shader fail.zip (Uses a modified version of Graphics2)
    TextureSample.zip (Simpler example, based off Texture sample project)
  2. Run the project with F5
  3. Press keys 1,2,3,4 to change the colours on the lefthand square, and 5,6,7,8 to change colours on the righthand square.
  4. Build the project for Linux (full build)
  5. Run the Linux build, and see that the coloured squares now show up as black squares on the red background and do not change colours when pressing the number keys. Also note that the squares seem to be drawn at a lower position than they should be.

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

Screenshots
What's interesting is in these screenshots from the "Linux Shader Fail.zip" project, the affected quads seem to have moved down from their proper positions.

Linux shader fail.zip
Correct output when viewed as WebGL or Windows (full build)
image
Incorrect output when viewed as Linux (full build)
image

TextureSample.zip
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):
@sh-dave
Copy link
Contributor

sh-dave commented Mar 15, 2021

Hm, is this maybe a rendertarget issue with inverted y coordinates seeing that the quads are also displaced?

@Project-Magenta
Copy link

(unrelated, but your shrug has lost an arm. please escape the first arm)

@Domarius
Copy link
Author

(unrelated, but your shrug has lost an arm. please escape the first arm)

Fixed - also it's Rob's shrug, not mine! That's the current Kha version in the output...

@RobDangerous
Copy link
Member

That means it can not read the Git revision - which is not a good sign (but likely unrelated to the rendering problem).

@Domarius
Copy link
Author

Since the default shader still works, it's worth pointing out one major difference between my shader and the default shader is I introduce a 2nd texture as a uniform variable.

@Domarius
Copy link
Author

Closing this issue in favour of the new one I just created, #1310

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants