From 1fd979f50a9f4c21fa8cafba7268d959e3076924 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Wed, 22 Aug 2018 15:43:52 -0400 Subject: gl_shader_gen: Use a std::vector to represent program code instead of std::array While convenient as a std::array, it's also quite a large set of data as well (32KB). It being an array also means data cannot be std::moved. Any situation where the code is being set or relocated means that a full copy of that 32KB data must be done. If we use a std::vector we do need to allocate on the heap, however, it does allow us to std::move the data we have within the std::vector into another std::vector instance, eliminating the need to always copy the program data (as std::move in this case would just transfer the pointers and bare necessities over to the new vector instance). --- src/video_core/renderer_opengl/gl_rasterizer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/video_core/renderer_opengl/gl_rasterizer.cpp') diff --git a/src/video_core/renderer_opengl/gl_rasterizer.cpp b/src/video_core/renderer_opengl/gl_rasterizer.cpp index 35056d9bd..3e5142bb1 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer.cpp +++ b/src/video_core/renderer_opengl/gl_rasterizer.cpp @@ -179,7 +179,7 @@ static GLShader::ProgramCode GetShaderProgramCode(Maxwell::ShaderProgram program auto& gpu = Core::System::GetInstance().GPU().Maxwell3D(); // Fetch program code from memory - GLShader::ProgramCode program_code; + GLShader::ProgramCode program_code(GLShader::MAX_PROGRAM_CODE_LENGTH); auto& shader_config = gpu.regs.shader_config[static_cast(program)]; const u64 gpu_address{gpu.regs.code_address.CodeAddress() + shader_config.offset}; const boost::optional cpu_address{gpu.memory_manager.GpuToCpuAddress(gpu_address)}; -- cgit v1.2.3