[Mesa-dev,22/27] mesa: hook up queries for NUM_TILING_TYPES and TILING_TYPES

Submitted by Andres Rodriguez on July 12, 2017, 10:45 p.m.

Details

Message ID 20170712224532.1307-23-andresx7@gmail.com
State New
Headers show
Series "Initial support for EXT_external_objects v3" ( rev: 3 2 1 ) in Mesa

Not browsing as part of any series.

Commit Message

Andres Rodriguez July 12, 2017, 10:45 p.m.
These are just basic implementations.

Signed-off-by: Andres Rodriguez <andresx7@gmail.com>
---
 src/mesa/main/formatquery.c | 17 +++++++++++++++++
 src/mesa/main/mtypes.h      |  3 +++
 src/mesa/main/texparam.c    | 27 +++++++++++++++++++++++++++
 3 files changed, 47 insertions(+)

Patch hide | download patch | download mbox

diff --git a/src/mesa/main/formatquery.c b/src/mesa/main/formatquery.c
index 07fb2f2..77c7faa 100644
--- a/src/mesa/main/formatquery.c
+++ b/src/mesa/main/formatquery.c
@@ -216,6 +216,8 @@  _legal_parameters(struct gl_context *ctx, GLenum target, GLenum internalformat,
    case GL_CLEAR_BUFFER:
    case GL_TEXTURE_VIEW:
    case GL_VIEW_COMPATIBILITY_CLASS:
+   case GL_NUM_TILING_TYPES_EXT:
+   case GL_TILING_TYPES_EXT:
       /* The ARB_internalformat_query spec says:
        *
        *     "If the <pname> parameter to GetInternalformativ is not SAMPLES
@@ -284,6 +286,7 @@  _set_default_response(GLenum pname, GLint buffer[16])
     */
    switch(pname) {
    case GL_SAMPLES:
+   case GL_TILING_TYPES_EXT:
       break;
 
    case GL_MAX_COMBINED_DIMENSIONS:
@@ -309,6 +312,7 @@  _set_default_response(GLenum pname, GLint buffer[16])
    case GL_TEXTURE_COMPRESSED_BLOCK_WIDTH:
    case GL_TEXTURE_COMPRESSED_BLOCK_HEIGHT:
    case GL_TEXTURE_COMPRESSED_BLOCK_SIZE:
+   case GL_NUM_TILING_TYPES_EXT:
       buffer[0] = 0;
       break;
 
@@ -700,6 +704,13 @@  _mesa_query_internal_format_default(struct gl_context *ctx, GLenum target,
    case GL_FILTER:
       params[0] = GL_FULL_SUPPORT;
       break;
+   case GL_NUM_TILING_TYPES_EXT:
+      params[0] = 2;
+      break;
+   case GL_TILING_TYPES_EXT:
+      params[0] = GL_OPTIMAL_TILING_EXT;
+      params[1] = GL_LINEAR_TILING_EXT;
+      break;
 
    default:
       _set_default_response(pname, params);
@@ -1519,6 +1530,12 @@  _mesa_GetInternalformativ(GLenum target, GLenum internalformat, GLenum pname,
       }
       break;
 
+   case GL_NUM_TILING_TYPES_EXT:
+   case GL_TILING_TYPES_EXT:
+      ctx->Driver.QueryInternalFormat(ctx, target, internalformat, pname,
+                                      buffer);
+      break;
+
    default:
       unreachable("bad param");
    }
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index 463f444..38055f3 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -1057,6 +1057,9 @@  struct gl_texture_object
    /** GL_ARB_shader_image_load_store */
    GLenum ImageFormatCompatibilityType;
 
+   /** GL_EXT_memory_object */
+   GLenum TextureTiling;
+
    /** GL_ARB_bindless_texture */
    struct util_dynarray SamplerHandles;
    struct util_dynarray ImageHandles;
diff --git a/src/mesa/main/texparam.c b/src/mesa/main/texparam.c
index d8bbabf..b6e9150 100644
--- a/src/mesa/main/texparam.c
+++ b/src/mesa/main/texparam.c
@@ -622,6 +622,14 @@  set_tex_parameteri(struct gl_context *ctx,
       }
       goto invalid_pname;
 
+   case GL_TEXTURE_TILING_EXT:
+      if (ctx->Extensions.EXT_memory_object) {
+         texObj->TextureTiling = params[0];
+
+         return GL_TRUE;
+      }
+      goto invalid_pname;
+
    default:
       goto invalid_pname;
    }
@@ -778,6 +786,13 @@  set_tex_parameterf(struct gl_context *ctx,
       }
       return GL_TRUE;
 
+   case GL_TEXTURE_TILING_EXT:
+      if (ctx->Extensions.EXT_memory_object) {
+         texObj->TextureTiling = params[0];
+         return GL_TRUE;
+      }
+      goto invalid_pname;
+
    default:
       goto invalid_pname;
    }
@@ -2019,6 +2034,12 @@  get_tex_parameterfv(struct gl_context *ctx,
          *params = ENUM_TO_FLOAT(obj->Target);
          break;
 
+      case GL_TEXTURE_TILING_EXT:
+         if (!ctx->Extensions.EXT_memory_object)
+            goto invalid_pname;
+         *params = ENUM_TO_FLOAT(obj->TextureTiling);
+         break;
+
       default:
          goto invalid_pname;
    }
@@ -2251,6 +2272,12 @@  get_tex_parameteriv(struct gl_context *ctx,
          *params = (GLint) obj->Target;
          break;
 
+      case GL_TEXTURE_TILING_EXT:
+         if (!ctx->Extensions.EXT_memory_object)
+            goto invalid_pname;
+         *params = (GLint) obj->TextureTiling;
+         break;
+
       default:
          goto invalid_pname;
    }