[Mesa-dev] [PATCH 21/24] mesa: hook up queries for NUM_TILING_TYPES and TILING_TYPES
Timothy Arceri
tarceri at itsqueeze.com
Thu Jul 27 13:08:46 UTC 2017
From: Andres Rodriguez <andresx7 at gmail.com>
These are just basic implementations.
Signed-off-by: Andres Rodriguez <andresx7 at gmail.com>
Reviewed-by: Timothy Arceri <tarceri at itsqueeze.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset at 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(+)
diff --git a/src/mesa/main/formatquery.c b/src/mesa/main/formatquery.c
index 07fb2f2330..77c7faa225 100644
--- a/src/mesa/main/formatquery.c
+++ b/src/mesa/main/formatquery.c
@@ -209,20 +209,22 @@ _legal_parameters(struct gl_context *ctx, GLenum target, GLenum internalformat,
case GL_SIMULTANEOUS_TEXTURE_AND_STENCIL_TEST:
case GL_SIMULTANEOUS_TEXTURE_AND_DEPTH_WRITE:
case GL_SIMULTANEOUS_TEXTURE_AND_STENCIL_WRITE:
case GL_TEXTURE_COMPRESSED:
case GL_TEXTURE_COMPRESSED_BLOCK_WIDTH:
case GL_TEXTURE_COMPRESSED_BLOCK_HEIGHT:
case GL_TEXTURE_COMPRESSED_BLOCK_SIZE:
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
* or NUM_SAMPLE_COUNTS, then an INVALID_ENUM error is generated."
*/
if (!query2) {
_mesa_error(ctx, GL_INVALID_ENUM,
"glGetInternalformativ(pname=%s)",
_mesa_enum_to_string(pname));
@@ -277,20 +279,21 @@ _set_default_response(GLenum pname, GLint buffer[16])
* representing "not supported" or "not applicable" for each <pname>.
*
* " In general:
* - size- or count-based queries will return zero,
* - support-, format- or type-based queries will return NONE,
* - boolean-based queries will return FALSE, and
* - list-based queries return no entries."
*/
switch(pname) {
case GL_SAMPLES:
+ case GL_TILING_TYPES_EXT:
break;
case GL_MAX_COMBINED_DIMENSIONS:
/* This value can be a 64-bit value. As the default is the 32-bit query,
* we pack 2 32-bit integers. So we need to clean both */
buffer[0] = 0;
buffer[1] = 0;
break;
case GL_NUM_SAMPLE_COUNTS:
@@ -302,20 +305,21 @@ _set_default_response(GLenum pname, GLint buffer[16])
case GL_INTERNALFORMAT_STENCIL_SIZE:
case GL_INTERNALFORMAT_SHARED_SIZE:
case GL_MAX_WIDTH:
case GL_MAX_HEIGHT:
case GL_MAX_DEPTH:
case GL_MAX_LAYERS:
case GL_IMAGE_TEXEL_SIZE:
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;
case GL_INTERNALFORMAT_PREFERRED:
case GL_INTERNALFORMAT_RED_TYPE:
case GL_INTERNALFORMAT_GREEN_TYPE:
case GL_INTERNALFORMAT_BLUE_TYPE:
case GL_INTERNALFORMAT_ALPHA_TYPE:
case GL_INTERNALFORMAT_DEPTH_TYPE:
case GL_INTERNALFORMAT_STENCIL_TYPE:
@@ -693,20 +697,27 @@ _mesa_query_internal_format_default(struct gl_context *ctx, GLenum target,
case GL_TEXTURE_VIEW:
case GL_TEXTURE_SHADOW:
case GL_TEXTURE_GATHER:
case GL_TEXTURE_GATHER_SHADOW:
case GL_FRAMEBUFFER_RENDERABLE:
case GL_FRAMEBUFFER_RENDERABLE_LAYERED:
case GL_FRAMEBUFFER_BLEND:
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);
break;
}
}
/*
* For MAX_WIDTH/MAX_HEIGHT/MAX_DEPTH it returns the equivalent GetInteger
* pname for a Getinternalformat pname/target combination. target/pname
@@ -1512,20 +1523,26 @@ _mesa_GetInternalformativ(GLenum target, GLenum internalformat, GLenum pname,
} else {
GLenum view_class = _mesa_texture_view_lookup_view_class(ctx,
internalformat);
if (view_class == GL_FALSE)
goto end;
buffer[0] = view_class;
}
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");
}
end:
if (bufSize != 0 && params == NULL) {
/* Emit a warning to aid application debugging, but go ahead and do the
* memcpy (and probably crash) anyway.
*/
_mesa_warning(ctx,
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index 833b504be4..7ee8358a8f 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -1050,20 +1050,23 @@ struct gl_texture_object
/** GL_ARB_texture_buffer_range */
GLintptr BufferOffset;
GLsizeiptr BufferSize; /**< if this is -1, use BufferObject->Size instead */
/** GL_OES_EGL_image_external */
GLint RequiredTextureImageUnits;
/** 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;
bool HandleAllocated;
};
/** Up to four combiner sources are possible with GL_NV_texture_env_combine4 */
#define MAX_COMBINER_TERMS 4
diff --git a/src/mesa/main/texparam.c b/src/mesa/main/texparam.c
index d8bbabf8f2..b6e91503ea 100644
--- a/src/mesa/main/texparam.c
+++ b/src/mesa/main/texparam.c
@@ -615,20 +615,28 @@ set_tex_parameteri(struct gl_context *ctx,
goto invalid_param;
}
if (param != texObj->Sampler.CubeMapSeamless) {
flush(ctx);
texObj->Sampler.CubeMapSeamless = param;
}
return GL_TRUE;
}
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;
}
invalid_pname:
_mesa_error(ctx, GL_INVALID_ENUM, "glTex%sParameter(pname=%s)",
suffix, _mesa_enum_to_string(pname));
return GL_FALSE;
invalid_param:
@@ -771,20 +779,27 @@ set_tex_parameterf(struct gl_context *ctx,
texObj->Sampler.BorderColor.f[BCOMP] = params[2];
texObj->Sampler.BorderColor.f[ACOMP] = params[3];
} else {
texObj->Sampler.BorderColor.f[RCOMP] = CLAMP(params[0], 0.0F, 1.0F);
texObj->Sampler.BorderColor.f[GCOMP] = CLAMP(params[1], 0.0F, 1.0F);
texObj->Sampler.BorderColor.f[BCOMP] = CLAMP(params[2], 0.0F, 1.0F);
texObj->Sampler.BorderColor.f[ACOMP] = CLAMP(params[3], 0.0F, 1.0F);
}
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;
}
return GL_FALSE;
invalid_pname:
_mesa_error(ctx, GL_INVALID_ENUM, "glTex%sParameter(pname=%s)",
suffix, _mesa_enum_to_string(pname));
return GL_FALSE;
@@ -2012,20 +2027,26 @@ get_tex_parameterfv(struct gl_context *ctx,
goto invalid_pname;
*params = (GLfloat) obj->ImageFormatCompatibilityType;
break;
case GL_TEXTURE_TARGET:
if (ctx->API != API_OPENGL_CORE)
goto invalid_pname;
*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;
}
/* no error if we get here */
_mesa_unlock_context_textures(ctx);
return;
invalid_pname:
_mesa_unlock_context_textures(ctx);
@@ -2244,20 +2265,26 @@ get_tex_parameteriv(struct gl_context *ctx,
goto invalid_pname;
*params = obj->ImageFormatCompatibilityType;
break;
case GL_TEXTURE_TARGET:
if (ctx->API != API_OPENGL_CORE)
goto invalid_pname;
*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;
}
/* no error if we get here */
_mesa_unlock_texture(ctx, obj);
return;
invalid_pname:
_mesa_unlock_texture(ctx, obj);
--
2.13.3
More information about the mesa-dev
mailing list