Grindstone Game Engine v0.2.0
An open source game engine and toolkit.
Loading...
Searching...
No Matches
GLCore.hpp
1#pragma once
2
3#define NOMINMAX
4#include <GL/gl3w.h>
5#include <vector>
6
7#include <Common/Graphics/Core.hpp>
8#include <Common/Graphics/DLLDefs.hpp>
9
10namespace Grindstone::GraphicsAPI::OpenGL {
12 public:
13 virtual bool Initialize(const CreateInfo& createInfo) override;
14 virtual void Clear(ClearMode mask, float clear_color[4], float clear_depth, uint32_t clear_stencil) override;
15 virtual void AdjustPerspective(float *perspective) override;
16 virtual void RegisterWindow(Window* window) override;
17
18 virtual const char* GetVendorName() const override;
19 virtual const char* GetAdapterName() const override;
20 virtual const char* GetAPIName() const override;
21 virtual const char* GetAPIVersion() const override;
22 virtual const char* GetDefaultShaderExtension() const override;
23
24 virtual void DeleteRenderTarget(Grindstone::GraphicsAPI::RenderTarget * ptr) override;
25 virtual void DeleteDepthStencilTarget(Grindstone::GraphicsAPI::DepthStencilTarget * ptr) override;
26 virtual void DeleteFramebuffer(Grindstone::GraphicsAPI::Framebuffer *ptr) override;
27 virtual void DeleteVertexBuffer(Grindstone::GraphicsAPI::VertexBuffer *ptr) override;
28 virtual void DeleteIndexBuffer(Grindstone::GraphicsAPI::IndexBuffer *ptr) override;
29 virtual void DeleteUniformBuffer(Grindstone::GraphicsAPI::UniformBuffer * ptr) override;
30 virtual void DeleteGraphicsPipeline(Grindstone::GraphicsAPI::GraphicsPipeline* ptr) override;
31 virtual void DeleteComputePipeline(Grindstone::GraphicsAPI::ComputePipeline* ptr) override;
32 virtual void DeleteRenderPass(Grindstone::GraphicsAPI::RenderPass *ptr) override;
33 virtual void DeleteTexture(Grindstone::GraphicsAPI::Texture *ptr) override;
34 virtual void DeleteDescriptorSet(Grindstone::GraphicsAPI::DescriptorSet *ptr) override;
35 virtual void DeleteDescriptorSetLayout(Grindstone::GraphicsAPI::DescriptorSetLayout *ptr) override;
36 virtual void DeleteCommandBuffer(Grindstone::GraphicsAPI::CommandBuffer * ptr) override;
37 virtual void DeleteVertexArrayObject(Grindstone::GraphicsAPI::VertexArrayObject *ptr) override;
38
39 virtual Grindstone::GraphicsAPI::Framebuffer* CreateFramebuffer(const Framebuffer::CreateInfo& ci) override;
40 virtual Grindstone::GraphicsAPI::RenderPass* CreateRenderPass(const RenderPass::CreateInfo& ci) override;
41 virtual Grindstone::GraphicsAPI::GraphicsPipeline* CreateGraphicsPipeline(const GraphicsPipeline::CreateInfo& ci) override;
42 virtual Grindstone::GraphicsAPI::ComputePipeline* CreateComputePipeline(const ComputePipeline::CreateInfo& ci) override;
43 virtual Grindstone::GraphicsAPI::CommandBuffer* CreateCommandBuffer(const CommandBuffer::CreateInfo& ci) override;
44 virtual Grindstone::GraphicsAPI::VertexArrayObject* CreateVertexArrayObject(const VertexArrayObject::CreateInfo& gp) override;
45 virtual Grindstone::GraphicsAPI::VertexBuffer* CreateVertexBuffer(const VertexBuffer::CreateInfo& ci) override;
46 virtual Grindstone::GraphicsAPI::IndexBuffer* CreateIndexBuffer(const IndexBuffer::CreateInfo& ci) override;
47 virtual Grindstone::GraphicsAPI::UniformBuffer* CreateUniformBuffer(const UniformBuffer::CreateInfo& ci) override;
48 virtual Grindstone::GraphicsAPI::Texture* CreateCubemap(const Texture::CubemapCreateInfo& createInfo) override;
49 virtual Grindstone::GraphicsAPI::Texture* CreateTexture(const Texture::CreateInfo& createInfo) override;
50 virtual Grindstone::GraphicsAPI::DescriptorSet* CreateDescriptorSet(const DescriptorSet::CreateInfo& createInfo) override;
51 virtual Grindstone::GraphicsAPI::DescriptorSetLayout* CreateDescriptorSetLayout(const DescriptorSetLayout::CreateInfo& createInfo) override;
52 virtual Grindstone::GraphicsAPI::RenderTarget* CreateRenderTarget(const RenderTarget::CreateInfo* rt, uint32_t rc, bool cube = false) override;
53 virtual Grindstone::GraphicsAPI::RenderTarget* CreateRenderTarget(const RenderTarget::CreateInfo& rt) override;
54 virtual Grindstone::GraphicsAPI::DepthStencilTarget* CreateDepthStencilTarget(const DepthStencilTarget::CreateInfo& rt) override;
55
56 virtual void CopyDepthBufferFromReadToWrite(uint32_t srcWidth, uint32_t srcHeight, uint32_t dstWidth, uint32_t dstHeight) override;
57
58 virtual bool ShouldUseImmediateMode() const override;
59 virtual bool SupportsCommandBuffers() const override;
60 virtual bool SupportsTesselation() const override;
61 virtual bool SupportsGeometryShader() const override;
62 virtual bool SupportsComputeShader() const override;
63 virtual bool SupportsMultiDrawIndirect() const override;
64
65 virtual void WaitUntilIdle() override;
66
67 virtual void BindGraphicsPipeline(Grindstone::GraphicsAPI::GraphicsPipeline* pipeline) override;
68 virtual void BindVertexArrayObject(Grindstone::GraphicsAPI::VertexArrayObject *) override;
69 virtual void DrawImmediateIndexed(GeometryType geom_type, bool largeBuffer, int32_t baseVertex, uint32_t indexOffsetPtr, uint32_t indexCount) override;
70 virtual void DrawImmediateVertices(GeometryType geom_type, uint32_t base, uint32_t count) override;
71 virtual void SetImmediateBlending(
72 BlendOperation colorOp, BlendFactor colorSrc, BlendFactor colorDst,
73 BlendOperation alphaOp, BlendFactor alphaSrc, BlendFactor alphaDst
74 ) override;
75 virtual void EnableDepthWrite(bool state) override;
76 virtual void BindDefaultFramebuffer() override;
77 virtual void BindDefaultFramebufferWrite() override;
78 virtual void BindDefaultFramebufferRead() override;
79 virtual void SetColorMask(ColorMask mask) override;
80 virtual void ResizeViewport(uint32_t w, uint32_t h) override;
81 private:
82 std::string vendorName;
83 std::string adapterName;
84 std::string apiVersion;
85
86 Window* primaryWindow;
87 };
88}
Definition CommandBuffer.hpp:21
Definition ComputePipeline.hpp:18
Definition Core.hpp:31
Definition DepthStencilTarget.hpp:15
Definition DescriptorSetLayout.hpp:11
Definition DescriptorSet.hpp:11
Definition Framebuffer.hpp:19
Definition GraphicsPipeline.hpp:18
Definition IndexBuffer.hpp:11
Definition RenderPass.hpp:27
Definition RenderTarget.hpp:12
Definition Texture.hpp:40
Definition UniformBuffer.hpp:10
Definition VertexArrayObject.hpp:10
Definition VertexBuffer.hpp:130
Definition Window.cs:7