mesa/st: move texture APIs to direct st calls
This is a bit more spreadout, but is still pretty straightforward Acked-by: Marek Olšák <marek.olsak@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14100>
This commit is contained in:
@@ -62,6 +62,7 @@
|
||||
#include <stdbool.h>
|
||||
#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);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -154,6 +154,7 @@
|
||||
#include <stdbool.h>
|
||||
#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;
|
||||
|
@@ -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 <target> 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
|
||||
*/
|
||||
|
@@ -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,7 +279,7 @@ write_texture_image(struct gl_texture_object *texObj,
|
||||
store = ctx->Pack; /* save */
|
||||
ctx->Pack = ctx->DefaultPacking;
|
||||
|
||||
ctx->Driver.GetTexSubImage(ctx,
|
||||
st_GetTexSubImage(ctx,
|
||||
0, 0, 0, img->Width, img->Height, img->Depth,
|
||||
GL_RGBA, GL_UNSIGNED_BYTE, buffer, img);
|
||||
|
||||
@@ -607,7 +608,7 @@ _mesa_print_texture(struct gl_context *ctx, struct gl_texture_image *img)
|
||||
GLuint i, j, c;
|
||||
GLubyte *data;
|
||||
|
||||
ctx->Driver.MapTextureImage(ctx, img, slice,
|
||||
st_MapTextureImage(ctx, img, slice,
|
||||
0, 0, img->Width, img->Height, GL_MAP_READ_BIT,
|
||||
&data, &srcRowStride);
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
@@ -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,12 +1031,12 @@ 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,
|
||||
st_MapTextureImage(ctx, atlas->texImage, 0,
|
||||
0, 0, atlas->texWidth, atlas->texHeight,
|
||||
GL_MAP_WRITE_BIT, &map, &map_stride);
|
||||
if (!map) {
|
||||
@@ -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;
|
||||
|
@@ -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,7 +594,7 @@ _is_internalformat_supported(struct gl_context *ctx, GLenum target,
|
||||
}
|
||||
|
||||
/* Let the driver have the final word */
|
||||
ctx->Driver.QueryInternalFormat(ctx, target, internalformat,
|
||||
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,7 +924,7 @@ _mesa_GetInternalformativ(GLenum target, GLenum internalformat, GLenum pname,
|
||||
goto end;
|
||||
}
|
||||
|
||||
ctx->Driver.QueryInternalFormat(ctx, target, internalformat, pname,
|
||||
st_QueryInternalFormat(ctx, target, internalformat, pname,
|
||||
buffer);
|
||||
break;
|
||||
|
||||
@@ -948,7 +948,7 @@ _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,
|
||||
st_QueryInternalFormat(ctx, target, internalformat, pname,
|
||||
buffer);
|
||||
break;
|
||||
|
||||
@@ -979,7 +979,7 @@ _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,
|
||||
texformat = st_ChooseTextureFormat(ctx, target, internalformat,
|
||||
GL_NONE /*format */, GL_NONE /* type */);
|
||||
|
||||
if (texformat == MESA_FORMAT_NONE || baseformat <= 0)
|
||||
@@ -1179,14 +1179,14 @@ _mesa_GetInternalformativ(GLenum target, GLenum internalformat, GLenum pname,
|
||||
!_is_renderable(ctx, internalformat))
|
||||
goto end;
|
||||
|
||||
ctx->Driver.QueryInternalFormat(ctx, target, internalformat, pname,
|
||||
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,
|
||||
st_QueryInternalFormat(ctx, target, internalformat, pname,
|
||||
buffer);
|
||||
break;
|
||||
|
||||
@@ -1194,7 +1194,7 @@ _mesa_GetInternalformativ(GLenum target, GLenum internalformat, GLenum pname,
|
||||
case GL_GET_TEXTURE_IMAGE_FORMAT:
|
||||
case GL_TEXTURE_IMAGE_TYPE:
|
||||
case GL_GET_TEXTURE_IMAGE_TYPE:
|
||||
ctx->Driver.QueryInternalFormat(ctx, target, internalformat, pname,
|
||||
st_QueryInternalFormat(ctx, target, internalformat, pname,
|
||||
buffer);
|
||||
break;
|
||||
|
||||
@@ -1226,7 +1226,7 @@ _mesa_GetInternalformativ(GLenum target, GLenum internalformat, GLenum pname,
|
||||
goto end;
|
||||
}
|
||||
|
||||
ctx->Driver.QueryInternalFormat(ctx, target, internalformat, pname,
|
||||
st_QueryInternalFormat(ctx, target, internalformat, pname,
|
||||
buffer);
|
||||
break;
|
||||
|
||||
@@ -1246,7 +1246,7 @@ _mesa_GetInternalformativ(GLenum target, GLenum internalformat, GLenum pname,
|
||||
goto end;
|
||||
}
|
||||
|
||||
ctx->Driver.QueryInternalFormat(ctx, target, internalformat, pname,
|
||||
st_QueryInternalFormat(ctx, target, internalformat, pname,
|
||||
buffer);
|
||||
break;
|
||||
|
||||
@@ -1256,7 +1256,7 @@ _mesa_GetInternalformativ(GLenum target, GLenum internalformat, GLenum pname,
|
||||
goto end;
|
||||
}
|
||||
|
||||
ctx->Driver.QueryInternalFormat(ctx, target, internalformat, pname,
|
||||
st_QueryInternalFormat(ctx, target, internalformat, pname,
|
||||
buffer);
|
||||
break;
|
||||
|
||||
@@ -1268,7 +1268,7 @@ _mesa_GetInternalformativ(GLenum target, GLenum internalformat, GLenum pname,
|
||||
goto end;
|
||||
}
|
||||
|
||||
ctx->Driver.QueryInternalFormat(ctx, target, internalformat, pname,
|
||||
st_QueryInternalFormat(ctx, target, internalformat, pname,
|
||||
buffer);
|
||||
break;
|
||||
|
||||
@@ -1289,7 +1289,7 @@ _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,
|
||||
st_QueryInternalFormat(ctx, target, internalformat, pname,
|
||||
buffer);
|
||||
break;
|
||||
|
||||
@@ -1313,7 +1313,7 @@ _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,
|
||||
st_QueryInternalFormat(ctx, target, internalformat, pname,
|
||||
buffer);
|
||||
break;
|
||||
|
||||
@@ -1351,7 +1351,7 @@ _mesa_GetInternalformativ(GLenum target, GLenum internalformat, GLenum pname,
|
||||
goto end;
|
||||
}
|
||||
|
||||
ctx->Driver.QueryInternalFormat(ctx, target, internalformat, pname,
|
||||
st_QueryInternalFormat(ctx, target, internalformat, pname,
|
||||
buffer);
|
||||
break;
|
||||
|
||||
@@ -1370,7 +1370,7 @@ _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,
|
||||
st_QueryInternalFormat(ctx, target, internalformat, pname,
|
||||
buffer);
|
||||
break;
|
||||
|
||||
@@ -1378,7 +1378,7 @@ _mesa_GetInternalformativ(GLenum target, GLenum internalformat, GLenum pname,
|
||||
if (!_mesa_has_ARB_shader_image_load_store(ctx))
|
||||
goto end;
|
||||
|
||||
ctx->Driver.QueryInternalFormat(ctx, target, internalformat, pname,
|
||||
st_QueryInternalFormat(ctx, target, internalformat, pname,
|
||||
buffer);
|
||||
break;
|
||||
|
||||
@@ -1491,7 +1491,7 @@ _mesa_GetInternalformativ(GLenum target, GLenum internalformat, GLenum pname,
|
||||
goto end;
|
||||
}
|
||||
|
||||
ctx->Driver.QueryInternalFormat(ctx, target, internalformat, pname,
|
||||
st_QueryInternalFormat(ctx, target, internalformat, pname,
|
||||
buffer);
|
||||
break;
|
||||
|
||||
@@ -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,7 +1545,7 @@ _mesa_GetInternalformativ(GLenum target, GLenum internalformat, GLenum pname,
|
||||
goto end;
|
||||
|
||||
if (pname == GL_TEXTURE_VIEW) {
|
||||
ctx->Driver.QueryInternalFormat(ctx, target, internalformat, pname,
|
||||
st_QueryInternalFormat(ctx, target, internalformat, pname,
|
||||
buffer);
|
||||
} else {
|
||||
GLenum view_class = _mesa_texture_view_lookup_view_class(ctx,
|
||||
@@ -1559,7 +1559,7 @@ _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,
|
||||
st_QueryInternalFormat(ctx, target, internalformat, pname,
|
||||
buffer);
|
||||
break;
|
||||
|
||||
@@ -1567,7 +1567,7 @@ _mesa_GetInternalformativ(GLenum target, GLenum internalformat, GLenum pname,
|
||||
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,
|
||||
st_QueryInternalFormat(ctx, target, internalformat, pname,
|
||||
buffer);
|
||||
else
|
||||
buffer[0] = (GLint)0;
|
||||
|
@@ -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,
|
||||
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);
|
||||
}
|
||||
|
@@ -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,7 +1999,7 @@ 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,
|
||||
st_MapTextureImage(ctx, srcImage, slice,
|
||||
0, 0, srcWidth, srcHeight,
|
||||
GL_MAP_READ_BIT,
|
||||
&srcMaps[slice], &srcRowStride);
|
||||
@@ -2016,7 +2017,7 @@ 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,
|
||||
st_MapTextureImage(ctx, dstImage, slice,
|
||||
0, 0, dstWidth, dstHeight,
|
||||
GL_MAP_WRITE_BIT,
|
||||
&dstMaps[slice], &dstRowStride);
|
||||
@@ -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,7 +2137,7 @@ generate_mipmap_compressed(struct gl_context *ctx, GLenum target,
|
||||
|
||||
/* Get the uncompressed image */
|
||||
assert(srcImage->Level == texObj->Attrib.BaseLevel);
|
||||
ctx->Driver.GetTexSubImage(ctx,
|
||||
st_GetTexSubImage(ctx,
|
||||
0, 0, 0,
|
||||
srcImage->Width, srcImage->Height,
|
||||
srcImage->Depth,
|
||||
@@ -2204,7 +2205,7 @@ 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,
|
||||
st_TexSubImage(ctx, 2, dstImage,
|
||||
0, 0, 0, dstWidth, dstHeight, dstDepth,
|
||||
temp_base_format, temp_datatype,
|
||||
temp_dst, &ctx->DefaultPacking);
|
||||
@@ -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
|
||||
|
@@ -32,6 +32,7 @@
|
||||
#include "main/glformats.h"
|
||||
#include "main/state.h"
|
||||
|
||||
#include "state_tracker/st_format.h"
|
||||
|
||||
/**
|
||||
* Called via glSampleCoverageARB
|
||||
@@ -294,7 +295,7 @@ _mesa_check_sample_count(struct gl_context *ctx, GLenum target,
|
||||
GLint buffer[16] = {-1};
|
||||
GLint limit;
|
||||
|
||||
ctx->Driver.QueryInternalFormat(ctx, target, internalFormat,
|
||||
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.
|
||||
|
@@ -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 */
|
||||
|
@@ -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,7 +95,7 @@ get_tex_depth(struct gl_context *ctx, GLuint dimensions,
|
||||
GLint srcRowStride;
|
||||
|
||||
/* map src texture buffer */
|
||||
ctx->Driver.MapTextureImage(ctx, texImage, zoffset + img,
|
||||
st_MapTextureImage(ctx, texImage, zoffset + img,
|
||||
xoffset, yoffset, width, height,
|
||||
GL_MAP_READ_BIT, &srcMap, &srcRowStride);
|
||||
|
||||
@@ -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,7 +140,7 @@ get_tex_depth_stencil(struct gl_context *ctx, GLuint dimensions,
|
||||
GLint rowstride;
|
||||
|
||||
/* map src texture buffer */
|
||||
ctx->Driver.MapTextureImage(ctx, texImage, zoffset + img,
|
||||
st_MapTextureImage(ctx, texImage, zoffset + img,
|
||||
xoffset, yoffset, width, height,
|
||||
GL_MAP_READ_BIT, &srcMap, &rowstride);
|
||||
|
||||
@@ -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,7 +196,7 @@ get_tex_stencil(struct gl_context *ctx, GLuint dimensions,
|
||||
GLint rowstride;
|
||||
|
||||
/* map src texture buffer */
|
||||
ctx->Driver.MapTextureImage(ctx, texImage, zoffset + img,
|
||||
st_MapTextureImage(ctx, texImage, zoffset + img,
|
||||
xoffset, yoffset, width, height,
|
||||
GL_MAP_READ_BIT,
|
||||
&srcMap, &rowstride);
|
||||
@@ -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,7 +240,7 @@ get_tex_ycbcr(struct gl_context *ctx, GLuint dimensions,
|
||||
GLint rowstride;
|
||||
|
||||
/* map src texture buffer */
|
||||
ctx->Driver.MapTextureImage(ctx, texImage, zoffset + img,
|
||||
st_MapTextureImage(ctx, texImage, zoffset + img,
|
||||
xoffset, yoffset, width, height,
|
||||
GL_MAP_READ_BIT, &srcMap, &rowstride);
|
||||
|
||||
@@ -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,7 +345,7 @@ get_tex_rgba_compressed(struct gl_context *ctx, GLuint dimensions,
|
||||
|
||||
tempSlice = tempImage + slice * 4 * width * height;
|
||||
|
||||
ctx->Driver.MapTextureImage(ctx, texImage, zoffset + slice,
|
||||
st_MapTextureImage(ctx, texImage, zoffset + slice,
|
||||
xoffset, yoffset, width, height,
|
||||
GL_MAP_READ_BIT,
|
||||
&srcMap, &srcRowStride);
|
||||
@@ -351,7 +353,7 @@ get_tex_rgba_compressed(struct gl_context *ctx, GLuint dimensions,
|
||||
_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,7 +474,7 @@ 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,
|
||||
st_MapTextureImage(ctx, texImage, zoffset + img,
|
||||
xoffset, yoffset, width, height,
|
||||
GL_MAP_READ_BIT,
|
||||
&srcMap, &rowstride);
|
||||
@@ -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,7 +657,7 @@ get_tex_memcpy(struct gl_context *ctx,
|
||||
GLint srcRowStride;
|
||||
|
||||
/* map src texture buffer */
|
||||
ctx->Driver.MapTextureImage(ctx, texImage, zoffset,
|
||||
st_MapTextureImage(ctx, texImage, zoffset,
|
||||
xoffset, yoffset, width, height,
|
||||
GL_MAP_READ_BIT, &src, &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,7 +812,7 @@ get_compressed_texsubimage_sw(struct gl_context *ctx,
|
||||
GLubyte *src;
|
||||
|
||||
/* map src texture buffer */
|
||||
ctx->Driver.MapTextureImage(ctx, texImage, zoffset + slice,
|
||||
st_MapTextureImage(ctx, texImage, zoffset + slice,
|
||||
xoffset, yoffset, width, height,
|
||||
GL_MAP_READ_BIT, &src, &srcRowStride);
|
||||
|
||||
@@ -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,7 +1437,7 @@ get_texture_image(struct gl_context *ctx,
|
||||
texImage = texObj->Image[firstFace + i][level];
|
||||
assert(texImage);
|
||||
|
||||
ctx->Driver.GetTexSubImage(ctx, xoffset, yoffset, zoffset,
|
||||
st_GetTexSubImage(ctx, xoffset, yoffset, zoffset,
|
||||
width, height, depth,
|
||||
format, type, pixels, texImage);
|
||||
|
||||
|
@@ -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,7 +2837,7 @@ _mesa_choose_texture_format(struct gl_context *ctx,
|
||||
}
|
||||
}
|
||||
|
||||
f = ctx->Driver.ChooseTextureFormat(ctx, target, internalFormat,
|
||||
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,7 +3080,7 @@ 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),
|
||||
sizeOK = st_TestProxyTexImage(ctx, proxy_target(target),
|
||||
0, level, texFormat, 1,
|
||||
width, height, depth);
|
||||
}
|
||||
@@ -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,11 +3153,11 @@ teximage(struct gl_context *ctx, GLboolean compressed, GLuint dims,
|
||||
/* Give the texture to the driver. <pixels> may be null. */
|
||||
if (width > 0 && height > 0 && depth > 0) {
|
||||
if (compressed) {
|
||||
ctx->Driver.CompressedTexImage(ctx, dims, texImage,
|
||||
st_CompressedTexImage(ctx, dims, texImage,
|
||||
imageSize, pixels);
|
||||
}
|
||||
else {
|
||||
ctx->Driver.TexImage(ctx, dims, texImage, format,
|
||||
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,7 +3567,7 @@ texture_sub_image(struct gl_context *ctx, GLuint dims,
|
||||
xoffset += texImage->Border;
|
||||
}
|
||||
|
||||
ctx->Driver.TexSubImage(ctx, dims, texImage,
|
||||
st_TexSubImage(ctx, dims, texImage,
|
||||
xoffset, yoffset, zoffset,
|
||||
width, height, depth,
|
||||
format, type, pixels, &ctx->Unpack);
|
||||
@@ -4105,12 +4106,12 @@ copytexsubimage_by_slice(struct gl_context *ctx,
|
||||
|
||||
for (slice = 0; slice < height; slice++) {
|
||||
assert(yoffset + slice < texImage->Height);
|
||||
ctx->Driver.CopyTexSubImage(ctx, 2, texImage,
|
||||
st_CopyTexSubImage(ctx, 2, texImage,
|
||||
xoffset, 0, yoffset + slice,
|
||||
rb, x, y + slice, width, 1);
|
||||
}
|
||||
} else {
|
||||
ctx->Driver.CopyTexSubImage(ctx, dims, texImage,
|
||||
st_CopyTexSubImage(ctx, dims, texImage,
|
||||
xoffset, yoffset, zoffset,
|
||||
rb, x, y, width, height);
|
||||
}
|
||||
@@ -4379,7 +4380,7 @@ 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),
|
||||
if (!st_TestProxyTexImage(ctx, proxy_target(target),
|
||||
0, level, texFormat, 1,
|
||||
width, height, 1)) {
|
||||
_mesa_error(ctx, GL_OUT_OF_MEMORY,
|
||||
@@ -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,7 +5166,7 @@ _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,
|
||||
st_ClearTexSubImage(ctx,
|
||||
texImages[0],
|
||||
xoffset, yoffset, zoffset,
|
||||
width, height, depth,
|
||||
@@ -5180,7 +5181,7 @@ _mesa_ClearTexSubImage(GLuint texture, GLint level,
|
||||
goto out;
|
||||
}
|
||||
for (i = zoffset; i < zoffset + depth; i++) {
|
||||
ctx->Driver.ClearTexSubImage(ctx,
|
||||
st_ClearTexSubImage(ctx,
|
||||
texImages[i],
|
||||
xoffset, yoffset, 0,
|
||||
width, height, 1,
|
||||
@@ -5220,7 +5221,7 @@ _mesa_ClearTexImage( GLuint texture, GLint level,
|
||||
}
|
||||
|
||||
for (i = 0; i < numImages; i++) {
|
||||
ctx->Driver.ClearTexSubImage(ctx, texImages[i],
|
||||
st_ClearTexSubImage(ctx, texImages[i],
|
||||
-(GLint) texImages[i]->Border, /* xoffset */
|
||||
-(GLint) texImages[i]->Border, /* yoffset */
|
||||
-(GLint) texImages[i]->Border, /* zoffset */
|
||||
@@ -5678,7 +5679,7 @@ 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,
|
||||
st_CompressedTexSubImage(ctx, dims, texImage,
|
||||
xoffset, yoffset, zoffset,
|
||||
width, height, depth,
|
||||
format, imageSize, data);
|
||||
@@ -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);
|
||||
st_TexParameter(ctx, texObj, GL_ALL_ATTRIB_BITS);
|
||||
} else {
|
||||
if (offset != oldOffset) {
|
||||
ctx->Driver.TexParameter(ctx, texObj, GL_TEXTURE_BUFFER_OFFSET);
|
||||
st_TexParameter(ctx, texObj, GL_TEXTURE_BUFFER_OFFSET);
|
||||
}
|
||||
if (size != oldSize) {
|
||||
ctx->Driver.TexParameter(ctx, texObj, GL_TEXTURE_BUFFER_SIZE);
|
||||
}
|
||||
st_TexParameter(ctx, texObj, GL_TEXTURE_BUFFER_SIZE);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6846,7 +6845,7 @@ 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,
|
||||
sizeOK = st_TestProxyTexImage(ctx, target, 0, 0, texFormat,
|
||||
samples, width, height, depth);
|
||||
|
||||
if (_mesa_is_proxy_texture(target)) {
|
||||
@@ -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,7 +6885,7 @@ texture_image_multisample(struct gl_context *ctx, GLuint dims,
|
||||
|
||||
if (width > 0 && height > 0 && depth > 0) {
|
||||
if (memObj) {
|
||||
if (!ctx->Driver.SetTextureStorageForMemoryObject(ctx, texObj,
|
||||
if (!st_SetTextureStorageForMemoryObject(ctx, texObj,
|
||||
memObj, 1, width,
|
||||
height, depth,
|
||||
offset)) {
|
||||
@@ -6895,7 +6894,7 @@ texture_image_multisample(struct gl_context *ctx, GLuint dims,
|
||||
internalformat, texFormat);
|
||||
}
|
||||
} else {
|
||||
if (!ctx->Driver.AllocTextureStorage(ctx, texObj, 1,
|
||||
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
|
||||
|
@@ -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);
|
||||
}
|
||||
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,7 +998,7 @@ _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,
|
||||
texFormat = st_ChooseTextureFormat(ctx, target,
|
||||
GL_RGBA, GL_RGBA,
|
||||
GL_UNSIGNED_BYTE);
|
||||
|
||||
@@ -1021,7 +1016,7 @@ _mesa_get_fallback_texture(struct gl_context *ctx, gl_texture_index tex)
|
||||
0, /* border */
|
||||
GL_RGBA, texFormat);
|
||||
|
||||
ctx->Driver.TexImage(ctx, dims, texImage,
|
||||
st_TexImage(ctx, dims, texImage,
|
||||
GL_RGBA, GL_UNSIGNED_BYTE, texel,
|
||||
&ctx->DefaultPacking);
|
||||
}
|
||||
@@ -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;
|
||||
|
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -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);
|
||||
|
@@ -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,7 +420,7 @@ 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,
|
||||
sizeOK = st_TestProxyTexImage(ctx, target, levels, 0, texFormat,
|
||||
1, width, height, depth);
|
||||
}
|
||||
|
||||
@@ -462,7 +463,7 @@ texture_storage(struct gl_context *ctx, GLuint dims,
|
||||
|
||||
/* Setup the backing memory */
|
||||
if (memObj) {
|
||||
if (!ctx->Driver.SetTextureStorageForMemoryObject(ctx, texObj, memObj,
|
||||
if (!st_SetTextureStorageForMemoryObject(ctx, texObj, memObj,
|
||||
levels,
|
||||
width, height, depth,
|
||||
offset)) {
|
||||
@@ -472,7 +473,7 @@ texture_storage(struct gl_context *ctx, GLuint dims,
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (!ctx->Driver.AllocTextureStorage(ctx, texObj, levels,
|
||||
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
|
||||
|
@@ -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,7 +1067,7 @@ store_texsubimage(struct gl_context *ctx,
|
||||
GLubyte *dstMap;
|
||||
GLint dstRowStride;
|
||||
|
||||
ctx->Driver.MapTextureImage(ctx, texImage,
|
||||
st_MapTextureImage(ctx, texImage,
|
||||
slice + sliceOffset,
|
||||
xoffset, yoffset, width, height,
|
||||
mapMode, &dstMap, &dstRowStride);
|
||||
@@ -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,7 +1193,7 @@ _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,
|
||||
st_MapTextureImage(ctx, texImage,
|
||||
z + zoffset, xoffset, yoffset,
|
||||
width, height,
|
||||
GL_MAP_WRITE_BIT,
|
||||
@@ -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,12 +1242,12 @@ _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,
|
||||
st_CompressedTexSubImage(ctx, dims, texImage,
|
||||
0, 0, 0,
|
||||
texImage->Width, texImage->Height, texImage->Depth,
|
||||
texImage->TexFormat,
|
||||
@@ -1356,7 +1357,7 @@ _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,
|
||||
st_MapTextureImage(ctx, texImage, slice + zoffset,
|
||||
xoffset, yoffset, width, height,
|
||||
GL_MAP_WRITE_BIT | GL_MAP_INVALIDATE_RANGE_BIT,
|
||||
&dstMap, &dstRowStride);
|
||||
@@ -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
|
||||
|
@@ -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()");
|
||||
|
@@ -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,7 +622,7 @@ texture_view(struct gl_context *ctx, struct gl_texture_object *origTexObj,
|
||||
return;
|
||||
}
|
||||
|
||||
sizeOK = ctx->Driver.TestProxyTexImage(ctx, target, 1, 0, texFormat,
|
||||
sizeOK = st_TestProxyTexImage(ctx, target, 1, 0, texFormat,
|
||||
origTexImage->NumSamples,
|
||||
width, height, depth);
|
||||
if (!sizeOK) {
|
||||
@@ -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 */
|
||||
}
|
||||
}
|
||||
|
@@ -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);
|
||||
}
|
||||
|
@@ -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);
|
||||
}
|
||||
|
@@ -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;
|
||||
}
|
||||
|
@@ -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 */
|
||||
|
@@ -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);
|
||||
|
@@ -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)
|
||||
|
Reference in New Issue
Block a user