#define MALI_OCCLUSION_QUERY (1 << 3)
#define MALI_OCCLUSION_PRECISE (1 << 4)
-#define MALI_FRONT_FACE(v) (v << 5)
-#define MALI_CCW (0)
-#define MALI_CW (1)
+/* Set for a glFrontFace(GL_CCW) in a Y=0=TOP coordinate system (like Gallium).
+ * In OpenGL, this would corresponds to glFrontFace(GL_CW). Mesa and the blob
+ * disagree about how to do viewport flipping, so the blob actually sets this
+ * for GL_CW but then has a negative viewport stride */
+#define MALI_FRONT_CCW_TOP (1 << 5)
#define MALI_CULL_FACE_FRONT (1 << 6)
#define MALI_CULL_FACE_BACK (1 << 7)
/* Corresponds to MALI_MASK_* above and glColorMask arguments */
unsigned color_mask : 4;
-
- /* Attached constant for CONSTANT_ALPHA, etc */
-
-#ifndef BIFROST
- float constant;
-#endif
} __attribute__((packed));
/* Used with channel swizzling */
union midgard_blend {
mali_ptr shader;
- struct mali_blend_equation equation;
+
+ struct {
+ struct mali_blend_equation equation;
+ float constant;
+ };
};
/* On MRT Midgard systems (using an MFBD), each render target gets its own
/* This is likely an analogue of the flags on
* midgard_blend_rt */
- u32 unk1; // = 0x200
+ u16 flags; // = 0x200
+
+ /* Single-channel blend constants are encoded in a sort of
+ * fixed-point. Basically, the float is mapped to a byte, becoming
+ * a high byte, and then the lower-byte is added for precision.
+ * For the original float f:
+ *
+ * f = (constant_hi / 255) + (constant_lo / 65535)
+ *
+ * constant_hi = int(f / 255)
+ * constant_lo = 65535*f - (65535/255) * constant_hi
+ */
+
+ u16 constant;
+
struct mali_blend_equation equation;
/*
* - 0x19 normally
* in vertex and tiler jobs.
*/
mali_ptr framebuffer;
-
-#ifdef __LP64__
-#ifdef BIFROST
- /* most likely padding to make this a multiple of 64 bytes */
- u64 zero7;
-#endif
-#endif
} __attribute__((packed));
struct midgard_payload_vertex_tiler {
struct mali_vertex_tiler_prefix prefix;
struct bifrost_tiler_only tiler;
struct mali_vertex_tiler_postfix tiler_postfix;
+ u64 padding; /* zero */
struct bifrost_vertex_only vertex;
struct mali_vertex_tiler_postfix vertex_postfix;
} __attribute__((packed));
/* Cubemap bloats everything up */
#define MAX_FACES (6)
+/* For each pointer, there is an address and optionally also a stride */
+#define MAX_ELEMENTS (2)
+
/* Corresponds to the type passed to glTexImage2D and so forth */
/* Flags for usage2 */
uint32_t unknown6;
uint32_t unknown7;
- mali_ptr swizzled_bitmaps[MAX_MIP_LEVELS * MAX_FACES];
+ mali_ptr payload[MAX_MIP_LEVELS * MAX_FACES * MAX_ELEMENTS];
} __attribute__((packed));
/* Used as part of filter_mode */
float border_color[4];
} __attribute__((packed));
-/* TODO: What are the floats? Apparently always { -inf, -inf, inf, inf },
- * unless the scissor test is enabled.
- *
- * viewport0/viewport1 form the arguments to glViewport. viewport1 is modified
- * by MALI_POSITIVE; viewport0 is as-is.
+/* viewport0/viewport1 form the arguments to glViewport. viewport1 is
+ * modified by MALI_POSITIVE; viewport0 is as-is.
*/
struct mali_viewport {
mali_ptr framebuffer;
} __attribute__((packed));
-/* (Single?) Framebuffer Descriptor */
+/* Single Framebuffer Descriptor */
/* Flags apply to format. With just MSAA_A and MSAA_B, the framebuffer is
* configured for 4x. With MSAA_8, it is configured for 8x. */