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

RZAPIRenderer::DrawIndexed doesn't work with ImGuiRenderer uses wrong scissor rect #117

Open
Pikachuxxxx opened this issue Apr 8, 2022 · 2 comments
Labels
69 Jelly Beans Reward Solve this and get a reward of 69 jelly beans! good first issue Good for newcomers graphics:Render Pass Issues with the Rend Pass/Rendering alg/implementation graphics:Vulkan Issue related to Vulkan API implementation help wanted Extra attention is needed meh I don't give a FUCK about this!
Milestone

Comments

@Pikachuxxxx
Copy link
Owner

RZAPIRenderer::DrawIndexed() is not able to use the Scissor rect set throught RZAPIRenderer or RZCommandBuffer (I've personally tried both the design changes) both vkCmdSetScissor and vkCmdDrawIndexed need to be set simultaneously in the same scope for it to work. The reason is that scissor rect is not properly set before the draw call for indexed rendering, it's losing that information.

 for (uint32_t i = 0; i < imDrawData->CmdListsCount; ++i) {
                const ImDrawList* cmd_list = imDrawData->CmdLists[i];
                for (int32_t j = 0; j < cmd_list->CmdBuffer.Size; j++) {
                    const ImDrawCmd* pcmd = &cmd_list->CmdBuffer[j];
                    RZDescriptorSet* set = (RZDescriptorSet*) pcmd->TextureId;
                    RZAPIRenderer::BindDescriptorSets(m_ImGuiPipeline, cmdBuffer, &set, 1);
                    // Fix this for Vulkan
                  
                    RZAPIRenderer::SetScissorRect(cmdBuffer, std::max((int32_t) (pcmd->ClipRect.x), 0), std::max((int32_t) (pcmd->ClipRect.y), 0), (uint32_t) (pcmd->ClipRect.z - pcmd->ClipRect.x), (uint32_t) (pcmd->ClipRect.w - pcmd->ClipRect.y));
                    vkCmdDrawIndexed(*cmdBuf, pcmd->ElemCount, 1, indexOffset, vertexOffset, 0);
                    //RZAPIRenderer::DrawIndexed(cmdBuffer, pcmd->ElemCount, 1, indexOffset, vertexOffset, 0);
                    indexOffset += pcmd->ElemCount;
                }
                vertexOffset += cmd_list->VtxBuffer.Size;
            }

ImGui only work if RZAPIRenderer::DrawIndexed is not used

============================================================
Razix Engine Stats
Version : 0.30.0
Configuration : [Debug | Release | Distribution]
Release Stage : Development
Release Date : 6-3-2022
OS : Windows 10 Home
Processor : Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz 2.60 GHz
Vulkan API Version : 1.3.194
GPU Name : NVIDIA GeForce RTX 2060
Vendor ID : 4318
Device Type : DISCRETE GPU
Driver Version : 511.316.0

@Pikachuxxxx Pikachuxxxx added bug Something isn't working help wanted Extra attention is needed graphics:Vulkan Issue related to Vulkan API implementation graphics:Render Pass Issues with the Rend Pass/Rendering alg/implementation labels Apr 8, 2022
@Pikachuxxxx Pikachuxxxx added this to the V.1.0.0.RC milestone Apr 8, 2022
@Pikachuxxxx
Copy link
Owner Author

@Pikachuxxxx
Copy link
Owner Author

Pikachuxxxx commented Apr 8, 2022

Workaround : I don't mind putting such hacky stuff in here, I don't want to be a bitch about making everything super decoupled, use macros and GetRenderAPI to make this work, this doesn't affect the performance at all. Hence this is OK!

Will be investigated by ME only it's a major problem when dealing with multi-viewport rendering.

Until then, If anyone want to solve this I will give you 69 jelly beans as a gift. Free shipping to anywhere in the world.

@Pikachuxxxx Pikachuxxxx added good first issue Good for newcomers meh I don't give a FUCK about this! and removed bug Something isn't working labels Apr 8, 2022
@Pikachuxxxx Pikachuxxxx added the 69 Jelly Beans Reward Solve this and get a reward of 69 jelly beans! label Sep 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
69 Jelly Beans Reward Solve this and get a reward of 69 jelly beans! good first issue Good for newcomers graphics:Render Pass Issues with the Rend Pass/Rendering alg/implementation graphics:Vulkan Issue related to Vulkan API implementation help wanted Extra attention is needed meh I don't give a FUCK about this!
Projects
None yet
Development

No branches or pull requests

1 participant