st/nine: Fix volumetexture dtor on ctor failure
[mesa.git] / src / gallium / state_trackers / nine / nine_state.h
index ee88a943ccd6a45e323042b64c9709d4f21bf1c9..51e5e3265273f432e2914d91485516eb5780167d 100644 (file)
 #define NINE_STATE_VDECL       (1 << 12)
 #define NINE_STATE_IDXBUF      (1 << 13)
 #define NINE_STATE_STREAMFREQ  (1 << 14)
-#define NINE_STATE_PRIM        (1 << 15)
-#define NINE_STATE_MATERIAL    (1 << 16)
 #define NINE_STATE_BLEND_COLOR (1 << 17)
 #define NINE_STATE_STENCIL_REF (1 << 18)
 #define NINE_STATE_SAMPLE_MASK (1 << 19)
 #define NINE_STATE_FF          (0x1f << 20)
 #define NINE_STATE_FF_VS       (0x17 << 20)
-#define NINE_STATE_FF_PS       (0x18 << 20)
+#define NINE_STATE_FF_PS       (0x08 << 20)
 #define NINE_STATE_FF_LIGHTING (1 << 20)
 #define NINE_STATE_FF_MATERIAL (1 << 21)
 #define NINE_STATE_FF_VSTRANSF (1 << 22)
-#define NINE_STATE_FF_PSSTAGES (1 << 23)
-#define NINE_STATE_FF_OTHER    (1 << 24)
-#define NINE_STATE_FOG_SHADER  (1 << 25)
-#define NINE_STATE_PS1X_SHADER (1 << 26)
-#define NINE_STATE_POINTSIZE_SHADER (1 << 27)
-#define NINE_STATE_MULTISAMPLE (1 << 28)
-#define NINE_STATE_SWVP        (1 << 29)
-#define NINE_STATE_ALL          0x3fffffff
-#define NINE_STATE_UNHANDLED   (1 << 30)
+#define NINE_STATE_FF_PS_CONSTS (1 << 23)
+#define NINE_STATE_FF_VS_OTHER  (1 << 24)
+#define NINE_STATE_VS_PARAMS_MISC  (1 << 25)
+#define NINE_STATE_PS_PARAMS_MISC (1 << 26)
+#define NINE_STATE_MULTISAMPLE (1 << 27)
+#define NINE_STATE_SWVP        (1 << 28)
+#define NINE_STATE_ALL          0x1fffffff
+#define NINE_STATE_UNHANDLED   (1 << 29)
+
+/* These states affect the ff shader key,
+ * which we recompute everytime. */
+#define NINE_STATE_FF_SHADER    0
 
 #define NINE_STATE_COMMIT_DSA  (1 << 0)
 #define NINE_STATE_COMMIT_RASTERIZER (1 << 1)
@@ -271,7 +272,9 @@ struct nine_context {
     uint32_t stream_instancedata_mask; /* derived from stream_freq */
     uint32_t stream_usage_mask; /* derived from VS and vdecl */
 
-    struct pipe_index_buffer idxbuf;
+    struct pipe_resource *idxbuf;
+    unsigned index_offset;
+    unsigned index_size;
 
     struct pipe_clip_state clip;
 
@@ -515,7 +518,64 @@ nine_context_draw_indexed_primitive_from_vtxbuf_idxbuf(struct NineDevice9 *devic
                                                        UINT NumVertices,
                                                        UINT PrimitiveCount,
                                                        struct pipe_vertex_buffer *vbuf,
-                                                       struct pipe_index_buffer *ibuf);
+                                                       struct pipe_resource *ibuf,
+                                                       void *user_ibuf,
+                                                       unsigned index_offset,
+                                                      unsigned index_size);
+
+void
+nine_context_resource_copy_region(struct NineDevice9 *device,
+                                  struct NineUnknown *dst,
+                                  struct NineUnknown *src,
+                                  struct pipe_resource* dst_res,
+                                  unsigned dst_level,
+                                  const struct pipe_box *dst_box,
+                                  struct pipe_resource* src_res,
+                                  unsigned src_level,
+                                  const struct pipe_box *src_box);
+
+void
+nine_context_blit(struct NineDevice9 *device,
+                  struct NineUnknown *dst,
+                  struct NineUnknown *src,
+                  struct pipe_blit_info *blit);
+
+void
+nine_context_clear_render_target(struct NineDevice9 *device,
+                                 struct NineSurface9 *surface,
+                                 D3DCOLOR color,
+                                 UINT x,
+                                 UINT y,
+                                 UINT width,
+                                 UINT height);
+
+void
+nine_context_gen_mipmap(struct NineDevice9 *device,
+                        struct NineUnknown *dst,
+                        struct pipe_resource *res,
+                        UINT base_level, UINT last_level,
+                        UINT first_layer, UINT last_layer,
+                        UINT filter);
+
+void
+nine_context_range_upload(struct NineDevice9 *device,
+                          unsigned *counter,
+                          struct pipe_resource *res,
+                          unsigned offset,
+                          unsigned size,
+                          const void *data);
+
+void
+nine_context_box_upload(struct NineDevice9 *device,
+                        unsigned *counter,
+                        struct NineUnknown *dst,
+                        struct pipe_resource *res,
+                        unsigned level,
+                        const struct pipe_box *dst_box,
+                        enum pipe_format src_format,
+                        const void *src, unsigned src_stride,
+                        unsigned src_layer_stride,
+                        const struct pipe_box *src_box);
 
 struct pipe_query *
 nine_context_create_query(struct NineDevice9 *device, unsigned query_type);
@@ -524,14 +584,14 @@ void
 nine_context_destroy_query(struct NineDevice9 *device, struct pipe_query *query);
 
 void
-nine_context_begin_query(struct NineDevice9 *device, struct pipe_query *query);
+nine_context_begin_query(struct NineDevice9 *device, unsigned *counter, struct pipe_query *query);
 
 void
-nine_context_end_query(struct NineDevice9 *device, struct pipe_query *query);
+nine_context_end_query(struct NineDevice9 *device, unsigned *counter, struct pipe_query *query);
 
 boolean
 nine_context_get_query_result(struct NineDevice9 *device, struct pipe_query *query,
-                              boolean flush, boolean wait,
+                              unsigned *counter, boolean flush, boolean wait,
                               union pipe_query_result *result);
 
 void nine_state_restore_non_cso(struct NineDevice9 *device);
@@ -549,6 +609,9 @@ void nine_state_prepare_draw_sw(struct NineDevice9 *device,
 void nine_state_after_draw_sw(struct NineDevice9 *device);
 void nine_state_destroy_sw(struct NineDevice9 *device);
 
+void
+nine_state_resize_transform(struct nine_ff_state *ff_state, unsigned N);
+
 /* If @alloc is FALSE, the return value may be a const identity matrix.
  * Therefore, do not modify if you set alloc to FALSE !
  */
@@ -560,7 +623,7 @@ HRESULT
 nine_state_set_light(struct nine_ff_state *, DWORD, const D3DLIGHT9 *);
 
 HRESULT
-nine_state_light_enable(struct nine_ff_state *, uint32_t *,
+nine_state_light_enable(struct nine_ff_state *,
                         DWORD, BOOL);
 
 const char *nine_d3drs_to_string(DWORD State);
@@ -587,4 +650,16 @@ nine_context_get_pipe( struct NineDevice9 *device );
 struct pipe_context *
 nine_context_get_pipe_multithread( struct NineDevice9 *device );
 
+
+/* Get the pipe_context (should not be called from the worker thread).
+ * All the work in the worker thread is paused before returning.
+ * It is neccessary to release in order to restart the thread.
+ * This is intended for use of the nine_context pipe_context that don't
+ * need the worker thread to finish all queued job. */
+struct pipe_context *
+nine_context_get_pipe_acquire( struct NineDevice9 *device );
+
+void
+nine_context_get_pipe_release( struct NineDevice9 *device );
+
 #endif /* _NINE_STATE_H_ */