mirror of
https://github.com/yuzu-mirror/yuzu.git
synced 2024-11-18 15:37:34 +01:00
Implement Const Buffer Accessor
This commit is contained in:
parent
f14328bf0a
commit
c4ac05c82c
@ -1,4 +1,6 @@
|
||||
add_library(video_core STATIC
|
||||
const_buffer_accessor.cpp
|
||||
const_buffer_accessor.h
|
||||
dma_pusher.cpp
|
||||
dma_pusher.h
|
||||
debug_utils/debug_utils.cpp
|
||||
|
35
src/video_core/const_buffer_accessor.cpp
Normal file
35
src/video_core/const_buffer_accessor.cpp
Normal file
@ -0,0 +1,35 @@
|
||||
#pragma once
|
||||
|
||||
#include <cstring>
|
||||
|
||||
#include "common/common_types.h"
|
||||
#include "core/core.h"
|
||||
#include "core/memory.h"
|
||||
#include "video_core/const_buffer_accessor.h"
|
||||
#include "video_core/engines/maxwell_3d.h"
|
||||
#include "video_core/gpu.h"
|
||||
#include "video_core/memory_manager.h"
|
||||
|
||||
namespace Tegra {
|
||||
|
||||
u32 ConstBufferAccessor::access32(Tegra::Engines::Maxwell3D::Regs::ShaderStage stage,
|
||||
u64 const_buffer, u64 offset) {
|
||||
auto& memory_manager = Core::System::GetInstance().GPU().MemoryManager();
|
||||
const auto& shader_stage = maxwell3d.state.shader_stages[static_cast<std::size_t>(stage)];
|
||||
const auto& buffer = shader_stage.const_buffers[const_buffer];
|
||||
u32 result;
|
||||
std::memcpy(&result, memory_manager.GetPointer(buffer.address + offset * 4), sizeof(u32));
|
||||
return result;
|
||||
}
|
||||
|
||||
u64 ConstBufferAccessor::access64(Tegra::Engines::Maxwell3D::Regs::ShaderStage stage,
|
||||
u64 const_buffer, u64 offset) {
|
||||
auto& memory_manager = Core::System::GetInstance().GPU().MemoryManager();
|
||||
const auto& shader_stage = maxwell3d.state.shader_stages[static_cast<std::size_t>(stage)];
|
||||
const auto& buffer = shader_stage.const_buffers[const_buffer];
|
||||
u64 result;
|
||||
std::memcpy(&result, memory_manager.GetPointer(buffer.address + offset * 4), sizeof(u64));
|
||||
return result;
|
||||
}
|
||||
|
||||
} // namespace Tegra
|
21
src/video_core/const_buffer_accessor.h
Normal file
21
src/video_core/const_buffer_accessor.h
Normal file
@ -0,0 +1,21 @@
|
||||
#pragma once
|
||||
|
||||
#include "common/common_types.h"
|
||||
#include "video_core/engines/maxwell_3d.h"
|
||||
|
||||
namespace Tegra {
|
||||
|
||||
class ConstBufferAccessor {
|
||||
public:
|
||||
ConstBufferAccessor(Tegra::Engines::Maxwell3D& maxwell3d) : maxwell3d(maxwell3d) {}
|
||||
~ConstBufferAccessor() = default;
|
||||
|
||||
u32 access32(Tegra::Engines::Maxwell3D::Regs::ShaderStage stage, u64 const_buffer, u64 offset);
|
||||
|
||||
u64 access64(Tegra::Engines::Maxwell3D::Regs::ShaderStage stage, u64 const_buffer, u64 offset);
|
||||
|
||||
private:
|
||||
Tegra::Engines::Maxwell3D& maxwell3d;
|
||||
};
|
||||
|
||||
} // namespace Tegra
|
@ -98,9 +98,11 @@ struct FramebufferCacheKey {
|
||||
}
|
||||
};
|
||||
|
||||
RasterizerOpenGL::RasterizerOpenGL(Core::System& system, ScreenInfo& info)
|
||||
RasterizerOpenGL::RasterizerOpenGL(Core::Frontend::EmuWindow& window, Core::System& system,
|
||||
ScreenInfo& info)
|
||||
: res_cache{*this}, shader_cache{*this, system}, global_cache{*this}, system{system},
|
||||
screen_info{info}, buffer_cache(*this, STREAM_BUFFER_SIZE) {
|
||||
screen_info{info}, buffer_cache(*this, STREAM_BUFFER_SIZE),
|
||||
const_buffer_accessor(system.GPU().Maxwell3D()) {
|
||||
// Create sampler objects
|
||||
for (std::size_t i = 0; i < texture_samplers.size(); ++i) {
|
||||
texture_samplers[i].Create();
|
||||
|
@ -17,6 +17,7 @@
|
||||
#include <glad/glad.h>
|
||||
|
||||
#include "common/common_types.h"
|
||||
#include "video_core/const_buffer_accessor.h"
|
||||
#include "video_core/engines/maxwell_3d.h"
|
||||
#include "video_core/rasterizer_cache.h"
|
||||
#include "video_core/rasterizer_interface.h"
|
||||
@ -229,6 +230,8 @@ private:
|
||||
PrimitiveAssembler primitive_assembler{buffer_cache};
|
||||
GLint uniform_buffer_alignment;
|
||||
|
||||
Tegra::ConstBufferAccessor const_buffer_accessor;
|
||||
|
||||
std::size_t CalculateVertexArraysSize() const;
|
||||
|
||||
std::size_t CalculateIndexBufferSize() const;
|
||||
|
Loading…
Reference in New Issue
Block a user