void GLAPIENTRY _mesa_VDPAUInitNV(const GLvoid *vdpDevice, const GLvoid *getProcAddress) { GET_CURRENT_CONTEXT(ctx); if (!vdpDevice) { _mesa_error(ctx, GL_INVALID_VALUE, "vdpDevice"); return; } if (!getProcAddress) { _mesa_error(ctx, GL_INVALID_VALUE, "getProcAddress"); return; } if (ctx->vdpDevice || ctx->vdpGetProcAddress || ctx->vdpSurfaces) { _mesa_error(ctx, GL_INVALID_OPERATION, "VDPAUInitNV"); return; } ctx->vdpDevice = vdpDevice; ctx->vdpGetProcAddress = getProcAddress; ctx->vdpSurfaces = _mesa_set_create(NULL, _mesa_hash_pointer, _mesa_key_pointer_equal); }
static void validate_ssa_def(nir_ssa_def *def, validate_state *state) { assert(def->index < state->impl->ssa_alloc); assert(!BITSET_TEST(state->ssa_defs_found, def->index)); BITSET_SET(state->ssa_defs_found, def->index); assert(def->parent_instr == state->instr); assert(def->num_components <= 4); list_validate(&def->uses); list_validate(&def->if_uses); ssa_def_validate_state *def_state = ralloc(state->ssa_defs, ssa_def_validate_state); def_state->where_defined = state->impl; def_state->uses = _mesa_set_create(def_state, _mesa_hash_pointer, _mesa_key_pointer_equal); def_state->if_uses = _mesa_set_create(def_state, _mesa_hash_pointer, _mesa_key_pointer_equal); _mesa_hash_table_insert(state->ssa_defs, def, def_state); }
static void register_store_instr(nir_intrinsic_instr *store_instr, struct lower_variables_state *state) { struct deref_node *node = get_deref_node(store_instr->variables[0], state); if (node == NULL) return; if (node->stores == NULL) node->stores = _mesa_set_create(state->dead_ctx, _mesa_hash_pointer, _mesa_key_pointer_equal); _mesa_set_add(node->stores, store_instr); }
/* Identical to nir_assign_var_locations_packed except that it assigns * locations to the variables that are used 100% directly first and then * assigns locations to variables that are used indirectly. */ void nir_assign_var_locations_scalar_direct_first(nir_shader *shader, struct exec_list *var_list, unsigned *direct_size, unsigned *size) { struct set *indirect_set = _mesa_set_create(NULL, _mesa_hash_pointer, _mesa_key_pointer_equal); nir_foreach_overload(shader, overload) { if (overload->impl) nir_foreach_block(overload->impl, mark_indirect_uses_block, indirect_set); } unsigned location = 0; foreach_list_typed(nir_variable, var, node, var_list) { if (var->data.mode == nir_var_uniform && var->interface_type != NULL) continue; if (_mesa_set_search(indirect_set, var)) continue; var->data.driver_location = location; location += type_size(var->type); } *direct_size = location; foreach_list_typed(nir_variable, var, node, var_list) { if (var->data.mode == nir_var_uniform && var->interface_type != NULL) continue; if (!_mesa_set_search(indirect_set, var)) continue; var->data.driver_location = location; location += type_size(var->type); } *size = location; _mesa_set_destroy(indirect_set, NULL); }
static void register_copy_instr(nir_intrinsic_instr *copy_instr, struct lower_variables_state *state) { for (unsigned idx = 0; idx < 2; idx++) { struct deref_node *node = get_deref_node(copy_instr->variables[idx], state); if (node == NULL) continue; if (node->copies == NULL) node->copies = _mesa_set_create(state->dead_ctx, _mesa_hash_pointer, _mesa_key_pointer_equal); _mesa_set_add(node->copies, copy_instr); } }
void nir_build_program_resource_list(struct gl_context *ctx, struct gl_shader_program *prog) { /* Rebuild resource list. */ if (prog->data->ProgramResourceList) { ralloc_free(prog->data->ProgramResourceList); prog->data->ProgramResourceList = NULL; prog->data->NumProgramResourceList = 0; } struct set *resource_set = _mesa_set_create(NULL, _mesa_hash_pointer, _mesa_key_pointer_equal); /* Add uniforms * * Here, it is expected that nir_link_uniforms() has already been * called, so that UniformStorage table is already available. */ for (unsigned i = 0; i < prog->data->NumUniformStorage; i++) { struct gl_uniform_storage *uniform = &prog->data->UniformStorage[i]; /* Do not add uniforms internally used by Mesa. */ if (uniform->hidden) continue; if (!link_util_add_program_resource(prog, resource_set, GL_UNIFORM, uniform, uniform->active_shader_mask)) { return; } } _mesa_set_destroy(resource_set, NULL); }
dead_variable_visitor() { variables = _mesa_set_create(NULL, _mesa_hash_pointer, _mesa_key_pointer_equal); }