aboutsummaryrefslogtreecommitdiff
path: root/src/video_core/renderer_opengl/gl_rasterizer.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/video_core/renderer_opengl/gl_rasterizer.h')
-rw-r--r--src/video_core/renderer_opengl/gl_rasterizer.h64
1 files changed, 7 insertions, 57 deletions
diff --git a/src/video_core/renderer_opengl/gl_rasterizer.h b/src/video_core/renderer_opengl/gl_rasterizer.h
index d868bf421..71c21c69b 100644
--- a/src/video_core/renderer_opengl/gl_rasterizer.h
+++ b/src/video_core/renderer_opengl/gl_rasterizer.h
@@ -15,10 +15,12 @@
#include "common/common_types.h"
#include "common/hash.h"
#include "common/vector_math.h"
+#include "video_core/engines/maxwell_3d.h"
#include "video_core/rasterizer_interface.h"
#include "video_core/renderer_opengl/gl_rasterizer_cache.h"
#include "video_core/renderer_opengl/gl_resource_manager.h"
#include "video_core/renderer_opengl/gl_shader_gen.h"
+#include "video_core/renderer_opengl/gl_shader_manager.h"
#include "video_core/renderer_opengl/gl_state.h"
#include "video_core/renderer_opengl/gl_stream_buffer.h"
@@ -45,7 +47,7 @@ public:
/// OpenGL shader generated for a given Maxwell register state
struct MaxwellShader {
/// OpenGL shader resource
- OGLShader shader;
+ OGLProgram shader;
};
struct VertexShader {
@@ -56,34 +58,6 @@ public:
OGLShader shader;
};
- /// Uniform structure for the Uniform Buffer Object, all vectors must be 16-byte aligned
- // NOTE: Always keep a vec4 at the end. The GL spec is not clear wether the alignment at
- // the end of a uniform block is included in UNIFORM_BLOCK_DATA_SIZE or not.
- // Not following that rule will cause problems on some AMD drivers.
- struct UniformData {};
-
- // static_assert(
- // sizeof(UniformData) == 0x460,
- // "The size of the UniformData structure has changed, update the structure in the shader");
- static_assert(sizeof(UniformData) < 16384,
- "UniformData structure must be less than 16kb as per the OpenGL spec");
-
- struct VSUniformData {};
- // static_assert(
- // sizeof(VSUniformData) == 1856,
- // "The size of the VSUniformData structure has changed, update the structure in the
- // shader");
- static_assert(sizeof(VSUniformData) < 16384,
- "VSUniformData structure must be less than 16kb as per the OpenGL spec");
-
- struct FSUniformData {};
- // static_assert(
- // sizeof(FSUniformData) == 1856,
- // "The size of the FSUniformData structure has changed, update the structure in the
- // shader");
- static_assert(sizeof(FSUniformData) < 16384,
- "FSUniformData structure must be less than 16kb as per the OpenGL spec");
-
private:
class SamplerInfo {
public:
@@ -122,9 +96,6 @@ private:
/// Syncs the clip coefficients to match the guest state
void SyncClipCoef();
- /// Sets the OpenGL shader in accordance with the current guest state
- void SetShader();
-
/// Syncs the cull mode to match the guest state
void SyncCullMode();
@@ -152,23 +123,12 @@ private:
RasterizerCacheOpenGL res_cache;
- /// Shader used for test renderering - to be removed once we have emulated shaders
- MaxwellShader test_shader{};
-
- const MaxwellShader* current_shader{};
- bool shader_dirty{};
-
- struct {
- UniformData data;
- bool dirty;
- } uniform_block_data = {};
-
- OGLPipeline pipeline;
+ std::unique_ptr<GLShader::ProgramManager> shader_program_manager;
OGLVertexArray sw_vao;
OGLVertexArray hw_vao;
std::array<bool, 16> hw_vao_enabled_attributes;
- std::array<SamplerInfo, 32> texture_samplers;
+ std::array<SamplerInfo, GLShader::NumTextureSamplers> texture_samplers;
static constexpr size_t VERTEX_BUFFER_SIZE = 128 * 1024 * 1024;
std::unique_ptr<OGLStreamBuffer> vertex_buffer;
OGLBuffer uniform_buffer;
@@ -182,19 +142,9 @@ private:
void AnalyzeVertexArray(bool is_indexed);
void SetupVertexArray(u8* array_ptr, GLintptr buffer_offset);
- OGLBuffer vs_uniform_buffer;
- std::unordered_map<GLShader::MaxwellVSConfig, VertexShader*> vs_shader_map;
- std::unordered_map<std::string, VertexShader> vs_shader_cache;
- OGLShader vs_default_shader;
-
- void SetupVertexShader(VSUniformData* ub_ptr, GLintptr buffer_offset);
-
- OGLBuffer fs_uniform_buffer;
- std::unordered_map<GLShader::MaxwellFSConfig, FragmentShader*> fs_shader_map;
- std::unordered_map<std::string, FragmentShader> fs_shader_cache;
- OGLShader fs_default_shader;
+ std::array<OGLBuffer, Tegra::Engines::Maxwell3D::Regs::MaxShaderStage> uniform_buffers;
- void SetupFragmentShader(FSUniformData* ub_ptr, GLintptr buffer_offset);
+ void SetupShaders(u8* buffer_ptr, GLintptr buffer_offset, size_t ptr_pos);
enum class AccelDraw { Disabled, Arrays, Indexed };
AccelDraw accelerate_draw;