diff options
author | Chia-I Wu <olvaffe@gmail.com> | 2010-01-25 13:14:51 +0800 |
---|---|---|
committer | Chia-I Wu <olvaffe@gmail.com> | 2010-01-25 13:24:07 +0800 |
commit | e181cc4dc13c16bf8c55d680a34d74807f441dd2 (patch) | |
tree | 0d626a1f9c19a35abb2c533ba0768f5d2a6b739d | |
parent | e626a737bdbc9449db52b9447f81bd7c54ebc176 (diff) |
Enhance st_visual and add st_context->is_visual_supported.
This avoids separating st_visual, as discussed in issue 1.
-rw-r--r-- | st_api.h | 48 |
1 files changed, 44 insertions, 4 deletions
@@ -70,6 +70,9 @@ enum st_texture_type { ST_TEXTURE_RECT, }; +/** + * Available attachments of framebuffer. + */ enum st_framebuffer_attachment { ST_FRAMEBUFFER_FRONT_LEFT, ST_FRAMEBUFFER_BACK_LEFT, @@ -80,6 +83,15 @@ enum st_framebuffer_attachment { ST_FRAMEBUFFER_SAMPLE, }; +/* for buffer_mask in st_visual */ +#define ST_FRAMEBUFFER_FRONT_LEFT_MASK (1 << ST_FRAMEBUFFER_FRONT_LEFT) +#define ST_FRAMEBUFFER_BACK_LEFT_MASK (1 << ST_FRAMEBUFFER_FRONT_RIGHT) +#define ST_FRAMEBUFFER_FRONT_RIGHT_MASK (1 << ST_FRAMEBUFFER_FRONT_RIGHT) +#define ST_FRAMEBUFFER_BACK_RIGHT_MASK (1 << ST_FRAMEBUFFER_BACK_RIGHT) +#define ST_FRAMEBUFFER_DEPTH_STENCIL (1 << ST_FRAMEBUFFER_DEPTH_STENCIL) +#define ST_FRAMEBUFFER_ACCUM_MASK (1 << ST_FRAMEBUFFER_ACCUM) +#define ST_FRAMEBUFFER_SAMPLE_MASK (1 << ST_FRAMEBUFFER_SAMPLE) + enum st_manager_resource_type { ST_MANAGER_RESOURCE_EGL_IMAGE, /* return struct pipe_texture */ }; @@ -104,12 +116,24 @@ struct pipe_fence_handle; struct st_visual { + /** + * Available buffers. Tested with ST_FRAMEBUFFER_*_MASK. + */ + unsigned buffer_mask; + + /** + * Buffer formats. The formats are always set even when the buffer is + * not available. + */ enum pipe_format color_format; - enum pipe_format stencil_format; - enum pipe_format depth_format; + enum pipe_format depth_stencil_format; enum pipe_format accum_format; + int samples; - boolean double_buffer; + /** + * Desired render buffer. + */ + enum st_framebuffer_attachment render_buffer; }; /** @@ -133,7 +157,7 @@ struct st_visual */ struct st_framebuffer { - struct st_visual *visual; + const struct st_visual *visual; /** * Flush the front buffer. @@ -237,10 +261,17 @@ typedef void (*st_proc_t)(void); struct st_api { /** + * Return true if the visual is supported by the state tracker. + */ + boolean (*is_visual_supported)(struct st_api *api, + const struct st_visual *visual); + + /** * Create a rendering context. * * XXX: The pipe argument should go away once * the pipe_screen can create contexts. + * XXX: Is visual needed? */ struct st_context *(*create_context)(struct st_api *api, struct pipe_context *pipe, @@ -298,6 +329,15 @@ struct st_module struct st_api *(*create_api)(const struct st_manager_api *smapi); }; +/** + * Return true if the visual has the specified buffers. + */ +static INLINE boolean +st_visual_have_buffers(const struct st_visual *visual, unsigned mask) +{ + 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; |