2018-02-11 18:34:20 -08:00
|
|
|
// Copyright 2018 yuzu Emulator Project
|
|
|
|
// Licensed under GPLv2 or any later version
|
|
|
|
// Refer to the license.txt file included.
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2018-09-25 15:41:21 -07:00
|
|
|
#include <array>
|
2019-03-05 17:25:01 -08:00
|
|
|
#include <cstddef>
|
2018-09-25 15:41:21 -07:00
|
|
|
#include "common/common_funcs.h"
|
2018-02-11 18:34:20 -08:00
|
|
|
#include "common/common_types.h"
|
2018-11-23 20:20:56 -08:00
|
|
|
#include "video_core/gpu.h"
|
2019-01-22 15:49:31 -08:00
|
|
|
#include "video_core/memory_manager.h"
|
2018-02-11 18:34:20 -08:00
|
|
|
|
2018-07-20 15:14:17 -07:00
|
|
|
namespace Tegra::Engines {
|
2018-02-11 18:34:20 -08:00
|
|
|
|
2019-01-22 15:49:31 -08:00
|
|
|
#define KEPLER_COMPUTE_REG_INDEX(field_name) \
|
|
|
|
(offsetof(Tegra::Engines::KeplerCompute::Regs, field_name) / sizeof(u32))
|
2018-09-25 15:41:21 -07:00
|
|
|
|
2019-01-22 15:49:31 -08:00
|
|
|
class KeplerCompute final {
|
2018-02-11 20:44:12 -08:00
|
|
|
public:
|
2019-01-22 15:49:31 -08:00
|
|
|
explicit KeplerCompute(MemoryManager& memory_manager);
|
|
|
|
~KeplerCompute();
|
|
|
|
|
|
|
|
static constexpr std::size_t NumConstBuffers = 8;
|
2018-02-11 18:34:20 -08:00
|
|
|
|
2018-09-25 15:41:21 -07:00
|
|
|
struct Regs {
|
|
|
|
static constexpr std::size_t NUM_REGS = 0xCF8;
|
|
|
|
|
|
|
|
union {
|
|
|
|
struct {
|
2019-01-22 15:49:31 -08:00
|
|
|
INSERT_PADDING_WORDS(0xAF);
|
2018-09-25 15:41:21 -07:00
|
|
|
|
2019-01-22 15:49:31 -08:00
|
|
|
u32 launch;
|
2018-09-25 15:41:21 -07:00
|
|
|
|
2019-01-22 15:49:31 -08:00
|
|
|
INSERT_PADDING_WORDS(0xC48);
|
2018-09-25 15:41:21 -07:00
|
|
|
};
|
|
|
|
std::array<u32, NUM_REGS> reg_array;
|
|
|
|
};
|
|
|
|
} regs{};
|
|
|
|
static_assert(sizeof(Regs) == Regs::NUM_REGS * sizeof(u32),
|
2019-01-22 15:49:31 -08:00
|
|
|
"KeplerCompute Regs has wrong size");
|
|
|
|
|
|
|
|
MemoryManager& memory_manager;
|
2018-09-25 15:41:21 -07:00
|
|
|
|
2018-02-11 20:44:12 -08:00
|
|
|
/// Write the value to the register identified by method.
|
2018-11-23 20:20:56 -08:00
|
|
|
void CallMethod(const GPU::MethodCall& method_call);
|
2018-02-11 20:44:12 -08:00
|
|
|
};
|
2018-02-11 18:34:20 -08:00
|
|
|
|
2018-09-25 15:41:21 -07:00
|
|
|
#define ASSERT_REG_POSITION(field_name, position) \
|
2019-01-22 15:49:31 -08:00
|
|
|
static_assert(offsetof(KeplerCompute::Regs, field_name) == position * 4, \
|
2018-09-25 15:41:21 -07:00
|
|
|
"Field " #field_name " has invalid position")
|
|
|
|
|
2019-01-22 15:49:31 -08:00
|
|
|
ASSERT_REG_POSITION(launch, 0xAF);
|
2018-09-25 15:41:21 -07:00
|
|
|
|
|
|
|
#undef ASSERT_REG_POSITION
|
|
|
|
|
2018-07-20 15:14:17 -07:00
|
|
|
} // namespace Tegra::Engines
|