aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium/state_trackers/nine/pixelshader9.c
diff options
context:
space:
mode:
authorAxel Davy <[email protected]>2019-01-23 22:48:17 +0100
committerAxel Davy <[email protected]>2019-04-30 19:18:52 +0200
commit9942ba2ea3bdfc55e2c832c8a03623d35e3bfe1f (patch)
tree37890c559e5020c469420de63dd72ae3f3f9739e /src/gallium/state_trackers/nine/pixelshader9.c
parenta3cdc466e75814cf5e18b51c760d17385771938d (diff)
st/nine: Cache constant buffer size
The shader constant buffer size with the constant compaction code can vary depending on the shader variant compiled (for example if fog constants are required, etc). Thus instead of using fixed size for the shader, add in the variant cache the size required, pass it to the context, and use this value. Signed-off-by: Axel Davy <[email protected]>
Diffstat (limited to 'src/gallium/state_trackers/nine/pixelshader9.c')
-rw-r--r--src/gallium/state_trackers/nine/pixelshader9.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/gallium/state_trackers/nine/pixelshader9.c b/src/gallium/state_trackers/nine/pixelshader9.c
index 42ad2c76a7f..4b85c738f79 100644
--- a/src/gallium/state_trackers/nine/pixelshader9.c
+++ b/src/gallium/state_trackers/nine/pixelshader9.c
@@ -80,13 +80,14 @@ NinePixelShader9_ctor( struct NinePixelShader9 *This,
This->variant.cso = info.cso;
This->variant.const_ranges = info.const_ranges;
+ This->variant.const_used_size = info.const_used_size;
This->last_cso = info.cso;
This->last_const_ranges = info.const_ranges;
+ This->last_const_used_size = info.const_used_size;
This->last_key = 0;
This->sampler_mask = info.sampler_mask;
This->rt_mask = info.rt_mask;
- This->const_used_size = info.const_used_size;
This->bumpenvmat_needed = info.bumpenvmat_needed;
memcpy(This->int_slots_used, info.int_slots_used, sizeof(This->int_slots_used));
@@ -159,7 +160,9 @@ NinePixelShader9_GetFunction( struct NinePixelShader9 *This,
}
void *
-NinePixelShader9_GetVariant( struct NinePixelShader9 *This, unsigned **const_ranges )
+NinePixelShader9_GetVariant( struct NinePixelShader9 *This,
+ unsigned **const_ranges,
+ unsigned *const_used_size )
{
/* GetVariant is called from nine_context, thus we can
* get pipe directly */
@@ -170,10 +173,11 @@ NinePixelShader9_GetVariant( struct NinePixelShader9 *This, unsigned **const_ran
key = This->next_key;
if (key == This->last_key) {
*const_ranges = This->last_const_ranges;
+ *const_used_size = This->last_const_used_size;
return This->last_cso;
}
- cso = nine_shader_variant_get(&This->variant, const_ranges, key);
+ cso = nine_shader_variant_get(&This->variant, const_ranges, const_used_size, key);
if (!cso) {
struct NineDevice9 *device = This->base.device;
struct nine_shader_info info;
@@ -210,14 +214,17 @@ NinePixelShader9_GetVariant( struct NinePixelShader9 *This, unsigned **const_ran
hr = nine_translate_shader(This->base.device, &info, pipe);
if (FAILED(hr))
return NULL;
- nine_shader_variant_add(&This->variant, key, info.cso, info.const_ranges);
+ nine_shader_variant_add(&This->variant, key, info.cso,
+ info.const_ranges, info.const_used_size);
cso = info.cso;
*const_ranges = info.const_ranges;
+ *const_used_size = info.const_used_size;
}
This->last_key = key;
This->last_cso = cso;
This->last_const_ranges = *const_ranges;
+ This->last_const_used_size = *const_used_size;
return cso;
}