* tracker managers.
*/
-/**
- * The entry points of the state trackers.
- */
-#define ST_MODULE_OPENGL_SYMBOL "st_module_OpenGL"
-#define ST_MODULE_OPENGL_ES1_SYMBOL "st_module_OpenGL_ES1"
-#define ST_MODULE_OPENGL_ES2_SYMBOL "st_module_OpenGL_ES2"
-#define ST_MODULE_OPENVG_SYMBOL "st_module_OpenVG"
-
/**
* The supported rendering API of a state tracker.
*/
enum st_api_type {
ST_API_OPENGL,
- ST_API_OPENGL_ES1,
- ST_API_OPENGL_ES2,
ST_API_OPENVG,
ST_API_COUNT
};
+/**
+ * The profile of a context.
+ */
+enum st_profile_type
+{
+ ST_PROFILE_DEFAULT,
+ ST_PROFILE_OPENGL_CORE,
+ ST_PROFILE_OPENGL_ES1,
+ ST_PROFILE_OPENGL_ES2
+};
+
+/* for profile_mask in st_api */
+#define ST_PROFILE_DEFAULT_MASK (1 << ST_PROFILE_DEFAULT)
+#define ST_PROFILE_OPENGL_CORE_MASK (1 << ST_PROFILE_OPENGL_CORE)
+#define ST_PROFILE_OPENGL_ES1_MASK (1 << ST_PROFILE_OPENGL_ES1)
+#define ST_PROFILE_OPENGL_ES2_MASK (1 << ST_PROFILE_OPENGL_ES2)
+
+/**
+ * New context flags for GL 3.0 and beyond.
+ */
+#define ST_CONTEXT_FLAG_CORE_PROFILE (1 << 0)
+#define ST_CONTEXT_FLAG_COMPATIBLE_PROFILE (1 << 1)
+#define ST_CONTEXT_FLAG_FORWARD_COMPATIBLE (1 << 2)
+#define ST_CONTEXT_FLAG_DEBUG (1 << 3)
+#define ST_CONTEXT_FLAG_ROBUST_ACCESS (1 << 4)
+
/**
* Used in st_context_iface->teximage.
*/
ST_TEXTURE_1D,
ST_TEXTURE_2D,
ST_TEXTURE_3D,
- ST_TEXTURE_RECT,
+ ST_TEXTURE_RECT
};
/**
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,
+ ST_CONTEXT_RESOURCE_OPENVG_PARENT_IMAGE
+};
+
+/**
+ * Flush flags.
+ */
+#define ST_FLUSH_FRONT (1 << 0)
+
+/**
+ * Value to st_manager->get_param function.
+ */
+enum st_manager_param {
+ /**
+ * The dri state tracker on old libGL's doesn't do the right thing
+ * with regards to invalidating the framebuffers.
+ *
+ * For the mesa state tracker that means that it needs to invalidate
+ * the framebuffer in glViewport itself.
+ */
+ ST_MANAGER_BROKEN_INVALIDATE
};
/**
typedef void (*st_proc_t)(void);
struct pipe_context;
-struct pipe_texture;
+struct pipe_resource;
struct pipe_fence_handle;
/**
void *resource;
/* this is owned by the caller */
- struct pipe_texture *texture;
+ struct pipe_resource *texture;
};
/**
*/
struct st_egl_image
{
- /* these fields are filled by the caller */
- struct st_context_iface *stctxi;
- void *egl_image;
-
/* this is owned by the caller */
- struct pipe_texture *texture;
+ struct pipe_resource *texture;
- unsigned face;
unsigned level;
- unsigned zslice;
+ unsigned layer;
};
/**
enum st_attachment_type render_buffer;
};
+/**
+ * Represent the attributes of a context.
+ */
+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.
+ */
+ enum st_profile_type profile;
+ int major, minor;
+
+ /** Mask of ST_CONTEXT_FLAG_x bits */
+ unsigned flags;
+
+ /**
+ * The visual of the framebuffers the context will be bound to.
+ */
+ struct st_visual visual;
+};
+
/**
* Represent a windowing system drawable.
*
*/
struct st_framebuffer_iface
{
+ /**
+ * Atomic stamp which changes when framebuffers need to be updated.
+ */
+
+ int32_t stamp;
+
/**
* Available for the state tracker manager to use.
*/
boolean (*validate)(struct st_framebuffer_iface *stfbi,
const enum st_attachment_type *statts,
unsigned count,
- struct pipe_texture **out);
+ struct pipe_resource **out);
};
/**
*/
void (*destroy)(struct st_context_iface *stctxi);
- /**
- * Invalidate the current textures that was taken from a framebuffer.
- *
- * The state tracker manager calls this function to let the rendering
- * context know that it should update the textures it got from
- * st_framebuffer_iface::validate. It should do so at the latest time possible.
- * Possible right before sending triangles to the pipe context.
- *
- * For certain platforms this function might be called from a thread other
- * than the thread that the context is currently bound in, and must
- * therefore be thread safe. But it is the state tracker manager's
- * responsibility to make sure that the framebuffer is bound to the context
- * and the API context is current for the duration of this call.
- *
- * Thus reducing the sync primitive needed to a single atomic flag.
- */
- void (*notify_invalid_framebuffer)(struct st_context_iface *stctxi,
- struct st_framebuffer_iface *stfbi);
-
/**
* Flush all drawing from context to the pipe also flushes the pipe.
*/
*/
boolean (*teximage)(struct st_context_iface *stctxi, enum st_texture_type target,
int level, enum pipe_format internal_format,
- struct pipe_texture *tex, boolean mipmap);
+ struct pipe_resource *tex, boolean mipmap);
/**
* Used to implement glXCopyContext.
void (*copy)(struct st_context_iface *stctxi,
struct st_context_iface *stsrci, unsigned mask);
+ /**
+ * Used to implement wglShareLists.
+ */
+ boolean (*share)(struct st_context_iface *stctxi,
+ struct st_context_iface *stsrci);
+
/**
* Look up and return the info of a resource for EGLImage.
*
/**
* Look up and return the info of an EGLImage.
*
+ * This is used to implement for example EGLImageTargetTexture2DOES.
+ * The GLeglImageOES agrument of that call is passed directly to this
+ * function call and the information needed to access this is returned
+ * in the given struct out.
+ *
+ * @smapi: manager owning the caller context
+ * @stctx: caller context
+ * @egl_image: EGLImage that caller recived
+ * @out: return struct filled out with access information.
+ *
* This function is optional.
*/
boolean (*get_egl_image)(struct st_manager *smapi,
- struct st_egl_image *stimg);
+ void *egl_image,
+ struct st_egl_image *out);
+
+ /**
+ * Query an manager param.
+ */
+ int (*get_param)(struct st_manager *smapi,
+ enum st_manager_param param);
};
/**
*/
struct st_api
{
+ /**
+ * The name of the rendering API. This is informative.
+ */
+ const char *name;
+
+ /**
+ * The supported rendering API.
+ */
+ enum st_api_type api;
+
+ /**
+ * The supported profiles. Tested with ST_PROFILE_*_MASK.
+ */
+ unsigned profile_mask;
+
/**
* Destroy the API.
*/
*/
st_proc_t (*get_proc_address)(struct st_api *stapi, const char *procname);
- /**
- * Return true if the visual is supported by the state tracker.
- */
- boolean (*is_visual_supported)(struct st_api *stapi,
- const struct st_visual *visual);
-
/**
* Create a rendering context.
*/
struct st_context_iface *(*create_context)(struct st_api *stapi,
struct st_manager *smapi,
- const struct st_visual *visual,
+ const struct st_context_attribs *attribs,
struct st_context_iface *stsharei);
/**
* Bind the context to the calling thread with draw and read as drawables.
*
- * The framebuffers might have different visuals than the context does.
+ * 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_context_iface *(*get_current)(struct st_api *stapi);
};
-/**
- * Represent a state tracker.
- *
- * This is the entry point of a state tracker.
- */
-struct st_module
-{
- enum st_api_type api;
- struct st_api *(*create_api)(void);
-};
-
/**
* Return true if the visual has the specified buffers.
*/
return ((visual->buffer_mask & mask) == mask);
}
-/* these symbols may need to be dynamically lookup up */
-extern PUBLIC const struct st_module st_module_OpenGL;
-extern PUBLIC const struct st_module st_module_OpenGL_ES1;
-extern PUBLIC const struct st_module st_module_OpenGL_ES2;
-extern PUBLIC const struct st_module st_module_OpenVG;
-
#endif /* _ST_API_H_ */