aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers/dri
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2012-08-21 20:22:27 -0600
committerBrian Paul <[email protected]>2012-08-24 06:18:41 -0600
commit46751edca9a95baff81771aa69986fa6e2422ed6 (patch)
treec0022e06d939d20f8e2fd48eace419fbebcc9e9b /src/mesa/drivers/dri
parent8a935d71ff4ded6f3cdd8e06dcd1a5e3de3d3cc0 (diff)
mesa: new _mesa_num_tex_faces() helper
Not a real big help now, but will be useful for the GL_ARB_texture_cube_map_array extension in the future.
Diffstat (limited to 'src/mesa/drivers/dri')
-rw-r--r--src/mesa/drivers/dri/intel/intel_tex.c2
-rw-r--r--src/mesa/drivers/dri/intel/intel_tex_validate.c7
-rw-r--r--src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c4
-rw-r--r--src/mesa/drivers/dri/radeon/radeon_texture.c4
4 files changed, 9 insertions, 8 deletions
diff --git a/src/mesa/drivers/dri/intel/intel_tex.c b/src/mesa/drivers/dri/intel/intel_tex.c
index 4abe9885369..5d938798d9f 100644
--- a/src/mesa/drivers/dri/intel/intel_tex.c
+++ b/src/mesa/drivers/dri/intel/intel_tex.c
@@ -120,7 +120,7 @@ intel_alloc_texture_storage(struct gl_context *ctx,
GLsizei levels, GLsizei width,
GLsizei height, GLsizei depth)
{
- const int numFaces = (texObj->Target == GL_TEXTURE_CUBE_MAP) ? 6 : 1;
+ const int numFaces = _mesa_num_tex_faces(texObj->Target);
int face;
int level;
diff --git a/src/mesa/drivers/dri/intel/intel_tex_validate.c b/src/mesa/drivers/dri/intel/intel_tex_validate.c
index 34bbbb83930..77c93290216 100644
--- a/src/mesa/drivers/dri/intel/intel_tex_validate.c
+++ b/src/mesa/drivers/dri/intel/intel_tex_validate.c
@@ -1,6 +1,7 @@
#include "main/mtypes.h"
#include "main/macros.h"
#include "main/samplerobj.h"
+#include "main/texobj.h"
#include "intel_context.h"
#include "intel_mipmap_tree.h"
@@ -95,7 +96,7 @@ intel_finalize_mipmap_tree(struct intel_context *intel, GLuint unit)
/* Pull in any images not in the object's tree:
*/
- nr_faces = (intelObj->base.Target == GL_TEXTURE_CUBE_MAP) ? 6 : 1;
+ nr_faces = _mesa_num_tex_faces(intelObj->base.Target);
for (face = 0; face < nr_faces; face++) {
for (i = tObj->BaseLevel; i <= intelObj->_MaxLevel; i++) {
struct intel_texture_image *intelImage =
@@ -181,7 +182,7 @@ intel_tex_map_images(struct intel_context *intel,
struct intel_texture_object *intelObj,
GLbitfield mode)
{
- GLuint nr_faces = (intelObj->base.Target == GL_TEXTURE_CUBE_MAP) ? 6 : 1;
+ GLuint nr_faces = _mesa_num_tex_faces(intelObj->base.Target);
int i, face;
DBG("%s\n", __FUNCTION__);
@@ -200,7 +201,7 @@ void
intel_tex_unmap_images(struct intel_context *intel,
struct intel_texture_object *intelObj)
{
- GLuint nr_faces = (intelObj->base.Target == GL_TEXTURE_CUBE_MAP) ? 6 : 1;
+ GLuint nr_faces = _mesa_num_tex_faces(intelObj->base.Target);
int i, face;
for (i = intelObj->base.BaseLevel; i <= intelObj->_MaxLevel; i++) {
diff --git a/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c b/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c
index 0ef6457f513..8901090df8b 100644
--- a/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c
+++ b/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c
@@ -198,7 +198,7 @@ radeon_mipmap_tree* radeon_miptree_create(radeonContextPtr rmesa,
mt->mesaFormat = mesaFormat;
mt->refcount = 1;
mt->target = target;
- mt->faces = (target == GL_TEXTURE_CUBE_MAP) ? 6 : 1;
+ mt->faces = _mesa_num_tex_faces(target);
mt->baseLevel = baseLevel;
mt->numLevels = numLevels;
mt->width0 = width0;
@@ -569,7 +569,7 @@ int radeon_validate_texture_miptree(struct gl_context * ctx,
"%s: Using miptree %p\n", __FUNCTION__, t->mt);
}
- const unsigned faces = texObj->Target == GL_TEXTURE_CUBE_MAP ? 6 : 1;
+ const unsigned faces = _mesa_num_tex_faces(texObj->Target);
unsigned face, level;
radeon_texture_image *img;
/* Validate only the levels that will actually be used during rendering */
diff --git a/src/mesa/drivers/dri/radeon/radeon_texture.c b/src/mesa/drivers/dri/radeon/radeon_texture.c
index 157cc096a31..11b825d9dab 100644
--- a/src/mesa/drivers/dri/radeon/radeon_texture.c
+++ b/src/mesa/drivers/dri/radeon/radeon_texture.c
@@ -750,7 +750,7 @@ radeon_swrast_map_texture_images(struct gl_context *ctx,
struct gl_texture_object *texObj)
{
radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- GLuint nr_faces = (texObj->Target == GL_TEXTURE_CUBE_MAP) ? 6 : 1;
+ GLuint nr_faces = _mesa_num_tex_faces(texObj->Target);
int i, face;
for (i = texObj->BaseLevel; i <= texObj->_MaxLevel; i++) {
@@ -766,7 +766,7 @@ radeon_swrast_unmap_texture_images(struct gl_context *ctx,
struct gl_texture_object *texObj)
{
radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
- GLuint nr_faces = (texObj->Target == GL_TEXTURE_CUBE_MAP) ? 6 : 1;
+ GLuint nr_faces = _mesa_num_tex_faces(texObj->Target);
int i, face;
for (i = texObj->BaseLevel; i <= texObj->_MaxLevel; i++) {