本文整理汇总了C++中GLU_EXPECT_NO_ERROR函数的典型用法代码示例。如果您正苦于以下问题:C++ GLU_EXPECT_NO_ERROR函数的具体用法?C++ GLU_EXPECT_NO_ERROR怎么用?C++ GLU_EXPECT_NO_ERROR使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GLU_EXPECT_NO_ERROR函数的17个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: GLU_EXPECT_NO_ERROR
/** @brief Function prepares texture object with test's data.
*
* @note The function may throw if unexpected error has occured.
*/
void TextureCubeMapArrayETC2Support::prepareTexture()
{
/* Shortcut for GL functionality */
const glw::Functions& gl = m_context.getRenderContext().getFunctions();
gl.activeTexture(GL_TEXTURE0);
GLU_EXPECT_NO_ERROR(gl.getError(), "glActiveTexture call failed.");
/* Texture creation and binding. */
gl.genTextures(1, &m_texture);
GLU_EXPECT_NO_ERROR(gl.getError(), "glGenTextures call failed.");
const glw::GLuint target = GL_TEXTURE_CUBE_MAP_ARRAY;
gl.bindTexture(target, m_texture);
GLU_EXPECT_NO_ERROR(gl.getError(), "glBindTexture call failed.");
/* Uploading texture. */
gl.compressedTexImage3D(target, 0, GL_COMPRESSED_RGB8_ETC2, RENDER_WIDTH, RENDER_HEIGHT, 6, 0,
s_compressed_RGB_texture_data_size, s_compressed_RGB_texture_data);
GLU_EXPECT_NO_ERROR(gl.getError(), "glCompressedTexImage3D call failed.");
gl.texParameteri(target, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
gl.texParameteri(target, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
gl.texParameteri(target, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
gl.texParameteri(target, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
GLU_EXPECT_NO_ERROR(gl.getError(), "glTexParameteri call failed.");
}
开发者ID:eth0047,项目名称:VK-GL-CTS,代码行数:31,代码来源:esextcTextureCubeMapArrayETC2Support.cpp
示例2: GLU_EXPECT_NO_ERROR
/** Takes a texture ID, binds it to GL_TEXTURE_CUBE_MAP_ARRAY texture target and
* initializes an immutable texture storage of @param texture_size x @param texture_size
* x (@param n_elements * 6) resolution.
*
* @param texture_id ID to use for the initialization.
* @param texture_size Width & height to use for each layer-face.
* @param n_cubemaps Amount of cube-maps to initialize.
* @param should_take_color_texture_properties true if m_color_internal_format, m_color_format,
* m_color_type should be used for texture storage
* initialization, false to use relevant m_depth_*
* fields.
**/
void TextureCubeMapArrayColorDepthAttachmentsTest::prepareImmutableTextureObject(
glw::GLuint texture_id, glw::GLuint texture_size, glw::GLuint n_cubemaps, bool should_take_color_texture_properties)
{
const glw::Functions& gl = m_context.getRenderContext().getFunctions();
glw::GLenum internal_format = GL_NONE;
/* Set internal_format accordingly to requested texture type */
if (true == should_take_color_texture_properties)
{
internal_format = m_color_internal_format;
}
else
{
internal_format = m_depth_internal_format;
}
/* Bind the texture object to GL_TEXTURE_CUBE_MAP_ARRAY texture target. */
gl.bindTexture(GL_TEXTURE_CUBE_MAP_ARRAY, texture_id);
GLU_EXPECT_NO_ERROR(gl.getError(), "glBindTexture() call failed.");
/* Initialize immutable texture storage as per description */
gl.texStorage3D(GL_TEXTURE_CUBE_MAP_ARRAY, 1, /* n_mipmap_levels */
internal_format, texture_size, texture_size, n_cubemaps * 6 /* layer-faces per cube-map */);
GLU_EXPECT_NO_ERROR(gl.getError(), "glTexStorage3D() call failed.");
}
开发者ID:eth0047,项目名称:VK-GL-CTS,代码行数:38,代码来源:esextcTextureCubeMapArrayColorDepthAttachments.cpp
示例3: GLU_EXPECT_NO_ERROR
/** Setup frame buffer:
* 1 allocate texture storage for specified format and dimensions,
* 2 bind framebuffer and attach texture to GL_COLOR_ATTACHMENT0
* 3 setup viewport to specified dimensions
*
* @param framebuffer_object_id FBO handle
* @param color_texture_id Texture handle
* @param texture_format Requested texture format, eg. GL_RGBA8
* @param texture_width Requested texture width
* @param texture_height Requested texture height
*
* @return true All operations succeded
* false In case of any error
**/
bool TestCaseBase::setupFramebufferWithTextureAsAttachment(glw::GLuint framebuffer_object_id,
glw::GLuint color_texture_id, glw::GLenum texture_format,
glw::GLuint texture_width, glw::GLuint texture_height) const
{
const glw::Functions& gl = m_context.getRenderContext().getFunctions();
/* Allocate texture storage */
gl.bindTexture(GL_TEXTURE_2D, color_texture_id);
gl.texStorage2D(GL_TEXTURE_2D, 1 /* levels */, texture_format, texture_width, texture_height);
GLU_EXPECT_NO_ERROR(gl.getError(), "Could not allocate texture storage!");
/* Setup framebuffer */
gl.bindFramebuffer(GL_FRAMEBUFFER, framebuffer_object_id);
gl.framebufferTexture2D(GL_DRAW_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, color_texture_id, 0 /* level */);
GLU_EXPECT_NO_ERROR(gl.getError(), "Could not setup framebuffer!");
/* Setup viewport */
gl.viewport(0, 0, texture_width, texture_height);
GLU_EXPECT_NO_ERROR(gl.getError(), "Could not setup viewport!");
/* Success */
return true;
}
开发者ID:eth0047,项目名称:VK-GL-CTS,代码行数:40,代码来源:esextcTestCaseBase.cpp
示例4: GLU_EXPECT_NO_ERROR
void ShaderMultiDrawElementsIndirectParametersTestCase::initChild()
{
const Functions& gl = m_context.getRenderContext().getFunctions();
// Set expected result vector [x, y, red, green, blue]
m_resultPoints.push_back(ResultPoint(-1.0f + 0.05f, -1.0f + 0.05f, 1.0f, 0.0f, 0.0f));
m_resultPoints.push_back(ResultPoint(-1.0f + 0.05f, -1.0f + 0.15f, 1.0f, 0.0f, 0.0f));
m_resultPoints.push_back(ResultPoint(-1.0f + 0.15f, -1.0f + 0.05f, 0.0f, 0.0f, 0.0f));
m_resultPoints.push_back(ResultPoint(-1.0f + 0.15f, -1.0f + 0.15f, 0.0f, 0.0f, 0.0f));
m_resultPoints.push_back(ResultPoint(-1.0f + 0.05f, -0.8f + 0.05f, 0.0f, 0.0f, 0.0f));
m_resultPoints.push_back(ResultPoint(-1.0f + 0.05f, -0.8f + 0.15f, 0.0f, 0.0f, 0.0f));
m_resultPoints.push_back(ResultPoint(-1.0f + 0.15f, -0.8f + 0.05f, 0.0f, 0.0f, 0.0f));
m_resultPoints.push_back(ResultPoint(-1.0f + 0.15f, -0.8f + 0.15f, 0.0f, 1.0f, 0.0f));
m_resultPoints.push_back(ResultPoint(-0.8f + 0.05f, -1.0f + 0.05f, 0.0f, 0.0f, 0.0f));
m_resultPoints.push_back(ResultPoint(-0.8f + 0.05f, -1.0f + 0.15f, 0.0f, 0.0f, 1.0f));
m_resultPoints.push_back(ResultPoint(-0.8f + 0.15f, -1.0f + 0.05f, 0.0f, 0.0f, 0.0f));
m_resultPoints.push_back(ResultPoint(-0.8f + 0.15f, -1.0f + 0.15f, 0.0f, 0.0f, 0.0f));
const SDPDrawElementsIndirectCommand indirect[] = {
{ 4, 1, 0, 0, 0 }, { 3, 1, 3, 0, 1 }, { 3, 1, 0, 1, 0 },
};
// Setup indirect command buffer
gl.genBuffers(1, &m_drawIndirectBuffer);
GLU_EXPECT_NO_ERROR(gl.getError(), "glGenBuffers");
gl.bindBuffer(GL_DRAW_INDIRECT_BUFFER, m_drawIndirectBuffer);
GLU_EXPECT_NO_ERROR(gl.getError(), "glBindBuffer");
gl.bufferData(GL_DRAW_INDIRECT_BUFFER, 3 * sizeof(SDPDrawElementsIndirectCommand), indirect, GL_STATIC_DRAW);
GLU_EXPECT_NO_ERROR(gl.getError(), "glBufferData");
}
开发者ID:timur-losev,项目名称:Vulkan-CTS,代码行数:32,代码来源:gl4cShaderDrawParametersTests.cpp
示例5: GLU_EXPECT_NO_ERROR
void ShaderAtomicCounterOpsTestBase::bindBuffers()
{
const glw::Functions& gl = m_context.getRenderContext().getFunctions();
gl.bindBufferBase(GL_ATOMIC_COUNTER_BUFFER, 0, m_atomicCounterBuffer);
GLU_EXPECT_NO_ERROR(gl.getError(), "bindBufferBase() call failed.");
gl.bindBufferBase(GL_ATOMIC_COUNTER_BUFFER, 1, m_atomicCounterCallsBuffer);
GLU_EXPECT_NO_ERROR(gl.getError(), "bindBufferBase() call failed.");
}
开发者ID:timur-losev,项目名称:Vulkan-CTS,代码行数:10,代码来源:gl4cShaderAtomicCounterOpsTests.cpp
示例6: GLU_EXPECT_NO_ERROR
/** Verify rendered polygon anisotropy.
*
* @param gl OpenGL functions wrapper
*
* @return Returns points value. Less points means better anisotropy (smoother strips).
*/
GLuint TextureFilterAnisotropicDrawingTestCase::verifyScene(const glw::Functions& gl)
{
std::vector<GLubyte> pixels;
pixels.resize(32 * 8 * 4);
gl.readPixels(0, 23, 32, 8, GL_RGBA, GL_UNSIGNED_BYTE, pixels.data());
GLU_EXPECT_NO_ERROR(gl.getError(), "glReadPixels");
GLuint sum = 0;
GLubyte last = 0;
GLubyte current = 0;
for (int j = 0; j < 8; ++j)
{
for (int i = 0; i < 32; ++i)
{
current = pixels[(i + j * 32) * 4];
if (i > 0)
sum += deAbs32((int)current - (int)last);
last = current;
}
}
return sum;
}
开发者ID:timur-losev,项目名称:Vulkan-CTS,代码行数:33,代码来源:glcTextureFilterAnisotropicTests.cpp
示例7: sizeof
void ShaderDrawElementsParametersTestCase::drawCommand()
{
const Functions& gl = m_context.getRenderContext().getFunctions();
gl.drawElements(GL_TRIANGLE_STRIP, 4, GL_UNSIGNED_SHORT, (GLvoid*)(2 * sizeof(GLushort)));
GLU_EXPECT_NO_ERROR(gl.getError(), "glDrawElements");
}
开发者ID:timur-losev,项目名称:Vulkan-CTS,代码行数:7,代码来源:gl4cShaderDrawParametersTests.cpp
示例8: releaseAndDetachTextureObject
/** Releases existing color & depth cube-map texture array objects, generates new
* ones and configures them as per user-specified properties.
*
* @param texture_width Size to use for each layer-face's width and height.
* @param n_cubemaps Number of cube-maps to initialize for the cube-map texture arrays.
* @param should_generate_mutable_textures true if the texture should be initialized as mutable, false otherwise.
**/
void TextureCubeMapArrayColorDepthAttachmentsTest::generateAndConfigureTextureObjects(
glw::GLuint texture_width, glw::GLuint n_cubemaps, bool should_generate_mutable_textures)
{
const glw::Functions& gl = m_context.getRenderContext().getFunctions();
/* Release any texture objects that may have already been initialized */
releaseAndDetachTextureObject(m_color_texture_id, true /* is_color_attachment */);
releaseAndDetachTextureObject(m_depth_texture_id, false /* is_color_attachment */);
/* Generate texture objects */
gl.genTextures(1, &m_color_texture_id);
gl.genTextures(1, &m_depth_texture_id);
GLU_EXPECT_NO_ERROR(gl.getError(), "glGenTextures() call(s) failed");
/* Configure new textures' storage */
if (true == should_generate_mutable_textures)
{
prepareMutableTextureObject(m_color_texture_id, texture_width, n_cubemaps,
true /* should_take_color_texture_properties */);
prepareMutableTextureObject(m_depth_texture_id, texture_width, n_cubemaps,
false /* should_take_color_texture_properties */);
}
else
{
prepareImmutableTextureObject(m_color_texture_id, texture_width, n_cubemaps,
true /* should_take_color_texture_properties */);
prepareImmutableTextureObject(m_depth_texture_id, texture_width, n_cubemaps,
false /* should_take_color_texture_properties */);
}
}
开发者ID:eth0047,项目名称:VK-GL-CTS,代码行数:38,代码来源:esextcTextureCubeMapArrayColorDepthAttachments.cpp
示例9: DE_ASSERT
/** Reads read buffer's depth data (assuming it's of 32-bit FP resolution)
* and verifies its correctness.
*
* @param texture_size Texture size
* @param n_layer Index of the layer to verify.
*
* @return true if the retrieved data was found correct, false otherwise.
**/
bool TextureCubeMapArrayColorDepthAttachmentsTest::verifyDepth32FData(const _texture_size& texture_size,
glw::GLuint n_layer)
{
/* Allocate buffer for the data we will retrieve from the implementation */
glw::GLfloat expected_value = (glw::GLfloat)n_layer / 256.0f;
const glw::Functions& gl = m_context.getRenderContext().getFunctions();
bool result = false;
const glw::GLuint result_data_size = texture_size.m_size * texture_size.m_size;
glw::GLfloat* result_data = new glw::GLfloat[result_data_size];
DE_ASSERT(result_data != NULL);
/* Read the data */
gl.readPixels(0, /* x */
0, /* y */
texture_size.m_size, texture_size.m_size, m_depth_format, m_depth_type, result_data);
GLU_EXPECT_NO_ERROR(gl.getError(), "glReadPixels() call failed");
/* Verify image, expected value is layer index */
result = verifyImage<glw::GLfloat, 1>(texture_size.m_size, texture_size.m_size, &expected_value, result_data);
/* Release the buffer */
if (result_data != NULL)
{
delete[] result_data;
result_data = NULL;
}
return result;
}
开发者ID:eth0047,项目名称:VK-GL-CTS,代码行数:39,代码来源:esextcTextureCubeMapArrayColorDepthAttachments.cpp
示例10: switch
/** Retrieves compilation OR linking info log for a shader/program object with GLES id
* @param id.
*
* @param is_compilation_info_log true if @param id is a GLES id of a shader object;
* false if it represents a program object.
* @param id GLES id of a shader OR a program object to
* retrieve info log for.
*
* @return String instance containing the log..
**/
std::string TestCaseBase::getInfoLog(LOG_TYPE log_type, glw::GLuint id)
{
const glw::Functions& gl = m_context.getRenderContext().getFunctions();
glw::GLint n_characters = 0;
/* Retrieve amount of characters needed to store the info log (terminator-inclusive) */
switch (log_type)
{
case LT_SHADER_OBJECT:
gl.getShaderiv(id, GL_INFO_LOG_LENGTH, &n_characters);
break;
case LT_PROGRAM_OBJECT:
gl.getProgramiv(id, GL_INFO_LOG_LENGTH, &n_characters);
break;
case LT_PIPELINE_OBJECT:
gl.getProgramPipelineiv(id, GL_INFO_LOG_LENGTH, &n_characters);
break;
default:
TCU_FAIL("Invalid parameter");
}
/* Check if everything is fine so far */
GLU_EXPECT_NO_ERROR(gl.getError(), "Could not query info log length!");
/* Allocate buffer */
std::vector<char> result_vec(n_characters + 1);
/* Retrieve the info log */
switch (log_type)
{
case LT_SHADER_OBJECT:
gl.getShaderInfoLog(id, n_characters + 1, 0, &result_vec[0]);
break;
case LT_PROGRAM_OBJECT:
gl.getProgramInfoLog(id, n_characters + 1, 0, &result_vec[0]);
break;
case LT_PIPELINE_OBJECT:
gl.getProgramPipelineInfoLog(id, n_characters + 1, 0, &result_vec[0]);
break;
}
GLU_EXPECT_NO_ERROR(gl.getError(), "Could not retrieve info log!");
return std::string(&result_vec[0]);
}
开发者ID:eth0047,项目名称:VK-GL-CTS,代码行数:55,代码来源:esextcTestCaseBase.cpp
示例11: texImage
/** Set contents of texture
*
* @param gl GL functions
* @param target Texture target
* @param level Mipmap level
* @param internal_format Format of data
* @param width Width of texture
* @param height Height of texture
* @param depth Depth of texture
* @param format Format of data
* @param type Type of data
* @param data Buffer with image data
**/
void texImage(const Functions& gl, GLenum target, GLint level, GLenum internal_format, GLuint width, GLuint height,
GLuint depth, GLenum format, GLenum type, const GLvoid* data)
{
switch (target)
{
case GL_TEXTURE_2D:
gl.texImage2D(target, level, internal_format, width, height, 0 /* border */, format, type, data);
GLU_EXPECT_NO_ERROR(gl.getError(), "texImage");
break;
case GL_TEXTURE_2D_ARRAY:
gl.texImage3D(target, level, internal_format, width, height, depth, 0 /* border */, format, type, data);
GLU_EXPECT_NO_ERROR(gl.getError(), "texImage");
break;
default:
TCU_FAIL("Invalid enum");
break;
}
}
开发者ID:timur-losev,项目名称:Vulkan-CTS,代码行数:31,代码来源:glcTextureFilterAnisotropicTests.cpp
示例12: subImage
/** Set contents of texture
*
* @param gl GL functions
* @param target Texture target
* @param level Mipmap level
* @param x X offset
* @param y Y offset
* @param z Z offset
* @param width Width of texture
* @param height Height of texture
* @param depth Depth of texture
* @param format Format of data
* @param type Type of data
* @param pixels Buffer with image data
**/
void subImage(const Functions& gl, GLenum target, GLint level, GLint x, GLint y, GLint z, GLsizei width, GLsizei height,
GLsizei depth, GLenum format, GLenum type, const GLvoid* pixels)
{
switch (target)
{
case GL_TEXTURE_2D:
gl.texSubImage2D(target, level, x, y, width, height, format, type, pixels);
GLU_EXPECT_NO_ERROR(gl.getError(), "TexSubImage2D");
break;
case GL_TEXTURE_2D_ARRAY:
gl.texSubImage3D(target, level, x, y, z, width, height, depth, format, type, pixels);
GLU_EXPECT_NO_ERROR(gl.getError(), "TexSubImage3D");
break;
default:
TCU_FAIL("Invalid enum");
break;
}
}
开发者ID:timur-losev,项目名称:Vulkan-CTS,代码行数:33,代码来源:glcTextureFilterAnisotropicTests.cpp
示例13: GLU_EXPECT_NO_ERROR
/** Executes test iteration.
*
* @return Returns STOP when test has finished executing, CONTINUE if more iterations are needed.
*/
tcu::TestNode::IterateResult MultisampleTextureSampleMaskiGettersTest::iterate()
{
/* Get GL_MAX_SAMPLE_MASK_WORDS value */
const glw::Functions& gl = m_context.getRenderContext().getFunctions();
glw::GLint gl_max_sample_mask_words_value = 0;
gl.getIntegerv(GL_MAX_SAMPLE_MASK_WORDS, &gl_max_sample_mask_words_value);
GLU_EXPECT_NO_ERROR(gl.getError(), "Failed to retrieve GL_MAX_SAMPLE_MASK_WORDS value");
/* Iterate over valid index & mask values */
const glw::GLuint valid_masks[] = { 0, 0xFFFFFFFF, 0xFF000000, 0x00FF0000, 0x0000FF00, 0x000000FF };
const unsigned int n_valid_masks = sizeof(valid_masks) / sizeof(valid_masks[0]);
for (int index = 0; index < gl_max_sample_mask_words_value; ++index)
{
for (unsigned int n_mask = 0; n_mask < n_valid_masks; ++n_mask)
{
glw::GLint mask = valid_masks[n_mask];
/* Make sure a valid glSampleMaski() call does not result in an error */
gl.sampleMaski(index, mask);
GLU_EXPECT_NO_ERROR(gl.getError(), "A valid glSampleMaski() call resulted in an error");
/* Check the property value as reported by implementation */
glw::GLint int_value = -1;
gl.getIntegeri_v(GL_SAMPLE_MASK_VALUE, index, &int_value);
GLU_EXPECT_NO_ERROR(gl.getError(), "A valid glGetIntegeri_v() call resulted in an error");
if (int_value != mask)
{
TCU_FAIL("Invalid sample mask reported");
}
} /* for (all masks) */
} /* for (all valid index argument values) */
/* Test case passed */
m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
return STOP;
}
开发者ID:eth0047,项目名称:VK-GL-CTS,代码行数:47,代码来源:es31cTextureStorageMultisampleSampleMaskiTests.cpp
示例14: initTest
/** Executes the test.
*
* Sets the test result to QP_TEST_RESULT_FAIL if the test failed, QP_TEST_RESULT_PASS otherwise.
* Note the function throws exception should an error occur!
*
* @return STOP if the test has finished, CONTINUE to indicate iterate should be called once again.
**/
tcu::TestCase::IterateResult TextureCubeMapArrayColorDepthAttachmentsTest::iterate()
{
/* GL functions */
const glw::Functions& gl = m_context.getRenderContext().getFunctions();
/* Initialize all ES objects needed to run the test */
initTest();
/* Setup clear values */
gl.clearColor(0.0f /* red */, 0.0f /* green */, 0.0f /* blue */, 0.0f /* alpha */);
GLU_EXPECT_NO_ERROR(gl.getError(), "glClearColor() call failed.");
gl.clearDepthf(1.0f /* d */);
GLU_EXPECT_NO_ERROR(gl.getError(), "glClearDepthf() call failed.");
/* Enable depth test */
gl.enable(GL_DEPTH_TEST);
GLU_EXPECT_NO_ERROR(gl.getError(), "glEnable() call failed");
/* Execute tests for each resolution */
for (_texture_size_vector::iterator texture_size_iterator = m_resolutions.begin(),
end_iterator = m_resolutions.end();
end_iterator != texture_size_iterator; ++texture_size_iterator)
{
testNonLayeredRendering(*texture_size_iterator, false);
testNonLayeredRendering(*texture_size_iterator, true);
testLayeredRendering(*texture_size_iterator, false);
testLayeredRendering(*texture_size_iterator, true);
}
/* Test passes if there were no errors */
if ((0 != m_n_invalid_color_checks) || (0 != m_n_invalid_depth_checks))
{
m_testCtx.setTestResult(QP_TEST_RESULT_FAIL, "Fail");
}
else
{
m_testCtx.setTestResult(QP_TEST_RESULT_PASS, "Pass");
}
/* Done */
return STOP;
}
开发者ID:eth0047,项目名称:VK-GL-CTS,代码行数:50,代码来源:esextcTextureCubeMapArrayColorDepthAttachments.cpp
示例15: makeVtxFragSources
/** Drawing quads method using drawArrays.
*/
bool MultiDrawElementsIndirectCountCase::draw()
{
const Functions& gl = m_context.getRenderContext().getFunctions();
ProgramSources sources = makeVtxFragSources(c_vertShader, c_fragShader);
ShaderProgram program(gl, sources);
if (!program.isOk())
{
m_testCtx.getLog() << tcu::TestLog::Message << "Shader build failed.\n"
<< "Vertex: " << program.getShaderInfo(SHADERTYPE_VERTEX).infoLog << "\n"
<< "Fragment: " << program.getShaderInfo(SHADERTYPE_FRAGMENT).infoLog << "\n"
<< "Program: " << program.getProgramInfo().infoLog << tcu::TestLog::EndMessage;
return false;
}
gl.useProgram(program.getProgram());
GLU_EXPECT_NO_ERROR(gl.getError(), "glUseProgram");
gl.clearColor(0.0f, 0.0f, 0.0f, 1.0f);
gl.clear(GL_COLOR_BUFFER_BIT);
gl.enable(GL_BLEND);
gl.blendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
gl.enableVertexAttribArray(0);
GLU_EXPECT_NO_ERROR(gl.getError(), "glEnableVertexAttribArray");
gl.vertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 0, NULL);
GLU_EXPECT_NO_ERROR(gl.getError(), "glVertexAttribPointer");
gl.multiDrawElementsIndirectCount(GL_TRIANGLE_STRIP, GL_UNSIGNED_SHORT, 0, 0, 2, 0);
GLU_EXPECT_NO_ERROR(gl.getError(), "glMultiDrawElementsIndirectCountARB");
gl.disableVertexAttribArray(0);
GLU_EXPECT_NO_ERROR(gl.getError(), "glDisableVertexAttribArray");
gl.disable(GL_BLEND);
return true;
}
开发者ID:eth0047,项目名称:VK-GL-CTS,代码行数:42,代码来源:gl4cIndirectParametersTests.cpp
示例16: program
void ShaderMetamorphicVariant::render (const tcu::PixelBufferAccess& img, const std::string& vertexSrc, const std::string& fragmentSrc)
{
TestLog& log = m_testCtx.getLog();
const glw::Functions& gl = m_context.getRenderContext().getFunctions();
// Positions, shared between shaders
const float positions[] =
{
-1.0f, 1.0f, // top-left
-1.0f, -1.0f, // bottom-left
1.0f, -1.0f, // bottom-right
1.0f, 1.0f, // top-right
};
const deUint16 indices[] =
{
0, 1, 2, // bottom-left triangle
0, 3, 2, // top-right triangle
};
glu::VertexArrayBinding posBinding = glu::va::Float("coord2d", 2, 6, 0, &positions[0]);
const glu::ShaderProgram program(m_context.getRenderContext(), glu::makeVtxFragSources(vertexSrc, fragmentSrc));
log << program;
if (!program.isOk())
throw tcu::TestError("Compile failed");
// Set uniforms expected in GraphicsFuzz generated programs
gl.useProgram(program.getProgram());
// Uniform: injectionSwitch
int uniformLoc = gl.getUniformLocation(program.getProgram(), "injectionSwitch");
if (uniformLoc != -1)
gl.uniform2f(uniformLoc, 0.0f, 1.0f);
// Uniform: resolution
uniformLoc = gl.getUniformLocation(program.getProgram(), "resolution");
if (uniformLoc != -1)
gl.uniform2f(uniformLoc, glw::GLfloat(img.getWidth()), glw::GLfloat(img.getHeight()));
// Uniform: mouse
uniformLoc = gl.getUniformLocation(program.getProgram(), "mouse");
if (uniformLoc != -1)
gl.uniform2f(uniformLoc, 0.0f, 0.0f);
// Uniform: time
uniformLoc = gl.getUniformLocation(program.getProgram(), "time");
if (uniformLoc != -1)
gl.uniform1f(uniformLoc, 0.0f);
// Render two times to check nondeterministic renderings
glu::draw(m_context.getRenderContext(), program.getProgram(), 1, &posBinding, glu::pr::Triangles(DE_LENGTH_OF_ARRAY(indices), &indices[0]));
glu::readPixels(m_context.getRenderContext(), 0, 0, img);
GLU_EXPECT_NO_ERROR(gl.getError(), "Draw");
}
开发者ID:eth0047,项目名称:VK-GL-CTS,代码行数:52,代码来源:es3fShaderMetamorphicTests.cpp
示例17: DE_LENGTH_OF_ARRAY
void ShaderAtomicCounterOpsTestBase::ShaderPipeline::renderQuad(deqp::Context& context)
{
const glw::Functions& gl = context.getRenderContext().getFunctions();
deUint16 const quadIndices[] = { 0, 1, 2, 2, 1, 3 };
float const position[] = { -1.0f, -1.0f, -1.0f, 1.0f, 1.0f, -1.0f, 1.0f, 1.0f };
glu::VertexArrayBinding vertexArrays[] = { glu::va::Float("inPosition", 2, 4, 0, position) };
this->use(context);
glu::PrimitiveList primitiveList = glu::pr::Patches(DE_LENGTH_OF_ARRAY(quadIndices), quadIndices);
glu::draw(context.getRenderContext(), this->getShaderProgram()->getProgram(), DE_LENGTH_OF_ARRAY(vertexArrays),
vertexArrays, primitiveList);
GLU_EXPECT_NO_ERROR(gl.getError(), "glu::draw error");
gl.memoryBarrier(GL_BUFFER_UPDATE_BARRIER_BIT);
GLU_EXPECT_NO_ERROR(gl.getError(), "glMemoryBarrier() error");
}
开发者ID:timur-losev,项目名称:Vulkan-CTS,代码行数:22,代码来源:gl4cShaderAtomicCounterOpsTests.cpp
注:本文中的GLU_EXPECT_NO_ERROR函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论