2016-03-03 03:16:38 +00:00
|
|
|
// Copyright 2016 Citra Emulator Project
|
|
|
|
// Licensed under GPLv2 or any later version
|
|
|
|
// Refer to the license.txt file included.
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2016-04-30 16:34:51 +01:00
|
|
|
#include <array>
|
|
|
|
#include "common/bit_field.h"
|
|
|
|
#include "common/common_types.h"
|
2016-03-03 03:16:38 +00:00
|
|
|
#include "video_core/primitive_assembly.h"
|
2017-01-28 21:27:24 +00:00
|
|
|
#include "video_core/regs.h"
|
2016-03-03 03:16:38 +00:00
|
|
|
#include "video_core/shader/shader.h"
|
|
|
|
|
|
|
|
namespace Pica {
|
|
|
|
|
|
|
|
/// Struct used to describe current Pica state
|
|
|
|
struct State {
|
2016-03-05 22:49:23 +00:00
|
|
|
void Reset();
|
|
|
|
|
2016-03-03 03:16:38 +00:00
|
|
|
/// Pica registers
|
|
|
|
Regs regs;
|
|
|
|
|
|
|
|
Shader::ShaderSetup vs;
|
|
|
|
Shader::ShaderSetup gs;
|
|
|
|
|
2016-12-19 00:42:19 +00:00
|
|
|
Shader::AttributeBuffer input_default_attributes;
|
2016-05-12 09:06:35 +01:00
|
|
|
|
2016-03-03 03:16:38 +00:00
|
|
|
struct {
|
|
|
|
union LutEntry {
|
|
|
|
// Used for raw access
|
|
|
|
u32 raw;
|
|
|
|
|
|
|
|
// LUT value, encoded as 12-bit fixed point, with 12 fraction bits
|
2016-09-18 01:38:01 +01:00
|
|
|
BitField<0, 12, u32> value; // 0.0.12 fixed point
|
2016-03-03 03:16:38 +00:00
|
|
|
|
|
|
|
// Used by HW for efficient interpolation, Citra does not use these
|
2016-05-11 12:39:28 +01:00
|
|
|
BitField<12, 12, s32> difference; // 1.0.11 fixed point
|
2016-03-03 03:16:38 +00:00
|
|
|
|
|
|
|
float ToFloat() {
|
|
|
|
return static_cast<float>(value) / 4095.f;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
std::array<std::array<LutEntry, 256>, 24> luts;
|
|
|
|
} lighting;
|
|
|
|
|
2016-05-11 12:39:28 +01:00
|
|
|
struct {
|
|
|
|
union LutEntry {
|
|
|
|
// Used for raw access
|
|
|
|
u32 raw;
|
|
|
|
|
2016-09-18 01:38:01 +01:00
|
|
|
BitField<0, 13, s32> difference; // 1.1.11 fixed point
|
|
|
|
BitField<13, 11, u32> value; // 0.0.11 fixed point
|
2016-05-11 12:39:28 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
std::array<LutEntry, 128> lut;
|
|
|
|
} fog;
|
|
|
|
|
2016-03-03 03:16:38 +00:00
|
|
|
/// Current Pica command list
|
|
|
|
struct {
|
|
|
|
const u32* head_ptr;
|
|
|
|
const u32* current_ptr;
|
|
|
|
u32 length;
|
|
|
|
} cmd_list;
|
|
|
|
|
|
|
|
/// Struct used to describe immediate mode rendering state
|
|
|
|
struct ImmediateModeState {
|
2016-03-05 22:49:23 +00:00
|
|
|
// Used to buffer partial vertices for immediate-mode rendering.
|
2016-12-19 00:42:19 +00:00
|
|
|
Shader::AttributeBuffer input_vertex;
|
2016-03-05 22:49:23 +00:00
|
|
|
// Index of the next attribute to be loaded into `input_vertex`.
|
2016-04-25 21:10:03 +01:00
|
|
|
u32 current_attribute = 0;
|
2016-03-03 03:16:38 +00:00
|
|
|
} immediate;
|
2016-03-05 22:49:23 +00:00
|
|
|
|
|
|
|
// This is constructed with a dummy triangle topology
|
|
|
|
PrimitiveAssembler<Shader::OutputVertex> primitive_assembler;
|
2016-03-03 03:16:38 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
extern State g_state; ///< Current Pica state
|
|
|
|
|
|
|
|
} // namespace
|