string NumSamplesParams::getDescription (const NumSamplesParams& params) { ostringstream os; bool first = true; static const char* const s_names[] = { "color", "depth", "stencil" }; DE_STATIC_ASSERT(DE_LENGTH_OF_ARRAY(s_names) == DE_LENGTH_OF_ARRAY(params.numSamples)); for (int i = 0; i < DE_LENGTH_OF_ARRAY(s_names); i++) { GLsizei ns = params.numSamples[i]; if (ns == SAMPLES_NONE) continue; if (first) first = false; else os << ", "; if (ns == SAMPLES_TEXTURE) os << "texture " << s_names[i] << " attachment"; else os << ns << "-sample renderbuffer " << s_names[i] << " attachment"; } return os.str(); }
void TextureCountTests::init (void) { static const struct { const char* name; deUint32 format; deUint32 dataType; } texFormats[] = { { "a8", GL_ALPHA, GL_UNSIGNED_BYTE }, { "rgb565", GL_RGB, GL_UNSIGNED_SHORT_5_6_5 }, { "rgb888", GL_RGB, GL_UNSIGNED_BYTE }, { "rgba8888", GL_RGBA, GL_UNSIGNED_BYTE } }; static const int texCounts[] = { 1, 2, 4, 8 }; for (int formatNdx = 0; formatNdx < DE_LENGTH_OF_ARRAY(texFormats); formatNdx++) { for (int cntNdx = 0; cntNdx < DE_LENGTH_OF_ARRAY(texCounts); cntNdx++) { deUint32 format = texFormats[formatNdx].format; deUint32 dataType = texFormats[formatNdx].dataType; deUint32 wrapS = GL_CLAMP_TO_EDGE; deUint32 wrapT = GL_CLAMP_TO_EDGE; deUint32 minFilter = GL_NEAREST; deUint32 magFilter = GL_NEAREST; int numTextures = texCounts[cntNdx]; string name = string(texFormats[formatNdx].name) + "_" + de::toString(numTextures); string description = string(glu::getPixelFormatName(format)) + ", " + glu::getTypeName(dataType); addChild(new Texture2DRenderCase(m_context, name.c_str(), description.c_str(), format, dataType, wrapS, wrapT, minFilter, magFilter, tcu::Mat3(), numTextures, false /* npot */)); } } }
void deAssertFail (const char* reason, const char* file, int line) { #if defined(DE_ASSERT_FAILURE_CALLBACK) if (g_assertFailureCallback != DE_NULL) { /* Remove callback in case of the callback causes further asserts. */ deAssertFailureCallbackFunc callback = g_assertFailureCallback; deSetAssertFailureCallback(DE_NULL); callback(reason, file, line); } #endif #if (((DE_OS == DE_OS_WIN32) || (DE_OS == DE_OS_WINCE)) && (DE_COMPILER == DE_COMPILER_MSC)) { wchar_t wreason[1024]; wchar_t wfile[128]; int num; int i; /* MessageBox(reason, "Assertion failed", MB_OK); */ num = deMin32((int)strlen(reason), DE_LENGTH_OF_ARRAY(wreason)-1); for (i = 0; i < num; i++) wreason[i] = reason[i]; wreason[i] = 0; num = deMin32((int)strlen(file), DE_LENGTH_OF_ARRAY(wfile)-1); for (i = 0; i < num; i++) wfile[i] = file[i]; wfile[i] = 0; # if (DE_OS == DE_OS_WIN32) _wassert(wreason, wfile, line); # else /* WINCE */ assert(wreason); # endif } #elif ((DE_OS == DE_OS_WIN32) && (DE_COMPILER == DE_COMPILER_CLANG)) _assert(reason, file, line); #elif (DE_OS == DE_OS_UNIX) __assert_fail(reason, file, (unsigned int)line, "Unknown function"); #elif (DE_OS == DE_OS_SYMBIAN) __assert("Unknown function", file, line, reason); #elif (DE_OS == DE_OS_OSX) || (DE_OS == DE_OS_IOS) fprintf(stderr, "Assertion '%s' failed at %s:%d\n", reason, file, line); raise(SIGTRAP); abort(); #elif (DE_OS == DE_OS_ANDROID) __android_log_print(ANDROID_LOG_ERROR, "delibs", "Assertion '%s' failed at %s:%d", reason, file, line); __assert(file, line, reason); #else # error Implement assertion function on your platform. #endif }
static void threadTestThr3 (void* arg) { ThreadData3* data = (ThreadData3*)arg; int ndx; for (ndx = 0; ndx < (int)DE_LENGTH_OF_ARRAY(data->bytes); ndx++) DE_TEST_ASSERT(data->bytes[ndx] == 0); for (ndx = 0; ndx < (int)DE_LENGTH_OF_ARRAY(data->bytes); ndx++) data->bytes[ndx] = 0xff; }
static const char* getPrecisionPostfix (glu::Precision precision) { static const char* s_postfix[] = { "_lowp", "_mediump", "_highp" }; DE_STATIC_ASSERT(DE_LENGTH_OF_ARRAY(s_postfix) == glu::PRECISION_LAST); DE_ASSERT(de::inBounds<int>(precision, 0, DE_LENGTH_OF_ARRAY(s_postfix))); return s_postfix[precision]; }
IterateResult NumSamplesTest::build (FboBuilder& builder) { static const GLenum s_targets[] = { GL_COLOR_ATTACHMENT0, GL_COLOR_ATTACHMENT1, GL_DEPTH_ATTACHMENT, }; // Non-integer formats for each attachment type. // \todo [2013-12-17 lauri] Add fixed/floating/integer metadata for formats so // we can pick one smartly or maybe try several. static const GLenum s_formats[] = { GL_RGBA8, GL_RGB565, GL_DEPTH_COMPONENT24, }; DE_STATIC_ASSERT(DE_LENGTH_OF_ARRAY(s_targets) == DE_LENGTH_OF_ARRAY(m_params.numSamples)); for (int i = 0; i < DE_LENGTH_OF_ARRAY(s_targets); i++) { const GLenum target = s_targets[i]; const ImageFormat fmt = { s_formats[i], GL_NONE }; const GLsizei ns = m_params.numSamples[i]; if (ns == -2) continue; if (ns == -1) { attachTargetToNew(target, GL_TEXTURE, fmt, 64, 64, builder); } else { Renderbuffer& rboCfg = builder.makeConfig<Renderbuffer>(); rboCfg.internalFormat = fmt; rboCfg.width = rboCfg.height = 64; rboCfg.numSamples = ns; const GLuint rbo = builder.glCreateRbo(rboCfg); // Implementations do not necessarily support sample sizes greater than 1. TCU_CHECK_AND_THROW(NotSupportedError, builder.getError() != GL_INVALID_OPERATION, "Unsupported number of samples"); RenderbufferAttachment& att = builder.makeConfig<RenderbufferAttachment>(); att.imageName = rbo; builder.glAttach(target, &att); } } return STOP; }
void DitheringTests::init (void) { static const struct { const char* name; Vec4 color; } caseColors[] = { { "white", Vec4(1.0f, 1.0f, 1.0f, 1.0f) }, { "red", Vec4(1.0f, 0.0f, 0.0f, 1.0f) }, { "green", Vec4(0.0f, 1.0f, 0.0f, 1.0f) }, { "blue", Vec4(0.0f, 0.0f, 1.0f, 1.0f) }, { "alpha", Vec4(0.0f, 0.0f, 0.0f, 1.0f) } }; for (int ditheringEnabledI = 0; ditheringEnabledI <= 1; ditheringEnabledI++) { const bool ditheringEnabled = ditheringEnabledI != 0; TestCaseGroup* const group = new TestCaseGroup(m_context, ditheringEnabled ? "enabled" : "disabled", ""); addChild(group); for (int patternTypeI = 0; patternTypeI < DitheringCase::PATTERNTYPE_LAST; patternTypeI++) { for (int caseColorNdx = 0; caseColorNdx < DE_LENGTH_OF_ARRAY(caseColors); caseColorNdx++) { const DitheringCase::PatternType patternType = (DitheringCase::PatternType)patternTypeI; const string caseName = string("") + DitheringCase::getPatternTypeName(patternType) + "_" + caseColors[caseColorNdx].name; group->addChild(new DitheringCase(m_context.getTestContext(), m_context.getRenderContext(), caseName.c_str(), "", ditheringEnabled, patternType, caseColors[caseColorNdx].color)); } } } }
void TextureFormatTests::init (void) { static const struct { const char* name; deUint32 format; deUint32 dataType; } texFormats[] = { { "a8", GL_ALPHA, GL_UNSIGNED_BYTE }, { "l8", GL_LUMINANCE, GL_UNSIGNED_BYTE }, { "la88", GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE }, { "rgb565", GL_RGB, GL_UNSIGNED_SHORT_5_6_5 }, { "rgba4444", GL_RGBA, GL_UNSIGNED_SHORT_4_4_4_4 }, { "rgba5551", GL_RGBA, GL_UNSIGNED_SHORT_5_5_5_1 }, { "rgb888", GL_RGB, GL_UNSIGNED_BYTE }, { "rgba8888", GL_RGBA, GL_UNSIGNED_BYTE } }; for (int formatNdx = 0; formatNdx < DE_LENGTH_OF_ARRAY(texFormats); formatNdx++) { deUint32 format = texFormats[formatNdx].format; deUint32 dataType = texFormats[formatNdx].dataType; string nameBase = texFormats[formatNdx].name; deUint32 wrapS = GL_CLAMP_TO_EDGE; deUint32 wrapT = GL_CLAMP_TO_EDGE; deUint32 minFilter = GL_NEAREST; deUint32 magFilter = GL_NEAREST; int numTextures = 1; string descriptionBase = string(glu::getPixelFormatName(format)) + ", " + glu::getTypeName(dataType); addChild(new Texture2DRenderCase(m_context, nameBase.c_str(), descriptionBase.c_str(), format, dataType, wrapS, wrapT, minFilter, magFilter, tcu::Mat3(), numTextures, false /* npot */)); } }
deUint32 chooseDepthStencilFormat (const glu::RenderConfig& config) { static const deUint32 s_formats[] = { GL_DEPTH32F_STENCIL8, GL_DEPTH24_STENCIL8, GL_DEPTH_COMPONENT32F, GL_DEPTH_COMPONENT24, GL_DEPTH_COMPONENT16, GL_STENCIL_INDEX8 }; for (int fmtNdx = 0; fmtNdx < DE_LENGTH_OF_ARRAY(s_formats); fmtNdx++) { const deUint32 format = s_formats[fmtNdx]; const tcu::TextureFormat combinedFormat = glu::mapGLInternalFormat(format); const int depthBits = getNumDepthBits(combinedFormat); const int stencilBits = getNumStencilBits(combinedFormat); if (config.depthBits != glu::RenderConfig::DONT_CARE && config.depthBits != depthBits) continue; if (config.stencilBits != glu::RenderConfig::DONT_CARE && config.stencilBits != stencilBits) continue; return format; } return 0; }
IntegerQuad (int windowWidth, int windowHeight) : posA(0, 0) , posB(windowWidth-1, windowHeight-1) { for (int i = 0; i < DE_LENGTH_OF_ARRAY(depth); i++) depth[i] = 0.0f; }
Quad (void) : posA(-1.0f, -1.0f) , posB( 1.0f, 1.0f) { for (int i = 0; i < DE_LENGTH_OF_ARRAY(depth); i++) depth[i] = 0.0f; }
IntegerQuad (void) : posA(0, 0) , posB(1, 1) { for (int i = 0; i < DE_LENGTH_OF_ARRAY(depth); i++) depth[i] = 0.0f; }
tcu::TestCaseGroup* createEarlyFragmentTests (tcu::TestContext& testCtx) { de::MovePtr<tcu::TestCaseGroup> testGroup(new tcu::TestCaseGroup(testCtx, "early_fragment", "early fragment test cases")); static const struct { std::string caseName; deUint32 flags; } cases[] = { { "no_early_fragment_tests_depth", FLAG_TEST_DEPTH | FLAG_DONT_USE_EARLY_FRAGMENT_TESTS }, { "no_early_fragment_tests_stencil", FLAG_TEST_STENCIL | FLAG_DONT_USE_EARLY_FRAGMENT_TESTS }, { "early_fragment_tests_depth", FLAG_TEST_DEPTH }, { "early_fragment_tests_stencil", FLAG_TEST_STENCIL }, { "no_early_fragment_tests_depth_no_attachment", FLAG_TEST_DEPTH | FLAG_DONT_USE_EARLY_FRAGMENT_TESTS | FLAG_DONT_USE_TEST_ATTACHMENT }, { "no_early_fragment_tests_stencil_no_attachment", FLAG_TEST_STENCIL | FLAG_DONT_USE_EARLY_FRAGMENT_TESTS | FLAG_DONT_USE_TEST_ATTACHMENT }, { "early_fragment_tests_depth_no_attachment", FLAG_TEST_DEPTH | FLAG_DONT_USE_TEST_ATTACHMENT }, { "early_fragment_tests_stencil_no_attachment", FLAG_TEST_STENCIL | FLAG_DONT_USE_TEST_ATTACHMENT }, }; for (int i = 0; i < DE_LENGTH_OF_ARRAY(cases); ++i) testGroup->addChild(new EarlyFragmentTest(testCtx, cases[i].caseName, cases[i].flags)); return testGroup.release(); }
void producerThread (void* arg) { TestBuffer* buffer = (TestBuffer*)arg; deRandom random; int ndx; int numToProduce = 10000; int writePos = 0; deRandom_init(&random, 123); for (ndx = 0; ndx <= numToProduce; ndx++) { deInt32 val; if (ndx == numToProduce) { val = 0; /* End. */ } else { val = (deInt32)deRandom_getUint32(&random); val = val ? val : 1; } deSemaphore_decrement(buffer->empty); buffer->buffer[writePos] = val; writePos = (writePos + 1) % DE_LENGTH_OF_ARRAY(buffer->buffer); deSemaphore_increment(buffer->fill); buffer->producerSum += val; } }
void deSingleton_selfTest (void) { const struct { int numThreads; int initTimeMs; int repeatCount; } cases[] = { /* #threads time #repeat */ { 1, -1, 5 }, { 1, 1, 5 }, { 2, -1, 20 }, { 2, 1, 20 }, { 4, -1, 20 }, { 4, 1, 20 }, { 4, 5, 20 } }; int caseNdx; for (caseNdx = 0; caseNdx < DE_LENGTH_OF_ARRAY(cases); caseNdx++) { int numThreads = cases[caseNdx].numThreads; int initTimeMs = cases[caseNdx].initTimeMs; int repeatCount = cases[caseNdx].repeatCount; int subCaseNdx; for (subCaseNdx = 0; subCaseNdx < repeatCount; subCaseNdx++) runSingletonThreadedTest(numThreads, initTimeMs); } }
void QuadRenderer::render (const Quad& quad) const { const float position[] = { quad.posA.x(), quad.posA.y(), quad.depth[0], 1.0f, quad.posA.x(), quad.posB.y(), quad.depth[1], 1.0f, quad.posB.x(), quad.posA.y(), quad.depth[2], 1.0f, quad.posB.x(), quad.posB.y(), quad.depth[3], 1.0f }; const deUint8 indices[] = { 0, 2, 1, 1, 2, 3 }; DE_STATIC_ASSERT(sizeof(tcu::Vec4) == sizeof(float)*4); DE_STATIC_ASSERT(sizeof(quad.color) == sizeof(float)*4*4); DE_STATIC_ASSERT(sizeof(quad.color1) == sizeof(float)*4*4); std::vector<glu::VertexArrayBinding> vertexArrays; vertexArrays.push_back(glu::va::Float(m_positionLoc, 4, 4, 0, &position[0])); vertexArrays.push_back(glu::va::Float(m_colorLoc, 4, 4, 0, (const float*)&quad.color[0])); if (m_blendFuncExt) vertexArrays.push_back(glu::va::Float(m_color1Loc, 4, 4, 0, (const float*)&quad.color1[0])); m_context.getFunctions().useProgram(m_program->getProgram()); glu::draw(m_context, m_program->getProgram(), (int)vertexArrays.size(), &vertexArrays[0], glu::pr::Triangles(DE_LENGTH_OF_ARRAY(indices), &indices[0])); }
void ShaderBallotBaseTestCase::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(), m_programRender->getProgram(), DE_LENGTH_OF_ARRAY(vertexArrays), vertexArrays, primitiveList); GLU_EXPECT_NO_ERROR(gl.getError(), "glu::draw error"); }
void ReferenceQuadRenderer::render (const tcu::PixelBufferAccess& colorBuffer, const tcu::PixelBufferAccess& depthBuffer, const tcu::PixelBufferAccess& stencilBuffer, const IntegerQuad& quad, const rr::FragmentOperationState& state) { bool flipX = quad.posA.x() > quad.posB.x(); bool flipY = quad.posA.y() > quad.posB.y(); rr::FaceType faceType = flipX == flipY ? rr::FACETYPE_FRONT : rr::FACETYPE_BACK; int xFirst = flipX ? quad.posB.x() : quad.posA.x(); int xLast = flipX ? quad.posA.x() : quad.posB.x(); int yFirst = flipY ? quad.posB.y() : quad.posA.y(); int yLast = flipY ? quad.posA.y() : quad.posB.y(); float width = (float)(xLast - xFirst + 1); float height = (float)(yLast - yFirst + 1); for (int y = yFirst; y <= yLast; y++) { // Interpolation factor for y. float yRatio = (0.5f + (float)(y - yFirst)) / height; if (flipY) yRatio = 1.0f - yRatio; for (int x = xFirst; x <= xLast; x++) { // Interpolation factor for x. float xRatio = (0.5f + (float)(x - xFirst)) / width; if (flipX) xRatio = 1.0f - xRatio; tcu::Vec4 color = triQuadInterpolate(quad.color, xRatio, yRatio); tcu::Vec4 color1 = triQuadInterpolate(quad.color1, xRatio, yRatio); float depth = triQuadInterpolate(quad.depth, xRatio, yRatio); // Interpolated color and depth. DE_STATIC_ASSERT(MAX_FRAGMENT_BUFFER_SIZE == DE_LENGTH_OF_ARRAY(m_fragmentBuffer)); if (m_fragmentBufferSize >= MAX_FRAGMENT_BUFFER_SIZE) flushFragmentBuffer(rr::MultisamplePixelBufferAccess::fromMultisampleAccess(colorBuffer), rr::MultisamplePixelBufferAccess::fromMultisampleAccess(depthBuffer), rr::MultisamplePixelBufferAccess::fromMultisampleAccess(stencilBuffer), faceType, state); m_fragmentDepths[m_fragmentBufferSize] = depth; m_fragmentBuffer[m_fragmentBufferSize] = rr::Fragment(tcu::IVec2(x, y), rr::GenericVec4(color), rr::GenericVec4(color1), 1u /* coverage mask */, &m_fragmentDepths[m_fragmentBufferSize]); m_fragmentBufferSize++; } } flushFragmentBuffer(rr::MultisamplePixelBufferAccess::fromMultisampleAccess(colorBuffer), rr::MultisamplePixelBufferAccess::fromMultisampleAccess(depthBuffer), rr::MultisamplePixelBufferAccess::fromMultisampleAccess(stencilBuffer), faceType, state); }
void BooleanStateQueryTests::init (void) { DE_ASSERT(m_verifierIsEnabled == DE_NULL); DE_ASSERT(m_verifierBoolean == DE_NULL); DE_ASSERT(m_verifierInteger == DE_NULL); DE_ASSERT(m_verifierInteger64 == DE_NULL); DE_ASSERT(m_verifierFloat == DE_NULL); m_verifierIsEnabled = new IsEnabledVerifier (m_context.getRenderContext().getFunctions(), m_context.getTestContext().getLog()); m_verifierBoolean = new GetBooleanVerifier (m_context.getRenderContext().getFunctions(), m_context.getTestContext().getLog()); m_verifierInteger = new GetIntegerVerifier (m_context.getRenderContext().getFunctions(), m_context.getTestContext().getLog()); m_verifierInteger64 = new GetInteger64Verifier (m_context.getRenderContext().getFunctions(), m_context.getTestContext().getLog()); m_verifierFloat = new GetFloatVerifier (m_context.getRenderContext().getFunctions(), m_context.getTestContext().getLog()); StateVerifier* isEnabledVerifiers[] = {m_verifierIsEnabled, m_verifierBoolean, m_verifierInteger, m_verifierInteger64, m_verifierFloat}; StateVerifier* normalVerifiers[] = {m_verifierBoolean, m_verifierInteger, m_verifierInteger64, m_verifierFloat}; struct StateBoolean { const char* name; const char* description; GLenum targetName; bool value; }; const StateBoolean isEnableds[] = { { "primitive_restart_fixed_index", "PRIMITIVE_RESTART_FIXED_INDEX", GL_PRIMITIVE_RESTART_FIXED_INDEX, false}, { "rasterizer_discard", "RASTERIZER_DISCARD", GL_RASTERIZER_DISCARD, false}, { "cull_face", "CULL_FACE", GL_CULL_FACE, false}, { "polygon_offset_fill", "POLYGON_OFFSET_FILL", GL_POLYGON_OFFSET_FILL, false}, { "sample_alpha_to_coverage", "SAMPLE_ALPHA_TO_COVERAGE", GL_SAMPLE_ALPHA_TO_COVERAGE, false}, { "sample_coverage", "SAMPLE_COVERAGE", GL_SAMPLE_COVERAGE, false}, { "scissor_test", "SCISSOR_TEST", GL_SCISSOR_TEST, false}, { "stencil_test", "STENCIL_TEST", GL_STENCIL_TEST, false}, { "depth_test", "DEPTH_TEST", GL_DEPTH_TEST, false}, { "blend", "BLEND", GL_BLEND, false}, { "dither", "DITHER", GL_DITHER, true }, }; for (int testNdx = 0; testNdx < DE_LENGTH_OF_ARRAY(isEnableds); testNdx++) { FOR_EACH_VERIFIER(isEnabledVerifiers, addChild(new IsEnabledStateTestCase(m_context, verifier, (std::string(isEnableds[testNdx].name) + verifier->getTestNamePostfix()).c_str(), isEnableds[testNdx].description, isEnableds[testNdx].targetName, isEnableds[testNdx].value))); } FOR_EACH_VERIFIER(normalVerifiers, addChild(new ColorMaskTestCase (m_context, verifier, (std::string("color_writemask") + verifier->getTestNamePostfix()).c_str(), "COLOR_WRITEMASK"))); FOR_EACH_VERIFIER(normalVerifiers, addChild(new DepthWriteMaskTestCase (m_context, verifier, (std::string("depth_writemask") + verifier->getTestNamePostfix()).c_str(), "DEPTH_WRITEMASK"))); FOR_EACH_VERIFIER(normalVerifiers, addChild(new SampleCoverageInvertTestCase (m_context, verifier, (std::string("sample_coverage_invert") + verifier->getTestNamePostfix()).c_str(), "SAMPLE_COVERAGE_INVERT"))); FOR_EACH_VERIFIER(normalVerifiers, addChild(new InitialBooleanTestCase (m_context, verifier, (std::string("shader_compiler") + verifier->getTestNamePostfix()).c_str(), "SHADER_COMPILER", GL_SHADER_COMPILER, true))); FOR_EACH_VERIFIER(normalVerifiers, addChild(new InitialBooleanTestCase (m_context, verifier, (std::string("transform_feedback_active_initial") + verifier->getTestNamePostfix()).c_str(), "initial TRANSFORM_FEEDBACK_ACTIVE", GL_TRANSFORM_FEEDBACK_ACTIVE, false))); FOR_EACH_VERIFIER(normalVerifiers, addChild(new InitialBooleanTestCase (m_context, verifier, (std::string("transform_feedback_paused_initial") + verifier->getTestNamePostfix()).c_str(), "initial TRANSFORM_FEEDBACK_PAUSED", GL_TRANSFORM_FEEDBACK_PAUSED, false))); FOR_EACH_VERIFIER(normalVerifiers, addChild(new TransformFeedbackBasicTestCase (m_context, verifier, (std::string("transform_feedback") + verifier->getTestNamePostfix()).c_str()))); FOR_EACH_VERIFIER(normalVerifiers, addChild(new TransformFeedbackImplicitResumeTestCase (m_context, verifier, (std::string("transform_feedback_implicit_resume") + verifier->getTestNamePostfix()).c_str()))); }
static const char* getLoopTypeName (LoopType loopType) { static const char* s_names[] = { "for", "while", "do_while" }; DE_STATIC_ASSERT(DE_LENGTH_OF_ARRAY(s_names) == LOOPTYPE_LAST); DE_ASSERT(deInBounds32((int)loopType, 0, LOOPTYPE_LAST)); return s_names[(int)loopType]; }
GLW_APICALL void GLW_APIENTRY glGetInternalformativ (GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint* params) { static const int s_sampleCounts[] = { 16, 8, 4, 2, 1 }; DE_UNREF(internalformat); DE_UNREF(target); switch (pname) { case GL_NUM_SAMPLE_COUNTS: if (bufSize >= 1) *params = DE_LENGTH_OF_ARRAY(s_sampleCounts); break; case GL_SAMPLES: deMemcpy(params, s_sampleCounts, de::min(bufSize, DE_LENGTH_OF_ARRAY(s_sampleCounts))); break; default: break; } }
deBool dePoolStringBuilder_appendFormat (dePoolStringBuilder* builder, const char* format, ...) { char buf[512]; va_list args; deBool ok; va_start(args, format); vsnprintf(buf, DE_LENGTH_OF_ARRAY(buf), format, args); ok = dePoolStringBuilder_appendString(builder, buf); va_end(args); return ok; }
static const char* getLoopCountTypeName (LoopCountType countType) { static const char* s_names[] = { "constant", "uniform", "dynamic" }; DE_STATIC_ASSERT(DE_LENGTH_OF_ARRAY(s_names) == LOOPCOUNT_LAST); DE_ASSERT(deInBounds32((int)countType, 0, LOOPCOUNT_LAST)); return s_names[(int)countType]; }
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"); }
/*--------------------------------------------------------------------*//*! * \brief Write an EGL config inside an EGL config set * \see qpElgConfigInfo for details *//*--------------------------------------------------------------------*/ deBool qpTestLog_writeEglConfig (qpTestLog* log, const qpEglConfigInfo* config) { qpXmlAttribute attribs[64]; int numAttribs = 0; DE_ASSERT(log && config); deMutex_lock(log->lock); attribs[numAttribs++] = qpSetIntAttrib ("BufferSize", config->bufferSize); attribs[numAttribs++] = qpSetIntAttrib ("RedSize", config->redSize); attribs[numAttribs++] = qpSetIntAttrib ("GreenSize", config->greenSize); attribs[numAttribs++] = qpSetIntAttrib ("BlueSize", config->blueSize); attribs[numAttribs++] = qpSetIntAttrib ("LuminanceSize", config->luminanceSize); attribs[numAttribs++] = qpSetIntAttrib ("AlphaSize", config->alphaSize); attribs[numAttribs++] = qpSetIntAttrib ("AlphaMaskSize", config->alphaMaskSize); attribs[numAttribs++] = qpSetBoolAttrib ("BindToTextureRGB", config->bindToTextureRGB); attribs[numAttribs++] = qpSetBoolAttrib ("BindToTextureRGBA", config->bindToTextureRGBA); attribs[numAttribs++] = qpSetStringAttrib ("ColorBufferType", config->colorBufferType); attribs[numAttribs++] = qpSetStringAttrib ("ConfigCaveat", config->configCaveat); attribs[numAttribs++] = qpSetIntAttrib ("ConfigID", config->configID); attribs[numAttribs++] = qpSetStringAttrib ("Conformant", config->conformant); attribs[numAttribs++] = qpSetIntAttrib ("DepthSize", config->depthSize); attribs[numAttribs++] = qpSetIntAttrib ("Level", config->level); attribs[numAttribs++] = qpSetIntAttrib ("MaxPBufferWidth", config->maxPBufferWidth); attribs[numAttribs++] = qpSetIntAttrib ("MaxPBufferHeight", config->maxPBufferHeight); attribs[numAttribs++] = qpSetIntAttrib ("MaxPBufferPixels", config->maxPBufferPixels); attribs[numAttribs++] = qpSetIntAttrib ("MaxSwapInterval", config->maxSwapInterval); attribs[numAttribs++] = qpSetIntAttrib ("MinSwapInterval", config->minSwapInterval); attribs[numAttribs++] = qpSetBoolAttrib ("NativeRenderable", config->nativeRenderable); attribs[numAttribs++] = qpSetStringAttrib ("RenderableType", config->renderableType); attribs[numAttribs++] = qpSetIntAttrib ("SampleBuffers", config->sampleBuffers); attribs[numAttribs++] = qpSetIntAttrib ("Samples", config->samples); attribs[numAttribs++] = qpSetIntAttrib ("StencilSize", config->stencilSize); attribs[numAttribs++] = qpSetStringAttrib ("SurfaceTypes", config->surfaceTypes); attribs[numAttribs++] = qpSetStringAttrib ("TransparentType", config->transparentType); attribs[numAttribs++] = qpSetIntAttrib ("TransparentRedValue", config->transparentRedValue); attribs[numAttribs++] = qpSetIntAttrib ("TransparentGreenValue", config->transparentGreenValue); attribs[numAttribs++] = qpSetIntAttrib ("TransparentBlueValue", config->transparentBlueValue); DE_ASSERT(numAttribs <= DE_LENGTH_OF_ARRAY(attribs)); if (!qpXmlWriter_startElement(log->writer, "EglConfig", numAttribs, attribs) || !qpXmlWriter_endElement(log->writer, "EglConfig")) { qpPrintf("qpTestLog_writeEglConfig(): Writing XML failed\n"); deMutex_unlock(log->lock); return DE_FALSE; } deMutex_unlock(log->lock); return DE_TRUE; }
static float compareToNeighbor (const FuzzyCompareParams& params, de::Random& rnd, deUint32 pixel, const ConstPixelBufferAccess& surface, int x, int y) { float minErr = +100.f; // (x, y) + (0, 0) minErr = deFloatMin(minErr, compareColors(pixel, readUnorm8<NumChannels>(surface, x, y), params.minErrThreshold)); if (minErr == 0.0f) return minErr; // Area around (x, y) static const int s_coords[][2] = { {-1, -1}, { 0, -1}, {+1, -1}, {-1, 0}, {+1, 0}, {-1, +1}, { 0, +1}, {+1, +1} }; for (int d = 0; d < (int)DE_LENGTH_OF_ARRAY(s_coords); d++) { int dx = x + s_coords[d][0]; int dy = y + s_coords[d][1]; if (!deInBounds32(dx, 0, surface.getWidth()) || !deInBounds32(dy, 0, surface.getHeight())) continue; minErr = deFloatMin(minErr, compareColors(pixel, readUnorm8<NumChannels>(surface, dx, dy), params.minErrThreshold)); if (minErr == 0.0f) return minErr; } // Random bilinear-interpolated samples around (x, y) for (int s = 0; s < 32; s++) { float dx = (float)x + rnd.getFloat()*2.0f - 0.5f; float dy = (float)y + rnd.getFloat()*2.0f - 0.5f; deUint32 sample = bilinearSample<NumChannels>(surface, dx, dy); minErr = deFloatMin(minErr, compareColors(pixel, sample, params.minErrThreshold)); if (minErr == 0.0f) return minErr; } return minErr; }
static const char* getShaderTypePostfix (glu::ShaderType shaderType) { static const char* s_postfix[] = { "_vertex", "_fragment", "_geometry", "_tess_control", "_tess_eval", "_compute" }; DE_ASSERT(de::inBounds<int>(shaderType, 0, DE_LENGTH_OF_ARRAY(s_postfix))); return s_postfix[shaderType]; }
void deSemaphore_destroy (deSemaphore semaphore) { NamedSemaphore* sem = (NamedSemaphore*)semaphore; char name[128]; int res; NamedSemaphore_getName(sem, name, DE_LENGTH_OF_ARRAY(name)); res = sem_close(sem->semaphore); DE_ASSERT(res == 0); res = sem_unlink(name); DE_ASSERT(res == 0); DE_UNREF(res); deFree(sem); }
/*--------------------------------------------------------------------*//*! * \brief Write a message to output log * \param log qpTestLog instance * \param format Format string of message * \param ... Parameters for message * \return true if ok, false otherwise *//*--------------------------------------------------------------------*/ deBool qpTestLog_writeMessage (qpTestLog* log, const char* format, ...) { char buffer[1024]; va_list args; /* \todo [petri] Handle buffer overflows! */ va_start(args, format); buffer[DE_LENGTH_OF_ARRAY(buffer) - 1] = 0; vsnprintf(buffer, sizeof(buffer), format, args); va_end(args); printf("%s\n", buffer); /* <Text>text</Text> */ return qpTestLog_writeKeyValuePair(log, "Text", DE_NULL, DE_NULL, DE_NULL, QP_KEY_TAG_LAST, buffer); }
static const char* getMessageTypeName (MessageType type) { static const char* s_names[] = { "RESUME", "PAUSE", "FINISH", "WINDOW_CREATED", "WINDOW_RESIZED", "WINDOW_DESTROYED", "INPUT_QUEUE_CREATED", "INPUT_QUEUE_DESTROYED", "SYNC" }; DE_STATIC_ASSERT(DE_LENGTH_OF_ARRAY(s_names) == MESSAGETYPE_LAST); return s_names[type]; }