mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-07-22 16:19:19 +02:00
Some renaming
This commit is contained in:
98
betterRenderer/renderer/source/imgui_nvrhi.h
Normal file
98
betterRenderer/renderer/source/imgui_nvrhi.h
Normal file
@@ -0,0 +1,98 @@
|
||||
/*
|
||||
* Copyright (c) 2014-2021, NVIDIA CORPORATION. All rights reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
/*
|
||||
License for Dear ImGui
|
||||
|
||||
Copyright (c) 2014-2019 Omar Cornut
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
#include <unordered_map>
|
||||
#include <stdint.h>
|
||||
|
||||
#include <nvrhi/nvrhi.h>
|
||||
|
||||
#include <imgui/imgui.h>
|
||||
#include "nvtexture.h"
|
||||
|
||||
struct ImGui_NVRHI
|
||||
{
|
||||
nvrhi::DeviceHandle renderer;
|
||||
nvrhi::CommandListHandle m_commandList;
|
||||
|
||||
nvrhi::ShaderHandle vertexShader;
|
||||
nvrhi::ShaderHandle pixelShader;
|
||||
nvrhi::InputLayoutHandle shaderAttribLayout;
|
||||
|
||||
nvrhi::TextureHandle fontTexture;
|
||||
nvrhi::SamplerHandle fontSampler;
|
||||
|
||||
nvrhi::BufferHandle vertexBuffer;
|
||||
nvrhi::BufferHandle indexBuffer;
|
||||
|
||||
nvrhi::BindingLayoutHandle bindingLayout;
|
||||
nvrhi::GraphicsPipelineDesc basePSODesc;
|
||||
|
||||
nvrhi::GraphicsPipelineHandle pso;
|
||||
std::unordered_map<nvrhi::ITexture*, nvrhi::BindingSetHandle> bindingsCache;
|
||||
|
||||
std::vector<ImDrawVert> vtxBuffer;
|
||||
std::vector<ImDrawIdx> idxBuffer;
|
||||
|
||||
NvTextureManager* textureManager;
|
||||
|
||||
bool init(class NvRendererBackend *backend);
|
||||
bool beginFrame();
|
||||
bool render(nvrhi::IFramebuffer* framebuffer);
|
||||
void backbufferResizing();
|
||||
|
||||
private:
|
||||
bool reallocateBuffer(nvrhi::BufferHandle& buffer, size_t requiredSize, size_t reallocateSize, bool isIndexBuffer);
|
||||
|
||||
bool createFontTexture(nvrhi::ICommandList* commandList);
|
||||
|
||||
nvrhi::IGraphicsPipeline* getPSO(nvrhi::IFramebuffer* fb);
|
||||
nvrhi::IBindingSet* getBindingSet(void* handle);
|
||||
bool updateGeometry(nvrhi::ICommandList* commandList);
|
||||
};
|
||||
Reference in New Issue
Block a user