2022-12-04 11:03:45 +00:00
|
|
|
// SPDX-FileCopyrightText: 2019-2022 Connor McLaughlin <stenzek@gmail.com>
|
|
|
|
// SPDX-License-Identifier: (GPL-3.0 OR CC-BY-NC-ND-4.0)
|
|
|
|
|
2019-11-03 03:36:54 +00:00
|
|
|
#pragma once
|
2019-11-03 05:18:51 +00:00
|
|
|
#include "gpu_hw.h"
|
2023-08-13 06:28:28 +00:00
|
|
|
#include "util/shadergen.h"
|
2019-11-03 03:36:54 +00:00
|
|
|
|
2020-09-12 04:52:18 +00:00
|
|
|
class GPU_HW_ShaderGen : public ShaderGen
|
2019-11-03 03:36:54 +00:00
|
|
|
{
|
|
|
|
public:
|
2022-08-26 11:59:45 +00:00
|
|
|
GPU_HW_ShaderGen(RenderAPI render_api, u32 resolution_scale, u32 multisamples, bool per_sample_shading,
|
2020-10-30 14:38:06 +00:00
|
|
|
bool true_color, bool scaled_dithering, GPUTextureFilter texture_filtering, bool uv_limits,
|
2022-10-03 10:03:30 +00:00
|
|
|
bool pgxp_depth, bool disable_color_perspective, bool supports_dual_source_blend);
|
2019-11-03 03:36:54 +00:00
|
|
|
~GPU_HW_ShaderGen();
|
|
|
|
|
2020-08-10 12:37:30 +00:00
|
|
|
std::string GenerateBatchVertexShader(bool textured);
|
2020-10-22 09:31:28 +00:00
|
|
|
std::string GenerateBatchFragmentShader(GPU_HW::BatchRenderMode transparency, GPUTextureMode texture_mode,
|
2020-04-03 14:11:33 +00:00
|
|
|
bool dithering, bool interlacing);
|
2020-11-03 04:17:51 +00:00
|
|
|
std::string GenerateDisplayFragmentShader(bool depth_24bit, GPU_HW::InterlacedRenderMode interlace_mode,
|
|
|
|
bool smooth_chroma);
|
2023-09-02 12:26:03 +00:00
|
|
|
std::string GenerateWireframeGeometryShader();
|
|
|
|
std::string GenerateWireframeFragmentShader();
|
2019-11-14 06:58:27 +00:00
|
|
|
std::string GenerateVRAMReadFragmentShader();
|
2020-06-23 15:39:53 +00:00
|
|
|
std::string GenerateVRAMWriteFragmentShader(bool use_ssbo);
|
2020-04-19 12:30:54 +00:00
|
|
|
std::string GenerateVRAMCopyFragmentShader();
|
2021-07-21 09:22:04 +00:00
|
|
|
std::string GenerateVRAMFillFragmentShader(bool wrapped, bool interlaced);
|
2020-05-03 07:11:28 +00:00
|
|
|
std::string GenerateVRAMUpdateDepthFragmentShader();
|
2019-11-03 03:36:54 +00:00
|
|
|
|
2023-08-13 03:42:02 +00:00
|
|
|
std::string GenerateAdaptiveDownsampleVertexShader();
|
2020-12-30 06:26:20 +00:00
|
|
|
std::string GenerateAdaptiveDownsampleMipFragmentShader(bool first_pass);
|
|
|
|
std::string GenerateAdaptiveDownsampleBlurFragmentShader();
|
|
|
|
std::string GenerateAdaptiveDownsampleCompositeFragmentShader();
|
|
|
|
std::string GenerateBoxSampleDownsampleFragmentShader();
|
|
|
|
|
2019-11-03 03:36:54 +00:00
|
|
|
private:
|
2020-10-30 14:38:06 +00:00
|
|
|
ALWAYS_INLINE bool UsingMSAA() const { return m_multisamples > 1; }
|
|
|
|
ALWAYS_INLINE bool UsingPerSampleShading() const { return m_multisamples > 1 && m_per_sample_shading; }
|
|
|
|
|
2019-11-03 05:18:51 +00:00
|
|
|
void WriteCommonFunctions(std::stringstream& ss);
|
|
|
|
void WriteBatchUniformBuffer(std::stringstream& ss);
|
2020-09-11 12:20:19 +00:00
|
|
|
void WriteBatchTextureFilter(std::stringstream& ss, GPUTextureFilter texture_filter);
|
2023-08-13 03:42:02 +00:00
|
|
|
void WriteAdaptiveDownsampleUniformBuffer(std::stringstream& ss);
|
2020-05-02 06:01:16 +00:00
|
|
|
|
|
|
|
u32 m_resolution_scale;
|
2020-10-30 14:38:06 +00:00
|
|
|
u32 m_multisamples;
|
|
|
|
bool m_per_sample_shading;
|
2020-05-02 06:01:16 +00:00
|
|
|
bool m_true_color;
|
|
|
|
bool m_scaled_dithering;
|
2020-09-11 12:20:19 +00:00
|
|
|
GPUTextureFilter m_texture_filter;
|
2020-08-10 12:37:30 +00:00
|
|
|
bool m_uv_limits;
|
2020-12-22 15:10:49 +00:00
|
|
|
bool m_pgxp_depth;
|
2022-10-03 10:03:30 +00:00
|
|
|
bool m_disable_color_perspective;
|
2019-11-03 03:36:54 +00:00
|
|
|
};
|