Lines Matching refs:Texture
133 static Framebuffer::TexTarget texLayeredTypeToTarget (Texture::Type type)
137 case Texture::TYPE_2D_ARRAY: return Framebuffer::TEXTARGET_2D_ARRAY;
138 case Texture::TYPE_3D: return Framebuffer::TEXTARGET_3D;
139 case Texture::TYPE_CUBE_MAP_ARRAY: return Framebuffer::TEXTARGET_CUBE_MAP_ARRAY;
179 TCU_FAIL("Can't map pixel format to texture format");
262 // Limit texture sizes to supported values
388 // Create empty textures to be used when texture objects are incomplete.
459 vector<Texture*> textures;
461 for (vector<Texture*>::iterator i = textures.begin(); i != textures.end(); i++)
494 void ReferenceContext::activeTexture (deUint32 texture)
496 if (deInBounds32(texture, GL_TEXTURE0, GL_TEXTURE0 + (deUint32)m_textureUnits.size()))
497 m_activeTexture = texture - GL_TEXTURE0;
502 void ReferenceContext::setTex1DBinding (int unitNdx, Texture1D* texture)
510 if (texture)
512 m_textures.acquireReference(texture);
513 m_textureUnits[unitNdx].tex1DBinding = texture;
517 void ReferenceContext::setTex2DBinding (int unitNdx, Texture2D* texture)
525 if (texture)
527 m_textures.acquireReference(texture);
528 m_textureUnits[unitNdx].tex2DBinding = texture;
532 void ReferenceContext::setTexCubeBinding (int unitNdx, TextureCube* texture)
540 if (texture)
542 m_textures.acquireReference(texture);
543 m_textureUnits[unitNdx].texCubeBinding = texture;
547 void ReferenceContext::setTex2DArrayBinding (int unitNdx, Texture2DArray* texture)
555 if (texture)
557 m_textures.acquireReference(texture);
558 m_textureUnits[unitNdx].tex2DArrayBinding = texture;
562 void ReferenceContext::setTex3DBinding (int unitNdx, Texture3D* texture)
570 if (texture)
572 m_textures.acquireReference(texture);
573 m_textureUnits[unitNdx].tex3DBinding = texture;
577 void ReferenceContext::setTexCubeArrayBinding (int unitNdx, TextureCubeArray* texture)
585 if (texture)
587 m_textures.acquireReference(texture);
588 m_textureUnits[unitNdx].texCubeArrayBinding = texture;
592 void ReferenceContext::bindTexture (deUint32 target, deUint32 texture)
606 if (texture == 0)
623 Texture* texObj = m_textures.find(texture);
628 Texture::Type expectedType = Texture::TYPE_LAST;
631 case GL_TEXTURE_1D: expectedType = Texture::TYPE_1D; break;
632 case GL_TEXTURE_2D: expectedType = Texture::TYPE_2D; break;
633 case GL_TEXTURE_CUBE_MAP: expectedType = Texture::TYPE_CUBE_MAP; break;
634 case GL_TEXTURE_2D_ARRAY: expectedType = Texture::TYPE_2D_ARRAY; break;
635 case GL_TEXTURE_3D: expectedType = Texture::TYPE_3D; break;
636 case GL_TEXTURE_CUBE_MAP_ARRAY: expectedType = Texture::TYPE_CUBE_MAP_ARRAY; break;
644 // New texture object.
647 case GL_TEXTURE_1D: texObj = new Texture1D (texture); break;
648 case GL_TEXTURE_2D: texObj = new Texture2D (texture); break;
649 case GL_TEXTURE_CUBE_MAP: texObj = new TextureCube (texture); break;
650 case GL_TEXTURE_2D_ARRAY: texObj = new Texture2DArray (texture); break;
651 case GL_TEXTURE_3D: texObj = new Texture3D (texture); break;
652 case GL_TEXTURE_CUBE_MAP_ARRAY: texObj = new TextureCubeArray (texture); break;
685 Texture* texture = name ? m_textures.find(name) : DE_NULL;
687 if (texture)
688 deleteTexture(texture);
692 void ReferenceContext::deleteTexture (Texture* texture)
697 if (m_textureUnits[unitNdx].tex1DBinding == texture) setTex1DBinding (unitNdx, DE_NULL);
698 else if (m_textureUnits[unitNdx].tex2DBinding == texture) setTex2DBinding (unitNdx, DE_NULL);
699 else if (m_textureUnits[unitNdx].texCubeBinding == texture) setTexCubeBinding (unitNdx, DE_NULL);
700 else if (m_textureUnits[unitNdx].tex2DArrayBinding == texture) setTex2DArrayBinding (unitNdx, DE_NULL);
701 else if (m_textureUnits[unitNdx].tex3DBinding == texture) setTex3DBinding (unitNdx, DE_NULL);
702 else if (m_textureUnits[unitNdx].texCubeArrayBinding == texture) setTexCubeArrayBinding (unitNdx, DE_NULL);
717 if (attachment.name == texture->getName())
727 DE_ASSERT(texture->getRefCount() == 1);
728 m_textures.releaseReference(texture);
1048 Texture1D* texture = unit.tex1DBinding ? unit.tex1DBinding : &unit.default1DTex;
1050 if (texture->isImmutable())
1052 RC_IF_ERROR(!texture->hasLevel(level), GL_INVALID_OPERATION, RC_RET_VOID);
1054 ConstPixelBufferAccess dst(texture->getLevel(level));
1059 texture->allocLevel(level, storageFmt, width);
1064 PixelBufferAccess dst (texture->getLevel(level));
1074 clearToTextureInitialValue(texture->getLevel(level));
1083 Texture2D* texture = unit.tex2DBinding ? unit.tex2DBinding : &unit.default2DTex;
1085 if (texture->isImmutable())
1087 RC_IF_ERROR(!texture->hasLevel(level), GL_INVALID_OPERATION, RC_RET_VOID);
1089 ConstPixelBufferAccess dst(texture->getLevel(level));
1095 texture->allocLevel(level, storageFmt, width, height);
1100 PixelBufferAccess dst (texture->getLevel(level));
1110 clearToTextureInitialValue(texture->getLevel(level));
1124 TextureCube* texture = unit.texCubeBinding ? unit.texCubeBinding : &unit.defaultCubeTex;
1127 if (texture->isImmutable())
1129 RC_IF_ERROR(!texture->hasFace(level, face), GL_INVALID_OPERATION, RC_RET_VOID);
1131 ConstPixelBufferAccess dst(texture->getFace(level, face));
1137 texture->allocFace(level, face, storageFmt, width, height);
1142 PixelBufferAccess dst (texture->getFace(level, face));
1152 clearToTextureInitialValue(texture->getFace(level, face));
1163 Texture2DArray* texture = unit.tex2DArrayBinding ? unit.tex2DArrayBinding : &unit.default2DArrayTex;
1165 if (texture->isImmutable())
1167 RC_IF_ERROR(!texture->hasLevel(level), GL_INVALID_OPERATION, RC_RET_VOID);
1169 ConstPixelBufferAccess dst(texture->getLevel(level));
1176 texture->allocLevel(level, storageFmt, width, height, depth);
1181 PixelBufferAccess dst (texture->getLevel(level));
1191 clearToTextureInitialValue(texture->getLevel(level));
1202 Texture3D* texture = unit.tex3DBinding ? unit.tex3DBinding : &unit.default3DTex;
1204 if (texture->isImmutable())
1206 RC_IF_ERROR(!texture->hasLevel(level), GL_INVALID_OPERATION, RC_RET_VOID);
1208 ConstPixelBufferAccess dst(texture->getLevel(level));
1215 texture->allocLevel(level, storageFmt, width, height, depth);
1220 PixelBufferAccess dst (texture->getLevel(level));
1230 clearToTextureInitialValue(texture->getLevel(level));
1242 TextureCubeArray* texture = unit.texCubeArrayBinding ? unit.texCubeArrayBinding : &unit.defaultCubeArrayTex;
1244 if (texture->isImmutable())
1246 RC_IF_ERROR(!texture->hasLevel(level), GL_INVALID_OPERATION, RC_RET_VOID);
1248 ConstPixelBufferAccess dst(texture->getLevel(level));
1255 texture->allocLevel(level, storageFmt, width, height, depth);
1260 PixelBufferAccess dst (texture->getLevel(level));
1270 clearToTextureInitialValue(texture->getLevel(level));
1302 Texture1D& texture = unit.tex1DBinding ? *unit.tex1DBinding : unit.default1DTex;
1304 RC_IF_ERROR(!texture.hasLevel(level), GL_INVALID_VALUE, RC_RET_VOID);
1306 PixelBufferAccess dst = texture.getLevel(level);
1321 Texture2D& texture = unit.tex2DBinding ? *unit.tex2DBinding : unit.default2DTex;
1323 RC_IF_ERROR(!texture.hasLevel(level), GL_INVALID_VALUE, RC_RET_VOID);
1325 PixelBufferAccess dst = texture.getLevel(level);
1345 TextureCube& texture = unit.texCubeBinding ? *unit.texCubeBinding : unit.defaultCubeTex;
1348 RC_IF_ERROR(!texture.hasFace(level, face), GL_INVALID_VALUE, RC_RET_VOID);
1350 PixelBufferAccess dst = texture.getFace(level, face);
1365 Texture3D& texture = unit.tex3DBinding ? *unit.tex3DBinding : unit.default3DTex;
1367 RC_IF_ERROR(!texture.hasLevel(level), GL_INVALID_VALUE, RC_RET_VOID);
1369 PixelBufferAccess dst = texture.getLevel(level);
1384 Texture2DArray& texture = unit.tex2DArrayBinding ? *unit.tex2DArrayBinding : unit.default2DArrayTex;
1386 RC_IF_ERROR(!texture.hasLevel(level), GL_INVALID_VALUE, RC_RET_VOID);
1388 PixelBufferAccess dst = texture.getLevel(level);
1403 TextureCubeArray& texture = unit.texCubeArrayBinding ? *unit.texCubeArrayBinding : unit.defaultCubeArrayTex;
1405 RC_IF_ERROR(!texture.hasLevel(level), GL_INVALID_VALUE, RC_RET_VOID);
1407 PixelBufferAccess dst = texture.getLevel(level);
1445 Texture1D* texture = unit.tex1DBinding ? unit.tex1DBinding : &unit.default1DTex;
1447 if (texture->isImmutable())
1449 RC_IF_ERROR(!texture->hasLevel(level), GL_INVALID_OPERATION, RC_RET_VOID);
1451 ConstPixelBufferAccess dst(texture->getLevel(level));
1456 texture->allocLevel(level, storageFmt, width);
1459 PixelBufferAccess dst = texture->getLevel(level);
1493 Texture2D* texture = unit.tex2DBinding ? unit.tex2DBinding : &unit.default2DTex;
1495 if (texture->isImmutable())
1497 RC_IF_ERROR(!texture->hasLevel(level), GL_INVALID_OPERATION, RC_RET_VOID);
1499 ConstPixelBufferAccess dst(texture->getLevel(level));
1505 texture->allocLevel(level, storageFmt, width, height);
1508 PixelBufferAccess dst = texture->getLevel(level);
1529 TextureCube* texture = unit.texCubeBinding ? unit.texCubeBinding : &unit.defaultCubeTex;
1532 if (texture->isImmutable())
1534 RC_IF_ERROR(!texture->hasFace(level, face), GL_INVALID_OPERATION, RC_RET_VOID);
1536 ConstPixelBufferAccess dst(texture->getFace(level, face));
1542 texture->allocFace(level, face, storageFmt, width, height);
1545 PixelBufferAccess dst = texture->getFace(level, face);
1570 Texture1D& texture = unit.tex1DBinding ? *unit.tex1DBinding : unit.default1DTex;
1572 RC_IF_ERROR(!texture.hasLevel(level), GL_INVALID_VALUE, RC_RET_VOID);
1574 PixelBufferAccess dst = texture.getLevel(level);
1601 Texture2D& texture = unit.tex2DBinding ? *unit.tex2DBinding : unit.default2DTex;
1603 RC_IF_ERROR(!texture.hasLevel(level), GL_INVALID_VALUE, RC_RET_VOID);
1605 PixelBufferAccess dst = texture.getLevel(level);
1627 TextureCube& texture = unit.texCubeBinding ? *unit.texCubeBinding : unit.defaultCubeTex;
1630 RC_IF_ERROR(!texture.hasFace(level, face), GL_INVALID_VALUE, RC_RET_VOID);
1632 PixelBufferAccess dst = texture.getFace(level, face);
1672 Texture2D& texture = unit.tex2DBinding ? *unit.tex2DBinding : unit.default2DTex;
1675 RC_IF_ERROR(texture.isImmutable(), GL_INVALID_OPERATION, RC_RET_VOID);
1677 texture.clearLevels();
1678 texture.setImmutable();
1685 texture.allocLevel(level, storageFmt, levelW, levelH);
1690 TextureCube& texture = unit.texCubeBinding ? *unit.texCubeBinding : unit.defaultCubeTex;
1693 RC_IF_ERROR(texture.isImmutable(), GL_INVALID_OPERATION, RC_RET_VOID);
1695 texture.clearLevels();
1696 texture.setImmutable();
1704 texture.allocFace(level, (tcu::CubeFace)face, storageFmt, levelW, levelH);
1726 Texture2DArray& texture = unit.tex2DArrayBinding ? *unit.tex2DArrayBinding : unit.default2DArrayTex;
1731 RC_IF_ERROR(texture.isImmutable(), GL_INVALID_OPERATION, RC_RET_VOID);
1733 texture.clearLevels();
1734 texture.setImmutable();
1741 texture.allocLevel(level, storageFmt, levelW, levelH, depth);
1746 Texture3D& texture = unit.tex3DBinding ? *unit.tex3DBinding : unit.default3DTex;
1751 RC_IF_ERROR(texture.isImmutable(), GL_INVALID_OPERATION, RC_RET_VOID);
1753 texture.clearLevels();
1754 texture.setImmutable();
1762 texture.allocLevel(level, storageFmt, levelW, levelH, levelD);
1767 TextureCubeArray& texture = unit.texCubeArrayBinding ? *unit.texCubeArrayBinding : unit.defaultCubeArrayTex;
1773 RC_IF_ERROR(texture.isImmutable(), GL_INVALID_OPERATION, RC_RET_VOID);
1775 texture.clearLevels();
1776 texture.setImmutable();
1783 texture.allocLevel(level, storageFmt, levelW, levelH, depth);
1820 Texture* texture = DE_NULL;
1824 case GL_TEXTURE_1D: texture = unit.tex1DBinding ? unit.tex1DBinding : &unit.default1DTex; break;
1825 case GL_TEXTURE_2D: texture = unit.tex2DBinding ? unit.tex2DBinding : &unit.default2DTex; break;
1826 case GL_TEXTURE_CUBE_MAP: texture = unit.texCubeBinding ? unit.texCubeBinding : &unit.defaultCubeTex; break;
1827 case GL_TEXTURE_2D_ARRAY: texture = unit.tex2DArrayBinding ? unit.tex2DArrayBinding : &unit.default2DArrayTex; break;
1828 case GL_TEXTURE_3D: texture = unit.tex3DBinding ? unit.tex3DBinding : &unit.default3DTex; break;
1829 case GL_TEXTURE_CUBE_MAP_ARRAY: texture = unit.texCubeArrayBinding ? unit.texCubeArrayBinding : &unit.defaultCubeArrayTex; break;
1840 texture->getSampler().wrapS = wrapS;
1848 texture->getSampler().wrapT = wrapT;
1856 texture->getSampler().wrapR = wrapR;
1864 texture->getSampler().minFilter = minMode;
1873 texture->getSampler().magFilter = magMode;
1880 texture->setMaxLevel(value);
1922 Texture* texture = m_textures.find(attachment.name);
1923 TCU_CHECK(texture);
1924 m_textures.acquireReference(texture);
1949 Texture* texture = m_textures.find(attachment.name);
1950 TCU_CHECK(texture);
1951 m_textures.releaseReference(texture);
1969 void ReferenceContext::framebufferTexture2D (deUint32 target, deUint32 attachment, deUint32 textarget, deUint32 texture, int level)
1974 framebufferTexture2D(target, GL_DEPTH_ATTACHMENT, textarget, texture, level);
1975 framebufferTexture2D(target, GL_STENCIL_ATTACHMENT, textarget, texture, level);
1980 Texture* texObj = DE_NULL;
1996 if (texture != 0)
1998 texObj = m_textures.find(texture);
2003 if (texObj->getType() == Texture::TYPE_2D)
2007 TCU_CHECK(texObj->getType() == Texture::TYPE_CUBE_MAP);
2031 void ReferenceContext::framebufferTextureLayer (deUint32 target, deUint32 attachment, deUint32 texture, int level, int layer)
2036 framebufferTextureLayer(target, GL_DEPTH_ATTACHMENT, texture, level, layer);
2037 framebufferTextureLayer(target, GL_STENCIL_ATTACHMENT, texture, level, layer);
2042 Texture* texObj = DE_NULL;
2057 if (texture != 0)
2059 texObj = m_textures.find(texture);
2064 RC_IF_ERROR(texObj->getType() != Texture::TYPE_2D_ARRAY &&
2065 texObj->getType() != Texture::TYPE_3D &&
2066 texObj->getType() != Texture::TYPE_CUBE_MAP_ARRAY, GL_INVALID_OPERATION, RC_RET_VOID);
2068 if (texObj->getType() == Texture::TYPE_2D_ARRAY || texObj->getType() == Texture::TYPE_CUBE_MAP_ARRAY)
2073 else if (texObj->getType() == Texture::TYPE_3D)
2179 const Texture* texture = m_textures.find(attachment.name);
2181 TCU_CHECK(texture);
2185 DE_ASSERT(texture->getType() == Texture::TYPE_2D);
2186 const Texture2D* tex2D = static_cast<const Texture2D*>(texture);
2194 DE_ASSERT(texture->getType() == Texture::TYPE_CUBE_MAP);
2196 const TextureCube* texCube = static_cast<const TextureCube*>(texture);
2205 DE_ASSERT(texture->getType() == Texture::TYPE_2D_ARRAY);
2206 const Texture2DArray* tex2DArr = static_cast<const Texture2DArray*>(texture);
2213 DE_ASSERT(texture->getType() == Texture::TYPE_3D);
2214 const Texture3D* tex3D = static_cast<const Texture3D*>(texture);
2221 DE_ASSERT(texture->getType() == Texture::TYPE_CUBE_MAP_ARRAY);
2222 const TextureCubeArray* texCubeArr = static_cast<const TextureCubeArray*>(texture);
2228 TCU_FAIL("Framebuffer attached to a texture but no valid target specified");
2338 Texture* texture = m_textures.find(attachment.name);
2339 TCU_CHECK(texture);
2341 if (texture->getType() == Texture::TYPE_2D)
2342 return dynamic_cast<Texture2D*>(texture)->getLevel(attachment.level);
2343 else if (texture->getType() == Texture::TYPE_CUBE_MAP)
2344 return dynamic_cast<TextureCube*>(texture)->getFace(attachment.level, texTargetToFace(attachment.texTarget));
2345 else if (texture->getType() == Texture::TYPE_2D_ARRAY ||
2346 texture->getType() == Texture::TYPE_3D ||
2347 texture->getType() == Texture::TYPE_CUBE_MAP_ARRAY)
2351 if (texture->getType() == Texture::TYPE_2D_ARRAY)
2352 level = dynamic_cast<Texture2DArray*>(texture)->getLevel(attachment.level);
2353 else if (texture->getType() == Texture::TYPE_3D)
2354 level = dynamic_cast<Texture3D*>(texture)->getLevel(attachment.level);
2355 else if (texture->getType() == Texture::TYPE_CUBE_MAP_ARRAY)
2356 level = dynamic_cast<TextureCubeArray*>(texture)->getLevel(attachment.level);
3792 // \note texture unit is stored to value
4708 Texture::Texture (deUint32 name, Type type)
4730 : Texture (name, TYPE_1D)
4827 : Texture (name, TYPE_2D)
4931 : Texture(name, TYPE_CUBE_MAP)
5059 : Texture (name, TYPE_2D_ARRAY)
5164 : Texture (name, TYPE_CUBE_MAP_ARRAY)
5285 : Texture (name, TYPE_3D)