mirror of
https://github.com/WinampDesktop/winamp.git
synced 2025-06-19 13:05:45 -04:00
GPU/HW: Use uniform blocks for all shaders + HLSL support in shadergen
This commit is contained in:
@ -1,34 +1,48 @@
|
||||
#pragma once
|
||||
#include "gpu_hw.h"
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
#include "gpu_hw.h"
|
||||
|
||||
class GPU_HW_ShaderGen
|
||||
{
|
||||
public:
|
||||
enum class Backend
|
||||
enum class API
|
||||
{
|
||||
OpenGL
|
||||
OpenGL,
|
||||
Direct3D
|
||||
};
|
||||
|
||||
public:
|
||||
GPU_HW_ShaderGen(Backend backend, u32 resolution_scale, bool true_color);
|
||||
GPU_HW_ShaderGen(API backend, u32 resolution_scale, bool true_color);
|
||||
~GPU_HW_ShaderGen();
|
||||
|
||||
void Init(Backend backend, u32 resolution_scale, bool true_color);
|
||||
void Init(API backend, u32 resolution_scale, bool true_color);
|
||||
|
||||
std::string GenerateBatchVertexShader(bool textured);
|
||||
std::string GenerateBatchFragmentShader(GPU_HW::BatchRenderMode transparency, GPU::TextureMode texture_mode, bool dithering);
|
||||
std::string GenerateBatchFragmentShader(GPU_HW::BatchRenderMode transparency, GPU::TextureMode texture_mode,
|
||||
bool dithering);
|
||||
std::string GenerateScreenQuadVertexShader();
|
||||
std::string GenerateFillFragmentShader();
|
||||
std::string GenerateDisplayFragmentShader(bool depth_24bit, bool interlaced);
|
||||
std::string GenerateVRAMWriteFragmentShader();
|
||||
|
||||
Backend m_backend;
|
||||
API m_backend;
|
||||
u32 m_resolution_scale;
|
||||
bool m_true_color;
|
||||
bool m_glsl;
|
||||
|
||||
private:
|
||||
void GenerateShaderHeader(std::stringstream& ss);
|
||||
void GenerateBatchUniformBuffer(std::stringstream& ss);
|
||||
void WriteHeader(std::stringstream& ss);
|
||||
void DeclareUniformBuffer(std::stringstream& ss, const std::initializer_list<const char*>& members);
|
||||
void DeclareTexture(std::stringstream& ss, const char* name, u32 index);
|
||||
void DeclareTextureBuffer(std::stringstream& ss, const char* name, u32 index, bool is_int, bool is_unsigned);
|
||||
void DeclareVertexEntryPoint(std::stringstream& ss, const std::initializer_list<const char*>& attributes,
|
||||
u32 num_color_outputs, u32 num_texcoord_outputs,
|
||||
const std::initializer_list<const char*>& additional_outputs);
|
||||
void DeclareFragmentEntryPoint(std::stringstream& ss, u32 num_color_inputs, u32 num_texcoord_inputs,
|
||||
const std::initializer_list<const char*>& additional_inputs,
|
||||
bool declare_fragcoord = false, bool dual_color_output = false);
|
||||
|
||||
void WriteCommonFunctions(std::stringstream& ss);
|
||||
void WriteBatchUniformBuffer(std::stringstream& ss);
|
||||
};
|
||||
|
Reference in New Issue
Block a user