예제 #1
0
파일: kdb_db2.c 프로젝트: DirectXMan12/krb5
krb5_error_code
krb5_db2_fini(krb5_context context)
{
    if (context->dal_handle->db_context != NULL) {
        ctx_fini(context->dal_handle->db_context);
        context->dal_handle->db_context = NULL;
    }
    return 0;
}
예제 #2
0
파일: drv_api.c 프로젝트: dborca/sage
void
sage_shut (sageContext *ctx)
{
    if (hardware < 0) {
	return;
    }
    if (ctx == NULL) {
	return;
    }

    sage_bind(NULL, NULL, 0, 0);

    free(vb);
    ctx_fini();
    free(ctx);
}
예제 #3
0
파일: drv_api.c 프로젝트: dborca/sage
sageContext *
sage_open (int db_flag,
	   int red_size, int green_size, int blue_size,
	   int alpha_size, int depth_size, int stencil_size)
{
    sageContext *ctx;

    if (hardware < 0) {
	goto exit_error;
    }

    /* Create context */
    ctx = malloc(sizeof(sageContext));
    if (ctx == NULL) {
	goto exit_error;
    }

    /* Initialize the core */
    if (ctx_init(db_flag,
		 red_size, green_size, blue_size,
		 alpha_size, depth_size, stencil_size) != 0) {
	goto exit_error1;
    }

    /* Finish driver setup */
    vb = malloc((tnl_vb.max + TNL_CLIPPED_VERTS) * sizeof(SWvertex));
    if (vb == NULL) {
	goto exit_error3;
    }

    drv_multipass = drv_multipass_none;

    return ctx;

  exit_error3:
    ctx_fini();
  exit_error1:
    free(ctx);
  exit_error:
    return NULL;
}
예제 #4
0
파일: drv_api.c 프로젝트: dborca/sage
sageContext *
sage_open (int db_flag,
	   int red_size, int green_size, int blue_size,
	   int alpha_size, int depth_size, int stencil_size)
{
    const char *str;
    sageContext *ctx;

    if (hardware < 0) {
	goto exit_error;
    }

    /* Create context */
    ctx = malloc(sizeof(sageContext));
    if (ctx == NULL) {
	goto exit_error;
    }
    ctx->gr_ctx = 0;

    /* Choose a visual */
    ctx->fmt = findPixelFormat(&red_size, &green_size, &blue_size,
			       &alpha_size, &depth_size, &stencil_size);
    fb_color = red_size + green_size + blue_size;
    fb_alpha = alpha_size;

    /* Initialize the core */
    if (ctx_init(db_flag,
		 red_size, green_size, blue_size,
		 alpha_size, depth_size, stencil_size) != 0) {
	goto exit_error1;
    }

    /* Set driver capabilities */
    allow_texuma      = hwext_texuma && !YES("3dfx.disable.texuma");
    allow_texmirror   = hwext_texmirror && !YES("3dfx.disable.texmirror");
    allow_fogcoord    = hwext_fogcoord && !YES("3dfx.disable.fogcoord");
    allow_32bpt       = (fb_color == 24 && hwext_texfmt) && !YES("3dfx.disable.32bpt");
    allow_blendsquare = (hardware >= GR_SSTTYPE_Voodoo4) && !YES("3dfx.disable.blendsquare");
    allow_combine     = GL_TRUE && !YES("3dfx.disable.combine");
    allow_multitex    = (getInteger(GR_NUM_TMU) > 1) && !YES("3dfx.disable.multitex");

    allow_compressed = atoi(cfg_get("3dfx.texture.compression", "3"));
    if (hardware < GR_SSTTYPE_Voodoo4) {
	allow_compressed &= ~2;
    }
    if (!ctx_texcodec) {
	allow_compressed &= ~1;
    }

    if (hardware < GR_SSTTYPE_Voodoo4) {
	allow_combine = -allow_combine;
    }

    /* Update core with driver capabilities */
    ctx_const_max_texture_size = getInteger(GR_MAX_TEXTURE_SIZE);
    ctx_const_max_texture_units = allow_multitex ? 2 : 1;

    max_texture_levels = 0;
    while ((GLuint)(1 << max_texture_levels) < ctx_const_max_texture_size) {
	max_texture_levels++;
    }
    ctx_const_max_lod_bias = max_texture_levels;

    str = cfg_get("3dfx.maxlod", NULL);
    if (str != NULL) {
	ctx_const_max_texture_size = 1 << atoi(str);
    }

    /* Finish driver setup */
    tex_bound_mask = (hardware < GR_SSTTYPE_Banshee) ? 0x1fffff : -1U;

    if (tm_init() != 0) {
	goto exit_error2;
    }

    if (vb_init() != 0) {
	goto exit_error3;
    }

    fogtable = malloc(getInteger(GR_FOG_TABLE_ENTRIES) * sizeof(GrFog_t));
    if (fogtable == NULL) {
	goto exit_error4;
    }

    /* XXX getInteger(GR_GLIDE_STATE_SIZE) */

    drv_multipass = drv_multipass_none;
    init_tri_pointers();

    /* Finish core setup */
    ext_set("GL_EXT_texture_env_add", GL_TRUE);
    ext_set("GL_EXT_texture_edge_clamp", GL_TRUE);
    ext_set("GL_EXT_compiled_vertex_array", GL_TRUE);
    ext_set("GL_EXT_blend_func_separate", GL_TRUE);
    ext_set("GL_EXT_texture_lod_bias", GL_TRUE);
    if (allow_multitex) {
	ext_set("GL_ARB_multitexture", GL_TRUE);
    }
    if (allow_fogcoord) {
	ext_set("GL_EXT_fog_coord", GL_TRUE);
    }
    if (allow_texmirror) {
	ext_set("GL_ARB_texture_mirrored_repeat", GL_TRUE);
    }
    if (stencil_size) {
	ext_set("GL_EXT_stencil_wrap", GL_TRUE);
    }
    if (allow_blendsquare) {
	ext_set("GL_NV_blend_square", GL_TRUE);
    }
    if (allow_combine) {
	ext_set("GL_ARB_texture_env_combine", GL_TRUE);
	ext_set("GL_EXT_texture_env_combine", GL_TRUE);
    }
    if (allow_compressed) {
	ext_set("GL_ARB_texture_compression", GL_TRUE);
	ext_set("GL_EXT_texture_compression_s3tc", GL_TRUE);
	ext_set("GL_3DFX_texture_compression_FXT1", GL_TRUE);
	ext_set("GL_S3_s3tc", GL_TRUE);
    }
    /* XXX not really */
    ext_set("GL_EXT_separate_specular_color", GL_TRUE);
    ext_set("GL_EXT_secondary_color", GL_TRUE);

    return ctx;

  exit_error4:
    free_a(vb);
  exit_error3:
    tm_fini();
  exit_error2:
    ctx_fini();
  exit_error1:
    free(ctx);
  exit_error:
    return NULL;
}
예제 #5
0
파일: kdb_db2.c 프로젝트: DirectXMan12/krb5
krb5_error_code
krb5_db2_promote_db(krb5_context context, char *conf_section, char **db_args)
{
    krb5_error_code retval;
    krb5_boolean merge_nra = FALSE, real_locked = FALSE;
    krb5_db2_context *dbc_temp, *dbc_real = NULL;
    char **db_argp;

    /* context must be initialized with an exclusively locked temp DB. */
    if (!inited(context))
        return KRB5_KDB_DBNOTINITED;
    dbc_temp = context->dal_handle->db_context;
    if (dbc_temp->db_lock_mode != KRB5_LOCKMODE_EXCLUSIVE)
        return KRB5_KDB_NOTLOCKED;
    if (!dbc_temp->tempdb)
        return EINVAL;

    /* Check db_args for whether we should merge non-replicated attributes. */
    for (db_argp = db_args; *db_argp; db_argp++) {
        if (!strcmp(*db_argp, "merge_nra")) {
            merge_nra = TRUE;
            break;
        }
    }

    /* Make a db2 context for the real DB. */
    dbc_real = k5alloc(sizeof(*dbc_real), &retval);
    if (dbc_real == NULL)
        return retval;
    ctx_clear(dbc_real);

    /* Try creating the real DB. */
    dbc_real->db_name = strdup(dbc_temp->db_name);
    if (dbc_real->db_name == NULL)
        goto cleanup;
    dbc_real->tempdb = FALSE;
    retval = ctx_create_db(context, dbc_real);
    if (retval == EEXIST) {
        /* The real database already exists, so open and lock it. */
        dbc_real->db_name = strdup(dbc_temp->db_name);
        if (dbc_real->db_name == NULL)
            goto cleanup;
        dbc_real->tempdb = FALSE;
        retval = ctx_init(dbc_real);
        if (retval)
            goto cleanup;
        retval = ctx_lock(context, dbc_real, KRB5_DB_LOCKMODE_EXCLUSIVE);
        if (retval)
            goto cleanup;
    } else if (retval)
        goto cleanup;
    real_locked = TRUE;

    if (merge_nra) {
        retval = ctx_merge_nra(context, dbc_temp, dbc_real);
        if (retval)
            goto cleanup;
    }

    /* Perform filesystem manipulations for the promotion. */
    retval = ctx_promote(context, dbc_temp, dbc_real);
    if (retval)
        goto cleanup;

    /* Unlock and finalize context since the temp DB is gone. */
    (void) krb5_db2_unlock(context);
    krb5_db2_fini(context);

cleanup:
    if (real_locked)
        (void) ctx_unlock(context, dbc_real);
    if (dbc_real)
        ctx_fini(dbc_real);
    return retval;
}