Squashed commit of the following:
[mesa.git] / src / gallium / drivers / r300 / r300_context.h
index 351bd2cdaeeaac11dc1c80c61de4202c607d2dc3..8d770853a4684fbc52e1714b44bd86564a87e776 100644 (file)
@@ -29,6 +29,7 @@
 
 #include "pipe/p_context.h"
 #include "util/u_inlines.h"
+#include "util/u_transfer.h"
 
 #include "r300_defines.h"
 #include "r300_screen.h"
@@ -79,6 +80,11 @@ struct r300_dsa_state {
     uint32_t z_stencil_control; /* R300_ZB_ZSTENCILCNTL: 0x4f04 */
     uint32_t stencil_ref_mask;  /* R300_ZB_STENCILREFMASK: 0x4f08 */
     uint32_t stencil_ref_bf;    /* R500_ZB_STENCILREFMASK_BF: 0x4fd4 */
+
+    /* Whether a two-sided stencil is enabled. */
+    boolean two_sided;
+    /* Whether a fallback should be used for a two-sided stencil ref value. */
+    boolean stencil_ref_bf_fallback;
 };
 
 struct r300_rs_state {
@@ -223,7 +229,7 @@ struct r300_query {
 
 struct r300_texture {
     /* Parent class */
-    struct pipe_texture tex;
+    struct u_resource b;
 
     /* Offsets into the buffer. */
     unsigned offset[R300_MAX_TEXTURE_LEVELS];
@@ -290,6 +296,21 @@ struct r300_context {
     /* Parent class */
     struct pipe_context context;
 
+    /* Emission of drawing packets. */
+    void (*emit_draw_arrays_immediate)(
+            struct r300_context *r300,
+            unsigned mode, unsigned start, unsigned count);
+
+    void (*emit_draw_arrays)(
+            struct r300_context *r300,
+            unsigned mode, unsigned count);
+
+    void (*emit_draw_elements)(
+            struct r300_context *r300, struct pipe_resource* indexBuffer,
+            unsigned indexSize, unsigned minIndex, unsigned maxIndex,
+            unsigned mode, unsigned start, unsigned count);
+
+
     /* The interface to the windowing system, etc. */
     struct r300_winsys_screen *rws;
     /* Screen. */
@@ -300,12 +321,12 @@ struct r300_context {
     struct blitter_context* blitter;
 
     /* Vertex buffer for rendering. */
-    struct pipe_buffer* vbo;
+    struct pipe_resource* vbo;
     /* Offset into the VBO. */
     size_t vbo_offset;
 
     /* Occlusion query buffer. */
-    struct pipe_buffer* oqbo;
+    struct pipe_resource* oqbo;
     /* Query list. */
     struct r300_query *query_current;
     struct r300_query query_list;
@@ -382,12 +403,20 @@ struct r300_context {
     boolean scissor_enabled;
     /* Whether rendering is conditional and should be skipped. */
     boolean skip_rendering;
+    /* Whether the two-sided stencil ref value is different for front and
+     * back faces, and fallback should be used for r3xx-r4xx. */
+    boolean stencil_ref_bf_fallback;
     /* upload managers */
     struct u_upload_mgr *upload_vb;
     struct u_upload_mgr *upload_ib;
 };
 
 /* Convenience cast wrapper. */
+static INLINE struct r300_texture* r300_texture(struct pipe_resource* tex)
+{
+    return (struct r300_texture*)tex;
+}
+
 static INLINE struct r300_context* r300_context(struct pipe_context* context)
 {
     return (struct r300_context*)context;
@@ -400,8 +429,7 @@ struct pipe_context* r300_create_context(struct pipe_screen* screen,
 /* Context initialization. */
 struct draw_stage* r300_draw_stage(struct r300_context* r300);
 void r300_init_state_functions(struct r300_context* r300);
-void r300_init_surface_functions(struct r300_context* r300);
-void r300_init_tex_functions( struct pipe_context *pipe );
+void r300_init_resource_functions(struct r300_context* r300);
 
 static INLINE boolean CTX_DBG_ON(struct r300_context * ctx, unsigned flags)
 {