gallium/hud: fix printing byte units
[mesa.git] / src / gallium / include / state_tracker / st_api.h
index da49dc80fca7dd4faf936db7f7099f6497ce40bd..356863d8531de76a7d801637d511be254458bf1f 100644 (file)
@@ -69,6 +69,17 @@ enum st_profile_type
 #define ST_PROFILE_OPENGL_ES1_MASK   (1 << ST_PROFILE_OPENGL_ES1)
 #define ST_PROFILE_OPENGL_ES2_MASK   (1 << ST_PROFILE_OPENGL_ES2)
 
+/**
+ * Optional API/state tracker features.
+ */
+enum st_api_feature
+{
+   ST_API_FEATURE_MS_VISUALS  /**< support for multisample visuals */
+};
+
+/* for feature_mask in st_api */
+#define ST_API_FEATURE_MS_VISUALS_MASK (1 << ST_API_FEATURE_MS_VISUALS)
+
 /**
  * New context flags for GL 3.0 and beyond.
  *
@@ -78,6 +89,7 @@ enum st_profile_type
 #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)
 
 /**
  * Reasons that context creation might fail.
@@ -147,6 +159,7 @@ enum st_context_resource_type {
  * Flush flags.
  */
 #define ST_FLUSH_FRONT                    (1 << 0)
+#define ST_FLUSH_END_OF_FRAME             (1 << 1)
 
 /**
  * Value to st_manager->get_param function.
@@ -176,7 +189,7 @@ struct pipe_fence_handle;
  */
 struct st_context_resource
 {
-   /* these fields are filled by the caller */
+   /* these fields are filled in by the caller */
    enum st_context_resource_type type;
    void *resource;
 
@@ -221,6 +234,21 @@ struct st_visual
    enum st_attachment_type render_buffer;
 };
 
+
+/**
+ * Configuration options from driconf
+ */
+struct st_config_options
+{
+   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 force_s3tc_enable;
+   boolean allow_glsl_extension_directive_midshader;
+};
+
 /**
  * Represent the attributes of a context.
  */
@@ -230,8 +258,7 @@ struct st_context_attribs
     * The profile and minimal version to support.
     *
     * The valid profiles and versions are rendering API dependent.  The latest
-    * version satisfying the request should be returned, unless the
-    * ST_CONTEXT_FLAG_FORWARD_COMPATIBLE bit is set.
+    * version satisfying the request should be returned.
     */
    enum st_profile_type profile;
    int major, minor;
@@ -243,25 +270,32 @@ struct st_context_attribs
     * The visual of the framebuffers the context will be bound to.
     */
    struct st_visual visual;
+
+   /**
+    * Configuration options.
+    */
+   struct st_config_options options;
 };
 
+struct st_context_iface;
+
 /**
  * Represent a windowing system drawable.
  *
  * The framebuffer is implemented by the state tracker manager and
  * used by the state trackers.
  *
- * Instead of the winsys pokeing into the API context to figure
+ * Instead of the winsys poking into the API context to figure
  * out what buffers that might be needed in the future by the API
  * context, it calls into the framebuffer to get the textures.
  *
  * This structure along with the notify_invalid_framebuffer
  * allows framebuffers to be shared between different threads
  * but at the same make the API context free from thread
- * syncronisation primitves, with the exception of a small
+ * synchronization primitves, with the exception of a small
  * atomic flag used for notification of framebuffer dirty status.
  *
- * The thread syncronisation is put inside the framebuffer
+ * The thread synchronization is put inside the framebuffer
  * and only called once the framebuffer has become dirty.
  */
 struct st_framebuffer_iface
@@ -269,7 +303,6 @@ struct st_framebuffer_iface
    /**
     * Atomic stamp which changes when framebuffers need to be updated.
     */
-
    int32_t stamp;
 
    /**
@@ -290,7 +323,8 @@ struct st_framebuffer_iface
     *
     * @att is one of the front buffer attachments.
     */
-   boolean (*flush_front)(struct st_framebuffer_iface *stfbi,
+   boolean (*flush_front)(struct st_context_iface *stctx,
+                          struct st_framebuffer_iface *stfbi,
                           enum st_attachment_type statt);
 
    /**
@@ -310,7 +344,8 @@ 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);
@@ -329,6 +364,17 @@ struct st_context_iface
    void *st_context_private;
    void *st_manager_private;
 
+   /**
+    * The CSO context associated with this context in case we need to draw
+    * something before swap buffers.
+    */
+   struct cso_context *cso_context;
+
+   /**
+    * The gallium context.
+    */
+   struct pipe_context *pipe;
+
    /**
     * Destroy the context.
     */
@@ -345,7 +391,8 @@ struct st_context_iface
     *
     * This function is optional.
     */
-   boolean (*teximage)(struct st_context_iface *stctxi, enum st_texture_type target,
+   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);
 
@@ -429,11 +476,27 @@ struct st_api
     */
    unsigned profile_mask;
 
+   /**
+    * The supported optional features.  Tested with ST_FEATURE_*_MASK.
+    */
+   unsigned feature_mask;
+
    /**
     * Destroy the API.
     */
    void (*destroy)(struct st_api *stapi);
 
+   /**
+    * Query supported OpenGL versions. (if applicable)
+    * The format is (major*10+minor).
+    */
+   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);
+
    /**
     * Return an API entry point.
     *
@@ -470,7 +533,7 @@ struct st_api
 /**
  * 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);