Kha
Kha copied to clipboard
[Krom] Binding render target for compute shader doesn't work
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
- Clone https://github.com/Kha-Samples/ComputeShader (
e34a690
) - In
Main.main()
, replace line 36
withtexture = Image.create(256, 256, TextureFormat.RGBA128);
texture = Image.createRenderTarget(256, 256, TextureFormat.RGBA128);
- 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:
Using a render target: (it's a black screen)
Inspecting the render target version in RenderDoc (the capture is attached below):
Execution Environment:
- Host system (where you compile your code): Windows 10
- Target system (where you run your code): Windows 10
- IDE used (if any): VS Codium
- Kha revision:
59478ab
- Using latest Krom_bin (
d99ac49
) - Kha build output (Using Kha...):
Using Kha (59478aba) from [...]\Kha Creating Kha project. Compiling shader 1 of 3 (shader.frag.glsl). Compiling shader 2 of 3 (shader.vert.glsl). Compiling shader 3 of 3 (test.comp.glsl). 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). Done.
- Application output (if it runs): -
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 restrict
ed don't change the outcome, there's still a black screen.