2019-04-22 22:50:56 +00:00
|
|
|
// Copyright 2019 yuzu Emulator Project
|
|
|
|
// Licensed under GPLv2 or any later version
|
|
|
|
// Refer to the license.txt file included.
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <vector>
|
|
|
|
#include "common/bit_field.h"
|
|
|
|
#include "common/common_types.h"
|
|
|
|
|
|
|
|
namespace Tegra {
|
|
|
|
class MemoryManager;
|
|
|
|
}
|
|
|
|
|
|
|
|
namespace Tegra::Engines::Upload {
|
|
|
|
|
2019-04-25 16:57:10 +00:00
|
|
|
struct Registers {
|
2019-04-22 22:50:56 +00:00
|
|
|
u32 line_length_in;
|
|
|
|
u32 line_count;
|
|
|
|
|
|
|
|
struct {
|
|
|
|
u32 address_high;
|
|
|
|
u32 address_low;
|
|
|
|
u32 pitch;
|
|
|
|
union {
|
|
|
|
BitField<0, 4, u32> block_width;
|
|
|
|
BitField<4, 4, u32> block_height;
|
|
|
|
BitField<8, 4, u32> block_depth;
|
|
|
|
};
|
|
|
|
u32 width;
|
|
|
|
u32 height;
|
|
|
|
u32 depth;
|
|
|
|
u32 z;
|
|
|
|
u32 x;
|
|
|
|
u32 y;
|
|
|
|
|
|
|
|
GPUVAddr Address() const {
|
|
|
|
return static_cast<GPUVAddr>((static_cast<GPUVAddr>(address_high) << 32) | address_low);
|
|
|
|
}
|
|
|
|
|
|
|
|
u32 BlockWidth() const {
|
2019-06-13 20:41:16 +00:00
|
|
|
return block_width.Value();
|
2019-04-22 22:50:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
u32 BlockHeight() const {
|
2019-06-13 20:41:16 +00:00
|
|
|
return block_height.Value();
|
2019-04-22 22:50:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
u32 BlockDepth() const {
|
2019-06-13 20:41:16 +00:00
|
|
|
return block_depth.Value();
|
2019-04-22 22:50:56 +00:00
|
|
|
}
|
|
|
|
} dest;
|
|
|
|
};
|
|
|
|
|
|
|
|
class State {
|
|
|
|
public:
|
2020-12-04 19:39:12 +00:00
|
|
|
explicit State(MemoryManager& memory_manager_, Registers& regs_);
|
2019-05-14 17:41:34 +00:00
|
|
|
~State();
|
2019-04-22 22:50:56 +00:00
|
|
|
|
2020-12-04 19:39:12 +00:00
|
|
|
void ProcessExec(bool is_linear_);
|
2019-05-14 17:40:05 +00:00
|
|
|
void ProcessData(u32 data, bool is_last_call);
|
2019-04-22 22:50:56 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
u32 write_offset = 0;
|
|
|
|
u32 copy_size = 0;
|
|
|
|
std::vector<u8> inner_buffer;
|
2019-04-25 16:57:10 +00:00
|
|
|
std::vector<u8> tmp_buffer;
|
|
|
|
bool is_linear = false;
|
|
|
|
Registers& regs;
|
2019-04-22 22:50:56 +00:00
|
|
|
MemoryManager& memory_manager;
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace Tegra::Engines::Upload
|