2019-09-12 02:53:04 +00:00
|
|
|
#pragma once
|
|
|
|
#include "gpu.h"
|
|
|
|
#include <string>
|
2019-09-13 16:07:31 +00:00
|
|
|
#include <sstream>
|
2019-09-12 02:53:04 +00:00
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
class GPU_HW : public GPU
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
GPU_HW();
|
|
|
|
virtual ~GPU_HW();
|
|
|
|
|
|
|
|
protected:
|
|
|
|
struct HWVertex
|
|
|
|
{
|
|
|
|
s32 x;
|
|
|
|
s32 y;
|
|
|
|
u32 color;
|
2019-09-13 16:07:31 +00:00
|
|
|
u16 texcoord;
|
|
|
|
u16 padding;
|
2019-09-12 02:53:04 +00:00
|
|
|
};
|
|
|
|
|
2019-09-13 16:07:31 +00:00
|
|
|
virtual void UpdateTexturePageTexture();
|
|
|
|
|
|
|
|
bool IsFlushed() const { return !m_batch_vertices.empty(); }
|
|
|
|
|
|
|
|
void DispatchRenderCommand(RenderCommand rc, u32 num_vertices) override;
|
2019-09-12 02:53:04 +00:00
|
|
|
|
2019-09-12 14:18:13 +00:00
|
|
|
void CalcViewport(int* x, int* y, int* width, int* height);
|
|
|
|
void CalcScissorRect(int* left, int* top, int* right, int* bottom);
|
|
|
|
|
2019-09-12 02:53:04 +00:00
|
|
|
std::string GenerateVertexShader(bool textured);
|
2019-09-13 16:07:31 +00:00
|
|
|
std::string GenerateFragmentShader(bool textured, bool blending);
|
|
|
|
std::string GenerateScreenQuadVertexShader();
|
|
|
|
std::string GenerateTexturePageProgram(TextureColorMode mode);
|
2019-09-12 02:53:04 +00:00
|
|
|
|
2019-09-13 16:07:31 +00:00
|
|
|
std::vector<HWVertex> m_batch_vertices;
|
|
|
|
RenderCommand m_batch_command = {};
|
|
|
|
|
|
|
|
private:
|
|
|
|
void GenerateShaderHeader(std::stringstream& ss);
|
|
|
|
|
|
|
|
void LoadVertices(RenderCommand rc, u32 num_vertices);
|
2019-09-12 02:53:04 +00:00
|
|
|
};
|
|
|
|
|