Mesa (master): mesa: extend _mesa_lookup_or_create_texture to support EXT_dsa
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Fri Jun 28 19:41:53 UTC 2019
Module: Mesa
Branch: master
Commit: 29194648a6afc2cd681e3f5d1643ca49220b7975
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=29194648a6afc2cd681e3f5d1643ca49220b7975
Author: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer at amd.com>
Date: Tue Jun 4 15:47:05 2019 +0200
mesa: extend _mesa_lookup_or_create_texture to support EXT_dsa
Adds a boolean to implement EXT_dsa specifics.
Reviewed-by: Marek Olšák <marek.olsak at amd.com>
Signed-off-by: Marek Olšák <marek.olsak at amd.com>
---
src/mesa/main/texobj.c | 20 ++++++++++++++++++--
src/mesa/main/texobj.h | 2 +-
2 files changed, 19 insertions(+), 3 deletions(-)
diff --git a/src/mesa/main/texobj.c b/src/mesa/main/texobj.c
index 6dbe56fa19c..5d49ce7924c 100644
--- a/src/mesa/main/texobj.c
+++ b/src/mesa/main/texobj.c
@@ -1705,12 +1705,28 @@ _mesa_bind_texture(struct gl_context *ctx, GLenum target,
struct gl_texture_object *
_mesa_lookup_or_create_texture(struct gl_context *ctx, GLenum target,
- GLuint texName, bool no_error,
+ GLuint texName, bool no_error, bool is_ext_dsa,
const char *caller)
{
struct gl_texture_object *newTexObj = NULL;
int targetIndex;
+ if (is_ext_dsa) {
+ if (_mesa_is_proxy_texture(target)) {
+ /* EXT_dsa allows proxy targets only when texName is 0 */
+ if (texName != 0) {
+ _mesa_error(ctx, GL_INVALID_OPERATION, "%s(target = %s)", caller,
+ _mesa_enum_to_string(target));
+ return NULL;
+ }
+ return _mesa_get_current_tex_object(ctx, target);
+ }
+ if (GL_TEXTURE_CUBE_MAP_POSITIVE_X <= target &&
+ target <= GL_TEXTURE_CUBE_MAP_NEGATIVE_Z) {
+ target = GL_TEXTURE_CUBE_MAP;
+ }
+ }
+
targetIndex = _mesa_tex_target_to_index(ctx, target);
if (!no_error && targetIndex < 0) {
_mesa_error(ctx, GL_INVALID_ENUM, "%s(target = %s)", caller,
@@ -1780,7 +1796,7 @@ bind_texture(struct gl_context *ctx, GLenum target, GLuint texName,
GLenum texunit, bool no_error, const char *caller)
{
struct gl_texture_object *newTexObj =
- _mesa_lookup_or_create_texture(ctx, target, texName, no_error,
+ _mesa_lookup_or_create_texture(ctx, target, texName, no_error, false,
"glBindTexture");
if (!newTexObj)
return;
diff --git a/src/mesa/main/texobj.h b/src/mesa/main/texobj.h
index 3ebfa6715db..54399af5381 100644
--- a/src/mesa/main/texobj.h
+++ b/src/mesa/main/texobj.h
@@ -179,7 +179,7 @@ _mesa_bind_texture(struct gl_context *ctx, GLenum target,
extern struct gl_texture_object *
_mesa_lookup_or_create_texture(struct gl_context *ctx, GLenum target,
- GLuint texName, bool no_error,
+ GLuint texName, bool no_error, bool is_ext_dsa,
const char *name);
/*@}*/
More information about the mesa-commit
mailing list