Beispiel #1
0
///////////////////////////////////////////////////////////////////////////////
// runOne:  Run a single test case
///////////////////////////////////////////////////////////////////////////////
void
ReadPixSanityTest::runOne(ReadPixSanityResult& r, GLEAN::Window& w) {

	// Many (if not most) other tests need to read the contents of
	// the framebuffer to determine if the correct image has been
	// drawn.  Obviously this is a waste of time if the basic
	// functionality of glReadPixels isn't working.
	//
	// This test does a "sanity" check of glReadPixels.  Using as
	// little of the GL as practicable, it writes a random value
	// in the framebuffer, reads it, and compares the value read
	// with the value written.

	glPixelStorei(GL_PACK_SWAP_BYTES, GL_FALSE);
	glPixelStorei(GL_PACK_LSB_FIRST, GL_FALSE);
	glPixelStorei(GL_PACK_ROW_LENGTH, 0);
	glPixelStorei(GL_PACK_SKIP_ROWS, 0);
	glPixelStorei(GL_PACK_SKIP_PIXELS, 0);
	glPixelStorei(GL_PACK_ALIGNMENT, 1);

	glPixelTransferi(GL_MAP_COLOR, GL_FALSE);
	glPixelTransferi(GL_MAP_STENCIL, GL_FALSE);
	glPixelTransferi(GL_INDEX_SHIFT, 0);
	glPixelTransferi(GL_INDEX_OFFSET, 0);
	glPixelTransferf(GL_RED_SCALE, 1.0);
	glPixelTransferf(GL_GREEN_SCALE, 1.0);
	glPixelTransferf(GL_BLUE_SCALE, 1.0);
	glPixelTransferf(GL_ALPHA_SCALE, 1.0);
	glPixelTransferf(GL_DEPTH_SCALE, 1.0);
	glPixelTransferf(GL_RED_BIAS, 0.0);
	glPixelTransferf(GL_GREEN_BIAS, 0.0);
	glPixelTransferf(GL_BLUE_BIAS, 0.0);
	glPixelTransferf(GL_ALPHA_BIAS, 0.0);
	glPixelTransferf(GL_DEPTH_BIAS, 0.0);

	glDisable(GL_SCISSOR_TEST);
	glDisable(GL_DITHER);

	glIndexMask(~0);
	glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
	glDepthMask(GL_TRUE);
	glStencilMask(~0);

	if (r.config->canRGBA)
		checkRGBA(r, w);
	if (r.config->z)
		checkDepth(r, w);
	if (r.config->s)
		checkStencil(r, w);

	r.pass = r.passRGBA & r.passDepth & r.passStencil & r.passIndex;
} // ReadPixSanityTest::runOne
Beispiel #2
0
void
EBCoarsen::defineStencil(const LayoutData<IntVectSet>&  a_cfivs)
{
  m_coarsenStencil.define(m_coarsenedFineGrids);
  m_vofIt.define(m_coarsenedFineGrids);
  //make the coarsening stencils
  for (DataIterator dit = m_gridsFine.dataIterator(); dit.ok(); ++dit)
    {
      const EBISBox&    ebisBoxCoar = m_coarsenedFineEBISL[dit()];
      const EBISBox&    ebisBoxFine = m_ebislFine[dit()];
      const Box&         dblBoxCoar = m_coarsenedFineGrids.get(dit());
      //      const Box&         dblBoxFine = m_gridsFine.get(dit());
      const IntVectSet&       cfivs = a_cfivs[dit()];

      //we need to do the coarsening with special care at:
      //  irregular coarse vofs
      //  if refRat < 4, then at coarse vofs (covered by finer) next to the cf interface or domain edge
      const IntVectSet     irregIVS = ebisBoxCoar.getIrregIVS(dblBoxCoar);

      BaseIVFAB<VoFStencil>& coarsenStencilBaseIVFAB = m_coarsenStencil[dit()];
      coarsenStencilBaseIVFAB.define(irregIVS,ebisBoxCoar.getEBGraph(), 1);

      //cache the coarse vof iterator
      m_vofIt[dit()].define(irregIVS,ebisBoxCoar.getEBGraph());

      //loop over the special vofs and build the coarsening stencil
      VoFIterator& vofit = m_vofIt[dit()];
      for (vofit.reset(); vofit.ok(); ++vofit)
        {
          const VolIndex& vofCoar = vofit();
          VoFStencil& coarsenStencil = coarsenStencilBaseIVFAB(vofCoar,0);

          getCoarsenVoFStencil(coarsenStencil,ebisBoxCoar,ebisBoxFine,vofCoar,dit(),cfivs);
          checkStencil(coarsenStencil,1.0);
        }
    }
}