summaryrefslogtreecommitdiffstats
path: root/src/gallium
diff options
context:
space:
mode:
authorAxel Davy <[email protected]>2019-01-21 22:40:25 +0100
committerAxel Davy <[email protected]>2019-04-30 19:18:52 +0200
commita3cdc466e75814cf5e18b51c760d17385771938d (patch)
treef22d2d215d48b7b4de451463eebab72294d2ae02 /src/gallium
parent7761cda686d8cb59c39d363ed5b6d95d1591bb66 (diff)
st/nine: Propagate const_range to context
As with the constant compaction we map the constant slots to new slots, we need to pass that information to the context which is in charge of uploading the constants. Signed-off-by: Axel Davy <[email protected]>
Diffstat (limited to 'src/gallium')
-rw-r--r--src/gallium/state_trackers/nine/nine_shader.h10
-rw-r--r--src/gallium/state_trackers/nine/nine_state.c4
-rw-r--r--src/gallium/state_trackers/nine/nine_state.h2
-rw-r--r--src/gallium/state_trackers/nine/pixelshader9.c15
-rw-r--r--src/gallium/state_trackers/nine/pixelshader9.h3
-rw-r--r--src/gallium/state_trackers/nine/vertexshader9.c15
-rw-r--r--src/gallium/state_trackers/nine/vertexshader9.h3
7 files changed, 37 insertions, 15 deletions
diff --git a/src/gallium/state_trackers/nine/nine_shader.h b/src/gallium/state_trackers/nine/nine_shader.h
index 6eb97127b9c..aa0c0ab1f7a 100644
--- a/src/gallium/state_trackers/nine/nine_shader.h
+++ b/src/gallium/state_trackers/nine/nine_shader.h
@@ -118,22 +118,25 @@ struct nine_shader_variant
{
struct nine_shader_variant *next;
void *cso;
+ unsigned *const_ranges;
uint64_t key;
};
static inline void *
-nine_shader_variant_get(struct nine_shader_variant *list, uint64_t key)
+nine_shader_variant_get(struct nine_shader_variant *list, unsigned **const_ranges, uint64_t key)
{
while (list->key != key && list->next)
list = list->next;
- if (list->key == key)
+ if (list->key == key) {
+ *const_ranges = list->const_ranges;
return list->cso;
+ }
return NULL;
}
static inline boolean
nine_shader_variant_add(struct nine_shader_variant *list,
- uint64_t key, void *cso)
+ uint64_t key, void *cso, unsigned *const_ranges)
{
while (list->next) {
assert(list->key != key);
@@ -145,6 +148,7 @@ nine_shader_variant_add(struct nine_shader_variant *list,
list->next->next = NULL;
list->next->key = key;
list->next->cso = cso;
+ list->next->const_ranges = const_ranges;
return TRUE;
}
diff --git a/src/gallium/state_trackers/nine/nine_state.c b/src/gallium/state_trackers/nine/nine_state.c
index 76c25c8831a..6440cf46c93 100644
--- a/src/gallium/state_trackers/nine/nine_state.c
+++ b/src/gallium/state_trackers/nine/nine_state.c
@@ -603,7 +603,7 @@ prepare_vs(struct NineDevice9 *device, uint8_t shader_changed)
/* likely because we dislike FF */
if (likely(context->programmable_vs)) {
- context->cso_shader.vs = NineVertexShader9_GetVariant(vs);
+ context->cso_shader.vs = NineVertexShader9_GetVariant(vs, &context->cso_shader.vs_const_ranges);
} else {
vs = device->ff.vs;
context->cso_shader.vs = vs->ff_cso;
@@ -637,7 +637,7 @@ prepare_ps(struct NineDevice9 *device, uint8_t shader_changed)
return 0;
if (likely(ps)) {
- context->cso_shader.ps = NinePixelShader9_GetVariant(ps);
+ context->cso_shader.ps = NinePixelShader9_GetVariant(ps, &context->cso_shader.ps_const_ranges);
} else {
ps = device->ff.ps;
context->cso_shader.ps = ps->ff_cso;
diff --git a/src/gallium/state_trackers/nine/nine_state.h b/src/gallium/state_trackers/nine/nine_state.h
index 376dc561697..37238b85936 100644
--- a/src/gallium/state_trackers/nine/nine_state.h
+++ b/src/gallium/state_trackers/nine/nine_state.h
@@ -239,7 +239,9 @@ struct nine_context {
struct {
void *vs;
+ unsigned *vs_const_ranges;
void *ps;
+ unsigned *ps_const_ranges;
} cso_shader;
struct pipe_context *pipe;
diff --git a/src/gallium/state_trackers/nine/pixelshader9.c b/src/gallium/state_trackers/nine/pixelshader9.c
index f4b28e8d039..42ad2c76a7f 100644
--- a/src/gallium/state_trackers/nine/pixelshader9.c
+++ b/src/gallium/state_trackers/nine/pixelshader9.c
@@ -79,7 +79,9 @@ NinePixelShader9_ctor( struct NinePixelShader9 *This,
This->byte_code.size = info.byte_size;
This->variant.cso = info.cso;
+ This->variant.const_ranges = info.const_ranges;
This->last_cso = info.cso;
+ This->last_const_ranges = info.const_ranges;
This->last_key = 0;
This->sampler_mask = info.sampler_mask;
@@ -116,6 +118,7 @@ NinePixelShader9_dtor( struct NinePixelShader9 *This )
if (This->base.device->context.cso_shader.ps == var->cso)
pipe->bind_fs_state(pipe, NULL);
pipe->delete_fs_state(pipe, var->cso);
+ FREE(var->const_ranges);
}
var = var->next;
} while (var);
@@ -156,7 +159,7 @@ NinePixelShader9_GetFunction( struct NinePixelShader9 *This,
}
void *
-NinePixelShader9_GetVariant( struct NinePixelShader9 *This )
+NinePixelShader9_GetVariant( struct NinePixelShader9 *This, unsigned **const_ranges )
{
/* GetVariant is called from nine_context, thus we can
* get pipe directly */
@@ -165,10 +168,12 @@ NinePixelShader9_GetVariant( struct NinePixelShader9 *This )
uint64_t key;
key = This->next_key;
- if (key == This->last_key)
+ if (key == This->last_key) {
+ *const_ranges = This->last_const_ranges;
return This->last_cso;
+ }
- cso = nine_shader_variant_get(&This->variant, key);
+ cso = nine_shader_variant_get(&This->variant, const_ranges, key);
if (!cso) {
struct NineDevice9 *device = This->base.device;
struct nine_shader_info info;
@@ -205,12 +210,14 @@ NinePixelShader9_GetVariant( struct NinePixelShader9 *This )
hr = nine_translate_shader(This->base.device, &info, pipe);
if (FAILED(hr))
return NULL;
- nine_shader_variant_add(&This->variant, key, info.cso);
+ nine_shader_variant_add(&This->variant, key, info.cso, info.const_ranges);
cso = info.cso;
+ *const_ranges = info.const_ranges;
}
This->last_key = key;
This->last_cso = cso;
+ This->last_const_ranges = *const_ranges;
return cso;
}
diff --git a/src/gallium/state_trackers/nine/pixelshader9.h b/src/gallium/state_trackers/nine/pixelshader9.h
index d864eca15a4..62b5abb5962 100644
--- a/src/gallium/state_trackers/nine/pixelshader9.h
+++ b/src/gallium/state_trackers/nine/pixelshader9.h
@@ -62,6 +62,7 @@ struct NinePixelShader9
uint64_t last_key;
void *last_cso;
+ unsigned *last_const_ranges;
uint64_t next_key;
};
@@ -131,7 +132,7 @@ NinePixelShader9_UpdateKey( struct NinePixelShader9 *ps,
}
void *
-NinePixelShader9_GetVariant( struct NinePixelShader9 *ps );
+NinePixelShader9_GetVariant( struct NinePixelShader9 *ps, unsigned **const_ranges );
/*** public ***/
diff --git a/src/gallium/state_trackers/nine/vertexshader9.c b/src/gallium/state_trackers/nine/vertexshader9.c
index cffe8501677..d14b9702a18 100644
--- a/src/gallium/state_trackers/nine/vertexshader9.c
+++ b/src/gallium/state_trackers/nine/vertexshader9.c
@@ -94,7 +94,9 @@ NineVertexShader9_ctor( struct NineVertexShader9 *This,
This->byte_code.size = info.byte_size;
This->variant.cso = info.cso;
+ This->variant.const_ranges = info.const_ranges;
This->last_cso = info.cso;
+ This->last_const_ranges = info.const_ranges;
This->last_key = (uint32_t) (info.swvp_on << 9);
This->const_used_size = info.const_used_size;
@@ -133,6 +135,7 @@ NineVertexShader9_dtor( struct NineVertexShader9 *This )
if (This->base.device->context.cso_shader.vs == var->cso)
pipe->bind_vs_state(pipe, NULL);
pipe->delete_vs_state(pipe, var->cso);
+ FREE(var->const_ranges);
}
var = var->next;
} while (var);
@@ -182,7 +185,7 @@ NineVertexShader9_GetFunction( struct NineVertexShader9 *This,
}
void *
-NineVertexShader9_GetVariant( struct NineVertexShader9 *This )
+NineVertexShader9_GetVariant( struct NineVertexShader9 *This, unsigned **const_ranges )
{
/* GetVariant is called from nine_context, thus we can
* get pipe directly */
@@ -191,10 +194,12 @@ NineVertexShader9_GetVariant( struct NineVertexShader9 *This )
uint64_t key;
key = This->next_key;
- if (key == This->last_key)
+ if (key == This->last_key) {
+ *const_ranges = This->last_const_ranges;
return This->last_cso;
+ }
- cso = nine_shader_variant_get(&This->variant, key);
+ cso = nine_shader_variant_get(&This->variant, const_ranges, key);
if (!cso) {
struct NineDevice9 *device = This->base.device;
struct nine_shader_info info;
@@ -218,12 +223,14 @@ NineVertexShader9_GetVariant( struct NineVertexShader9 *This )
hr = nine_translate_shader(This->base.device, &info, pipe);
if (FAILED(hr))
return NULL;
- nine_shader_variant_add(&This->variant, key, info.cso);
+ nine_shader_variant_add(&This->variant, key, info.cso, info.const_ranges);
cso = info.cso;
+ *const_ranges = info.const_ranges;
}
This->last_key = key;
This->last_cso = cso;
+ This->last_const_ranges = *const_ranges;
return cso;
}
diff --git a/src/gallium/state_trackers/nine/vertexshader9.h b/src/gallium/state_trackers/nine/vertexshader9.h
index 766b2fd13ea..0b139c5dad1 100644
--- a/src/gallium/state_trackers/nine/vertexshader9.h
+++ b/src/gallium/state_trackers/nine/vertexshader9.h
@@ -72,6 +72,7 @@ struct NineVertexShader9
uint64_t last_key;
void *last_cso;
+ unsigned *last_const_ranges;
uint64_t next_key;
@@ -123,7 +124,7 @@ NineVertexShader9_UpdateKey( struct NineVertexShader9 *vs,
}
void *
-NineVertexShader9_GetVariant( struct NineVertexShader9 *vs );
+NineVertexShader9_GetVariant( struct NineVertexShader9 *vs, unsigned **const_ranges );
void *
NineVertexShader9_GetVariantProcessVertices( struct NineVertexShader9 *vs,