From da1114ca59ab2fbd4a1020db79f98b75cf4a6d5a Mon Sep 17 00:00:00 2001 From: bunnei Date: Fri, 6 Apr 2018 23:56:42 -0400 Subject: renderer_opengl: Use OGLProgram instead of OGLShader. --- src/video_core/renderer_opengl/gl_rasterizer.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/video_core/renderer_opengl/gl_rasterizer.h') diff --git a/src/video_core/renderer_opengl/gl_rasterizer.h b/src/video_core/renderer_opengl/gl_rasterizer.h index d868bf421..989c62d0d 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer.h +++ b/src/video_core/renderer_opengl/gl_rasterizer.h @@ -45,7 +45,7 @@ public: /// OpenGL shader generated for a given Maxwell register state struct MaxwellShader { /// OpenGL shader resource - OGLShader shader; + OGLProgram shader; }; struct VertexShader { -- cgit v1.2.3 From 5617831d5fb42a692d09f2fd3c21cc1eac3ae903 Mon Sep 17 00:00:00 2001 From: bunnei Date: Sat, 7 Apr 2018 05:22:08 -0400 Subject: gl_rasterizer: Use shader program manager, remove test shader. --- src/video_core/renderer_opengl/gl_rasterizer.h | 57 ++------------------------ 1 file changed, 4 insertions(+), 53 deletions(-) (limited to 'src/video_core/renderer_opengl/gl_rasterizer.h') diff --git a/src/video_core/renderer_opengl/gl_rasterizer.h b/src/video_core/renderer_opengl/gl_rasterizer.h index 989c62d0d..b508f5acc 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer.h +++ b/src/video_core/renderer_opengl/gl_rasterizer.h @@ -19,6 +19,7 @@ #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" @@ -56,34 +57,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 +95,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,18 +122,7 @@ 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 shader_program_manager; OGLVertexArray sw_vao; OGLVertexArray hw_vao; std::array hw_vao_enabled_attributes; @@ -183,18 +142,10 @@ private: void SetupVertexArray(u8* array_ptr, GLintptr buffer_offset); OGLBuffer vs_uniform_buffer; - std::unordered_map vs_shader_map; - std::unordered_map vs_shader_cache; - OGLShader vs_default_shader; - - void SetupVertexShader(VSUniformData* ub_ptr, GLintptr buffer_offset); - OGLBuffer fs_uniform_buffer; - std::unordered_map fs_shader_map; - std::unordered_map fs_shader_cache; - OGLShader fs_default_shader; + void SetupVertexShader(GLShader::VSUniformData* ub_ptr, GLintptr buffer_offset); - void SetupFragmentShader(FSUniformData* ub_ptr, GLintptr buffer_offset); + void SetupFragmentShader(GLShader::FSUniformData* ub_ptr, GLintptr buffer_offset); enum class AccelDraw { Disabled, Arrays, Indexed }; AccelDraw accelerate_draw; -- cgit v1.2.3 From beddc8afd208a71b1ec0f012103e3ac3e058c140 Mon Sep 17 00:00:00 2001 From: bunnei Date: Sun, 8 Apr 2018 00:00:11 -0400 Subject: gl_rasterizer: Generate shaders and upload uniforms. --- src/video_core/renderer_opengl/gl_rasterizer.h | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'src/video_core/renderer_opengl/gl_rasterizer.h') diff --git a/src/video_core/renderer_opengl/gl_rasterizer.h b/src/video_core/renderer_opengl/gl_rasterizer.h index b508f5acc..32b897eb2 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer.h +++ b/src/video_core/renderer_opengl/gl_rasterizer.h @@ -15,6 +15,7 @@ #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" @@ -141,11 +142,9 @@ private: void AnalyzeVertexArray(bool is_indexed); void SetupVertexArray(u8* array_ptr, GLintptr buffer_offset); - OGLBuffer vs_uniform_buffer; + std::array uniform_buffers; - void SetupVertexShader(GLShader::VSUniformData* ub_ptr, GLintptr buffer_offset); - - void SetupFragmentShader(GLShader::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; -- cgit v1.2.3 From 1b41b875dcd24c662b947731f48f4d1c7131fa0b Mon Sep 17 00:00:00 2001 From: bunnei Date: Sat, 14 Apr 2018 18:50:06 -0400 Subject: shaders: Add NumTextureSamplers const, remove unused #pragma. --- src/video_core/renderer_opengl/gl_rasterizer.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/video_core/renderer_opengl/gl_rasterizer.h') diff --git a/src/video_core/renderer_opengl/gl_rasterizer.h b/src/video_core/renderer_opengl/gl_rasterizer.h index 32b897eb2..71c21c69b 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer.h +++ b/src/video_core/renderer_opengl/gl_rasterizer.h @@ -128,7 +128,7 @@ private: OGLVertexArray hw_vao; std::array hw_vao_enabled_attributes; - std::array texture_samplers; + std::array texture_samplers; static constexpr size_t VERTEX_BUFFER_SIZE = 128 * 1024 * 1024; std::unique_ptr vertex_buffer; OGLBuffer uniform_buffer; -- cgit v1.2.3