From: Mika Isojärvi Date: Thu, 8 Jan 2015 23:20:07 +0000 (-0800) Subject: Expose function for mapping GL cubemap face to tcu::CubeFace X-Git-Tag: upstream/0.1.0~2015 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=07b89ce0885a4a9e02b7057d45a4260d24740ba9;p=platform%2Fupstream%2FVK-GL-CTS.git Expose function for mapping GL cubemap face to tcu::CubeFace Expose and rename function to map GL cubemap face target to tcu::CubeFace. Change-Id: Ie2a3220c496255dfde18968128edaf20c90d22a1 --- diff --git a/framework/opengl/gluTexture.cpp b/framework/opengl/gluTexture.cpp index c402a50..344a514 100644 --- a/framework/opengl/gluTexture.cpp +++ b/framework/opengl/gluTexture.cpp @@ -343,22 +343,6 @@ TextureCube::~TextureCube (void) m_context.getFunctions().deleteTextures(1, &m_glTexture); } -static deUint32 cubeFaceToGLFace (tcu::CubeFace face) -{ - switch (face) - { - case tcu::CUBEFACE_NEGATIVE_X: return GL_TEXTURE_CUBE_MAP_NEGATIVE_X; - case tcu::CUBEFACE_POSITIVE_X: return GL_TEXTURE_CUBE_MAP_POSITIVE_X; - case tcu::CUBEFACE_NEGATIVE_Y: return GL_TEXTURE_CUBE_MAP_NEGATIVE_Y; - case tcu::CUBEFACE_POSITIVE_Y: return GL_TEXTURE_CUBE_MAP_POSITIVE_Y; - case tcu::CUBEFACE_NEGATIVE_Z: return GL_TEXTURE_CUBE_MAP_NEGATIVE_Z; - case tcu::CUBEFACE_POSITIVE_Z: return GL_TEXTURE_CUBE_MAP_POSITIVE_Z; - default: - DE_ASSERT(DE_FALSE); - return GL_NONE; - } -} - void TextureCube::upload (void) { const glw::Functions& gl = m_context.getFunctions(); @@ -381,7 +365,7 @@ void TextureCube::upload (void) tcu::ConstPixelBufferAccess access = m_refTexture.getLevelFace(levelNdx, (tcu::CubeFace)face); DE_ASSERT(access.getRowPitch() == access.getFormat().getPixelSize()*access.getWidth()); - gl.texImage2D(cubeFaceToGLFace((tcu::CubeFace)face), levelNdx, m_format, access.getWidth(), access.getHeight(), 0 /* border */, transferFormat.format, transferFormat.dataType, access.getDataPtr()); + gl.texImage2D(getGLCubeFace((tcu::CubeFace)face), levelNdx, m_format, access.getWidth(), access.getHeight(), 0 /* border */, transferFormat.format, transferFormat.dataType, access.getDataPtr()); } } @@ -410,7 +394,7 @@ void TextureCube::loadCompressed (int numLevels, const tcu::CompressedTexture* l level.decompress(refLevelAccess, decompressionParams); // Upload to GL texture in compressed form. - gl.compressedTexImage2D(cubeFaceToGLFace((tcu::CubeFace)face), levelNdx, compressedFormat, + gl.compressedTexImage2D(getGLCubeFace((tcu::CubeFace)face), levelNdx, compressedFormat, level.getWidth(), level.getHeight(), 0 /* border */, level.getDataSize(), level.getData()); } } diff --git a/framework/opengl/gluTextureUtil.cpp b/framework/opengl/gluTextureUtil.cpp index e26ab54..ff81272 100644 --- a/framework/opengl/gluTextureUtil.cpp +++ b/framework/opengl/gluTextureUtil.cpp @@ -696,6 +696,21 @@ deUint32 getGLCubeFace (tcu::CubeFace face) } } +tcu::CubeFace getCubeFaceFromGL (deUint32 face) +{ + switch (face) + { + case GL_TEXTURE_CUBE_MAP_NEGATIVE_X: return tcu::CUBEFACE_NEGATIVE_X; + case GL_TEXTURE_CUBE_MAP_POSITIVE_X: return tcu::CUBEFACE_POSITIVE_X; + case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y: return tcu::CUBEFACE_NEGATIVE_Y; + case GL_TEXTURE_CUBE_MAP_POSITIVE_Y: return tcu::CUBEFACE_POSITIVE_Y; + case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z: return tcu::CUBEFACE_NEGATIVE_Z; + case GL_TEXTURE_CUBE_MAP_POSITIVE_Z: return tcu::CUBEFACE_POSITIVE_Z; + default: + throw tcu::InternalError("Can't map cube face"); + } +} + /*--------------------------------------------------------------------*//*! * \brief Get GLSL sampler type for texture format. * diff --git a/framework/opengl/gluTextureUtil.hpp b/framework/opengl/gluTextureUtil.hpp index 6ba71df..2ea448f 100644 --- a/framework/opengl/gluTextureUtil.hpp +++ b/framework/opengl/gluTextureUtil.hpp @@ -73,6 +73,7 @@ deUint32 getGLFilterMode (tcu::Sampler::FilterMode filterMode); deUint32 getGLCompareFunc (tcu::Sampler::CompareMode compareMode); deUint32 getGLCubeFace (tcu::CubeFace face); +tcu::CubeFace getCubeFaceFromGL (deUint32 face); DataType getSampler1DType (tcu::TextureFormat format); DataType getSampler2DType (tcu::TextureFormat format);