Kode / Kha

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

[Krom] Binding render target for compute shader doesn't work #1406

Open MoritzBrueckner opened 2 years ago

MoritzBrueckner commented 2 years ago

Describe the bug When using a render target instead of a "regular" image as a writeonly image2D uniform in a compute shader on Krom (Windows), the texture is not bound correctly.

To Reproduce

  1. Clone https://github.com/Kha-Samples/ComputeShader (e34a690)
  2. In Main.main(), replace line 36
    texture = Image.create(256, 256, TextureFormat.RGBA128);

    with

    texture = Image.createRenderTarget(256, 256, TextureFormat.RGBA128);
  3. Publish to Krom and you will see a black screen.

Expected behavior The visual result when using a rendertarget should be the same as when using a regular image.

Screenshots Using a regular image: grafik

Using a render target: (it's a black screen)

Inspecting the render target version in RenderDoc (the capture is attached below):

Execution Environment:

Additional context RenderDoc capture: ComputeShader_RenderTarget.zip

Using a different texture format (tested all RGBA variants), using Access.ReadWrite in setTexture() and making the uniform restricted don't change the outcome, there's still a black screen.