mesa: add AllowGLSLCrossStageInterpolationMismatch workaround
[mesa.git] / src / gallium / include / state_tracker / st_api.h
index 9f3d2a12cb4f8443cb209f7cd174fff747b7bc53..44d6b474f8f34aaa9bcaf024b89cc64bc9783486 100644 (file)
@@ -89,6 +89,9 @@ enum st_api_feature
 #define ST_CONTEXT_FLAG_DEBUG               (1 << 0)
 #define ST_CONTEXT_FLAG_FORWARD_COMPATIBLE  (1 << 1)
 #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)
 
 /**
  * Reasons that context creation might fail.
@@ -138,27 +141,13 @@ enum st_attachment_type {
 #define ST_ATTACHMENT_ACCUM_MASK          (1 << ST_ATTACHMENT_ACCUM)
 #define ST_ATTACHMENT_SAMPLE_MASK         (1 << ST_ATTACHMENT_SAMPLE)
 
-/**
- * Enumerations of state tracker context resources.
- */
-enum st_context_resource_type {
-   ST_CONTEXT_RESOURCE_OPENGL_TEXTURE_2D,
-   ST_CONTEXT_RESOURCE_OPENGL_TEXTURE_3D,
-   ST_CONTEXT_RESOURCE_OPENGL_TEXTURE_CUBE_MAP_POSITIVE_X,
-   ST_CONTEXT_RESOURCE_OPENGL_TEXTURE_CUBE_MAP_NEGATIVE_X,
-   ST_CONTEXT_RESOURCE_OPENGL_TEXTURE_CUBE_MAP_POSITIVE_Y,
-   ST_CONTEXT_RESOURCE_OPENGL_TEXTURE_CUBE_MAP_NEGATIVE_Y,
-   ST_CONTEXT_RESOURCE_OPENGL_TEXTURE_CUBE_MAP_POSITIVE_Z,
-   ST_CONTEXT_RESOURCE_OPENGL_TEXTURE_CUBE_MAP_NEGATIVE_Z,
-   ST_CONTEXT_RESOURCE_OPENGL_RENDERBUFFER,
-   ST_CONTEXT_RESOURCE_OPENVG_PARENT_IMAGE
-};
-
 /**
  * Flush flags.
  */
 #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.
@@ -174,27 +163,10 @@ enum st_manager_param {
    ST_MANAGER_BROKEN_INVALIDATE
 };
 
-/**
- * The return type of st_api->get_proc_address.
- */
-typedef void (*st_proc_t)(void);
-
 struct pipe_context;
 struct pipe_resource;
 struct pipe_fence_handle;
-
-/**
- * Used in st_context_iface->get_resource_for_egl_image.
- */
-struct st_context_resource
-{
-   /* these fields are filled in by the caller */
-   enum st_context_resource_type type;
-   void *resource;
-
-   /* this is owned by the caller */
-   struct pipe_resource *texture;
-};
+struct util_queue_monitoring;
 
 /**
  * Used in st_manager_iface->get_egl_image.
@@ -204,6 +176,9 @@ struct st_egl_image
    /* this is owned by the caller */
    struct pipe_resource *texture;
 
+   /* format only differs from texture->format for multi-planar (YUV): */
+   enum pipe_format format;
+
    unsigned level;
    unsigned layer;
 };
@@ -214,7 +189,7 @@ struct st_egl_image
 struct st_visual
 {
    /**
-    * Available buffers.  Tested with ST_FRAMEBUFFER_*_MASK.
+    * Available buffers.  Bitfield of ST_ATTACHMENT_*_MASK bits.
     */
    unsigned buffer_mask;
 
@@ -239,7 +214,18 @@ struct st_visual
  */
 struct st_config_options
 {
-       boolean force_glsl_extensions_warn;
+   boolean disable_blend_func_extended;
+   boolean disable_glsl_line_continuations;
+   boolean disable_shader_bit_encoding;
+   boolean 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;
+   boolean allow_glsl_cross_stage_interpolation_mismatch;
+   unsigned char config_options_sha1[20];
 };
 
 /**
@@ -271,6 +257,7 @@ struct st_context_attribs
 };
 
 struct st_context_iface;
+struct st_manager;
 
 /**
  * Represent a windowing system drawable.
@@ -298,6 +285,16 @@ struct st_framebuffer_iface
     */
    int32_t stamp;
 
+   /**
+    * Identifier that uniquely identifies the framebuffer interface object.
+    */
+   uint32_t ID;
+
+   /**
+    * The state tracker manager that manages this object.
+    */
+   struct st_manager *state_manager;
+
    /**
     * Available for the state tracker manager to use.
     */
@@ -337,10 +334,13 @@ struct st_framebuffer_iface
     * the last call might be destroyed.  This behavior might change in the
     * future.
     */
-   boolean (*validate)(struct st_framebuffer_iface *stfbi,
+   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);
 };
 
 /**
@@ -356,6 +356,11 @@ struct st_context_iface
    void *st_context_private;
    void *st_manager_private;
 
+   /**
+    * The state tracker manager that manages this object.
+    */
+   struct st_manager *state_manager;
+
    /**
     * The CSO context associated with this context in case we need to draw
     * something before swap buffers.
@@ -401,12 +406,17 @@ struct st_context_iface
                     struct st_context_iface *stsrci);
 
    /**
-    * Look up and return the info of a resource for EGLImage.
-    *
-    * This function is optional.
+    * Start the thread if the API has a worker thread.
+    * Called after the context has been created and fully initialized on both
+    * sides (e.g. st/mesa and st/dri).
     */
-   boolean (*get_resource_for_egl_image)(struct st_context_iface *stctxi,
-                                         struct st_context_resource *stres);
+   void (*start_thread)(struct st_context_iface *stctxi);
+
+   /**
+    * If the API is multithreaded, wait for all queued commands to complete.
+    * Called from the main thread.
+    */
+   void (*thread_finish)(struct st_context_iface *stctxi);
 };
 
 
@@ -444,6 +454,23 @@ struct st_manager
     */
    int (*get_param)(struct st_manager *smapi,
                     enum st_manager_param param);
+
+   /**
+    * Call the loader function setBackgroundContext. Called from the worker
+    * thread.
+    */
+   void (*set_background_context)(struct st_context_iface *stctxi,
+                                  struct util_queue_monitoring *queue_info);
+
+   /**
+    * Destroy any private data used by the state tracker manager.
+    */
+   void (*destroy)(struct st_manager *smapi);
+
+   /**
+    * Available for the state tracker manager to use.
+    */
+   void *st_manager_private;
 };
 
 /**
@@ -479,11 +506,15 @@ struct st_api
    void (*destroy)(struct st_api *stapi);
 
    /**
-    * Return an API entry point.
-    *
-    * For GL this is the same as _glapi_get_proc_address.
+    * Query supported OpenGL versions. (if applicable)
+    * The format is (major*10+minor).
     */
-   st_proc_t (*get_proc_address)(struct st_api *stapi, const char *procname);
+   void (*query_versions)(struct st_api *stapi, struct st_manager *sm,
+                          struct st_config_options *options,
+                          int *gl_core_version,
+                          int *gl_compat_version,
+                          int *gl_es1_version,
+                          int *gl_es2_version);
 
    /**
     * Create a rendering context.
@@ -509,12 +540,19 @@ struct st_api
     * Get the currently bound context in the calling thread.
     */
    struct st_context_iface *(*get_current)(struct st_api *stapi);
+
+   /**
+    * Notify the st manager the framebuffer interface object
+    * is no longer valid.
+    */
+   void (*destroy_drawable)(struct st_api *stapi,
+                            struct st_framebuffer_iface *stfbi);
 };
 
 /**
  * Return true if the visual has the specified buffers.
  */
-static INLINE boolean
+static inline boolean
 st_visual_have_buffers(const struct st_visual *visual, unsigned mask)
 {
    return ((visual->buffer_mask & mask) == mask);