diff --git a/src/mesa/main/attrib.c b/src/mesa/main/attrib.c index 4e703722e18..ed9dc52b9a9 100644 --- a/src/mesa/main/attrib.c +++ b/src/mesa/main/attrib.c @@ -62,6 +62,7 @@ #include #include "util/u_memory.h" +#include "state_tracker/st_cb_texture.h" static inline bool copy_texture_attribs(struct gl_texture_object *dst, @@ -597,8 +598,7 @@ pop_texture_group(struct gl_context *ctx, struct gl_texture_attrib_node *texstat continue; /* GL_ALL_ATTRIB_BITS means all pnames. (internal) */ - if (ctx->Driver.TexParameter) - ctx->Driver.TexParameter(ctx, texObj, GL_ALL_ATTRIB_BITS); + st_TexParameter(ctx, texObj, GL_ALL_ATTRIB_BITS); } } diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index fa887d64c56..522ad005a92 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -154,6 +154,7 @@ #include #include "util/u_memory.h" +#include "state_tracker/st_cb_texture.h" #ifndef MESA_VERBOSE int MESA_VERBOSE = 0; @@ -1077,7 +1078,7 @@ _mesa_initialize_dispatch_tables(struct gl_context *ctx) * This includes allocating all the other structs and arrays which hang off of * the context by pointers. * Note that the driver needs to pass in its dd_function_table here since - * we need to at least call driverFunctions->NewTextureObject to create the + * we need to at least call st_NewTextureObject to create the * default texture objects. * * Called by _mesa_create_context(). @@ -1108,9 +1109,6 @@ _mesa_initialize_context(struct gl_context *ctx, struct gl_shared_state *shared; int i; - assert(driverFunctions->NewTextureObject); - assert(driverFunctions->FreeTextureImageBuffer); - ctx->API = api; ctx->DrawBuffer = NULL; ctx->ReadBuffer = NULL; diff --git a/src/mesa/main/dd.h b/src/mesa/main/dd.h index 6c7ff0fd5b9..1fb62f52b01 100644 --- a/src/mesa/main/dd.h +++ b/src/mesa/main/dd.h @@ -194,109 +194,6 @@ struct dd_function_table { GLuint count, const GLubyte *ids); /*@}*/ - - /** - * \name Texture image functions - */ - /*@{*/ - - /** - * Choose actual hardware texture format given the texture target, the - * user-provided source image format and type and the desired internal - * format. In some cases, srcFormat and srcType can be GL_NONE. - * Note: target may be GL_TEXTURE_CUBE_MAP, but never - * GL_TEXTURE_CUBE_MAP_[POSITIVE/NEGATIVE]_[XYZ]. - * Called by glTexImage(), etc. - */ - mesa_format (*ChooseTextureFormat)(struct gl_context *ctx, - GLenum target, GLint internalFormat, - GLenum srcFormat, GLenum srcType ); - - /** - * Queries different driver parameters for a particular target and format. - * Since ARB_internalformat_query2 introduced several new query parameters - * over ARB_internalformat_query, having one driver hook for each parameter - * is no longer feasible. So this is the generic entry-point for calls - * to glGetInternalFormativ and glGetInternalFormati64v, after Mesa has - * checked errors and default values. - * - * \param ctx GL context - * \param target GL target enum - * \param internalFormat GL format enum - * \param pname GL enum that specifies the info to query. - * \param params Buffer to hold the result of the query. - */ - void (*QueryInternalFormat)(struct gl_context *ctx, - GLenum target, - GLenum internalFormat, - GLenum pname, - GLint *params); - - /** - * Called by glTexImage[123]D() and glCopyTexImage[12]D() - * Allocate texture memory and copy the user's image to the buffer. - * The gl_texture_image fields, etc. will be fully initialized. - * The parameters are the same as glTexImage3D(), plus: - * \param dims 1, 2, or 3 indicating glTexImage1/2/3D() - * \param packing describes how to unpack the source data. - * \param texImage is the destination texture image. - */ - void (*TexImage)(struct gl_context *ctx, GLuint dims, - struct gl_texture_image *texImage, - GLenum format, GLenum type, const GLvoid *pixels, - const struct gl_pixelstore_attrib *packing); - - /** - * Called by glTexSubImage[123]D(). - * Replace a subset of the target texture with new texel data. - */ - void (*TexSubImage)(struct gl_context *ctx, GLuint dims, - struct gl_texture_image *texImage, - GLint xoffset, GLint yoffset, GLint zoffset, - GLsizei width, GLsizei height, GLint depth, - GLenum format, GLenum type, - const GLvoid *pixels, - const struct gl_pixelstore_attrib *packing); - - - /** - * Called by glGetTexImage(), glGetTextureSubImage(). - */ - void (*GetTexSubImage)(struct gl_context *ctx, - GLint xoffset, GLint yoffset, GLint zoffset, - GLsizei width, GLsizei height, GLsizei depth, - GLenum format, GLenum type, GLvoid *pixels, - struct gl_texture_image *texImage); - - /** - * Called by glClearTex[Sub]Image - * - * Clears a rectangular region of the image to a given value. The - * clearValue argument is either NULL or points to a single texel to use as - * the clear value in the same internal format as the texture image. If it - * is NULL then the texture should be cleared to zeroes. - */ - void (*ClearTexSubImage)(struct gl_context *ctx, - struct gl_texture_image *texImage, - GLint xoffset, GLint yoffset, GLint zoffset, - GLsizei width, GLsizei height, GLsizei depth, - const GLvoid *clearValue); - - /** - * Called by glCopyTex[Sub]Image[123]D(). - * - * This function should copy a rectangular region in the rb to a single - * destination slice, specified by @slice. In the case of 1D array - * textures (where one GL call can potentially affect multiple destination - * slices), core mesa takes care of calling this function multiple times, - * once for each scanline to be copied. - */ - void (*CopyTexSubImage)(struct gl_context *ctx, GLuint dims, - struct gl_texture_image *texImage, - GLint xoffset, GLint yoffset, GLint slice, - struct gl_renderbuffer *rb, - GLint x, GLint y, - GLsizei width, GLsizei height); /** * Called by glCopyImageSubData(). * @@ -319,131 +216,6 @@ struct dd_function_table { int dst_x, int dst_y, int dst_z, int src_width, int src_height); - /** - * Called by glGenerateMipmap() or when GL_GENERATE_MIPMAP_SGIS is enabled. - * Note that if the texture is a cube map, the parameter will - * indicate which cube face to generate (GL_POSITIVE/NEGATIVE_X/Y/Z). - * texObj->BaseLevel is the level from which to generate the remaining - * mipmap levels. - */ - void (*GenerateMipmap)(struct gl_context *ctx, GLenum target, - struct gl_texture_object *texObj); - - /** - * Called by glTexImage, glCompressedTexImage, glCopyTexImage - * and glTexStorage to check if the dimensions of the texture image - * are too large. - * \param target any GL_PROXY_TEXTURE_x target - * \return GL_TRUE if the image is OK, GL_FALSE if too large - */ - GLboolean (*TestProxyTexImage)(struct gl_context *ctx, GLenum target, - GLuint numLevels, GLint level, - mesa_format format, GLuint numSamples, - GLint width, GLint height, - GLint depth); - /*@}*/ - - - /** - * \name Compressed texture functions - */ - /*@{*/ - - /** - * Called by glCompressedTexImage[123]D(). - */ - void (*CompressedTexImage)(struct gl_context *ctx, GLuint dims, - struct gl_texture_image *texImage, - GLsizei imageSize, const GLvoid *data); - - /** - * Called by glCompressedTexSubImage[123]D(). - */ - void (*CompressedTexSubImage)(struct gl_context *ctx, GLuint dims, - struct gl_texture_image *texImage, - GLint xoffset, GLint yoffset, GLint zoffset, - GLsizei width, GLsizei height, GLsizei depth, - GLenum format, - GLsizei imageSize, const GLvoid *data); - /*@}*/ - - /** - * \name Texture object / image functions - */ - /*@{*/ - - /** - * Called to allocate a new texture object. Drivers will usually - * allocate/return a subclass of gl_texture_object. - */ - struct gl_texture_object * (*NewTextureObject)(struct gl_context *ctx, - GLuint name, GLenum target); - /** - * Called to delete/free a texture object. Drivers should free the - * object and any image data it contains. - */ - void (*DeleteTexture)(struct gl_context *ctx, - struct gl_texture_object *texObj); - - /** - * Called to notify that texture is removed from ctx->Shared->TexObjects - */ - void (*TextureRemovedFromShared)(struct gl_context *ctx, - struct gl_texture_object *texObj); - - /** Called to allocate a new texture image object. */ - struct gl_texture_image * (*NewTextureImage)(struct gl_context *ctx); - - /** Called to free a texture image object returned by NewTextureImage() */ - void (*DeleteTextureImage)(struct gl_context *ctx, - struct gl_texture_image *); - - /** Called to allocate memory for a single texture image */ - GLboolean (*AllocTextureImageBuffer)(struct gl_context *ctx, - struct gl_texture_image *texImage); - - /** Free the memory for a single texture image */ - void (*FreeTextureImageBuffer)(struct gl_context *ctx, - struct gl_texture_image *texImage); - - /** Map a slice of a texture image into user space. - * Note: for GL_TEXTURE_1D_ARRAY, height must be 1, y must be 0 and slice - * indicates the 1D array index. - * \param texImage the texture image - * \param slice the 3D image slice or array texture slice - * \param x, y, w, h region of interest - * \param mode bitmask of GL_MAP_READ_BIT, GL_MAP_WRITE_BIT and - * GL_MAP_INVALIDATE_RANGE_BIT (if writing) - * \param mapOut returns start of mapping of region of interest - * \param rowStrideOut returns row stride (in bytes). In the case of a - * compressed texture, this is the byte stride between one row of blocks - * and another. - */ - void (*MapTextureImage)(struct gl_context *ctx, - struct gl_texture_image *texImage, - GLuint slice, - GLuint x, GLuint y, GLuint w, GLuint h, - GLbitfield mode, - GLubyte **mapOut, GLint *rowStrideOut); - - void (*UnmapTextureImage)(struct gl_context *ctx, - struct gl_texture_image *texImage, - GLuint slice); - - /** For GL_ARB_texture_storage. Allocate memory for whole mipmap stack. - * All the gl_texture_images in the texture object will have their - * dimensions, format, etc. initialized already. - */ - GLboolean (*AllocTextureStorage)(struct gl_context *ctx, - struct gl_texture_object *texObj, - GLsizei levels, GLsizei width, - GLsizei height, GLsizei depth); - - /** Called as part of glTextureView to add views to origTexObj */ - GLboolean (*TextureView)(struct gl_context *ctx, - struct gl_texture_object *texObj, - struct gl_texture_object *origTexObj); - /*@}*/ @@ -635,9 +407,6 @@ struct dd_function_table { * May add more functions like these to the device driver in the future. */ /*@{*/ - /** Set texture parameter (callee gets param value from the texObj) */ - void (*TexParameter)(struct gl_context *ctx, - struct gl_texture_object *texObj, GLenum pname); /** Set the viewport */ void (*Viewport)(struct gl_context *ctx); /*@}*/ @@ -866,34 +635,6 @@ struct dd_function_table { GLboolean commit); /*@}*/ - /** - * \name GL_ARB_bindless_texture interface - */ - /*@{*/ - GLuint64 (*NewTextureHandle)(struct gl_context *ctx, - struct gl_texture_object *texObj, - struct gl_sampler_object *sampObj); - void (*DeleteTextureHandle)(struct gl_context *ctx, GLuint64 handle); - void (*MakeTextureHandleResident)(struct gl_context *ctx, GLuint64 handle, - bool resident); - GLuint64 (*NewImageHandle)(struct gl_context *ctx, - struct gl_image_unit *imgObj); - void (*DeleteImageHandle)(struct gl_context *ctx, GLuint64 handle); - void (*MakeImageHandleResident)(struct gl_context *ctx, GLuint64 handle, - GLenum access, bool resident); - /*@}*/ - - - /** - * Set the given memory object as the texture's storage. - */ - GLboolean (*SetTextureStorageForMemoryObject)(struct gl_context *ctx, - struct gl_texture_object *tex_obj, - struct gl_memory_object *mem_obj, - GLsizei levels, GLsizei width, - GLsizei height, GLsizei depth, - GLuint64 offset); - /** * Use a memory object as the backing data for a buffer object */ diff --git a/src/mesa/main/debug.c b/src/mesa/main/debug.c index 28b81fb9447..7c4b7385eab 100644 --- a/src/mesa/main/debug.c +++ b/src/mesa/main/debug.c @@ -38,6 +38,7 @@ #include "readpix.h" #include "texobj.h" +#include "state_tracker/st_cb_texture.h" static const char * tex_target_name(GLenum tgt) @@ -278,9 +279,9 @@ write_texture_image(struct gl_texture_object *texObj, store = ctx->Pack; /* save */ ctx->Pack = ctx->DefaultPacking; - ctx->Driver.GetTexSubImage(ctx, - 0, 0, 0, img->Width, img->Height, img->Depth, - GL_RGBA, GL_UNSIGNED_BYTE, buffer, img); + st_GetTexSubImage(ctx, + 0, 0, 0, img->Width, img->Height, img->Depth, + GL_RGBA, GL_UNSIGNED_BYTE, buffer, img); /* make filename */ snprintf(s, sizeof(s), "/tmp/tex%u.l%u.f%u.ppm", texObj->Name, level, face); @@ -607,9 +608,9 @@ _mesa_print_texture(struct gl_context *ctx, struct gl_texture_image *img) GLuint i, j, c; GLubyte *data; - ctx->Driver.MapTextureImage(ctx, img, slice, - 0, 0, img->Width, img->Height, GL_MAP_READ_BIT, - &data, &srcRowStride); + st_MapTextureImage(ctx, img, slice, + 0, 0, img->Width, img->Height, GL_MAP_READ_BIT, + &data, &srcRowStride); if (!data) { printf("No texture data\n"); @@ -656,5 +657,5 @@ _mesa_print_texture(struct gl_context *ctx, struct gl_texture_image *img) } } - ctx->Driver.UnmapTextureImage(ctx, img, slice); + st_UnmapTextureImage(ctx, img, slice); } diff --git a/src/mesa/main/dlist.c b/src/mesa/main/dlist.c index 5b6a2fcaec0..ba25b814562 100644 --- a/src/mesa/main/dlist.c +++ b/src/mesa/main/dlist.c @@ -76,6 +76,8 @@ #include "util/u_inlines.h" #include "util/u_memory.h" +#include "state_tracker/st_cb_texture.h" + #define USE_BITMAP_ATLAS 1 static bool @@ -856,7 +858,7 @@ void _mesa_delete_bitmap_atlas(struct gl_context *ctx, struct gl_bitmap_atlas *atlas) { if (atlas->texObj) { - ctx->Driver.DeleteTexture(ctx, atlas->texObj); + st_DeleteTextureObject(ctx, atlas->texObj); } free(atlas->glyphs); free(atlas); @@ -1000,7 +1002,7 @@ build_bitmap_atlas(struct gl_context *ctx, struct gl_bitmap_atlas *atlas, } /* Create atlas texture (texture ID is irrelevant) */ - atlas->texObj = ctx->Driver.NewTextureObject(ctx, 999, GL_TEXTURE_RECTANGLE); + atlas->texObj = st_NewTextureObject(ctx, 999, GL_TEXTURE_RECTANGLE); if (!atlas->texObj) { goto out_of_memory; } @@ -1029,14 +1031,14 @@ build_bitmap_atlas(struct gl_context *ctx, struct gl_bitmap_atlas *atlas, GL_ALPHA, MESA_FORMAT_A_UNORM8); /* alloc image storage */ - if (!ctx->Driver.AllocTextureImageBuffer(ctx, atlas->texImage)) { + if (!st_AllocTextureImageBuffer(ctx, atlas->texImage)) { goto out_of_memory; } /* map teximage, load with bitmap glyphs */ - ctx->Driver.MapTextureImage(ctx, atlas->texImage, 0, - 0, 0, atlas->texWidth, atlas->texHeight, - GL_MAP_WRITE_BIT, &map, &map_stride); + st_MapTextureImage(ctx, atlas->texImage, 0, + 0, 0, atlas->texWidth, atlas->texHeight, + GL_MAP_WRITE_BIT, &map, &map_stride); if (!map) { goto out_of_memory; } @@ -1069,7 +1071,7 @@ build_bitmap_atlas(struct gl_context *ctx, struct gl_bitmap_atlas *atlas, } } - ctx->Driver.UnmapTextureImage(ctx, atlas->texImage, 0); + st_UnmapTextureImage(ctx, atlas->texImage, 0); atlas->complete = true; @@ -1079,7 +1081,7 @@ out_of_memory: _mesa_error(ctx, GL_OUT_OF_MEMORY, "Display list bitmap atlas"); fail: if (atlas->texObj) { - ctx->Driver.DeleteTexture(ctx, atlas->texObj); + st_DeleteTextureObject(ctx, atlas->texObj); } free(atlas->glyphs); atlas->glyphs = NULL; diff --git a/src/mesa/main/formatquery.c b/src/mesa/main/formatquery.c index 8fec6b213a9..b86fd196154 100644 --- a/src/mesa/main/formatquery.c +++ b/src/mesa/main/formatquery.c @@ -37,6 +37,8 @@ #include "texcompress.h" #include "textureview.h" +#include "state_tracker/st_format.h" + static bool _is_renderable(struct gl_context *ctx, GLenum internalformat) { @@ -592,8 +594,8 @@ _is_internalformat_supported(struct gl_context *ctx, GLenum target, } /* Let the driver have the final word */ - ctx->Driver.QueryInternalFormat(ctx, target, internalformat, - GL_INTERNALFORMAT_SUPPORTED, buffer); + st_QueryInternalFormat(ctx, target, internalformat, + GL_INTERNALFORMAT_SUPPORTED, buffer); return (buffer[0] == GL_TRUE); } @@ -873,8 +875,6 @@ _mesa_GetInternalformativ(GLenum target, GLenum internalformat, GLenum pname, return; } - assert(ctx->Driver.QueryInternalFormat != NULL); - if (!_legal_parameters(ctx, target, internalformat, pname, bufSize, params)) return; @@ -924,8 +924,8 @@ _mesa_GetInternalformativ(GLenum target, GLenum internalformat, GLenum pname, goto end; } - ctx->Driver.QueryInternalFormat(ctx, target, internalformat, pname, - buffer); + st_QueryInternalFormat(ctx, target, internalformat, pname, + buffer); break; case GL_INTERNALFORMAT_SUPPORTED: @@ -948,8 +948,8 @@ _mesa_GetInternalformativ(GLenum target, GLenum internalformat, GLenum pname, * is called just to try to get a preferred format. If not supported, * GL_NONE was already returned and the driver is not called. */ - ctx->Driver.QueryInternalFormat(ctx, target, internalformat, pname, - buffer); + st_QueryInternalFormat(ctx, target, internalformat, pname, + buffer); break; case GL_INTERNALFORMAT_RED_SIZE: @@ -979,8 +979,8 @@ _mesa_GetInternalformativ(GLenum target, GLenum internalformat, GLenum pname, * Disclaimer: I am considering that drivers use for renderbuffers the * same format-choice logic as for textures. */ - texformat = ctx->Driver.ChooseTextureFormat(ctx, target, internalformat, - GL_NONE /*format */, GL_NONE /* type */); + texformat = st_ChooseTextureFormat(ctx, target, internalformat, + GL_NONE /*format */, GL_NONE /* type */); if (texformat == MESA_FORMAT_NONE || baseformat <= 0) goto end; @@ -1179,23 +1179,23 @@ _mesa_GetInternalformativ(GLenum target, GLenum internalformat, GLenum pname, !_is_renderable(ctx, internalformat)) goto end; - ctx->Driver.QueryInternalFormat(ctx, target, internalformat, pname, - buffer); + st_QueryInternalFormat(ctx, target, internalformat, pname, + buffer); break; case GL_READ_PIXELS: case GL_READ_PIXELS_FORMAT: case GL_READ_PIXELS_TYPE: - ctx->Driver.QueryInternalFormat(ctx, target, internalformat, pname, - buffer); + st_QueryInternalFormat(ctx, target, internalformat, pname, + buffer); break; case GL_TEXTURE_IMAGE_FORMAT: case GL_GET_TEXTURE_IMAGE_FORMAT: case GL_TEXTURE_IMAGE_TYPE: case GL_GET_TEXTURE_IMAGE_TYPE: - ctx->Driver.QueryInternalFormat(ctx, target, internalformat, pname, - buffer); + st_QueryInternalFormat(ctx, target, internalformat, pname, + buffer); break; case GL_MIPMAP: @@ -1226,8 +1226,8 @@ _mesa_GetInternalformativ(GLenum target, GLenum internalformat, GLenum pname, goto end; } - ctx->Driver.QueryInternalFormat(ctx, target, internalformat, pname, - buffer); + st_QueryInternalFormat(ctx, target, internalformat, pname, + buffer); break; case GL_COLOR_ENCODING: @@ -1246,8 +1246,8 @@ _mesa_GetInternalformativ(GLenum target, GLenum internalformat, GLenum pname, goto end; } - ctx->Driver.QueryInternalFormat(ctx, target, internalformat, pname, - buffer); + st_QueryInternalFormat(ctx, target, internalformat, pname, + buffer); break; case GL_SRGB_WRITE: @@ -1256,8 +1256,8 @@ _mesa_GetInternalformativ(GLenum target, GLenum internalformat, GLenum pname, goto end; } - ctx->Driver.QueryInternalFormat(ctx, target, internalformat, pname, - buffer); + st_QueryInternalFormat(ctx, target, internalformat, pname, + buffer); break; case GL_SRGB_DECODE_ARB: @@ -1268,8 +1268,8 @@ _mesa_GetInternalformativ(GLenum target, GLenum internalformat, GLenum pname, goto end; } - ctx->Driver.QueryInternalFormat(ctx, target, internalformat, pname, - buffer); + st_QueryInternalFormat(ctx, target, internalformat, pname, + buffer); break; case GL_FILTER: @@ -1289,8 +1289,8 @@ _mesa_GetInternalformativ(GLenum target, GLenum internalformat, GLenum pname, * need to call the driver to know if it is CAVEAT_SUPPORT or * FULL_SUPPORT. */ - ctx->Driver.QueryInternalFormat(ctx, target, internalformat, pname, - buffer); + st_QueryInternalFormat(ctx, target, internalformat, pname, + buffer); break; case GL_VERTEX_TEXTURE: @@ -1313,8 +1313,8 @@ _mesa_GetInternalformativ(GLenum target, GLenum internalformat, GLenum pname, if (pname == GL_COMPUTE_TEXTURE && !_mesa_has_compute_shaders(ctx)) goto end; - ctx->Driver.QueryInternalFormat(ctx, target, internalformat, pname, - buffer); + st_QueryInternalFormat(ctx, target, internalformat, pname, + buffer); break; case GL_TEXTURE_GATHER: @@ -1351,8 +1351,8 @@ _mesa_GetInternalformativ(GLenum target, GLenum internalformat, GLenum pname, goto end; } - ctx->Driver.QueryInternalFormat(ctx, target, internalformat, pname, - buffer); + st_QueryInternalFormat(ctx, target, internalformat, pname, + buffer); break; case GL_SHADER_IMAGE_LOAD: @@ -1370,16 +1370,16 @@ _mesa_GetInternalformativ(GLenum target, GLenum internalformat, GLenum pname, !_mesa_is_shader_image_format_supported(ctx, internalformat)) goto end; - ctx->Driver.QueryInternalFormat(ctx, target, internalformat, pname, - buffer); + st_QueryInternalFormat(ctx, target, internalformat, pname, + buffer); break; case GL_SHADER_IMAGE_ATOMIC: if (!_mesa_has_ARB_shader_image_load_store(ctx)) goto end; - ctx->Driver.QueryInternalFormat(ctx, target, internalformat, pname, - buffer); + st_QueryInternalFormat(ctx, target, internalformat, pname, + buffer); break; case GL_IMAGE_TEXEL_SIZE: { @@ -1491,8 +1491,8 @@ _mesa_GetInternalformativ(GLenum target, GLenum internalformat, GLenum pname, goto end; } - ctx->Driver.QueryInternalFormat(ctx, target, internalformat, pname, - buffer); + st_QueryInternalFormat(ctx, target, internalformat, pname, + buffer); break; case GL_TEXTURE_COMPRESSED: @@ -1533,7 +1533,7 @@ _mesa_GetInternalformativ(GLenum target, GLenum internalformat, GLenum pname, if (target != GL_TEXTURE_BUFFER) goto end; - ctx->Driver.QueryInternalFormat(ctx, target, internalformat, pname, + st_QueryInternalFormat(ctx, target, internalformat, pname, buffer); break; @@ -1545,8 +1545,8 @@ _mesa_GetInternalformativ(GLenum target, GLenum internalformat, GLenum pname, goto end; if (pname == GL_TEXTURE_VIEW) { - ctx->Driver.QueryInternalFormat(ctx, target, internalformat, pname, - buffer); + st_QueryInternalFormat(ctx, target, internalformat, pname, + buffer); } else { GLenum view_class = _mesa_texture_view_lookup_view_class(ctx, internalformat); @@ -1559,16 +1559,16 @@ _mesa_GetInternalformativ(GLenum target, GLenum internalformat, GLenum pname, case GL_NUM_TILING_TYPES_EXT: case GL_TILING_TYPES_EXT: - ctx->Driver.QueryInternalFormat(ctx, target, internalformat, pname, - buffer); + st_QueryInternalFormat(ctx, target, internalformat, pname, + buffer); break; case GL_TEXTURE_REDUCTION_MODE_ARB: if (ctx->Extensions.EXT_texture_filter_minmax) buffer[0] = (GLint)1; else if (ctx->Extensions.ARB_texture_filter_minmax) - ctx->Driver.QueryInternalFormat(ctx, target, internalformat, pname, - buffer); + st_QueryInternalFormat(ctx, target, internalformat, pname, + buffer); else buffer[0] = (GLint)0; break; diff --git a/src/mesa/main/genmipmap.c b/src/mesa/main/genmipmap.c index bcb8ac9c407..17757939345 100644 --- a/src/mesa/main/genmipmap.c +++ b/src/mesa/main/genmipmap.c @@ -38,6 +38,8 @@ #include "texobj.h" #include "hash.h" +#include "state_tracker/st_gen_mipmap.h" + bool _mesa_is_valid_generate_texture_mipmap_target(struct gl_context *ctx, GLenum target) @@ -174,12 +176,12 @@ generate_texture_mipmap(struct gl_context *ctx, if (target == GL_TEXTURE_CUBE_MAP) { GLuint face; for (face = 0; face < 6; face++) { - ctx->Driver.GenerateMipmap(ctx, - GL_TEXTURE_CUBE_MAP_POSITIVE_X + face, texObj); + st_generate_mipmap(ctx, + GL_TEXTURE_CUBE_MAP_POSITIVE_X + face, texObj); } } else { - ctx->Driver.GenerateMipmap(ctx, target, texObj); + st_generate_mipmap(ctx, target, texObj); } _mesa_unlock_texture(ctx, texObj); } diff --git a/src/mesa/main/mipmap.c b/src/mesa/main/mipmap.c index 6bb586655eb..bfe67fc7f0d 100644 --- a/src/mesa/main/mipmap.c +++ b/src/mesa/main/mipmap.c @@ -42,6 +42,7 @@ #include "util/format_rgb9e5.h" #include "util/format_r11g11b10f.h" +#include "state_tracker/st_cb_texture.h" /** * Compute the expected number of mipmap levels in the texture given @@ -1880,13 +1881,13 @@ prepare_mipmap_level(struct gl_context *ctx, dstImage->InternalFormat != intFormat || dstImage->TexFormat != format) { /* need to (re)allocate image */ - ctx->Driver.FreeTextureImageBuffer(ctx, dstImage); + st_FreeTextureImageBuffer(ctx, dstImage); _mesa_init_teximage_fields(ctx, dstImage, width, height, depth, border, intFormat, format); - ctx->Driver.AllocTextureImageBuffer(ctx, dstImage); + st_AllocTextureImageBuffer(ctx, dstImage); /* in case the mipmap level is part of an FBO: */ _mesa_update_fbo_texture(ctx, texObj, face, level); @@ -1998,10 +1999,10 @@ generate_mipmap_uncompressed(struct gl_context *ctx, GLenum target, srcMaps = calloc(srcDepth, sizeof(GLubyte *)); if (srcMaps) { for (slice = 0; slice < srcDepth; slice++) { - ctx->Driver.MapTextureImage(ctx, srcImage, slice, - 0, 0, srcWidth, srcHeight, - GL_MAP_READ_BIT, - &srcMaps[slice], &srcRowStride); + st_MapTextureImage(ctx, srcImage, slice, + 0, 0, srcWidth, srcHeight, + GL_MAP_READ_BIT, + &srcMaps[slice], &srcRowStride); if (!srcMaps[slice]) { success = GL_FALSE; break; @@ -2016,10 +2017,10 @@ generate_mipmap_uncompressed(struct gl_context *ctx, GLenum target, dstMaps = calloc(dstDepth, sizeof(GLubyte *)); if (dstMaps) { for (slice = 0; slice < dstDepth; slice++) { - ctx->Driver.MapTextureImage(ctx, dstImage, slice, - 0, 0, dstWidth, dstHeight, - GL_MAP_WRITE_BIT, - &dstMaps[slice], &dstRowStride); + st_MapTextureImage(ctx, dstImage, slice, + 0, 0, dstWidth, dstHeight, + GL_MAP_WRITE_BIT, + &dstMaps[slice], &dstRowStride); if (!dstMaps[slice]) { success = GL_FALSE; break; @@ -2043,7 +2044,7 @@ generate_mipmap_uncompressed(struct gl_context *ctx, GLenum target, if (srcMaps) { for (slice = 0; slice < srcDepth; slice++) { if (srcMaps[slice]) { - ctx->Driver.UnmapTextureImage(ctx, srcImage, slice); + st_UnmapTextureImage(ctx, srcImage, slice); } } free(srcMaps); @@ -2053,7 +2054,7 @@ generate_mipmap_uncompressed(struct gl_context *ctx, GLenum target, if (dstMaps) { for (slice = 0; slice < dstDepth; slice++) { if (dstMaps[slice]) { - ctx->Driver.UnmapTextureImage(ctx, dstImage, slice); + st_UnmapTextureImage(ctx, dstImage, slice); } } free(dstMaps); @@ -2136,12 +2137,12 @@ generate_mipmap_compressed(struct gl_context *ctx, GLenum target, /* Get the uncompressed image */ assert(srcImage->Level == texObj->Attrib.BaseLevel); - ctx->Driver.GetTexSubImage(ctx, - 0, 0, 0, - srcImage->Width, srcImage->Height, - srcImage->Depth, - temp_base_format, temp_datatype, - temp_src, srcImage); + st_GetTexSubImage(ctx, + 0, 0, 0, + srcImage->Width, srcImage->Height, + srcImage->Depth, + temp_base_format, temp_datatype, + temp_src, srcImage); /* restore packing mode */ ctx->Pack = save; } @@ -2204,10 +2205,10 @@ generate_mipmap_compressed(struct gl_context *ctx, GLenum target, temp_dst_slices, temp_dst_row_stride); /* The image space was allocated above so use glTexSubImage now */ - ctx->Driver.TexSubImage(ctx, 2, dstImage, - 0, 0, 0, dstWidth, dstHeight, dstDepth, - temp_base_format, temp_datatype, - temp_dst, &ctx->DefaultPacking); + st_TexSubImage(ctx, 2, dstImage, + 0, 0, 0, dstWidth, dstHeight, dstDepth, + temp_base_format, temp_datatype, + temp_dst, &ctx->DefaultPacking); /* swap src and dest pointers */ { @@ -2228,7 +2229,7 @@ end: /** * Automatic mipmap generation. - * This is the fallback/default function for ctx->Driver.GenerateMipmap(). + * This is the fallback/default function for mipmap generation. * Generate a complete set of mipmaps from texObj's BaseLevel image. * Stop at texObj's MaxLevel or when we get to the 1x1 texture. * For cube maps, target will be one of diff --git a/src/mesa/main/multisample.c b/src/mesa/main/multisample.c index 2d243eaac48..33731e18f64 100644 --- a/src/mesa/main/multisample.c +++ b/src/mesa/main/multisample.c @@ -32,6 +32,7 @@ #include "main/glformats.h" #include "main/state.h" +#include "state_tracker/st_format.h" /** * Called via glSampleCoverageARB @@ -294,8 +295,8 @@ _mesa_check_sample_count(struct gl_context *ctx, GLenum target, GLint buffer[16] = {-1}; GLint limit; - ctx->Driver.QueryInternalFormat(ctx, target, internalFormat, - GL_SAMPLES, buffer); + st_QueryInternalFormat(ctx, target, internalFormat, + GL_SAMPLES, buffer); /* since the query returns samples sorted in descending order, * the first element is the greatest supported sample value. */ diff --git a/src/mesa/main/shared.c b/src/mesa/main/shared.c index 20dc0f7167e..8a23d885a2d 100644 --- a/src/mesa/main/shared.c +++ b/src/mesa/main/shared.c @@ -47,6 +47,7 @@ #include "state_tracker/st_cb_memoryobjects.h" #include "state_tracker/st_cb_semaphoreobjects.h" +#include "state_tracker/st_cb_texture.h" static void free_shared_state(struct gl_context *ctx, struct gl_shared_state *shared); @@ -119,7 +120,7 @@ _mesa_alloc_shared_state(struct gl_context *ctx) GL_TEXTURE_1D }; STATIC_ASSERT(ARRAY_SIZE(targets) == NUM_TEXTURE_TARGETS); - shared->DefaultTex[i] = ctx->Driver.NewTextureObject(ctx, 0, targets[i]); + shared->DefaultTex[i] = st_NewTextureObject(ctx, 0, targets[i]); /* Need to explicitly set/overwrite the TargetIndex field here since * the call to _mesa_tex_target_to_index() in NewTextureObject() may * fail if the texture target is not supported. @@ -179,7 +180,7 @@ delete_texture_cb(void *data, void *userData) { struct gl_texture_object *texObj = (struct gl_texture_object *) data; struct gl_context *ctx = (struct gl_context *) userData; - ctx->Driver.DeleteTexture(ctx, texObj); + st_DeleteTextureObject(ctx, texObj); } @@ -350,7 +351,7 @@ free_shared_state(struct gl_context *ctx, struct gl_shared_state *shared) /* Free the dummy/fallback texture objects */ for (i = 0; i < NUM_TEXTURE_TARGETS; i++) { if (shared->FallbackTex[i]) - ctx->Driver.DeleteTexture(ctx, shared->FallbackTex[i]); + st_DeleteTextureObject(ctx, shared->FallbackTex[i]); } /* @@ -432,11 +433,10 @@ free_shared_state(struct gl_context *ctx, struct gl_shared_state *shared) * Free texture objects (after FBOs since some textures might have * been bound to FBOs). */ - assert(ctx->Driver.DeleteTexture); /* the default textures */ for (i = 0; i < NUM_TEXTURE_TARGETS; i++) { if (shared->DefaultTex[i]) - ctx->Driver.DeleteTexture(ctx, shared->DefaultTex[i]); + st_DeleteTextureObject(ctx, shared->DefaultTex[i]); } /* all other textures */ diff --git a/src/mesa/main/texgetimage.c b/src/mesa/main/texgetimage.c index de6caaed5a1..81ed1a36651 100644 --- a/src/mesa/main/texgetimage.c +++ b/src/mesa/main/texgetimage.c @@ -49,6 +49,8 @@ #include "format_utils.h" #include "pixeltransfer.h" +#include "state_tracker/st_cb_texture.h" + /** * Can the given type represent negative values? */ @@ -93,9 +95,9 @@ get_tex_depth(struct gl_context *ctx, GLuint dimensions, GLint srcRowStride; /* map src texture buffer */ - ctx->Driver.MapTextureImage(ctx, texImage, zoffset + img, - xoffset, yoffset, width, height, - GL_MAP_READ_BIT, &srcMap, &srcRowStride); + st_MapTextureImage(ctx, texImage, zoffset + img, + xoffset, yoffset, width, height, + GL_MAP_READ_BIT, &srcMap, &srcRowStride); if (srcMap) { for (row = 0; row < height; row++) { @@ -107,7 +109,7 @@ get_tex_depth(struct gl_context *ctx, GLuint dimensions, _mesa_pack_depth_span(ctx, width, dest, type, depthRow, &ctx->Pack); } - ctx->Driver.UnmapTextureImage(ctx, texImage, zoffset + img); + st_UnmapTextureImage(ctx, texImage, zoffset + img); } else { _mesa_error(ctx, GL_OUT_OF_MEMORY, "glGetTexImage"); @@ -138,9 +140,9 @@ get_tex_depth_stencil(struct gl_context *ctx, GLuint dimensions, GLint rowstride; /* map src texture buffer */ - ctx->Driver.MapTextureImage(ctx, texImage, zoffset + img, - xoffset, yoffset, width, height, - GL_MAP_READ_BIT, &srcMap, &rowstride); + st_MapTextureImage(ctx, texImage, zoffset + img, + xoffset, yoffset, width, height, + GL_MAP_READ_BIT, &srcMap, &rowstride); if (srcMap) { for (row = 0; row < height; row++) { @@ -166,7 +168,7 @@ get_tex_depth_stencil(struct gl_context *ctx, GLuint dimensions, } } - ctx->Driver.UnmapTextureImage(ctx, texImage, zoffset + img); + st_UnmapTextureImage(ctx, texImage, zoffset + img); } else { _mesa_error(ctx, GL_OUT_OF_MEMORY, "glGetTexImage"); @@ -194,10 +196,10 @@ get_tex_stencil(struct gl_context *ctx, GLuint dimensions, GLint rowstride; /* map src texture buffer */ - ctx->Driver.MapTextureImage(ctx, texImage, zoffset + img, - xoffset, yoffset, width, height, - GL_MAP_READ_BIT, - &srcMap, &rowstride); + st_MapTextureImage(ctx, texImage, zoffset + img, + xoffset, yoffset, width, height, + GL_MAP_READ_BIT, + &srcMap, &rowstride); if (srcMap) { for (row = 0; row < height; row++) { @@ -211,7 +213,7 @@ get_tex_stencil(struct gl_context *ctx, GLuint dimensions, dest); } - ctx->Driver.UnmapTextureImage(ctx, texImage, zoffset + img); + st_UnmapTextureImage(ctx, texImage, zoffset + img); } else { _mesa_error(ctx, GL_OUT_OF_MEMORY, "glGetTexImage"); @@ -238,9 +240,9 @@ get_tex_ycbcr(struct gl_context *ctx, GLuint dimensions, GLint rowstride; /* map src texture buffer */ - ctx->Driver.MapTextureImage(ctx, texImage, zoffset + img, - xoffset, yoffset, width, height, - GL_MAP_READ_BIT, &srcMap, &rowstride); + st_MapTextureImage(ctx, texImage, zoffset + img, + xoffset, yoffset, width, height, + GL_MAP_READ_BIT, &srcMap, &rowstride); if (srcMap) { for (row = 0; row < height; row++) { @@ -263,7 +265,7 @@ get_tex_ycbcr(struct gl_context *ctx, GLuint dimensions, } } - ctx->Driver.UnmapTextureImage(ctx, texImage, zoffset + img); + st_UnmapTextureImage(ctx, texImage, zoffset + img); } else { _mesa_error(ctx, GL_OUT_OF_MEMORY, "glGetTexImage"); @@ -343,15 +345,15 @@ get_tex_rgba_compressed(struct gl_context *ctx, GLuint dimensions, tempSlice = tempImage + slice * 4 * width * height; - ctx->Driver.MapTextureImage(ctx, texImage, zoffset + slice, - xoffset, yoffset, width, height, - GL_MAP_READ_BIT, - &srcMap, &srcRowStride); + st_MapTextureImage(ctx, texImage, zoffset + slice, + xoffset, yoffset, width, height, + GL_MAP_READ_BIT, + &srcMap, &srcRowStride); if (srcMap) { _mesa_decompress_image(texFormat, width, height, srcMap, srcRowStride, tempSlice); - ctx->Driver.UnmapTextureImage(ctx, texImage, zoffset + slice); + st_UnmapTextureImage(ctx, texImage, zoffset + slice); } else { _mesa_error(ctx, GL_OUT_OF_MEMORY, "glGetTexImage"); @@ -472,10 +474,10 @@ get_tex_rgba_uncompressed(struct gl_context *ctx, GLuint dimensions, uint32_t src_format; /* map src texture buffer */ - ctx->Driver.MapTextureImage(ctx, texImage, zoffset + img, - xoffset, yoffset, width, height, - GL_MAP_READ_BIT, - &srcMap, &rowstride); + st_MapTextureImage(ctx, texImage, zoffset + img, + xoffset, yoffset, width, height, + GL_MAP_READ_BIT, + &srcMap, &rowstride); if (!srcMap) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "glGetTexImage"); goto done; @@ -508,7 +510,7 @@ get_tex_rgba_uncompressed(struct gl_context *ctx, GLuint dimensions, rgba = malloc(height * rgba_stride); if (!rgba) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "glGetTexImage()"); - ctx->Driver.UnmapTextureImage(ctx, texImage, img); + st_UnmapTextureImage(ctx, texImage, img); return; } } @@ -555,7 +557,7 @@ get_tex_rgba_uncompressed(struct gl_context *ctx, GLuint dimensions, width, height, dest, dest); /* Unmap the src texture buffer */ - ctx->Driver.UnmapTextureImage(ctx, texImage, zoffset + img); + st_UnmapTextureImage(ctx, texImage, zoffset + img); } done: @@ -655,9 +657,9 @@ get_tex_memcpy(struct gl_context *ctx, GLint srcRowStride; /* map src texture buffer */ - ctx->Driver.MapTextureImage(ctx, texImage, zoffset, - xoffset, yoffset, width, height, - GL_MAP_READ_BIT, &src, &srcRowStride); + st_MapTextureImage(ctx, texImage, zoffset, + xoffset, yoffset, width, height, + GL_MAP_READ_BIT, &src, &srcRowStride); if (src) { if (bytesPerRow == dstRowStride && bytesPerRow == srcRowStride) { @@ -673,7 +675,7 @@ get_tex_memcpy(struct gl_context *ctx, } /* unmap src texture buffer */ - ctx->Driver.UnmapTextureImage(ctx, texImage, zoffset); + st_UnmapTextureImage(ctx, texImage, zoffset); } else { _mesa_error(ctx, GL_OUT_OF_MEMORY, "glGetTexImage"); @@ -685,10 +687,8 @@ get_tex_memcpy(struct gl_context *ctx, /** - * This is the software fallback for Driver.GetTexSubImage(). + * This is the software fallback for GetTexSubImage(). * All error checking will have been done before this routine is called. - * We'll call ctx->Driver.MapTextureImage() to access the data, then - * unmap with ctx->Driver.UnmapTextureImage(). */ void _mesa_GetTexSubImage_sw(struct gl_context *ctx, @@ -812,9 +812,9 @@ get_compressed_texsubimage_sw(struct gl_context *ctx, GLubyte *src; /* map src texture buffer */ - ctx->Driver.MapTextureImage(ctx, texImage, zoffset + slice, - xoffset, yoffset, width, height, - GL_MAP_READ_BIT, &src, &srcRowStride); + st_MapTextureImage(ctx, texImage, zoffset + slice, + xoffset, yoffset, width, height, + GL_MAP_READ_BIT, &src, &srcRowStride); if (src) { GLint i; @@ -824,7 +824,7 @@ get_compressed_texsubimage_sw(struct gl_context *ctx, src += srcRowStride; } - ctx->Driver.UnmapTextureImage(ctx, texImage, zoffset + slice); + st_UnmapTextureImage(ctx, texImage, zoffset + slice); /* Advance to next slice */ dest += store.TotalBytesPerRow * (store.TotalRowsPerSlice - @@ -1437,9 +1437,9 @@ get_texture_image(struct gl_context *ctx, texImage = texObj->Image[firstFace + i][level]; assert(texImage); - ctx->Driver.GetTexSubImage(ctx, xoffset, yoffset, zoffset, - width, height, depth, - format, type, pixels, texImage); + st_GetTexSubImage(ctx, xoffset, yoffset, zoffset, + width, height, depth, + format, type, pixels, texImage); /* next cube face */ pixels = (GLubyte *) pixels + imageStride; diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c index f1a07334ed5..a219f74fda6 100644 --- a/src/mesa/main/teximage.c +++ b/src/mesa/main/teximage.c @@ -57,6 +57,9 @@ #include "texstore.h" #include "pbo.h" +#include "state_tracker/st_cb_texture.h" +#include "state_tracker/st_format.h" +#include "state_tracker/st_gen_mipmap.h" /** * Returns a corresponding internal floating point format for a given base @@ -199,7 +202,7 @@ set_tex_image(struct gl_texture_object *tObj, /** * Free a gl_texture_image and associated data. - * This function is a fallback called via ctx->Driver.DeleteTextureImage(). + * This function is a fallback. * * \param texImage texture image. * @@ -212,8 +215,7 @@ _mesa_delete_texture_image(struct gl_context *ctx, /* Free texImage->Data and/or any other driver-specific texture * image storage. */ - assert(ctx->Driver.FreeTextureImageBuffer); - ctx->Driver.FreeTextureImageBuffer( ctx, texImage ); + st_FreeTextureImageBuffer( ctx, texImage ); free(texImage); } @@ -387,7 +389,7 @@ _mesa_get_tex_image(struct gl_context *ctx, struct gl_texture_object *texObj, texImage = _mesa_select_tex_image(texObj, target, level); if (!texImage) { - texImage = ctx->Driver.NewTextureImage(ctx); + texImage = st_NewTextureImage(ctx); if (!texImage) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "texture image allocation"); return NULL; @@ -454,7 +456,7 @@ get_proxy_tex_image(struct gl_context *ctx, GLenum target, GLint level) texImage = ctx->Texture.ProxyTex[texIndex]->Image[0][level]; if (!texImage) { - texImage = ctx->Driver.NewTextureImage(ctx); + texImage = st_NewTextureImage(ctx); if (!texImage) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "proxy texture allocation"); return NULL; @@ -945,7 +947,7 @@ void _mesa_clear_texture_image(struct gl_context *ctx, struct gl_texture_image *texImage) { - ctx->Driver.FreeTextureImageBuffer(ctx, texImage); + st_FreeTextureImageBuffer(ctx, texImage); clear_teximage_fields(texImage); } @@ -2753,8 +2755,7 @@ check_gen_mipmap(struct gl_context *ctx, GLenum target, if (texObj->Attrib.GenerateMipmap && level == texObj->Attrib.BaseLevel && level < texObj->Attrib.MaxLevel) { - assert(ctx->Driver.GenerateMipmap); - ctx->Driver.GenerateMipmap(ctx, target, texObj); + st_generate_mipmap(ctx, target, texObj); } } @@ -2836,8 +2837,8 @@ _mesa_choose_texture_format(struct gl_context *ctx, } } - f = ctx->Driver.ChooseTextureFormat(ctx, target, internalFormat, - format, type); + f = st_ChooseTextureFormat(ctx, target, internalFormat, + format, type); assert(f != MESA_FORMAT_NONE); return f; } @@ -2930,7 +2931,7 @@ lookup_texture_ext_dsa(struct gl_context *ctx, GLenum target, GLuint texture, } if (!texObj) { - texObj = ctx->Driver.NewTextureObject(ctx, texture, boundTarget); + texObj = st_NewTextureObject(ctx, texture, boundTarget); if (!texObj) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "%s", caller); return NULL; @@ -3079,9 +3080,9 @@ teximage(struct gl_context *ctx, GLboolean compressed, GLuint dims, height, depth, border); /* check that the texture won't take too much memory, etc */ - sizeOK = ctx->Driver.TestProxyTexImage(ctx, proxy_target(target), - 0, level, texFormat, 1, - width, height, depth); + sizeOK = st_TestProxyTexImage(ctx, proxy_target(target), + 0, level, texFormat, 1, + width, height, depth); } if (_mesa_is_proxy_texture(target)) { @@ -3143,7 +3144,7 @@ teximage(struct gl_context *ctx, GLboolean compressed, GLuint dims, _mesa_error(ctx, GL_OUT_OF_MEMORY, "%s%uD", func, dims); } else { - ctx->Driver.FreeTextureImageBuffer(ctx, texImage); + st_FreeTextureImageBuffer(ctx, texImage); _mesa_init_teximage_fields(ctx, texImage, width, height, depth, @@ -3152,12 +3153,12 @@ teximage(struct gl_context *ctx, GLboolean compressed, GLuint dims, /* Give the texture to the driver. may be null. */ if (width > 0 && height > 0 && depth > 0) { if (compressed) { - ctx->Driver.CompressedTexImage(ctx, dims, texImage, - imageSize, pixels); + st_CompressedTexImage(ctx, dims, texImage, + imageSize, pixels); } else { - ctx->Driver.TexImage(ctx, dims, texImage, format, - type, pixels, unpack); + st_TexImage(ctx, dims, texImage, format, + type, pixels, unpack); } } @@ -3446,7 +3447,7 @@ egl_image_target_texture(struct gl_context *ctx, if (!texImage) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "%s", caller); } else { - ctx->Driver.FreeTextureImageBuffer(ctx, texImage); + st_FreeTextureImageBuffer(ctx, texImage); texObj->External = GL_TRUE; @@ -3566,10 +3567,10 @@ texture_sub_image(struct gl_context *ctx, GLuint dims, xoffset += texImage->Border; } - ctx->Driver.TexSubImage(ctx, dims, texImage, - xoffset, yoffset, zoffset, - width, height, depth, - format, type, pixels, &ctx->Unpack); + st_TexSubImage(ctx, dims, texImage, + xoffset, yoffset, zoffset, + width, height, depth, + format, type, pixels, &ctx->Unpack); check_gen_mipmap(ctx, target, texObj, level); @@ -4105,14 +4106,14 @@ copytexsubimage_by_slice(struct gl_context *ctx, for (slice = 0; slice < height; slice++) { assert(yoffset + slice < texImage->Height); - ctx->Driver.CopyTexSubImage(ctx, 2, texImage, - xoffset, 0, yoffset + slice, - rb, x, y + slice, width, 1); + st_CopyTexSubImage(ctx, 2, texImage, + xoffset, 0, yoffset + slice, + rb, x, y + slice, width, 1); } } else { - ctx->Driver.CopyTexSubImage(ctx, dims, texImage, - xoffset, yoffset, zoffset, - rb, x, y, width, height); + st_CopyTexSubImage(ctx, dims, texImage, + xoffset, yoffset, zoffset, + rb, x, y, width, height); } } @@ -4379,9 +4380,9 @@ copyteximage(struct gl_context *ctx, GLuint dims, struct gl_texture_object *texO assert(texFormat != MESA_FORMAT_NONE); - if (!ctx->Driver.TestProxyTexImage(ctx, proxy_target(target), - 0, level, texFormat, 1, - width, height, 1)) { + if (!st_TestProxyTexImage(ctx, proxy_target(target), + 0, level, texFormat, 1, + width, height, 1)) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCopyTexImage%uD(image too large)", dims); return; @@ -4410,14 +4411,14 @@ copyteximage(struct gl_context *ctx, GLuint dims, struct gl_texture_object *texO const GLuint face = _mesa_tex_target_to_face(target); /* Free old texture image */ - ctx->Driver.FreeTextureImageBuffer(ctx, texImage); + st_FreeTextureImageBuffer(ctx, texImage); _mesa_init_teximage_fields(ctx, texImage, width, height, 1, border, internalFormat, texFormat); if (width && height) { /* Allocate texture memory (no pixel data yet) */ - ctx->Driver.AllocTextureImageBuffer(ctx, texImage); + st_AllocTextureImageBuffer(ctx, texImage); if (ctx->Const.NoClippingOnCopyTex || _mesa_clip_copytexsubimage(ctx, &dstX, &dstY, &srcX, &srcY, @@ -5165,11 +5166,11 @@ _mesa_ClearTexSubImage(GLuint texture, GLint level, if (numImages == 1) { if (check_clear_tex_image(ctx, "glClearTexSubImage", texImages[0], format, type, data, clearValue[0])) { - ctx->Driver.ClearTexSubImage(ctx, - texImages[0], - xoffset, yoffset, zoffset, - width, height, depth, - data ? clearValue[0] : NULL); + st_ClearTexSubImage(ctx, + texImages[0], + xoffset, yoffset, zoffset, + width, height, depth, + data ? clearValue[0] : NULL); } } else { /* loop over cube face images */ @@ -5180,11 +5181,11 @@ _mesa_ClearTexSubImage(GLuint texture, GLint level, goto out; } for (i = zoffset; i < zoffset + depth; i++) { - ctx->Driver.ClearTexSubImage(ctx, - texImages[i], - xoffset, yoffset, 0, - width, height, 1, - data ? clearValue[i] : NULL); + st_ClearTexSubImage(ctx, + texImages[i], + xoffset, yoffset, 0, + width, height, 1, + data ? clearValue[i] : NULL); } } @@ -5220,14 +5221,14 @@ _mesa_ClearTexImage( GLuint texture, GLint level, } for (i = 0; i < numImages; i++) { - ctx->Driver.ClearTexSubImage(ctx, texImages[i], - -(GLint) texImages[i]->Border, /* xoffset */ - -(GLint) texImages[i]->Border, /* yoffset */ - -(GLint) texImages[i]->Border, /* zoffset */ - texImages[i]->Width, - texImages[i]->Height, - texImages[i]->Depth, - data ? clearValue[i] : NULL); + st_ClearTexSubImage(ctx, texImages[i], + -(GLint) texImages[i]->Border, /* xoffset */ + -(GLint) texImages[i]->Border, /* yoffset */ + -(GLint) texImages[i]->Border, /* zoffset */ + texImages[i]->Width, + texImages[i]->Height, + texImages[i]->Depth, + data ? clearValue[i] : NULL); } out: @@ -5678,10 +5679,10 @@ compressed_texture_sub_image(struct gl_context *ctx, GLuint dims, _mesa_lock_texture(ctx, texObj); { if (width > 0 && height > 0 && depth > 0) { - ctx->Driver.CompressedTexSubImage(ctx, dims, texImage, - xoffset, yoffset, zoffset, - width, height, depth, - format, imageSize, data); + st_CompressedTexSubImage(ctx, dims, texImage, + xoffset, yoffset, zoffset, + width, height, depth, + format, imageSize, data); check_gen_mipmap(ctx, target, texObj, level); @@ -6359,16 +6360,14 @@ texture_buffer_range(struct gl_context *ctx, } _mesa_unlock_texture(ctx, texObj); - if (ctx->Driver.TexParameter) { - if (old_format != format) { - ctx->Driver.TexParameter(ctx, texObj, GL_ALL_ATTRIB_BITS); - } else { - if (offset != oldOffset) { - ctx->Driver.TexParameter(ctx, texObj, GL_TEXTURE_BUFFER_OFFSET); - } - if (size != oldSize) { - ctx->Driver.TexParameter(ctx, texObj, GL_TEXTURE_BUFFER_SIZE); - } + if (old_format != format) { + st_TexParameter(ctx, texObj, GL_ALL_ATTRIB_BITS); + } else { + if (offset != oldOffset) { + st_TexParameter(ctx, texObj, GL_TEXTURE_BUFFER_OFFSET); + } + if (size != oldSize) { + st_TexParameter(ctx, texObj, GL_TEXTURE_BUFFER_SIZE); } } @@ -6846,8 +6845,8 @@ texture_image_multisample(struct gl_context *ctx, GLuint dims, dimensionsOK = _mesa_legal_texture_dimensions(ctx, target, 0, width, height, depth, 0); - sizeOK = ctx->Driver.TestProxyTexImage(ctx, target, 0, 0, texFormat, - samples, width, height, depth); + sizeOK = st_TestProxyTexImage(ctx, target, 0, 0, texFormat, + samples, width, height, depth); if (_mesa_is_proxy_texture(target)) { if (samplesOK && dimensionsOK && sizeOK) { @@ -6878,7 +6877,7 @@ texture_image_multisample(struct gl_context *ctx, GLuint dims, return; } - ctx->Driver.FreeTextureImageBuffer(ctx, texImage); + st_FreeTextureImageBuffer(ctx, texImage); _mesa_init_teximage_fields_ms(ctx, texImage, width, height, depth, 0, internalformat, texFormat, @@ -6886,17 +6885,17 @@ texture_image_multisample(struct gl_context *ctx, GLuint dims, if (width > 0 && height > 0 && depth > 0) { if (memObj) { - if (!ctx->Driver.SetTextureStorageForMemoryObject(ctx, texObj, - memObj, 1, width, - height, depth, - offset)) { + if (!st_SetTextureStorageForMemoryObject(ctx, texObj, + memObj, 1, width, + height, depth, + offset)) { _mesa_init_teximage_fields(ctx, texImage, 0, 0, 0, 0, internalformat, texFormat); } } else { - if (!ctx->Driver.AllocTextureStorage(ctx, texObj, 1, - width, height, depth)) { + if (!st_AllocTextureStorage(ctx, texObj, 1, + width, height, depth)) { /* tidy up the texture image state. strictly speaking, * we're allowed to just leave this in whatever state we * like, but being tidy is good. diff --git a/src/mesa/main/texobj.c b/src/mesa/main/texobj.c index 88b9ee63086..8130213201f 100644 --- a/src/mesa/main/texobj.c +++ b/src/mesa/main/texobj.c @@ -46,7 +46,8 @@ #include "texturebindless.h" #include "util/u_memory.h" - +#include "state_tracker/st_cb_texture.h" +#include "state_tracker/st_format.h" /**********************************************************************/ /** \name Internal functions */ @@ -261,9 +262,6 @@ _mesa_get_texobj_by_target_and_texunit(struct gl_context *ctx, GLenum target, * Allocate and initialize a new texture object. But don't put it into the * texture object hash table. * - * Called via ctx->Driver.NewTextureObject, unless overridden by a device - * driver. - * * \param shared the shared GL state structure to contain the texture object * \param name integer name for the texture object * \param target either GL_TEXTURE_1D, GL_TEXTURE_2D, GL_TEXTURE_3D, @@ -425,14 +423,12 @@ finish_texture_init(struct gl_context *ctx, GLenum target, obj->Sampler.Attrib.state.min_img_filter = filter_to_gallium(filter); obj->Sampler.Attrib.state.min_mip_filter = mipfilter_to_gallium(filter); obj->Sampler.Attrib.state.mag_img_filter = filter_to_gallium(filter); - if (ctx->Driver.TexParameter) { - /* XXX we probably don't need to make all these calls */ - ctx->Driver.TexParameter(ctx, obj, GL_TEXTURE_WRAP_S); - ctx->Driver.TexParameter(ctx, obj, GL_TEXTURE_WRAP_T); - ctx->Driver.TexParameter(ctx, obj, GL_TEXTURE_WRAP_R); - ctx->Driver.TexParameter(ctx, obj, GL_TEXTURE_MIN_FILTER); - ctx->Driver.TexParameter(ctx, obj, GL_TEXTURE_MAG_FILTER); - } + /* XXX we probably don't need to make all these calls */ + st_TexParameter(ctx, obj, GL_TEXTURE_WRAP_S); + st_TexParameter(ctx, obj, GL_TEXTURE_WRAP_T); + st_TexParameter(ctx, obj, GL_TEXTURE_WRAP_R); + st_TexParameter(ctx, obj, GL_TEXTURE_MIN_FILTER); + st_TexParameter(ctx, obj, GL_TEXTURE_MAG_FILTER); break; default: @@ -445,7 +441,6 @@ finish_texture_init(struct gl_context *ctx, GLenum target, /** * Deallocate a texture object struct. It should have already been * removed from the texture object pool. - * Called via ctx->Driver.DeleteTexture() if not overriden by a driver. * * \param shared the shared GL state to which the object belongs. * \param texObj the texture object to delete. @@ -465,7 +460,7 @@ _mesa_delete_texture_object(struct gl_context *ctx, for (face = 0; face < 6; face++) { for (i = 0; i < MAX_TEXTURE_LEVELS; i++) { if (texObj->Image[face][i]) { - ctx->Driver.DeleteTextureImage(ctx, texObj->Image[face][i]); + st_DeleteTextureImage(ctx, texObj->Image[face][i]); } } } @@ -572,7 +567,7 @@ _mesa_reference_texobj_(struct gl_texture_object **ptr, */ GET_CURRENT_CONTEXT(ctx); if (ctx) - ctx->Driver.DeleteTexture(ctx, oldTex); + st_DeleteTextureObject(ctx, oldTex); else _mesa_problem(NULL, "Unable to delete texture, no context"); } @@ -992,7 +987,7 @@ _mesa_get_fallback_texture(struct gl_context *ctx, gl_texture_index tex) } /* create texture object */ - texObj = ctx->Driver.NewTextureObject(ctx, 0, target); + texObj = st_NewTextureObject(ctx, 0, target); if (!texObj) return NULL; @@ -1003,9 +998,9 @@ _mesa_get_fallback_texture(struct gl_context *ctx, gl_texture_index tex) texObj->Sampler.Attrib.state.min_mip_filter = PIPE_TEX_MIPFILTER_NONE; texObj->Sampler.Attrib.state.mag_img_filter = PIPE_TEX_FILTER_NEAREST; - texFormat = ctx->Driver.ChooseTextureFormat(ctx, target, - GL_RGBA, GL_RGBA, - GL_UNSIGNED_BYTE); + texFormat = st_ChooseTextureFormat(ctx, target, + GL_RGBA, GL_RGBA, + GL_UNSIGNED_BYTE); /* need a loop here just for cube maps */ for (face = 0; face < numFaces; face++) { @@ -1021,9 +1016,9 @@ _mesa_get_fallback_texture(struct gl_context *ctx, gl_texture_index tex) 0, /* border */ GL_RGBA, texFormat); - ctx->Driver.TexImage(ctx, dims, texImage, - GL_RGBA, GL_UNSIGNED_BYTE, texel, - &ctx->DefaultPacking); + st_TexImage(ctx, dims, texImage, + GL_RGBA, GL_UNSIGNED_BYTE, texel, + &ctx->DefaultPacking); } _mesa_test_texobj_completeness(ctx, texObj); @@ -1193,7 +1188,7 @@ create_textures(struct gl_context *ctx, GLenum target, /* Allocate new, empty texture objects */ for (i = 0; i < n; i++) { struct gl_texture_object *texObj; - texObj = ctx->Driver.NewTextureObject(ctx, textures[i], target); + texObj = st_NewTextureObject(ctx, textures[i], target); if (!texObj) { _mesa_HashUnlockMutex(ctx->Shared->TexObjects); _mesa_error(ctx, GL_OUT_OF_MEMORY, "%s", caller); @@ -1474,9 +1469,7 @@ delete_textures(struct gl_context *ctx, GLsizei n, const GLuint *textures) */ _mesa_HashRemove(ctx->Shared->TexObjects, delObj->Name); - if (ctx->Driver.TextureRemovedFromShared) { - ctx->Driver.TextureRemovedFromShared(ctx, delObj); - } + st_TextureReleaseAllSamplerViews(ctx, delObj); /* Unreference the texobj. If refcount hits zero, the texture * will be deleted. @@ -1748,7 +1741,7 @@ _mesa_lookup_or_create_texture(struct gl_context *ctx, GLenum target, } /* if this is a new texture id, allocate a texture object now */ - newTexObj = ctx->Driver.NewTextureObject(ctx, texName, target); + newTexObj = st_NewTextureObject(ctx, texName, target); if (!newTexObj) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "%s", caller); return NULL; diff --git a/src/mesa/main/texparam.c b/src/mesa/main/texparam.c index ffa12134f17..4cec4ba7fea 100644 --- a/src/mesa/main/texparam.c +++ b/src/mesa/main/texparam.c @@ -47,6 +47,8 @@ #include "program/prog_instruction.h" #include "util/u_math.h" +#include "state_tracker/st_cb_texture.h" + /** * Use macro to resolve undefined clamping behaviour when using lroundf */ @@ -909,8 +911,8 @@ _mesa_texture_parameterf(struct gl_context *ctx, } } - if (ctx->Driver.TexParameter && need_update) { - ctx->Driver.TexParameter(ctx, texObj, pname); + if (need_update) { + st_TexParameter(ctx, texObj, pname); } } @@ -977,8 +979,8 @@ _mesa_texture_parameterfv(struct gl_context *ctx, need_update = set_tex_parameterf(ctx, texObj, pname, params, dsa); } - if (ctx->Driver.TexParameter && need_update) { - ctx->Driver.TexParameter(ctx, texObj, pname); + if (need_update) { + st_TexParameter(ctx, texObj, pname); } } @@ -1021,8 +1023,8 @@ _mesa_texture_parameteri(struct gl_context *ctx, } } - if (ctx->Driver.TexParameter && need_update) { - ctx->Driver.TexParameter(ctx, texObj, pname); + if (need_update) { + st_TexParameter(ctx, texObj, pname); } } @@ -1064,8 +1066,8 @@ _mesa_texture_parameteriv(struct gl_context *ctx, need_update = set_tex_parameteri(ctx, texObj, pname, params, dsa); } - if (ctx->Driver.TexParameter && need_update) { - ctx->Driver.TexParameter(ctx, texObj, pname); + if (need_update) { + st_TexParameter(ctx, texObj, pname); } } diff --git a/src/mesa/main/texstate.c b/src/mesa/main/texstate.c index 6ad0eddfb50..1d27688e977 100644 --- a/src/mesa/main/texstate.c +++ b/src/mesa/main/texstate.c @@ -42,6 +42,7 @@ #include "util/bitscan.h" #include "util/bitset.h" +#include "state_tracker/st_cb_texture.h" /** * Default texture combine environment state. This is used to initialize @@ -1005,10 +1006,10 @@ alloc_proxy_textures( struct gl_context *ctx ) for (tgt = 0; tgt < NUM_TEXTURE_TARGETS; tgt++) { if (!(ctx->Texture.ProxyTex[tgt] - = ctx->Driver.NewTextureObject(ctx, 0, targets[tgt]))) { + = st_NewTextureObject(ctx, 0, targets[tgt]))) { /* out of memory, free what we did allocate */ while (--tgt >= 0) { - ctx->Driver.DeleteTexture(ctx, ctx->Texture.ProxyTex[tgt]); + st_DeleteTextureObject(ctx, ctx->Texture.ProxyTex[tgt]); } return GL_FALSE; } @@ -1132,7 +1133,7 @@ _mesa_free_texture_data(struct gl_context *ctx) /* Free proxy texture objects */ for (tgt = 0; tgt < NUM_TEXTURE_TARGETS; tgt++) - ctx->Driver.DeleteTexture(ctx, ctx->Texture.ProxyTex[tgt]); + st_DeleteTextureObject(ctx, ctx->Texture.ProxyTex[tgt]); /* GL_ARB_texture_buffer_object */ _mesa_reference_buffer_object(ctx, &ctx->Texture.BufferObject, NULL); diff --git a/src/mesa/main/texstorage.c b/src/mesa/main/texstorage.c index 77abc6c511f..af0508d4757 100644 --- a/src/mesa/main/texstorage.c +++ b/src/mesa/main/texstorage.c @@ -41,6 +41,7 @@ #include "glformats.h" #include "hash.h" +#include "state_tracker/st_cb_texture.h" /** * Check if the given texture target is a legal texture object target @@ -287,7 +288,7 @@ _mesa_AllocTextureStorage_sw(struct gl_context *ctx, 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)) + if (!st_AllocTextureImageBuffer(ctx, texImage)) return GL_FALSE; } } @@ -419,8 +420,8 @@ texture_storage(struct gl_context *ctx, GLuint dims, dimensionsOK = _mesa_legal_texture_dimensions(ctx, target, 0, width, height, depth, 0); - sizeOK = ctx->Driver.TestProxyTexImage(ctx, target, levels, 0, texFormat, - 1, width, height, depth); + sizeOK = st_TestProxyTexImage(ctx, target, levels, 0, texFormat, + 1, width, height, depth); } if (_mesa_is_proxy_texture(target)) { @@ -462,18 +463,18 @@ texture_storage(struct gl_context *ctx, GLuint dims, /* Setup the backing memory */ if (memObj) { - if (!ctx->Driver.SetTextureStorageForMemoryObject(ctx, texObj, memObj, - levels, - width, height, depth, - offset)) { + if (!st_SetTextureStorageForMemoryObject(ctx, texObj, memObj, + levels, + width, height, depth, + offset)) { clear_texture_fields(ctx, texObj); return; } } else { - if (!ctx->Driver.AllocTextureStorage(ctx, texObj, levels, - width, height, depth)) { + if (!st_AllocTextureStorage(ctx, texObj, levels, + width, height, depth)) { /* Reset the texture images' info to zeros. * Strictly speaking, we probably don't have to do this since * generating GL_OUT_OF_MEMORY can leave things in an undefined diff --git a/src/mesa/main/texstore.c b/src/mesa/main/texstore.c index 8e0d8e951c2..7caaa62f20f 100755 --- a/src/mesa/main/texstore.c +++ b/src/mesa/main/texstore.c @@ -77,6 +77,7 @@ #include "util/format_rgb9e5.h" #include "util/format_r11g11b10f.h" +#include "state_tracker/st_cb_texture.h" enum { ZERO = 4, @@ -1066,10 +1067,10 @@ store_texsubimage(struct gl_context *ctx, GLubyte *dstMap; GLint dstRowStride; - ctx->Driver.MapTextureImage(ctx, texImage, - slice + sliceOffset, - xoffset, yoffset, width, height, - mapMode, &dstMap, &dstRowStride); + st_MapTextureImage(ctx, texImage, + slice + sliceOffset, + xoffset, yoffset, width, height, + mapMode, &dstMap, &dstRowStride); if (dstMap) { /* Note: we're only storing a 2D (or 1D) slice at a time but we need * to pass the right 'dims' value so that GL_UNPACK_SKIP_IMAGES is @@ -1082,7 +1083,7 @@ store_texsubimage(struct gl_context *ctx, width, height, 1, /* w, h, d */ format, type, src, packing); - ctx->Driver.UnmapTextureImage(ctx, texImage, slice + sliceOffset); + st_UnmapTextureImage(ctx, texImage, slice + sliceOffset); } src += srcImageStride; @@ -1100,7 +1101,7 @@ store_texsubimage(struct gl_context *ctx, /** - * Fallback code for ctx->Driver.TexImage(). + * Fallback code for TexImage(). * Basically, allocate storage for the texture image, then copy the * user's image into it. */ @@ -1117,7 +1118,7 @@ _mesa_store_teximage(struct gl_context *ctx, return; /* allocate storage for texture data */ - if (!ctx->Driver.AllocTextureImageBuffer(ctx, texImage)) { + if (!st_AllocTextureImageBuffer(ctx, texImage)) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage%uD", dims); return; } @@ -1192,11 +1193,11 @@ _mesa_store_cleartexsubimage(struct gl_context *ctx, clearValueSize = _mesa_get_format_bytes(texImage->TexFormat); for (z = 0; z < depth; z++) { - ctx->Driver.MapTextureImage(ctx, texImage, - z + zoffset, xoffset, yoffset, - width, height, - GL_MAP_WRITE_BIT, - &dstMap, &dstRowStride); + st_MapTextureImage(ctx, texImage, + z + zoffset, xoffset, yoffset, + width, height, + GL_MAP_WRITE_BIT, + &dstMap, &dstRowStride); if (dstMap == NULL) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "glClearTex*Image"); return; @@ -1213,7 +1214,7 @@ _mesa_store_cleartexsubimage(struct gl_context *ctx, clearValueSize); } - ctx->Driver.UnmapTextureImage(ctx, texImage, z + zoffset); + st_UnmapTextureImage(ctx, texImage, z + zoffset); } } @@ -1241,16 +1242,16 @@ _mesa_store_compressed_teximage(struct gl_context *ctx, GLuint dims, assert(texImage->Depth > 0); /* allocate storage for texture data */ - if (!ctx->Driver.AllocTextureImageBuffer(ctx, texImage)) { + if (!st_AllocTextureImageBuffer(ctx, texImage)) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCompressedTexImage%uD", dims); return; } - ctx->Driver.CompressedTexSubImage(ctx, dims, texImage, - 0, 0, 0, - texImage->Width, texImage->Height, texImage->Depth, - texImage->TexFormat, - imageSize, data); + st_CompressedTexSubImage(ctx, dims, texImage, + 0, 0, 0, + texImage->Width, texImage->Height, texImage->Depth, + texImage->TexFormat, + imageSize, data); } @@ -1356,10 +1357,10 @@ _mesa_store_compressed_texsubimage(struct gl_context *ctx, GLuint dims, for (slice = 0; slice < store.CopySlices; slice++) { /* Map dest texture buffer */ - ctx->Driver.MapTextureImage(ctx, texImage, slice + zoffset, - xoffset, yoffset, width, height, - GL_MAP_WRITE_BIT | GL_MAP_INVALIDATE_RANGE_BIT, - &dstMap, &dstRowStride); + st_MapTextureImage(ctx, texImage, slice + zoffset, + xoffset, yoffset, width, height, + GL_MAP_WRITE_BIT | GL_MAP_INVALIDATE_RANGE_BIT, + &dstMap, &dstRowStride); if (dstMap) { @@ -1377,7 +1378,7 @@ _mesa_store_compressed_texsubimage(struct gl_context *ctx, GLuint dims, } } - ctx->Driver.UnmapTextureImage(ctx, texImage, slice + zoffset); + st_UnmapTextureImage(ctx, texImage, slice + zoffset); /* advance to next slice */ src += store.TotalBytesPerRow * (store.TotalRowsPerSlice diff --git a/src/mesa/main/texturebindless.c b/src/mesa/main/texturebindless.c index 3f9c69587ec..a762fc1c419 100644 --- a/src/mesa/main/texturebindless.c +++ b/src/mesa/main/texturebindless.c @@ -35,6 +35,8 @@ #include "util/hash_table.h" #include "util/u_memory.h" +#include "state_tracker/st_cb_texture.h" + /** * Return the gl_texture_handle_object for a given 64-bit handle. */ @@ -77,7 +79,7 @@ delete_texture_handle(struct gl_context *ctx, GLuint64 id) _mesa_hash_table_u64_remove(ctx->Shared->TextureHandles, id); mtx_unlock(&ctx->Shared->HandlesMutex); - ctx->Driver.DeleteTextureHandle(ctx, id); + st_DeleteTextureHandle(ctx, id); } /** @@ -90,7 +92,7 @@ delete_image_handle(struct gl_context *ctx, GLuint64 id) _mesa_hash_table_u64_remove(ctx->Shared->ImageHandles, id); mtx_unlock(&ctx->Shared->HandlesMutex); - ctx->Driver.DeleteImageHandle(ctx, id); + st_DeleteImageHandle(ctx, id); } /** @@ -131,7 +133,7 @@ make_texture_handle_resident(struct gl_context *ctx, _mesa_hash_table_u64_insert(ctx->ResidentTextureHandles, handle, texHandleObj); - ctx->Driver.MakeTextureHandleResident(ctx, handle, GL_TRUE); + st_MakeTextureHandleResident(ctx, handle, GL_TRUE); /* Reference the texture object (and the separate sampler if needed) to * be sure it won't be deleted until it is not bound anywhere and there @@ -145,7 +147,7 @@ make_texture_handle_resident(struct gl_context *ctx, _mesa_hash_table_u64_remove(ctx->ResidentTextureHandles, handle); - ctx->Driver.MakeTextureHandleResident(ctx, handle, GL_FALSE); + st_MakeTextureHandleResident(ctx, handle, GL_FALSE); /* Unreference the texture object but keep the pointer intact, if * refcount hits zero, the texture and all handles will be deleted. @@ -180,7 +182,7 @@ make_image_handle_resident(struct gl_context *ctx, _mesa_hash_table_u64_insert(ctx->ResidentImageHandles, handle, imgHandleObj); - ctx->Driver.MakeImageHandleResident(ctx, handle, access, GL_TRUE); + st_MakeImageHandleResident(ctx, handle, access, GL_TRUE); /* Reference the texture object to be sure it won't be deleted until it * is not bound anywhere and there are no handles using the object that @@ -192,7 +194,7 @@ make_image_handle_resident(struct gl_context *ctx, _mesa_hash_table_u64_remove(ctx->ResidentImageHandles, handle); - ctx->Driver.MakeImageHandleResident(ctx, handle, access, GL_FALSE); + st_MakeImageHandleResident(ctx, handle, access, GL_FALSE); /* Unreference the texture object but keep the pointer intact, if * refcount hits zero, the texture and all handles will be deleted. @@ -237,7 +239,7 @@ get_texture_handle(struct gl_context *ctx, struct gl_texture_object *texObj, } /* Request a new texture handle from the driver. */ - handle = ctx->Driver.NewTextureHandle(ctx, texObj, sampObj); + handle = st_NewTextureHandle(ctx, texObj, sampObj); if (!handle) { mtx_unlock(&ctx->Shared->HandlesMutex); _mesa_error(ctx, GL_OUT_OF_MEMORY, "glGetTexture*HandleARB()"); @@ -332,7 +334,7 @@ get_image_handle(struct gl_context *ctx, struct gl_texture_object *texObj, } /* Request a new image handle from the driver. */ - handle = ctx->Driver.NewImageHandle(ctx, &imgObj); + handle = st_NewImageHandle(ctx, &imgObj); if (!handle) { mtx_unlock(&ctx->Shared->HandlesMutex); _mesa_error(ctx, GL_OUT_OF_MEMORY, "glGetImageHandleARB()"); diff --git a/src/mesa/main/textureview.c b/src/mesa/main/textureview.c index c532fd1b834..e0045104979 100644 --- a/src/mesa/main/textureview.c +++ b/src/mesa/main/textureview.c @@ -44,6 +44,8 @@ #include "stdbool.h" #include "mtypes.h" +#include "state_tracker/st_cb_texture.h" + /* Table 3.X.2 (Compatible internal formats for TextureView) --------------------------------------------------------------------------- | Class | Internal formats | @@ -620,9 +622,9 @@ texture_view(struct gl_context *ctx, struct gl_texture_object *origTexObj, return; } - sizeOK = ctx->Driver.TestProxyTexImage(ctx, target, 1, 0, texFormat, - origTexImage->NumSamples, - width, height, depth); + sizeOK = st_TestProxyTexImage(ctx, target, 1, 0, texFormat, + origTexImage->NumSamples, + width, height, depth); if (!sizeOK) { _mesa_error(ctx, GL_INVALID_OPERATION, "glTextureView(invalid texture size)"); @@ -699,8 +701,7 @@ texture_view(struct gl_context *ctx, struct gl_texture_object *origTexObj, texObj->TargetIndex = _mesa_tex_target_to_index(ctx, target); assert(texObj->TargetIndex < NUM_TEXTURE_TARGETS); - if (ctx->Driver.TextureView != NULL && - !ctx->Driver.TextureView(ctx, texObj, origTexObj)) { + if (!st_TextureView(ctx, texObj, origTexObj)) { return; /* driver recorded error */ } } diff --git a/src/mesa/main/vdpau.c b/src/mesa/main/vdpau.c index 6a96c40bdb8..05d78157ee6 100644 --- a/src/mesa/main/vdpau.c +++ b/src/mesa/main/vdpau.c @@ -41,6 +41,8 @@ #include "teximage.h" #include "vdpau.h" +#include "state_tracker/st_cb_texture.h" + #define MAX_TEXTURES 4 struct vdp_surface @@ -377,7 +379,7 @@ _mesa_VDPAUMapSurfacesNV(GLsizei numSurfaces, const GLintptr *surfaces) return; } - ctx->Driver.FreeTextureImageBuffer(ctx, image); + st_FreeTextureImageBuffer(ctx, image); ctx->Driver.VDPAUMapSurface(ctx, surf->target, surf->access, surf->output, tex, image, @@ -432,7 +434,7 @@ _mesa_VDPAUUnmapSurfacesNV(GLsizei numSurfaces, const GLintptr *surfaces) surf->vdpSurface, j); if (image) - ctx->Driver.FreeTextureImageBuffer(ctx, image); + st_FreeTextureImageBuffer(ctx, image); _mesa_unlock_texture(ctx, tex); } diff --git a/src/mesa/state_tracker/st_cb_copyimage.c b/src/mesa/state_tracker/st_cb_copyimage.c index 4909576292e..afef22304cb 100644 --- a/src/mesa/state_tracker/st_cb_copyimage.c +++ b/src/mesa/state_tracker/st_cb_copyimage.c @@ -26,6 +26,7 @@ #include "state_tracker/st_cb_bitmap.h" #include "state_tracker/st_cb_copyimage.h" #include "state_tracker/st_cb_fbo.h" +#include "state_tracker/st_cb_texture.h" #include "state_tracker/st_texture.h" #include "state_tracker/st_util.h" @@ -579,7 +580,7 @@ fallback_copy_image(struct st_context *st, line_bytes = _mesa_format_row_stride(dst_image->TexFormat, dst_w); if (dst_image) { - st->ctx->Driver.MapTextureImage( + st_MapTextureImage( st->ctx, dst_image, dst_z, dst_x, dst_y, dst_w, dst_h, GL_MAP_WRITE_BIT, &dst, &dst_stride); @@ -592,7 +593,7 @@ fallback_copy_image(struct st_context *st, } if (src_image) { - st->ctx->Driver.MapTextureImage( + st_MapTextureImage( st->ctx, src_image, src_z, src_x, src_y, src_w, src_h, GL_MAP_READ_BIT, &src, &src_stride); @@ -611,13 +612,13 @@ fallback_copy_image(struct st_context *st, } if (dst_image) { - st->ctx->Driver.UnmapTextureImage(st->ctx, dst_image, dst_z); + st_UnmapTextureImage(st->ctx, dst_image, dst_z); } else { pipe_texture_unmap(st->pipe, dst_transfer); } if (src_image) { - st->ctx->Driver.UnmapTextureImage(st->ctx, src_image, src_z); + st_UnmapTextureImage(st->ctx, src_image, src_z); } else { pipe_texture_unmap(st->pipe, src_transfer); } diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c index 599d2099d6f..3767ff46d91 100644 --- a/src/mesa/state_tracker/st_cb_texture.c +++ b/src/mesa/state_tracker/st_cb_texture.c @@ -386,8 +386,7 @@ st_pbo_get_dst_format(struct gl_context *ctx, enum pipe_texture_target target, return dst_format; } -/** called via ctx->Driver.NewTextureImage() */ -static struct gl_texture_image * +struct gl_texture_image * st_NewTextureImage(struct gl_context * ctx) { DBG("%s\n", __func__); @@ -396,8 +395,7 @@ st_NewTextureImage(struct gl_context * ctx) } -/** called via ctx->Driver.DeleteTextureImage() */ -static void +void st_DeleteTextureImage(struct gl_context * ctx, struct gl_texture_image *img) { /* nothing special (yet) for st_texture_image */ @@ -405,8 +403,7 @@ st_DeleteTextureImage(struct gl_context * ctx, struct gl_texture_image *img) } -/** called via ctx->Driver.NewTextureObject() */ -static struct gl_texture_object * +struct gl_texture_object * st_NewTextureObject(struct gl_context * ctx, GLuint name, GLenum target) { struct st_texture_object *obj = ST_CALLOC_STRUCT(st_texture_object); @@ -437,8 +434,7 @@ st_NewTextureObject(struct gl_context * ctx, GLuint name, GLenum target) } -/** called via ctx->Driver.DeleteTextureObject() */ -static void +void st_DeleteTextureObject(struct gl_context *ctx, struct gl_texture_object *texObj) { @@ -458,7 +454,7 @@ st_DeleteTextureObject(struct gl_context *ctx, * lead to dangling pointers to destroyed contexts. * Release the views to prevent this. */ -static void +void st_TextureReleaseAllSamplerViews(struct gl_context *ctx, struct gl_texture_object *texObj) { @@ -468,8 +464,7 @@ st_TextureReleaseAllSamplerViews(struct gl_context *ctx, st_texture_release_all_sampler_views(st, stObj); } -/** called via ctx->Driver.FreeTextureImageBuffer() */ -static void +void st_FreeTextureImageBuffer(struct gl_context *ctx, struct gl_texture_image *texImage) { @@ -556,8 +551,7 @@ compressed_tex_fallback_allocate(struct st_context *st, } -/** called via ctx->Driver.MapTextureImage() */ -static void +void st_MapTextureImage(struct gl_context *ctx, struct gl_texture_image *texImage, GLuint slice, GLuint x, GLuint y, GLuint w, GLuint h, @@ -619,8 +613,7 @@ st_MapTextureImage(struct gl_context *ctx, } -/** called via ctx->Driver.UnmapTextureImage() */ -static void +void st_UnmapTextureImage(struct gl_context *ctx, struct gl_texture_image *texImage, GLuint slice) @@ -1004,11 +997,10 @@ guess_and_alloc_texture(struct st_context *st, /** - * Called via ctx->Driver.AllocTextureImageBuffer(). * If the texture object/buffer already has space for the indicated image, * we're done. Otherwise, allocate memory for the new texture image. */ -static GLboolean +GLboolean st_AllocTextureImageBuffer(struct gl_context *ctx, struct gl_texture_image *texImage) { @@ -1963,7 +1955,7 @@ fail: } -static void +void st_TexSubImage(struct gl_context *ctx, GLuint dims, struct gl_texture_image *texImage, GLint xoffset, GLint yoffset, GLint zoffset, @@ -2243,7 +2235,7 @@ fallback: } -static void +void st_TexImage(struct gl_context * ctx, GLuint dims, struct gl_texture_image *texImage, GLenum format, GLenum type, const void *pixels, @@ -2257,7 +2249,7 @@ st_TexImage(struct gl_context * ctx, GLuint dims, return; /* allocate storage for texture data */ - if (!ctx->Driver.AllocTextureImageBuffer(ctx, texImage)) { + if (!st_AllocTextureImageBuffer(ctx, texImage)) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage%uD", dims); return; } @@ -2296,7 +2288,7 @@ st_try_pbo_compressed_texsubimage(struct gl_context *ctx, return success; } -static void +void st_CompressedTexSubImage(struct gl_context *ctx, GLuint dims, struct gl_texture_image *texImage, GLint x, GLint y, GLint z, @@ -2435,7 +2427,7 @@ fallback: } -static void +void st_CompressedTexImage(struct gl_context *ctx, GLuint dims, struct gl_texture_image *texImage, GLsizei imageSize, const void *data) @@ -2485,7 +2477,7 @@ st_CompressedTexImage(struct gl_context *ctx, GLuint dims, * texture layouts during texture uploads/downloads, so the blit * we do here should be free in such cases. */ -static void +void st_GetTexSubImage(struct gl_context * ctx, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLint depth, @@ -2822,7 +2814,7 @@ st_can_copyteximage_using_blit(const struct gl_texture_image *texImage, * * Note: srcY=0=Bottom of renderbuffer (GL convention) */ -static void +void st_CopyTexSubImage(struct gl_context *ctx, GLuint dims, struct gl_texture_image *texImage, GLint destX, GLint destY, GLint slice, @@ -3376,7 +3368,7 @@ st_texture_storage(struct gl_context *ctx, * Called via ctx->Driver.AllocTextureStorage() to allocate texture memory * for a whole mipmap stack. */ -static GLboolean +GLboolean st_AllocTextureStorage(struct gl_context *ctx, struct gl_texture_object *texObj, GLsizei levels, GLsizei width, @@ -3388,7 +3380,7 @@ st_AllocTextureStorage(struct gl_context *ctx, } -static GLboolean +GLboolean st_TestProxyTexImage(struct gl_context *ctx, GLenum target, GLuint numLevels, GLint level, mesa_format format, GLuint numSamples, @@ -3444,7 +3436,7 @@ st_TestProxyTexImage(struct gl_context *ctx, GLenum target, } } -static GLboolean +GLboolean st_TextureView(struct gl_context *ctx, struct gl_texture_object *texObj, struct gl_texture_object *origTexObj) @@ -3534,7 +3526,7 @@ find_mipmap_level(const struct gl_texture_image *texImage, } -static void +void st_ClearTexSubImage(struct gl_context *ctx, struct gl_texture_image *texImage, GLint xoffset, GLint yoffset, GLint zoffset, @@ -3594,7 +3586,7 @@ st_ClearTexSubImage(struct gl_context *ctx, * Called via the glTexParam*() function, but only when some texture object * state has actually changed. */ -static void +void st_TexParameter(struct gl_context *ctx, struct gl_texture_object *texObj, GLenum pname) { @@ -3625,7 +3617,7 @@ st_TexParameter(struct gl_context *ctx, } } -static GLboolean +GLboolean st_SetTextureStorageForMemoryObject(struct gl_context *ctx, struct gl_texture_object *texObj, struct gl_memory_object *memObj, @@ -3638,7 +3630,7 @@ st_SetTextureStorageForMemoryObject(struct gl_context *ctx, memObj, offset); } -static GLuint64 +GLuint64 st_NewTextureHandle(struct gl_context *ctx, struct gl_texture_object *texObj, struct gl_sampler_object *sampObj) { @@ -3665,7 +3657,7 @@ st_NewTextureHandle(struct gl_context *ctx, struct gl_texture_object *texObj, } -static void +void st_DeleteTextureHandle(struct gl_context *ctx, GLuint64 handle) { struct st_context *st = st_context(ctx); @@ -3675,7 +3667,7 @@ st_DeleteTextureHandle(struct gl_context *ctx, GLuint64 handle) } -static void +void st_MakeTextureHandleResident(struct gl_context *ctx, GLuint64 handle, bool resident) { @@ -3686,7 +3678,7 @@ st_MakeTextureHandleResident(struct gl_context *ctx, GLuint64 handle, } -static GLuint64 +GLuint64 st_NewImageHandle(struct gl_context *ctx, struct gl_image_unit *imgObj) { struct st_context *st = st_context(ctx); @@ -3699,7 +3691,7 @@ st_NewImageHandle(struct gl_context *ctx, struct gl_image_unit *imgObj) } -static void +void st_DeleteImageHandle(struct gl_context *ctx, GLuint64 handle) { struct st_context *st = st_context(ctx); @@ -3709,7 +3701,7 @@ st_DeleteImageHandle(struct gl_context *ctx, GLuint64 handle) } -static void +void st_MakeImageHandleResident(struct gl_context *ctx, GLuint64 handle, GLenum access, bool resident) { @@ -3718,51 +3710,3 @@ st_MakeImageHandleResident(struct gl_context *ctx, GLuint64 handle, pipe->make_image_handle_resident(pipe, handle, access, resident); } - - -void -st_init_texture_functions(struct dd_function_table *functions) -{ - functions->ChooseTextureFormat = st_ChooseTextureFormat; - functions->QueryInternalFormat = st_QueryInternalFormat; - functions->TexImage = st_TexImage; - functions->TexSubImage = st_TexSubImage; - functions->CompressedTexSubImage = st_CompressedTexSubImage; - functions->CopyTexSubImage = st_CopyTexSubImage; - functions->GenerateMipmap = st_generate_mipmap; - - functions->GetTexSubImage = st_GetTexSubImage; - - /* compressed texture functions */ - functions->CompressedTexImage = st_CompressedTexImage; - - functions->NewTextureObject = st_NewTextureObject; - functions->NewTextureImage = st_NewTextureImage; - functions->DeleteTextureImage = st_DeleteTextureImage; - functions->DeleteTexture = st_DeleteTextureObject; - functions->TextureRemovedFromShared = st_TextureReleaseAllSamplerViews; - functions->AllocTextureImageBuffer = st_AllocTextureImageBuffer; - functions->FreeTextureImageBuffer = st_FreeTextureImageBuffer; - functions->MapTextureImage = st_MapTextureImage; - functions->UnmapTextureImage = st_UnmapTextureImage; - - /* XXX Temporary until we can query pipe's texture sizes */ - functions->TestProxyTexImage = st_TestProxyTexImage; - - functions->AllocTextureStorage = st_AllocTextureStorage; - functions->TextureView = st_TextureView; - functions->ClearTexSubImage = st_ClearTexSubImage; - - functions->TexParameter = st_TexParameter; - - /* bindless functions */ - functions->NewTextureHandle = st_NewTextureHandle; - functions->DeleteTextureHandle = st_DeleteTextureHandle; - functions->MakeTextureHandleResident = st_MakeTextureHandleResident; - functions->NewImageHandle = st_NewImageHandle; - functions->DeleteImageHandle = st_DeleteImageHandle; - functions->MakeImageHandleResident = st_MakeImageHandleResident; - - /* external object functions */ - functions->SetTextureStorageForMemoryObject = st_SetTextureStorageForMemoryObject; -} diff --git a/src/mesa/state_tracker/st_cb_texture.h b/src/mesa/state_tracker/st_cb_texture.h index ed6ed16fed8..04588f50879 100644 --- a/src/mesa/state_tracker/st_cb_texture.h +++ b/src/mesa/state_tracker/st_cb_texture.h @@ -51,8 +51,85 @@ st_finalize_texture(struct gl_context *ctx, struct gl_texture_object *tObj, GLuint cubeMapFace); - -extern void -st_init_texture_functions(struct dd_function_table *functions); - +struct gl_texture_image *st_NewTextureImage(struct gl_context *ctx); +void st_DeleteTextureImage(struct gl_context *ctx, struct gl_texture_image *img); +struct gl_texture_object *st_NewTextureObject(struct gl_context *ctx, + GLuint name, GLenum target); +void st_DeleteTextureObject(struct gl_context *ctx, + struct gl_texture_object *texObj); +void st_TextureReleaseAllSamplerViews(struct gl_context *ctx, + struct gl_texture_object *texObj); +void st_FreeTextureImageBuffer(struct gl_context *ctx, + struct gl_texture_image *texImage); +void st_MapTextureImage(struct gl_context *ctx, + struct gl_texture_image *texImage, + GLuint slice, GLuint x, GLuint y, GLuint w, GLuint h, + GLbitfield mode, + GLubyte **mapOut, GLint *rowStrideOut); +void st_UnmapTextureImage(struct gl_context *ctx, + struct gl_texture_image *texImage, + GLuint slice); +GLboolean st_AllocTextureImageBuffer(struct gl_context *ctx, + struct gl_texture_image *texImage); +void st_TexSubImage(struct gl_context *ctx, GLuint dims, + struct gl_texture_image *texImage, + GLint xoffset, GLint yoffset, GLint zoffset, + GLint width, GLint height, GLint depth, + GLenum format, GLenum type, const void *pixels, + const struct gl_pixelstore_attrib *unpack); +void st_TexImage(struct gl_context * ctx, GLuint dims, + struct gl_texture_image *texImage, + GLenum format, GLenum type, const void *pixels, + const struct gl_pixelstore_attrib *unpack); +void st_CompressedTexSubImage(struct gl_context *ctx, GLuint dims, + struct gl_texture_image *texImage, + GLint x, GLint y, GLint z, + GLsizei w, GLsizei h, GLsizei d, + GLenum format, GLsizei imageSize, const void *data); +void st_CompressedTexImage(struct gl_context *ctx, GLuint dims, + struct gl_texture_image *texImage, + GLsizei imageSize, const void *data); +void st_GetTexSubImage(struct gl_context * ctx, + GLint xoffset, GLint yoffset, GLint zoffset, + GLsizei width, GLsizei height, GLint depth, + GLenum format, GLenum type, void * pixels, + struct gl_texture_image *texImage); +void st_CopyTexSubImage(struct gl_context *ctx, GLuint dims, + struct gl_texture_image *texImage, + GLint destX, GLint destY, GLint slice, + struct gl_renderbuffer *rb, + GLint srcX, GLint srcY, GLsizei width, GLsizei height); +GLboolean st_AllocTextureStorage(struct gl_context *ctx, + struct gl_texture_object *texObj, + GLsizei levels, GLsizei width, + GLsizei height, GLsizei depth); +GLboolean st_TestProxyTexImage(struct gl_context *ctx, GLenum target, + GLuint numLevels, GLint level, + mesa_format format, GLuint numSamples, + GLint width, GLint height, GLint depth); +GLboolean st_TextureView(struct gl_context *ctx, + struct gl_texture_object *texObj, + struct gl_texture_object *origTexObj); +void st_ClearTexSubImage(struct gl_context *ctx, + struct gl_texture_image *texImage, + GLint xoffset, GLint yoffset, GLint zoffset, + GLsizei width, GLsizei height, GLsizei depth, + const void *clearValue); +void st_TexParameter(struct gl_context *ctx, + struct gl_texture_object *texObj, GLenum pname); +GLboolean st_SetTextureStorageForMemoryObject(struct gl_context *ctx, + struct gl_texture_object *texObj, + struct gl_memory_object *memObj, + GLsizei levels, GLsizei width, + GLsizei height, GLsizei depth, + GLuint64 offset); +GLuint64 st_NewTextureHandle(struct gl_context *ctx, struct gl_texture_object *texObj, + struct gl_sampler_object *sampObj); +void st_DeleteTextureHandle(struct gl_context *ctx, GLuint64 handle); +void st_MakeTextureHandleResident(struct gl_context *ctx, GLuint64 handle, + bool resident); +GLuint64 st_NewImageHandle(struct gl_context *ctx, struct gl_image_unit *imgObj); +void st_DeleteImageHandle(struct gl_context *ctx, GLuint64 handle); +void st_MakeImageHandleResident(struct gl_context *ctx, GLuint64 handle, + GLenum access, bool resident); #endif /* ST_CB_TEXTURE_H */ diff --git a/src/mesa/state_tracker/st_context.c b/src/mesa/state_tracker/st_context.c index 9085fd56a1d..2f744b60e2a 100644 --- a/src/mesa/state_tracker/st_context.c +++ b/src/mesa/state_tracker/st_context.c @@ -60,7 +60,6 @@ #include "st_cb_program.h" #include "st_cb_queryobj.h" #include "st_cb_readpixels.h" -#include "st_cb_texture.h" #include "st_cb_flush.h" #include "st_cb_viewport.h" #include "st_atom.h" @@ -944,7 +943,6 @@ st_init_driver_functions(struct pipe_screen *screen, st_init_msaa_functions(functions); st_init_program_functions(functions); st_init_readpixels_functions(functions); - st_init_texture_functions(functions); st_init_flush_functions(screen, functions); st_init_viewport_functions(functions); st_init_compute_functions(functions); diff --git a/src/mesa/state_tracker/st_gen_mipmap.c b/src/mesa/state_tracker/st_gen_mipmap.c index 8f39315178e..481ef8ba550 100644 --- a/src/mesa/state_tracker/st_gen_mipmap.c +++ b/src/mesa/state_tracker/st_gen_mipmap.c @@ -45,10 +45,6 @@ #include "st_cb_bitmap.h" #include "st_cb_texture.h" - -/** - * Called via ctx->Driver.GenerateMipmap(). - */ void st_generate_mipmap(struct gl_context *ctx, GLenum target, struct gl_texture_object *texObj)