Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
hrydgard
GitHub Repository: hrydgard/ppsspp
Path: blob/master/ext/imgui/imgui_impl_thin3d.h
3186 views
1
// dear imgui: Renderer Backend for Vulkan
2
// This needs to be used along with a Platform Backend (e.g. GLFW, SDL, Win32, custom..)
3
4
// Implemented features:
5
// [!] Renderer: User texture binding. Use 'VkDescriptorSet' as ImTextureID. Read the FAQ about ImTextureID! See https://github.com/ocornut/imgui/pull/914 for discussions.
6
// [X] Renderer: Large meshes support (64k+ vertices) with 16-bit indices.
7
8
// Important: on 32-bit systems, user texture binding is only supported if your imconfig file has '#define ImTextureID ImU64'.
9
// See imgui_impl_vulkan.cpp file for details.
10
11
// The aim of imgui_impl_vulkan.h/.cpp is to be usable in your engine without any modification.
12
// IF YOU FEEL YOU NEED TO MAKE ANY CHANGE TO THIS CODE, please share them and your feedback at https://github.com/ocornut/imgui/
13
14
// You can use unmodified imgui_impl_* files in your project. See examples/ folder for examples of using this.
15
// Prefer including the entire imgui/ repository into your project (either as a copy or as a submodule), and only build the backends you need.
16
// Learn about Dear ImGui:
17
// - FAQ https://dearimgui.com/faq
18
// - Getting Started https://dearimgui.com/getting-started
19
// - Documentation https://dearimgui.com/docs (same as your local docs/ folder).
20
// - Introduction, links and more at the top of imgui.cpp
21
22
// Important note to the reader who wish to integrate imgui_impl_vulkan.cpp/.h in their own engine/app.
23
// - Common ImGui_ImplThin3d_XXX functions and structures are used to interface with imgui_impl_vulkan.cpp/.h.
24
// You will use those if you want to use this rendering backend in your engine/app.
25
// - Helper ImGui_ImplThin3dH_XXX functions and structures are only used by this example (main.cpp) and by
26
// the backend itself (imgui_impl_vulkan.cpp), but should PROBABLY NOT be used by your own engine/app code.
27
// Read comments in imgui_impl_vulkan.h.
28
29
#pragma once
30
#ifndef IMGUI_DISABLE
31
#include "imgui.h" // IMGUI_IMPL_API
32
33
#include "Common/GPU/thin3d.h"
34
#include "Common/Math/lin/matrix4x4.h"
35
36
// Called by user code. Takes ownership of the font buffer and later deletes it.
37
IMGUI_IMPL_API bool ImGui_ImplThin3d_Init(Draw::DrawContext *draw,
38
const uint8_t *ttf_font_proportional, size_t proportional_size,
39
const uint8_t *ttf_font_fixed, size_t fixed_size);
40
IMGUI_IMPL_API void ImGui_ImplThin3d_Shutdown();
41
IMGUI_IMPL_API void ImGui_ImplThin3d_NewFrame(Draw::DrawContext *draw, Lin::Matrix4x4 drawMatrix);
42
IMGUI_IMPL_API void ImGui_ImplThin3d_RenderDrawData(ImDrawData* draw_data, Draw::DrawContext *draw);
43
IMGUI_IMPL_API bool ImGui_ImplThin3d_CreateDeviceObjects(Draw::DrawContext *draw);
44
IMGUI_IMPL_API void ImGui_ImplThin3d_DestroyDeviceObjects();
45
46
enum class ImGuiPipeline {
47
TexturedAlphaBlend = 0,
48
TexturedOpaque = 1,
49
};
50
51
// These register a texture for imgui drawing, but just for the current frame.
52
// Textures are unregistered again in RenderDrawData. This is just simpler.
53
IMGUI_IMPL_API ImTextureID ImGui_ImplThin3d_AddTextureTemp(Draw::Texture *texture, ImGuiPipeline pipeline = ImGuiPipeline::TexturedAlphaBlend);
54
IMGUI_IMPL_API ImTextureID ImGui_ImplThin3d_AddNativeTextureTemp(void *texture, ImGuiPipeline pipeline = ImGuiPipeline::TexturedAlphaBlend);
55
IMGUI_IMPL_API ImTextureID ImGui_ImplThin3d_AddFBAsTextureTemp(Draw::Framebuffer *framebuffer, Draw::Aspect aspect = Draw::Aspect::COLOR_BIT, ImGuiPipeline pipeline = ImGuiPipeline::TexturedAlphaBlend);
56
57
void ImGui_PushFixedFont();
58
void ImGui_PopFont();
59
60
// To get metrics etc.
61
ImFont *ImGui_GetFixedFont();
62
63
64
// Helper structure to hold the data needed by one rendering context into one OS window
65
// (Used by example's main.cpp. Used by multi-viewport features. Probably NOT used by your own engine/app.)
66
struct ImGui_ImplThin3dH_Window {
67
int Width = 0;
68
int Height = 0;
69
bool ClearEnable = true;
70
};
71
72
#endif // #ifndef IMGUI_DISABLE
73
74