v3d: Rename driver functions from vc5 to v3d.
This is the final step of the driver rename.
This commit is contained in:
@@ -38,7 +38,7 @@
|
||||
#include "mesa/state_tracker/st_glsl_types.h"
|
||||
|
||||
static gl_varying_slot
|
||||
vc5_get_slot_for_driver_location(nir_shader *s, uint32_t driver_location)
|
||||
v3d_get_slot_for_driver_location(nir_shader *s, uint32_t driver_location)
|
||||
{
|
||||
nir_foreach_variable(var, &s->outputs) {
|
||||
if (var->data.driver_location == driver_location) {
|
||||
@@ -58,7 +58,7 @@ vc5_get_slot_for_driver_location(nir_shader *s, uint32_t driver_location)
|
||||
* varyings together in a single data spec.
|
||||
*/
|
||||
static void
|
||||
vc5_set_transform_feedback_outputs(struct vc5_uncompiled_shader *so,
|
||||
v3d_set_transform_feedback_outputs(struct v3d_uncompiled_shader *so,
|
||||
const struct pipe_stream_output_info *stream_output)
|
||||
{
|
||||
if (!stream_output->num_outputs)
|
||||
@@ -96,7 +96,7 @@ vc5_set_transform_feedback_outputs(struct vc5_uncompiled_shader *so,
|
||||
*/
|
||||
for (int j = 0; j < output->num_components; j++) {
|
||||
gl_varying_slot slot =
|
||||
vc5_get_slot_for_driver_location(so->base.ir.nir, output->register_index);
|
||||
v3d_get_slot_for_driver_location(so->base.ir.nir, output->register_index);
|
||||
|
||||
slots[slot_count] =
|
||||
v3d_slot_from_slot_and_component(slot,
|
||||
@@ -173,15 +173,15 @@ uniforms_type_size(const struct glsl_type *type)
|
||||
}
|
||||
|
||||
static void *
|
||||
vc5_shader_state_create(struct pipe_context *pctx,
|
||||
v3d_shader_state_create(struct pipe_context *pctx,
|
||||
const struct pipe_shader_state *cso)
|
||||
{
|
||||
struct vc5_context *vc5 = vc5_context(pctx);
|
||||
struct vc5_uncompiled_shader *so = CALLOC_STRUCT(vc5_uncompiled_shader);
|
||||
struct v3d_context *v3d = v3d_context(pctx);
|
||||
struct v3d_uncompiled_shader *so = CALLOC_STRUCT(v3d_uncompiled_shader);
|
||||
if (!so)
|
||||
return NULL;
|
||||
|
||||
so->program_id = vc5->next_uncompiled_program_id++;
|
||||
so->program_id = v3d->next_uncompiled_program_id++;
|
||||
|
||||
nir_shader *s;
|
||||
|
||||
@@ -227,7 +227,7 @@ vc5_shader_state_create(struct pipe_context *pctx,
|
||||
so->base.type = PIPE_SHADER_IR_NIR;
|
||||
so->base.ir.nir = s;
|
||||
|
||||
vc5_set_transform_feedback_outputs(so, &cso->stream_output);
|
||||
v3d_set_transform_feedback_outputs(so, &cso->stream_output);
|
||||
|
||||
if (V3D_DEBUG & (V3D_DEBUG_NIR |
|
||||
v3d_debug_flag_for_shader_stage(s->info.stage))) {
|
||||
@@ -241,19 +241,19 @@ vc5_shader_state_create(struct pipe_context *pctx,
|
||||
return so;
|
||||
}
|
||||
|
||||
static struct vc5_compiled_shader *
|
||||
vc5_get_compiled_shader(struct vc5_context *vc5, struct v3d_key *key)
|
||||
static struct v3d_compiled_shader *
|
||||
v3d_get_compiled_shader(struct v3d_context *v3d, struct v3d_key *key)
|
||||
{
|
||||
struct vc5_uncompiled_shader *shader_state = key->shader_state;
|
||||
struct v3d_uncompiled_shader *shader_state = key->shader_state;
|
||||
nir_shader *s = shader_state->base.ir.nir;
|
||||
|
||||
struct hash_table *ht;
|
||||
uint32_t key_size;
|
||||
if (s->info.stage == MESA_SHADER_FRAGMENT) {
|
||||
ht = vc5->fs_cache;
|
||||
ht = v3d->fs_cache;
|
||||
key_size = sizeof(struct v3d_fs_key);
|
||||
} else {
|
||||
ht = vc5->vs_cache;
|
||||
ht = v3d->vs_cache;
|
||||
key_size = sizeof(struct v3d_vs_key);
|
||||
}
|
||||
|
||||
@@ -261,8 +261,8 @@ vc5_get_compiled_shader(struct vc5_context *vc5, struct v3d_key *key)
|
||||
if (entry)
|
||||
return entry->data;
|
||||
|
||||
struct vc5_compiled_shader *shader =
|
||||
rzalloc(NULL, struct vc5_compiled_shader);
|
||||
struct v3d_compiled_shader *shader =
|
||||
rzalloc(NULL, struct v3d_compiled_shader);
|
||||
|
||||
int program_id = shader_state->program_id;
|
||||
int variant_id =
|
||||
@@ -274,7 +274,7 @@ vc5_get_compiled_shader(struct vc5_context *vc5, struct v3d_key *key)
|
||||
case MESA_SHADER_VERTEX:
|
||||
shader->prog_data.vs = rzalloc(shader, struct v3d_vs_prog_data);
|
||||
|
||||
qpu_insts = v3d_compile_vs(vc5->screen->compiler,
|
||||
qpu_insts = v3d_compile_vs(v3d->screen->compiler,
|
||||
(struct v3d_vs_key *)key,
|
||||
shader->prog_data.vs, s,
|
||||
program_id, variant_id,
|
||||
@@ -283,7 +283,7 @@ vc5_get_compiled_shader(struct vc5_context *vc5, struct v3d_key *key)
|
||||
case MESA_SHADER_FRAGMENT:
|
||||
shader->prog_data.fs = rzalloc(shader, struct v3d_fs_prog_data);
|
||||
|
||||
qpu_insts = v3d_compile_fs(vc5->screen->compiler,
|
||||
qpu_insts = v3d_compile_fs(v3d->screen->compiler,
|
||||
(struct v3d_fs_key *)key,
|
||||
shader->prog_data.fs, s,
|
||||
program_id, variant_id,
|
||||
@@ -293,31 +293,31 @@ vc5_get_compiled_shader(struct vc5_context *vc5, struct v3d_key *key)
|
||||
unreachable("bad stage");
|
||||
}
|
||||
|
||||
vc5_set_shader_uniform_dirty_flags(shader);
|
||||
v3d_set_shader_uniform_dirty_flags(shader);
|
||||
|
||||
shader->bo = vc5_bo_alloc(vc5->screen, shader_size, "shader");
|
||||
vc5_bo_map(shader->bo);
|
||||
shader->bo = v3d_bo_alloc(v3d->screen, shader_size, "shader");
|
||||
v3d_bo_map(shader->bo);
|
||||
memcpy(shader->bo->map, qpu_insts, shader_size);
|
||||
|
||||
free(qpu_insts);
|
||||
|
||||
struct vc5_key *dup_key;
|
||||
struct v3d_key *dup_key;
|
||||
dup_key = ralloc_size(shader, key_size);
|
||||
memcpy(dup_key, key, key_size);
|
||||
_mesa_hash_table_insert(ht, dup_key, shader);
|
||||
|
||||
if (shader->prog_data.base->spill_size >
|
||||
vc5->prog.spill_size_per_thread) {
|
||||
v3d->prog.spill_size_per_thread) {
|
||||
/* Max 4 QPUs per slice, 3 slices per core. We only do single
|
||||
* core so far. This overallocates memory on smaller cores.
|
||||
*/
|
||||
int total_spill_size =
|
||||
4 * 3 * shader->prog_data.base->spill_size;
|
||||
|
||||
vc5_bo_unreference(&vc5->prog.spill_bo);
|
||||
vc5->prog.spill_bo = vc5_bo_alloc(vc5->screen,
|
||||
v3d_bo_unreference(&v3d->prog.spill_bo);
|
||||
v3d->prog.spill_bo = v3d_bo_alloc(v3d->screen,
|
||||
total_spill_size, "spill");
|
||||
vc5->prog.spill_size_per_thread =
|
||||
v3d->prog.spill_size_per_thread =
|
||||
shader->prog_data.base->spill_size;
|
||||
}
|
||||
|
||||
@@ -325,14 +325,14 @@ vc5_get_compiled_shader(struct vc5_context *vc5, struct v3d_key *key)
|
||||
}
|
||||
|
||||
static void
|
||||
vc5_setup_shared_key(struct vc5_context *vc5, struct v3d_key *key,
|
||||
struct vc5_texture_stateobj *texstate)
|
||||
v3d_setup_shared_key(struct v3d_context *v3d, struct v3d_key *key,
|
||||
struct v3d_texture_stateobj *texstate)
|
||||
{
|
||||
const struct v3d_device_info *devinfo = &vc5->screen->devinfo;
|
||||
const struct v3d_device_info *devinfo = &v3d->screen->devinfo;
|
||||
|
||||
for (int i = 0; i < texstate->num_textures; i++) {
|
||||
struct pipe_sampler_view *sampler = texstate->textures[i];
|
||||
struct vc5_sampler_view *vc5_sampler = vc5_sampler_view(sampler);
|
||||
struct v3d_sampler_view *v3d_sampler = v3d_sampler_view(sampler);
|
||||
struct pipe_sampler_state *sampler_state =
|
||||
texstate->samplers[i];
|
||||
|
||||
@@ -340,7 +340,7 @@ vc5_setup_shared_key(struct vc5_context *vc5, struct v3d_key *key,
|
||||
continue;
|
||||
|
||||
key->tex[i].return_size =
|
||||
vc5_get_tex_return_size(devinfo,
|
||||
v3d_get_tex_return_size(devinfo,
|
||||
sampler->format,
|
||||
sampler_state->compare_mode);
|
||||
|
||||
@@ -354,14 +354,14 @@ vc5_setup_shared_key(struct vc5_context *vc5, struct v3d_key *key,
|
||||
key->tex[i].return_channels = 4;
|
||||
} else {
|
||||
key->tex[i].return_channels =
|
||||
vc5_get_tex_return_channels(devinfo,
|
||||
v3d_get_tex_return_channels(devinfo,
|
||||
sampler->format);
|
||||
}
|
||||
|
||||
if (key->tex[i].return_size == 32 && devinfo->ver < 40) {
|
||||
memcpy(key->tex[i].swizzle,
|
||||
vc5_sampler->swizzle,
|
||||
sizeof(vc5_sampler->swizzle));
|
||||
v3d_sampler->swizzle,
|
||||
sizeof(v3d_sampler->swizzle));
|
||||
} else {
|
||||
/* For 16-bit returns, we let the sampler state handle
|
||||
* the swizzle.
|
||||
@@ -384,17 +384,17 @@ vc5_setup_shared_key(struct vc5_context *vc5, struct v3d_key *key,
|
||||
}
|
||||
}
|
||||
|
||||
key->ucp_enables = vc5->rasterizer->base.clip_plane_enable;
|
||||
key->ucp_enables = v3d->rasterizer->base.clip_plane_enable;
|
||||
}
|
||||
|
||||
static void
|
||||
vc5_update_compiled_fs(struct vc5_context *vc5, uint8_t prim_mode)
|
||||
v3d_update_compiled_fs(struct v3d_context *v3d, uint8_t prim_mode)
|
||||
{
|
||||
struct vc5_job *job = vc5->job;
|
||||
struct v3d_job *job = v3d->job;
|
||||
struct v3d_fs_key local_key;
|
||||
struct v3d_fs_key *key = &local_key;
|
||||
|
||||
if (!(vc5->dirty & (VC5_DIRTY_PRIM_MODE |
|
||||
if (!(v3d->dirty & (VC5_DIRTY_PRIM_MODE |
|
||||
VC5_DIRTY_BLEND |
|
||||
VC5_DIRTY_FRAMEBUFFER |
|
||||
VC5_DIRTY_ZSA |
|
||||
@@ -406,40 +406,40 @@ vc5_update_compiled_fs(struct vc5_context *vc5, uint8_t prim_mode)
|
||||
}
|
||||
|
||||
memset(key, 0, sizeof(*key));
|
||||
vc5_setup_shared_key(vc5, &key->base, &vc5->fragtex);
|
||||
key->base.shader_state = vc5->prog.bind_fs;
|
||||
v3d_setup_shared_key(v3d, &key->base, &v3d->fragtex);
|
||||
key->base.shader_state = v3d->prog.bind_fs;
|
||||
key->is_points = (prim_mode == PIPE_PRIM_POINTS);
|
||||
key->is_lines = (prim_mode >= PIPE_PRIM_LINES &&
|
||||
prim_mode <= PIPE_PRIM_LINE_STRIP);
|
||||
key->clamp_color = vc5->rasterizer->base.clamp_fragment_color;
|
||||
if (vc5->blend->logicop_enable) {
|
||||
key->logicop_func = vc5->blend->logicop_func;
|
||||
key->clamp_color = v3d->rasterizer->base.clamp_fragment_color;
|
||||
if (v3d->blend->logicop_enable) {
|
||||
key->logicop_func = v3d->blend->logicop_func;
|
||||
} else {
|
||||
key->logicop_func = PIPE_LOGICOP_COPY;
|
||||
}
|
||||
if (job->msaa) {
|
||||
key->msaa = vc5->rasterizer->base.multisample;
|
||||
key->sample_coverage = (vc5->rasterizer->base.multisample &&
|
||||
vc5->sample_mask != (1 << VC5_MAX_SAMPLES) - 1);
|
||||
key->sample_alpha_to_coverage = vc5->blend->alpha_to_coverage;
|
||||
key->sample_alpha_to_one = vc5->blend->alpha_to_one;
|
||||
key->msaa = v3d->rasterizer->base.multisample;
|
||||
key->sample_coverage = (v3d->rasterizer->base.multisample &&
|
||||
v3d->sample_mask != (1 << VC5_MAX_SAMPLES) - 1);
|
||||
key->sample_alpha_to_coverage = v3d->blend->alpha_to_coverage;
|
||||
key->sample_alpha_to_one = v3d->blend->alpha_to_one;
|
||||
}
|
||||
|
||||
key->depth_enabled = (vc5->zsa->base.depth.enabled ||
|
||||
vc5->zsa->base.stencil[0].enabled);
|
||||
if (vc5->zsa->base.alpha.enabled) {
|
||||
key->depth_enabled = (v3d->zsa->base.depth.enabled ||
|
||||
v3d->zsa->base.stencil[0].enabled);
|
||||
if (v3d->zsa->base.alpha.enabled) {
|
||||
key->alpha_test = true;
|
||||
key->alpha_test_func = vc5->zsa->base.alpha.func;
|
||||
key->alpha_test_func = v3d->zsa->base.alpha.func;
|
||||
}
|
||||
|
||||
/* gl_FragColor's propagation to however many bound color buffers
|
||||
* there are means that the buffer count needs to be in the key.
|
||||
*/
|
||||
key->nr_cbufs = vc5->framebuffer.nr_cbufs;
|
||||
key->swap_color_rb = vc5->swap_color_rb;
|
||||
key->nr_cbufs = v3d->framebuffer.nr_cbufs;
|
||||
key->swap_color_rb = v3d->swap_color_rb;
|
||||
|
||||
for (int i = 0; i < key->nr_cbufs; i++) {
|
||||
struct pipe_surface *cbuf = vc5->framebuffer.cbufs[i];
|
||||
struct pipe_surface *cbuf = v3d->framebuffer.cbufs[i];
|
||||
if (!cbuf)
|
||||
continue;
|
||||
|
||||
@@ -451,7 +451,7 @@ vc5_update_compiled_fs(struct vc5_context *vc5, uint8_t prim_mode)
|
||||
key->f32_color_rb |= 1 << i;
|
||||
}
|
||||
|
||||
if (vc5->prog.bind_fs->was_tgsi) {
|
||||
if (v3d->prog.bind_fs->was_tgsi) {
|
||||
if (util_format_is_pure_uint(cbuf->format))
|
||||
key->uint_color_rb |= 1 << i;
|
||||
else if (util_format_is_pure_sint(cbuf->format))
|
||||
@@ -461,48 +461,48 @@ vc5_update_compiled_fs(struct vc5_context *vc5, uint8_t prim_mode)
|
||||
|
||||
if (key->is_points) {
|
||||
key->point_sprite_mask =
|
||||
vc5->rasterizer->base.sprite_coord_enable;
|
||||
v3d->rasterizer->base.sprite_coord_enable;
|
||||
key->point_coord_upper_left =
|
||||
(vc5->rasterizer->base.sprite_coord_mode ==
|
||||
(v3d->rasterizer->base.sprite_coord_mode ==
|
||||
PIPE_SPRITE_COORD_UPPER_LEFT);
|
||||
}
|
||||
|
||||
key->light_twoside = vc5->rasterizer->base.light_twoside;
|
||||
key->shade_model_flat = vc5->rasterizer->base.flatshade;
|
||||
key->light_twoside = v3d->rasterizer->base.light_twoside;
|
||||
key->shade_model_flat = v3d->rasterizer->base.flatshade;
|
||||
|
||||
struct vc5_compiled_shader *old_fs = vc5->prog.fs;
|
||||
vc5->prog.fs = vc5_get_compiled_shader(vc5, &key->base);
|
||||
if (vc5->prog.fs == old_fs)
|
||||
struct v3d_compiled_shader *old_fs = v3d->prog.fs;
|
||||
v3d->prog.fs = v3d_get_compiled_shader(v3d, &key->base);
|
||||
if (v3d->prog.fs == old_fs)
|
||||
return;
|
||||
|
||||
vc5->dirty |= VC5_DIRTY_COMPILED_FS;
|
||||
v3d->dirty |= VC5_DIRTY_COMPILED_FS;
|
||||
|
||||
if (old_fs) {
|
||||
if (vc5->prog.fs->prog_data.fs->flat_shade_flags !=
|
||||
if (v3d->prog.fs->prog_data.fs->flat_shade_flags !=
|
||||
old_fs->prog_data.fs->flat_shade_flags) {
|
||||
vc5->dirty |= VC5_DIRTY_FLAT_SHADE_FLAGS;
|
||||
v3d->dirty |= VC5_DIRTY_FLAT_SHADE_FLAGS;
|
||||
}
|
||||
|
||||
if (vc5->prog.fs->prog_data.fs->centroid_flags !=
|
||||
if (v3d->prog.fs->prog_data.fs->centroid_flags !=
|
||||
old_fs->prog_data.fs->centroid_flags) {
|
||||
vc5->dirty |= VC5_DIRTY_CENTROID_FLAGS;
|
||||
v3d->dirty |= VC5_DIRTY_CENTROID_FLAGS;
|
||||
}
|
||||
}
|
||||
|
||||
if (old_fs && memcmp(vc5->prog.fs->prog_data.fs->input_slots,
|
||||
if (old_fs && memcmp(v3d->prog.fs->prog_data.fs->input_slots,
|
||||
old_fs->prog_data.fs->input_slots,
|
||||
sizeof(vc5->prog.fs->prog_data.fs->input_slots))) {
|
||||
vc5->dirty |= VC5_DIRTY_FS_INPUTS;
|
||||
sizeof(v3d->prog.fs->prog_data.fs->input_slots))) {
|
||||
v3d->dirty |= VC5_DIRTY_FS_INPUTS;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
vc5_update_compiled_vs(struct vc5_context *vc5, uint8_t prim_mode)
|
||||
v3d_update_compiled_vs(struct v3d_context *v3d, uint8_t prim_mode)
|
||||
{
|
||||
struct v3d_vs_key local_key;
|
||||
struct v3d_vs_key *key = &local_key;
|
||||
|
||||
if (!(vc5->dirty & (VC5_DIRTY_PRIM_MODE |
|
||||
if (!(v3d->dirty & (VC5_DIRTY_PRIM_MODE |
|
||||
VC5_DIRTY_RASTERIZER |
|
||||
VC5_DIRTY_VERTTEX |
|
||||
VC5_DIRTY_VTXSTATE |
|
||||
@@ -512,29 +512,29 @@ vc5_update_compiled_vs(struct vc5_context *vc5, uint8_t prim_mode)
|
||||
}
|
||||
|
||||
memset(key, 0, sizeof(*key));
|
||||
vc5_setup_shared_key(vc5, &key->base, &vc5->verttex);
|
||||
key->base.shader_state = vc5->prog.bind_vs;
|
||||
key->num_fs_inputs = vc5->prog.fs->prog_data.fs->base.num_inputs;
|
||||
v3d_setup_shared_key(v3d, &key->base, &v3d->verttex);
|
||||
key->base.shader_state = v3d->prog.bind_vs;
|
||||
key->num_fs_inputs = v3d->prog.fs->prog_data.fs->base.num_inputs;
|
||||
STATIC_ASSERT(sizeof(key->fs_inputs) ==
|
||||
sizeof(vc5->prog.fs->prog_data.fs->input_slots));
|
||||
memcpy(key->fs_inputs, vc5->prog.fs->prog_data.fs->input_slots,
|
||||
sizeof(v3d->prog.fs->prog_data.fs->input_slots));
|
||||
memcpy(key->fs_inputs, v3d->prog.fs->prog_data.fs->input_slots,
|
||||
sizeof(key->fs_inputs));
|
||||
key->clamp_color = vc5->rasterizer->base.clamp_vertex_color;
|
||||
key->clamp_color = v3d->rasterizer->base.clamp_vertex_color;
|
||||
|
||||
key->per_vertex_point_size =
|
||||
(prim_mode == PIPE_PRIM_POINTS &&
|
||||
vc5->rasterizer->base.point_size_per_vertex);
|
||||
v3d->rasterizer->base.point_size_per_vertex);
|
||||
|
||||
struct vc5_compiled_shader *vs =
|
||||
vc5_get_compiled_shader(vc5, &key->base);
|
||||
if (vs != vc5->prog.vs) {
|
||||
vc5->prog.vs = vs;
|
||||
vc5->dirty |= VC5_DIRTY_COMPILED_VS;
|
||||
struct v3d_compiled_shader *vs =
|
||||
v3d_get_compiled_shader(v3d, &key->base);
|
||||
if (vs != v3d->prog.vs) {
|
||||
v3d->prog.vs = vs;
|
||||
v3d->dirty |= VC5_DIRTY_COMPILED_VS;
|
||||
}
|
||||
|
||||
key->is_coord = true;
|
||||
/* Coord shaders only output varyings used by transform feedback. */
|
||||
struct vc5_uncompiled_shader *shader_state = key->base.shader_state;
|
||||
struct v3d_uncompiled_shader *shader_state = key->base.shader_state;
|
||||
memcpy(key->fs_inputs, shader_state->tf_outputs,
|
||||
sizeof(*key->fs_inputs) * shader_state->num_tf_outputs);
|
||||
if (shader_state->num_tf_outputs < key->num_fs_inputs) {
|
||||
@@ -545,19 +545,19 @@ vc5_update_compiled_vs(struct vc5_context *vc5, uint8_t prim_mode)
|
||||
}
|
||||
key->num_fs_inputs = shader_state->num_tf_outputs;
|
||||
|
||||
struct vc5_compiled_shader *cs =
|
||||
vc5_get_compiled_shader(vc5, &key->base);
|
||||
if (cs != vc5->prog.cs) {
|
||||
vc5->prog.cs = cs;
|
||||
vc5->dirty |= VC5_DIRTY_COMPILED_CS;
|
||||
struct v3d_compiled_shader *cs =
|
||||
v3d_get_compiled_shader(v3d, &key->base);
|
||||
if (cs != v3d->prog.cs) {
|
||||
v3d->prog.cs = cs;
|
||||
v3d->dirty |= VC5_DIRTY_COMPILED_CS;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
vc5_update_compiled_shaders(struct vc5_context *vc5, uint8_t prim_mode)
|
||||
v3d_update_compiled_shaders(struct v3d_context *v3d, uint8_t prim_mode)
|
||||
{
|
||||
vc5_update_compiled_fs(vc5, prim_mode);
|
||||
vc5_update_compiled_vs(vc5, prim_mode);
|
||||
v3d_update_compiled_fs(v3d, prim_mode);
|
||||
v3d_update_compiled_vs(v3d, prim_mode);
|
||||
}
|
||||
|
||||
static uint32_t
|
||||
@@ -586,16 +586,16 @@ vs_cache_compare(const void *key1, const void *key2)
|
||||
|
||||
static void
|
||||
delete_from_cache_if_matches(struct hash_table *ht,
|
||||
struct vc5_compiled_shader **last_compile,
|
||||
struct v3d_compiled_shader **last_compile,
|
||||
struct hash_entry *entry,
|
||||
struct vc5_uncompiled_shader *so)
|
||||
struct v3d_uncompiled_shader *so)
|
||||
{
|
||||
const struct v3d_key *key = entry->key;
|
||||
|
||||
if (key->shader_state == so) {
|
||||
struct vc5_compiled_shader *shader = entry->data;
|
||||
struct v3d_compiled_shader *shader = entry->data;
|
||||
_mesa_hash_table_remove(ht, entry);
|
||||
vc5_bo_unreference(&shader->bo);
|
||||
v3d_bo_unreference(&shader->bo);
|
||||
|
||||
if (shader == *last_compile)
|
||||
*last_compile = NULL;
|
||||
@@ -605,18 +605,18 @@ delete_from_cache_if_matches(struct hash_table *ht,
|
||||
}
|
||||
|
||||
static void
|
||||
vc5_shader_state_delete(struct pipe_context *pctx, void *hwcso)
|
||||
v3d_shader_state_delete(struct pipe_context *pctx, void *hwcso)
|
||||
{
|
||||
struct vc5_context *vc5 = vc5_context(pctx);
|
||||
struct vc5_uncompiled_shader *so = hwcso;
|
||||
struct v3d_context *v3d = v3d_context(pctx);
|
||||
struct v3d_uncompiled_shader *so = hwcso;
|
||||
|
||||
struct hash_entry *entry;
|
||||
hash_table_foreach(vc5->fs_cache, entry) {
|
||||
delete_from_cache_if_matches(vc5->fs_cache, &vc5->prog.fs,
|
||||
hash_table_foreach(v3d->fs_cache, entry) {
|
||||
delete_from_cache_if_matches(v3d->fs_cache, &v3d->prog.fs,
|
||||
entry, so);
|
||||
}
|
||||
hash_table_foreach(vc5->vs_cache, entry) {
|
||||
delete_from_cache_if_matches(vc5->vs_cache, &vc5->prog.vs,
|
||||
hash_table_foreach(v3d->vs_cache, entry) {
|
||||
delete_from_cache_if_matches(v3d->vs_cache, &v3d->prog.vs,
|
||||
entry, so);
|
||||
}
|
||||
|
||||
@@ -625,58 +625,58 @@ vc5_shader_state_delete(struct pipe_context *pctx, void *hwcso)
|
||||
}
|
||||
|
||||
static void
|
||||
vc5_fp_state_bind(struct pipe_context *pctx, void *hwcso)
|
||||
v3d_fp_state_bind(struct pipe_context *pctx, void *hwcso)
|
||||
{
|
||||
struct vc5_context *vc5 = vc5_context(pctx);
|
||||
vc5->prog.bind_fs = hwcso;
|
||||
vc5->dirty |= VC5_DIRTY_UNCOMPILED_FS;
|
||||
struct v3d_context *v3d = v3d_context(pctx);
|
||||
v3d->prog.bind_fs = hwcso;
|
||||
v3d->dirty |= VC5_DIRTY_UNCOMPILED_FS;
|
||||
}
|
||||
|
||||
static void
|
||||
vc5_vp_state_bind(struct pipe_context *pctx, void *hwcso)
|
||||
v3d_vp_state_bind(struct pipe_context *pctx, void *hwcso)
|
||||
{
|
||||
struct vc5_context *vc5 = vc5_context(pctx);
|
||||
vc5->prog.bind_vs = hwcso;
|
||||
vc5->dirty |= VC5_DIRTY_UNCOMPILED_VS;
|
||||
struct v3d_context *v3d = v3d_context(pctx);
|
||||
v3d->prog.bind_vs = hwcso;
|
||||
v3d->dirty |= VC5_DIRTY_UNCOMPILED_VS;
|
||||
}
|
||||
|
||||
void
|
||||
vc5_program_init(struct pipe_context *pctx)
|
||||
v3d_program_init(struct pipe_context *pctx)
|
||||
{
|
||||
struct vc5_context *vc5 = vc5_context(pctx);
|
||||
struct v3d_context *v3d = v3d_context(pctx);
|
||||
|
||||
pctx->create_vs_state = vc5_shader_state_create;
|
||||
pctx->delete_vs_state = vc5_shader_state_delete;
|
||||
pctx->create_vs_state = v3d_shader_state_create;
|
||||
pctx->delete_vs_state = v3d_shader_state_delete;
|
||||
|
||||
pctx->create_fs_state = vc5_shader_state_create;
|
||||
pctx->delete_fs_state = vc5_shader_state_delete;
|
||||
pctx->create_fs_state = v3d_shader_state_create;
|
||||
pctx->delete_fs_state = v3d_shader_state_delete;
|
||||
|
||||
pctx->bind_fs_state = vc5_fp_state_bind;
|
||||
pctx->bind_vs_state = vc5_vp_state_bind;
|
||||
pctx->bind_fs_state = v3d_fp_state_bind;
|
||||
pctx->bind_vs_state = v3d_vp_state_bind;
|
||||
|
||||
vc5->fs_cache = _mesa_hash_table_create(pctx, fs_cache_hash,
|
||||
v3d->fs_cache = _mesa_hash_table_create(pctx, fs_cache_hash,
|
||||
fs_cache_compare);
|
||||
vc5->vs_cache = _mesa_hash_table_create(pctx, vs_cache_hash,
|
||||
v3d->vs_cache = _mesa_hash_table_create(pctx, vs_cache_hash,
|
||||
vs_cache_compare);
|
||||
}
|
||||
|
||||
void
|
||||
vc5_program_fini(struct pipe_context *pctx)
|
||||
v3d_program_fini(struct pipe_context *pctx)
|
||||
{
|
||||
struct vc5_context *vc5 = vc5_context(pctx);
|
||||
struct v3d_context *v3d = v3d_context(pctx);
|
||||
|
||||
struct hash_entry *entry;
|
||||
hash_table_foreach(vc5->fs_cache, entry) {
|
||||
struct vc5_compiled_shader *shader = entry->data;
|
||||
vc5_bo_unreference(&shader->bo);
|
||||
hash_table_foreach(v3d->fs_cache, entry) {
|
||||
struct v3d_compiled_shader *shader = entry->data;
|
||||
v3d_bo_unreference(&shader->bo);
|
||||
ralloc_free(shader);
|
||||
_mesa_hash_table_remove(vc5->fs_cache, entry);
|
||||
_mesa_hash_table_remove(v3d->fs_cache, entry);
|
||||
}
|
||||
|
||||
hash_table_foreach(vc5->vs_cache, entry) {
|
||||
struct vc5_compiled_shader *shader = entry->data;
|
||||
vc5_bo_unreference(&shader->bo);
|
||||
hash_table_foreach(v3d->vs_cache, entry) {
|
||||
struct v3d_compiled_shader *shader = entry->data;
|
||||
v3d_bo_unreference(&shader->bo);
|
||||
ralloc_free(shader);
|
||||
_mesa_hash_table_remove(vc5->vs_cache, entry);
|
||||
_mesa_hash_table_remove(v3d->vs_cache, entry);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user