2
1
Fork 0
mirror of https://github.com/yuzu-emu/yuzu.git synced 2024-07-04 23:31:19 +01:00

Fixes to Const Buffer Accessor and Formatting

This commit is contained in:
Fernando Sahmkow 2019-03-26 18:46:46 -04:00 committed by FernandoS27
parent 7af82ca022
commit 90d06acfed
3 changed files with 10 additions and 10 deletions

View file

@ -14,21 +14,25 @@ namespace Tegra {
u32 ConstBufferAccessor::access32(Tegra::Engines::Maxwell3D::Regs::ShaderStage stage,
u64 const_buffer, u64 offset) {
auto& memory_manager = Core::System::GetInstance().GPU().MemoryManager();
auto& gpu = Core::System::GetInstance().GPU();
auto& memory_manager = gpu.MemoryManager();
auto& maxwell3d = gpu.Maxwell3D();
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));
std::memcpy(&result, memory_manager.GetPointer(buffer.address + offset), 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();
auto& gpu = Core::System::GetInstance().GPU();
auto& memory_manager = gpu.MemoryManager();
auto& maxwell3d = gpu.Maxwell3D();
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));
std::memcpy(&result, memory_manager.GetPointer(buffer.address + offset), sizeof(u64));
return result;
}

View file

@ -7,15 +7,12 @@ namespace Tegra {
class ConstBufferAccessor {
public:
ConstBufferAccessor(Tegra::Engines::Maxwell3D& maxwell3d) : maxwell3d(maxwell3d) {}
ConstBufferAccessor() {}
~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

View file

@ -101,8 +101,7 @@ struct FramebufferCacheKey {
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),
const_buffer_accessor(system.GPU().Maxwell3D()) {
screen_info{info}, buffer_cache(*this, STREAM_BUFFER_SIZE), const_buffer_accessor() {
// Create sampler objects
for (std::size_t i = 0; i < texture_samplers.size(); ++i) {
texture_samplers[i].Create();