2015-04-04 11:57:31 +01:00
|
|
|
// Copyright 2015 Citra Emulator Project
|
|
|
|
// Licensed under GPLv2 or any later version
|
|
|
|
// Refer to the license.txt file included.
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2015-08-11 22:32:39 +01:00
|
|
|
#include "common/common_types.h"
|
2015-04-04 11:57:31 +01:00
|
|
|
|
|
|
|
namespace CiTrace {
|
|
|
|
|
|
|
|
// NOTE: Things are stored in little-endian
|
|
|
|
|
|
|
|
#pragma pack(1)
|
|
|
|
|
|
|
|
struct CTHeader {
|
|
|
|
static const char* ExpectedMagicWord() {
|
|
|
|
return "CiTr";
|
|
|
|
}
|
|
|
|
|
2015-08-11 22:32:39 +01:00
|
|
|
static u32 ExpectedVersion() {
|
2015-04-04 11:57:31 +01:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
char magic[4];
|
2015-08-11 22:32:39 +01:00
|
|
|
u32 version;
|
|
|
|
u32 header_size;
|
2015-04-04 11:57:31 +01:00
|
|
|
|
|
|
|
struct {
|
|
|
|
// NOTE: Register range sizes are technically hardware-constants, but the actual limits
|
|
|
|
// aren't known. Hence we store the presumed limits along the offsets.
|
2015-08-11 22:32:39 +01:00
|
|
|
// Sizes are given in u32 units.
|
|
|
|
u32 gpu_registers;
|
|
|
|
u32 gpu_registers_size;
|
|
|
|
u32 lcd_registers;
|
|
|
|
u32 lcd_registers_size;
|
|
|
|
u32 pica_registers;
|
|
|
|
u32 pica_registers_size;
|
|
|
|
u32 default_attributes;
|
|
|
|
u32 default_attributes_size;
|
|
|
|
u32 vs_program_binary;
|
|
|
|
u32 vs_program_binary_size;
|
|
|
|
u32 vs_swizzle_data;
|
|
|
|
u32 vs_swizzle_data_size;
|
|
|
|
u32 vs_float_uniforms;
|
|
|
|
u32 vs_float_uniforms_size;
|
|
|
|
u32 gs_program_binary;
|
|
|
|
u32 gs_program_binary_size;
|
|
|
|
u32 gs_swizzle_data;
|
|
|
|
u32 gs_swizzle_data_size;
|
|
|
|
u32 gs_float_uniforms;
|
|
|
|
u32 gs_float_uniforms_size;
|
2015-04-04 11:57:31 +01:00
|
|
|
|
|
|
|
// Other things we might want to store here:
|
|
|
|
// - Initial framebuffer data, maybe even a full copy of FCRAM/VRAM
|
2015-05-21 01:51:28 +01:00
|
|
|
// - Lookup tables for fragment lighting
|
|
|
|
// - Lookup tables for procedural textures
|
2015-04-04 11:57:31 +01:00
|
|
|
} initial_state_offsets;
|
|
|
|
|
2015-08-11 22:32:39 +01:00
|
|
|
u32 stream_offset;
|
|
|
|
u32 stream_size;
|
2015-04-04 11:57:31 +01:00
|
|
|
};
|
|
|
|
|
2015-08-11 22:32:39 +01:00
|
|
|
enum CTStreamElementType : u32 {
|
2016-09-18 01:38:01 +01:00
|
|
|
FrameMarker = 0xE1,
|
|
|
|
MemoryLoad = 0xE2,
|
2015-04-04 11:57:31 +01:00
|
|
|
RegisterWrite = 0xE3,
|
|
|
|
};
|
|
|
|
|
|
|
|
struct CTMemoryLoad {
|
2015-08-11 22:32:39 +01:00
|
|
|
u32 file_offset;
|
|
|
|
u32 size;
|
|
|
|
u32 physical_address;
|
|
|
|
u32 pad;
|
2015-04-04 11:57:31 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
struct CTRegisterWrite {
|
2015-08-11 22:32:39 +01:00
|
|
|
u32 physical_address;
|
2015-04-04 11:57:31 +01:00
|
|
|
|
2016-09-19 02:01:46 +01:00
|
|
|
enum : u32 {
|
|
|
|
SIZE_8 = 0xD1,
|
|
|
|
SIZE_16 = 0xD2,
|
|
|
|
SIZE_32 = 0xD3,
|
|
|
|
SIZE_64 = 0xD4,
|
|
|
|
} size;
|
2015-04-04 11:57:31 +01:00
|
|
|
|
|
|
|
// TODO: Make it clearer which bits of this member are used for sizes other than 32 bits
|
2015-08-11 22:32:39 +01:00
|
|
|
u64 value;
|
2015-04-04 11:57:31 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
struct CTStreamElement {
|
|
|
|
CTStreamElementType type;
|
|
|
|
|
|
|
|
union {
|
|
|
|
CTMemoryLoad memory_load;
|
|
|
|
CTRegisterWrite register_write;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
#pragma pack()
|
2018-03-09 17:54:43 +00:00
|
|
|
} // namespace CiTrace
|