GPUDevice: Swap ImGui rendering to use UBO

This commit is contained in:
Stenzek
2025-10-31 16:54:38 +10:00
parent 863b9b10a0
commit 683ccbf216
2 changed files with 4 additions and 4 deletions

View File

@@ -400,7 +400,7 @@ bool ImGuiManager::CompilePipelines(Error* error)
};
GPUPipeline::GraphicsConfig plconfig;
plconfig.layout = GPUPipeline::Layout::SingleTextureAndPushConstants;
plconfig.layout = GPUPipeline::Layout::SingleTextureAndUBO;
plconfig.input_layout.vertex_attributes = imgui_attributes;
plconfig.input_layout.vertex_stride = sizeof(ImDrawVert);
plconfig.primitive = GPUPipeline::Primitive::Triangles;
@@ -454,7 +454,7 @@ void ImGuiManager::RenderDrawLists(u32 window_width, u32 window_height, WindowIn
static_cast<float>(window_height), 0.0f, 1.0f);
if (prerotated)
mproj = GSMatrix4x4::RotationZ(WindowInfo::GetZRotationForPreRotation(prerotation)) * mproj;
g_gpu_device->PushUniformBuffer(&mproj, sizeof(mproj));
g_gpu_device->UploadUniformBuffer(&mproj, sizeof(mproj));
// Render command lists
const bool flip = g_gpu_device->UsesLowerLeftOrigin();
@@ -492,7 +492,7 @@ void ImGuiManager::RenderDrawLists(u32 window_width, u32 window_height, WindowIn
if (pcmd->UserCallback) [[unlikely]]
{
pcmd->UserCallback(cmd_list, pcmd);
g_gpu_device->PushUniformBuffer(&mproj, sizeof(mproj));
g_gpu_device->UploadUniformBuffer(&mproj, sizeof(mproj));
g_gpu_device->SetPipeline(s_state.imgui_pipeline.get());
}
else

View File

@@ -948,7 +948,7 @@ std::string ShaderGen::GenerateImGuiVertexShader() const
{
std::stringstream ss;
WriteHeader(ss);
DeclareUniformBuffer(ss, {"float4x4 ProjectionMatrix"}, true);
DeclareUniformBuffer(ss, {"float4x4 ProjectionMatrix"}, false);
DeclareVertexEntryPoint(ss, {"float2 a_pos", "float2 a_tex0", "float4 a_col0"}, 1, 1, {}, false);
ss << R"(
{