#include "blend.h"
#include "enable.h"
#include "enums.h"
+#include "errors.h"
#include "extensions.h"
#include "get.h"
#include "macros.h"
EXTRA_API_GL_CORE,
EXTRA_API_ES2,
EXTRA_API_ES3,
+ EXTRA_API_ES31,
EXTRA_NEW_BUFFERS,
EXTRA_NEW_FRAG_CLAMP,
EXTRA_VALID_DRAW_BUFFER,
EXTRA_END
};
-static const int extra_EXT_texture_integer[] = {
- EXT(EXT_texture_integer),
- EXTRA_END
-};
-
static const int extra_EXT_texture_integer_and_new_buffers[] = {
EXT(EXT_texture_integer),
EXTRA_NEW_BUFFERS,
EXTRA_END
};
+static const int extra_ARB_draw_indirect_es31[] = {
+ EXT(ARB_draw_indirect),
+ EXTRA_API_ES31,
+ EXTRA_END
+};
+
EXTRA_EXT(ARB_texture_cube_map);
EXTRA_EXT(EXT_texture_array);
EXTRA_EXT(NV_fog_distance);
EXTRA_EXT(ARB_shader_image_load_store);
EXTRA_EXT(ARB_viewport_array);
EXTRA_EXT(ARB_compute_shader);
+EXTRA_EXT(ARB_gpu_shader5);
+EXTRA_EXT2(ARB_transform_feedback3, ARB_gpu_shader5);
+EXTRA_EXT(INTEL_performance_query);
+EXTRA_EXT(ARB_explicit_uniform_location);
+EXTRA_EXT(ARB_clip_control);
+EXTRA_EXT(EXT_polygon_offset_clamp);
+EXTRA_EXT(ARB_framebuffer_no_attachments);
static const int
extra_ARB_color_buffer_float_or_glcore[] = {
};
const char *api_name;
- api_name = api < Elements(api_names) ? api_names[api] : "N/A";
+ api_name = api < ARRAY_SIZE(api_names) ? api_names[api] : "N/A";
count = 0;
- mask = Elements(table(api)) - 1;
+ mask = ARRAY_SIZE(table(api)) - 1;
memset(collisions, 0, sizeof collisions);
- for (i = 0; i < Elements(table(api)); i++) {
+ for (i = 0; i < ARRAY_SIZE(table(api)); i++) {
if (!table(api)[i])
continue;
count++;
}
printf("number of enums for %s: %d (total %ld)\n",
- api_name, count, Elements(values));
- for (i = 0; i < Elements(collisions) - 1; i++)
+ api_name, count, ARRAY_SIZE(values));
+ for (i = 0; i < ARRAY_SIZE(collisions) - 1; i++)
if (collisions[i] > 0)
printf(" %d enums with %d %scollisions\n",
collisions[i], i, i == 10 ? "or more " : "");
case GL_COMPRESSED_TEXTURE_FORMATS_ARB:
v->value_int_n.n =
_mesa_get_compressed_formats(ctx, v->value_int_n.ints);
- ASSERT(v->value_int_n.n <= (int) ARRAY_SIZE(v->value_int_n.ints));
+ assert(v->value_int_n.n <= (int) ARRAY_SIZE(v->value_int_n.ints));
break;
case GL_MAX_VARYING_FLOATS_ARB:
v->value_int = ctx->Array.VAO->IndexBufferObj->Name;
break;
+ /* ARB_vertex_array_bgra */
+ case GL_COLOR_ARRAY_SIZE:
+ array = &ctx->Array.VAO->VertexAttrib[VERT_ATTRIB_COLOR0];
+ v->value_int = array->Format == GL_BGRA ? GL_BGRA : array->Size;
+ break;
+ case GL_SECONDARY_COLOR_ARRAY_SIZE:
+ array = &ctx->Array.VAO->VertexAttrib[VERT_ATTRIB_COLOR1];
+ v->value_int = array->Format == GL_BGRA ? GL_BGRA : array->Size;
+ break;
+
/* ARB_copy_buffer */
case GL_COPY_READ_BUFFER:
v->value_int = ctx->CopyReadBuffer->Name;
v->value_int = ctx->TransformFeedback.CurrentObject->Name;
break;
case GL_CURRENT_PROGRAM:
+ /* The Changelog of the ARB_separate_shader_objects spec says:
+ *
+ * 24 25 Jul 2011 pbrown Remove the language erroneously deleting
+ * CURRENT_PROGRAM. In the EXT extension, this
+ * token was aliased to ACTIVE_PROGRAM_EXT, and
+ * was used to indicate the last program set by
+ * either ActiveProgramEXT or UseProgram. In
+ * the ARB extension, the SSO active programs
+ * are now program pipeline object state and
+ * CURRENT_PROGRAM should still be used to query
+ * the last program set by UseProgram (bug 7822).
+ */
v->value_int =
ctx->Shader.ActiveProgram ? ctx->Shader.ActiveProgram->Name : 0;
break;
break;
case GL_FOG_COLOR:
- if (_mesa_get_clamp_fragment_color(ctx))
+ if (_mesa_get_clamp_fragment_color(ctx, ctx->DrawBuffer))
COPY_4FV(v->value_float_4, ctx->Fog.Color);
else
COPY_4FV(v->value_float_4, ctx->Fog.ColorUnclamped);
break;
case GL_COLOR_CLEAR_VALUE:
- if (_mesa_get_clamp_fragment_color(ctx)) {
+ if (_mesa_get_clamp_fragment_color(ctx, ctx->DrawBuffer)) {
v->value_float_4[0] = CLAMP(ctx->Color.ClearColor.f[0], 0.0F, 1.0F);
v->value_float_4[1] = CLAMP(ctx->Color.ClearColor.f[1], 0.0F, 1.0F);
v->value_float_4[2] = CLAMP(ctx->Color.ClearColor.f[2], 0.0F, 1.0F);
COPY_4FV(v->value_float_4, ctx->Color.ClearColor.f);
break;
case GL_BLEND_COLOR_EXT:
- if (_mesa_get_clamp_fragment_color(ctx))
+ if (_mesa_get_clamp_fragment_color(ctx, ctx->DrawBuffer))
COPY_4FV(v->value_float_4, ctx->Color.BlendColor);
else
COPY_4FV(v->value_float_4, ctx->Color.BlendColorUnclamped);
break;
case GL_ALPHA_TEST_REF:
- if (_mesa_get_clamp_fragment_color(ctx))
+ if (_mesa_get_clamp_fragment_color(ctx, ctx->DrawBuffer))
v->value_float = ctx->Color.AlphaRef;
else
v->value_float = ctx->Color.AlphaRefUnclamped;
_mesa_problem(ctx, "driver doesn't implement GetTimestamp");
}
break;
+ /* GL_KHR_DEBUG */
+ case GL_DEBUG_LOGGED_MESSAGES:
+ case GL_DEBUG_NEXT_LOGGED_MESSAGE_LENGTH:
+ case GL_DEBUG_GROUP_STACK_DEPTH:
+ v->value_int = _mesa_get_debug_state_int(ctx, d->pname);
+ break;
/* GL_ARB_shader_atomic_counters */
case GL_ATOMIC_COUNTER_BUFFER_BINDING:
- v->value_int = ctx->AtomicBuffer->Name;
+ if (ctx->AtomicBuffer) {
+ v->value_int = ctx->AtomicBuffer->Name;
+ } else {
+ v->value_int = 0;
+ }
break;
/* GL_ARB_draw_indirect */
case GL_DRAW_INDIRECT_BUFFER_BINDING:
v->value_int = ctx->DrawIndirectBuffer->Name;
break;
+ /* GL_ARB_separate_shader_objects */
+ case GL_PROGRAM_PIPELINE_BINDING:
+ if (ctx->Pipeline.Current) {
+ v->value_int = ctx->Pipeline.Current->Name;
+ } else {
+ v->value_int = 0;
+ }
+ break;
}
}
if (_mesa_is_gles3(ctx))
api_found = GL_TRUE;
break;
+ case EXTRA_API_ES31:
+ api_check = GL_TRUE;
+ if (_mesa_is_gles31(ctx))
+ api_found = GL_TRUE;
+ break;
case EXTRA_API_GL:
api_check = GL_TRUE;
if (_mesa_is_desktop_gl(ctx))
if (api_check && !api_found) {
_mesa_error(ctx, GL_INVALID_ENUM, "%s(pname=%s)", func,
- _mesa_lookup_enum_by_nr(d->pname));
+ _mesa_enum_to_string(d->pname));
return GL_FALSE;
}
* value since it's compatible with GLES2 its entry in table_set[] is at the
* end.
*/
- STATIC_ASSERT(Elements(table_set) == API_OPENGL_LAST + 2);
+ STATIC_ASSERT(ARRAY_SIZE(table_set) == API_OPENGL_LAST + 2);
if (_mesa_is_gles3(ctx)) {
api = API_OPENGL_LAST + 1;
}
- mask = Elements(table(api)) - 1;
+ mask = ARRAY_SIZE(table(api)) - 1;
hash = (pname * prime_factor);
while (1) {
int idx = table(api)[hash & mask];
* any valid enum. */
if (unlikely(idx == 0)) {
_mesa_error(ctx, GL_INVALID_ENUM, "%s(pname=%s)", func,
- _mesa_lookup_enum_by_nr(pname));
+ _mesa_enum_to_string(pname));
return &error_value;
}
if (index >= ctx->Const.Program[MESA_SHADER_VERTEX].MaxAttribs)
goto invalid_value;
v->value_int = ctx->Array.VAO->VertexBinding[VERT_ATTRIB_GENERIC(index)].Stride;
+ return TYPE_INT;
/* ARB_shader_image_load_store */
case GL_IMAGE_BINDING_NAME: {
invalid_enum:
_mesa_error(ctx, GL_INVALID_ENUM, "%s(pname=%s)", func,
- _mesa_lookup_enum_by_nr(pname));
+ _mesa_enum_to_string(pname));
return TYPE_INVALID;
invalid_value:
_mesa_error(ctx, GL_INVALID_VALUE, "%s(pname=%s)", func,
- _mesa_lookup_enum_by_nr(pname));
+ _mesa_enum_to_string(pname));
return TYPE_INVALID;
}
params[3] = INT_TO_BOOLEAN(v.value_int_4[3]);
break;
case TYPE_INT64:
- params[0] = INT64_TO_BOOLEAN(v.value_int);
+ params[0] = INT64_TO_BOOLEAN(v.value_int64);
break;
default:
; /* nothing - GL error was recorded */
params[3] = v.value_int_4[3];
break;
case TYPE_INT64:
- params[0] = INT64_TO_INT(v.value_int);
+ params[0] = INT64_TO_INT(v.value_int64);
break;
default:
; /* nothing - GL error was recorded */
params[3] = v.value_int_4[3];
break;
case TYPE_INT64:
- params[0] = v.value_int;
+ params[0] = v.value_int64;
break;
default:
; /* nothing - GL error was recorded */