{
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);
list->next->next = NULL;
list->next->key = key;
list->next->cso = cso;
+ list->next->const_ranges = const_ranges;
return TRUE;
}
/* 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;
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;
struct {
void *vs;
+ unsigned *vs_const_ranges;
void *ps;
+ unsigned *ps_const_ranges;
} cso_shader;
struct pipe_context *pipe;
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;
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);
}
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 */
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;
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;
}
uint64_t last_key;
void *last_cso;
+ unsigned *last_const_ranges;
uint64_t next_key;
};
}
void *
-NinePixelShader9_GetVariant( struct NinePixelShader9 *ps );
+NinePixelShader9_GetVariant( struct NinePixelShader9 *ps, unsigned **const_ranges );
/*** public ***/
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;
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);
}
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 */
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;
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;
}
uint64_t last_key;
void *last_cso;
+ unsigned *last_const_ranges;
uint64_t next_key;
}
void *
-NineVertexShader9_GetVariant( struct NineVertexShader9 *vs );
+NineVertexShader9_GetVariant( struct NineVertexShader9 *vs, unsigned **const_ranges );
void *
NineVertexShader9_GetVariantProcessVertices( struct NineVertexShader9 *vs,