Merge remote branch 'origin/7.8'
[mesa.git] / src / mesa / drivers / dri / r300 / compiler / radeon_code.h
index 9fd37dc8d24c250299ce2967a3e0a9af2387f238..6d979bbaecf7b17060dc66e426e31b9dcf0dde37 100644 (file)
@@ -23,6 +23,8 @@
 #ifndef RADEON_CODE_H
 #define RADEON_CODE_H
 
+#include <stdint.h>
+
 #define R300_PFS_MAX_ALU_INST     64
 #define R300_PFS_MAX_TEX_INST     32
 #define R300_PFS_MAX_TEX_INDIRECT 4
@@ -57,7 +59,9 @@ enum {
        RC_STATE_SHADOW_AMBIENT = 0,
 
        RC_STATE_R300_WINDOW_DIMENSION,
-       RC_STATE_R300_TEXRECT_FACTOR
+       RC_STATE_R300_TEXRECT_FACTOR,
+       RC_STATE_R300_VIEWPORT_SCALE,
+       RC_STATE_R300_VIEWPORT_OFFSET
 };
 
 struct rc_constant {
@@ -86,6 +90,23 @@ unsigned rc_constants_add_state(struct rc_constant_list * c, unsigned state1, un
 unsigned rc_constants_add_immediate_vec4(struct rc_constant_list * c, const float * data);
 unsigned rc_constants_add_immediate_scalar(struct rc_constant_list * c, float data, unsigned * swizzle);
 
+/**
+ * Compare functions.
+ *
+ * \note By design, RC_COMPARE_FUNC_xxx + GL_NEVER gives you
+ * the correct GL compare function.
+ */
+typedef enum {
+       RC_COMPARE_FUNC_NEVER = 0,
+       RC_COMPARE_FUNC_LESS,
+       RC_COMPARE_FUNC_EQUAL,
+       RC_COMPARE_FUNC_LEQUAL,
+       RC_COMPARE_FUNC_GREATER,
+       RC_COMPARE_FUNC_NOTEQUAL,
+       RC_COMPARE_FUNC_GEQUAL,
+       RC_COMPARE_FUNC_ALWAYS
+} rc_compare_func;
+
 /**
  * Stores state that influences the compilation of a fragment program.
  */
@@ -99,16 +120,18 @@ struct r300_fragment_program_external_state {
                 *  2 - GL_ALPHA
                 * depending on the depth texture mode.
                 */
-               GLuint depth_texture_mode : 2;
+               unsigned depth_texture_mode : 2;
 
                /**
                 * If the sampler is used as a shadow sampler,
-                * this field is (texture_compare_func - GL_NEVER).
-                * [e.g. if compare function is GL_LEQUAL, this field is 3]
+                * this field specifies the compare function.
+                *
+                * Otherwise, this field is \ref RC_COMPARE_FUNC_NEVER (aka 0).
                 *
                 * Otherwise, this field is 0.
+                * \sa rc_compare_func
                 */
-               GLuint texture_compare_func : 3;
+               unsigned texture_compare_func : 3;
        } unit[16];
 };
 
@@ -128,41 +151,41 @@ struct r300_fragment_program_node {
 struct r300_fragment_program_code {
        struct {
                int length; /**< total # of texture instructions used */
-               GLuint inst[R300_PFS_MAX_TEX_INST];
+               uint32_t inst[R300_PFS_MAX_TEX_INST];
        } tex;
 
        struct {
                int length; /**< total # of ALU instructions used */
                struct {
-                       GLuint inst0;
-                       GLuint inst1;
-                       GLuint inst2;
-                       GLuint inst3;
+                       uint32_t rgb_inst;
+                       uint32_t rgb_addr;
+                       uint32_t alpha_inst;
+                       uint32_t alpha_addr;
                } inst[R300_PFS_MAX_ALU_INST];
        } alu;
 
-       struct r300_fragment_program_node node[4];
-       int cur_node;
-       int first_node_has_tex;
-
-       int max_temp_idx;
+       uint32_t config; /* US_CONFIG */
+       uint32_t pixsize; /* US_PIXSIZE */
+       uint32_t code_offset; /* US_CODE_OFFSET */
+       uint32_t code_addr[4]; /* US_CODE_ADDR */
 };
 
 
 struct r500_fragment_program_code {
        struct {
-               GLuint inst0;
-               GLuint inst1;
-               GLuint inst2;
-               GLuint inst3;
-               GLuint inst4;
-               GLuint inst5;
+               uint32_t inst0;
+               uint32_t inst1;
+               uint32_t inst2;
+               uint32_t inst3;
+               uint32_t inst4;
+               uint32_t inst5;
        } inst[R500_PFS_MAX_INST];
 
-       int inst_offset;
-       int inst_end;
+       int inst_end; /* Number of instructions - 1; also, last instruction to be executed */
 
        int max_temp_idx;
+
+       uint32_t us_fc_ctrl;
 };
 
 struct rX00_fragment_program_code {
@@ -171,7 +194,7 @@ struct rX00_fragment_program_code {
                struct r500_fragment_program_code r500;
        } code;
 
-       GLboolean writes_depth;
+       unsigned writes_depth:1;
 
        struct rc_constant_list constants;
 };
@@ -180,22 +203,28 @@ struct rX00_fragment_program_code {
 #define VSF_MAX_FRAGMENT_LENGTH (255*4)
 #define VSF_MAX_FRAGMENT_TEMPS (14)
 
+#define VSF_MAX_INPUTS 32
+#define VSF_MAX_OUTPUTS 32
+
 struct r300_vertex_program_code {
        int length;
        union {
-               GLuint d[VSF_MAX_FRAGMENT_LENGTH];
+               uint32_t d[VSF_MAX_FRAGMENT_LENGTH];
                float f[VSF_MAX_FRAGMENT_LENGTH];
        } body;
 
        int pos_end;
        int num_temporaries;    /* Number of temp vars used by program */
-       int inputs[VERT_ATTRIB_MAX];
-       int outputs[VERT_RESULT_MAX];
+       int inputs[VSF_MAX_INPUTS];
+       int outputs[VSF_MAX_OUTPUTS];
 
        struct rc_constant_list constants;
 
-       GLbitfield InputsRead;
-       GLbitfield OutputsWritten;
+       uint32_t InputsRead;
+       uint32_t OutputsWritten;
 };
 
-#endif /* RADEON_CODE_H */
\ No newline at end of file
+void r300_vertex_program_dump(struct r300_vertex_program_code * vs);
+
+#endif /* RADEON_CODE_H */
+