Kode/Kha

[HL] Matrix uniforms are incorrectly transposed

MoritzBrueckner opened this issue · 0 comments

Describe the bug
On HL, matrix uniforms are (incorrectly) transposed when passed to the shader. For example the projectionMatrix uniform used for 2D drawing will result in a broken visual output on HL:

HL

How it should look like:

Screenshot

Note that in the first screenshot I also removed the translation transform from the default project to see whether it was the reason for the problem. It isn't, but if you keep it enabled, the distorted shape will of course look slightly different.

To Reproduce
Steps to reproduce the behavior:

  1. Use Kha: Init Project in VSCode to create the default example project
  2. Kha/make windows-hl
  3. Compare with other targets

It doesn't make a difference whether you use D3D11 or OpenGL.

The projection matrix uniform in hxcpp:
grafik

The projection matrix uniform in HL:
grafik

Execution Environment:

  • Host system (where you compile your code): Windows 10
  • Target system (where you run your code): Windows 10
  • IDE used (if any): VSCodium
  • Kha revision: e700b11
  • Kha build output (Using Kha...):
    > Kha\make windows-hl --debug
    Using Kha (e700b11f) from [...]\Kha
    Creating Kha project.
    Compiling shader 1 of 8 (painter-colored.frag.glsl).
    Compiling shader 2 of 8 (painter-colored.vert.glsl).
    Compiling shader 3 of 8 (painter-image.frag.glsl).
    Compiling shader 4 of 8 (painter-image.vert.glsl).
    Compiling shader 5 of 8 (painter-text.frag.glsl).
    Compiling shader 6 of 8 (painter-text.vert.glsl).
    Compiling shader 7 of 8 (painter-video.frag.glsl).
    Compiling shader 8 of 8 (painter-video.vert.glsl).
    Using Kinc (d6d8b1e1) from [...]\Kha\Kinc
    kfile found.
    Creating Windows project files.
    Done.
    Done.
    
  • Application output (if it runs):
    Nothing special apart from a big wall of D3D11 warnings that exist since ages (excerpt):
    D3D11 WARNING: Live Producer at 0x000002AF5EBFA8B0, Refcount: 39. [ STATE_CREATION WARNING #0: UNKNOWN]
    D3D11 WARNING: 	Live Object at 0x000002AF69730680, Refcount: 0. [ STATE_CREATION WARNING #0: UNKNOWN]
    D3D11 WARNING: Live                         Object :     44 [ STATE_CREATION WARNING #0: UNKNOWN]