mirror of
https://github.com/PabloMK7/citra.git
synced 2025-09-12 05:40:04 +00:00
video_core: Run clang format
This commit is contained in:
parent
f478e3093f
commit
31e6b553dc
24 changed files with 147 additions and 150 deletions
|
@ -81,8 +81,8 @@ void main() {
|
|||
|
||||
glFramebufferTexture2D(GL_DRAW_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D,
|
||||
dst_tex.handle, 0);
|
||||
glFramebufferTexture2D(GL_DRAW_FRAMEBUFFER, GL_DEPTH_STENCIL_ATTACHMENT, GL_TEXTURE_2D,
|
||||
0, 0);
|
||||
glFramebufferTexture2D(GL_DRAW_FRAMEBUFFER, GL_DEPTH_STENCIL_ATTACHMENT, GL_TEXTURE_2D, 0,
|
||||
0);
|
||||
|
||||
glUniform2i(dst_size_loc, dst_rect.GetWidth(), dst_rect.GetHeight());
|
||||
glUniform2i(src_size_loc, src_rect.GetWidth(), src_rect.GetHeight());
|
||||
|
@ -96,7 +96,6 @@ private:
|
|||
OGLVertexArray vao;
|
||||
};
|
||||
|
||||
|
||||
class ShaderD24S8toRGBA8 final : public FormatReinterpreterBase {
|
||||
public:
|
||||
ShaderD24S8toRGBA8() {
|
||||
|
@ -186,7 +185,8 @@ void main() {
|
|||
if (use_texture_view) {
|
||||
temp_tex.Create();
|
||||
glActiveTexture(GL_TEXTURE1);
|
||||
glTextureView(temp_tex.handle, GL_TEXTURE_2D, src_tex.handle, GL_DEPTH24_STENCIL8, 0, 1, 0, 1);
|
||||
glTextureView(temp_tex.handle, GL_TEXTURE_2D, src_tex.handle, GL_DEPTH24_STENCIL8, 0, 1,
|
||||
0, 1);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
||||
} else if (src_rect.top > temp_rect.top || src_rect.right > temp_rect.right) {
|
||||
|
@ -220,8 +220,8 @@ void main() {
|
|||
|
||||
glFramebufferTexture2D(GL_DRAW_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D,
|
||||
dst_tex.handle, 0);
|
||||
glFramebufferTexture2D(GL_DRAW_FRAMEBUFFER, GL_DEPTH_STENCIL_ATTACHMENT, GL_TEXTURE_2D,
|
||||
0, 0);
|
||||
glFramebufferTexture2D(GL_DRAW_FRAMEBUFFER, GL_DEPTH_STENCIL_ATTACHMENT, GL_TEXTURE_2D, 0,
|
||||
0);
|
||||
|
||||
glUniform2i(dst_size_loc, dst_rect.GetWidth(), dst_rect.GetHeight());
|
||||
glUniform2i(src_size_loc, src_rect.GetWidth(), src_rect.GetHeight());
|
||||
|
|
|
@ -148,8 +148,8 @@ RasterizerOpenGL::RasterizerOpenGL(Frontend::EmuWindow& emu_window)
|
|||
emu_window,
|
||||
VideoCore::g_separable_shader_enabled ? GLAD_GL_ARB_separate_shader_objects : false);
|
||||
} else {
|
||||
shader_program_manager = std::make_unique<ShaderProgramManager>(
|
||||
emu_window, GLAD_GL_ARB_separate_shader_objects);
|
||||
shader_program_manager =
|
||||
std::make_unique<ShaderProgramManager>(emu_window, GLAD_GL_ARB_separate_shader_objects);
|
||||
}
|
||||
#else
|
||||
shader_program_manager = std::make_unique<ShaderProgramManager>(emu_window, true);
|
||||
|
@ -726,12 +726,10 @@ bool RasterizerOpenGL::Draw(bool accelerate, bool is_indexed) {
|
|||
// Making a copy to sample from eliminates this issue and seems to be fairly cheap.
|
||||
temp_tex.Create();
|
||||
temp_tex.Allocate(GL_TEXTURE_2D, levels, tuple.internal_format,
|
||||
color_surface->GetScaledWidth(),
|
||||
color_surface->GetScaledHeight());
|
||||
color_surface->GetScaledWidth(), color_surface->GetScaledHeight());
|
||||
|
||||
temp_tex.CopyFrom(color_surface->texture, GL_TEXTURE_2D, levels,
|
||||
color_surface->GetScaledWidth(),
|
||||
color_surface->GetScaledHeight());
|
||||
color_surface->GetScaledWidth(), color_surface->GetScaledHeight());
|
||||
|
||||
for (auto& unit : state.texture_units) {
|
||||
if (unit.texture_2d == color_surface->texture.handle) {
|
||||
|
@ -1902,11 +1900,9 @@ void RasterizerOpenGL::SyncLightAmbient(int light_index) {
|
|||
|
||||
void RasterizerOpenGL::SyncLightPosition(int light_index) {
|
||||
const auto& light = Pica::g_state.regs.lighting.light[light_index];
|
||||
const Common::Vec3f position = {
|
||||
Pica::float16::FromRaw(light.x).ToFloat32(),
|
||||
Pica::float16::FromRaw(light.y).ToFloat32(),
|
||||
Pica::float16::FromRaw(light.z).ToFloat32()
|
||||
};
|
||||
const Common::Vec3f position = {Pica::float16::FromRaw(light.x).ToFloat32(),
|
||||
Pica::float16::FromRaw(light.y).ToFloat32(),
|
||||
Pica::float16::FromRaw(light.z).ToFloat32()};
|
||||
|
||||
if (position != uniform_block_data.data.light_src[light_index].position) {
|
||||
uniform_block_data.data.light_src[light_index].position = position;
|
||||
|
@ -1916,8 +1912,7 @@ void RasterizerOpenGL::SyncLightPosition(int light_index) {
|
|||
|
||||
void RasterizerOpenGL::SyncLightSpotDirection(int light_index) {
|
||||
const auto& light = Pica::g_state.regs.lighting.light[light_index];
|
||||
const auto spot_direction = Common::Vec3u{light.spot_x, light.spot_y, light.spot_z}
|
||||
/ 2047.0f;
|
||||
const auto spot_direction = Common::Vec3u{light.spot_x, light.spot_y, light.spot_z} / 2047.0f;
|
||||
|
||||
if (spot_direction != uniform_block_data.data.light_src[light_index].spot_direction) {
|
||||
uniform_block_data.data.light_src[light_index].spot_direction = spot_direction;
|
||||
|
@ -2019,7 +2014,8 @@ void RasterizerOpenGL::SyncAndUploadLUTsLF() {
|
|||
|
||||
if (new_data != fog_lut_data || invalidate) {
|
||||
fog_lut_data = new_data;
|
||||
std::memcpy(buffer + bytes_used, new_data.data(), new_data.size() * sizeof(Common::Vec2f));
|
||||
std::memcpy(buffer + bytes_used, new_data.data(),
|
||||
new_data.size() * sizeof(Common::Vec2f));
|
||||
uniform_block_data.data.fog_lut_offset =
|
||||
static_cast<int>((offset + bytes_used) / sizeof(Common::Vec2f));
|
||||
uniform_block_data.dirty = true;
|
||||
|
@ -2032,9 +2028,10 @@ void RasterizerOpenGL::SyncAndUploadLUTsLF() {
|
|||
}
|
||||
|
||||
void RasterizerOpenGL::SyncAndUploadLUTs() {
|
||||
constexpr std::size_t max_size = sizeof(Common::Vec2f) * 128 * 3 + // proctex: noise + color + alpha
|
||||
sizeof(Common::Vec4f) * 256 + // proctex
|
||||
sizeof(Common::Vec4f) * 256; // proctex diff
|
||||
constexpr std::size_t max_size =
|
||||
sizeof(Common::Vec2f) * 128 * 3 + // proctex: noise + color + alpha
|
||||
sizeof(Common::Vec4f) * 256 + // proctex
|
||||
sizeof(Common::Vec4f) * 256; // proctex diff
|
||||
|
||||
if (!uniform_block_data.proctex_noise_lut_dirty &&
|
||||
!uniform_block_data.proctex_color_map_dirty &&
|
||||
|
@ -2061,7 +2058,8 @@ void RasterizerOpenGL::SyncAndUploadLUTs() {
|
|||
|
||||
if (new_data != lut_data || invalidate) {
|
||||
lut_data = new_data;
|
||||
std::memcpy(buffer + bytes_used, new_data.data(), new_data.size() * sizeof(Common::Vec2f));
|
||||
std::memcpy(buffer + bytes_used, new_data.data(),
|
||||
new_data.size() * sizeof(Common::Vec2f));
|
||||
lut_offset = static_cast<GLint>((offset + bytes_used) / sizeof(Common::Vec2f));
|
||||
uniform_block_data.dirty = true;
|
||||
bytes_used += new_data.size() * sizeof(Common::Vec2f);
|
||||
|
@ -2102,7 +2100,8 @@ void RasterizerOpenGL::SyncAndUploadLUTs() {
|
|||
|
||||
if (new_data != proctex_lut_data || invalidate) {
|
||||
proctex_lut_data = new_data;
|
||||
std::memcpy(buffer + bytes_used, new_data.data(), new_data.size() * sizeof(Common::Vec4f));
|
||||
std::memcpy(buffer + bytes_used, new_data.data(),
|
||||
new_data.size() * sizeof(Common::Vec4f));
|
||||
uniform_block_data.data.proctex_lut_offset =
|
||||
static_cast<GLint>((offset + bytes_used) / sizeof(Common::Vec4f));
|
||||
uniform_block_data.dirty = true;
|
||||
|
@ -2124,7 +2123,8 @@ void RasterizerOpenGL::SyncAndUploadLUTs() {
|
|||
|
||||
if (new_data != proctex_diff_lut_data || invalidate) {
|
||||
proctex_diff_lut_data = new_data;
|
||||
std::memcpy(buffer + bytes_used, new_data.data(), new_data.size() * sizeof(Common::Vec4f));
|
||||
std::memcpy(buffer + bytes_used, new_data.data(),
|
||||
new_data.size() * sizeof(Common::Vec4f));
|
||||
uniform_block_data.data.proctex_diff_lut_offset =
|
||||
static_cast<GLint>((offset + bytes_used) / sizeof(Common::Vec4f));
|
||||
uniform_block_data.dirty = true;
|
||||
|
|
|
@ -6,10 +6,10 @@
|
|||
#include "common/vector_math.h"
|
||||
#include "core/hw/gpu.h"
|
||||
#include "video_core/pica_types.h"
|
||||
#include "video_core/rasterizer_cache/rasterizer_cache.h"
|
||||
#include "video_core/rasterizer_interface.h"
|
||||
#include "video_core/regs_lighting.h"
|
||||
#include "video_core/regs_texturing.h"
|
||||
#include "video_core/rasterizer_cache/rasterizer_cache.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"
|
||||
|
@ -298,7 +298,8 @@ private:
|
|||
OGLTexture texture_buffer_lut_rg;
|
||||
OGLTexture texture_buffer_lut_rgba;
|
||||
|
||||
std::array<std::array<Common::Vec2f, 256>, Pica::LightingRegs::NumLightingSampler> lighting_lut_data{};
|
||||
std::array<std::array<Common::Vec2f, 256>, Pica::LightingRegs::NumLightingSampler>
|
||||
lighting_lut_data{};
|
||||
std::array<Common::Vec2f, 128> fog_lut_data{};
|
||||
std::array<Common::Vec2f, 128> proctex_noise_lut_data{};
|
||||
std::array<Common::Vec2f, 128> proctex_color_map_data{};
|
||||
|
|
|
@ -52,8 +52,8 @@ void OGLTexture::Release() {
|
|||
handle = 0;
|
||||
}
|
||||
|
||||
void OGLTexture::Allocate(GLenum target, GLsizei levels, GLenum internalformat,
|
||||
GLsizei width, GLsizei height, GLsizei depth) {
|
||||
void OGLTexture::Allocate(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width,
|
||||
GLsizei height, GLsizei depth) {
|
||||
GLuint old_tex = OpenGLState::GetCurState().texture_units[0].texture_2d;
|
||||
glActiveTexture(GL_TEXTURE0);
|
||||
glBindTexture(GL_TEXTURE_2D, handle);
|
||||
|
@ -83,17 +83,15 @@ void OGLTexture::Allocate(GLenum target, GLsizei levels, GLenum internalformat,
|
|||
glBindTexture(GL_TEXTURE_2D, old_tex);
|
||||
}
|
||||
|
||||
void OGLTexture::CopyFrom(const OGLTexture& other, GLenum target, GLsizei levels,
|
||||
GLsizei width, GLsizei height) {
|
||||
void OGLTexture::CopyFrom(const OGLTexture& other, GLenum target, GLsizei levels, GLsizei width,
|
||||
GLsizei height) {
|
||||
GLuint old_tex = OpenGLState::GetCurState().texture_units[0].texture_2d;
|
||||
glActiveTexture(GL_TEXTURE0);
|
||||
glBindTexture(GL_TEXTURE_2D, handle);
|
||||
|
||||
for (u32 level = 0; level < levels; level++) {
|
||||
glCopyImageSubData(other.handle, target, level, 0, 0, 0,
|
||||
handle, target, level, 0, 0, 0,
|
||||
width >> level,
|
||||
height >> level, 1);
|
||||
glCopyImageSubData(other.handle, target, level, 0, 0, 0, handle, target, level, 0, 0, 0,
|
||||
width >> level, height >> level, 1);
|
||||
}
|
||||
|
||||
glBindTexture(GL_TEXTURE_2D, old_tex);
|
||||
|
|
|
@ -58,11 +58,11 @@ public:
|
|||
/// Deletes the internal OpenGL resource
|
||||
void Release();
|
||||
|
||||
void Allocate(GLenum target, GLsizei levels, GLenum internalformat,
|
||||
GLsizei width, GLsizei height = 1, GLsizei depth = 1);
|
||||
void Allocate(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width,
|
||||
GLsizei height = 1, GLsizei depth = 1);
|
||||
|
||||
void CopyFrom(const OGLTexture& other, GLenum target, GLsizei levels,
|
||||
GLsizei width, GLsizei height);
|
||||
void CopyFrom(const OGLTexture& other, GLenum target, GLsizei levels, GLsizei width,
|
||||
GLsizei height);
|
||||
|
||||
GLuint handle = 0;
|
||||
};
|
||||
|
|
|
@ -3,17 +3,17 @@
|
|||
// Refer to the license.txt file included.
|
||||
|
||||
#include <algorithm>
|
||||
#include <thread>
|
||||
#include <set>
|
||||
#include <thread>
|
||||
#include <unordered_map>
|
||||
#include <boost/variant.hpp>
|
||||
#include <boost/functional/hash.hpp>
|
||||
#include <boost/variant.hpp>
|
||||
#include "core/frontend/scope_acquire_context.h"
|
||||
#include "video_core/renderer_opengl/gl_resource_manager.h"
|
||||
#include "video_core/renderer_opengl/gl_shader_disk_cache.h"
|
||||
#include "video_core/renderer_opengl/gl_shader_manager.h"
|
||||
#include "video_core/renderer_opengl/gl_vars.h"
|
||||
#include "video_core/renderer_opengl/gl_state.h"
|
||||
#include "video_core/renderer_opengl/gl_vars.h"
|
||||
#include "video_core/video_core.h"
|
||||
|
||||
namespace OpenGL {
|
||||
|
|
|
@ -20,7 +20,7 @@ class EmuWindow;
|
|||
namespace Pica {
|
||||
struct Regs;
|
||||
struct ShaderRegs;
|
||||
}
|
||||
} // namespace Pica
|
||||
|
||||
namespace Pica::Shader {
|
||||
struct ShaderSetup;
|
||||
|
|
|
@ -232,8 +232,8 @@ inline GLenum StencilOp(Pica::FramebufferRegs::StencilAction action) {
|
|||
}
|
||||
|
||||
inline Common::Vec4f ColorRGBA8(const u32 color) {
|
||||
const auto rgba = Common::Vec4u{color >> 0 & 0xFF, color >> 8 & 0xFF,
|
||||
color >> 16 & 0xFF, color >> 24 & 0xFF};
|
||||
const auto rgba =
|
||||
Common::Vec4u{color >> 0 & 0xFF, color >> 8 & 0xFF, color >> 16 & 0xFF, color >> 24 & 0xFF};
|
||||
return rgba / 255.0f;
|
||||
}
|
||||
|
||||
|
|
|
@ -16,8 +16,8 @@
|
|||
#include "core/tracer/recorder.h"
|
||||
#include "video_core/debug_utils/debug_utils.h"
|
||||
#include "video_core/rasterizer_interface.h"
|
||||
#include "video_core/renderer_opengl/gl_state.h"
|
||||
#include "video_core/renderer_opengl/gl_shader_util.h"
|
||||
#include "video_core/renderer_opengl/gl_state.h"
|
||||
#include "video_core/renderer_opengl/gl_vars.h"
|
||||
#include "video_core/renderer_opengl/post_processing_opengl.h"
|
||||
#include "video_core/renderer_opengl/renderer_opengl.h"
|
||||
|
|
|
@ -6,12 +6,12 @@
|
|||
#include <vector>
|
||||
#include <fmt/chrono.h>
|
||||
#include "common/logging/log.h"
|
||||
#include "video_core/rasterizer_cache/rasterizer_cache_utils.h"
|
||||
#include "video_core/renderer_opengl/gl_state.h"
|
||||
#include "video_core/renderer_opengl/texture_downloader_es.h"
|
||||
#include "shaders/depth_to_color.frag"
|
||||
#include "shaders/depth_to_color.vert"
|
||||
#include "shaders/ds_to_color.frag"
|
||||
#include "video_core/rasterizer_cache/rasterizer_cache_utils.h"
|
||||
#include "video_core/renderer_opengl/gl_state.h"
|
||||
#include "video_core/renderer_opengl/texture_downloader_es.h"
|
||||
|
||||
namespace OpenGL {
|
||||
|
||||
|
|
|
@ -133,8 +133,8 @@ void Anime4kUltrafast::Filter(const OGLTexture& src_tex, Common::Rectangle<u32>
|
|||
state.draw.shader_program = refine_program.handle;
|
||||
state.Apply();
|
||||
|
||||
glFramebufferTexture2D(GL_DRAW_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D,
|
||||
dst_tex.handle, 0);
|
||||
glFramebufferTexture2D(GL_DRAW_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, dst_tex.handle,
|
||||
0);
|
||||
glFramebufferTexture2D(GL_DRAW_FRAMEBUFFER, GL_DEPTH_STENCIL_ATTACHMENT, GL_TEXTURE_2D, 0, 0);
|
||||
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
|
||||
|
||||
|
|
|
@ -35,8 +35,8 @@ void Bicubic::Filter(const OGLTexture& src_tex, Common::Rectangle<u32> src_rect,
|
|||
static_cast<GLsizei>(dst_rect.GetHeight())};
|
||||
state.Apply();
|
||||
|
||||
glFramebufferTexture2D(GL_DRAW_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D,
|
||||
dst_tex.handle, 0);
|
||||
glFramebufferTexture2D(GL_DRAW_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, dst_tex.handle,
|
||||
0);
|
||||
glFramebufferTexture2D(GL_DRAW_FRAMEBUFFER, GL_DEPTH_STENCIL_ATTACHMENT, GL_TEXTURE_2D, 0, 0);
|
||||
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
|
||||
|
||||
|
|
|
@ -35,8 +35,8 @@ void ScaleForce::Filter(const OGLTexture& src_tex, Common::Rectangle<u32> src_re
|
|||
static_cast<GLsizei>(dst_rect.GetHeight())};
|
||||
state.Apply();
|
||||
|
||||
glFramebufferTexture2D(GL_DRAW_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D,
|
||||
dst_tex.handle, 0);
|
||||
glFramebufferTexture2D(GL_DRAW_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, dst_tex.handle,
|
||||
0);
|
||||
glFramebufferTexture2D(GL_DRAW_FRAMEBUFFER, GL_DEPTH_STENCIL_ATTACHMENT, GL_TEXTURE_2D, 0, 0);
|
||||
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
|
||||
|
||||
|
|
|
@ -15,6 +15,7 @@ class OGLTexture;
|
|||
|
||||
class TextureFilterBase {
|
||||
friend class TextureFilterer;
|
||||
|
||||
public:
|
||||
explicit TextureFilterBase(u16 scale_factor) : scale_factor(scale_factor) {
|
||||
draw_fbo.Create();
|
||||
|
|
|
@ -27,8 +27,7 @@ public:
|
|||
|
||||
// Returns true if the texture was able to be filtered
|
||||
bool Filter(const OGLTexture& src_tex, Common::Rectangle<u32> src_rect,
|
||||
const OGLTexture& dst_tex, Common::Rectangle<u32> dst_rect,
|
||||
SurfaceType type);
|
||||
const OGLTexture& dst_tex, Common::Rectangle<u32> dst_rect, SurfaceType type);
|
||||
|
||||
static std::vector<std::string_view> GetFilterNames();
|
||||
|
||||
|
|
|
@ -47,8 +47,7 @@
|
|||
|
||||
namespace OpenGL {
|
||||
|
||||
XbrzFreescale::XbrzFreescale(u16 scale_factor) :
|
||||
TextureFilterBase(scale_factor) {
|
||||
XbrzFreescale::XbrzFreescale(u16 scale_factor) : TextureFilterBase(scale_factor) {
|
||||
|
||||
const OpenGLState cur_state = OpenGLState::GetCurState();
|
||||
|
||||
|
@ -84,8 +83,8 @@ void XbrzFreescale::Filter(const OGLTexture& src_tex, Common::Rectangle<u32> src
|
|||
static_cast<GLsizei>(dst_rect.GetHeight())};
|
||||
state.Apply();
|
||||
|
||||
glFramebufferTexture2D(GL_DRAW_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D,
|
||||
dst_tex.handle, 0);
|
||||
glFramebufferTexture2D(GL_DRAW_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, dst_tex.handle,
|
||||
0);
|
||||
glFramebufferTexture2D(GL_DRAW_FRAMEBUFFER, GL_DEPTH_STENCIL_ATTACHMENT, GL_TEXTURE_2D, 0, 0);
|
||||
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue