• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ piglit_build_simple_program函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中piglit_build_simple_program函数的典型用法代码示例。如果您正苦于以下问题:C++ piglit_build_simple_program函数的具体用法?C++ piglit_build_simple_program怎么用?C++ piglit_build_simple_program使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了piglit_build_simple_program函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: piglit_init

void
piglit_init(int argc, char **argv)
{
	piglit_require_extension("GL_EXT_texture_norm16");

	prog = piglit_build_simple_program(vs_source, fs_source);

	if (piglit_is_extension_supported("GL_OES_texture_buffer"))
		buf_prog = piglit_build_simple_program(vs_source,
						       fs_buf_source);
}
开发者ID:dumbbell,项目名称:piglit,代码行数:11,代码来源:render.c


示例2: piglit_init

void
piglit_init(int argc, char **argv)
{
	GLuint prog = piglit_build_simple_program(
		"#version 140\n"
		"const vec2 verts[4] = vec2[](\n"
		"	vec2(-1, 1),\n"
		"	vec2(-1,-1),\n"
		"	vec2( 1,-1),\n"
		"	vec2( 1, 1)\n"
		");\n"
		"void main() {\n"
		"	gl_Position = vec4(verts[gl_VertexID], 0, 1);\n"
		"}\n",

		"#version 140\n"
		"void main() {\n"
		"	gl_FragColor = vec4(1,0,0,1);\n"
		"}\n");

	GLuint vao;

	glUseProgram(prog);

	glGenVertexArrays(1, &vao);
	glBindVertexArray(vao);
}
开发者ID:ThirteenFish,项目名称:piglit,代码行数:27,代码来源:attributeless-vertexid.c


示例3: piglit_init

void
piglit_init(int argc, char **argv)
{
   GLuint Texture;

   piglit_require_extension("GL_ARB_texture_float");
   piglit_require_extension("GL_ARB_fragment_shader");

   HaveRG = piglit_is_extension_supported("GL_ARB_texture_rg");

   Program = piglit_build_simple_program(NULL, FragShaderText);

   glUseProgram(Program);

   BiasUniform = glGetUniformLocation(Program, "bias");
   ScaleUniform = glGetUniformLocation(Program, "scale");
   TexUniform = glGetUniformLocation(Program, "tex");

   glUniform1f(BiasUniform, Bias);
   glUniform1f(ScaleUniform, Scale);
   glUniform1i(TexUniform, 0);  /* tex unit zero */

   (void) check_error(__FILE__, __LINE__);

   glGenTextures(1, &Texture);
   glBindTexture(GL_TEXTURE_2D, Texture);
   glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
   glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);

   piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);
}
开发者ID:chemecse,项目名称:piglit,代码行数:31,代码来源:texture-float-formats.c


示例4: piglit_init

void
piglit_init(int argc, char **argv)
{
    GLuint buf;
    GLint vertex;

    piglit_require_gl_version(20);

    prog = piglit_build_simple_program(vs, fs);
    if (!prog) {
        printf("Failed to compile/link program\n");
        piglit_report_result(PIGLIT_FAIL);
    }

    glUseProgram(prog);

    attr = glGetAttribLocation(prog, "attr");
    vertex = glGetAttribLocation(prog, "vertex");

    glGenBuffers(1, &buf);
    glBindBuffer(GL_ARRAY_BUFFER, buf);
    glBufferData(GL_ARRAY_BUFFER, sizeof(verts), verts, GL_STATIC_DRAW);
    glVertexAttribPointer(vertex,
                          2, GL_FLOAT, GL_FALSE, 0, 0);

    glEnableVertexAttribArray(vertex);
}
开发者ID:krnowak,项目名称:piglit,代码行数:27,代码来源:vertex-const-attr.c


示例5: piglit_init

void
piglit_init(int argc, char **argv)
{
    piglit_require_GLSL();
    piglit_require_extension("GL_ARB_instanced_arrays");

    Program = piglit_build_simple_program(VertShaderText, FragShaderText);

    glUseProgram(Program);

    PosAttrib = glGetAttribLocation(Program, "Pos");
    ColorAttrib = glGetAttribLocation(Program, "Color");

    glMatrixMode(GL_PROJECTION);
    glLoadIdentity();
    glFrustum(-5, 5, -5, 5, 10, 20);

    glMatrixMode(GL_MODELVIEW);
    glLoadIdentity();
    glTranslatef(0, 0, -11.0);
    glScalef(0.5, 0.5, 1.0);

    if ((argc >= 2) && (strcmp(argv[1], "vbo") == 0)) {
        use_vbo = GL_TRUE;
    }
}
开发者ID:kphillisjr,项目名称:piglit,代码行数:26,代码来源:instanced_arrays.c


示例6: piglit_init

void
piglit_init(int argc, char **argv)
{
	enum piglit_result result;
	GLuint render_program;
	int i;
	float green[4] = { 0.0, 1.0, 0.0, 1.0 };

	cs_ids_common_init();
	cs_ids_set_local_id_test();
	cs_ids_set_local_size(4, 4, 4);
	cs_ids_set_global_size(4, 4, 4);

	render_program =
		piglit_build_simple_program(passthrough_vs_src,
					    green_fs_src);
	glClearColor(0.0, 0.0, 0.0, 0.0);

	for (i = 0; i < 2; i++) {
		result = cs_ids_run_test();
		if (result != PIGLIT_PASS)
			piglit_report_result(result);

		glUseProgram(render_program);
		glClear(GL_COLOR_BUFFER_BIT);
		piglit_draw_rect(-1, -1, 2, 2);
		result = piglit_probe_rect_rgba(0, 0, piglit_width,
						piglit_height, green)
			? PIGLIT_PASS : PIGLIT_FAIL;
	}

	cs_ids_common_destroy();

	piglit_report_result(result);
}
开发者ID:BNieuwenhuizen,项目名称:piglit,代码行数:35,代码来源:render-and-compute.c


示例7: create_program

static void
create_program(struct program *program, const char *type)
{
	char *fs_source, *vs_source;
	GLuint prog;
	char *threshold;

	if (strcmp(type, "") == 0)
		threshold = "vec4(0.02)";
	else
		threshold = "ivec4(1)";

	if (test_vs) {
		asprintf(&vs_source, vs_vert_source, type, type, type, type,
			 threshold);
		fs_source = fs_vert_source;
	} else {
		vs_source = vs_frag_source;
		asprintf(&fs_source, fs_frag_source, type, type, type, type,
			 threshold);
	}

	prog = piglit_build_simple_program(vs_source, fs_source);

	program->prog = prog;
        program->pos_location = glGetUniformLocation(prog, "pos");
        program->expected_location = glGetUniformLocation(prog,
							       "expected");
	vertex_location = glGetAttribLocation(prog, "vertex");
	assert(vertex_location == 0);
}
开发者ID:ThirteenFish,项目名称:piglit,代码行数:31,代码来源:formats.c


示例8: piglit_init

void
piglit_init(int argc, char **argv)
{
	GLuint vertIndex;

#ifdef PIGLIT_USE_OPENGL
	piglit_require_extension("GL_ARB_base_instance");
#else
	piglit_require_extension("GL_EXT_base_instance");
#endif

	prog = piglit_build_simple_program(vstext, fstext);

	glUseProgram(prog);

	glGenBuffers(1, &vertBuff);
	glBindBuffer(GL_ARRAY_BUFFER, vertBuff);
	glBufferData(GL_ARRAY_BUFFER, vertSize, vertices, GL_STATIC_DRAW);

	glGenBuffers(1, &indexBuf);
	glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, indexBuf);
	glBufferData(GL_ELEMENT_ARRAY_BUFFER, indSize,
			indices, GL_STATIC_DRAW);

	glGenVertexArrays(1, &vao);
	glBindVertexArray(vao);

	vertIndex = glGetAttribLocation(prog, "vertex");

	glBindBuffer(GL_ARRAY_BUFFER, vertBuff);
	glEnableVertexAttribArray(vertIndex);
	glVertexAttribPointer(vertIndex, 3, GL_FLOAT, GL_FALSE, 0, 0);
}
开发者ID:chemecse,项目名称:piglit,代码行数:33,代码来源:baseinstance-doesnt-affect-gl-instance-id.c


示例9: make_program

static GLuint
make_program(void)
{
	const char *snippet = sample_function->snippet;
	int glsl_version = sample_function->glsl_version;
	int snippet_length = strlen(snippet);
	int snippet_pos = strstr(fragment_source, "SNIPPET") - fragment_source;
	GLuint program;
	char source[1000], *p = source;

	if (glsl_version > 0) {
		p += sprintf(p, "#version %i\n", glsl_version);
		piglit_require_GLSL_version(glsl_version);
	}

	if (sample_function->extension) {
		p += sprintf(p,
			     "#extension %s : require\n",
			     sample_function->extension);
		piglit_require_extension(sample_function->extension);
	}

	memcpy(p, fragment_source, snippet_pos);
	p += snippet_pos;
	memcpy(p, snippet, snippet_length);
	p += snippet_length;
	memcpy(p,
	       fragment_source + snippet_pos + 7,
	       sizeof fragment_source - snippet_pos - 7);

	program = piglit_build_simple_program(vertex_source, source);

	return program;
}
开发者ID:chemecse,项目名称:piglit,代码行数:34,代码来源:zero-tex-coord.c


示例10: setup_shaders

static void
setup_shaders(void)
{
    static const char *vsSrc =
        "#version 150\n"
        "in vec4 Attr0;"
        "in vec4 Attr1;"
        "smooth out vec4 fs_color0;"
        "void main(void) {"
        "   gl_Position = Attr0;"
        "   fs_color0 = Attr1;"
        "}";
    static const char *fsSrc =
        "#version 150\n"
        "smooth in vec4 fs_color0;"
        "out vec4 fragColor0;"
        "void main(void) {"
        "   vec2 psCoords = gl_PointCoord;"
        "   fragColor0 = fs_color0;"
        "}";

    prog = piglit_build_simple_program(vsSrc, fsSrc);
    glBindFragDataLocation(prog, 0, "fragColor0");
    glLinkProgram(prog);
    glUseProgram(prog);
}
开发者ID:krnowak,项目名称:piglit,代码行数:26,代码来源:pointsprite-coord.c


示例11: piglit_init

void
piglit_init(int argc, char **argv)
{
	int maxloc;
	GLuint prog;
	char *f_sha;

	piglit_require_extension("GL_ARB_explicit_uniform_location");

	glGetIntegerv(GL_MAX_UNIFORM_LOCATIONS, &maxloc);

	if (!piglit_check_gl_error(GL_NO_ERROR))
		piglit_report_result(PIGLIT_FAIL);

	/* test GL_MAX_UNIFORM_LOCATIONS - 1, 0, and a loc in between (1) */
	if (asprintf(&f_sha, fs_template, maxloc - 1, 0, 1) == -1)
		piglit_report_result(PIGLIT_FAIL);

	prog = piglit_build_simple_program(vs_text, f_sha);

	free(f_sha);

	if (glGetUniformLocation(prog, "r") != maxloc - 1)
		piglit_report_result(PIGLIT_FAIL);
	if (glGetUniformLocation(prog, "g") != 0)
		piglit_report_result(PIGLIT_FAIL);
	if (glGetUniformLocation(prog, "b") != 1)
		piglit_report_result(PIGLIT_FAIL);

	glDeleteProgram(prog);
	piglit_report_result(PIGLIT_PASS);
}
开发者ID:ThirteenFish,项目名称:piglit,代码行数:32,代码来源:loc-boundaries.c


示例12: piglit_init

void
piglit_init(int argc, char **argv)
{
	GLuint prog;
	char *vs_text;

	if (strcmp(argv[1], "drawid") == 0) {
		(void)!asprintf(&vs_text, vs_template,
			 "ref.x == gl_DrawIDARB");
	} else if (strcmp(argv[1], "vertexid") == 0) {
		(void)!asprintf(&vs_text, vs_template,
			 "ref.x == gl_DrawIDARB && ref.y == gl_VertexID");
	} else {
                printf("Unknown subtest: %s\n", argv[1]);
		piglit_report_result(PIGLIT_FAIL);
	}

	piglit_require_GLSL_version(130);

	piglit_require_extension("GL_ARB_shader_draw_parameters");
	piglit_require_extension("GL_ARB_base_instance");

	prog = piglit_build_simple_program(vs_text, fs_text);

	glUseProgram(prog);
}
开发者ID:rib,项目名称:piglit,代码行数:26,代码来源:drawid.c


示例13: piglit_init

void
piglit_init(int argc, char **argv)
{
	GLuint prog, i;

	piglit_require_extension("GL_ARB_explicit_attrib_location");
	piglit_require_extension("GL_ARB_explicit_uniform_location");

	prog = piglit_build_simple_program(vs_text, fs_text);

	/* verify that locations are sequential */
	for (i = 0; i < 16; i++) {
		char *element;
		if (asprintf(&element, "a[%d]", i) == -1)
			piglit_report_result(PIGLIT_FAIL);

		if (glGetUniformLocation(prog, element) != 3 + i)
			piglit_report_result(PIGLIT_FAIL);

		free(element);
	}

	glDeleteProgram(prog);
	piglit_report_result(PIGLIT_PASS);
}
开发者ID:BNieuwenhuizen,项目名称:piglit,代码行数:25,代码来源:array-elements.c


示例14: piglit_init

void
piglit_init(int argc, char *argv[])
{
	GLuint prog, array, buf;

	glGenVertexArrays(1, &array);
	glBindVertexArray(array);
	glGenBuffers(1, &buf);
	glBindBuffer(GL_ARRAY_BUFFER, buf);

	prog = piglit_build_simple_program(vs_src, fs_src);

	glVertexAttribPointer(0, /* index */
			      4, /* size */
			      GL_FLOAT, /* type */
			      GL_FALSE, /* normalized */
			      0, /* stride */
			      NULL /* pointer */);
	glEnableVertexAttribArray(0);

#ifndef DISPLAY
	glEnable(GL_RASTERIZER_DISCARD);
#endif

	do_query_init(queries, ARRAY_SIZE(queries));

	if (!piglit_link_check_status(prog)) {
		glDeleteProgram(prog);
		piglit_report_result(PIGLIT_FAIL);
	}

	glUseProgram(prog);
}
开发者ID:chemecse,项目名称:piglit,代码行数:33,代码来源:pipeline_stats_vert_adj.c


示例15: piglit_init

void
piglit_init(int argc, char **argv)
{
	char *vsCode;
	char *fsCode;

	piglit_require_extension("GL_ARB_texture_storage");
	piglit_require_extension("GL_ARB_texture_view");
	piglit_require_extension("GL_EXT_texture_array");

	/* setup shaders and program object for 2DArray rendering */
	asprintf(&vsCode,
		 "void main()\n"
		 "{\n"
		 "    gl_Position = gl_Vertex;\n"
		 "    gl_TexCoord[0] = gl_MultiTexCoord0;\n"
		 "}\n");
	asprintf(&fsCode,
		 "#extension GL_EXT_texture_array : enable\n"
		 "uniform sampler2DArray tex;\n"
		 "void main()\n"
		 "{\n"
		 "   vec4 color  = texture2DArray(tex, gl_TexCoord[0].xyz);\n"
		 "   gl_FragColor = vec4(color.xyz, 1.0);\n"
		 "}\n");
	prog2Darray = piglit_build_simple_program(vsCode, fsCode);
	free(fsCode);
	free(vsCode);
	tex_loc_2Darray = glGetUniformLocation(prog2Darray, "tex");

}
开发者ID:RAOF,项目名称:piglit,代码行数:31,代码来源:rendering_levels.c


示例16: piglit_init

void
piglit_init(int argc, char **argv)
{
    /* Create the shaders */
    prog = piglit_build_simple_program(vs_text, fs_text);

    /* Create the multisampled framebuffer */
    glGenFramebuffers(1, &fbo);
    glGenRenderbuffers(1, &rb);
    glBindFramebuffer(GL_DRAW_FRAMEBUFFER, fbo);
    glBindRenderbuffer(GL_RENDERBUFFER, rb);
    glRenderbufferStorageMultisample(GL_RENDERBUFFER,
                                     4 /* samples */,
                                     GL_RGBA8 /* internalformat */,
                                     piglit_width, piglit_height);
    glFramebufferRenderbuffer(GL_DRAW_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
                              GL_RENDERBUFFER, rb);
    if (glCheckFramebufferStatus(GL_DRAW_FRAMEBUFFER)
            != GL_FRAMEBUFFER_COMPLETE) {
        printf("Framebuffer incomplete\n");
        piglit_report_result(PIGLIT_FAIL);
    }

    if (!piglit_check_gl_error(GL_NO_ERROR))
        piglit_report_result(PIGLIT_FAIL);
}
开发者ID:janesma,项目名称:piglit,代码行数:26,代码来源:varying-struct-centroid.c


示例17: piglit_init

void
piglit_init(int argc, char **argv)
{
	bool pass = true;

	GLint prog = 0;

	GLint active_attribs = 0;
	GLint max_length = 0;

	piglit_require_GLSL_version(150);

	prog = piglit_build_simple_program(vs_source, fs_source);
	glUseProgram(prog);

	glGetProgramiv(prog, GL_ACTIVE_ATTRIBUTES, &active_attribs);
	glGetProgramiv(prog, GL_ACTIVE_ATTRIBUTE_MAX_LENGTH, &max_length);

	/*
	 * Check the size of the given attribute with the
	 * corresponding expected array size.
	 */
	pass = getAttribLocTest(prog, active_attribs, max_length, "a", 1) && pass;
	pass = getAttribLocTest(prog, active_attribs, max_length, "b", 2) && pass;
	pass = getAttribLocTest(prog, active_attribs, max_length, "c", 3) && pass;
	pass = getAttribLocTest(prog, active_attribs, max_length, "d", 4) && pass;
	pass = getAttribLocTest(prog, active_attribs, max_length, "e", 5) && pass;

	glDeleteProgram(prog);

	piglit_report_result(pass ? PIGLIT_PASS : PIGLIT_FAIL);
}
开发者ID:stereotype441,项目名称:piglit,代码行数:32,代码来源:get-active-attrib-array.c


示例18: piglit_init

void
piglit_init(int argc, char **argv)
{
	bool pass = true;
	unsigned int i;
	GLuint prog;

	piglit_require_extension("GL_ARB_uniform_buffer_object");
	prog = piglit_build_simple_program(NULL, source);

	for (i = 0; i < ARRAY_SIZE(uniforms); i++) {
		GLuint index;
		GLint row_major;

		glGetUniformIndices(prog, 1, &uniforms[i].name, &index);
		if (index == GL_INVALID_INDEX) {
			printf("Failed to get index for %s\n",
			       uniforms[i].name);
			pass = false;
			continue;
		}

		glGetActiveUniformsiv(prog, 1, &index, GL_UNIFORM_IS_ROW_MAJOR,
				      &row_major);

		if (row_major != uniforms[i].row_major) {
			fprintf(stderr, "Uniform %s should %sbe row major\n",
				uniforms[i].name,
				uniforms[i].row_major ? "" : "not ");
			pass = false;
		}
	}

	piglit_report_result(pass ? PIGLIT_PASS : PIGLIT_FAIL);
}
开发者ID:BNieuwenhuizen,项目名称:piglit,代码行数:35,代码来源:row-major.c


示例19: try_140_test

static bool
try_140_test()
{
	bool pass = true;
	GLint idx;
	GLint binding;

	prog140 = piglit_build_simple_program(vert140_source, frag140_source);

	idx = glGetUniformBlockIndex(prog140, "U");
	if (idx == -1) {
		printf("Failed to get index for \"U\"\n");
		pass = false;
	}

	glGetActiveUniformBlockiv(prog140, idx, GL_UNIFORM_BLOCK_BINDING,
				  &binding);
	if (binding != 2) {
		printf("Expected block binding = 2, got %d\n", binding);
		pass = false;
	}

	pass = piglit_check_gl_error(GL_NO_ERROR) && pass;

	return pass;
}
开发者ID:chemecse,项目名称:piglit,代码行数:26,代码来源:binding-layout.c


示例20: try_150_test

static bool
try_150_test()
{
	bool pass = true;
	GLint idx;
	GLint binding;
	unsigned i;

	prog150 = piglit_build_simple_program(vert150_source, frag150_source);

	for (i = 0; i < 2; i++) {
		char name[5] = "U[0]";

		name[2] = '0' + i;

		idx = glGetUniformBlockIndex(prog150, name);
		if (idx == -1) {
			printf("Failed to get index for \"%s\"\n", name);
			pass = false;
		}

		glGetActiveUniformBlockiv(prog150, idx,
					  GL_UNIFORM_BLOCK_BINDING, &binding);
		if (binding != (3 + i)) {
			printf("Expected block binding = %d, got %d\n",
			       3 + i, binding);
			pass = false;
		}
	}

	pass = piglit_check_gl_error(GL_NO_ERROR) && pass;

	return pass;
}
开发者ID:chemecse,项目名称:piglit,代码行数:34,代码来源:binding-layout.c



注:本文中的piglit_build_simple_program函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ piglit_check_gl_error函数代码示例发布时间:2022-05-30
下一篇:
C++ pie_SetRendMode函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap