summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/common/assert.h18
-rw-r--r--src/video_core/renderer_opengl/gl_shader_cache.cpp4
2 files changed, 22 insertions, 0 deletions
diff --git a/src/common/assert.h b/src/common/assert.h
index 6002f7ab1..4b0e3f64e 100644
--- a/src/common/assert.h
+++ b/src/common/assert.h
@@ -57,3 +57,21 @@ __declspec(noinline, noreturn)
57 57
58#define UNIMPLEMENTED_IF(cond) ASSERT_MSG(!(cond), "Unimplemented code!") 58#define UNIMPLEMENTED_IF(cond) ASSERT_MSG(!(cond), "Unimplemented code!")
59#define UNIMPLEMENTED_IF_MSG(cond, ...) ASSERT_MSG(!(cond), __VA_ARGS__) 59#define UNIMPLEMENTED_IF_MSG(cond, ...) ASSERT_MSG(!(cond), __VA_ARGS__)
60
61// If the assert is ignored, execute _b_
62#define ASSERT_OR_EXECUTE(_a_, _b_) \
63 do { \
64 ASSERT(_a_); \
65 if (!(_a_)) { \
66 _b_ \
67 } \
68 } while (0)
69
70// If the assert is ignored, execute _b_
71#define ASSERT_OR_EXECUTE_MSG(_a_, _b_, ...) \
72 do { \
73 ASSERT_MSG(_a_, __VA_ARGS__); \
74 if (!(_a_)) { \
75 _b_ \
76 } \
77 } while (0)
diff --git a/src/video_core/renderer_opengl/gl_shader_cache.cpp b/src/video_core/renderer_opengl/gl_shader_cache.cpp
index 1f8eca6f0..a9d88000e 100644
--- a/src/video_core/renderer_opengl/gl_shader_cache.cpp
+++ b/src/video_core/renderer_opengl/gl_shader_cache.cpp
@@ -41,6 +41,10 @@ GPUVAddr GetShaderAddress(Maxwell::ShaderProgram program) {
41/// Gets the shader program code from memory for the specified address 41/// Gets the shader program code from memory for the specified address
42ProgramCode GetShaderCode(const u8* host_ptr) { 42ProgramCode GetShaderCode(const u8* host_ptr) {
43 ProgramCode program_code(VideoCommon::Shader::MAX_PROGRAM_LENGTH); 43 ProgramCode program_code(VideoCommon::Shader::MAX_PROGRAM_LENGTH);
44 ASSERT_OR_EXECUTE(host_ptr != nullptr, {
45 std::fill(program_code.begin(), program_code.end(), 0);
46 return program_code;
47 });
44 std::memcpy(program_code.data(), host_ptr, program_code.size() * sizeof(u64)); 48 std::memcpy(program_code.data(), host_ptr, program_code.size() * sizeof(u64));
45 return program_code; 49 return program_code;
46} 50}