r300/compiler: use perspective division only for TXP in shadow samplers
[mesa.git] / src / mesa / drivers / dri / r300 / compiler / radeon_code.h
index 0806fb1b5c60708d5bd5e3f44b4110022b84a4dd..17703a9ad3826f07fd5767c4d33837a863d69fd7 100644 (file)
@@ -59,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 {
@@ -88,6 +90,35 @@ 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;
+
+/**
+ * Coordinate wrapping modes.
+ *
+ * These are not quite the same as their GL counterparts yet.
+ */
+typedef enum {
+       RC_WRAP_NONE = 0,
+       RC_WRAP_REPEAT,
+       RC_WRAP_MIRRORED_REPEAT,
+       RC_WRAP_MIRRORED_CLAMP
+} rc_wrap_mode;
+
 /**
  * Stores state that influences the compilation of a fragment program.
  */
@@ -101,16 +132,35 @@ struct r300_fragment_program_external_state {
                 *  2 - GL_ALPHA
                 * depending on the depth texture mode.
                 */
-               unsigned depth_texture_mode : 2;
+               unsigned depth_texture_swizzle:12;
 
                /**
                 * 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 0.
+                * Otherwise, this field is \ref RC_COMPARE_FUNC_NEVER (aka 0).
+                * \sa rc_compare_func
                 */
                unsigned texture_compare_func : 3;
+
+               /**
+                * If the sampler needs to fake NPOT, this field is set.
+                */
+               unsigned fake_npot : 1;
+
+               /**
+                * If the sampler will recieve non-normalized coords,
+                * this field is set.
+                */
+               unsigned non_normalized_coords : 1;
+
+               /**
+                * This field specifies wrapping modes for the sampler.
+                *
+                * If this field is \ref RC_WRAP_NONE (aka 0), no wrapping maths
+                * will be performed on the coordinates.
+                */
+               unsigned wrap_mode : 2;
        } unit[16];
 };
 
@@ -163,6 +213,8 @@ struct r500_fragment_program_code {
        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 {
@@ -203,4 +255,5 @@ struct r300_vertex_program_code {
 
 void r300_vertex_program_dump(struct r300_vertex_program_code * vs);
 
-#endif /* RADEON_CODE_H */
\ No newline at end of file
+#endif /* RADEON_CODE_H */
+