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