1
1
Fork 0
forked from suyu/suyu

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, u32 ConstBufferAccessor::access32(Tegra::Engines::Maxwell3D::Regs::ShaderStage stage,
u64 const_buffer, u64 offset) { 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& shader_stage = maxwell3d.state.shader_stages[static_cast<std::size_t>(stage)];
const auto& buffer = shader_stage.const_buffers[const_buffer]; const auto& buffer = shader_stage.const_buffers[const_buffer];
u32 result; 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; return result;
} }
u64 ConstBufferAccessor::access64(Tegra::Engines::Maxwell3D::Regs::ShaderStage stage, u64 ConstBufferAccessor::access64(Tegra::Engines::Maxwell3D::Regs::ShaderStage stage,
u64 const_buffer, u64 offset) { 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& shader_stage = maxwell3d.state.shader_stages[static_cast<std::size_t>(stage)];
const auto& buffer = shader_stage.const_buffers[const_buffer]; const auto& buffer = shader_stage.const_buffers[const_buffer];
u64 result; 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; return result;
} }

View file

@ -7,15 +7,12 @@ namespace Tegra {
class ConstBufferAccessor { class ConstBufferAccessor {
public: public:
ConstBufferAccessor(Tegra::Engines::Maxwell3D& maxwell3d) : maxwell3d(maxwell3d) {} ConstBufferAccessor() {}
~ConstBufferAccessor() = default; ~ConstBufferAccessor() = default;
u32 access32(Tegra::Engines::Maxwell3D::Regs::ShaderStage stage, u64 const_buffer, u64 offset); 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); u64 access64(Tegra::Engines::Maxwell3D::Regs::ShaderStage stage, u64 const_buffer, u64 offset);
private:
Tegra::Engines::Maxwell3D& maxwell3d;
}; };
} // namespace Tegra } // namespace Tegra

View file

@ -101,8 +101,7 @@ struct FramebufferCacheKey {
RasterizerOpenGL::RasterizerOpenGL(Core::Frontend::EmuWindow& window, Core::System& system, RasterizerOpenGL::RasterizerOpenGL(Core::Frontend::EmuWindow& window, Core::System& system,
ScreenInfo& info) ScreenInfo& info)
: res_cache{*this}, shader_cache{*this, system}, global_cache{*this}, system{system}, : 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() {
const_buffer_accessor(system.GPU().Maxwell3D()) {
// Create sampler objects // Create sampler objects
for (std::size_t i = 0; i < texture_samplers.size(); ++i) { for (std::size_t i = 0; i < texture_samplers.size(); ++i) {
texture_samplers[i].Create(); texture_samplers[i].Create();