aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/gallium/include/state_tracker/st_api.h6
-rw-r--r--src/gallium/state_trackers/egl/common/egl_g3d.c10
-rw-r--r--src/gallium/state_trackers/vega/vg_context.c30
-rw-r--r--src/gallium/state_trackers/vega/vg_context.h1
-rw-r--r--src/gallium/state_trackers/vega/vg_manager.c14
-rw-r--r--src/mesa/state_tracker/st_manager.c8
6 files changed, 34 insertions, 35 deletions
diff --git a/src/gallium/include/state_tracker/st_api.h b/src/gallium/include/state_tracker/st_api.h
index 621bdae5c85..11424611881 100644
--- a/src/gallium/include/state_tracker/st_api.h
+++ b/src/gallium/include/state_tracker/st_api.h
@@ -369,12 +369,6 @@ struct st_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,
diff --git a/src/gallium/state_trackers/egl/common/egl_g3d.c b/src/gallium/state_trackers/egl/common/egl_g3d.c
index 8c7d2cb33e7..b4ca861efee 100644
--- a/src/gallium/state_trackers/egl/common/egl_g3d.c
+++ b/src/gallium/state_trackers/egl/common/egl_g3d.c
@@ -272,7 +272,6 @@ egl_g3d_init_config(_EGLDriver *drv, _EGLDisplay *dpy,
struct egl_g3d_config *gconf = egl_g3d_config(conf);
EGLint buffer_mask, api_mask;
EGLBoolean valid;
- EGLint i;
buffer_mask = 0x0;
if (nconf->buffer_mask & (1 << NATIVE_ATTACHMENT_FRONT_LEFT))
@@ -293,14 +292,7 @@ egl_g3d_init_config(_EGLDriver *drv, _EGLDisplay *dpy,
gconf->stvis.render_buffer = (buffer_mask & ST_ATTACHMENT_BACK_LEFT_MASK) ?
ST_ATTACHMENT_BACK_LEFT : ST_ATTACHMENT_FRONT_LEFT;
- api_mask = 0;
- for (i = 0; i < ST_API_COUNT; i++) {
- struct st_api *stapi = gdrv->stapis[i];
- if (stapi) {
- if (stapi->is_visual_supported(stapi, &gconf->stvis))
- api_mask |= egl_g3d_st_api_bit(i);
- }
- }
+ api_mask = gdrv->api_mask;;
/* this is required by EGL, not by OpenGL ES */
if (nconf->window_bit &&
gconf->stvis.render_buffer != ST_ATTACHMENT_BACK_LEFT)
diff --git a/src/gallium/state_trackers/vega/vg_context.c b/src/gallium/state_trackers/vega/vg_context.c
index f02db8949df..b45e0086b4a 100644
--- a/src/gallium/state_trackers/vega/vg_context.c
+++ b/src/gallium/state_trackers/vega/vg_context.c
@@ -65,6 +65,32 @@ static void init_clear(struct vg_context *st)
st->clear.fs =
util_make_fragment_passthrough_shader(pipe);
}
+
+/**
+ * A depth/stencil rb will be needed regardless of what the visual says.
+ */
+static boolean
+choose_depth_stencil_format(struct vg_context *ctx)
+{
+ struct pipe_screen *screen = ctx->pipe->screen;
+ enum pipe_format formats[] = {
+ PIPE_FORMAT_Z24_UNORM_S8_USCALED,
+ PIPE_FORMAT_S8_USCALED_Z24_UNORM,
+ PIPE_FORMAT_NONE
+ };
+ enum pipe_format *fmt;
+
+ for (fmt = formats; *fmt != PIPE_FORMAT_NONE; fmt++) {
+ if (screen->is_format_supported(screen, *fmt,
+ PIPE_TEXTURE_2D, 0, PIPE_BIND_DEPTH_STENCIL, 0))
+ break;
+ }
+
+ ctx->ds_format = *fmt;
+
+ return (ctx->ds_format != PIPE_FORMAT_NONE);
+}
+
void vg_set_current_context(struct vg_context *ctx)
{
_vg_context = ctx;
@@ -81,6 +107,10 @@ struct vg_context * vg_create_context(struct pipe_context *pipe,
ctx = CALLOC_STRUCT(vg_context);
ctx->pipe = pipe;
+ if (!choose_depth_stencil_format(ctx)) {
+ FREE(ctx);
+ return NULL;
+ }
ctx->dispatch = api_create_dispatch();
diff --git a/src/gallium/state_trackers/vega/vg_context.h b/src/gallium/state_trackers/vega/vg_context.h
index 7b59ad512a0..80a6c07c693 100644
--- a/src/gallium/state_trackers/vega/vg_context.h
+++ b/src/gallium/state_trackers/vega/vg_context.h
@@ -94,6 +94,7 @@ struct vg_context
struct mapi_table *dispatch;
struct pipe_context *pipe;
+ enum pipe_format ds_format;
struct {
struct vg_state vg;
diff --git a/src/gallium/state_trackers/vega/vg_manager.c b/src/gallium/state_trackers/vega/vg_manager.c
index 3b04816df04..bd6b59ba66e 100644
--- a/src/gallium/state_trackers/vega/vg_manager.c
+++ b/src/gallium/state_trackers/vega/vg_manager.c
@@ -448,8 +448,7 @@ vg_context_bind_framebuffers(struct st_context_iface *stctxi,
/* free the existing fb */
if (!stdrawi ||
stfb->strb_att != strb_att ||
- stfb->strb->format != stdrawi->visual->color_format ||
- stfb->dsrb->format != stdrawi->visual->depth_stencil_format) {
+ stfb->strb->format != stdrawi->visual->color_format) {
destroy_renderbuffer(stfb->strb);
destroy_renderbuffer(stfb->dsrb);
free(stfb);
@@ -476,7 +475,7 @@ vg_context_bind_framebuffers(struct st_context_iface *stctxi,
return FALSE;
}
- stfb->dsrb = create_renderbuffer(stdrawi->visual->depth_stencil_format);
+ stfb->dsrb = create_renderbuffer(ctx->ds_format);
if (!stfb->dsrb) {
free(stfb->strb);
free(stfb);
@@ -517,14 +516,6 @@ vg_api_get_current(struct st_api *stapi)
return (ctx) ? &ctx->iface : NULL;
}
-static boolean
-vg_api_is_visual_supported(struct st_api *stapi,
- const struct st_visual *visual)
-{
- /* the impl requires a depth/stencil buffer */
- return util_format_is_depth_and_stencil(visual->depth_stencil_format);
-}
-
static st_proc_t
vg_api_get_proc_address(struct st_api *stapi, const char *procname)
{
@@ -539,7 +530,6 @@ vg_api_destroy(struct st_api *stapi)
static const struct st_api vg_api = {
vg_api_destroy,
vg_api_get_proc_address,
- vg_api_is_visual_supported,
vg_api_create_context,
vg_api_make_current,
vg_api_get_current,
diff --git a/src/mesa/state_tracker/st_manager.c b/src/mesa/state_tracker/st_manager.c
index ccfb1f4a520..f1d98dbd20b 100644
--- a/src/mesa/state_tracker/st_manager.c
+++ b/src/mesa/state_tracker/st_manager.c
@@ -707,13 +707,6 @@ st_api_get_current(struct st_api *stapi)
return (st) ? &st->iface : NULL;
}
-static boolean
-st_api_is_visual_supported(struct st_api *stapi,
- const struct st_visual *visual)
-{
- return TRUE;
-}
-
static st_proc_t
st_api_get_proc_address(struct st_api *stapi, const char *procname)
{
@@ -822,7 +815,6 @@ st_manager_add_color_renderbuffer(struct st_context *st, GLframebuffer *fb,
struct st_api st_gl_api = {
st_api_destroy,
st_api_get_proc_address,
- st_api_is_visual_supported,
st_api_create_context,
st_api_make_current,
st_api_get_current,