Duckstation/src/pse/gpu_hw_opengl.h

44 lines
914 B
C
Raw Normal View History

2019-09-12 02:53:04 +00:00
#pragma once
2019-09-12 14:18:13 +00:00
#include "common/gl_program.h"
#include "common/gl_texture.h"
2019-09-12 02:53:04 +00:00
#include "glad.h"
2019-09-12 14:18:13 +00:00
#include "gpu_hw.h"
2019-09-12 02:53:04 +00:00
#include <array>
2019-09-12 14:18:13 +00:00
#include <memory>
2019-09-12 02:53:04 +00:00
class GPU_HW_OpenGL : public GPU_HW
{
public:
GPU_HW_OpenGL();
~GPU_HW_OpenGL() override;
2019-09-12 14:18:13 +00:00
bool Initialize(System* system, Bus* bus, DMA* dma) override;
2019-09-12 02:53:04 +00:00
void Reset() override;
protected:
virtual void DispatchRenderCommand(RenderCommand rc, u32 num_vertices) override;
virtual void FlushRender() override;
private:
void CreateFramebuffer();
void ClearFramebuffer();
void DestroyFramebuffer();
void CreateVertexBuffer();
2019-09-12 14:18:13 +00:00
bool CompilePrograms();
bool SetProgram(bool texture_enable);
void SetViewport();
void SetScissor();
std::unique_ptr<GL::Texture> m_framebuffer_texture;
2019-09-12 02:53:04 +00:00
GLuint m_framebuffer_fbo_id = 0;
GLuint m_vertex_buffer = 0;
GLuint m_vao_id = 0;
2019-09-12 14:18:13 +00:00
GL::Program m_texture_program;
GL::Program m_color_program;
2019-09-12 02:53:04 +00:00
};