Kode / Kha

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

It doesn't render to more than one render target using metal backend #1359

Open BlackGoku36 opened 3 years ago

BlackGoku36 commented 3 years ago

Describe the bug Doing this, where colorImage and normalImage are render target.

var g = colorImage.g4;
g.begin([normalImage]);
// drawing
g.end();

normalImage render target appears black. To Reproduce https://github.com/BlackGoku36/MRTKhaBug

Expected behavior

Screen Shot 2021-09-02 at 9 41 13 PM

Screenshots

Screen Shot 2021-09-02 at 9 40 47 PM

Execution Environment:

Using Kha (0ad34631, M Kinc,?? Backends/Kore/) from /Users/urjasvisuthar/Kha
Creating Kha project.
Compiling shader 1 of 4 (shade.frag.glsl).
Compiling shader 2 of 4 (shade.vert.glsl).
Compiling shader 3 of 4 (texdebug.frag.glsl).
Compiling shader 4 of 4 (texdebug.vert.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).
Using Kinc (e2a61ca0, M Backends/System/macOS/Sources/kinc/backend/audio.cpp, M Backends/System/macOS/Sources/kinc/backend/input/mouse.mm, M Backends/System/macOS/Sources/kinc/backend/system.mm, M Backends/System/macOS/Sources/kinc/backend/windowdata.h) from /Users/urjasvisuthar/Kha/Kinc
kincfile found.
Creating macOS project files.
Done.
Starting Kinc
2021-09-02 21:52:26.969092+0530 New Project[5504:77300] Metal GPU Frame Capture Enabled
2021-09-02 21:52:26.969708+0530 New Project[5504:77300] Metal API Validation Enabled
Starting application
2021-09-02 21:52:27.062177+0530 New Project[5504:77300] [plugin] AddInstanceForFactory: No factory registered for id <CFUUID 0x600003b9bcc0> F8BB1C28-BAE8-11D6-9C31-00039315CD46
2021-09-02 21:52:27.120209+0530 New Project[5504:77300]   saved enable noise cancellation setting is the same as the default (=1)
deviceBufferSize = 4096

mSampleRate = 44100

mFormatFlags = 00000009

mBytesPerPacket = 8

mFramesPerPacket = 1

mChannelsPerFrame = 2

mBytesPerFrame = 8

mBitsPerChannel = 32
BlackGoku36 commented 3 years ago

Using this project instead: https://github.com/BlackGoku36/MRTKhaBug2 Kha version: 87009c6261

Build output:

Using Kha (¯\_(ツ)_/¯) from /Users/urjasvisuthar/Desktop/MRTKhaBug2/Kha
Creating Kha project.
Compiling shader 1 of 6 (light.frag.glsl).
Compiling shader 2 of 6 (light.vert.glsl).
Compiling shader 3 of 6 (shade.frag.glsl).
Compiling shader 4 of 6 (shade.vert.glsl).
Compiling shader 5 of 6 (texdebug.frag.glsl).
Compiling shader 6 of 6 (texdebug.vert.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).
Using Kinc (9eed21a7) from /Users/urjasvisuthar/Desktop/MRTKhaBug2/Kha/Kinc
kincfile found.
Creating macOS project files.
Done.

Application output:

-[MTLDebugRenderCommandEncoder validateFramebufferWithRenderPipelineState:]:1288: failed assertion `Framebuffer With Render Pipeline State Validation
For color attachment 1, the render pipeline's pixelFormat (MTLPixelFormatInvalid) does not match the framebuffer's pixelFormat (MTLPixelFormatBGRA8Unorm).
'
BlackGoku36 commented 3 years ago

(Kha version has nothing to do with both the issue)

XANOZOID commented 3 years ago

Fixed the Kha version not showing up though, here: https://github.com/Kode/khamake/pull/250