Open dokipen3d opened 2 years ago
hiya, I'm in the middle of trying out my tutorial series with MGL and have hit a couple of issues (one of which I believe is coming in a current uniform pull request by @r58Playz for mglProgramUniformMatrix4fv.
https://github.com/dokipen3d/OpenGLTutorial/tree/main/src
The other issue is that I am making a draw call that refers to its vertex locations from a const array in the shader to draw a full screen triangle. I'm hitting an assertion...
Assertion failed: (mapped_buffers == count), function -[MGLRenderer mapGLBuffersToMTLBufferMap:stage:], file MGLRenderer.m, line 511.
I haven't had time to dive deep into the library yet but is that something that should be supported?
I think in Metal you need to have some sort of vertex data to call drawarrays. You can see it in Apple's OIT example where they needed to draw a full screen quad pass. There is a seperate shader to do that and you need to draw any 6 vertices to trigger it.
edit: Here's the exact shader they have:
/// A vertex function that generates a full-screen quad pass.
/// This "dummy" vertex function is used to call blendFragments.
vertex VertexOut quadPassVertex(uint vid[[vertex_id]])
{
VertexOut out;
float4 position;
position.x = (vid == 2) ? 3.0 : -1.0;
position.y = (vid == 0) ? -3.0 : 1.0;
position.zw = 1.0;
out.position = position;
return out;
}
In debug mode the asserts are on so if are no mapped buffers at the time primitive execution MGLRenderer will catch this. It would be best to write a bug and post a backtrace of this call under Xcode.
Mike
On Sep 1, 2022, at 7:14 AM, r58Playz @.***> wrote:
hiya, I'm in the middle of trying out my tutorial series with MGL and have hit a couple of issues (one of which I believe is coming in a current uniform pull request by @r58Playz https://github.com/r58Playz for mglProgramUniformMatrix4fv.
https://github.com/dokipen3d/OpenGLTutorial/tree/main/src https://github.com/dokipen3d/OpenGLTutorial/tree/main/src The other issue is that I am making a draw call that refers to its vertex locations from a const array in the shader to draw a full screen triangle. I'm hitting an assertion...
Assertion failed: (mapped_buffers == count), function -[MGLRenderer mapGLBuffersToMTLBufferMap:stage:], file MGLRenderer.m, line 511.
I haven't had time to dive deep into the library yet but is that something that should be supported?
I think in Metal you need to have some sort of vertex data to call drawarrays. You can see it in Apple's OIT example https://developer.apple.com/documentation/metal/metal_sample_code_library/implementing_order-independent_transparency_with_image_blocks?changes=_5__4 where they needed to draw a full screen quad pass. There is a seperate shader to do that and you need to draw any 6 vertices to trigger it.
— Reply to this email directly, view it on GitHub https://github.com/openglonmetal/MGL/issues/56#issuecomment-1234342957, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACOKD3YCFSYVJ7QXO5QCSK3V4C25RANCNFSM6AAAAAAQCBVAKA. You are receiving this because you are subscribed to this thread.
hiya, I'm in the middle of trying out my tutorial series with MGL and have hit a couple of issues (one of which I believe is coming in a current uniform pull request by @r58Playz for mglProgramUniformMatrix4fv.
https://github.com/dokipen3d/OpenGLTutorial/tree/main/src
The other issue is that I am making a draw call that refers to its vertex locations from a const array in the shader to draw a full screen triangle. I'm hitting an assertion...
Assertion failed: (mapped_buffers == count), function -[MGLRenderer mapGLBuffersToMTLBufferMap:stage:], file MGLRenderer.m, line 511.
I haven't had time to dive deep into the library yet but is that something that should be supported?