summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/audio_core/time_stretch.cpp6
-rw-r--r--src/video_core/CMakeLists.txt2
-rw-r--r--src/video_core/renderer_opengl/gl_rasterizer_cache.cpp9
-rw-r--r--src/video_core/renderer_opengl/gl_rasterizer_cache.h2
-rw-r--r--src/video_core/renderer_opengl/gl_shader_cache.cpp5
-rw-r--r--src/video_core/renderer_opengl/utils.cpp38
-rw-r--r--src/video_core/renderer_opengl/utils.h15
-rw-r--r--src/video_core/utils.h26
8 files changed, 67 insertions, 36 deletions
diff --git a/src/audio_core/time_stretch.cpp b/src/audio_core/time_stretch.cpp
index cee8b12dd..2fe0b3aef 100644
--- a/src/audio_core/time_stretch.cpp
+++ b/src/audio_core/time_stretch.cpp
@@ -32,10 +32,10 @@ std::size_t TimeStretcher::Process(const s16* in, std::size_t num_in, s16* out,
32 // We were given actual_samples number of samples, and num_samples were requested from us. 32 // We were given actual_samples number of samples, and num_samples were requested from us.
33 double current_ratio = static_cast<double>(num_in) / static_cast<double>(num_out); 33 double current_ratio = static_cast<double>(num_in) / static_cast<double>(num_out);
34 34
35 const double max_latency = 1.0; // seconds 35 const double max_latency = 0.25; // seconds
36 const double max_backlog = m_sample_rate * max_latency; 36 const double max_backlog = m_sample_rate * max_latency;
37 const double backlog_fullness = m_sound_touch.numSamples() / max_backlog; 37 const double backlog_fullness = m_sound_touch.numSamples() / max_backlog;
38 if (backlog_fullness > 5.0) { 38 if (backlog_fullness > 4.0) {
39 // Too many samples in backlog: Don't push anymore on 39 // Too many samples in backlog: Don't push anymore on
40 num_in = 0; 40 num_in = 0;
41 } 41 }
@@ -49,7 +49,7 @@ std::size_t TimeStretcher::Process(const s16* in, std::size_t num_in, s16* out,
49 49
50 // This low-pass filter smoothes out variance in the calculated stretch ratio. 50 // This low-pass filter smoothes out variance in the calculated stretch ratio.
51 // The time-scale determines how responsive this filter is. 51 // The time-scale determines how responsive this filter is.
52 constexpr double lpf_time_scale = 2.0; // seconds 52 constexpr double lpf_time_scale = 0.712; // seconds
53 const double lpf_gain = 1.0 - std::exp(-time_delta / lpf_time_scale); 53 const double lpf_gain = 1.0 - std::exp(-time_delta / lpf_time_scale);
54 m_stretch_ratio += lpf_gain * (current_ratio - m_stretch_ratio); 54 m_stretch_ratio += lpf_gain * (current_ratio - m_stretch_ratio);
55 55
diff --git a/src/video_core/CMakeLists.txt b/src/video_core/CMakeLists.txt
index 09ecc5bad..c5f7128ec 100644
--- a/src/video_core/CMakeLists.txt
+++ b/src/video_core/CMakeLists.txt
@@ -51,6 +51,8 @@ add_library(video_core STATIC
51 renderer_opengl/maxwell_to_gl.h 51 renderer_opengl/maxwell_to_gl.h
52 renderer_opengl/renderer_opengl.cpp 52 renderer_opengl/renderer_opengl.cpp
53 renderer_opengl/renderer_opengl.h 53 renderer_opengl/renderer_opengl.h
54 renderer_opengl/utils.cpp
55 renderer_opengl/utils.h
54 textures/astc.cpp 56 textures/astc.cpp
55 textures/astc.h 57 textures/astc.h
56 textures/decoders.cpp 58 textures/decoders.cpp
diff --git a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp
index 81b86b7a5..1d43a419d 100644
--- a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp
+++ b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp
@@ -16,6 +16,7 @@
16#include "core/settings.h" 16#include "core/settings.h"
17#include "video_core/engines/maxwell_3d.h" 17#include "video_core/engines/maxwell_3d.h"
18#include "video_core/renderer_opengl/gl_rasterizer_cache.h" 18#include "video_core/renderer_opengl/gl_rasterizer_cache.h"
19#include "video_core/renderer_opengl/utils.h"
19#include "video_core/textures/astc.h" 20#include "video_core/textures/astc.h"
20#include "video_core/textures/decoders.h" 21#include "video_core/textures/decoders.h"
21#include "video_core/utils.h" 22#include "video_core/utils.h"
@@ -282,7 +283,7 @@ static constexpr std::array<FormatTuple, SurfaceParams::MaxPixelFormat> tex_form
282 {GL_R11F_G11F_B10F, GL_RGB, GL_UNSIGNED_INT_10F_11F_11F_REV, ComponentType::Float, 283 {GL_R11F_G11F_B10F, GL_RGB, GL_UNSIGNED_INT_10F_11F_11F_REV, ComponentType::Float,
283 false}, // R11FG11FB10F 284 false}, // R11FG11FB10F
284 {GL_RGBA32UI, GL_RGBA_INTEGER, GL_UNSIGNED_INT, ComponentType::UInt, false}, // RGBA32UI 285 {GL_RGBA32UI, GL_RGBA_INTEGER, GL_UNSIGNED_INT, ComponentType::UInt, false}, // RGBA32UI
285 {GL_COMPRESSED_RGB_S3TC_DXT1_EXT, GL_RGB, GL_UNSIGNED_INT_8_8_8_8, ComponentType::UNorm, 286 {GL_COMPRESSED_RGBA_S3TC_DXT1_EXT, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8, ComponentType::UNorm,
286 true}, // DXT1 287 true}, // DXT1
287 {GL_COMPRESSED_RGBA_S3TC_DXT3_EXT, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8, ComponentType::UNorm, 288 {GL_COMPRESSED_RGBA_S3TC_DXT3_EXT, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8, ComponentType::UNorm,
288 true}, // DXT23 289 true}, // DXT23
@@ -327,7 +328,7 @@ static constexpr std::array<FormatTuple, SurfaceParams::MaxPixelFormat> tex_form
327 {GL_RGBA8, GL_RGBA, GL_UNSIGNED_BYTE, ComponentType::UNorm, false}, // ASTC_2D_5X4 328 {GL_RGBA8, GL_RGBA, GL_UNSIGNED_BYTE, ComponentType::UNorm, false}, // ASTC_2D_5X4
328 {GL_SRGB8_ALPHA8, GL_BGRA, GL_UNSIGNED_BYTE, ComponentType::UNorm, false}, // BGRA8 329 {GL_SRGB8_ALPHA8, GL_BGRA, GL_UNSIGNED_BYTE, ComponentType::UNorm, false}, // BGRA8
329 // Compressed sRGB formats 330 // Compressed sRGB formats
330 {GL_COMPRESSED_SRGB_S3TC_DXT1_EXT, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8, ComponentType::UNorm, 331 {GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8, ComponentType::UNorm,
331 true}, // DXT1_SRGB 332 true}, // DXT1_SRGB
332 {GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8, ComponentType::UNorm, 333 {GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT, GL_RGBA, GL_UNSIGNED_INT_8_8_8_8, ComponentType::UNorm,
333 true}, // DXT23_SRGB 334 true}, // DXT23_SRGB
@@ -884,8 +885,8 @@ CachedSurface::CachedSurface(const SurfaceParams& params)
884 glTexParameterf(SurfaceTargetToGL(params.target), GL_TEXTURE_LOD_BIAS, 1000.0); 885 glTexParameterf(SurfaceTargetToGL(params.target), GL_TEXTURE_LOD_BIAS, 1000.0);
885 } 886 }
886 887
887 VideoCore::LabelGLObject(GL_TEXTURE, texture.handle, params.addr, 888 LabelGLObject(GL_TEXTURE, texture.handle, params.addr,
888 SurfaceParams::SurfaceTargetName(params.target)); 889 SurfaceParams::SurfaceTargetName(params.target));
889 890
890 // Clamp size to mapped GPU memory region 891 // Clamp size to mapped GPU memory region
891 // TODO(bunnei): Super Mario Odyssey maps a 0x40000 byte region and then uses it for a 0x80000 892 // TODO(bunnei): Super Mario Odyssey maps a 0x40000 byte region and then uses it for a 0x80000
diff --git a/src/video_core/renderer_opengl/gl_rasterizer_cache.h b/src/video_core/renderer_opengl/gl_rasterizer_cache.h
index 15ac4a1b1..e72f4f2d2 100644
--- a/src/video_core/renderer_opengl/gl_rasterizer_cache.h
+++ b/src/video_core/renderer_opengl/gl_rasterizer_cache.h
@@ -404,7 +404,7 @@ struct SurfaceParams {
404 128, // BC7U 404 128, // BC7U
405 32, // ASTC_2D_4X4_SRGB 405 32, // ASTC_2D_4X4_SRGB
406 16, // ASTC_2D_8X8_SRGB 406 16, // ASTC_2D_8X8_SRGB
407 32, // ASTC_2D_8X5_SRGB 407 16, // ASTC_2D_8X5_SRGB
408 32, // ASTC_2D_5X4_SRGB 408 32, // ASTC_2D_5X4_SRGB
409 32, // Z32F 409 32, // Z32F
410 16, // Z16 410 16, // Z16
diff --git a/src/video_core/renderer_opengl/gl_shader_cache.cpp b/src/video_core/renderer_opengl/gl_shader_cache.cpp
index 1a03a677f..9522fd344 100644
--- a/src/video_core/renderer_opengl/gl_shader_cache.cpp
+++ b/src/video_core/renderer_opengl/gl_shader_cache.cpp
@@ -8,6 +8,7 @@
8#include "video_core/engines/maxwell_3d.h" 8#include "video_core/engines/maxwell_3d.h"
9#include "video_core/renderer_opengl/gl_shader_cache.h" 9#include "video_core/renderer_opengl/gl_shader_cache.h"
10#include "video_core/renderer_opengl/gl_shader_manager.h" 10#include "video_core/renderer_opengl/gl_shader_manager.h"
11#include "video_core/renderer_opengl/utils.h"
11#include "video_core/utils.h" 12#include "video_core/utils.h"
12 13
13namespace OpenGL { 14namespace OpenGL {
@@ -89,7 +90,7 @@ CachedShader::CachedShader(VAddr addr, Maxwell::ShaderProgram program_type)
89 shader.Create(program_result.first.c_str(), gl_type); 90 shader.Create(program_result.first.c_str(), gl_type);
90 program.Create(true, shader.handle); 91 program.Create(true, shader.handle);
91 SetShaderUniformBlockBindings(program.handle); 92 SetShaderUniformBlockBindings(program.handle);
92 VideoCore::LabelGLObject(GL_PROGRAM, program.handle, addr); 93 LabelGLObject(GL_PROGRAM, program.handle, addr);
93 } else { 94 } else {
94 // Store shader's code to lazily build it on draw 95 // Store shader's code to lazily build it on draw
95 geometry_programs.code = program_result.first; 96 geometry_programs.code = program_result.first;
@@ -130,7 +131,7 @@ GLuint CachedShader::LazyGeometryProgram(OGLProgram& target_program,
130 shader.Create(source.c_str(), GL_GEOMETRY_SHADER); 131 shader.Create(source.c_str(), GL_GEOMETRY_SHADER);
131 target_program.Create(true, shader.handle); 132 target_program.Create(true, shader.handle);
132 SetShaderUniformBlockBindings(target_program.handle); 133 SetShaderUniformBlockBindings(target_program.handle);
133 VideoCore::LabelGLObject(GL_PROGRAM, target_program.handle, addr, debug_name); 134 LabelGLObject(GL_PROGRAM, target_program.handle, addr, debug_name);
134 return target_program.handle; 135 return target_program.handle;
135}; 136};
136 137
diff --git a/src/video_core/renderer_opengl/utils.cpp b/src/video_core/renderer_opengl/utils.cpp
new file mode 100644
index 000000000..d84634cb3
--- /dev/null
+++ b/src/video_core/renderer_opengl/utils.cpp
@@ -0,0 +1,38 @@
1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2 or any later version
3// Refer to the license.txt file included.
4
5#include <string>
6#include <fmt/format.h>
7#include <glad/glad.h>
8#include "common/common_types.h"
9#include "video_core/renderer_opengl/utils.h"
10
11namespace OpenGL {
12
13void LabelGLObject(GLenum identifier, GLuint handle, VAddr addr, std::string extra_info) {
14 if (!GLAD_GL_KHR_debug) {
15 return; // We don't need to throw an error as this is just for debugging
16 }
17 const std::string nice_addr = fmt::format("0x{:016x}", addr);
18 std::string object_label;
19
20 if (extra_info.empty()) {
21 switch (identifier) {
22 case GL_TEXTURE:
23 object_label = "Texture@" + nice_addr;
24 break;
25 case GL_PROGRAM:
26 object_label = "Shader@" + nice_addr;
27 break;
28 default:
29 object_label = fmt::format("Object(0x{:x})@{}", identifier, nice_addr);
30 break;
31 }
32 } else {
33 object_label = extra_info + '@' + nice_addr;
34 }
35 glObjectLabel(identifier, handle, -1, static_cast<const GLchar*>(object_label.c_str()));
36}
37
38} // namespace OpenGL \ No newline at end of file
diff --git a/src/video_core/renderer_opengl/utils.h b/src/video_core/renderer_opengl/utils.h
new file mode 100644
index 000000000..1fcb6fc11
--- /dev/null
+++ b/src/video_core/renderer_opengl/utils.h
@@ -0,0 +1,15 @@
1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2 or any later version
3// Refer to the license.txt file included.
4
5#pragma once
6
7#include <string>
8#include <glad/glad.h>
9#include "common/common_types.h"
10
11namespace OpenGL {
12
13void LabelGLObject(GLenum identifier, GLuint handle, VAddr addr, std::string extra_info = "");
14
15} // namespace OpenGL \ No newline at end of file
diff --git a/src/video_core/utils.h b/src/video_core/utils.h
index 237cc1307..e0a14d48f 100644
--- a/src/video_core/utils.h
+++ b/src/video_core/utils.h
@@ -161,30 +161,4 @@ static inline void MortonCopyPixels128(u32 width, u32 height, u32 bytes_per_pixe
161 } 161 }
162} 162}
163 163
164static void LabelGLObject(GLenum identifier, GLuint handle, VAddr addr,
165 std::string extra_info = "") {
166 if (!GLAD_GL_KHR_debug) {
167 return; // We don't need to throw an error as this is just for debugging
168 }
169 const std::string nice_addr = fmt::format("0x{:016x}", addr);
170 std::string object_label;
171
172 if (extra_info.empty()) {
173 switch (identifier) {
174 case GL_TEXTURE:
175 object_label = "Texture@" + nice_addr;
176 break;
177 case GL_PROGRAM:
178 object_label = "Shader@" + nice_addr;
179 break;
180 default:
181 object_label = fmt::format("Object(0x{:x})@{}", identifier, nice_addr);
182 break;
183 }
184 } else {
185 object_label = extra_info + '@' + nice_addr;
186 }
187 glObjectLabel(identifier, handle, -1, static_cast<const GLchar*>(object_label.c_str()));
188}
189
190} // namespace VideoCore 164} // namespace VideoCore