[Mesa-dev] [PATCH 00/41] ARB_direct_state_access texture functions
Laura Ekstrand
laura at jlekstrand.net
Mon Dec 15 17:22:15 PST 2014
This implements all of the texture functions for ARB_direct_state_access, with the exception of glTextureBufferRange. There is an outstanding bug on the specification for glTextureBufferRange. Fortunately, glTextureBufferRange shares its implementation with glTextureBuffer and will be trivial to add once the bug is fixed.
Most of the implementation work involved abstracting the internals of the traditional GL functions and writing the DSA functions on top of these abstractions. For instance, to implement GenerateTextureMipmap, most of the functionality of GenerateMipmap was moved to a function
void _mesa_generate_texture_mipmap(struct gl_context *ctx, struct gl_texture_object *texObj, GLenum target, bool dsa).
GenerateMipmap and GenerateTextureMipmap were then implemented on top of this function as thin layers that get the context and the relevant texture object. One exciting byproduct of the creation of these backend abstractions is the potential for driver internals (such as meta) to use nameless texture objects. These objects could be created, used, and deleted without costly hash table lookups. Moreover, the backend abstractions avoid the use of GET_CURRENT_CONTEXT(ctx), allowing driver internals to pass in a different context if desired.
For this reason, most of the backend abstractions were exposed to the rest of Mesa and given a name of the form _mesa_[DSA_function_name_in_snake_case]. To avoid confusion between the backend function names and those of software fallbacks, software fallbacks were renamed in the form _mesa_[Driver_function_name]_sw. For instance, the backend for TexStorage2D and TextureStorage2D is named _mesa_texture_storage. To avoid confusion with the software fallback _mesa_alloc_texture_storage, the software fallback was renamed to _mesa_AllocTextureStorage_sw.
ARB_direct_state_access allows the user to create and pass around objects with the effective target of GL_TEXTURE_CUBE_MAP. This causes some unfortunate complexities in the implementation of TextureSubImage*D and GetTextureImage, and there is an outstanding bug on how these implementations should act if the user fails to provide enough storage for his or her cube map. In the meantime, TextureSubImage*D and GetTextureImage throw GL_INVALID_OPERATION if this happens.
Laura Ekstrand (41):
glapi: Added ARB_direct_state_access.xml file.
main: Created a standard function that looks up a texture object by
its ID and throws INVALID_OPERATION if the ID isn't in the hash
table.
i965: intel_tex_image.c now accepts TEXTURE_CUBE_MAP as a valid
target.
main: Moved _mesa_lock_texture and _mesa_unlock_texture to texobj.h
from teximage.h.
main: Moved _mesa_get_current_tex_object from teximage.c to texobj.c.
main: Changed _mesa_alloc_texture_storage to
_mesa_AllocTextureStorage_sw.
main: Renamed _mesa_get_teximage to _mesa_GetTexImage_sw.
main: Renamed _mesa_get_compressed_teximage to
_mesa_GetCompressedTexImage_sw.
main: Removed trailing whitespace in texstate.c.
main: Added entry point for glCreateTextures.
main: Added entry points for glTextureStorage*D.
main: Added entry points for glTextureSubImage*D.
main: Corrected comment on _mesa_is_zero_size_texture.
main: Added entry point for BindTextureUnit.
main: set_tex_parameteri now handles errors according to the OpenGL
4.5 Specification.
main: set_tex_parameterf now handles errors according to the OpenGL
4.5 Specification.
main: Added get_texobj_by_name in texparam.c.
main: Added entry point for glTextureParameterf.
main: Added entry point for glTextureParameterfv.
main: Added entry point for glTextureParameteri.
main: Added entry points for glTextureParameteriv, Iiv, Iuiv.
main: legal_get_tex_level_parameter_target now handles
GL_TEXTURE_CUBE_MAP.
main: Added entry points for glGetTextureLevelParameteriv, fv.
main: Added entry point for glGetTextureParameterfv.
main: Added entry points for glGetTextureParameteriv, Iiv, and Iuiv.
main: Fixed some comments in texparam.c
main: Added entry points for CopyTextureSubImage*D.
main: Nameless texture creation and deletion. Does not affect normal
creation and deletion paths.
main: Added entry point for glGetTextureImage.
main: Added entry point for glGetCompressedTextureImage.
main: Added entry points for glCompressedTextureSubImage*D.
main: Added entry point for glGenerateTextureMipmap.
main: Added entry points for glTextureStorage2DMultisample and
glTextureStorage3DMultisample.
main: Fixed _mesa_texture_image_multisample so that it updates the
texObj->Immutable flag correctly.
main: Added entry point for glTextureBuffer.
main: Deleted trailing whitespaces in texobj.c.
main: Fixed whitespace errors in teximage.h and teximage.c.
main: Refactor in teximage.c to handle NULL from
_mesa_get_current_tex_object.
main: glDeleteTextures now throws GL_INVALID_VALUE if n is negative.
main: Checking for cube completeness in GetTextureImage.
main: Checking for cube completeness in TextureSubImage.
src/mapi/glapi/gen/ARB_direct_state_access.xml | 271 ++++++
src/mapi/glapi/gen/Makefile.am | 1 +
src/mapi/glapi/gen/gl_API.xml | 6 +-
src/mesa/drivers/common/driverfuncs.c | 4 +-
src/mesa/drivers/common/meta.c | 2 +-
src/mesa/drivers/dri/i965/intel_tex.c | 2 +-
src/mesa/drivers/dri/i965/intel_tex_copy.c | 1 +
src/mesa/drivers/dri/i965/intel_tex_image.c | 1 +
src/mesa/drivers/dri/swrast/swrast.c | 1 +
src/mesa/main/extensions.c | 1 +
src/mesa/main/genmipmap.c | 73 +-
src/mesa/main/genmipmap.h | 6 +
src/mesa/main/texgetimage.c | 497 ++++++++---
src/mesa/main/texgetimage.h | 33 +-
src/mesa/main/teximage.c | 1096 +++++++++++++++++-------
src/mesa/main/teximage.h | 133 ++-
src/mesa/main/texobj.c | 397 ++++++++-
src/mesa/main/texobj.h | 48 +-
src/mesa/main/texparam.c | 758 ++++++++++++----
src/mesa/main/texparam.h | 84 +-
src/mesa/main/texstate.c | 22 +-
src/mesa/main/texstate.h | 39 +-
src/mesa/main/texstorage.c | 213 +++--
src/mesa/main/texstorage.h | 39 +-
src/mesa/state_tracker/st_cb_texture.c | 12 +-
25 files changed, 2971 insertions(+), 769 deletions(-)
create mode 100644 src/mapi/glapi/gen/ARB_direct_state_access.xml
--
2.1.0
More information about the mesa-dev
mailing list