summaryrefslogtreecommitdiffstats
path: root/video/out/gpu
diff options
context:
space:
mode:
authorJames Ross-Gowan <rossy@jrg.systems>2017-10-22 00:10:09 +1100
committerJames Ross-Gowan <rossy@jrg.systems>2017-11-07 20:27:13 +1100
commit41dff03f8d856273e4a87293f87887d9940009fa (patch)
tree586de53d199dd6021987aed01865974b9d824562 /video/out/gpu
parent793b43020c784047b60a7b9f3461ff3b9fe90d02 (diff)
downloadmpv-41dff03f8d856273e4a87293f87887d9940009fa.tar.bz2
mpv-41dff03f8d856273e4a87293f87887d9940009fa.tar.xz
vo_gpu: add namespace query mechanism
Backported from @haasn's change to libplacebo. More flexible than the previous "shared || non-shared" distinction. The extra flexibility is needed for Direct3D 11, but it also doesn't hurt code-wise.
Diffstat (limited to 'video/out/gpu')
-rw-r--r--video/out/gpu/ra.h12
-rw-r--r--video/out/gpu/shader_cache.c6
2 files changed, 9 insertions, 9 deletions
diff --git a/video/out/gpu/ra.h b/video/out/gpu/ra.h
index 15fa782bdd..5c5c851e64 100644
--- a/video/out/gpu/ra.h
+++ b/video/out/gpu/ra.h
@@ -50,8 +50,7 @@ enum {
RA_CAP_BUF_RO = 1 << 5, // supports RA_VARTYPE_BUF_RO
RA_CAP_BUF_RW = 1 << 6, // supports RA_VARTYPE_BUF_RW
RA_CAP_NESTED_ARRAY = 1 << 7, // supports nested arrays
- RA_CAP_SHARED_BINDING = 1 << 8, // sampler/image/buffer namespaces are disjoint
- RA_CAP_GLOBAL_UNIFORM = 1 << 9, // supports using "naked" uniforms (not UBO)
+ RA_CAP_GLOBAL_UNIFORM = 1 << 8, // supports using "naked" uniforms (not UBO)
};
enum ra_ctype {
@@ -206,8 +205,8 @@ struct ra_renderpass_input {
// RA_VARTYPE_IMG_W: image unit
// RA_VARTYPE_BUF_* buffer binding point
// Other uniforms: unused
- // If RA_CAP_SHARED_BINDING is set, these may only be unique per input type.
- // Otherwise, these must be unique for all input values.
+ // Bindings must be unique within each namespace, as specified by
+ // desc_namespace()
int binding;
};
@@ -396,6 +395,11 @@ struct ra_fns {
// but must be implemented if ra.max_pushc_size > 0.
struct ra_layout (*push_constant_layout)(struct ra_renderpass_input *inp);
+ // Returns an abstract namespace index for a given renderpass input type.
+ // This will always be a value >= 0 and < RA_VARTYPE_COUNT. This is used to
+ // figure out which inputs may share the same value of `binding`.
+ int (*desc_namespace)(enum ra_vartype type);
+
// Clear the dst with the given color (rgba) and within the given scissor.
// dst must have dst->params.render_dst==true. Content outside of the
// scissor is preserved.
diff --git a/video/out/gpu/shader_cache.c b/video/out/gpu/shader_cache.c
index c3eccac9e9..f191a7198c 100644
--- a/video/out/gpu/shader_cache.c
+++ b/video/out/gpu/shader_cache.c
@@ -254,11 +254,7 @@ static struct sc_uniform *find_uniform(struct gl_shader_cache *sc,
static int gl_sc_next_binding(struct gl_shader_cache *sc, enum ra_vartype type)
{
- if (sc->ra->caps & RA_CAP_SHARED_BINDING) {
- return sc->next_binding[type]++;
- } else {
- return sc->next_binding[0]++;
- }
+ return sc->next_binding[sc->ra->fns->desc_namespace(type)]++;
}
void gl_sc_uniform_dynamic(struct gl_shader_cache *sc)