#include "main/texgetimage.h"
#include "main/teximage.h"
#include "main/texobj.h"
+#include "main/texstorage.h"
#include "main/texstore.h"
#include "main/bufferobj.h"
#include "main/fbobject.h"
driver->EndCallList = NULL;
/* GL_ARB_texture_storage */
- driver->AllocTextureStorage = _swrast_AllocTextureStorage;
+ driver->AllocTextureStorage = _mesa_alloc_texture_storage;
/* GL_ARB_texture_multisample */
driver->GetSamplePosition = NULL;
return true;
}
-/**
- * Called via ctx->Driver.AllocTextureStorage()
- * Just have to allocate memory for the texture images.
- */
-static GLboolean
-intel_alloc_texture_storage(struct gl_context *ctx,
- struct gl_texture_object *texObj,
- GLsizei levels, GLsizei width,
- GLsizei height, GLsizei depth)
-{
- const int numFaces = _mesa_num_tex_faces(texObj->Target);
- int face;
- int level;
-
- for (face = 0; face < numFaces; face++) {
- for (level = 0; level < levels; level++) {
- struct gl_texture_image *const texImage = texObj->Image[face][level];
- if (!intel_alloc_texture_image_buffer(ctx, texImage))
- return false;
- }
- }
-
- return true;
-}
-
static void
intel_free_texture_image_buffer(struct gl_context * ctx,
struct gl_texture_image *texImage)
functions->DeleteTexture = intelDeleteTextureObject;
functions->AllocTextureImageBuffer = intel_alloc_texture_image_buffer;
functions->FreeTextureImageBuffer = intel_free_texture_image_buffer;
- functions->AllocTextureStorage = intel_alloc_texture_storage;
functions->MapTextureImage = intel_map_texture_image;
functions->UnmapTextureImage = intel_unmap_texture_image;
}
}
}
+/**
+ * Default ctx->Driver.AllocTextureStorage() handler.
+ *
+ * The driver can override this with a more specific implementation if it
+ * desires, but this can be used to get the texture images allocated using the
+ * usual texture image handling code. The immutability of
+ * GL_ARB_texture_storage texture layouts is handled by texObj->Immutable
+ * checks at glTexImage* time.
+ */
+GLboolean
+_mesa_alloc_texture_storage(struct gl_context *ctx,
+ struct gl_texture_object *texObj,
+ GLsizei levels, GLsizei width,
+ GLsizei height, GLsizei depth)
+{
+ const int numFaces = _mesa_num_tex_faces(texObj->Target);
+ int face;
+ int level;
+
+ for (face = 0; face < numFaces; face++) {
+ for (level = 0; level < levels; level++) {
+ struct gl_texture_image *const texImage = texObj->Image[face][level];
+ if (!ctx->Driver.AllocTextureImageBuffer(ctx, texImage))
+ return GL_FALSE;
+ }
+ }
+
+ return GL_TRUE;
+}
+
/**
* Do error checking for calls to glTexStorage1/2/3D().
extern GLboolean
_mesa_is_legal_tex_storage_format(struct gl_context *ctx, GLenum internalformat);
+extern GLboolean
+_mesa_alloc_texture_storage(struct gl_context *ctx,
+ struct gl_texture_object *texObj,
+ GLsizei levels, GLsizei width,
+ GLsizei height, GLsizei depth);
#endif /* TEXSTORAGE_H */
enabledUnits &= ~(1 << unit);
}
}
-
-
-/**
- * Called via ctx->Driver.AllocTextureStorage()
- * Just have to allocate memory for the texture images.
- */
-GLboolean
-_swrast_AllocTextureStorage(struct gl_context *ctx,
- struct gl_texture_object *texObj,
- GLsizei levels, GLsizei width,
- GLsizei height, GLsizei depth)
-{
- const GLint numFaces = (texObj->Target == GL_TEXTURE_CUBE_MAP) ? 6 : 1;
- GLint face, level;
-
- for (face = 0; face < numFaces; face++) {
- for (level = 0; level < levels; level++) {
- struct gl_texture_image *texImage = texObj->Image[face][level];
- if (!_swrast_alloc_texture_image_buffer(ctx, texImage)) {
- return GL_FALSE;
- }
- }
- }
-
- return GL_TRUE;
-}
-
struct gl_renderbuffer_attachment *att);
-
-extern GLboolean
-_swrast_AllocTextureStorage(struct gl_context *ctx,
- struct gl_texture_object *texObj,
- GLsizei levels, GLsizei width,
- GLsizei height, GLsizei depth);
-
-
/**
* The driver interface for the software rasterizer.
* XXX this may go away.