summaryrefslogtreecommitdiffstats
path: root/src/video_core/pica.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/video_core/pica.h')
-rw-r--r--src/video_core/pica.h58
1 files changed, 49 insertions, 9 deletions
diff --git a/src/video_core/pica.h b/src/video_core/pica.h
index 16f9e4006..86c0a0096 100644
--- a/src/video_core/pica.h
+++ b/src/video_core/pica.h
@@ -5,10 +5,13 @@
#pragma once
#include <array>
-#include <cmath>
#include <cstddef>
#include <string>
+#ifndef _MSC_VER
+#include <type_traits> // for std::enable_if
+#endif
+
#include "common/assert.h"
#include "common/bit_field.h"
#include "common/common_funcs.h"
@@ -16,8 +19,6 @@
#include "common/vector_math.h"
#include "common/logging/log.h"
-#include "pica_types.h"
-
namespace Pica {
// Returns index corresponding to the Regs member labeled by field_name
@@ -69,7 +70,7 @@ struct Regs {
INSERT_PADDING_WORDS(0x9);
BitField<0, 24, u32> viewport_depth_range; // float24
- BitField<0, 24, u32> viewport_depth_far_plane; // float24
+ BitField<0, 24, u32> viewport_depth_near_plane; // float24
BitField<0, 3, u32> vs_output_total;
@@ -121,9 +122,31 @@ struct Regs {
BitField<16, 10, s32> y;
} viewport_corner;
- INSERT_PADDING_WORDS(0x17);
+ INSERT_PADDING_WORDS(0x1);
+
+ //TODO: early depth
+ INSERT_PADDING_WORDS(0x1);
+
+ INSERT_PADDING_WORDS(0x2);
+
+ enum DepthBuffering : u32 {
+ WBuffering = 0,
+ ZBuffering = 1,
+ };
+ BitField< 0, 1, DepthBuffering> depthmap_enable;
+
+ INSERT_PADDING_WORDS(0x12);
struct TextureConfig {
+ enum TextureType : u32 {
+ Texture2D = 0,
+ TextureCube = 1,
+ Shadow2D = 2,
+ Projection2D = 3,
+ ShadowCube = 4,
+ Disabled = 5,
+ };
+
enum WrapMode : u32 {
ClampToEdge = 0,
ClampToBorder = 1,
@@ -154,6 +177,7 @@ struct Regs {
BitField< 2, 1, TextureFilter> min_filter;
BitField< 8, 2, WrapMode> wrap_t;
BitField<12, 2, WrapMode> wrap_s;
+ BitField<28, 2, TextureType> type; ///< @note Only valid for texture 0 according to 3DBrew.
};
INSERT_PADDING_WORDS(0x1);
@@ -577,8 +601,18 @@ struct Regs {
}
}
- struct {
- INSERT_PADDING_WORDS(0x6);
+ struct FramebufferConfig {
+ INSERT_PADDING_WORDS(0x3);
+
+ union {
+ BitField<0, 4, u32> allow_color_write; // 0 = disable, else enable
+ };
+
+ INSERT_PADDING_WORDS(0x1);
+
+ union {
+ BitField<0, 2, u32> allow_depth_stencil_write; // 0 = disable, else enable
+ };
DepthFormat depth_format; // TODO: Should be a BitField!
BitField<16, 3, ColorFormat> color_format;
@@ -737,8 +771,13 @@ struct Regs {
case LightingSampler::ReflectGreen:
case LightingSampler::ReflectBlue:
return (config == LightingConfig::Config4) || (config == LightingConfig::Config5) || (config == LightingConfig::Config7);
+ default:
+ UNREACHABLE_MSG("Regs::IsLightingSamplerSupported: Reached "
+ "unreachable section, sampler should be one "
+ "of Distribution0, Distribution1, Fresnel, "
+ "ReflectRed, ReflectGreen or ReflectBlue, instead "
+ "got %i", static_cast<int>(config));
}
- return false;
}
struct {
@@ -1263,10 +1302,11 @@ ASSERT_REG_POSITION(cull_mode, 0x40);
ASSERT_REG_POSITION(viewport_size_x, 0x41);
ASSERT_REG_POSITION(viewport_size_y, 0x43);
ASSERT_REG_POSITION(viewport_depth_range, 0x4d);
-ASSERT_REG_POSITION(viewport_depth_far_plane, 0x4e);
+ASSERT_REG_POSITION(viewport_depth_near_plane, 0x4e);
ASSERT_REG_POSITION(vs_output_attributes[0], 0x50);
ASSERT_REG_POSITION(vs_output_attributes[1], 0x51);
ASSERT_REG_POSITION(viewport_corner, 0x68);
+ASSERT_REG_POSITION(depthmap_enable, 0x6D);
ASSERT_REG_POSITION(texture0_enable, 0x80);
ASSERT_REG_POSITION(texture0, 0x81);
ASSERT_REG_POSITION(texture0_format, 0x8e);