gallium: add st_context_iface::flush_resource to call FLUSH_VERTICES
[mesa.git] / src / gallium / include / state_tracker / st_api.h
index 2232c3efa186863c6f400ba1b26c31057552820b..955d84b5b4442d6be4aa6b0beb4344a6b917f9f9 100644 (file)
@@ -27,7 +27,6 @@
 #ifndef _ST_API_H_
 #define _ST_API_H_
 
-#include "pipe/p_compiler.h"
 #include "pipe/p_format.h"
 
 /**
@@ -91,6 +90,9 @@ enum st_api_feature
 #define ST_CONTEXT_FLAG_ROBUST_ACCESS       (1 << 2)
 #define ST_CONTEXT_FLAG_RESET_NOTIFICATION_ENABLED (1 << 3)
 #define ST_CONTEXT_FLAG_NO_ERROR            (1 << 4)
+#define ST_CONTEXT_FLAG_RELEASE_NONE       (1 << 5)
+#define ST_CONTEXT_FLAG_HIGH_PRIORITY       (1 << 6)
+#define ST_CONTEXT_FLAG_LOW_PRIORITY        (1 << 7)
 
 /**
  * Reasons that context creation might fail.
@@ -146,6 +148,7 @@ enum st_attachment_type {
 #define ST_FLUSH_FRONT                    (1 << 0)
 #define ST_FLUSH_END_OF_FRAME             (1 << 1)
 #define ST_FLUSH_WAIT                     (1 << 2)
+#define ST_FLUSH_FENCE_FD                 (1 << 3)
 
 /**
  * Value to st_manager->get_param function.
@@ -179,6 +182,8 @@ struct st_egl_image
 
    unsigned level;
    unsigned layer;
+   /* GL internal format. */
+   unsigned internalformat;
 };
 
 /**
@@ -186,6 +191,8 @@ struct st_egl_image
  */
 struct st_visual
 {
+   bool no_config;
+
    /**
     * Available buffers.  Bitfield of ST_ATTACHMENT_*_MASK bits.
     */
@@ -198,7 +205,7 @@ struct st_visual
    enum pipe_format color_format;
    enum pipe_format depth_stencil_format;
    enum pipe_format accum_format;
-   int samples;
+   unsigned samples;
 
    /**
     * Desired render buffer.
@@ -212,16 +219,22 @@ struct st_visual
  */
 struct st_config_options
 {
-   boolean disable_blend_func_extended;
-   boolean disable_glsl_line_continuations;
-   boolean disable_shader_bit_encoding;
-   boolean force_glsl_extensions_warn;
+   bool disable_blend_func_extended;
+   bool disable_glsl_line_continuations;
+   bool disable_arb_gpu_shader5;
+   bool force_glsl_extensions_warn;
    unsigned force_glsl_version;
-   boolean allow_glsl_extension_directive_midshader;
-   boolean allow_glsl_builtin_variable_redeclaration;
-   boolean allow_higher_compat_version;
-   boolean glsl_zero_init;
-   boolean force_glsl_abs_sqrt;
+   bool allow_glsl_extension_directive_midshader;
+   bool allow_glsl_builtin_const_expression;
+   bool allow_glsl_relaxed_es;
+   bool allow_glsl_builtin_variable_redeclaration;
+   bool allow_higher_compat_version;
+   bool glsl_zero_init;
+   bool vs_position_always_invariant;
+   bool force_glsl_abs_sqrt;
+   bool allow_glsl_cross_stage_interpolation_mismatch;
+   bool allow_glsl_layout_qualifier_on_function_parameters;
+   char *force_gl_vendor;
    unsigned char config_options_sha1[20];
 };
 
@@ -310,9 +323,9 @@ struct st_framebuffer_iface
     *
     * @att is one of the front buffer attachments.
     */
-   boolean (*flush_front)(struct st_context_iface *stctx,
-                          struct st_framebuffer_iface *stfbi,
-                          enum st_attachment_type statt);
+   bool (*flush_front)(struct st_context_iface *stctx,
+                       struct st_framebuffer_iface *stfbi,
+                       enum st_attachment_type statt);
 
    /**
     * The state tracker asks for the textures it needs.
@@ -331,13 +344,13 @@ struct st_framebuffer_iface
     * the last call might be destroyed.  This behavior might change in the
     * future.
     */
-   boolean (*validate)(struct st_context_iface *stctx,
-                       struct st_framebuffer_iface *stfbi,
-                       const enum st_attachment_type *statts,
-                       unsigned count,
-                       struct pipe_resource **out);
-   boolean (*flush_swapbuffers) (struct st_context_iface *stctx,
-                                 struct st_framebuffer_iface *stfbi);
+   bool (*validate)(struct st_context_iface *stctx,
+                    struct st_framebuffer_iface *stfbi,
+                    const enum st_attachment_type *statts,
+                    unsigned count,
+                    struct pipe_resource **out);
+   bool (*flush_swapbuffers) (struct st_context_iface *stctx,
+                              struct st_framebuffer_iface *stfbi);
 };
 
 /**
@@ -378,17 +391,26 @@ struct st_context_iface
     * Flush all drawing from context to the pipe also flushes the pipe.
     */
    void (*flush)(struct st_context_iface *stctxi, unsigned flags,
-                 struct pipe_fence_handle **fence);
+                 struct pipe_fence_handle **fence,
+                 void (*notify_before_flush_cb) (void*),
+                 void* notify_before_flush_cb_args);
+
+   /**
+    * Flush all enqueued vertices (e.g. vbo module) and call
+    * pipe_context::flush_resource.
+    */
+   void (*flush_resource)(struct st_context_iface *stctxi,
+                          struct pipe_resource *resource);
 
    /**
     * Replace the texture image of a texture object at the specified level.
     *
     * This function is optional.
     */
-   boolean (*teximage)(struct st_context_iface *stctxi,
-                       enum st_texture_type target,
-                       int level, enum pipe_format internal_format,
-                       struct pipe_resource *tex, boolean mipmap);
+   bool (*teximage)(struct st_context_iface *stctxi,
+                    enum st_texture_type target,
+                    int level, enum pipe_format internal_format,
+                    struct pipe_resource *tex, bool mipmap);
 
    /**
     * Used to implement glXCopyContext.
@@ -399,8 +421,8 @@ struct st_context_iface
    /**
     * Used to implement wglShareLists.
     */
-   boolean (*share)(struct st_context_iface *stctxi,
-                    struct st_context_iface *stsrci);
+   bool (*share)(struct st_context_iface *stctxi,
+                 struct st_context_iface *stsrci);
 
    /**
     * Start the thread if the API has a worker thread.
@@ -442,9 +464,9 @@ struct st_manager
     *
     * This function is optional.
     */
-   boolean (*get_egl_image)(struct st_manager *smapi,
-                            void *egl_image,
-                            struct st_egl_image *out);
+   bool (*get_egl_image)(struct st_manager *smapi,
+                         void *egl_image,
+                         struct st_egl_image *out);
 
    /**
     * Query an manager param.
@@ -528,10 +550,10 @@ struct st_api
     * The framebuffers might be NULL, or might have different visuals than the
     * context does.
     */
-   boolean (*make_current)(struct st_api *stapi,
-                           struct st_context_iface *stctxi,
-                           struct st_framebuffer_iface *stdrawi,
-                           struct st_framebuffer_iface *streadi);
+   bool (*make_current)(struct st_api *stapi,
+                        struct st_context_iface *stctxi,
+                        struct st_framebuffer_iface *stdrawi,
+                        struct st_framebuffer_iface *streadi);
 
    /**
     * Get the currently bound context in the calling thread.
@@ -549,7 +571,7 @@ struct st_api
 /**
  * Return true if the visual has the specified buffers.
  */
-static inline boolean
+static inline bool
 st_visual_have_buffers(const struct st_visual *visual, unsigned mask)
 {
    return ((visual->buffer_mask & mask) == mask);