aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRob Clark <[email protected]>2020-04-16 10:30:16 -0700
committerMarge Bot <[email protected]>2020-04-23 04:49:52 +0000
commitb88778e2de3a593587e20a8d4f0363a499f91455 (patch)
treed7fae8ed68d335e28d1ebf60d571df69fe2f5bab /src
parent7e1b57a6d964ac58e84ec4ece2951e4e643d6b1a (diff)
mesa/st: avoid u_vbuf for GLES
64b VBO types are not required for GLES. So avoid u_vbuf if that was otherwise the only reason it was used. Signed-off-by: Rob Clark <[email protected]> Reviewed-by: Kristian H. Kristensen <[email protected]> Reviewed-by: Eric Anholt <[email protected]> Reviewed-by: Marek Olšák <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4619>
Diffstat (limited to 'src')
-rw-r--r--src/gallium/auxiliary/cso_cache/cso_context.c3
-rw-r--r--src/gallium/auxiliary/cso_cache/cso_context.h1
-rw-r--r--src/gallium/auxiliary/util/u_vbuf.c7
-rw-r--r--src/gallium/auxiliary/util/u_vbuf.h3
-rw-r--r--src/mesa/state_tracker/st_context.c16
5 files changed, 25 insertions, 5 deletions
diff --git a/src/gallium/auxiliary/cso_cache/cso_context.c b/src/gallium/auxiliary/cso_cache/cso_context.c
index 459833b21be..3911ee73d30 100644
--- a/src/gallium/auxiliary/cso_cache/cso_context.c
+++ b/src/gallium/auxiliary/cso_cache/cso_context.c
@@ -291,8 +291,9 @@ static void cso_init_vbuf(struct cso_context *cso, unsigned flags)
{
struct u_vbuf_caps caps;
bool uses_user_vertex_buffers = !(flags & CSO_NO_USER_VERTEX_BUFFERS);
+ bool needs64b = !(flags & CSO_NO_64B_VERTEX_BUFFERS);
- u_vbuf_get_caps(cso->pipe->screen, &caps);
+ u_vbuf_get_caps(cso->pipe->screen, &caps, needs64b);
/* Enable u_vbuf if needed. */
if (caps.fallback_always ||
diff --git a/src/gallium/auxiliary/cso_cache/cso_context.h b/src/gallium/auxiliary/cso_cache/cso_context.h
index 0cd977b39e0..ce64568a6da 100644
--- a/src/gallium/auxiliary/cso_cache/cso_context.h
+++ b/src/gallium/auxiliary/cso_cache/cso_context.h
@@ -43,6 +43,7 @@ struct cso_context;
struct u_vbuf;
#define CSO_NO_USER_VERTEX_BUFFERS (1 << 0)
+#define CSO_NO_64B_VERTEX_BUFFERS (1 << 1)
struct cso_context *cso_create_context(struct pipe_context *pipe,
unsigned flags);
diff --git a/src/gallium/auxiliary/util/u_vbuf.c b/src/gallium/auxiliary/util/u_vbuf.c
index 567cb6a75c9..62b2e0efc3d 100644
--- a/src/gallium/auxiliary/util/u_vbuf.c
+++ b/src/gallium/auxiliary/util/u_vbuf.c
@@ -256,7 +256,8 @@ static const struct {
{ PIPE_FORMAT_R8G8B8A8_SSCALED, PIPE_FORMAT_R32G32B32A32_FLOAT },
};
-void u_vbuf_get_caps(struct pipe_screen *screen, struct u_vbuf_caps *caps)
+void u_vbuf_get_caps(struct pipe_screen *screen, struct u_vbuf_caps *caps,
+ bool needs64b)
{
unsigned i;
@@ -272,6 +273,10 @@ void u_vbuf_get_caps(struct pipe_screen *screen, struct u_vbuf_caps *caps)
for (i = 0; i < ARRAY_SIZE(vbuf_format_fallbacks); i++) {
enum pipe_format format = vbuf_format_fallbacks[i].from;
+ unsigned comp_bits = util_format_get_component_bits(format, 0, 0);
+
+ if ((comp_bits > 32) && !needs64b)
+ continue;
if (!screen->is_format_supported(screen, format, PIPE_BUFFER, 0, 0,
PIPE_BIND_VERTEX_BUFFER)) {
diff --git a/src/gallium/auxiliary/util/u_vbuf.h b/src/gallium/auxiliary/util/u_vbuf.h
index 81dac2caf33..1b09bf02e2d 100644
--- a/src/gallium/auxiliary/util/u_vbuf.h
+++ b/src/gallium/auxiliary/util/u_vbuf.h
@@ -62,7 +62,8 @@ struct u_vbuf_caps {
};
-void u_vbuf_get_caps(struct pipe_screen *screen, struct u_vbuf_caps *caps);
+void u_vbuf_get_caps(struct pipe_screen *screen, struct u_vbuf_caps *caps,
+ bool needs64b);
struct u_vbuf *
u_vbuf_create(struct pipe_context *pipe, struct u_vbuf_caps *caps);
diff --git a/src/mesa/state_tracker/st_context.c b/src/mesa/state_tracker/st_context.c
index 0a6e9951a1d..4f7fd242741 100644
--- a/src/mesa/state_tracker/st_context.c
+++ b/src/mesa/state_tracker/st_context.c
@@ -592,8 +592,20 @@ st_create_context_priv(struct gl_context *ctx, struct pipe_context *pipe,
* profile, so that u_vbuf is bypassed completely if there is nothing else
* to do.
*/
- unsigned cso_flags =
- ctx->API == API_OPENGL_CORE ? CSO_NO_USER_VERTEX_BUFFERS : 0;
+ unsigned cso_flags;
+ switch (ctx->API) {
+ case API_OPENGL_CORE:
+ cso_flags = CSO_NO_USER_VERTEX_BUFFERS;
+ break;
+ case API_OPENGLES:
+ case API_OPENGLES2:
+ cso_flags = CSO_NO_64B_VERTEX_BUFFERS;
+ break;
+ default:
+ cso_flags = 0;
+ break;
+ }
+
st->cso_context = cso_create_context(pipe, cso_flags);
st_init_atoms(st);