aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/video_core/pica.h
diff options
context:
space:
mode:
authorGravatar Subv <subv2112@gmail.com>2015-03-08 21:31:15 -0500
committerGravatar Subv <subv2112@gmail.com>2015-03-09 20:13:21 -0500
commit1248e291f0c9a29734b0f5175df8fa675cce930c (patch)
tree18218cbe496e5a2f42022a5e6741fa0665218874 /src/video_core/pica.h
parent155cc80e3b39f51cb75c6ab2bf9203fbfe444be3 (diff)
GPU: Added the stencil test structure to the Pica Regs struct.
Diffstat (limited to 'src/video_core/pica.h')
-rw-r--r--src/video_core/pica.h43
1 files changed, 34 insertions, 9 deletions
diff --git a/src/video_core/pica.h b/src/video_core/pica.h
index 6549693f..fe20cd77 100644
--- a/src/video_core/pica.h
+++ b/src/video_core/pica.h
@@ -393,7 +393,15 @@ struct Regs {
BitField< 8, 8, u32> ref;
} alpha_test;
- INSERT_PADDING_WORDS(0x2);
+ union {
+ BitField< 0, 1, u32> stencil_test_enable;
+ BitField< 4, 3, CompareFunc> stencil_test_func;
+ BitField< 8, 8, u32> stencil_replacement_value;
+ BitField<16, 8, u32> stencil_reference_value;
+ BitField<24, 8, u32> stencil_mask;
+ } stencil_test;
+
+ INSERT_PADDING_WORDS(0x1);
union {
BitField< 0, 1, u32> depth_test_enable;
@@ -408,6 +416,30 @@ struct Regs {
INSERT_PADDING_WORDS(0x8);
} output_merger;
+ enum DepthFormat : u32 {
+ D16 = 0,
+
+ D24 = 2,
+ D24S8 = 3
+ };
+
+ /*
+ * Returns the number of bytes in the specified depth format
+ */
+ static u32 BytesPerDepthPixel(DepthFormat format) {
+ switch (format) {
+ case DepthFormat::D16:
+ return 2;
+ case DepthFormat::D24:
+ return 3;
+ case DepthFormat::D24S8:
+ return 4;
+ default:
+ LOG_CRITICAL(HW_GPU, "Unknown depth format %u", format);
+ UNIMPLEMENTED();
+ }
+ }
+
struct {
// Components are laid out in reverse byte order, most significant bits first.
enum ColorFormat : u32 {
@@ -418,16 +450,9 @@ struct Regs {
RGBA4 = 4,
};
- enum DepthFormat : u32 {
- D16 = 0,
-
- D24 = 2,
- D24S8 = 3
- };
-
INSERT_PADDING_WORDS(0x6);
- u32 depth_format;
+ DepthFormat depth_format;
BitField<16, 3, u32> color_format;
INSERT_PADDING_WORDS(0x4);