Ejemplo n.º 1
0
static inline void  fail_if_bad_command(config *cfg, char *cmd) {
    if (strlen(cmd) == 1) {
        switch (cmd[0]) {
            case 'c':
                cfg->op = stream_encrypt;
                cfg->block_op = stream_encrypt_dispatch;
                return;
            case 'd':
                cfg->op = stream_decrypt;
                cfg->block_op = stream_decrypt_dispatch;
                return;
        }
    }
    fail_with_usage();
}
Ejemplo n.º 2
0
void
piglit_init(int argc, char **argv)
{
	int i;
	for (i = 1; i < argc; i++) {
		char *opt = argv[i];
		if (!strcmp(opt, "vs")) stage = VS;
		else if (!strcmp(opt, "fs")) stage = FS;
		else if (!strcmp(opt, "offset")) use_offset = true;
		else if (!strcmp(opt, "nonconst")) use_nonconst = true;
		else if (!strcmp(opt, "offsets")) use_offsets = true;
		else if (!strcmp(opt, "r")) components = 1;
		else if (!strcmp(opt, "rg")) components = 2;
		else if (!strcmp(opt, "rgb")) components = 3;
		else if (!strcmp(opt, "rgba")) components = 4;
		else if (!strcmp(opt, "red")) swizzle = 0;
		else if (!strcmp(opt, "green")) swizzle = 1;
		else if (!strcmp(opt, "blue")) swizzle = 2;
		else if (!strcmp(opt, "alpha")) swizzle = 3;
		else if (!strcmp(opt, "zero")) swizzle = 4;
		else if (!strcmp(opt, "one")) swizzle = 5;
		else if (!strcmp(opt, "unorm")) comptype = UNORM_T;
		else if (!strcmp(opt, "float")) comptype = FLOAT_T;
		else if (!strcmp(opt, "int")) comptype = INT_T;
		else if (!strcmp(opt, "uint")) comptype = UINT_T;
		else if (!strcmp(opt, "shadow")) comptype = SHADOW_T;
		else if (!strcmp(opt, "2D")) sampler = SAMPLER_2D;
		else if (!strcmp(opt, "2DArray")) sampler = SAMPLER_2DARRAY;
		else if (!strcmp(opt, "Cube")) sampler = SAMPLER_CUBE;
		else if (!strcmp(opt, "CubeArray")) sampler = SAMPLER_CUBEARRAY;
		else if (!strcmp(opt, "2DRect")) sampler = SAMPLER_2DRECT;
		else if (!strcmp(opt, "0")) comp_select = 0;
		else if (!strcmp(opt, "1")) comp_select = 1;
		else if (!strcmp(opt, "2")) comp_select = 2;
		else if (!strcmp(opt, "3")) comp_select = 3;
		else if (!strcmp(opt, "repeat")) address_mode = GL_REPEAT;
		else if (!strcmp(opt, "clamp")) address_mode = GL_CLAMP_TO_EDGE;
	}

	if (stage == NOSTAGE) fail_with_usage();
	if (components == 0) fail_with_usage();

	if (use_nonconst) use_offset = true;

	do_requires();
	do_texture_setup();

	if (!piglit_check_gl_error(GL_NO_ERROR)) {
		printf("Error in texture setup\n");
		piglit_report_result(PIGLIT_FAIL);
	}

	do_shader_setup();

	if (!piglit_check_gl_error(GL_NO_ERROR)) {
		printf("Error in shader setup\n");
		piglit_report_result(PIGLIT_FAIL);
	}

	do_geometry_setup();

	if (!piglit_check_gl_error(GL_NO_ERROR)) {
		printf("Error in geometry setup\n");
		piglit_report_result(PIGLIT_FAIL);
	}
}
Ejemplo n.º 3
0
static inline void  fail_if_bad_usage(int argc) {
    if (argc == 3)
        return;
    fail_with_usage();
}