summaryrefslogtreecommitdiff
path: root/src/mesa/drivers/dri/r300/r300_context.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/drivers/dri/r300/r300_context.h')
-rw-r--r--src/mesa/drivers/dri/r300/r300_context.h95
1 files changed, 37 insertions, 58 deletions
diff --git a/src/mesa/drivers/dri/r300/r300_context.h b/src/mesa/drivers/dri/r300/r300_context.h
index c287871b37..076bb49a00 100644
--- a/src/mesa/drivers/dri/r300/r300_context.h
+++ b/src/mesa/drivers/dri/r300/r300_context.h
@@ -49,13 +49,6 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#define USER_BUFFERS
-/* We don't handle 16 bits elts swapping yet */
-#ifdef MESA_BIG_ENDIAN
-#define FORCE_32BITS_ELTS
-#endif
-
-//#define OPTIMIZE_ELTS
-
struct r300_context;
typedef struct r300_context r300ContextRec;
typedef struct r300_context *r300ContextPtr;
@@ -63,13 +56,10 @@ typedef struct r300_context *r300ContextPtr;
#include "radeon_lock.h"
#include "mm.h"
-/* Checkpoint.. for convenience */
-#define CPT { fprintf(stderr, "%s:%s line %d\n", __FILE__, __FUNCTION__, __LINE__); }
/* From http://gcc.gnu.org/onlinedocs/gcc-3.2.3/gcc/Variadic-Macros.html .
I suppose we could inline this and use macro to fetch out __LINE__ and stuff in case we run into trouble
with other compilers ... GLUE!
*/
-#if 1
#define WARN_ONCE(a, ...) { \
static int warn##__LINE__=1; \
if(warn##__LINE__){ \
@@ -81,9 +71,6 @@ typedef struct r300_context *r300ContextPtr;
warn##__LINE__=0;\
} \
}
-#else
-#define WARN_ONCE(a, ...) {}
-#endif
#include "r300_vertprog.h"
#include "r300_fragprog.h"
@@ -91,7 +78,7 @@ typedef struct r300_context *r300ContextPtr;
/**
* This function takes a float and packs it into a uint32_t
*/
-static __inline__ uint32_t r300PackFloat32(float fl)
+static inline uint32_t r300PackFloat32(float fl)
{
union {
float fl;
@@ -102,6 +89,37 @@ static __inline__ uint32_t r300PackFloat32(float fl)
return u.u;
}
+/* This is probably wrong for some values, I need to test this
+ * some more. Range checking would be a good idea also..
+ *
+ * But it works for most things. I'll fix it later if someone
+ * else with a better clue doesn't
+ */
+static inline uint32_t r300PackFloat24(float f)
+{
+ float mantissa;
+ int exponent;
+ uint32_t float24 = 0;
+
+ if (f == 0.0)
+ return 0;
+
+ mantissa = frexpf(f, &exponent);
+
+ /* Handle -ve */
+ if (mantissa < 0) {
+ float24 |= (1 << 23);
+ mantissa = mantissa * -1.0;
+ }
+ /* Handle exponent, bias of 63 */
+ exponent += 62;
+ float24 |= (exponent << 16);
+ /* Kill 7 LSB of mantissa */
+ float24 |= (r300PackFloat32(mantissa) & 0x7FFFFF) >> 7;
+
+ return float24;
+}
+
/************ DMA BUFFERS **************/
/* Need refcounting on dma buffers:
@@ -129,7 +147,6 @@ struct r300_dma_region {
int aos_offset; /* address in GART memory */
int aos_stride; /* distance between elements, in dwords */
int aos_size; /* number of components (1-4) */
- int aos_reg; /* VAP register assignment */
};
struct r300_dma {
@@ -171,6 +188,8 @@ struct r300_tex_obj {
drm_radeon_tex_image_t image[6][RADEON_MAX_TEXTURE_LEVELS];
/* Six, for the cube faces */
+ GLboolean image_override; /* Image overridden by GLX_EXT_tfp */
+
GLuint pitch; /* this isn't sent to hardware just used in calculations */
/* hardware register values */
/* Note that R200 has 8 registers per texture and R300 only 7 */
@@ -433,7 +452,7 @@ struct r300_hw_state {
struct r300_state_atom vic; /* vap input control (2180) */
struct r300_state_atom unk21DC; /* (21DC) */
struct r300_state_atom unk221C; /* (221C) */
- struct r300_state_atom unk2220; /* (2220) */
+ struct r300_state_atom vap_clip;
struct r300_state_atom unk2288; /* (2288) */
struct r300_state_atom pvs; /* pvs_cntl (22D0) */
struct r300_state_atom gb_enable; /* (4008) */
@@ -761,50 +780,10 @@ struct r300_fragment_program {
#define R300_MAX_AOS_ARRAYS 16
-#define AOS_FORMAT_USHORT 0
-#define AOS_FORMAT_FLOAT 1
-#define AOS_FORMAT_UBYTE 2
-#define AOS_FORMAT_FLOAT_COLOR 3
-
#define REG_COORDS 0
#define REG_COLOR0 1
#define REG_TEX0 2
-struct dt {
- GLint size;
- GLenum type;
- GLsizei stride;
- void *data;
-};
-
-struct radeon_vertex_buffer {
- int Count;
- void *Elts;
- int elt_size;
- int elt_min, elt_max; /* debug */
-
- struct dt AttribPtr[VERT_ATTRIB_MAX];
-
- const struct _mesa_prim *Primitive;
- GLuint PrimitiveCount;
- GLint LockFirst;
- GLsizei LockCount;
- int lock_uptodate;
-};
-
-struct r300_aos_rec {
- GLuint offset;
- int element_size; /* in dwords */
- int stride; /* distance between elements, in dwords */
-
- int format;
-
- int ncomponents; /* number of components - between 1 and 4, inclusive */
-
- int reg; /* which register they are assigned to. */
-
-};
-
struct r300_state {
struct r300_depthbuffer_state depth;
struct r300_texture_state texture;
@@ -813,7 +792,6 @@ struct r300_state {
struct r300_pfs_compile_state pfs_compile;
struct r300_dma_region aos[R300_MAX_AOS_ARRAYS];
int aos_count;
- struct radeon_vertex_buffer VB;
GLuint *Elts;
struct r300_dma_region elt_dma;
@@ -865,9 +843,10 @@ struct r300_context {
#ifdef USER_BUFFERS
struct r300_memory_manager *rmm;
+#endif
+
GLvector4f dummy_attrib[_TNL_ATTRIB_MAX];
GLvector4f *temp_attrib[_TNL_ATTRIB_MAX];
-#endif
GLboolean disable_lowimpact_fallback;
};