Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Metal] Unable to CreateFramebuffer with more than 3 textures in Metal Backend #464

Open
partyalarm opened this issue Oct 23, 2022 · 1 comment

Comments

@partyalarm
Copy link

Create a frame buffer with 3 or more textures bind at the Metal backend.

var depthStencil = factory.CreateTexture(TextureDescription.Texture2D(w, h, 1, 1, PixelFormat.R16_UNorm, TextureUsage.DepthStencil ));
var colorRT  = factory.CreateTexture(TextureDescription.Texture2D(w, h, 1, 1, PixelFormat.R8_G8_B8_A8_UNorm, TextureUsage.RenderTarget | TextureUsage.Sampled));
var normalRT = factory.CreateTexture(TextureDescription.Texture2D(w, h, 1, 1, PixelFormat.R8_G8_B8_A8_UNorm, TextureUsage.RenderTarget | TextureUsage.Sampled));
var depthRT = factory.CreateTexture(TextureDescription.Texture2D(w, h, 1, 1, PixelFormat.R8_G8_B8_A8_UNorm, TextureUsage.RenderTarget | TextureUsage.Sampled));
var mrtFramebuffer = factory.CreateFramebuffer(new FramebufferDescription(depthStencil, colorRT, normalRT, depthRT));

Creating a PipelineDescription using this framebuffer and calling CreateGraphicsPipeline() will throw System.IndexOutOfRangeException.

var mrtPipeline = factory.CreateGraphicsPipeline(pipelineDesc);

For one or two textures, this exception does not seem to occur.
Also, the OpenGL backend does not seem to raise any exceptions.
I have not tried Vulkan Backend because I could not figure out how to run it on a Mac.

@mellinoe
Copy link
Collaborator

Could you provide a bit more information, especially regarding the other properties of the GraphicsPipelineDescription? I suspect there might be a mismatch in the number of attachments that you have in BlendStateDescription.AttachmentStates as that does not seem to be directly validated anywhere (and would very likely behave differently across backends if the size wasn't correct).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants