light/modules/renderer/include/renderer/dx/framebuffers.hpp

48 lines
1,001 B
C++
Raw Normal View History

2022-03-08 21:19:19 +03:30
#pragma once
#include <d3d11.h>
#include <renderer/framebuffer.hpp>
2022-03-08 21:19:19 +03:30
#include <wrl.h>
namespace Light {
class dxSharedContext;
class dxFramebuffer: public Framebuffer
{
public:
2025-07-05 13:28:41 +03:30
dxFramebuffer(
const FramebufferSpecification &specification,
Ref<dxSharedContext> sharedContext
);
2022-03-08 21:19:19 +03:30
2025-07-06 14:02:50 +03:30
auto get_color_attachment() -> void * override
2025-07-05 13:28:41 +03:30
{
return (void *)m_shader_resource_view.Get();
2025-07-05 13:28:41 +03:30
}
2022-03-08 21:19:19 +03:30
void bind_as_target(const glm::vec4 &clearColor) override;
2025-07-05 16:07:51 +03:30
void bind_as_resource() override;
2022-03-08 21:19:19 +03:30
void resize(const glm::uvec2 &size) override;
2025-07-05 16:07:51 +03:30
private:
Ref<dxSharedContext> m_context;
FramebufferSpecification m_specification;
Microsoft::WRL::ComPtr<ID3D11RenderTargetView> m_render_target_view;
Microsoft::WRL::ComPtr<ID3D11Texture2D> m_color_attachment;
Microsoft::WRL::ComPtr<ID3D11Texture2D> m_depth_stencil_attachment;
Microsoft::WRL::ComPtr<ID3D11ShaderResourceView> m_shader_resource_view;
Microsoft::WRL::ComPtr<ID3D11DepthStencilView> m_depth_stencil_view;
2022-03-08 21:19:19 +03:30
};
2025-07-05 13:28:41 +03:30
} // namespace Light