2018-02-12 02:34:20 +00: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 22:41:21 +00:00
|
|
|
#include <array>
|
2019-03-06 01:25:01 +00:00
|
|
|
#include <cstddef>
|
2018-09-25 22:41:21 +00:00
|
|
|
#include "common/common_funcs.h"
|
2018-02-12 02:34:20 +00:00
|
|
|
#include "common/common_types.h"
|
2018-11-24 04:20:56 +00:00
|
|
|
#include "video_core/gpu.h"
|
2019-01-22 23:49:31 +00:00
|
|
|
#include "video_core/memory_manager.h"
|
2018-02-12 02:34:20 +00:00
|
|
|
|
2018-07-20 22:14:17 +00:00
|
|
|
namespace Tegra::Engines {
|
2018-02-12 02:34:20 +00:00
|
|
|
|
2019-01-22 23:49:31 +00:00
|
|
|
#define KEPLER_COMPUTE_REG_INDEX(field_name) \
|
|
|
|
(offsetof(Tegra::Engines::KeplerCompute::Regs, field_name) / sizeof(u32))
|
2018-09-25 22:41:21 +00:00
|
|
|
|
2019-01-22 23:49:31 +00:00
|
|
|
class KeplerCompute final {
|
2018-02-12 04:44:12 +00:00
|
|
|
public:
|
2019-01-22 23:49:31 +00:00
|
|
|
explicit KeplerCompute(MemoryManager& memory_manager);
|
|
|
|
~KeplerCompute();
|
|
|
|
|
|
|
|
static constexpr std::size_t NumConstBuffers = 8;
|
2018-02-12 02:34:20 +00:00
|
|
|
|
2018-09-25 22:41:21 +00:00
|
|
|
struct Regs {
|
|
|
|
static constexpr std::size_t NUM_REGS = 0xCF8;
|
|
|
|
|
|
|
|
union {
|
|
|
|
struct {
|
2019-01-22 23:49:31 +00:00
|
|
|
INSERT_PADDING_WORDS(0xAF);
|
2018-09-25 22:41:21 +00:00
|
|
|
|
2019-01-22 23:49:31 +00:00
|
|
|
u32 launch;
|
2018-09-25 22:41:21 +00:00
|
|
|
|
2019-01-22 23:49:31 +00:00
|
|
|
INSERT_PADDING_WORDS(0xC48);
|
2018-09-25 22:41:21 +00:00
|
|
|
};
|
|
|
|
std::array<u32, NUM_REGS> reg_array;
|
|
|
|
};
|
|
|
|
} regs{};
|
|
|
|
static_assert(sizeof(Regs) == Regs::NUM_REGS * sizeof(u32),
|
2019-01-22 23:49:31 +00:00
|
|
|
"KeplerCompute Regs has wrong size");
|
|
|
|
|
|
|
|
MemoryManager& memory_manager;
|
2018-09-25 22:41:21 +00:00
|
|
|
|
2018-02-12 04:44:12 +00:00
|
|
|
/// Write the value to the register identified by method.
|
2018-11-24 04:20:56 +00:00
|
|
|
void CallMethod(const GPU::MethodCall& method_call);
|
2018-02-12 04:44:12 +00:00
|
|
|
};
|
2018-02-12 02:34:20 +00:00
|
|
|
|
2018-09-25 22:41:21 +00:00
|
|
|
#define ASSERT_REG_POSITION(field_name, position) \
|
2019-01-22 23:49:31 +00:00
|
|
|
static_assert(offsetof(KeplerCompute::Regs, field_name) == position * 4, \
|
2018-09-25 22:41:21 +00:00
|
|
|
"Field " #field_name " has invalid position")
|
|
|
|
|
2019-01-22 23:49:31 +00:00
|
|
|
ASSERT_REG_POSITION(launch, 0xAF);
|
2018-09-25 22:41:21 +00:00
|
|
|
|
|
|
|
#undef ASSERT_REG_POSITION
|
|
|
|
|
2018-07-20 22:14:17 +00:00
|
|
|
} // namespace Tegra::Engines
|