void piglit_init(int argc, char **argv) { unsigned i; (void) argc; (void) argv; piglit_require_vertex_program(); piglit_require_fragment_program(); piglit_require_extension("GL_NV_vertex_program2_option"); piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE); for (i = 0; i < ARRAY_SIZE(progs); i++) { char shader_source[1024]; snprintf(shader_source, sizeof(shader_source), vertex_source_template); progs[i] = piglit_compile_program(GL_VERTEX_PROGRAM_ARB, shader_source); } glEnable(GL_FRAGMENT_PROGRAM_ARB); glEnable(GL_VERTEX_PROGRAM_ARB); frag_prog = piglit_compile_program(GL_FRAGMENT_PROGRAM_ARB, fragment_source); glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, frag_prog); glClearColor(clear_color[0], clear_color[1], clear_color[2], clear_color[3]); }
void piglit_init(int argc, char **argv) { static const char components[] = "xyzw"; unsigned i; (void) argc; (void) argv; piglit_require_vertex_program(); piglit_require_fragment_program(); piglit_require_extension("GL_NV_vertex_program2_option"); piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE); for (i = 0; i < ARRAY_SIZE(progs); i++) { char shader_source[1024]; snprintf(shader_source, sizeof(shader_source), vertex_source_template, components[i + 0], components[i + 2]); progs[i] = piglit_compile_program(GL_VERTEX_PROGRAM_ARB, shader_source); } glEnable(GL_FRAGMENT_PROGRAM_ARB); glEnable(GL_VERTEX_PROGRAM_ARB); glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, piglit_ARBfp_pass_through); glClearColor(0.5, 0.5, 0.5, 1.0); }
void piglit_init(int argc, char **argv) { (void) argc; (void) argv; piglit_require_vertex_program(); piglit_require_fragment_program(); piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE); progs[0] = piglit_compile_program(GL_FRAGMENT_PROGRAM_ARB, cos_shader_source); progs[1] = piglit_compile_program(GL_FRAGMENT_PROGRAM_ARB, sge_shader_source); vert_prog = piglit_compile_program(GL_VERTEX_PROGRAM_ARB, vert_shader_source); glClearColor(0.5, 0.5, 0.5, 1.0); }
void piglit_init(int argc, char **argv) { piglit_automatic = GL_TRUE; piglit_require_vertex_program(); }
void piglit_init(int argc, char **argv) { unsigned r; unsigned c; unsigned i; (void) argc; (void) argv; piglit_require_vertex_program(); piglit_require_fragment_program(); piglit_require_extension("GL_NV_fragment_program_option"); piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE); vert_prog = piglit_compile_program(GL_VERTEX_PROGRAM_ARB, vert_shader_source); frag_prog = piglit_compile_program(GL_FRAGMENT_PROGRAM_ARB, frag_shader_source); glClearColor(0.5, 0.5, 0.5, 1.0); i = 0; for (r = 0; r < TEST_ROWS; r++) { for (c = 0; c < TEST_COLS; c++) { position[i + 0] = (float)((BOX_SIZE / 2) + c * (BOX_SIZE + 1) + 1); position[i + 1] = (float)((BOX_SIZE / 2) + r * (BOX_SIZE + 1) + 1); position[i + 2] = 0.0f; position[i + 3] = 1.0f; i += 4; } } /* Generate a bunch of random direction vectors. Based on the random * direction vector, generate an axis such that the reflection of the * random vector across the axis is { 0, 1, 0 }. */ srand(time(NULL)); for (i = 0; i < (ARRAY_SIZE(direction) / 4); i++) { const double d[3] = { random_float(), random_float(), random_float() }; const double inv_mag_d = 1.0 / sqrt((d[0] * d[0]) + (d[1] * d[1]) + (d[2] * d[2])); double a[3]; double mag_a; direction[(i * 4) + 0] = d[0] * inv_mag_d; direction[(i * 4) + 1] = d[1] * inv_mag_d; direction[(i * 4) + 2] = d[2] * inv_mag_d; direction[(i * 4) + 3] = 0.0; a[0] = direction[(i * 4) + 0] + 0.0; a[1] = direction[(i * 4) + 1] + 1.0; a[2] = direction[(i * 4) + 2] + 0.0; mag_a = sqrt((a[0] * a[0]) + (a[1] * a[1]) + (a[2] * a[2])); axis[(i * 4) + 0] = a[0] / mag_a; axis[(i * 4) + 1] = a[1] / mag_a; axis[(i * 4) + 2] = a[2] / mag_a; axis[(i * 4) + 3] = 0.0; } }
void piglit_init(int argc, char **argv) { GLint max_parameters; GLint max_native_parameters; GLint max_local_parameters; GLint max_env_parameters; char *shader_source; bool pass = true; size_t len; int offset; unsigned i; (void) argc; (void) argv; piglit_require_vertex_program(); /* First, query all of the limits. */ pass = query_and_require_limit(GL_MAX_PROGRAM_PARAMETERS_ARB, & max_parameters, "GL_MAX_PROGRAM_PARAMETERS_ARB", 96) && pass; pass = query_and_require_limit(GL_MAX_PROGRAM_NATIVE_PARAMETERS_ARB, & max_native_parameters, "GL_MAX_PROGRAM_NATIVE_PARAMETERS_ARB", 96) && pass; pass = query_and_require_limit(GL_MAX_PROGRAM_LOCAL_PARAMETERS_ARB, & max_local_parameters, "GL_MAX_PROGRAM_LOCAL_PARAMETERS_ARB", 96) && pass; pass = query_and_require_limit(GL_MAX_PROGRAM_ENV_PARAMETERS_ARB, & max_env_parameters, "GL_MAX_PROGRAM_ENV_PARAMETERS_ARB", 96) && pass; if (!pass) { piglit_report_result(PIGLIT_FAIL); } /* Allocate a buffer big enough to hold any program that this test * might generate. */ len = sizeof(template_header) + sizeof(template_footer) + sizeof(max_native_template_footer) + (80 * max_parameters) + 1; shader_source = malloc(len); if (shader_source == NULL) piglit_report_result(PIGLIT_FAIL); /* Generate a program that uses the full parameter space using an * array of constants. Since only one parameter is statically used, * this exercises GL_MAX_PROGRAM_PARAMETERS_ARB and *not* * GL_MAX_PROGRAM_NATIVE_PARAMETERS_ARB. */ offset = snprintf(shader_source, len, template_header, max_parameters); for (i = 0; i < max_parameters; i++) { int comma = (i < (max_parameters - 1)) ? ',' : ' '; int used = snprintf(& shader_source[offset], len - offset, "\t\t{ %.1f, %.1f, %.1f, %.1f }%c\n", (float) i, (float) i + 0.2, (float) i + 0.4, (float) i + 0.6, comma); offset += used; } memcpy(& shader_source[offset], template_footer, sizeof(template_footer)); (void) piglit_compile_program(GL_VERTEX_PROGRAM_ARB, shader_source); /* Generate a program that uses the full native parameter space using * an array of constants. The array is accessed indirectly, so the * assembler cannot know which elements may be used. As a result, it * has to upload all of them. This exercises * GL_MAX_PROGRAM_NATIVE_PARAMETERS_ARB. */ offset = snprintf(shader_source, len, template_header, max_native_parameters); for (i = 0; i < max_native_parameters; i++) { int comma = (i < (max_native_parameters - 1)) ? ',' : ' '; int used = snprintf(& shader_source[offset], len - offset, "\t\t{ %.1f, %.1f, %.1f, %.1f }%c\n", (float) i, (float) i + 0.2, (float) i + 0.4, (float) i + 0.6, comma); offset += used; } memcpy(& shader_source[offset], max_native_template_footer, sizeof(max_native_template_footer)); (void) piglit_compile_program(GL_VERTEX_PROGRAM_ARB, shader_source); /* Generate a program that uses as much of the local parameter space * as possible. This basically tries to hit both ends of the * program.local array without making assumptions about the relative * amount of parameter space. We only assume that the * minimum-maximums of 96 are respected by the GL implementation. */ snprintf(shader_source, len, max_local_template, "local", "local", max_local_parameters - 47, max_local_parameters - 1); (void) piglit_compile_program(GL_VERTEX_PROGRAM_ARB, shader_source); /* Generate a program that uses as much of the env parameter space * as possible. This basically tries to hit both ends of the * program.env array without making assumptions about the relative * amount of parameter space. We only assume that the * minimum-maximums of 96 are respected by the GL implementation. */ snprintf(shader_source, len, max_local_template, "env", "env", max_env_parameters - 47, max_env_parameters - 1); (void) piglit_compile_program(GL_VERTEX_PROGRAM_ARB, shader_source); }
void piglit_init(int argc, char **argv) { GLint max_address_registers; unsigned i; (void) argc; (void) argv; piglit_require_vertex_program(); piglit_require_fragment_program(); piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE); glGetProgramivARB(GL_VERTEX_PROGRAM_ARB, GL_MAX_PROGRAM_ADDRESS_REGISTERS_ARB, & max_address_registers); if (max_address_registers == 0) { /* we have to have at least one address register */ if (! piglit_automatic) printf("GL_MAX_PROGRAM_ADDRESS_REGISTERS_ARB == 0\n"); piglit_report_result(PIGLIT_FAIL); } else if (max_address_registers == 1) { if (piglit_is_extension_supported("GL_NV_vertex_program2_option")) { /* this extension requires two address regs */ if (! piglit_automatic) printf("GL_MAX_PROGRAM_ADDRESS_REGISTERS_ARB " "== 1\n"); piglit_report_result(PIGLIT_FAIL); } else { piglit_report_result(PIGLIT_SKIP); } } for (i = 0; i < ARRAY_SIZE(progs); i++) { char shader_source[1024]; int offset[2]; char direction[2]; /* We want the constant offset in the instruction plus the * value read from the attribute to be 1. */ offset[0] = 1 - (int) attrib[(2 * i) + 0]; offset[1] = 1 - (int) attrib[(2 * i) + 1]; if (offset[0] < 0) { direction[0] = '-'; offset[0] = -offset[0]; } else { direction[0] = '+'; } if (offset[1] < 0) { direction[1] = '-'; offset[1] = -offset[1]; } else { direction[1] = '+'; } snprintf(shader_source, sizeof(shader_source), vertex_source_template, direction[0], offset[0], direction[1], offset[1]); progs[i] = piglit_compile_program(GL_VERTEX_PROGRAM_ARB, shader_source); } glEnable(GL_FRAGMENT_PROGRAM_ARB); glEnable(GL_VERTEX_PROGRAM_ARB); glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, piglit_ARBfp_pass_through); glClearColor(0.5, 0.5, 0.5, 1.0); }