13 changed files with 4 additions and 152 deletions
-
2src/video_core/CMakeLists.txt
-
1src/video_core/renderer_opengl/gl_framebuffer_cache.cpp
-
2src/video_core/renderer_opengl/gl_framebuffer_cache.h
-
13src/video_core/renderer_opengl/gl_rasterizer.cpp
-
5src/video_core/renderer_opengl/gl_rasterizer.h
-
1src/video_core/renderer_opengl/gl_resource_manager.cpp
-
1src/video_core/renderer_opengl/gl_shader_manager.h
-
90src/video_core/renderer_opengl/gl_state.cpp
-
31src/video_core/renderer_opengl/gl_state.h
-
1src/video_core/renderer_opengl/gl_stream_buffer.cpp
-
1src/video_core/renderer_opengl/gl_texture_cache.cpp
-
5src/video_core/renderer_opengl/renderer_opengl.cpp
-
3src/video_core/renderer_opengl/renderer_opengl.h
@ -1,90 +0,0 @@ |
|||||
// Copyright 2015 Citra Emulator Project
|
|
||||
// Licensed under GPLv2 or any later version
|
|
||||
// Refer to the license.txt file included.
|
|
||||
|
|
||||
#include <algorithm>
|
|
||||
#include <iterator>
|
|
||||
#include <glad/glad.h>
|
|
||||
#include "common/assert.h"
|
|
||||
#include "common/logging/log.h"
|
|
||||
#include "common/microprofile.h"
|
|
||||
#include "video_core/renderer_opengl/gl_state.h"
|
|
||||
|
|
||||
MICROPROFILE_DEFINE(OpenGL_State, "OpenGL", "State Change", MP_RGB(192, 128, 128)); |
|
||||
|
|
||||
namespace OpenGL { |
|
||||
|
|
||||
using Maxwell = Tegra::Engines::Maxwell3D::Regs; |
|
||||
|
|
||||
OpenGLState OpenGLState::cur_state; |
|
||||
|
|
||||
namespace { |
|
||||
|
|
||||
template <typename T> |
|
||||
bool UpdateValue(T& current_value, const T new_value) { |
|
||||
const bool changed = current_value != new_value; |
|
||||
current_value = new_value; |
|
||||
return changed; |
|
||||
} |
|
||||
|
|
||||
template <typename T1, typename T2> |
|
||||
bool UpdateTie(T1 current_value, const T2 new_value) { |
|
||||
const bool changed = current_value != new_value; |
|
||||
current_value = new_value; |
|
||||
return changed; |
|
||||
} |
|
||||
|
|
||||
template <typename T> |
|
||||
std::optional<std::pair<GLuint, GLsizei>> UpdateArray(T& current_values, const T& new_values) { |
|
||||
std::optional<std::size_t> first; |
|
||||
std::size_t last; |
|
||||
for (std::size_t i = 0; i < std::size(current_values); ++i) { |
|
||||
if (!UpdateValue(current_values[i], new_values[i])) { |
|
||||
continue; |
|
||||
} |
|
||||
if (!first) { |
|
||||
first = i; |
|
||||
} |
|
||||
last = i; |
|
||||
} |
|
||||
if (!first) { |
|
||||
return std::nullopt; |
|
||||
} |
|
||||
return std::make_pair(static_cast<GLuint>(*first), static_cast<GLsizei>(last - *first + 1)); |
|
||||
} |
|
||||
|
|
||||
void Enable(GLenum cap, bool enable) { |
|
||||
if (enable) { |
|
||||
glEnable(cap); |
|
||||
} else { |
|
||||
glDisable(cap); |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
void Enable(GLenum cap, GLuint index, bool enable) { |
|
||||
if (enable) { |
|
||||
glEnablei(cap, index); |
|
||||
} else { |
|
||||
glDisablei(cap, index); |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
void Enable(GLenum cap, bool& current_value, bool new_value) { |
|
||||
if (UpdateValue(current_value, new_value)) { |
|
||||
Enable(cap, new_value); |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
void Enable(GLenum cap, GLuint index, bool& current_value, bool new_value) { |
|
||||
if (UpdateValue(current_value, new_value)) { |
|
||||
Enable(cap, index, new_value); |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
} // Anonymous namespace
|
|
||||
|
|
||||
OpenGLState::OpenGLState() = default; |
|
||||
|
|
||||
void OpenGLState::Apply() {} |
|
||||
|
|
||||
} // namespace OpenGL
|
|
||||
@ -1,31 +0,0 @@ |
|||||
// Copyright 2015 Citra Emulator Project |
|
||||
// Licensed under GPLv2 or any later version |
|
||||
// Refer to the license.txt file included. |
|
||||
|
|
||||
#pragma once |
|
||||
|
|
||||
#include <array> |
|
||||
#include <type_traits> |
|
||||
#include <glad/glad.h> |
|
||||
#include "video_core/engines/maxwell_3d.h" |
|
||||
|
|
||||
namespace OpenGL { |
|
||||
|
|
||||
class OpenGLState { |
|
||||
public: |
|
||||
OpenGLState(); |
|
||||
|
|
||||
/// Get the currently active OpenGL state |
|
||||
static OpenGLState GetCurState() { |
|
||||
return cur_state; |
|
||||
} |
|
||||
|
|
||||
/// Apply this state as the current OpenGL state |
|
||||
void Apply(); |
|
||||
|
|
||||
private: |
|
||||
static OpenGLState cur_state; |
|
||||
}; |
|
||||
static_assert(std::is_trivially_copyable_v<OpenGLState>); |
|
||||
|
|
||||
} // namespace OpenGL |
|
||||
Write
Preview
Loading…
Cancel
Save
Reference in new issue