git.s-ol.nu ~forks/DiligentTools / e444285
ImGuiDiligentRenderer: a couple of minor updates assiduous 9 months ago
2 changed file(s) with 18 addition(s) and 13 deletion(s). Raw diff Collapse all Expand all
4444 struct IPipelineState;
4545 struct ITextureView;
4646 struct IShaderResourceBinding;
47 struct IShaderResourceVariable;
4748 enum TEXTURE_FORMAT : Uint16;
4849 enum SURFACE_TRANSFORM : Uint32;
4950
7677 RefCntAutoPtr<IPipelineState> m_pPSO;
7778 RefCntAutoPtr<ITextureView> m_pFontSRV;
7879 RefCntAutoPtr<IShaderResourceBinding> m_pSRB;
79 const TEXTURE_FORMAT m_BackBufferFmt;
80 const TEXTURE_FORMAT m_DepthBufferFmt;
81 Uint32 m_VertexBufferSize = 0;
82 Uint32 m_IndexBufferSize = 0;
83 Uint32 m_RenderSurfaceWidth = 0;
84 Uint32 m_RenderSurfaceHeight = 0;
85 SURFACE_TRANSFORM m_SurfacePreTransform = SURFACE_TRANSFORM_IDENTITY;
80 IShaderResourceVariable* m_pTextureVar = nullptr;
81
82 const TEXTURE_FORMAT m_BackBufferFmt;
83 const TEXTURE_FORMAT m_DepthBufferFmt;
84 Uint32 m_VertexBufferSize = 0;
85 Uint32 m_IndexBufferSize = 0;
86 Uint32 m_RenderSurfaceWidth = 0;
87 Uint32 m_RenderSurfaceHeight = 0;
88 SURFACE_TRANSFORM m_SurfacePreTransform = SURFACE_TRANSFORM_IDENTITY;
8689 };
8790
8891 } // namespace Diligent
392392
393393 m_pSRB.Release();
394394 m_pPSO->CreateShaderResourceBinding(&m_pSRB, true);
395 m_pTextureVar = m_pSRB->GetVariableByName(SHADER_TYPE_PIXEL, "Texture");
396 VERIFY_EXPR(m_pTextureVar != nullptr);
395397
396398 // Store our identifier
397399 io.Fonts->TexID = (ImTextureID)m_pFontSRV;
653655
654656 // Render command lists
655657 // (Because we merged all buffers into a single one, we maintain our own offset into them)
656 int global_idx_offset = 0;
657 int global_vtx_offset = 0;
658 ITextureView* pLastTextureView = nullptr;
659
658 int global_idx_offset = 0;
659 int global_vtx_offset = 0;
660
661 ITextureView* pLastTextureView = nullptr;
660662 for (int n = 0; n < pDrawData->CmdListsCount; n++)
661663 {
662664 const ImDrawList* cmd_list = pDrawData->CmdLists[n];
698700 static_cast<Uint32>(m_RenderSurfaceHeight * pDrawData->FramebufferScale.y));
699701
700702 // Bind texture
701 auto pTextureView = reinterpret_cast<ITextureView*>(pcmd->TextureId);
703 auto* pTextureView = reinterpret_cast<ITextureView*>(pcmd->TextureId);
702704 VERIFY_EXPR(pTextureView);
703705 if (pTextureView != pLastTextureView)
704706 {
705707 pLastTextureView = pTextureView;
706 m_pSRB->GetVariableByName(SHADER_TYPE_PIXEL, "Texture")->Set(pTextureView);
708 m_pTextureVar->Set(pTextureView);
707709 pCtx->CommitShaderResources(m_pSRB, RESOURCE_STATE_TRANSITION_MODE_TRANSITION);
708710 }
709711