break;
case GL_CLAMP_TO_BORDER:
- supported = is_desktop_gl && e->ARB_texture_border_clamp
+ supported = ctx->API != API_OPENGLES && e->ARB_texture_border_clamp
&& (target != GL_TEXTURE_EXTERNAL_OES);
break;
}
-static GLboolean
-target_allows_setting_sampler_parameters(GLenum target)
+GLboolean
+_mesa_target_allows_setting_sampler_parameters(GLenum target)
{
switch (target) {
case GL_TEXTURE_2D_MULTISAMPLE:
switch (pname) {
case GL_TEXTURE_MIN_FILTER:
- if (!target_allows_setting_sampler_parameters(texObj->Target))
+ if (!_mesa_target_allows_setting_sampler_parameters(texObj->Target))
goto invalid_enum;
if (texObj->Sampler.MinFilter == params[0])
return GL_FALSE;
case GL_TEXTURE_MAG_FILTER:
- if (!target_allows_setting_sampler_parameters(texObj->Target))
+ if (!_mesa_target_allows_setting_sampler_parameters(texObj->Target))
goto invalid_enum;
if (texObj->Sampler.MagFilter == params[0])
return GL_FALSE;
case GL_TEXTURE_WRAP_S:
- if (!target_allows_setting_sampler_parameters(texObj->Target))
+ if (!_mesa_target_allows_setting_sampler_parameters(texObj->Target))
goto invalid_enum;
if (texObj->Sampler.WrapS == params[0])
return GL_FALSE;
case GL_TEXTURE_WRAP_T:
- if (!target_allows_setting_sampler_parameters(texObj->Target))
+ if (!_mesa_target_allows_setting_sampler_parameters(texObj->Target))
goto invalid_enum;
if (texObj->Sampler.WrapT == params[0])
return GL_FALSE;
case GL_TEXTURE_WRAP_R:
- if (!target_allows_setting_sampler_parameters(texObj->Target))
+ if (!_mesa_target_allows_setting_sampler_parameters(texObj->Target))
goto invalid_enum;
if (texObj->Sampler.WrapR == params[0])
if ((_mesa_is_desktop_gl(ctx) && ctx->Extensions.ARB_shadow)
|| _mesa_is_gles3(ctx)) {
- if (!target_allows_setting_sampler_parameters(texObj->Target))
+ if (!_mesa_target_allows_setting_sampler_parameters(texObj->Target))
goto invalid_enum;
if (texObj->Sampler.CompareMode == params[0])
if ((_mesa_is_desktop_gl(ctx) && ctx->Extensions.ARB_shadow)
|| _mesa_is_gles3(ctx)) {
- if (!target_allows_setting_sampler_parameters(texObj->Target))
+ if (!_mesa_target_allows_setting_sampler_parameters(texObj->Target))
goto invalid_enum;
if (texObj->Sampler.CompareFunc == params[0])
goto invalid_pname;
case GL_DEPTH_STENCIL_TEXTURE_MODE:
- if ((_mesa_is_desktop_gl(ctx) &&
- ctx->Extensions.ARB_stencil_texturing) ||
- _mesa_is_gles31(ctx)) {
+ if (_mesa_has_ARB_stencil_texturing(ctx) || _mesa_is_gles31(ctx)) {
bool stencil = params[0] == GL_STENCIL_INDEX;
if (!stencil && params[0] != GL_DEPTH_COMPONENT)
goto invalid_param;
goto invalid_pname;
case GL_TEXTURE_SRGB_DECODE_EXT:
- if (_mesa_is_desktop_gl(ctx)
- && ctx->Extensions.EXT_texture_sRGB_decode) {
+ if (ctx->Extensions.EXT_texture_sRGB_decode) {
GLenum decode = params[0];
- if (!target_allows_setting_sampler_parameters(texObj->Target))
+ if (!_mesa_target_allows_setting_sampler_parameters(texObj->Target))
goto invalid_enum;
if (decode == GL_DECODE_EXT || decode == GL_SKIP_DECODE_EXT) {
&& ctx->Extensions.AMD_seamless_cubemap_per_texture) {
GLenum param = params[0];
- if (!target_allows_setting_sampler_parameters(texObj->Target))
+ if (!_mesa_target_allows_setting_sampler_parameters(texObj->Target))
goto invalid_enum;
if (param != GL_TRUE && param != GL_FALSE) {
if (!_mesa_is_desktop_gl(ctx) && !_mesa_is_gles3(ctx))
goto invalid_pname;
- if (!target_allows_setting_sampler_parameters(texObj->Target))
+ if (!_mesa_target_allows_setting_sampler_parameters(texObj->Target))
goto invalid_enum;
if (texObj->Sampler.MinLod == params[0])
if (!_mesa_is_desktop_gl(ctx) && !_mesa_is_gles3(ctx))
goto invalid_pname;
- if (!target_allows_setting_sampler_parameters(texObj->Target))
+ if (!_mesa_target_allows_setting_sampler_parameters(texObj->Target))
goto invalid_enum;
if (texObj->Sampler.MaxLod == params[0])
case GL_TEXTURE_MAX_ANISOTROPY_EXT:
if (ctx->Extensions.EXT_texture_filter_anisotropic) {
- if (!target_allows_setting_sampler_parameters(texObj->Target))
+ if (!_mesa_target_allows_setting_sampler_parameters(texObj->Target))
goto invalid_enum;
if (texObj->Sampler.MaxAnisotropy == params[0])
if (_mesa_is_gles(ctx))
goto invalid_pname;
- if (!target_allows_setting_sampler_parameters(texObj->Target))
+ if (!_mesa_target_allows_setting_sampler_parameters(texObj->Target))
goto invalid_enum;
if (texObj->Sampler.LodBias != params[0]) {
break;
case GL_TEXTURE_BORDER_COLOR:
- if (!_mesa_is_desktop_gl(ctx))
+ if (ctx->API == API_OPENGLES ||
+ !ctx->Extensions.ARB_texture_border_clamp)
goto invalid_pname;
- if (!target_allows_setting_sampler_parameters(texObj->Target))
+ if (!_mesa_target_allows_setting_sampler_parameters(texObj->Target))
goto invalid_enum;
flush(ctx);
_mesa_texture_parameterIuiv(ctx, texObj, pname, params, true);
}
-static GLboolean
-legal_get_tex_level_parameter_target(struct gl_context *ctx, GLenum target,
- bool dsa)
+GLboolean
+_mesa_legal_get_tex_level_parameter_target(struct gl_context *ctx, GLenum target,
+ bool dsa)
{
/* Common targets for desktop GL and GLES 3.1. */
switch (target) {
return GL_TRUE;
case GL_TEXTURE_2D_ARRAY_EXT:
return ctx->Extensions.EXT_texture_array;
- case GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB:
- case GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB:
- case GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB:
- case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB:
- case GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB:
- case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB:
+ case GL_TEXTURE_CUBE_MAP_POSITIVE_X:
+ case GL_TEXTURE_CUBE_MAP_NEGATIVE_X:
+ case GL_TEXTURE_CUBE_MAP_POSITIVE_Y:
+ case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y:
+ case GL_TEXTURE_CUBE_MAP_POSITIVE_Z:
+ case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z:
return ctx->Extensions.ARB_texture_cube_map;
case GL_TEXTURE_2D_MULTISAMPLE:
case GL_TEXTURE_2D_MULTISAMPLE_ARRAY:
return ctx->Extensions.ARB_texture_multisample;
+ case GL_TEXTURE_BUFFER:
+ /* GetTexLevelParameter accepts GL_TEXTURE_BUFFER in GL 3.1+ contexts,
+ * but not in earlier versions that expose ARB_texture_buffer_object.
+ *
+ * From the ARB_texture_buffer_object spec:
+ * "(7) Do buffer textures support texture parameters (TexParameter) or
+ * queries (GetTexParameter, GetTexLevelParameter, GetTexImage)?
+ *
+ * RESOLVED: No. [...] Note that the spec edits above don't add
+ * explicit error language for any of these cases. That is because
+ * each of the functions enumerate the set of valid <target>
+ * parameters. Not editing the spec to allow TEXTURE_BUFFER_ARB in
+ * these cases means that target is not legal, and an INVALID_ENUM
+ * error should be generated."
+ *
+ * From the OpenGL 3.1 spec:
+ * "target may also be TEXTURE_BUFFER, indicating the texture buffer."
+ */
+ return (ctx->API == API_OPENGL_CORE && ctx->Version >= 31) ||
+ _mesa_has_OES_texture_buffer(ctx);
}
if (!_mesa_is_desktop_gl(ctx))
case GL_PROXY_TEXTURE_2D:
case GL_PROXY_TEXTURE_3D:
return GL_TRUE;
- case GL_PROXY_TEXTURE_CUBE_MAP_ARB:
+ case GL_PROXY_TEXTURE_CUBE_MAP:
return ctx->Extensions.ARB_texture_cube_map;
case GL_TEXTURE_CUBE_MAP_ARRAY_ARB:
case GL_PROXY_TEXTURE_CUBE_MAP_ARRAY_ARB:
case GL_PROXY_TEXTURE_1D_ARRAY_EXT:
case GL_PROXY_TEXTURE_2D_ARRAY_EXT:
return ctx->Extensions.EXT_texture_array;
- case GL_TEXTURE_BUFFER:
- /* GetTexLevelParameter accepts GL_TEXTURE_BUFFER in GL 3.1+ contexts,
- * but not in earlier versions that expose ARB_texture_buffer_object.
- *
- * From the ARB_texture_buffer_object spec:
- * "(7) Do buffer textures support texture parameters (TexParameter) or
- * queries (GetTexParameter, GetTexLevelParameter, GetTexImage)?
- *
- * RESOLVED: No. [...] Note that the spec edits above don't add
- * explicit error language for any of these cases. That is because
- * each of the functions enumerate the set of valid <target>
- * parameters. Not editing the spec to allow TEXTURE_BUFFER_ARB in
- * these cases means that target is not legal, and an INVALID_ENUM
- * error should be generated."
- *
- * From the OpenGL 3.1 spec:
- * "target may also be TEXTURE_BUFFER, indicating the texture buffer."
- */
- return ctx->API == API_OPENGL_CORE && ctx->Version >= 31;
case GL_PROXY_TEXTURE_2D_MULTISAMPLE:
case GL_PROXY_TEXTURE_2D_MULTISAMPLE_ARRAY:
return ctx->Extensions.ARB_texture_multisample;
dummy_image.TexFormat = MESA_FORMAT_NONE;
dummy_image.InternalFormat = GL_RGBA;
dummy_image._BaseFormat = GL_NONE;
+ dummy_image.FixedSampleLocations = GL_TRUE;
img = &dummy_image;
}
*params = img->FixedSampleLocations;
break;
+ /* There is never a buffer data store here, but these pnames still have
+ * to work.
+ */
+
+ /* GL_ARB_texture_buffer_object */
+ case GL_TEXTURE_BUFFER_DATA_STORE_BINDING:
+ if (!ctx->Extensions.ARB_texture_buffer_object)
+ goto invalid_pname;
+ *params = 0;
+ break;
+
+ /* GL_ARB_texture_buffer_range */
+ case GL_TEXTURE_BUFFER_OFFSET:
+ if (!ctx->Extensions.ARB_texture_buffer_range)
+ goto invalid_pname;
+ *params = 0;
+ break;
+ case GL_TEXTURE_BUFFER_SIZE:
+ if (!ctx->Extensions.ARB_texture_buffer_range)
+ goto invalid_pname;
+ *params = 0;
+ break;
+
default:
goto invalid_pname;
}
{
const struct gl_buffer_object *bo = texObj->BufferObject;
mesa_format texFormat = texObj->_BufferObjectFormat;
+ int bytes = MAX2(1, _mesa_get_format_bytes(texFormat));
GLenum internalFormat = texObj->BufferObjectFormat;
GLenum baseFormat = _mesa_get_format_base_format(texFormat);
const char *suffix = dsa ? "ture" : "";
if (!bo) {
/* undefined texture buffer object */
- *params = pname == GL_TEXTURE_COMPONENTS ? 1 : 0;
+ switch (pname) {
+ case GL_TEXTURE_FIXED_SAMPLE_LOCATIONS:
+ *params = GL_TRUE;
+ break;
+ case GL_TEXTURE_INTERNAL_FORMAT:
+ *params = internalFormat;
+ break;
+ default:
+ *params = 0;
+ break;
+ }
return;
}
*params = bo->Name;
break;
case GL_TEXTURE_WIDTH:
- *params = bo->Size;
+ *params = ((texObj->BufferSize == -1) ? bo->Size : texObj->BufferSize)
+ / bytes;
break;
case GL_TEXTURE_HEIGHT:
case GL_TEXTURE_DEPTH:
+ *params = 1;
+ break;
case GL_TEXTURE_BORDER:
case GL_TEXTURE_SHARED_SIZE:
case GL_TEXTURE_COMPRESSED:
*params = (texObj->BufferSize == -1) ? bo->Size : texObj->BufferSize;
break;
+ /* GL_ARB_texture_multisample */
+ case GL_TEXTURE_SAMPLES:
+ if (!ctx->Extensions.ARB_texture_multisample)
+ goto invalid_pname;
+ *params = 0;
+ break;
+
+ case GL_TEXTURE_FIXED_SAMPLE_LOCATIONS:
+ if (!ctx->Extensions.ARB_texture_multisample)
+ goto invalid_pname;
+ *params = GL_TRUE;
+ break;
+
/* GL_ARB_texture_compression */
case GL_TEXTURE_COMPRESSED_IMAGE_SIZE:
/* Always illegal for GL_TEXTURE_BUFFER */
bool dsa)
{
const char *suffix = dsa ? "ture" : "";
- if (!legal_get_tex_level_parameter_target(ctx, target, dsa)) {
+ if (!_mesa_legal_get_tex_level_parameter_target(ctx, target, dsa)) {
_mesa_error(ctx, GL_INVALID_ENUM,
"glGetTex%sLevelParameter[if]v(target=%s)", suffix,
_mesa_enum_to_string(target));
*params = ENUM_TO_FLOAT(obj->Sampler.WrapR);
break;
case GL_TEXTURE_BORDER_COLOR:
- if (!_mesa_is_desktop_gl(ctx))
+ if (ctx->API == API_OPENGLES ||
+ !ctx->Extensions.ARB_texture_border_clamp)
goto invalid_pname;
if (ctx->NewState & (_NEW_BUFFERS | _NEW_FRAG_CLAMP))
*params = (GLfloat) obj->DepthMode;
break;
case GL_DEPTH_STENCIL_TEXTURE_MODE:
- if (!_mesa_is_desktop_gl(ctx) || !ctx->Extensions.ARB_stencil_texturing)
+ if (!_mesa_has_ARB_stencil_texturing(ctx) && !_mesa_is_gles31(ctx))
goto invalid_pname;
*params = (GLfloat)
(obj->StencilSampling ? GL_STENCIL_INDEX : GL_DEPTH_COMPONENT);
*params = (GLint) obj->Sampler.WrapR;
break;
case GL_TEXTURE_BORDER_COLOR:
- if (!_mesa_is_desktop_gl(ctx))
+ if (ctx->API == API_OPENGLES ||
+ !ctx->Extensions.ARB_texture_border_clamp)
goto invalid_pname;
{
*params = (GLint) obj->DepthMode;
break;
case GL_DEPTH_STENCIL_TEXTURE_MODE:
- if (!_mesa_is_desktop_gl(ctx) || !ctx->Extensions.ARB_stencil_texturing)
+ if (!_mesa_has_ARB_stencil_texturing(ctx) && !_mesa_is_gles31(ctx))
goto invalid_pname;
*params = (GLint)
(obj->StencilSampling ? GL_STENCIL_INDEX : GL_DEPTH_COMPONENT);