Compare commits
67 Commits
12.0
...
gles3-fmt-
Author | SHA1 | Date | |
---|---|---|---|
|
ae0120f247 | ||
|
787bbe65ff | ||
|
5f96348c60 | ||
|
fe23a2c5e1 | ||
|
54d744bfc4 | ||
|
b1c62e9533 | ||
|
0faa38ccc6 | ||
|
ed9f608070 | ||
|
b68dc0c5ee | ||
|
add9b77cbd | ||
|
64e0be7d0b | ||
|
166c4d211d | ||
|
fef9526cb6 | ||
|
a33dc45d2f | ||
|
95da613011 | ||
|
9824382dbd | ||
|
067e9170ef | ||
|
28236b2f28 | ||
|
a1ef7b34ce | ||
|
8d99b25045 | ||
|
3613e67b4a | ||
|
566ce73fab | ||
|
4fd482b841 | ||
|
555245eeb7 | ||
|
e76ddbf0f8 | ||
|
8b89a5bbf5 | ||
|
56e2a876e4 | ||
|
acac9cdde0 | ||
|
8a88168a90 | ||
|
18aca7ac5a | ||
|
4dd38352e5 | ||
|
a0333d34a7 | ||
|
5d1c69be02 | ||
|
e68b841b3c | ||
|
3b495d815f | ||
|
0538b36bac | ||
|
d3d6e05349 | ||
|
4014ee4567 | ||
|
b83a83dcdf | ||
|
19864a4b1c | ||
|
24d89bc7ea | ||
|
84b2017c30 | ||
|
a9c1fa067c | ||
|
d9228105e1 | ||
|
4b7bea48ee | ||
|
b1a21a9f7c | ||
|
f7a82c00cd | ||
|
d053e8e85b | ||
|
0f16eafa17 | ||
|
43413b3fdd | ||
|
974d48a061 | ||
|
173e4f7a42 | ||
|
026099f93a | ||
|
feba88049f | ||
|
cf6ddcecda | ||
|
244d6eb094 | ||
|
7a4eca8280 | ||
|
3d0890d39d | ||
|
2a18d71dbe | ||
|
13fa793585 | ||
|
fca1ec5bfa | ||
|
5b9df1c245 | ||
|
bdea9b9460 | ||
|
e1ccb71996 | ||
|
db902c4948 | ||
|
a40737f505 | ||
|
dbee8d3ea2 |
@@ -826,8 +826,9 @@ struct __DRIdri2LoaderExtensionRec {
|
||||
|
||||
#define __DRI_API_OPENGL 0 /**< OpenGL compatibility profile */
|
||||
#define __DRI_API_GLES 1 /**< OpenGL ES 1.x */
|
||||
#define __DRI_API_GLES2 2 /**< OpenGL ES 2.0 or 3.0 */
|
||||
#define __DRI_API_GLES2 2 /**< OpenGL ES 2.x */
|
||||
#define __DRI_API_OPENGL_CORE 3 /**< OpenGL 3.2+ core profile */
|
||||
#define __DRI_API_GLES3 4 /**< OpenGL ES 3.x */
|
||||
|
||||
#define __DRI_CTX_ATTRIB_MAJOR_VERSION 0
|
||||
#define __DRI_CTX_ATTRIB_MINOR_VERSION 1
|
||||
|
@@ -465,7 +465,10 @@ dri2_setup_screen(_EGLDisplay *disp)
|
||||
api_mask = dri2_dpy->dri2->getAPIMask(dri2_dpy->dri_screen);
|
||||
} else {
|
||||
assert(dri2_dpy->swrast);
|
||||
api_mask = 1 << __DRI_API_OPENGL | 1 << __DRI_API_GLES | 1 << __DRI_API_GLES2;
|
||||
api_mask = 1 << __DRI_API_OPENGL |
|
||||
1 << __DRI_API_GLES |
|
||||
1 << __DRI_API_GLES2 |
|
||||
1 << __DRI_API_GLES3;
|
||||
}
|
||||
|
||||
disp->ClientAPIs = 0;
|
||||
@@ -475,6 +478,8 @@ dri2_setup_screen(_EGLDisplay *disp)
|
||||
disp->ClientAPIs |= EGL_OPENGL_ES_BIT;
|
||||
if (api_mask & (1 << __DRI_API_GLES2))
|
||||
disp->ClientAPIs |= EGL_OPENGL_ES2_BIT;
|
||||
if (api_mask & (1 << __DRI_API_GLES3))
|
||||
disp->ClientAPIs |= EGL_OPENGL_ES3_BIT_KHR;
|
||||
|
||||
assert(dri2_dpy->dri2 || dri2_dpy->swrast);
|
||||
disp->Extensions.KHR_surfaceless_context = EGL_TRUE;
|
||||
@@ -737,8 +742,10 @@ dri2_create_context(_EGLDriver *drv, _EGLDisplay *disp, _EGLConfig *conf,
|
||||
api = __DRI_API_GLES;
|
||||
break;
|
||||
case 2:
|
||||
api = __DRI_API_GLES3;
|
||||
break;
|
||||
case 3:
|
||||
api = __DRI_API_GLES2;
|
||||
api = __DRI_API_GLES3;
|
||||
break;
|
||||
default:
|
||||
_eglError(EGL_BAD_PARAMETER, "eglCreateContext");
|
||||
|
@@ -331,6 +331,7 @@ _eglValidateConfig(const _EGLConfig *conf, EGLBoolean for_matching)
|
||||
mask = EGL_OPENGL_ES_BIT |
|
||||
EGL_OPENVG_BIT |
|
||||
EGL_OPENGL_ES2_BIT |
|
||||
EGL_OPENGL_ES3_BIT_KHR |
|
||||
EGL_OPENGL_BIT;
|
||||
break;
|
||||
default:
|
||||
|
@@ -54,9 +54,11 @@ _eglGetContextAPIBit(_EGLContext *ctx)
|
||||
bit = EGL_OPENGL_ES_BIT;
|
||||
break;
|
||||
case 2:
|
||||
case 3:
|
||||
bit = EGL_OPENGL_ES2_BIT;
|
||||
break;
|
||||
case 3:
|
||||
bit = EGL_OPENGL_ES3_BIT_KHR;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@@ -37,6 +37,7 @@
|
||||
(EGL_OPENGL_ES_BIT | \
|
||||
EGL_OPENVG_BIT | \
|
||||
EGL_OPENGL_ES2_BIT | \
|
||||
EGL_OPENGL_ES3_BIT_KHR | \
|
||||
EGL_OPENGL_BIT)
|
||||
|
||||
|
||||
|
@@ -140,6 +140,9 @@ _eglUpdateAPIsString(_EGLDisplay *dpy)
|
||||
if (dpy->ClientAPIs & EGL_OPENGL_ES2_BIT)
|
||||
strcat(apis, "OpenGL_ES2 ");
|
||||
|
||||
if (dpy->ClientAPIs & EGL_OPENGL_ES3_BIT_KHR)
|
||||
strcat(apis, "OpenGL_ES3 ");
|
||||
|
||||
if (dpy->ClientAPIs & EGL_OPENVG_BIT)
|
||||
strcat(apis, "OpenVG ");
|
||||
|
||||
|
@@ -435,11 +435,14 @@ _eglSurfaceAttrib(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surface,
|
||||
{
|
||||
EGLint confval;
|
||||
EGLint err = EGL_SUCCESS;
|
||||
EGLint all_es_bits = EGL_OPENGL_ES_BIT |
|
||||
EGL_OPENGL_ES2_BIT |
|
||||
EGL_OPENGL_ES3_BIT_KHR;
|
||||
|
||||
switch (attribute) {
|
||||
case EGL_MIPMAP_LEVEL:
|
||||
confval = surface->Config->RenderableType;
|
||||
if (!(confval & (EGL_OPENGL_ES_BIT | EGL_OPENGL_ES2_BIT))) {
|
||||
if (!(confval & all_es_bits)) {
|
||||
err = EGL_BAD_PARAMETER;
|
||||
break;
|
||||
}
|
||||
|
@@ -260,6 +260,8 @@ HEXADECIMAL_INTEGER 0[xX][0-9a-fA-F]+[uU]?
|
||||
}
|
||||
|
||||
"##" {
|
||||
if (parser->is_gles)
|
||||
glcpp_error(yylloc, yyextra, "Token pasting (##) is illegal in GLES");
|
||||
return PASTE;
|
||||
}
|
||||
|
||||
|
@@ -363,6 +363,8 @@ integer_constant:
|
||||
expression:
|
||||
integer_constant
|
||||
| IDENTIFIER {
|
||||
if (parser->is_gles)
|
||||
glcpp_error(& @1, parser, "undefined macro %s in expression (illegal in GLES)", $1);
|
||||
$$ = 0;
|
||||
}
|
||||
| expression OR expression {
|
||||
@@ -1179,15 +1181,18 @@ glcpp_parser_create (const struct gl_extensions *extensions, int api)
|
||||
parser->has_new_source_number = 0;
|
||||
parser->new_source_number = 0;
|
||||
|
||||
parser->is_gles = false;
|
||||
|
||||
/* Add pre-defined macros. */
|
||||
if (extensions != NULL) {
|
||||
if (extensions->OES_EGL_image_external)
|
||||
add_builtin_define(parser, "GL_OES_EGL_image_external", 1);
|
||||
}
|
||||
|
||||
if (api == API_OPENGLES2)
|
||||
if (api == API_OPENGLES2) {
|
||||
parser->is_gles = true;
|
||||
add_builtin_define(parser, "GL_ES", 1);
|
||||
else {
|
||||
} else {
|
||||
add_builtin_define(parser, "GL_ARB_draw_buffers", 1);
|
||||
add_builtin_define(parser, "GL_ARB_texture_rectangle", 1);
|
||||
|
||||
@@ -2026,11 +2031,6 @@ static void
|
||||
_glcpp_parser_handle_version_declaration(glcpp_parser_t *parser, intmax_t version,
|
||||
const char *es_identifier)
|
||||
{
|
||||
/* Note: We assume that if any identifier is present, it means ES.
|
||||
* The GLSL parser will double-check that the identifier is correct.
|
||||
*/
|
||||
bool is_es = es_identifier != NULL;
|
||||
|
||||
macro_t *macro = hash_table_find (parser->defines, "__VERSION__");
|
||||
if (macro) {
|
||||
hash_table_remove (parser->defines, "__VERSION__");
|
||||
@@ -2038,17 +2038,23 @@ _glcpp_parser_handle_version_declaration(glcpp_parser_t *parser, intmax_t versio
|
||||
}
|
||||
add_builtin_define (parser, "__VERSION__", version);
|
||||
|
||||
if (version == 100)
|
||||
is_es = true;
|
||||
if (is_es)
|
||||
/* If we didn't have a GLES context to begin with, (indicated
|
||||
* by parser->api), then the version declaration here might
|
||||
* indicate GLES. */
|
||||
if (! parser->is_gles &&
|
||||
(version == 100 ||
|
||||
(es_identifier && (strcmp(es_identifier, "es") == 0))))
|
||||
{
|
||||
parser->is_gles = true;
|
||||
add_builtin_define (parser, "GL_ES", 1);
|
||||
}
|
||||
|
||||
/* Currently, all ES2/ES3 implementations support highp in the
|
||||
* fragment shader, so we always define this macro in ES2/ES3.
|
||||
* If we ever get a driver that doesn't support highp, we'll
|
||||
* need to add a flag to the gl_context and check that here.
|
||||
*/
|
||||
if (version >= 130 || is_es)
|
||||
if (version >= 130 || parser->is_gles)
|
||||
add_builtin_define (parser, "GL_FRAGMENT_PRECISION_HIGH", 1);
|
||||
|
||||
ralloc_asprintf_rewrite_tail (&parser->output, &parser->output_length,
|
||||
|
@@ -182,6 +182,7 @@ struct glcpp_parser {
|
||||
int new_line_number;
|
||||
bool has_new_source_number;
|
||||
int new_source_number;
|
||||
bool is_gles;
|
||||
};
|
||||
|
||||
struct gl_extensions;
|
||||
|
23
src/mapi/glapi/gen/ARB_ES3_compatibility.xml
Normal file
23
src/mapi/glapi/gen/ARB_ES3_compatibility.xml
Normal file
@@ -0,0 +1,23 @@
|
||||
<?xml version="1.0"?>
|
||||
<!DOCTYPE OpenGLAPI SYSTEM "gl_API.dtd">
|
||||
|
||||
<OpenGLAPI>
|
||||
|
||||
<category name="GL_ARB_ES3_compatibility" number="127">
|
||||
<enum name="COMPRESSED_RGB8_ETC2" value="0x9274"/>
|
||||
<enum name="COMPRESSED_SRGB8_ETC2" value="0x9275"/>
|
||||
<enum name="COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2" value="0x9276"/>
|
||||
<enum name="COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2" value="0x9277"/>
|
||||
<enum name="COMPRESSED_RGBA8_ETC2_EAC" value="0x9278"/>
|
||||
<enum name="COMPRESSED_SRGB8_ALPHA8_ETC2_EAC" value="0x9279"/>
|
||||
<enum name="COMPRESSED_R11_EAC" value="0x9270"/>
|
||||
<enum name="COMPRESSED_SIGNED_R11_EAC" value="0x9271"/>
|
||||
<enum name="COMPRESSED_RG11_EAC" value="0x9272"/>
|
||||
<enum name="COMPRESSED_SIGNED_RG11_EAC" value="0x9273"/>
|
||||
<enum name="PRIMITIVE_RESTART_FIXED_INDEX" value="0x8D69"/>
|
||||
<enum name="ANY_SAMPLES_PASSED_CONSERVATIVE" value="0x8D6A"/>
|
||||
<enum name="MAX_ELEMENT_INDEX" value="0x8D6B"/>
|
||||
<enum name="TEXTURE_IMMUTABLE_LEVELS" value="0x82DF"/>
|
||||
</category>
|
||||
|
||||
</OpenGLAPI>
|
@@ -595,7 +595,7 @@
|
||||
<enum name="MAX_FRAGMENT_INPUT_COMPONENTS" value="0x9125"/>
|
||||
<enum name="CONTEXT_PROFILE_MASK" value="0x9126"/>
|
||||
|
||||
<function name="GetInteger64i_v" offset="assign" es2="3.0" exec="skip">
|
||||
<function name="GetInteger64i_v" offset="assign" es2="3.0">
|
||||
<param name="cap" type="GLenum"/>
|
||||
<param name="index" type="GLuint"/>
|
||||
<param name="data" type="GLint64 *"/>
|
||||
|
@@ -101,6 +101,7 @@ API_XML = \
|
||||
ARB_draw_elements_base_vertex.xml \
|
||||
ARB_draw_instanced.xml \
|
||||
ARB_ES2_compatibility.xml \
|
||||
ARB_ES3_compatibility.xml \
|
||||
ARB_framebuffer_object.xml \
|
||||
ARB_geometry_shader4.xml \
|
||||
ARB_instanced_arrays.xml \
|
||||
@@ -144,6 +145,7 @@ COMMON = $(API_XML) \
|
||||
gl_and_es_API.xml \
|
||||
es_EXT.xml \
|
||||
ARB_ES2_compatibility.xml \
|
||||
ARB_ES3_compatibility.xml \
|
||||
ARB_get_program_binary.xml \
|
||||
OES_fixed_point.xml \
|
||||
OES_single_precision.xml
|
||||
|
@@ -8277,7 +8277,11 @@
|
||||
|
||||
<xi:include href="ARB_robustness.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
|
||||
|
||||
<!-- ARB extensions #106...#108 -->
|
||||
<!-- ARB extensions #106 -->
|
||||
|
||||
<xi:include href="ARB_base_instance.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
|
||||
|
||||
<!-- ARB extensions #108 -->
|
||||
|
||||
<category name="GL_ARB_transform_feedback_instanced" number="109">
|
||||
<function name="DrawTransformFeedbackInstanced" offset="assign"
|
||||
@@ -8304,10 +8308,14 @@
|
||||
|
||||
<!-- ARB extensions #114...#116 -->
|
||||
|
||||
<xi:include href="ARB_base_instance.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
|
||||
|
||||
<xi:include href="ARB_texture_storage.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
|
||||
|
||||
<!-- ARB extensions #118...#126 -->
|
||||
|
||||
<xi:include href="ARB_ES3_compatibility.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
|
||||
|
||||
<!-- ARB extensions #128...#131 -->
|
||||
|
||||
<xi:include href="ARB_invalidate_subdata.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
|
||||
|
||||
<!-- Non-ARB extensions sorted by extension number. -->
|
||||
|
@@ -189,6 +189,7 @@ dri2CreateContextAttribs(__DRIscreen *screen, int api,
|
||||
mesa_api = API_OPENGLES;
|
||||
break;
|
||||
case __DRI_API_GLES2:
|
||||
case __DRI_API_GLES3:
|
||||
mesa_api = API_OPENGLES2;
|
||||
break;
|
||||
case __DRI_API_OPENGL_CORE:
|
||||
|
@@ -123,6 +123,7 @@ driCreateContextAttribs(__DRIscreen *screen, int api,
|
||||
mesa_api = API_OPENGLES;
|
||||
break;
|
||||
case __DRI_API_GLES2:
|
||||
case __DRI_API_GLES3:
|
||||
mesa_api = API_OPENGLES2;
|
||||
break;
|
||||
case __DRI_API_OPENGL_CORE:
|
||||
|
@@ -52,23 +52,33 @@ i830InitDriverFunctions(struct dd_function_table *functions)
|
||||
extern const struct tnl_pipeline_stage *intel_pipeline[];
|
||||
|
||||
bool
|
||||
i830CreateContext(const struct gl_config * mesaVis,
|
||||
i830CreateContext(int api,
|
||||
const struct gl_config * mesaVis,
|
||||
__DRIcontext * driContextPriv,
|
||||
unsigned major_version,
|
||||
unsigned minor_version,
|
||||
unsigned *error,
|
||||
void *sharedContextPrivate)
|
||||
{
|
||||
struct dd_function_table functions;
|
||||
struct i830_context *i830 = rzalloc(NULL, struct i830_context);
|
||||
struct intel_context *intel = &i830->intel;
|
||||
struct gl_context *ctx = &intel->ctx;
|
||||
if (!i830)
|
||||
|
||||
if (!i830) {
|
||||
*error = __DRI_CTX_ERROR_NO_MEMORY;
|
||||
return false;
|
||||
}
|
||||
|
||||
i830InitVtbl(i830);
|
||||
i830InitDriverFunctions(&functions);
|
||||
|
||||
if (!intelInitContext(intel, __DRI_API_OPENGL, mesaVis, driContextPriv,
|
||||
sharedContextPrivate, &functions)) {
|
||||
free(i830);
|
||||
if (!intelInitContext(intel, __DRI_API_OPENGL,
|
||||
major_version, minor_version,
|
||||
mesaVis, driContextPriv,
|
||||
sharedContextPrivate, &functions,
|
||||
error)) {
|
||||
ralloc_free(i830);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@@ -178,8 +178,12 @@ i830_state_draw_region(struct intel_context *intel,
|
||||
/* i830_context.c
|
||||
*/
|
||||
extern bool
|
||||
i830CreateContext(const struct gl_config * mesaVis,
|
||||
i830CreateContext(int api,
|
||||
const struct gl_config * mesaVis,
|
||||
__DRIcontext * driContextPriv,
|
||||
unsigned major_version,
|
||||
unsigned minor_version,
|
||||
unsigned *error,
|
||||
void *sharedContextPrivate);
|
||||
|
||||
/* i830_tex.c, i830_texstate.c
|
||||
|
@@ -168,33 +168,11 @@ i915CreateContext(int api,
|
||||
|
||||
i915InitDriverFunctions(&functions);
|
||||
|
||||
if (!intelInitContext(intel, api, mesaVis, driContextPriv,
|
||||
sharedContextPrivate, &functions)) {
|
||||
*error = __DRI_CTX_ERROR_NO_MEMORY;
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Now that the extension bits are known, filter against the requested API
|
||||
* and version.
|
||||
*/
|
||||
switch (api) {
|
||||
case API_OPENGL_COMPAT: {
|
||||
const unsigned max_version =
|
||||
(ctx->Extensions.ARB_fragment_shader &&
|
||||
ctx->Extensions.ARB_occlusion_query) ? 20 : 15;
|
||||
const unsigned req_version = major_version * 10 + minor_version;
|
||||
|
||||
if (req_version > max_version) {
|
||||
*error = __DRI_CTX_ERROR_BAD_VERSION;
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case API_OPENGLES:
|
||||
case API_OPENGLES2:
|
||||
break;
|
||||
default:
|
||||
*error = __DRI_CTX_ERROR_BAD_API;
|
||||
if (!intelInitContext(intel, api, major_version, minor_version,
|
||||
mesaVis, driContextPriv,
|
||||
sharedContextPrivate, &functions,
|
||||
error)) {
|
||||
ralloc_free(i915);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@@ -87,47 +87,8 @@ brwCreateContext(int api,
|
||||
__DRIscreen *sPriv = driContextPriv->driScreenPriv;
|
||||
struct intel_screen *screen = sPriv->driverPrivate;
|
||||
struct dd_function_table functions;
|
||||
const unsigned req_version = major_version * 10 + minor_version;
|
||||
unsigned max_supported_version = 0;
|
||||
unsigned i;
|
||||
|
||||
#ifdef TEXTURE_FLOAT_ENABLED
|
||||
bool has_texture_float = true;
|
||||
#else
|
||||
bool has_texture_float = false;
|
||||
#endif
|
||||
|
||||
bool supports_gl30 = has_texture_float &&
|
||||
(screen->gen == 6 ||
|
||||
(screen->gen == 7 &&
|
||||
screen->kernel_has_gen7_sol_reset));
|
||||
|
||||
/* Determine max_supported_version. */
|
||||
switch (api) {
|
||||
case API_OPENGL_COMPAT:
|
||||
max_supported_version = supports_gl30 ? 30 : 21;
|
||||
break;
|
||||
case API_OPENGLES:
|
||||
max_supported_version = 11;
|
||||
break;
|
||||
case API_OPENGLES2:
|
||||
max_supported_version = 20;
|
||||
break;
|
||||
case API_OPENGL_CORE:
|
||||
max_supported_version = supports_gl30 ? 31 : 0;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (max_supported_version == 0) {
|
||||
*error = __DRI_CTX_ERROR_BAD_API;
|
||||
return false;
|
||||
} else if (req_version > max_supported_version) {
|
||||
*error = __DRI_CTX_ERROR_BAD_VERSION;
|
||||
return false;
|
||||
}
|
||||
|
||||
struct brw_context *brw = rzalloc(NULL, struct brw_context);
|
||||
if (!brw) {
|
||||
printf("%s: failed to alloc context\n", __FUNCTION__);
|
||||
@@ -147,10 +108,12 @@ brwCreateContext(int api,
|
||||
struct intel_context *intel = &brw->intel;
|
||||
struct gl_context *ctx = &intel->ctx;
|
||||
|
||||
if (!intelInitContext( intel, api, mesaVis, driContextPriv,
|
||||
sharedContextPrivate, &functions )) {
|
||||
if (!intelInitContext( intel, api, major_version, minor_version,
|
||||
mesaVis, driContextPriv,
|
||||
sharedContextPrivate, &functions,
|
||||
error)) {
|
||||
printf("%s: failed to init intel context\n", __FUNCTION__);
|
||||
*error = __DRI_CTX_ERROR_NO_MEMORY;
|
||||
ralloc_free(brw);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -365,8 +328,8 @@ brwCreateContext(int api,
|
||||
|
||||
intel->batch.need_workaround_flush = true;
|
||||
|
||||
ctx->VertexProgram._MaintainTnlProgram = true;
|
||||
ctx->FragmentProgram._MaintainTexEnvProgram = true;
|
||||
ctx->VertexProgram._MaintainTnlProgram = ctx->API != API_OPENGL_CORE;
|
||||
ctx->FragmentProgram._MaintainTexEnvProgram = ctx->API != API_OPENGL_CORE;
|
||||
|
||||
brw_draw_init( brw );
|
||||
|
||||
|
@@ -52,13 +52,13 @@ can_cut_index_handle_restart_index(struct gl_context *ctx,
|
||||
|
||||
switch (ib->type) {
|
||||
case GL_UNSIGNED_BYTE:
|
||||
cut_index_will_work = (ctx->Array.RestartIndex & 0xff) == 0xff;
|
||||
cut_index_will_work = (ctx->Array._RestartIndex & 0xff) == 0xff;
|
||||
break;
|
||||
case GL_UNSIGNED_SHORT:
|
||||
cut_index_will_work = (ctx->Array.RestartIndex & 0xffff) == 0xffff;
|
||||
cut_index_will_work = (ctx->Array._RestartIndex & 0xffff) == 0xffff;
|
||||
break;
|
||||
case GL_UNSIGNED_INT:
|
||||
cut_index_will_work = ctx->Array.RestartIndex == 0xffffffff;
|
||||
cut_index_will_work = ctx->Array._RestartIndex == 0xffffffff;
|
||||
break;
|
||||
default:
|
||||
cut_index_will_work = false;
|
||||
@@ -157,7 +157,7 @@ brw_handle_primitive_restart(struct gl_context *ctx,
|
||||
/* If PrimitiveRestart is not enabled, then we aren't concerned about
|
||||
* handling this draw.
|
||||
*/
|
||||
if (!(ctx->Array.PrimitiveRestart)) {
|
||||
if (!(ctx->Array._PrimitiveRestart)) {
|
||||
return GL_FALSE;
|
||||
}
|
||||
|
||||
|
@@ -195,6 +195,7 @@ brw_queryobj_get_results(struct gl_context *ctx,
|
||||
break;
|
||||
|
||||
case GL_ANY_SAMPLES_PASSED:
|
||||
case GL_ANY_SAMPLES_PASSED_CONSERVATIVE:
|
||||
/* Set true if any of the sub-queries passed. */
|
||||
for (i = query->first_index; i <= query->last_index; i++) {
|
||||
if (results[i * 2 + 1] != results[i * 2]) {
|
||||
@@ -261,6 +262,7 @@ brw_begin_query(struct gl_context *ctx, struct gl_query_object *q)
|
||||
break;
|
||||
|
||||
case GL_ANY_SAMPLES_PASSED:
|
||||
case GL_ANY_SAMPLES_PASSED_CONSERVATIVE:
|
||||
case GL_SAMPLES_PASSED_ARB:
|
||||
/* Reset our driver's tracking of query state. */
|
||||
drm_intel_bo_unreference(query->bo);
|
||||
@@ -316,6 +318,7 @@ brw_end_query(struct gl_context *ctx, struct gl_query_object *q)
|
||||
break;
|
||||
|
||||
case GL_ANY_SAMPLES_PASSED:
|
||||
case GL_ANY_SAMPLES_PASSED_CONSERVATIVE:
|
||||
case GL_SAMPLES_PASSED_ARB:
|
||||
if (query->bo) {
|
||||
brw_emit_query_end(brw);
|
||||
|
@@ -579,13 +579,55 @@ intelInitDriverFunctions(struct dd_function_table *functions)
|
||||
intel_init_syncobj_functions(functions);
|
||||
}
|
||||
|
||||
static bool
|
||||
validate_context_version(struct intel_screen *screen,
|
||||
int mesa_api,
|
||||
unsigned major_version,
|
||||
unsigned minor_version,
|
||||
unsigned *dri_ctx_error)
|
||||
{
|
||||
unsigned req_version = 10 * major_version + minor_version;
|
||||
unsigned max_version = 0;
|
||||
|
||||
switch (mesa_api) {
|
||||
case API_OPENGL_COMPAT:
|
||||
max_version = screen->max_gl_compat_version;
|
||||
break;
|
||||
case API_OPENGL_CORE:
|
||||
max_version = screen->max_gl_core_version;
|
||||
break;
|
||||
case API_OPENGLES:
|
||||
max_version = screen->max_gl_es1_version;
|
||||
break;
|
||||
case API_OPENGLES2:
|
||||
max_version = screen->max_gl_es2_version;
|
||||
break;
|
||||
default:
|
||||
max_version = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
if (max_version == 0) {
|
||||
*dri_ctx_error = __DRI_CTX_ERROR_BAD_API;
|
||||
return false;
|
||||
} else if (req_version > max_version) {
|
||||
*dri_ctx_error = __DRI_CTX_ERROR_BAD_VERSION;
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
intelInitContext(struct intel_context *intel,
|
||||
int api,
|
||||
int api,
|
||||
unsigned major_version,
|
||||
unsigned minor_version,
|
||||
const struct gl_config * mesaVis,
|
||||
__DRIcontext * driContextPriv,
|
||||
void *sharedContextPrivate,
|
||||
struct dd_function_table *functions)
|
||||
struct dd_function_table *functions,
|
||||
unsigned *dri_ctx_error)
|
||||
{
|
||||
struct gl_context *ctx = &intel->ctx;
|
||||
struct gl_context *shareCtx = (struct gl_context *) sharedContextPrivate;
|
||||
@@ -595,7 +637,14 @@ intelInitContext(struct intel_context *intel,
|
||||
struct gl_config visual;
|
||||
|
||||
/* we can't do anything without a connection to the device */
|
||||
if (intelScreen->bufmgr == NULL)
|
||||
if (intelScreen->bufmgr == NULL) {
|
||||
*dri_ctx_error = __DRI_CTX_ERROR_NO_MEMORY;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!validate_context_version(intelScreen,
|
||||
api, major_version, minor_version,
|
||||
dri_ctx_error))
|
||||
return false;
|
||||
|
||||
/* Can't rely on invalidate events, fall back to glViewport hack */
|
||||
@@ -611,6 +660,7 @@ intelInitContext(struct intel_context *intel,
|
||||
|
||||
if (!_mesa_initialize_context(&intel->ctx, api, mesaVis, shareCtx,
|
||||
functions)) {
|
||||
*dri_ctx_error = __DRI_CTX_ERROR_NO_MEMORY;
|
||||
printf("%s: failed to init mesa context\n", __FUNCTION__);
|
||||
return false;
|
||||
}
|
||||
|
@@ -514,11 +514,14 @@ extern int INTEL_DEBUG;
|
||||
*/
|
||||
|
||||
extern bool intelInitContext(struct intel_context *intel,
|
||||
int api,
|
||||
const struct gl_config * mesaVis,
|
||||
__DRIcontext * driContextPriv,
|
||||
void *sharedContextPrivate,
|
||||
struct dd_function_table *functions);
|
||||
int api,
|
||||
unsigned major_version,
|
||||
unsigned minor_version,
|
||||
const struct gl_config * mesaVis,
|
||||
__DRIcontext * driContextPriv,
|
||||
void *sharedContextPrivate,
|
||||
struct dd_function_table *functions,
|
||||
unsigned *dri_ctx_error);
|
||||
|
||||
extern void intelFinish(struct gl_context * ctx);
|
||||
extern void intel_flush_rendering_to_batch(struct gl_context *ctx);
|
||||
|
@@ -104,6 +104,7 @@ intelInitExtensions(struct gl_context *ctx)
|
||||
ctx->Extensions.ARB_uniform_buffer_object = true;
|
||||
ctx->Extensions.ARB_texture_buffer_object = true;
|
||||
ctx->Extensions.ARB_texture_cube_map_array = true;
|
||||
ctx->Extensions.ARB_ES3_compatibility = true;
|
||||
}
|
||||
|
||||
if (intel->gen >= 5)
|
||||
|
@@ -753,8 +753,12 @@ intelDestroyBuffer(__DRIdrawable * driDrawPriv)
|
||||
* functions.
|
||||
*/
|
||||
extern bool
|
||||
i830CreateContext(const struct gl_config *mesaVis,
|
||||
i830CreateContext(int api,
|
||||
const struct gl_config *mesaVis,
|
||||
__DRIcontext *driContextPriv,
|
||||
unsigned major_version,
|
||||
unsigned minor_version,
|
||||
unsigned *error,
|
||||
void *sharedContextPrivate);
|
||||
|
||||
extern bool
|
||||
@@ -796,27 +800,10 @@ intelCreateContext(gl_api api,
|
||||
major_version, minor_version, error,
|
||||
sharedContextPrivate);
|
||||
} else {
|
||||
switch (api) {
|
||||
case API_OPENGL_COMPAT:
|
||||
if (major_version > 1 || minor_version > 3) {
|
||||
*error = __DRI_CTX_ERROR_BAD_VERSION;
|
||||
success = false;
|
||||
}
|
||||
break;
|
||||
case API_OPENGLES:
|
||||
break;
|
||||
default:
|
||||
*error = __DRI_CTX_ERROR_BAD_API;
|
||||
success = false;
|
||||
}
|
||||
|
||||
if (success) {
|
||||
intelScreen->no_vbo = true;
|
||||
success = i830CreateContext(mesaVis, driContextPriv,
|
||||
sharedContextPrivate);
|
||||
if (!success)
|
||||
*error = __DRI_CTX_ERROR_NO_MEMORY;
|
||||
}
|
||||
intelScreen->no_vbo = true;
|
||||
success = i830CreateContext(api, mesaVis, driContextPriv,
|
||||
major_version, minor_version, error,
|
||||
sharedContextPrivate);
|
||||
}
|
||||
#else
|
||||
success = brwCreateContext(api, mesaVis,
|
||||
@@ -1050,6 +1037,90 @@ intel_screen_make_configs(__DRIscreen *dri_screen)
|
||||
return configs;
|
||||
}
|
||||
|
||||
static void
|
||||
set_max_gl_versions(struct intel_screen *screen)
|
||||
{
|
||||
#ifdef TEXTURE_FLOAT_ENABLED
|
||||
bool has_texture_float = true;
|
||||
#else
|
||||
bool has_texture_float = false;
|
||||
#endif
|
||||
|
||||
switch (screen->gen) {
|
||||
case 7:
|
||||
if (has_texture_float && screen->kernel_has_gen7_sol_reset) {
|
||||
screen->max_gl_core_version = 31;
|
||||
screen->max_gl_compat_version = 30;
|
||||
screen->max_gl_es1_version = 11;
|
||||
screen->max_gl_es2_version = 30;
|
||||
} else {
|
||||
screen->max_gl_core_version = 0;
|
||||
screen->max_gl_compat_version = 21;
|
||||
screen->max_gl_es1_version = 11;
|
||||
screen->max_gl_es2_version = 20;
|
||||
}
|
||||
break;
|
||||
case 6:
|
||||
if (has_texture_float) {
|
||||
screen->max_gl_core_version = 31;
|
||||
screen->max_gl_compat_version = 30;
|
||||
screen->max_gl_es1_version = 11;
|
||||
screen->max_gl_es2_version = 30;
|
||||
} else {
|
||||
screen->max_gl_core_version = 0;
|
||||
screen->max_gl_compat_version = 21;
|
||||
screen->max_gl_es1_version = 11;
|
||||
screen->max_gl_es2_version = 20;
|
||||
}
|
||||
break;
|
||||
case 5:
|
||||
case 4:
|
||||
screen->max_gl_core_version = 0;
|
||||
screen->max_gl_compat_version = 21;
|
||||
screen->max_gl_es1_version = 11;
|
||||
screen->max_gl_es2_version = 20;
|
||||
break;
|
||||
case 3: {
|
||||
bool has_fragment_shader = driQueryOptionb(&screen->optionCache, "fragment_shader");
|
||||
bool has_occlusion_query = driQueryOptionb(&screen->optionCache, "stub_occlusion_query");
|
||||
|
||||
screen->max_gl_core_version = 0;
|
||||
screen->max_gl_es1_version = 11;
|
||||
|
||||
if (has_fragment_shader && has_occlusion_query) {
|
||||
screen->max_gl_compat_version = 21;
|
||||
} else {
|
||||
screen->max_gl_compat_version = 14;
|
||||
}
|
||||
|
||||
if (has_fragment_shader) {
|
||||
screen->max_gl_es2_version = 20;
|
||||
} else {
|
||||
screen->max_gl_es2_version = 0;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case 2:
|
||||
screen->max_gl_core_version = 0;
|
||||
screen->max_gl_compat_version = 13;
|
||||
screen->max_gl_es1_version = 11;
|
||||
screen->max_gl_es2_version = 0;
|
||||
break;
|
||||
default:
|
||||
assert(!"unrecognized intel_screen::gen");
|
||||
break;
|
||||
}
|
||||
|
||||
#ifndef FEATURE_ES1
|
||||
screen->max_gl_es1_version = 0;
|
||||
#endif
|
||||
|
||||
#ifndef FEATURE_ES2
|
||||
screen->max_gl_es2_version = 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
* This is the driver specific part of the createNewScreen entry point.
|
||||
* Called when using DRI2.
|
||||
@@ -1060,7 +1131,6 @@ static const
|
||||
__DRIconfig **intelInitScreen2(__DRIscreen *psp)
|
||||
{
|
||||
struct intel_screen *intelScreen;
|
||||
unsigned int api_mask;
|
||||
|
||||
if (psp->dri2.loader->base.version <= 2 ||
|
||||
psp->dri2.loader->getBuffersWithFormat == NULL) {
|
||||
@@ -1119,19 +1189,18 @@ __DRIconfig **intelInitScreen2(__DRIscreen *psp)
|
||||
|
||||
intel_override_separate_stencil(intelScreen);
|
||||
|
||||
api_mask = (1 << __DRI_API_OPENGL);
|
||||
#if FEATURE_ES1
|
||||
api_mask |= (1 << __DRI_API_GLES);
|
||||
#endif
|
||||
#if FEATURE_ES2
|
||||
api_mask |= (1 << __DRI_API_GLES2);
|
||||
#endif
|
||||
|
||||
if (IS_9XX(intelScreen->deviceID) || IS_965(intelScreen->deviceID))
|
||||
psp->api_mask = api_mask;
|
||||
|
||||
intelScreen->hw_has_swizzling = intel_detect_swizzling(intelScreen);
|
||||
|
||||
set_max_gl_versions(intelScreen);
|
||||
|
||||
psp->api_mask = (1 << __DRI_API_OPENGL);
|
||||
if (intelScreen->max_gl_es1_version > 0)
|
||||
psp->api_mask |= (1 << __DRI_API_GLES);
|
||||
if (intelScreen->max_gl_es2_version > 0)
|
||||
psp->api_mask |= (1 << __DRI_API_GLES2);
|
||||
if (intelScreen->max_gl_es2_version >= 30)
|
||||
psp->api_mask |= (1 << __DRI_API_GLES3);
|
||||
|
||||
psp->extensions = intelScreenExtensions;
|
||||
|
||||
return (const __DRIconfig**) intel_screen_make_configs(psp);
|
||||
|
@@ -40,6 +40,11 @@ struct intel_screen
|
||||
int deviceID;
|
||||
int gen;
|
||||
|
||||
int max_gl_core_version;
|
||||
int max_gl_compat_version;
|
||||
int max_gl_es1_version;
|
||||
int max_gl_es2_version;
|
||||
|
||||
int logTextureGranularity;
|
||||
|
||||
__DRIscreen *driScrnPriv;
|
||||
|
@@ -239,8 +239,11 @@ intelTexImage(struct gl_context * ctx,
|
||||
__FUNCTION__, texImage->Width, texImage->Height, texImage->Depth,
|
||||
pixels);
|
||||
|
||||
_mesa_store_teximage(ctx, dims, texImage,
|
||||
format, type, pixels, unpack);
|
||||
ctx->Driver.AllocTextureImageBuffer(ctx, texImage);
|
||||
if (format != GL_NONE && type != GL_NONE) {
|
||||
_mesa_store_teximage(ctx, dims, texImage,
|
||||
format, type, pixels, unpack);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@@ -1636,7 +1636,7 @@ void GLAPIENTRY _ae_ArrayElement( GLint elt )
|
||||
/* If PrimitiveRestart is enabled and the index is the RestartIndex
|
||||
* then we call PrimitiveRestartNV and return.
|
||||
*/
|
||||
if (ctx->Array.PrimitiveRestart && (elt == ctx->Array.RestartIndex)) {
|
||||
if (ctx->Array._PrimitiveRestart && (elt == ctx->Array._RestartIndex)) {
|
||||
CALL_PrimitiveRestartNV((struct _glapi_table *)disp, ());
|
||||
return;
|
||||
}
|
||||
|
@@ -1377,7 +1377,10 @@ copy_array_attrib(struct gl_context *ctx,
|
||||
dest->LockFirst = src->LockFirst;
|
||||
dest->LockCount = src->LockCount;
|
||||
dest->PrimitiveRestart = src->PrimitiveRestart;
|
||||
dest->PrimitiveRestartFixedIndex = src->PrimitiveRestartFixedIndex;
|
||||
dest->_PrimitiveRestart = src->_PrimitiveRestart;
|
||||
dest->RestartIndex = src->RestartIndex;
|
||||
dest->_RestartIndex = src->_RestartIndex;
|
||||
/* skip NewState */
|
||||
/* skip RebindArrays */
|
||||
|
||||
|
@@ -136,10 +136,24 @@ get_buffer(struct gl_context *ctx, const char *func, GLenum target)
|
||||
}
|
||||
|
||||
|
||||
static inline GLbitfield
|
||||
default_access_mode(const struct gl_context *ctx)
|
||||
/**
|
||||
* Convert a GLbitfield describing the mapped buffer access flags
|
||||
* into one of GL_READ_WRITE, GL_READ_ONLY, or GL_WRITE_ONLY.
|
||||
*/
|
||||
static GLenum
|
||||
simplified_access_mode(struct gl_context *ctx, GLbitfield access)
|
||||
{
|
||||
/* Table 2.6 on page 31 (page 44 of the PDF) of the OpenGL 1.5 spec says:
|
||||
const GLbitfield rwFlags = GL_MAP_READ_BIT | GL_MAP_WRITE_BIT;
|
||||
if ((access & rwFlags) == rwFlags)
|
||||
return GL_READ_WRITE;
|
||||
if ((access & GL_MAP_READ_BIT) == GL_MAP_READ_BIT)
|
||||
return GL_READ_ONLY;
|
||||
if ((access & GL_MAP_WRITE_BIT) == GL_MAP_WRITE_BIT)
|
||||
return GL_WRITE_ONLY;
|
||||
|
||||
/* Otherwise, AccessFlags is zero (the default state).
|
||||
*
|
||||
* Table 2.6 on page 31 (page 44 of the PDF) of the OpenGL 1.5 spec says:
|
||||
*
|
||||
* Name Type Initial Value Legal Values
|
||||
* ... ... ... ...
|
||||
@@ -155,26 +169,9 @@ default_access_mode(const struct gl_context *ctx)
|
||||
* The difference is because GL_OES_mapbuffer only supports mapping buffers
|
||||
* write-only.
|
||||
*/
|
||||
return _mesa_is_gles(ctx)
|
||||
? GL_MAP_WRITE_BIT : (GL_MAP_READ_BIT | GL_MAP_WRITE_BIT);
|
||||
}
|
||||
assert(access == 0);
|
||||
|
||||
|
||||
/**
|
||||
* Convert a GLbitfield describing the mapped buffer access flags
|
||||
* into one of GL_READ_WRITE, GL_READ_ONLY, or GL_WRITE_ONLY.
|
||||
*/
|
||||
static GLenum
|
||||
simplified_access_mode(GLbitfield access)
|
||||
{
|
||||
const GLbitfield rwFlags = GL_MAP_READ_BIT | GL_MAP_WRITE_BIT;
|
||||
if ((access & rwFlags) == rwFlags)
|
||||
return GL_READ_WRITE;
|
||||
if ((access & GL_MAP_READ_BIT) == GL_MAP_READ_BIT)
|
||||
return GL_READ_ONLY;
|
||||
if ((access & GL_MAP_WRITE_BIT) == GL_MAP_WRITE_BIT)
|
||||
return GL_WRITE_ONLY;
|
||||
return GL_READ_WRITE; /* this should never happen, but no big deal */
|
||||
return _mesa_is_gles(ctx) ? GL_WRITE_ONLY : GL_READ_WRITE;
|
||||
}
|
||||
|
||||
|
||||
@@ -354,7 +351,7 @@ _mesa_initialize_buffer_object( struct gl_context *ctx,
|
||||
obj->RefCount = 1;
|
||||
obj->Name = name;
|
||||
obj->Usage = GL_STATIC_DRAW_ARB;
|
||||
obj->AccessFlags = default_access_mode(ctx);
|
||||
obj->AccessFlags = 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -864,7 +861,7 @@ _mesa_DeleteBuffers(GLsizei n, const GLuint *ids)
|
||||
if (_mesa_bufferobj_mapped(bufObj)) {
|
||||
/* if mapped, unmap it now */
|
||||
ctx->Driver.UnmapBuffer(ctx, bufObj);
|
||||
bufObj->AccessFlags = default_access_mode(ctx);
|
||||
bufObj->AccessFlags = 0;
|
||||
bufObj->Pointer = NULL;
|
||||
}
|
||||
|
||||
@@ -1064,7 +1061,7 @@ _mesa_BufferData(GLenum target, GLsizeiptrARB size,
|
||||
if (_mesa_bufferobj_mapped(bufObj)) {
|
||||
/* Unmap the existing buffer. We'll replace it now. Not an error. */
|
||||
ctx->Driver.UnmapBuffer(ctx, bufObj);
|
||||
bufObj->AccessFlags = default_access_mode(ctx);
|
||||
bufObj->AccessFlags = 0;
|
||||
ASSERT(bufObj->Pointer == NULL);
|
||||
}
|
||||
|
||||
@@ -1282,7 +1279,7 @@ _mesa_UnmapBuffer(GLenum target)
|
||||
#endif
|
||||
|
||||
status = ctx->Driver.UnmapBuffer( ctx, bufObj );
|
||||
bufObj->AccessFlags = default_access_mode(ctx);
|
||||
bufObj->AccessFlags = 0;
|
||||
ASSERT(bufObj->Pointer == NULL);
|
||||
ASSERT(bufObj->Offset == 0);
|
||||
ASSERT(bufObj->Length == 0);
|
||||
@@ -1310,7 +1307,7 @@ _mesa_GetBufferParameteriv(GLenum target, GLenum pname, GLint *params)
|
||||
*params = bufObj->Usage;
|
||||
return;
|
||||
case GL_BUFFER_ACCESS_ARB:
|
||||
*params = simplified_access_mode(bufObj->AccessFlags);
|
||||
*params = simplified_access_mode(ctx, bufObj->AccessFlags);
|
||||
return;
|
||||
case GL_BUFFER_MAPPED_ARB:
|
||||
*params = _mesa_bufferobj_mapped(bufObj);
|
||||
@@ -1364,7 +1361,7 @@ _mesa_GetBufferParameteri64v(GLenum target, GLenum pname, GLint64 *params)
|
||||
*params = bufObj->Usage;
|
||||
return;
|
||||
case GL_BUFFER_ACCESS_ARB:
|
||||
*params = simplified_access_mode(bufObj->AccessFlags);
|
||||
*params = simplified_access_mode(ctx, bufObj->AccessFlags);
|
||||
return;
|
||||
case GL_BUFFER_ACCESS_FLAGS:
|
||||
if (!ctx->Extensions.ARB_map_buffer_range)
|
||||
|
@@ -290,6 +290,10 @@ _mesa_DrawBuffers(GLsizei n, const GLenum *buffers)
|
||||
|
||||
/* Turns out n==0 is a valid input that should not produce an error.
|
||||
* The remaining code below correctly handles the n==0 case.
|
||||
*
|
||||
* From the OpenGL 3.0 specification, page 258:
|
||||
* "An INVALID_VALUE error is generated if n is greater than
|
||||
* MAX_DRAW_BUFFERS."
|
||||
*/
|
||||
if (n < 0 || n > (GLsizei) ctx->Const.MaxDrawBuffers) {
|
||||
_mesa_error(ctx, GL_INVALID_VALUE, "glDrawBuffersARB(n)");
|
||||
@@ -305,20 +309,76 @@ _mesa_DrawBuffers(GLsizei n, const GLenum *buffers)
|
||||
destMask[output] = 0x0;
|
||||
}
|
||||
else {
|
||||
/* From the OpenGL 3.0 specification, page 258:
|
||||
* "If the GL is bound to a framebuffer object and DrawBuffers is
|
||||
* supplied with [...] COLOR_ATTACHMENTm where m is greater than or
|
||||
* equal to the value of MAX_COLOR_ATTACHMENTS, then the error
|
||||
* INVALID_OPERATION results."
|
||||
*/
|
||||
if (_mesa_is_user_fbo(ctx->DrawBuffer) && buffers[output] >=
|
||||
GL_COLOR_ATTACHMENT0 + ctx->Const.MaxDrawBuffers) {
|
||||
_mesa_error(ctx, GL_INVALID_OPERATION, "glDrawBuffersARB(buffer)");
|
||||
return;
|
||||
}
|
||||
|
||||
destMask[output] = draw_buffer_enum_to_bitmask(buffers[output]);
|
||||
if (destMask[output] == BAD_MASK
|
||||
|| _mesa_bitcount(destMask[output]) > 1) {
|
||||
|
||||
/* From the OpenGL 3.0 specification, page 258:
|
||||
* "Each buffer listed in bufs must be one of the values from tables
|
||||
* 4.5 or 4.6. Otherwise, an INVALID_ENUM error is generated.
|
||||
*/
|
||||
if (destMask[output] == BAD_MASK) {
|
||||
_mesa_error(ctx, GL_INVALID_ENUM, "glDrawBuffersARB(buffer)");
|
||||
return;
|
||||
}
|
||||
|
||||
/* From the OpenGL 3.0 specification, page 259:
|
||||
* "For both the default framebuffer and framebuffer objects, the
|
||||
* constants FRONT, BACK, LEFT, RIGHT, and FRONT_AND_BACK are not
|
||||
* valid in the bufs array passed to DrawBuffers, and will result in
|
||||
* the error INVALID_OPERATION. This restriction is because these
|
||||
* constants may themselves refer to multiple buffers, as shown in
|
||||
* table 4.4."
|
||||
*/
|
||||
if (_mesa_bitcount(destMask[output]) > 1) {
|
||||
_mesa_error(ctx, GL_INVALID_OPERATION, "glDrawBuffersARB(buffer)");
|
||||
return;
|
||||
}
|
||||
|
||||
/* From the OpenGL 3.0 specification, page 259:
|
||||
* "If the GL is bound to the default framebuffer and DrawBuffers is
|
||||
* supplied with a constant (other than NONE) that does not indicate
|
||||
* any of the color buffers allocated to the GL context by the window
|
||||
* system, the error INVALID_OPERATION will be generated.
|
||||
*
|
||||
* If the GL is bound to a framebuffer object and DrawBuffers is
|
||||
* supplied with a constant from table 4.6 [...] then the error
|
||||
* INVALID_OPERATION results."
|
||||
*/
|
||||
destMask[output] &= supportedMask;
|
||||
if (destMask[output] == 0) {
|
||||
_mesa_error(ctx, GL_INVALID_OPERATION,
|
||||
"glDrawBuffersARB(unsupported buffer)");
|
||||
return;
|
||||
}
|
||||
|
||||
/* ES 3.0 is even more restrictive. From the ES 3.0 spec, page 180:
|
||||
* "If the GL is bound to a framebuffer object, the ith buffer listed
|
||||
* in bufs must be COLOR_ATTACHMENTi or NONE. [...] INVALID_OPERATION."
|
||||
*/
|
||||
if (_mesa_is_gles3(ctx) && _mesa_is_user_fbo(ctx->DrawBuffer) &&
|
||||
buffers[output] != GL_NONE &&
|
||||
buffers[output] != GL_COLOR_ATTACHMENT0 + output) {
|
||||
_mesa_error(ctx, GL_INVALID_OPERATION, "glDrawBuffers(buffer)");
|
||||
return;
|
||||
}
|
||||
|
||||
/* From the OpenGL 3.0 specification, page 258:
|
||||
* "Except for NONE, a buffer may not appear more than once in the
|
||||
* array pointed to by bufs. Specifying a buffer more then once will
|
||||
* result in the error INVALID_OPERATION."
|
||||
*/
|
||||
if (destMask[output] & usedBufferMask) {
|
||||
/* can't specify a dest buffer more than once! */
|
||||
_mesa_error(ctx, GL_INVALID_OPERATION,
|
||||
"glDrawBuffersARB(duplicated buffer)");
|
||||
return;
|
||||
|
@@ -656,6 +656,9 @@ _mesa_init_constants(struct gl_context *ctx)
|
||||
|
||||
/* PrimitiveRestart */
|
||||
ctx->Const.PrimitiveRestartInSoftware = GL_FALSE;
|
||||
|
||||
/* ES 3.0 or ARB_ES3_compatibility */
|
||||
ctx->Const.MaxElementIndex = 0xffffffffu;
|
||||
}
|
||||
|
||||
|
||||
|
@@ -48,6 +48,20 @@
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
update_derived_primitive_restart_state(struct gl_context *ctx)
|
||||
{
|
||||
/* Update derived primitive restart state.
|
||||
*/
|
||||
if (ctx->Array.PrimitiveRestart)
|
||||
ctx->Array._RestartIndex = ctx->Array.RestartIndex;
|
||||
else
|
||||
ctx->Array._RestartIndex = ~0;
|
||||
|
||||
ctx->Array._PrimitiveRestart = ctx->Array.PrimitiveRestart
|
||||
|| ctx->Array.PrimitiveRestartFixedIndex;
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper to enable/disable client-side state.
|
||||
*/
|
||||
@@ -119,6 +133,8 @@ client_state(struct gl_context *ctx, GLenum cap, GLboolean state)
|
||||
|
||||
*var = state;
|
||||
|
||||
update_derived_primitive_restart_state(ctx);
|
||||
|
||||
if (state)
|
||||
arrayObj->_Enabled |= flag;
|
||||
else
|
||||
@@ -967,6 +983,17 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
|
||||
if (ctx->Array.PrimitiveRestart != state) {
|
||||
FLUSH_VERTICES(ctx, _NEW_TRANSFORM);
|
||||
ctx->Array.PrimitiveRestart = state;
|
||||
update_derived_primitive_restart_state(ctx);
|
||||
}
|
||||
break;
|
||||
|
||||
case GL_PRIMITIVE_RESTART_FIXED_INDEX:
|
||||
if (!_mesa_is_gles3(ctx) && !ctx->Extensions.ARB_ES3_compatibility)
|
||||
goto invalid_enum_error;
|
||||
if (ctx->Array.PrimitiveRestartFixedIndex != state) {
|
||||
FLUSH_VERTICES(ctx, _NEW_TRANSFORM);
|
||||
ctx->Array.PrimitiveRestartFixedIndex = state;
|
||||
update_derived_primitive_restart_state(ctx);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -1542,6 +1569,12 @@ _mesa_IsEnabled( GLenum cap )
|
||||
}
|
||||
return ctx->Array.PrimitiveRestart;
|
||||
|
||||
case GL_PRIMITIVE_RESTART_FIXED_INDEX:
|
||||
if (!_mesa_is_gles3(ctx) && !ctx->Extensions.ARB_ES3_compatibility) {
|
||||
goto invalid_enum_error;
|
||||
}
|
||||
return ctx->Array.PrimitiveRestartFixedIndex;
|
||||
|
||||
/* GL3.0 - GL_framebuffer_sRGB */
|
||||
case GL_FRAMEBUFFER_SRGB_EXT:
|
||||
if (!_mesa_is_desktop_gl(ctx))
|
||||
|
@@ -222,7 +222,7 @@ _mesa_get_attachment(struct gl_context *ctx, struct gl_framebuffer *fb,
|
||||
}
|
||||
return &fb->Attachment[BUFFER_COLOR0 + i];
|
||||
case GL_DEPTH_STENCIL_ATTACHMENT:
|
||||
if (!_mesa_is_desktop_gl(ctx))
|
||||
if (!_mesa_is_desktop_gl(ctx) && !_mesa_is_gles3(ctx))
|
||||
return NULL;
|
||||
/* fall-through */
|
||||
case GL_DEPTH_ATTACHMENT_EXT:
|
||||
@@ -492,7 +492,7 @@ _mesa_is_legal_color_format(const struct gl_context *ctx, GLenum baseFormat)
|
||||
case GL_LUMINANCE_ALPHA:
|
||||
case GL_INTENSITY:
|
||||
case GL_ALPHA:
|
||||
return ctx->Extensions.ARB_framebuffer_object;
|
||||
return _mesa_is_desktop_gl(ctx) && ctx->Extensions.ARB_framebuffer_object;
|
||||
case GL_RED:
|
||||
case GL_RG:
|
||||
return ctx->Extensions.ARB_texture_rg;
|
||||
@@ -502,6 +502,57 @@ _mesa_is_legal_color_format(const struct gl_context *ctx, GLenum baseFormat)
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Is the given base format a legal format for a color renderbuffer?
|
||||
*/
|
||||
static GLboolean
|
||||
is_format_color_renderable(const struct gl_context *ctx, gl_format format, GLenum internalFormat)
|
||||
{
|
||||
const GLenum baseFormat =
|
||||
_mesa_get_format_base_format(format);
|
||||
GLboolean valid;
|
||||
|
||||
valid = _mesa_is_legal_color_format(ctx, baseFormat);
|
||||
if (!valid || _mesa_is_desktop_gl(ctx)) {
|
||||
return valid;
|
||||
}
|
||||
|
||||
/* Reject additional cases for GLES */
|
||||
switch (internalFormat) {
|
||||
case GL_RGBA32F:
|
||||
case GL_RGBA16F:
|
||||
case GL_RGBA8_SNORM:
|
||||
case GL_RGB32F:
|
||||
case GL_RGB32I:
|
||||
case GL_RGB32UI:
|
||||
case GL_RGB16F:
|
||||
case GL_RGB16I:
|
||||
case GL_RGB16UI:
|
||||
case GL_RGB8_SNORM:
|
||||
case GL_RGB8I:
|
||||
case GL_RGB8UI:
|
||||
case GL_SRGB8:
|
||||
case GL_R11F_G11F_B10F:
|
||||
case GL_RGB9_E5:
|
||||
case GL_RG32F:
|
||||
case GL_RG16F:
|
||||
case GL_RG8_SNORM:
|
||||
case GL_R32F:
|
||||
case GL_R16F:
|
||||
case GL_R8_SNORM:
|
||||
return GL_FALSE;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (format == MESA_FORMAT_ARGB2101010 && internalFormat != GL_RGB10_A2) {
|
||||
return GL_FALSE;
|
||||
}
|
||||
|
||||
return GL_TRUE;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Is the given base format a legal format for a depth/stencil renderbuffer?
|
||||
*/
|
||||
@@ -567,7 +618,7 @@ test_attachment_completeness(const struct gl_context *ctx, GLenum format,
|
||||
baseFormat = _mesa_get_format_base_format(texImage->TexFormat);
|
||||
|
||||
if (format == GL_COLOR) {
|
||||
if (!_mesa_is_legal_color_format(ctx, baseFormat)) {
|
||||
if (!is_format_color_renderable(ctx, texImage->TexFormat, texImage->InternalFormat)) {
|
||||
att_incomplete("bad format");
|
||||
att->Complete = GL_FALSE;
|
||||
return;
|
||||
@@ -621,7 +672,7 @@ test_attachment_completeness(const struct gl_context *ctx, GLenum format,
|
||||
return;
|
||||
}
|
||||
if (format == GL_COLOR) {
|
||||
if (!_mesa_is_legal_color_format(ctx, baseFormat)) {
|
||||
if (!is_format_color_renderable(ctx, att->Renderbuffer->Format, att->Renderbuffer->InternalFormat)) {
|
||||
att_incomplete("bad renderbuffer color format");
|
||||
att->Complete = GL_FALSE;
|
||||
return;
|
||||
@@ -750,7 +801,7 @@ _mesa_test_framebuffer_completeness(struct gl_context *ctx,
|
||||
f = texImg->_BaseFormat;
|
||||
attFormat = texImg->TexFormat;
|
||||
numImages++;
|
||||
if (!_mesa_is_legal_color_format(ctx, f) &&
|
||||
if (!is_format_color_renderable(ctx, attFormat, texImg->InternalFormat) &&
|
||||
!is_legal_depth_format(ctx, f)) {
|
||||
fb->_Status = GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT;
|
||||
fbo_incomplete("texture attachment incomplete", -1);
|
||||
@@ -1110,7 +1161,7 @@ _mesa_base_fbo_format(struct gl_context *ctx, GLenum internalFormat)
|
||||
case GL_RGB16:
|
||||
return _mesa_is_desktop_gl(ctx) ? GL_RGB : 0;
|
||||
case GL_SRGB8_EXT:
|
||||
return _mesa_is_desktop_gl(ctx) || _mesa_is_gles3(ctx) ? GL_RGB : 0;
|
||||
return _mesa_is_desktop_gl(ctx) ? GL_RGB : 0;
|
||||
case GL_RGBA4:
|
||||
case GL_RGB5_A1:
|
||||
case GL_RGBA8:
|
||||
@@ -1170,32 +1221,28 @@ _mesa_base_fbo_format(struct gl_context *ctx, GLenum internalFormat)
|
||||
? GL_RG : 0;
|
||||
/* signed normalized texture formats */
|
||||
case GL_R8_SNORM:
|
||||
return ctx->Version >= 30
|
||||
|| (ctx->API == API_OPENGL_COMPAT && ctx->Extensions.EXT_texture_snorm)
|
||||
return (ctx->API == API_OPENGL_COMPAT && ctx->Extensions.EXT_texture_snorm)
|
||||
? GL_RED : 0;
|
||||
case GL_RED_SNORM:
|
||||
case GL_R16_SNORM:
|
||||
return _mesa_is_desktop_gl(ctx) && ctx->Extensions.EXT_texture_snorm
|
||||
? GL_RED : 0;
|
||||
case GL_RG8_SNORM:
|
||||
return ctx->Version >= 30
|
||||
|| (ctx->API == API_OPENGL_COMPAT && ctx->Extensions.EXT_texture_snorm)
|
||||
return (ctx->API == API_OPENGL_COMPAT && ctx->Extensions.EXT_texture_snorm)
|
||||
? GL_RG : 0;
|
||||
case GL_RG_SNORM:
|
||||
case GL_RG16_SNORM:
|
||||
return _mesa_is_desktop_gl(ctx) && ctx->Extensions.EXT_texture_snorm
|
||||
? GL_RG : 0;
|
||||
case GL_RGB8_SNORM:
|
||||
return ctx->Version >= 30
|
||||
|| (ctx->API == API_OPENGL_COMPAT && ctx->Extensions.EXT_texture_snorm)
|
||||
return (ctx->API == API_OPENGL_COMPAT && ctx->Extensions.EXT_texture_snorm)
|
||||
? GL_RGB : 0;
|
||||
case GL_RGB_SNORM:
|
||||
case GL_RGB16_SNORM:
|
||||
return _mesa_is_desktop_gl(ctx) && ctx->Extensions.EXT_texture_snorm
|
||||
? GL_RGB : 0;
|
||||
case GL_RGBA8_SNORM:
|
||||
return ctx->Version >= 30
|
||||
|| (ctx->API == API_OPENGL_COMPAT && ctx->Extensions.EXT_texture_snorm)
|
||||
return (ctx->API == API_OPENGL_COMPAT && ctx->Extensions.EXT_texture_snorm)
|
||||
? GL_RGBA : 0;
|
||||
case GL_RGBA_SNORM:
|
||||
case GL_RGBA16_SNORM:
|
||||
@@ -1227,25 +1274,21 @@ _mesa_base_fbo_format(struct gl_context *ctx, GLenum internalFormat)
|
||||
ctx->Extensions.ARB_framebuffer_object ? GL_INTENSITY : 0;
|
||||
case GL_R16F:
|
||||
case GL_R32F:
|
||||
return ctx->Version >= 30
|
||||
|| (ctx->API == API_OPENGL_COMPAT &&
|
||||
return (ctx->API == API_OPENGL_COMPAT &&
|
||||
ctx->Extensions.ARB_texture_rg &&
|
||||
ctx->Extensions.ARB_texture_float) ? GL_RED : 0;
|
||||
case GL_RG16F:
|
||||
case GL_RG32F:
|
||||
return ctx->Version >= 30
|
||||
|| (ctx->API == API_OPENGL_COMPAT &&
|
||||
return (ctx->API == API_OPENGL_COMPAT &&
|
||||
ctx->Extensions.ARB_texture_rg &&
|
||||
ctx->Extensions.ARB_texture_float) ? GL_RG : 0;
|
||||
case GL_RGB16F:
|
||||
case GL_RGB32F:
|
||||
return (_mesa_is_desktop_gl(ctx) && ctx->Extensions.ARB_texture_float)
|
||||
|| _mesa_is_gles3(ctx)
|
||||
? GL_RGB : 0;
|
||||
case GL_RGBA16F:
|
||||
case GL_RGBA32F:
|
||||
return (_mesa_is_desktop_gl(ctx) && ctx->Extensions.ARB_texture_float)
|
||||
|| _mesa_is_gles3(ctx)
|
||||
? GL_RGBA : 0;
|
||||
case GL_ALPHA16F_ARB:
|
||||
case GL_ALPHA32F_ARB:
|
||||
@@ -1270,10 +1313,10 @@ _mesa_base_fbo_format(struct gl_context *ctx, GLenum internalFormat)
|
||||
case GL_RGB9_E5:
|
||||
return (_mesa_is_desktop_gl(ctx)
|
||||
&& ctx->Extensions.EXT_texture_shared_exponent)
|
||||
|| _mesa_is_gles3(ctx) ? GL_RGB : 0;
|
||||
? GL_RGB : 0;
|
||||
case GL_R11F_G11F_B10F:
|
||||
return (_mesa_is_desktop_gl(ctx) && ctx->Extensions.EXT_packed_float)
|
||||
|| _mesa_is_gles3(ctx) ? GL_RGB : 0;
|
||||
? GL_RGB : 0;
|
||||
|
||||
case GL_RGBA8UI_EXT:
|
||||
case GL_RGBA16UI_EXT:
|
||||
@@ -1291,8 +1334,7 @@ _mesa_base_fbo_format(struct gl_context *ctx, GLenum internalFormat)
|
||||
case GL_RGB8I_EXT:
|
||||
case GL_RGB16I_EXT:
|
||||
case GL_RGB32I_EXT:
|
||||
return ctx->Version >= 30
|
||||
|| (_mesa_is_desktop_gl(ctx) &&
|
||||
return (_mesa_is_desktop_gl(ctx) &&
|
||||
ctx->Extensions.EXT_texture_integer) ? GL_RGB : 0;
|
||||
|
||||
case GL_R8UI:
|
||||
@@ -1312,8 +1354,7 @@ _mesa_base_fbo_format(struct gl_context *ctx, GLenum internalFormat)
|
||||
case GL_RG16I:
|
||||
case GL_RG32UI:
|
||||
case GL_RG32I:
|
||||
return ctx->Version >= 30
|
||||
|| (_mesa_is_desktop_gl(ctx) &&
|
||||
return (_mesa_is_desktop_gl(ctx) &&
|
||||
ctx->Extensions.ARB_texture_rg &&
|
||||
ctx->Extensions.EXT_texture_integer) ? GL_RG : 0;
|
||||
|
||||
|
@@ -2696,6 +2696,20 @@ unpack_int_rgba_ABGR2101010_UINT(const GLuint *src, GLuint dst[][4], GLuint n)
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
unpack_int_rgba_ARGB2101010(const GLuint *src, GLuint dst[][4], GLuint n)
|
||||
{
|
||||
unsigned int i;
|
||||
|
||||
for (i = 0; i < n; i++) {
|
||||
GLuint tmp = src[i];
|
||||
dst[i][0] = (tmp >> 20) & 0x3ff;
|
||||
dst[i][1] = (tmp >> 10) & 0x3ff;
|
||||
dst[i][2] = (tmp >> 0) & 0x3ff;
|
||||
dst[i][3] = (tmp >> 30) & 0x3;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
_mesa_unpack_uint_rgba_row(gl_format format, GLuint n,
|
||||
const void *src, GLuint dst[][4])
|
||||
@@ -2871,6 +2885,10 @@ _mesa_unpack_uint_rgba_row(gl_format format, GLuint n,
|
||||
unpack_int_rgba_ABGR2101010_UINT(src, dst, n);
|
||||
break;
|
||||
|
||||
case MESA_FORMAT_ARGB2101010:
|
||||
unpack_int_rgba_ARGB2101010(src, dst, n);
|
||||
break;
|
||||
|
||||
default:
|
||||
_mesa_problem(NULL, "%s: bad format %s", __FUNCTION__,
|
||||
_mesa_get_format_name(format));
|
||||
|
@@ -42,6 +42,7 @@
|
||||
#include "framebuffer.h"
|
||||
#include "renderbuffer.h"
|
||||
#include "texobj.h"
|
||||
#include "glformats.h"
|
||||
|
||||
|
||||
|
||||
@@ -898,6 +899,25 @@ _mesa_get_color_read_type(struct gl_context *ctx)
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the read renderbuffer for the specified format.
|
||||
*/
|
||||
struct gl_renderbuffer *
|
||||
_mesa_get_read_renderbuffer(struct gl_context *ctx, GLenum format)
|
||||
{
|
||||
struct gl_framebuffer *rfb = ctx->ReadBuffer;
|
||||
|
||||
if (_mesa_is_color_format(format)) {
|
||||
return rfb->Attachment[rfb->_ColorReadBufferIndex].Renderbuffer;
|
||||
} else if (_mesa_is_depth_format(format) ||
|
||||
_mesa_is_depthstencil_format(format)) {
|
||||
return rfb->Attachment[BUFFER_DEPTH].Renderbuffer;
|
||||
} else {
|
||||
return rfb->Attachment[BUFFER_STENCIL].Renderbuffer;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Print framebuffer info to stderr, for debugging.
|
||||
*/
|
||||
|
@@ -30,6 +30,7 @@
|
||||
|
||||
struct gl_config;
|
||||
struct gl_context;
|
||||
struct gl_renderbuffer;
|
||||
|
||||
extern struct gl_framebuffer *
|
||||
_mesa_create_framebuffer(const struct gl_config *visual);
|
||||
@@ -96,6 +97,9 @@ _mesa_get_color_read_type(struct gl_context *ctx);
|
||||
extern GLenum
|
||||
_mesa_get_color_read_format(struct gl_context *ctx);
|
||||
|
||||
extern struct gl_renderbuffer *
|
||||
_mesa_get_read_renderbuffer(struct gl_context *ctx, GLenum format);
|
||||
|
||||
extern void
|
||||
_mesa_print_framebuffer(const struct gl_framebuffer *fb);
|
||||
|
||||
|
@@ -131,6 +131,7 @@ enum value_extra {
|
||||
EXTRA_API_GL,
|
||||
EXTRA_API_GL_CORE,
|
||||
EXTRA_API_ES2,
|
||||
EXTRA_API_ES3,
|
||||
EXTRA_NEW_BUFFERS,
|
||||
EXTRA_NEW_FRAG_CLAMP,
|
||||
EXTRA_VALID_DRAW_BUFFER,
|
||||
@@ -290,14 +291,30 @@ static const int extra_texture_buffer_object[] = {
|
||||
EXTRA_END
|
||||
};
|
||||
|
||||
static const int extra_ARB_transform_feedback2_api_es3[] = {
|
||||
EXT(ARB_transform_feedback2),
|
||||
EXTRA_API_ES3,
|
||||
EXTRA_END
|
||||
};
|
||||
|
||||
static const int extra_ARB_uniform_buffer_object_and_geometry_shader[] = {
|
||||
EXT(ARB_uniform_buffer_object),
|
||||
EXT(ARB_geometry_shader4),
|
||||
EXTRA_END
|
||||
};
|
||||
|
||||
static const int extra_ARB_ES2_compatibility_api_es2[] = {
|
||||
EXT(ARB_ES2_compatibility),
|
||||
EXTRA_API_ES2,
|
||||
EXTRA_END
|
||||
};
|
||||
|
||||
static const int extra_ARB_ES3_compatibility_api_es3[] = {
|
||||
EXT(ARB_ES3_compatibility),
|
||||
EXTRA_API_ES3,
|
||||
EXTRA_END
|
||||
};
|
||||
|
||||
EXTRA_EXT(ARB_ES2_compatibility);
|
||||
EXTRA_EXT(ARB_texture_cube_map);
|
||||
EXTRA_EXT(MESA_texture_array);
|
||||
EXTRA_EXT2(EXT_secondary_color, ARB_vertex_program);
|
||||
@@ -322,7 +339,6 @@ EXTRA_EXT(ARB_seamless_cube_map);
|
||||
EXTRA_EXT(ARB_sync);
|
||||
EXTRA_EXT(ARB_vertex_shader);
|
||||
EXTRA_EXT(EXT_transform_feedback);
|
||||
EXTRA_EXT(ARB_transform_feedback2);
|
||||
EXTRA_EXT(ARB_transform_feedback3);
|
||||
EXTRA_EXT(EXT_pixel_buffer_object);
|
||||
EXTRA_EXT(ARB_vertex_program);
|
||||
@@ -348,6 +364,12 @@ static const int extra_version_30[] = { EXTRA_VERSION_30, EXTRA_END };
|
||||
static const int extra_version_31[] = { EXTRA_VERSION_31, EXTRA_END };
|
||||
static const int extra_version_32[] = { EXTRA_VERSION_32, EXTRA_END };
|
||||
|
||||
static const int extra_gl30_es3[] = {
|
||||
EXTRA_VERSION_30,
|
||||
EXTRA_API_ES3,
|
||||
EXTRA_END,
|
||||
};
|
||||
|
||||
static const int
|
||||
extra_ARB_vertex_program_api_es2[] = {
|
||||
EXT(ARB_vertex_program),
|
||||
@@ -874,6 +896,12 @@ check_extra(struct gl_context *ctx, const char *func, const struct value_desc *d
|
||||
enabled++;
|
||||
}
|
||||
break;
|
||||
case EXTRA_API_ES3:
|
||||
if (_mesa_is_gles3(ctx)) {
|
||||
total++;
|
||||
enabled++;
|
||||
}
|
||||
break;
|
||||
case EXTRA_API_GL:
|
||||
if (_mesa_is_desktop_gl(ctx)) {
|
||||
total++;
|
||||
@@ -973,6 +1001,15 @@ find_value(const char *func, GLenum pname, void **p, union value *v)
|
||||
int api;
|
||||
|
||||
api = ctx->API;
|
||||
/* We index into the table_set[] list of per-API hash tables using the API's
|
||||
* value in the gl_api enum. Since GLES 3 doesn't have an API_OPENGL* enum
|
||||
* 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);
|
||||
if (_mesa_is_gles3(ctx)) {
|
||||
api = API_OPENGL_LAST + 1;
|
||||
}
|
||||
mask = Elements(table(api)) - 1;
|
||||
hash = (pname * prime_factor);
|
||||
while (1) {
|
||||
@@ -1626,7 +1663,7 @@ _mesa_GetBooleani_v( GLenum pname, GLuint index, GLboolean *params )
|
||||
{
|
||||
union value v;
|
||||
enum value_type type =
|
||||
find_value_indexed("glGetBooleanIndexedv", pname, index, &v);
|
||||
find_value_indexed("glGetBooleani_v", pname, index, &v);
|
||||
|
||||
switch (type) {
|
||||
case TYPE_INT:
|
||||
@@ -1651,7 +1688,7 @@ _mesa_GetIntegeri_v( GLenum pname, GLuint index, GLint *params )
|
||||
{
|
||||
union value v;
|
||||
enum value_type type =
|
||||
find_value_indexed("glGetIntegerIndexedv", pname, index, &v);
|
||||
find_value_indexed("glGetIntegeri_v", pname, index, &v);
|
||||
|
||||
switch (type) {
|
||||
case TYPE_INT:
|
||||
@@ -1672,11 +1709,11 @@ _mesa_GetIntegeri_v( GLenum pname, GLuint index, GLint *params )
|
||||
}
|
||||
|
||||
void GLAPIENTRY
|
||||
_mesa_GetInteger64Indexedv( GLenum pname, GLuint index, GLint64 *params )
|
||||
_mesa_GetInteger64i_v( GLenum pname, GLuint index, GLint64 *params )
|
||||
{
|
||||
union value v;
|
||||
enum value_type type =
|
||||
find_value_indexed("glGetIntegerIndexedv", pname, index, &v);
|
||||
find_value_indexed("glGetInteger64i_v", pname, index, &v);
|
||||
|
||||
switch (type) {
|
||||
case TYPE_INT:
|
||||
|
@@ -60,7 +60,7 @@ extern void GLAPIENTRY
|
||||
_mesa_GetIntegeri_v( GLenum pname, GLuint index, GLint *params );
|
||||
|
||||
extern void GLAPIENTRY
|
||||
_mesa_GetInteger64Indexedv( GLenum pname, GLuint index, GLint64 *params );
|
||||
_mesa_GetInteger64i_v( GLenum pname, GLuint index, GLint64 *params );
|
||||
|
||||
extern void GLAPIENTRY
|
||||
_mesa_GetPointerv( GLenum pname, GLvoid **params );
|
||||
|
@@ -44,7 +44,7 @@ prime_factor = 89
|
||||
prime_step = 281
|
||||
hash_table_size = 1024
|
||||
|
||||
gl_apis=set(["GL", "GL_CORE", "GLES", "GLES2"])
|
||||
gl_apis=set(["GL", "GL_CORE", "GLES", "GLES2", "GLES3"])
|
||||
|
||||
def print_header():
|
||||
print "typedef const unsigned short table_t[%d];\n" % (hash_table_size)
|
||||
@@ -67,6 +67,7 @@ api_enum = [
|
||||
'GLES',
|
||||
'GLES2',
|
||||
'GL_CORE',
|
||||
'GLES3', # Not in gl_api enum in mtypes.h
|
||||
]
|
||||
|
||||
def api_index(api):
|
||||
@@ -166,6 +167,9 @@ def generate_hash_tables(enum_list, enabled_apis, param_descriptors):
|
||||
|
||||
for api in valid_apis:
|
||||
add_to_hash_table(tables[api], hash_val, len(params))
|
||||
# Also add GLES2 items to the GLES3 hash table
|
||||
if api == "GLES2":
|
||||
add_to_hash_table(tables["GLES3"], hash_val, len(params))
|
||||
|
||||
params.append(["GL_" + enum_name, param[1]])
|
||||
|
||||
@@ -183,6 +187,8 @@ def opt_to_apis(feature):
|
||||
apis = set([_map[feature]])
|
||||
if "GL" in apis:
|
||||
apis.add("GL_CORE")
|
||||
if "GLES2" in apis:
|
||||
apis.add("GLES3")
|
||||
|
||||
return apis
|
||||
|
||||
|
@@ -204,12 +204,6 @@ descriptor=[
|
||||
[ "TEXTURE_COORD_ARRAY_TYPE", "LOC_CUSTOM, TYPE_ENUM, offsetof(struct gl_client_array, Type), NO_EXTRA" ],
|
||||
[ "TEXTURE_COORD_ARRAY_STRIDE", "LOC_CUSTOM, TYPE_INT, offsetof(struct gl_client_array, Stride), NO_EXTRA" ],
|
||||
|
||||
# GL_ARB_ES2_compatibility
|
||||
[ "SHADER_COMPILER", "CONST(1), extra_ARB_ES2_compatibility" ],
|
||||
[ "MAX_VARYING_VECTORS", "CONTEXT_INT(Const.MaxVarying), extra_ARB_ES2_compatibility" ],
|
||||
[ "MAX_VERTEX_UNIFORM_VECTORS", "LOC_CUSTOM, TYPE_INT, 0, extra_ARB_ES2_compatibility" ],
|
||||
[ "MAX_FRAGMENT_UNIFORM_VECTORS", "LOC_CUSTOM, TYPE_INT, 0, extra_ARB_ES2_compatibility" ],
|
||||
|
||||
# GL_ARB_multitexture
|
||||
[ "MAX_TEXTURE_UNITS", "CONTEXT_INT(Const.MaxTextureUnits), NO_EXTRA" ],
|
||||
[ "CLIENT_ACTIVE_TEXTURE", "LOC_CUSTOM, TYPE_INT, 0, NO_EXTRA" ],
|
||||
@@ -232,15 +226,8 @@ descriptor=[
|
||||
# GL_OES_point_sprite
|
||||
[ "POINT_SPRITE_NV", "CONTEXT_BOOL(Point.PointSprite), extra_NV_point_sprite_ARB_point_sprite" ],
|
||||
|
||||
# GL_ARB_fragment_shader
|
||||
[ "MAX_FRAGMENT_UNIFORM_COMPONENTS_ARB", "CONTEXT_INT(Const.FragmentProgram.MaxUniformComponents), extra_ARB_fragment_shader" ],
|
||||
|
||||
# GL_ARB_vertex_shader
|
||||
[ "MAX_VERTEX_UNIFORM_COMPONENTS_ARB", "CONTEXT_INT(Const.VertexProgram.MaxUniformComponents), extra_ARB_vertex_shader" ],
|
||||
[ "MAX_VARYING_FLOATS_ARB", "LOC_CUSTOM, TYPE_INT, 0, extra_ARB_vertex_shader" ],
|
||||
|
||||
# GL_EXT_texture_lod_bias
|
||||
[ "MAX_TEXTURE_LOD_BIAS_EXT", "CONTEXT_FLOAT(Const.MaxTextureLodBias), NO_EXTRA" ],
|
||||
]},
|
||||
|
||||
|
||||
@@ -317,6 +304,73 @@ descriptor=[
|
||||
|
||||
# GL_NV_read_buffer
|
||||
[ "READ_BUFFER", "LOC_CUSTOM, TYPE_ENUM, NO_OFFSET, extra_NV_read_buffer_api_gl" ],
|
||||
|
||||
# GL_ARB_ES2_compatibility
|
||||
[ "SHADER_COMPILER", "CONST(1), extra_ARB_ES2_compatibility_api_es2" ],
|
||||
[ "MAX_VARYING_VECTORS", "CONTEXT_INT(Const.MaxVarying), extra_ARB_ES2_compatibility_api_es2" ],
|
||||
[ "MAX_VERTEX_UNIFORM_VECTORS", "LOC_CUSTOM, TYPE_INT, 0, extra_ARB_ES2_compatibility_api_es2" ],
|
||||
[ "MAX_FRAGMENT_UNIFORM_VECTORS", "LOC_CUSTOM, TYPE_INT, 0, extra_ARB_ES2_compatibility_api_es2" ],
|
||||
]},
|
||||
|
||||
# GLES3 is not a typo.
|
||||
{ "apis": ["GL", "GLES", "GLES3", "GL_CORE"], "params": [
|
||||
# GL_EXT_texture_lod_bias
|
||||
[ "MAX_TEXTURE_LOD_BIAS_EXT", "CONTEXT_FLOAT(Const.MaxTextureLodBias), NO_EXTRA" ],
|
||||
]},
|
||||
|
||||
|
||||
# Enums in OpenGL and ES 3.0
|
||||
{ "apis": ["GL", "GL_CORE", "GLES3"], "params": [
|
||||
# GL 3.0 / GLES3
|
||||
[ "NUM_EXTENSIONS", "LOC_CUSTOM, TYPE_INT, 0, extra_gl30_es3" ],
|
||||
[ "MAJOR_VERSION", "LOC_CUSTOM, TYPE_INT, 0, extra_gl30_es3" ],
|
||||
[ "MINOR_VERSION", "LOC_CUSTOM, TYPE_INT, 0, extra_gl30_es3" ],
|
||||
|
||||
# GL_ARB_ES3_compatibility
|
||||
[ "MAX_ELEMENT_INDEX", "CONTEXT_INT64(Const.MaxElementIndex), extra_ARB_ES3_compatibility_api_es3"],
|
||||
|
||||
# GL_ARB_fragment_shader
|
||||
[ "MAX_FRAGMENT_UNIFORM_COMPONENTS_ARB", "CONTEXT_INT(Const.FragmentProgram.MaxUniformComponents), extra_ARB_fragment_shader" ],
|
||||
|
||||
# GL_ARB_framebuffer_object
|
||||
[ "MAX_SAMPLES", "CONTEXT_INT(Const.MaxSamples), extra_ARB_framebuffer_object_EXT_framebuffer_multisample" ],
|
||||
|
||||
# GL_ARB_sync
|
||||
[ "MAX_SERVER_WAIT_TIMEOUT", "CONTEXT_INT64(Const.MaxServerWaitTimeout), extra_ARB_sync" ],
|
||||
|
||||
# GL_ARB_transform_feedback2
|
||||
[ "TRANSFORM_FEEDBACK_BUFFER_PAUSED", "LOC_CUSTOM, TYPE_BOOLEAN, 0, extra_ARB_transform_feedback2_api_es3" ],
|
||||
[ "TRANSFORM_FEEDBACK_BUFFER_ACTIVE", "LOC_CUSTOM, TYPE_BOOLEAN, 0, extra_ARB_transform_feedback2_api_es3" ],
|
||||
[ "TRANSFORM_FEEDBACK_BINDING", "LOC_CUSTOM, TYPE_INT, 0, extra_ARB_transform_feedback2_api_es3" ],
|
||||
|
||||
# GL_ARB_uniform_buffer_object
|
||||
[ "MAX_VERTEX_UNIFORM_BLOCKS", "CONTEXT_INT(Const.VertexProgram.MaxUniformBlocks), extra_ARB_uniform_buffer_object" ],
|
||||
[ "MAX_FRAGMENT_UNIFORM_BLOCKS", "CONTEXT_INT(Const.FragmentProgram.MaxUniformBlocks), extra_ARB_uniform_buffer_object" ],
|
||||
[ "MAX_COMBINED_UNIFORM_BLOCKS", "CONTEXT_INT(Const.MaxCombinedUniformBlocks), extra_ARB_uniform_buffer_object" ],
|
||||
[ "MAX_UNIFORM_BLOCK_SIZE", "CONTEXT_INT(Const.MaxUniformBlockSize), extra_ARB_uniform_buffer_object" ],
|
||||
[ "MAX_UNIFORM_BUFFER_BINDINGS", "CONTEXT_INT(Const.MaxUniformBufferBindings), extra_ARB_uniform_buffer_object" ],
|
||||
[ "MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS", "CONTEXT_INT(Const.VertexProgram.MaxCombinedUniformComponents), extra_ARB_uniform_buffer_object" ],
|
||||
[ "MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS", "CONTEXT_INT(Const.FragmentProgram.MaxCombinedUniformComponents), extra_ARB_uniform_buffer_object" ],
|
||||
[ "UNIFORM_BUFFER_OFFSET_ALIGNMENT", "CONTEXT_INT(Const.UniformBufferOffsetAlignment), extra_ARB_uniform_buffer_object" ],
|
||||
[ "UNIFORM_BUFFER_BINDING", "LOC_CUSTOM, TYPE_INT, 0, extra_ARB_uniform_buffer_object" ],
|
||||
|
||||
# GL_ARB_vertex_shader
|
||||
[ "MAX_VERTEX_UNIFORM_COMPONENTS_ARB", "CONTEXT_INT(Const.VertexProgram.MaxUniformComponents), extra_ARB_vertex_shader" ],
|
||||
|
||||
# GL_EXT_framebuffer_blit
|
||||
# NOTE: GL_DRAW_FRAMEBUFFER_BINDING_EXT == GL_FRAMEBUFFER_BINDING_EXT
|
||||
[ "READ_FRAMEBUFFER_BINDING_EXT", "LOC_CUSTOM, TYPE_INT, 0, extra_EXT_framebuffer_blit" ],
|
||||
|
||||
# GL_EXT_pixel_buffer_object
|
||||
[ "PIXEL_PACK_BUFFER_BINDING_EXT", "LOC_CUSTOM, TYPE_INT, 0, extra_EXT_pixel_buffer_object" ],
|
||||
[ "PIXEL_UNPACK_BUFFER_BINDING_EXT", "LOC_CUSTOM, TYPE_INT, 0, extra_EXT_pixel_buffer_object" ],
|
||||
|
||||
# GL_EXT_transform_feedback
|
||||
[ "TRANSFORM_FEEDBACK_BUFFER_BINDING", "LOC_CUSTOM, TYPE_INT, 0, extra_EXT_transform_feedback" ],
|
||||
[ "RASTERIZER_DISCARD", "CONTEXT_BOOL(RasterDiscard), extra_EXT_transform_feedback" ],
|
||||
[ "MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS", "CONTEXT_INT(Const.MaxTransformFeedbackInterleavedComponents), extra_EXT_transform_feedback" ],
|
||||
[ "MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS", "CONTEXT_INT(Const.MaxTransformFeedbackBuffers), extra_EXT_transform_feedback" ],
|
||||
[ "MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS", "CONTEXT_INT(Const.MaxTransformFeedbackSeparateComponents), extra_EXT_transform_feedback" ],
|
||||
]},
|
||||
|
||||
{ "apis": ["GLES", "GLES2"], "params": [
|
||||
@@ -327,10 +381,6 @@ descriptor=[
|
||||
|
||||
# Enums unique to OpenGL ES 2.0
|
||||
{ "apis": ["GLES2"], "params": [
|
||||
[ "MAX_FRAGMENT_UNIFORM_VECTORS", "LOC_CUSTOM, TYPE_INT, 0, NO_EXTRA" ],
|
||||
[ "MAX_VARYING_VECTORS", "CONTEXT_INT(Const.MaxVarying), NO_EXTRA" ],
|
||||
[ "MAX_VERTEX_UNIFORM_VECTORS", "LOC_CUSTOM, TYPE_INT, 0, NO_EXTRA" ],
|
||||
[ "SHADER_COMPILER", "CONST(1), NO_EXTRA" ],
|
||||
# OES_get_program_binary
|
||||
[ "NUM_SHADER_BINARY_FORMATS", "CONST(0), NO_EXTRA" ],
|
||||
[ "SHADER_BINARY_FORMATS", "CONST(0), NO_EXTRA" ],
|
||||
@@ -536,10 +586,6 @@ descriptor=[
|
||||
[ "SECONDARY_COLOR_ARRAY_BUFFER_BINDING_ARB", "LOC_CUSTOM, TYPE_INT, offsetof(struct gl_array_object, VertexAttrib[VERT_ATTRIB_COLOR1].BufferObj), NO_EXTRA" ],
|
||||
[ "FOG_COORDINATE_ARRAY_BUFFER_BINDING_ARB", "LOC_CUSTOM, TYPE_INT, offsetof(struct gl_array_object, VertexAttrib[VERT_ATTRIB_FOG].BufferObj), NO_EXTRA" ],
|
||||
|
||||
# GL_EXT_pixel_buffer_object
|
||||
[ "PIXEL_PACK_BUFFER_BINDING_EXT", "LOC_CUSTOM, TYPE_INT, 0, extra_EXT_pixel_buffer_object" ],
|
||||
[ "PIXEL_UNPACK_BUFFER_BINDING_EXT", "LOC_CUSTOM, TYPE_INT, 0, extra_EXT_pixel_buffer_object" ],
|
||||
|
||||
# GL_ARB_vertex_program
|
||||
# == GL_VERTEX_PROGRAM_NV
|
||||
[ "VERTEX_PROGRAM_ARB", "CONTEXT_BOOL(VertexProgram.Enabled), extra_ARB_vertex_program" ],
|
||||
@@ -580,38 +626,16 @@ descriptor=[
|
||||
[ "NUM_LOOPBACK_COMPONENTS_ATI", "CONST(3), extra_ATI_fragment_shader" ],
|
||||
[ "NUM_INPUT_INTERPOLATOR_COMPONENTS_ATI", "CONST(3), extra_ATI_fragment_shader" ],
|
||||
|
||||
# GL_EXT_framebuffer_blit
|
||||
# NOTE: GL_DRAW_FRAMEBUFFER_BINDING_EXT == GL_FRAMEBUFFER_BINDING_EXT
|
||||
[ "READ_FRAMEBUFFER_BINDING_EXT", "LOC_CUSTOM, TYPE_INT, 0, extra_EXT_framebuffer_blit" ],
|
||||
|
||||
# GL_EXT_provoking_vertex
|
||||
[ "PROVOKING_VERTEX_EXT", "CONTEXT_ENUM(Light.ProvokingVertex), extra_EXT_provoking_vertex" ],
|
||||
[ "QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION_EXT", "CONTEXT_BOOL(Const.QuadsFollowProvokingVertexConvention), extra_EXT_provoking_vertex" ],
|
||||
|
||||
# GL_ARB_framebuffer_object
|
||||
[ "MAX_SAMPLES", "CONTEXT_INT(Const.MaxSamples), extra_ARB_framebuffer_object_EXT_framebuffer_multisample" ],
|
||||
|
||||
# GL_ARB_seamless_cube_map
|
||||
[ "TEXTURE_CUBE_MAP_SEAMLESS", "CONTEXT_BOOL(Texture.CubeMapSeamless), extra_ARB_seamless_cube_map" ],
|
||||
|
||||
# GL_ARB_sync
|
||||
[ "MAX_SERVER_WAIT_TIMEOUT", "CONTEXT_INT64(Const.MaxServerWaitTimeout), extra_ARB_sync" ],
|
||||
|
||||
# GL_EXT_texture_integer
|
||||
[ "RGBA_INTEGER_MODE_EXT", "BUFFER_BOOL(_IntegerColor), extra_EXT_texture_integer" ],
|
||||
|
||||
# GL_EXT_transform_feedback
|
||||
[ "TRANSFORM_FEEDBACK_BUFFER_BINDING", "LOC_CUSTOM, TYPE_INT, 0, extra_EXT_transform_feedback" ],
|
||||
[ "RASTERIZER_DISCARD", "CONTEXT_BOOL(RasterDiscard), extra_EXT_transform_feedback" ],
|
||||
[ "MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS", "CONTEXT_INT(Const.MaxTransformFeedbackInterleavedComponents), extra_EXT_transform_feedback" ],
|
||||
[ "MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS", "CONTEXT_INT(Const.MaxTransformFeedbackBuffers), extra_EXT_transform_feedback" ],
|
||||
[ "MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS", "CONTEXT_INT(Const.MaxTransformFeedbackSeparateComponents), extra_EXT_transform_feedback" ],
|
||||
|
||||
# GL_ARB_transform_feedback2
|
||||
[ "TRANSFORM_FEEDBACK_BUFFER_PAUSED", "LOC_CUSTOM, TYPE_BOOLEAN, 0, extra_ARB_transform_feedback2" ],
|
||||
[ "TRANSFORM_FEEDBACK_BUFFER_ACTIVE", "LOC_CUSTOM, TYPE_BOOLEAN, 0, extra_ARB_transform_feedback2" ],
|
||||
[ "TRANSFORM_FEEDBACK_BINDING", "LOC_CUSTOM, TYPE_INT, 0, extra_ARB_transform_feedback2" ],
|
||||
|
||||
# GL_ARB_transform_feedback3
|
||||
[ "MAX_TRANSFORM_FEEDBACK_BUFFERS", "CONTEXT_INT(Const.MaxTransformFeedbackBuffers), extra_ARB_transform_feedback3" ],
|
||||
[ "MAX_VERTEX_STREAMS", "CONTEXT_INT(Const.MaxVertexStreams), extra_ARB_transform_feedback3" ],
|
||||
@@ -642,9 +666,6 @@ descriptor=[
|
||||
[ "SAMPLER_BINDING", "LOC_CUSTOM, TYPE_INT, GL_SAMPLER_BINDING, NO_EXTRA" ],
|
||||
|
||||
# GL 3.0
|
||||
[ "NUM_EXTENSIONS", "LOC_CUSTOM, TYPE_INT, 0, extra_version_30" ],
|
||||
[ "MAJOR_VERSION", "LOC_CUSTOM, TYPE_INT, 0, extra_version_30" ],
|
||||
[ "MINOR_VERSION", "LOC_CUSTOM, TYPE_INT, 0, extra_version_30" ],
|
||||
[ "CONTEXT_FLAGS", "CONTEXT_INT(Const.ContextFlags), extra_version_30" ],
|
||||
|
||||
# GL3.0 / GL_EXT_framebuffer_sRGB
|
||||
@@ -671,17 +692,8 @@ descriptor=[
|
||||
[ "MAX_DUAL_SOURCE_DRAW_BUFFERS", "CONTEXT_INT(Const.MaxDualSourceDrawBuffers), extra_ARB_blend_func_extended" ],
|
||||
|
||||
# GL_ARB_uniform_buffer_object
|
||||
[ "MAX_VERTEX_UNIFORM_BLOCKS", "CONTEXT_INT(Const.VertexProgram.MaxUniformBlocks), extra_ARB_uniform_buffer_object" ],
|
||||
[ "MAX_FRAGMENT_UNIFORM_BLOCKS", "CONTEXT_INT(Const.FragmentProgram.MaxUniformBlocks), extra_ARB_uniform_buffer_object" ],
|
||||
[ "MAX_GEOMETRY_UNIFORM_BLOCKS", "CONTEXT_INT(Const.GeometryProgram.MaxUniformBlocks), extra_ARB_uniform_buffer_object_and_geometry_shader" ],
|
||||
[ "MAX_COMBINED_UNIFORM_BLOCKS", "CONTEXT_INT(Const.MaxCombinedUniformBlocks), extra_ARB_uniform_buffer_object" ],
|
||||
[ "MAX_UNIFORM_BLOCK_SIZE", "CONTEXT_INT(Const.MaxUniformBlockSize), extra_ARB_uniform_buffer_object" ],
|
||||
[ "MAX_UNIFORM_BUFFER_BINDINGS", "CONTEXT_INT(Const.MaxUniformBufferBindings), extra_ARB_uniform_buffer_object" ],
|
||||
[ "MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS", "CONTEXT_INT(Const.VertexProgram.MaxCombinedUniformComponents), extra_ARB_uniform_buffer_object" ],
|
||||
[ "MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS", "CONTEXT_INT(Const.FragmentProgram.MaxCombinedUniformComponents), extra_ARB_uniform_buffer_object" ],
|
||||
[ "MAX_COMBINED_GEOMETRY_UNIFORM_COMPONENTS", "CONTEXT_INT(Const.GeometryProgram.MaxCombinedUniformComponents), extra_ARB_uniform_buffer_object_and_geometry_shader" ],
|
||||
[ "UNIFORM_BUFFER_OFFSET_ALIGNMENT", "CONTEXT_INT(Const.UniformBufferOffsetAlignment), extra_ARB_uniform_buffer_object" ],
|
||||
[ "UNIFORM_BUFFER_BINDING", "LOC_CUSTOM, TYPE_INT, 0, extra_ARB_uniform_buffer_object" ],
|
||||
|
||||
# GL_ARB_timer_query
|
||||
[ "TIMESTAMP", "LOC_CUSTOM, TYPE_INT64, 0, extra_ARB_timer_query" ],
|
||||
|
@@ -74,7 +74,9 @@ shading_language_version(struct gl_context *ctx)
|
||||
break;
|
||||
|
||||
case API_OPENGLES2:
|
||||
return (const GLubyte *) "OpenGL ES GLSL ES 1.0.16";
|
||||
return (ctx->Version < 30)
|
||||
? (const GLubyte *) "OpenGL ES GLSL ES 1.0.16"
|
||||
: (const GLubyte *) "OpenGL ES GLSL ES 3.0";
|
||||
|
||||
case API_OPENGLES:
|
||||
/* fall-through */
|
||||
|
@@ -271,7 +271,8 @@ _mesa_bytes_per_pixel(GLenum format, GLenum type)
|
||||
case GL_UNSIGNED_INT_10_10_10_2:
|
||||
case GL_UNSIGNED_INT_2_10_10_10_REV:
|
||||
if (format == GL_RGBA || format == GL_BGRA || format == GL_ABGR_EXT ||
|
||||
format == GL_RGBA_INTEGER_EXT || format == GL_BGRA_INTEGER_EXT)
|
||||
format == GL_RGBA_INTEGER_EXT || format == GL_BGRA_INTEGER_EXT ||
|
||||
format == GL_RGB)
|
||||
return sizeof(GLuint);
|
||||
else
|
||||
return -1;
|
||||
@@ -353,21 +354,9 @@ _mesa_bytes_per_vertex_attrib(GLint comps, GLenum type)
|
||||
* Test if the given format is an integer (non-normalized) format.
|
||||
*/
|
||||
GLboolean
|
||||
_mesa_is_enum_format_integer(GLenum format)
|
||||
_mesa_is_enum_format_unsigned_int(GLenum format)
|
||||
{
|
||||
switch (format) {
|
||||
/* generic integer formats */
|
||||
case GL_RED_INTEGER_EXT:
|
||||
case GL_GREEN_INTEGER_EXT:
|
||||
case GL_BLUE_INTEGER_EXT:
|
||||
case GL_ALPHA_INTEGER_EXT:
|
||||
case GL_RGB_INTEGER_EXT:
|
||||
case GL_RGBA_INTEGER_EXT:
|
||||
case GL_BGR_INTEGER_EXT:
|
||||
case GL_BGRA_INTEGER_EXT:
|
||||
case GL_LUMINANCE_INTEGER_EXT:
|
||||
case GL_LUMINANCE_ALPHA_INTEGER_EXT:
|
||||
case GL_RG_INTEGER:
|
||||
/* specific integer formats */
|
||||
case GL_RGBA32UI_EXT:
|
||||
case GL_RGB32UI_EXT:
|
||||
@@ -393,6 +382,34 @@ _mesa_is_enum_format_integer(GLenum format)
|
||||
case GL_INTENSITY8UI_EXT:
|
||||
case GL_LUMINANCE8UI_EXT:
|
||||
case GL_LUMINANCE_ALPHA8UI_EXT:
|
||||
case GL_RGB10_A2UI:
|
||||
return GL_TRUE;
|
||||
default:
|
||||
return GL_FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Test if the given format is an integer (non-normalized) format.
|
||||
*/
|
||||
GLboolean
|
||||
_mesa_is_enum_format_signed_int(GLenum format)
|
||||
{
|
||||
switch (format) {
|
||||
/* generic integer formats */
|
||||
case GL_RED_INTEGER_EXT:
|
||||
case GL_GREEN_INTEGER_EXT:
|
||||
case GL_BLUE_INTEGER_EXT:
|
||||
case GL_ALPHA_INTEGER_EXT:
|
||||
case GL_RGB_INTEGER_EXT:
|
||||
case GL_RGBA_INTEGER_EXT:
|
||||
case GL_BGR_INTEGER_EXT:
|
||||
case GL_BGRA_INTEGER_EXT:
|
||||
case GL_LUMINANCE_INTEGER_EXT:
|
||||
case GL_LUMINANCE_ALPHA_INTEGER_EXT:
|
||||
case GL_RG_INTEGER:
|
||||
/* specific integer formats */
|
||||
case GL_RGBA32I_EXT:
|
||||
case GL_RGB32I_EXT:
|
||||
case GL_RG32I:
|
||||
@@ -417,7 +434,6 @@ _mesa_is_enum_format_integer(GLenum format)
|
||||
case GL_INTENSITY8I_EXT:
|
||||
case GL_LUMINANCE8I_EXT:
|
||||
case GL_LUMINANCE_ALPHA8I_EXT:
|
||||
case GL_RGB10_A2UI:
|
||||
return GL_TRUE;
|
||||
default:
|
||||
return GL_FALSE;
|
||||
@@ -425,6 +441,17 @@ _mesa_is_enum_format_integer(GLenum format)
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Test if the given format is an integer (non-normalized) format.
|
||||
*/
|
||||
GLboolean
|
||||
_mesa_is_enum_format_integer(GLenum format)
|
||||
{
|
||||
return _mesa_is_enum_format_unsigned_int(format) ||
|
||||
_mesa_is_enum_format_signed_int(format);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Test if the given type is an integer (non-normalized) format.
|
||||
*/
|
||||
@@ -1031,6 +1058,32 @@ _mesa_base_format_has_channel(GLenum base_format, GLenum pname)
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the number of channels/components for a base format.
|
||||
*/
|
||||
GLint
|
||||
_mesa_base_format_component_count(GLenum base_format)
|
||||
{
|
||||
switch (base_format) {
|
||||
case GL_RED:
|
||||
case GL_ALPHA:
|
||||
case GL_INTENSITY:
|
||||
case GL_DEPTH_COMPONENT:
|
||||
return 1;
|
||||
case GL_RG:
|
||||
case GL_LUMINANCE_ALPHA:
|
||||
case GL_DEPTH_STENCIL:
|
||||
return 2;
|
||||
case GL_RGB:
|
||||
return 3;
|
||||
case GL_RGBA:
|
||||
return 4;
|
||||
default:
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* If format is a generic compressed format, return the corresponding
|
||||
* non-compressed format. For other formats, return the format as-is.
|
||||
@@ -1236,6 +1289,10 @@ _mesa_error_check_format_and_type(const struct gl_context *ctx,
|
||||
ctx->Extensions.ARB_texture_rgb10_a2ui) {
|
||||
break; /* OK */
|
||||
}
|
||||
if (type == GL_UNSIGNED_INT_2_10_10_10_REV && format == GL_RGB &&
|
||||
ctx->API == API_OPENGLES2) {
|
||||
break; /* OK by GL_EXT_texture_type_2_10_10_10_REV */
|
||||
}
|
||||
return GL_INVALID_OPERATION;
|
||||
|
||||
case GL_UNSIGNED_INT_24_8:
|
||||
@@ -1349,6 +1406,11 @@ _mesa_error_check_format_and_type(const struct gl_context *ctx,
|
||||
case GL_UNSIGNED_SHORT_5_6_5:
|
||||
case GL_UNSIGNED_SHORT_5_6_5_REV:
|
||||
return GL_NO_ERROR;
|
||||
case GL_UNSIGNED_INT_2_10_10_10_REV:
|
||||
/* OK by GL_EXT_texture_type_2_10_10_10_REV */
|
||||
if (ctx->API == API_OPENGLES2) {
|
||||
return GL_NO_ERROR;
|
||||
}
|
||||
case GL_HALF_FLOAT:
|
||||
return ctx->Extensions.ARB_half_float_pixel
|
||||
? GL_NO_ERROR : GL_INVALID_ENUM;
|
||||
@@ -1425,8 +1487,18 @@ _mesa_error_check_format_and_type(const struct gl_context *ctx,
|
||||
else if (ctx->Extensions.ARB_depth_buffer_float &&
|
||||
type == GL_FLOAT_32_UNSIGNED_INT_24_8_REV)
|
||||
return GL_NO_ERROR;
|
||||
else
|
||||
switch (type) {
|
||||
case GL_BYTE:
|
||||
case GL_UNSIGNED_BYTE:
|
||||
case GL_SHORT:
|
||||
case GL_UNSIGNED_SHORT:
|
||||
case GL_INT:
|
||||
case GL_UNSIGNED_INT:
|
||||
case GL_FLOAT:
|
||||
return GL_INVALID_OPERATION;
|
||||
default:
|
||||
return GL_INVALID_ENUM;
|
||||
}
|
||||
|
||||
case GL_DUDV_ATI:
|
||||
case GL_DU8DV8_ATI:
|
||||
@@ -1617,3 +1689,442 @@ _mesa_es_error_check_format_and_type(GLenum format, GLenum type,
|
||||
|
||||
return type_valid ? GL_NO_ERROR : GL_INVALID_OPERATION;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Do error checking of format/type combinations for OpenGL ES 3
|
||||
* glTex[Sub]Image.
|
||||
* \return error code, or GL_NO_ERROR.
|
||||
*/
|
||||
GLenum
|
||||
_mesa_es3_error_check_format_and_type(GLenum format, GLenum type,
|
||||
GLenum internalFormat,
|
||||
unsigned dimensions)
|
||||
{
|
||||
GLboolean type_valid = GL_TRUE;
|
||||
|
||||
switch (format) {
|
||||
case GL_RGBA:
|
||||
switch (type) {
|
||||
case GL_UNSIGNED_BYTE:
|
||||
switch (internalFormat) {
|
||||
case GL_RGBA:
|
||||
case GL_RGBA8:
|
||||
case GL_RGB5_A1:
|
||||
case GL_RGBA4:
|
||||
case GL_SRGB8_ALPHA8_EXT:
|
||||
break;
|
||||
default:
|
||||
return GL_INVALID_OPERATION;
|
||||
}
|
||||
break;
|
||||
|
||||
case GL_BYTE:
|
||||
if (internalFormat != GL_RGBA8_SNORM)
|
||||
return GL_INVALID_OPERATION;
|
||||
break;
|
||||
|
||||
case GL_UNSIGNED_SHORT_4_4_4_4:
|
||||
switch (internalFormat) {
|
||||
case GL_RGBA:
|
||||
case GL_RGBA4:
|
||||
break;
|
||||
default:
|
||||
return GL_INVALID_OPERATION;
|
||||
}
|
||||
break;
|
||||
|
||||
case GL_UNSIGNED_SHORT_5_5_5_1:
|
||||
switch (internalFormat) {
|
||||
case GL_RGBA:
|
||||
case GL_RGB5_A1:
|
||||
break;
|
||||
default:
|
||||
return GL_INVALID_OPERATION;
|
||||
}
|
||||
break;
|
||||
|
||||
case GL_UNSIGNED_INT_2_10_10_10_REV:
|
||||
switch (internalFormat) {
|
||||
case GL_RGBA: /* XXX: Spec does *not* say this, but the test expects it */
|
||||
case GL_RGB10_A2:
|
||||
case GL_RGB5_A1:
|
||||
break;
|
||||
default:
|
||||
return GL_INVALID_OPERATION;
|
||||
}
|
||||
break;
|
||||
|
||||
case GL_HALF_FLOAT:
|
||||
if (internalFormat != GL_RGBA16F)
|
||||
return GL_INVALID_OPERATION;
|
||||
break;
|
||||
|
||||
case GL_FLOAT:
|
||||
switch (internalFormat) {
|
||||
case GL_RGBA16F:
|
||||
case GL_RGBA32F:
|
||||
break;
|
||||
default:
|
||||
return GL_INVALID_OPERATION;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
return GL_INVALID_OPERATION;
|
||||
}
|
||||
break;
|
||||
|
||||
case GL_RGBA_INTEGER:
|
||||
switch (type) {
|
||||
case GL_UNSIGNED_BYTE:
|
||||
if (internalFormat != GL_RGBA8UI)
|
||||
return GL_INVALID_OPERATION;
|
||||
break;
|
||||
|
||||
case GL_BYTE:
|
||||
if (internalFormat != GL_RGBA8I)
|
||||
return GL_INVALID_OPERATION;
|
||||
break;
|
||||
|
||||
case GL_UNSIGNED_SHORT:
|
||||
if (internalFormat != GL_RGBA16UI)
|
||||
return GL_INVALID_OPERATION;
|
||||
break;
|
||||
|
||||
case GL_SHORT:
|
||||
if (internalFormat != GL_RGBA16I)
|
||||
return GL_INVALID_OPERATION;
|
||||
break;
|
||||
|
||||
case GL_UNSIGNED_INT:
|
||||
if (internalFormat != GL_RGBA32UI)
|
||||
return GL_INVALID_OPERATION;
|
||||
break;
|
||||
|
||||
case GL_INT:
|
||||
if (internalFormat != GL_RGBA32I)
|
||||
return GL_INVALID_OPERATION;
|
||||
break;
|
||||
|
||||
case GL_UNSIGNED_INT_2_10_10_10_REV:
|
||||
if (internalFormat != GL_RGB10_A2UI)
|
||||
return GL_INVALID_OPERATION;
|
||||
break;
|
||||
|
||||
default:
|
||||
return GL_INVALID_OPERATION;
|
||||
}
|
||||
break;
|
||||
|
||||
case GL_RGB:
|
||||
switch (type) {
|
||||
case GL_UNSIGNED_BYTE:
|
||||
switch (internalFormat) {
|
||||
case GL_RGB:
|
||||
case GL_RGB8:
|
||||
case GL_RGB565:
|
||||
case GL_SRGB8:
|
||||
break;
|
||||
default:
|
||||
return GL_INVALID_OPERATION;
|
||||
}
|
||||
break;
|
||||
|
||||
case GL_BYTE:
|
||||
if (internalFormat != GL_RGB8_SNORM)
|
||||
return GL_INVALID_OPERATION;
|
||||
break;
|
||||
|
||||
case GL_UNSIGNED_SHORT_5_6_5:
|
||||
switch (internalFormat) {
|
||||
case GL_RGB:
|
||||
case GL_RGB565:
|
||||
break;
|
||||
default:
|
||||
return GL_INVALID_OPERATION;
|
||||
}
|
||||
break;
|
||||
|
||||
case GL_UNSIGNED_INT_10F_11F_11F_REV:
|
||||
if (internalFormat != GL_R11F_G11F_B10F)
|
||||
return GL_INVALID_OPERATION;
|
||||
break;
|
||||
|
||||
case GL_UNSIGNED_INT_5_9_9_9_REV:
|
||||
if (internalFormat != GL_RGB9_E5)
|
||||
return GL_INVALID_OPERATION;
|
||||
break;
|
||||
|
||||
case GL_HALF_FLOAT:
|
||||
switch (internalFormat) {
|
||||
case GL_RGB16F:
|
||||
case GL_R11F_G11F_B10F:
|
||||
case GL_RGB9_E5:
|
||||
break;
|
||||
default:
|
||||
return GL_INVALID_OPERATION;
|
||||
}
|
||||
break;
|
||||
|
||||
case GL_FLOAT:
|
||||
switch (internalFormat) {
|
||||
case GL_RGB16F:
|
||||
case GL_RGB32F:
|
||||
case GL_R11F_G11F_B10F:
|
||||
case GL_RGB9_E5:
|
||||
break;
|
||||
default:
|
||||
return GL_INVALID_OPERATION;
|
||||
}
|
||||
break;
|
||||
|
||||
case GL_UNSIGNED_INT_2_10_10_10_REV:
|
||||
switch (internalFormat) {
|
||||
case GL_RGB:
|
||||
break;
|
||||
default:
|
||||
return GL_INVALID_OPERATION;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
return GL_INVALID_OPERATION;
|
||||
}
|
||||
break;
|
||||
|
||||
case GL_RGB_INTEGER:
|
||||
switch (type) {
|
||||
case GL_UNSIGNED_BYTE:
|
||||
if (internalFormat != GL_RGB8UI)
|
||||
return GL_INVALID_OPERATION;
|
||||
break;
|
||||
|
||||
case GL_BYTE:
|
||||
if (internalFormat != GL_RGB8I)
|
||||
return GL_INVALID_OPERATION;
|
||||
break;
|
||||
|
||||
case GL_UNSIGNED_SHORT:
|
||||
if (internalFormat != GL_RGB16UI)
|
||||
return GL_INVALID_OPERATION;
|
||||
break;
|
||||
|
||||
case GL_SHORT:
|
||||
if (internalFormat != GL_RGB16I)
|
||||
return GL_INVALID_OPERATION;
|
||||
break;
|
||||
|
||||
case GL_UNSIGNED_INT:
|
||||
if (internalFormat != GL_RGB32UI)
|
||||
return GL_INVALID_OPERATION;
|
||||
break;
|
||||
|
||||
case GL_INT:
|
||||
if (internalFormat != GL_RGB32I)
|
||||
return GL_INVALID_OPERATION;
|
||||
break;
|
||||
|
||||
default:
|
||||
return GL_INVALID_OPERATION;
|
||||
}
|
||||
break;
|
||||
|
||||
case GL_RG:
|
||||
switch (type) {
|
||||
case GL_UNSIGNED_BYTE:
|
||||
if (internalFormat != GL_RG8)
|
||||
return GL_INVALID_OPERATION;
|
||||
break;
|
||||
|
||||
case GL_BYTE:
|
||||
if (internalFormat != GL_RG8_SNORM)
|
||||
return GL_INVALID_OPERATION;
|
||||
break;
|
||||
|
||||
case GL_HALF_FLOAT:
|
||||
if (internalFormat != GL_RG16F)
|
||||
return GL_INVALID_OPERATION;
|
||||
break;
|
||||
|
||||
case GL_FLOAT:
|
||||
switch (internalFormat) {
|
||||
case GL_RG16F:
|
||||
case GL_RG32F:
|
||||
break;
|
||||
default:
|
||||
return GL_INVALID_OPERATION;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
return GL_INVALID_OPERATION;
|
||||
}
|
||||
break;
|
||||
|
||||
case GL_RG_INTEGER:
|
||||
switch (type) {
|
||||
case GL_UNSIGNED_BYTE:
|
||||
if (internalFormat != GL_RG8UI)
|
||||
return GL_INVALID_OPERATION;
|
||||
break;
|
||||
|
||||
case GL_BYTE:
|
||||
if (internalFormat != GL_RG8I)
|
||||
return GL_INVALID_OPERATION;
|
||||
break;
|
||||
|
||||
case GL_UNSIGNED_SHORT:
|
||||
if (internalFormat != GL_RG16UI)
|
||||
return GL_INVALID_OPERATION;
|
||||
break;
|
||||
|
||||
case GL_SHORT:
|
||||
if (internalFormat != GL_RG16I)
|
||||
return GL_INVALID_OPERATION;
|
||||
break;
|
||||
|
||||
case GL_UNSIGNED_INT:
|
||||
if (internalFormat != GL_RG32UI)
|
||||
return GL_INVALID_OPERATION;
|
||||
break;
|
||||
|
||||
case GL_INT:
|
||||
if (internalFormat != GL_RG32I)
|
||||
return GL_INVALID_OPERATION;
|
||||
break;
|
||||
|
||||
default:
|
||||
return GL_INVALID_OPERATION;
|
||||
}
|
||||
break;
|
||||
|
||||
case GL_RED:
|
||||
switch (type) {
|
||||
case GL_UNSIGNED_BYTE:
|
||||
if (internalFormat != GL_R8)
|
||||
return GL_INVALID_OPERATION;
|
||||
break;
|
||||
|
||||
case GL_BYTE:
|
||||
if (internalFormat != GL_R8_SNORM)
|
||||
return GL_INVALID_OPERATION;
|
||||
break;
|
||||
|
||||
case GL_HALF_FLOAT:
|
||||
if (internalFormat != GL_R16F)
|
||||
return GL_INVALID_OPERATION;
|
||||
break;
|
||||
|
||||
case GL_FLOAT:
|
||||
switch (internalFormat) {
|
||||
case GL_R16F:
|
||||
case GL_R32F:
|
||||
break;
|
||||
default:
|
||||
return GL_INVALID_OPERATION;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
return GL_INVALID_OPERATION;
|
||||
}
|
||||
break;
|
||||
|
||||
case GL_RED_INTEGER:
|
||||
switch (type) {
|
||||
case GL_UNSIGNED_BYTE:
|
||||
if (internalFormat != GL_R8UI)
|
||||
return GL_INVALID_OPERATION;
|
||||
break;
|
||||
|
||||
case GL_BYTE:
|
||||
if (internalFormat != GL_R8I)
|
||||
return GL_INVALID_OPERATION;
|
||||
break;
|
||||
|
||||
case GL_UNSIGNED_SHORT:
|
||||
if (internalFormat != GL_R16UI)
|
||||
return GL_INVALID_OPERATION;
|
||||
break;
|
||||
|
||||
case GL_SHORT:
|
||||
if (internalFormat != GL_R16I)
|
||||
return GL_INVALID_OPERATION;
|
||||
break;
|
||||
|
||||
case GL_UNSIGNED_INT:
|
||||
if (internalFormat != GL_R32UI)
|
||||
return GL_INVALID_OPERATION;
|
||||
break;
|
||||
|
||||
case GL_INT:
|
||||
if (internalFormat != GL_R32I)
|
||||
return GL_INVALID_OPERATION;
|
||||
break;
|
||||
|
||||
default:
|
||||
return GL_INVALID_OPERATION;
|
||||
}
|
||||
break;
|
||||
|
||||
case GL_DEPTH_COMPONENT:
|
||||
if (dimensions != 2) {
|
||||
return GL_INVALID_OPERATION;
|
||||
}
|
||||
switch (type) {
|
||||
case GL_UNSIGNED_SHORT:
|
||||
if (internalFormat != GL_DEPTH_COMPONENT16)
|
||||
return GL_INVALID_OPERATION;
|
||||
break;
|
||||
|
||||
case GL_UNSIGNED_INT:
|
||||
switch (internalFormat) {
|
||||
case GL_DEPTH_COMPONENT16:
|
||||
case GL_DEPTH_COMPONENT24:
|
||||
break;
|
||||
default:
|
||||
return GL_INVALID_OPERATION;
|
||||
}
|
||||
break;
|
||||
|
||||
case GL_FLOAT:
|
||||
if (internalFormat != GL_DEPTH_COMPONENT32F)
|
||||
return GL_INVALID_OPERATION;
|
||||
break;
|
||||
|
||||
default:
|
||||
return GL_INVALID_OPERATION;
|
||||
}
|
||||
break;
|
||||
|
||||
case GL_DEPTH_STENCIL:
|
||||
if (dimensions != 2) {
|
||||
return GL_INVALID_OPERATION;
|
||||
}
|
||||
switch (type) {
|
||||
case GL_UNSIGNED_INT_24_8:
|
||||
if (internalFormat != GL_DEPTH24_STENCIL8)
|
||||
return GL_INVALID_OPERATION;
|
||||
break;
|
||||
|
||||
case GL_FLOAT_32_UNSIGNED_INT_24_8_REV:
|
||||
if (internalFormat != GL_DEPTH32F_STENCIL8)
|
||||
return GL_INVALID_OPERATION;
|
||||
break;
|
||||
|
||||
default:
|
||||
return GL_INVALID_OPERATION;
|
||||
}
|
||||
break;
|
||||
|
||||
case GL_ALPHA:
|
||||
case GL_LUMINANCE:
|
||||
case GL_LUMINANCE_ALPHA:
|
||||
if (type != GL_UNSIGNED_BYTE || format != internalFormat)
|
||||
return GL_INVALID_OPERATION;
|
||||
break;
|
||||
}
|
||||
|
||||
return type_valid ? GL_NO_ERROR : GL_INVALID_OPERATION;
|
||||
}
|
||||
|
@@ -61,6 +61,12 @@ _mesa_is_type_unsigned(GLenum type);
|
||||
extern GLboolean
|
||||
_mesa_is_enum_format_integer(GLenum format);
|
||||
|
||||
extern GLboolean
|
||||
_mesa_is_enum_format_unsigned_int(GLenum format);
|
||||
|
||||
extern GLboolean
|
||||
_mesa_is_enum_format_signed_int(GLenum format);
|
||||
|
||||
extern GLboolean
|
||||
_mesa_is_enum_format_or_type_integer(GLenum format, GLenum type);
|
||||
|
||||
@@ -94,6 +100,9 @@ _mesa_base_format_to_integer_format(GLenum format);
|
||||
extern GLboolean
|
||||
_mesa_base_format_has_channel(GLenum base_format, GLenum pname);
|
||||
|
||||
extern GLint
|
||||
_mesa_base_format_component_count(GLenum base_format);
|
||||
|
||||
extern GLenum
|
||||
_mesa_generic_compressed_format_to_uncompressed_format(GLenum format);
|
||||
|
||||
@@ -111,6 +120,11 @@ extern GLenum
|
||||
_mesa_es_error_check_format_and_type(GLenum format, GLenum type,
|
||||
unsigned dimensions);
|
||||
|
||||
extern GLenum
|
||||
_mesa_es3_error_check_format_and_type(GLenum format, GLenum type,
|
||||
GLenum internalFormat,
|
||||
unsigned dimensions);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@@ -1634,9 +1634,20 @@ struct gl_array_attrib
|
||||
GLuint LockFirst; /**< GL_EXT_compiled_vertex_array */
|
||||
GLuint LockCount; /**< GL_EXT_compiled_vertex_array */
|
||||
|
||||
/** GL 3.1 (slightly different from GL_NV_primitive_restart) */
|
||||
/**
|
||||
* \name Primitive restart controls
|
||||
*
|
||||
* Primitive restart is enabled if either \c PrimitiveRestart or
|
||||
* \c PrimitiveRestart is set. If \c PrimitiveRestart is set, then
|
||||
* \c RestartIndex is used as the cut vertex. Otherwise ~0 is used.
|
||||
*/
|
||||
/*@{*/
|
||||
GLboolean PrimitiveRestart;
|
||||
GLboolean PrimitiveRestartFixedIndex;
|
||||
GLboolean _PrimitiveRestart;
|
||||
GLuint RestartIndex;
|
||||
GLuint _RestartIndex;
|
||||
/*@}*/
|
||||
|
||||
/* GL_ARB_vertex_buffer_object */
|
||||
struct gl_buffer_object *ArrayBufferObj;
|
||||
@@ -2962,6 +2973,17 @@ struct gl_constants
|
||||
* Drivers that support transform feedback must set this value to GL_FALSE.
|
||||
*/
|
||||
GLboolean DisableVaryingPacking;
|
||||
|
||||
/*
|
||||
* Maximum value supported for an index in DrawElements and friends.
|
||||
*
|
||||
* This must be at least (1ull<<24)-1. The default value is
|
||||
* (1ull<<32)-1.
|
||||
*
|
||||
* \since ES 3.0 or GL_ARB_ES3_compatibility
|
||||
* \sa _mesa_init_constants
|
||||
*/
|
||||
GLuint64 MaxElementIndex;
|
||||
};
|
||||
|
||||
|
||||
@@ -3358,6 +3380,7 @@ typedef enum
|
||||
API_OPENGLES,
|
||||
API_OPENGLES2,
|
||||
API_OPENGL_CORE,
|
||||
API_OPENGL_LAST = API_OPENGL_CORE,
|
||||
} gl_api;
|
||||
|
||||
/**
|
||||
|
@@ -885,7 +885,7 @@ _mesa_pack_rgba_span_from_uints(struct gl_context *ctx, GLuint n, GLuint rgba[][
|
||||
#undef FN_NAME
|
||||
|
||||
#define DST_TYPE GLubyte
|
||||
#define SRC_CONVERT(x) MAX2(x, 0)
|
||||
#define SRC_CONVERT(x) CLAMP(x, 0, 0x7f)
|
||||
#define FN_NAME pack_ubyte_from_int_rgba
|
||||
#include "pack_tmp.h"
|
||||
#undef DST_TYPE
|
||||
@@ -3641,7 +3641,11 @@ extract_float_rgba(GLuint n, GLfloat rgba[][4],
|
||||
rgba[i][rDst] = ((p ) & 0x3ff) * rs;
|
||||
rgba[i][gDst] = ((p >> 10) & 0x3ff) * gs;
|
||||
rgba[i][bDst] = ((p >> 20) & 0x3ff) * bs;
|
||||
rgba[i][aDst] = ((p >> 30) ) * as;
|
||||
if (aSrc < 0) {
|
||||
rgba[i][aDst] = 1.0F;
|
||||
} else {
|
||||
rgba[i][aDst] = (p >> 30) * as;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
@@ -3652,7 +3656,11 @@ extract_float_rgba(GLuint n, GLfloat rgba[][4],
|
||||
rgba[i][rDst] = ((p ) & 0x3ff) * rs;
|
||||
rgba[i][gDst] = ((p >> 10) & 0x3ff) * gs;
|
||||
rgba[i][bDst] = ((p >> 20) & 0x3ff) * bs;
|
||||
rgba[i][aDst] = ((p >> 30) ) * as;
|
||||
if (aSrc < 0) {
|
||||
rgba[i][aDst] = 1.0F;
|
||||
} else {
|
||||
rgba[i][aDst] = (p >> 30) * as;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@@ -147,6 +147,12 @@ get_query_binding_point(struct gl_context *ctx, GLenum target)
|
||||
return &ctx->Query.CurrentOcclusionObject;
|
||||
else
|
||||
return NULL;
|
||||
case GL_ANY_SAMPLES_PASSED_CONSERVATIVE:
|
||||
if (ctx->Extensions.ARB_ES3_compatibility
|
||||
|| (ctx->API == API_OPENGLES2 && ctx->Version >= 30))
|
||||
return &ctx->Query.CurrentOcclusionObject;
|
||||
else
|
||||
return NULL;
|
||||
case GL_TIME_ELAPSED_EXT:
|
||||
if (ctx->Extensions.EXT_timer_query)
|
||||
return &ctx->Query.CurrentTimerObject;
|
||||
@@ -577,7 +583,8 @@ _mesa_GetQueryObjectiv(GLuint id, GLenum pname, GLint *params)
|
||||
if (!q->Ready)
|
||||
ctx->Driver.WaitQuery(ctx, q);
|
||||
/* if result is too large for returned type, clamp to max value */
|
||||
if (q->Target == GL_ANY_SAMPLES_PASSED) {
|
||||
if (q->Target == GL_ANY_SAMPLES_PASSED
|
||||
|| q->Target == GL_ANY_SAMPLES_PASSED_CONSERVATIVE) {
|
||||
if (q->Result)
|
||||
*params = GL_TRUE;
|
||||
else
|
||||
@@ -628,7 +635,8 @@ _mesa_GetQueryObjectuiv(GLuint id, GLenum pname, GLuint *params)
|
||||
if (!q->Ready)
|
||||
ctx->Driver.WaitQuery(ctx, q);
|
||||
/* if result is too large for returned type, clamp to max value */
|
||||
if (q->Target == GL_ANY_SAMPLES_PASSED) {
|
||||
if (q->Target == GL_ANY_SAMPLES_PASSED
|
||||
|| q->Target == GL_ANY_SAMPLES_PASSED_CONSERVATIVE) {
|
||||
if (q->Result)
|
||||
*params = GL_TRUE;
|
||||
else
|
||||
|
@@ -325,6 +325,11 @@ slow_read_rgba_pixels( struct gl_context *ctx,
|
||||
GLboolean dst_is_integer = _mesa_is_enum_format_integer(format);
|
||||
GLboolean dst_is_uint = _mesa_is_format_unsigned(rbFormat);
|
||||
|
||||
if (_mesa_is_format_integer_color(rbFormat) && format == GL_RGBA && type == GL_UNSIGNED_BYTE) {
|
||||
format = GL_RGBA_INTEGER;
|
||||
dst_is_integer = GL_TRUE;
|
||||
}
|
||||
|
||||
dstStride = _mesa_image_row_stride(packing, width, format, type);
|
||||
dst = (GLubyte *) _mesa_image_address2d(packing, pixels, width, height,
|
||||
format, type, 0, 0);
|
||||
@@ -674,12 +679,57 @@ _mesa_readpixels(struct gl_context *ctx,
|
||||
}
|
||||
|
||||
|
||||
static GLenum
|
||||
read_pixels_es3_error_check(GLenum format, GLenum type,
|
||||
GLenum internalFormat)
|
||||
{
|
||||
GLboolean is_unsigned_int = GL_FALSE;
|
||||
GLboolean is_signed_int = GL_FALSE;
|
||||
|
||||
if (!_mesa_is_color_format(internalFormat)) {
|
||||
return GL_INVALID_OPERATION;
|
||||
}
|
||||
|
||||
is_unsigned_int = _mesa_is_enum_format_unsigned_int(internalFormat);
|
||||
if (!is_unsigned_int) {
|
||||
is_signed_int = _mesa_is_enum_format_signed_int(internalFormat);
|
||||
}
|
||||
|
||||
switch (format) {
|
||||
case GL_RGBA:
|
||||
if (type == GL_UNSIGNED_BYTE)
|
||||
return GL_NO_ERROR;
|
||||
if (internalFormat == GL_RGB10_A2 &&
|
||||
type == GL_UNSIGNED_INT_2_10_10_10_REV)
|
||||
return GL_NO_ERROR;
|
||||
if (internalFormat == GL_RGB10_A2UI && type == GL_UNSIGNED_BYTE)
|
||||
return GL_NO_ERROR;
|
||||
break;
|
||||
case GL_BGRA:
|
||||
/* GL_EXT_read_format_bgra */
|
||||
if (type == GL_UNSIGNED_BYTE ||
|
||||
type == GL_UNSIGNED_SHORT_4_4_4_4_REV ||
|
||||
type == GL_UNSIGNED_SHORT_1_5_5_5_REV)
|
||||
return GL_NO_ERROR;
|
||||
break;
|
||||
case GL_RGBA_INTEGER:
|
||||
if ((is_signed_int && type == GL_INT) ||
|
||||
(is_unsigned_int && type == GL_UNSIGNED_INT))
|
||||
return GL_NO_ERROR;
|
||||
break;
|
||||
}
|
||||
|
||||
return GL_INVALID_OPERATION;
|
||||
}
|
||||
|
||||
|
||||
void GLAPIENTRY
|
||||
_mesa_ReadnPixelsARB( GLint x, GLint y, GLsizei width, GLsizei height,
|
||||
GLenum format, GLenum type, GLsizei bufSize,
|
||||
GLvoid *pixels )
|
||||
{
|
||||
GLenum err;
|
||||
GLenum err = GL_NO_ERROR;
|
||||
struct gl_renderbuffer *rb;
|
||||
|
||||
GET_CURRENT_CONTEXT(ctx);
|
||||
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx);
|
||||
@@ -699,6 +749,22 @@ _mesa_ReadnPixelsARB( GLint x, GLint y, GLsizei width, GLsizei height,
|
||||
return;
|
||||
}
|
||||
|
||||
if (ctx->NewState)
|
||||
_mesa_update_state(ctx);
|
||||
|
||||
if (ctx->ReadBuffer->_Status != GL_FRAMEBUFFER_COMPLETE_EXT) {
|
||||
_mesa_error(ctx, GL_INVALID_FRAMEBUFFER_OPERATION_EXT,
|
||||
"glReadPixels(incomplete framebuffer)" );
|
||||
return;
|
||||
}
|
||||
|
||||
rb = _mesa_get_read_renderbuffer(ctx, format);
|
||||
if (rb == NULL) {
|
||||
_mesa_error(ctx, GL_INVALID_OPERATION,
|
||||
"glReadPixels(read buffer)");
|
||||
return;
|
||||
}
|
||||
|
||||
/* OpenGL ES 1.x and OpenGL ES 2.0 impose additional restrictions on the
|
||||
* combinations of format and type that can be used.
|
||||
*
|
||||
@@ -707,15 +773,21 @@ _mesa_ReadnPixelsARB( GLint x, GLint y, GLsizei width, GLsizei height,
|
||||
* preferred combination. This code doesn't know what that preferred
|
||||
* combination is, and Mesa can handle anything valid. Just work instead.
|
||||
*/
|
||||
if (_mesa_is_gles(ctx) && ctx->Version < 30) {
|
||||
err = _mesa_es_error_check_format_and_type(format, type, 2);
|
||||
if (err == GL_NO_ERROR) {
|
||||
if (type == GL_FLOAT || type == GL_HALF_FLOAT_OES) {
|
||||
err = GL_INVALID_OPERATION;
|
||||
} else if (format == GL_DEPTH_COMPONENT
|
||||
|| format == GL_DEPTH_STENCIL) {
|
||||
err = GL_INVALID_ENUM;
|
||||
if (_mesa_is_gles(ctx)) {
|
||||
if (ctx->Version < 30) {
|
||||
err = _mesa_es_error_check_format_and_type(format, type, 2);
|
||||
if (err == GL_NO_ERROR) {
|
||||
if (type == GL_FLOAT || type == GL_HALF_FLOAT_OES) {
|
||||
err = GL_INVALID_OPERATION;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
err = read_pixels_es3_error_check(format, type, rb->InternalFormat);
|
||||
}
|
||||
|
||||
if (err == GL_NO_ERROR && (format == GL_DEPTH_COMPONENT
|
||||
|| format == GL_DEPTH_STENCIL)) {
|
||||
err = GL_INVALID_ENUM;
|
||||
}
|
||||
|
||||
if (err != GL_NO_ERROR) {
|
||||
@@ -726,9 +798,6 @@ _mesa_ReadnPixelsARB( GLint x, GLint y, GLsizei width, GLsizei height,
|
||||
}
|
||||
}
|
||||
|
||||
if (ctx->NewState)
|
||||
_mesa_update_state(ctx);
|
||||
|
||||
err = _mesa_error_check_format_and_type(ctx, format, type);
|
||||
if (err != GL_NO_ERROR) {
|
||||
_mesa_error(ctx, err, "glReadPixels(invalid format %s and/or type %s)",
|
||||
@@ -737,12 +806,6 @@ _mesa_ReadnPixelsARB( GLint x, GLint y, GLsizei width, GLsizei height,
|
||||
return;
|
||||
}
|
||||
|
||||
if (ctx->ReadBuffer->_Status != GL_FRAMEBUFFER_COMPLETE_EXT) {
|
||||
_mesa_error(ctx, GL_INVALID_FRAMEBUFFER_OPERATION_EXT,
|
||||
"glReadPixels(incomplete framebuffer)" );
|
||||
return;
|
||||
}
|
||||
|
||||
if (_mesa_is_user_fbo(ctx->ReadBuffer) &&
|
||||
ctx->ReadBuffer->Visual.samples > 0) {
|
||||
_mesa_error(ctx, GL_INVALID_OPERATION, "glReadPixels(multisample FBO)");
|
||||
@@ -754,17 +817,25 @@ _mesa_ReadnPixelsARB( GLint x, GLint y, GLsizei width, GLsizei height,
|
||||
return;
|
||||
}
|
||||
|
||||
/* Check that the destination format and source buffer are both
|
||||
* integer-valued or both non-integer-valued.
|
||||
*/
|
||||
if (ctx->Extensions.EXT_texture_integer && _mesa_is_color_format(format)) {
|
||||
const struct gl_renderbuffer *rb = ctx->ReadBuffer->_ColorReadBuffer;
|
||||
const GLboolean srcInteger = _mesa_is_format_integer_color(rb->Format);
|
||||
const GLboolean dstInteger = _mesa_is_enum_format_integer(format);
|
||||
if (dstInteger != srcInteger) {
|
||||
_mesa_error(ctx, GL_INVALID_OPERATION,
|
||||
"glReadPixels(integer / non-integer format mismatch");
|
||||
return;
|
||||
if (_mesa_get_color_read_format(ctx) == format &&
|
||||
_mesa_get_color_read_type(ctx) == type) {
|
||||
/* IMPLEMENTATION_COLOR_READ_FORMAT and
|
||||
* IMPLEMENTATION_COLOR_READ_TYPE are being used. Therefore
|
||||
* we don't need to check integer vs. non-integer below.
|
||||
*/
|
||||
} else {
|
||||
/* Check that the destination format and source buffer are both
|
||||
* integer-valued or both non-integer-valued.
|
||||
*/
|
||||
const struct gl_renderbuffer *rb = ctx->ReadBuffer->_ColorReadBuffer;
|
||||
const GLboolean srcInteger = _mesa_is_format_integer_color(rb->Format);
|
||||
const GLboolean dstInteger = _mesa_is_enum_format_integer(format);
|
||||
if (dstInteger != srcInteger) {
|
||||
_mesa_error(ctx, GL_INVALID_OPERATION,
|
||||
"glReadPixels(integer / non-integer format mismatch");
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -465,18 +465,20 @@ _mesa_update_state_locked( struct gl_context *ctx )
|
||||
if (MESA_VERBOSE & VERBOSE_STATE)
|
||||
_mesa_print_state("_mesa_update_state", new_state);
|
||||
|
||||
/* Determine which state flags effect vertex/fragment program state */
|
||||
if (ctx->FragmentProgram._MaintainTexEnvProgram) {
|
||||
prog_flags |= (_NEW_BUFFERS | _NEW_TEXTURE | _NEW_FOG |
|
||||
_NEW_VARYING_VP_INPUTS | _NEW_LIGHT | _NEW_POINT |
|
||||
_NEW_RENDERMODE | _NEW_PROGRAM | _NEW_FRAG_CLAMP |
|
||||
_NEW_COLOR);
|
||||
}
|
||||
if (ctx->VertexProgram._MaintainTnlProgram) {
|
||||
prog_flags |= (_NEW_VARYING_VP_INPUTS | _NEW_TEXTURE |
|
||||
_NEW_TEXTURE_MATRIX | _NEW_TRANSFORM | _NEW_POINT |
|
||||
_NEW_FOG | _NEW_LIGHT |
|
||||
_MESA_NEW_NEED_EYE_COORDS);
|
||||
if (ctx->API == API_OPENGL_COMPAT || ctx->API == API_OPENGLES) {
|
||||
/* Determine which state flags effect vertex/fragment program state */
|
||||
if (ctx->FragmentProgram._MaintainTexEnvProgram) {
|
||||
prog_flags |= (_NEW_BUFFERS | _NEW_TEXTURE | _NEW_FOG |
|
||||
_NEW_VARYING_VP_INPUTS | _NEW_LIGHT | _NEW_POINT |
|
||||
_NEW_RENDERMODE | _NEW_PROGRAM | _NEW_FRAG_CLAMP |
|
||||
_NEW_COLOR);
|
||||
}
|
||||
if (ctx->VertexProgram._MaintainTnlProgram) {
|
||||
prog_flags |= (_NEW_VARYING_VP_INPUTS | _NEW_TEXTURE |
|
||||
_NEW_TEXTURE_MATRIX | _NEW_TRANSFORM | _NEW_POINT |
|
||||
_NEW_FOG | _NEW_LIGHT |
|
||||
_MESA_NEW_NEED_EYE_COORDS);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -486,8 +488,10 @@ _mesa_update_state_locked( struct gl_context *ctx )
|
||||
if (new_state & prog_flags)
|
||||
update_program_enables( ctx );
|
||||
|
||||
if (new_state & (_NEW_MODELVIEW|_NEW_PROJECTION))
|
||||
_mesa_update_modelview_project( ctx, new_state );
|
||||
if (ctx->API == API_OPENGL_COMPAT || ctx->API == API_OPENGLES) {
|
||||
if (new_state & (_NEW_MODELVIEW|_NEW_PROJECTION))
|
||||
_mesa_update_modelview_project( ctx, new_state );
|
||||
}
|
||||
|
||||
if (new_state & (_NEW_PROGRAM|_NEW_TEXTURE|_NEW_TEXTURE_MATRIX))
|
||||
_mesa_update_texture( ctx, new_state );
|
||||
@@ -501,8 +505,10 @@ _mesa_update_state_locked( struct gl_context *ctx )
|
||||
if (new_state & _NEW_POLYGON)
|
||||
update_polygon( ctx );
|
||||
|
||||
if (new_state & _NEW_LIGHT)
|
||||
_mesa_update_lighting( ctx );
|
||||
if (ctx->API == API_OPENGL_COMPAT || ctx->API == API_OPENGLES) {
|
||||
if (new_state & _NEW_LIGHT)
|
||||
_mesa_update_lighting( ctx );
|
||||
}
|
||||
|
||||
if (new_state & (_NEW_LIGHT | _NEW_PROGRAM))
|
||||
update_twoside( ctx );
|
||||
@@ -516,8 +522,10 @@ _mesa_update_state_locked( struct gl_context *ctx )
|
||||
if (new_state & _NEW_PIXEL)
|
||||
_mesa_update_pixel( ctx, new_state );
|
||||
|
||||
if (new_state & _MESA_NEW_SEPARATE_SPECULAR)
|
||||
update_separate_specular( ctx );
|
||||
if (ctx->API == API_OPENGL_COMPAT || ctx->API == API_OPENGLES) {
|
||||
if (new_state & _MESA_NEW_SEPARATE_SPECULAR)
|
||||
update_separate_specular( ctx );
|
||||
}
|
||||
|
||||
if (new_state & (_NEW_BUFFERS | _NEW_VIEWPORT))
|
||||
update_viewport_matrix(ctx);
|
||||
|
@@ -1310,8 +1310,7 @@ const struct function gles3_functions_possible[] = {
|
||||
// We check for the aliased -OES version in GLES 2
|
||||
// { "glGetBufferPointerv", 30, -1 },
|
||||
{ "glGetFragDataLocation", 30, -1 },
|
||||
/// XXX: Missing implementation of glGetInteger64i_v
|
||||
// { "glGetInteger64i_v", 30, -1 },
|
||||
{ "glGetInteger64i_v", 30, -1 },
|
||||
{ "glGetInteger64v", 30, -1 },
|
||||
{ "glGetIntegeri_v", 30, -1 },
|
||||
// XXX: Missing implementation of ARB_internalformat_query
|
||||
|
@@ -807,6 +807,7 @@ const struct enum_info everything[] = {
|
||||
{ 0x8256, "GL_RESET_NOTIFICATION_STRATEGY_ARB" },
|
||||
{ 0x8257, "GL_PROGRAM_BINARY_RETRIEVABLE_HINT" },
|
||||
{ 0x8261, "GL_NO_RESET_NOTIFICATION_ARB" },
|
||||
{ 0x82DF, "GL_TEXTURE_IMMUTABLE_LEVELS" },
|
||||
{ 0x8362, "GL_UNSIGNED_BYTE_2_3_3_REV" },
|
||||
{ 0x8363, "GL_UNSIGNED_SHORT_5_6_5" },
|
||||
{ 0x8364, "GL_UNSIGNED_SHORT_5_6_5_REV" },
|
||||
@@ -1662,6 +1663,9 @@ const struct enum_info everything[] = {
|
||||
{ 0x8D55, "GL_RENDERBUFFER_STENCIL_SIZE" },
|
||||
{ 0x8D56, "GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE" },
|
||||
{ 0x8D57, "GL_MAX_SAMPLES" },
|
||||
{ 0x8D69, "GL_PRIMITIVE_RESTART_FIXED_INDEX" },
|
||||
{ 0x8D6A, "GL_ANY_SAMPLES_PASSED_CONSERVATIVE" },
|
||||
{ 0x8D6B, "GL_MAX_ELEMENT_INDEX" },
|
||||
{ 0x8D70, "GL_RGBA32UI" },
|
||||
{ 0x8D71, "GL_RGB32UI" },
|
||||
{ 0x8D72, "GL_ALPHA32UI_EXT" },
|
||||
@@ -1828,6 +1832,16 @@ const struct enum_info everything[] = {
|
||||
{ 0x9146, "GL_DEBUG_SEVERITY_HIGH_ARB" },
|
||||
{ 0x9147, "GL_DEBUG_SEVERITY_MEDIUM_ARB" },
|
||||
{ 0x9148, "GL_DEBUG_SEVERITY_LOW_ARB" },
|
||||
{ 0x9274, "GL_COMPRESSED_RGB8_ETC2" },
|
||||
{ 0x9275, "GL_COMPRESSED_SRGB8_ETC2" },
|
||||
{ 0x9276, "GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2" },
|
||||
{ 0x9277, "GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2" },
|
||||
{ 0x9278, "GL_COMPRESSED_RGBA8_ETC2_EAC" },
|
||||
{ 0x9279, "GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC" },
|
||||
{ 0x9270, "GL_COMPRESSED_R11_EAC" },
|
||||
{ 0x9271, "GL_COMPRESSED_SIGNED_R11_EAC" },
|
||||
{ 0x9272, "GL_COMPRESSED_RG11_EAC" },
|
||||
{ 0x9273, "GL_COMPRESSED_SIGNED_RG11_EAC" },
|
||||
{ 0x19262, "GL_RASTER_POSITION_UNCLIPPED_IBM" },
|
||||
{ 0, NULL }
|
||||
};
|
||||
|
@@ -75,7 +75,9 @@ _mesa_choose_tex_format(struct gl_context *ctx, GLenum target,
|
||||
RETURN_IF_SUPPORTED(MESA_FORMAT_ARGB4444);
|
||||
} else if (type == GL_UNSIGNED_SHORT_1_5_5_5_REV) {
|
||||
RETURN_IF_SUPPORTED(MESA_FORMAT_ARGB1555);
|
||||
}
|
||||
} else if (type == GL_UNSIGNED_INT_2_10_10_10_REV) {
|
||||
RETURN_IF_SUPPORTED(MESA_FORMAT_ARGB2101010);
|
||||
}
|
||||
RETURN_IF_SUPPORTED(MESA_FORMAT_RGBA8888);
|
||||
RETURN_IF_SUPPORTED(MESA_FORMAT_ARGB8888);
|
||||
break;
|
||||
@@ -111,6 +113,10 @@ _mesa_choose_tex_format(struct gl_context *ctx, GLenum target,
|
||||
/* shallow RGB formats */
|
||||
case 3:
|
||||
case GL_RGB:
|
||||
if (type == GL_UNSIGNED_INT_2_10_10_10_REV) {
|
||||
RETURN_IF_SUPPORTED(MESA_FORMAT_ARGB2101010);
|
||||
}
|
||||
/* fallthrough */
|
||||
case GL_RGB8:
|
||||
RETURN_IF_SUPPORTED(MESA_FORMAT_RGB888);
|
||||
RETURN_IF_SUPPORTED(MESA_FORMAT_XRGB8888);
|
||||
|
@@ -1893,23 +1893,30 @@ texture_error_check( struct gl_context *ctx,
|
||||
* requires GL_OES_texture_float) are filtered elsewhere.
|
||||
*/
|
||||
|
||||
if (_mesa_is_gles(ctx) && !_mesa_is_gles3(ctx)) {
|
||||
if (format != internalFormat) {
|
||||
if (_mesa_is_gles(ctx)) {
|
||||
if (_mesa_is_gles3(ctx)) {
|
||||
err = _mesa_es3_error_check_format_and_type(format, type,
|
||||
internalFormat,
|
||||
dimensions);
|
||||
} else {
|
||||
if (format != internalFormat) {
|
||||
_mesa_error(ctx, GL_INVALID_OPERATION,
|
||||
"glTexImage%dD(format = %s, internalFormat = %s)",
|
||||
dimensions,
|
||||
_mesa_lookup_enum_by_nr(format),
|
||||
_mesa_lookup_enum_by_nr(internalFormat));
|
||||
return GL_TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
err = _mesa_es_error_check_format_and_type(format, type, dimensions);
|
||||
err = _mesa_es_error_check_format_and_type(format, type, dimensions);
|
||||
}
|
||||
if (err != GL_NO_ERROR) {
|
||||
_mesa_error(ctx, err,
|
||||
"glTexImage%dD(format = %s, type = %s)",
|
||||
"glTexImage%dD(format = %s, type = %s, internalFormat = %s)",
|
||||
dimensions,
|
||||
_mesa_lookup_enum_by_nr(format),
|
||||
_mesa_lookup_enum_by_nr(type));
|
||||
_mesa_lookup_enum_by_nr(type),
|
||||
_mesa_lookup_enum_by_nr(internalFormat));
|
||||
return GL_TRUE;
|
||||
}
|
||||
}
|
||||
@@ -1947,8 +1954,9 @@ texture_error_check( struct gl_context *ctx,
|
||||
err = _mesa_error_check_format_and_type(ctx, format, type);
|
||||
if (err != GL_NO_ERROR) {
|
||||
_mesa_error(ctx, err,
|
||||
"glTexImage%dD(incompatible format 0x%x, type 0x%x)",
|
||||
dimensions, format, type);
|
||||
"glTexImage%dD(incompatible format = %s, type = %s)",
|
||||
dimensions, _mesa_lookup_enum_by_nr(format),
|
||||
_mesa_lookup_enum_by_nr(type));
|
||||
return GL_TRUE;
|
||||
}
|
||||
|
||||
@@ -1960,8 +1968,9 @@ texture_error_check( struct gl_context *ctx,
|
||||
(_mesa_is_depthstencil_format(internalFormat) != _mesa_is_depthstencil_format(format)) ||
|
||||
(_mesa_is_dudv_format(internalFormat) != _mesa_is_dudv_format(format))) {
|
||||
_mesa_error(ctx, GL_INVALID_OPERATION,
|
||||
"glTexImage%dD(incompatible internalFormat 0x%x, format 0x%x)",
|
||||
dimensions, internalFormat, format);
|
||||
"glTexImage%dD(incompatible internalFormat = %s, format = %s)",
|
||||
dimensions, _mesa_lookup_enum_by_nr(internalFormat),
|
||||
_mesa_lookup_enum_by_nr(format));
|
||||
return GL_TRUE;
|
||||
}
|
||||
|
||||
@@ -2263,8 +2272,9 @@ texsubimage_error_check(struct gl_context *ctx, GLuint dimensions,
|
||||
err = _mesa_error_check_format_and_type(ctx, format, type);
|
||||
if (err != GL_NO_ERROR) {
|
||||
_mesa_error(ctx, err,
|
||||
"glTexSubImage%dD(incompatible format 0x%x, type 0x%x)",
|
||||
dimensions, format, type);
|
||||
"glTexSubImage%dD(incompatible format = %s, type = %s)",
|
||||
dimensions, _mesa_lookup_enum_by_nr(format),
|
||||
_mesa_lookup_enum_by_nr(type));
|
||||
return GL_TRUE;
|
||||
}
|
||||
|
||||
@@ -2313,6 +2323,29 @@ texsubimage_error_check(struct gl_context *ctx, GLuint dimensions,
|
||||
}
|
||||
|
||||
|
||||
static bool
|
||||
is_srgb_format(GLenum internalFormat)
|
||||
{
|
||||
switch (internalFormat) {
|
||||
case GL_SRGB_EXT:
|
||||
case GL_SRGB8_EXT:
|
||||
case GL_COMPRESSED_SRGB_EXT:
|
||||
case GL_COMPRESSED_SRGB_S3TC_DXT1_EXT:
|
||||
case GL_SRGB_ALPHA_EXT:
|
||||
case GL_SRGB8_ALPHA8_EXT:
|
||||
case GL_COMPRESSED_SRGB_ALPHA_EXT:
|
||||
case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT:
|
||||
case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT:
|
||||
case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT:
|
||||
case GL_COMPRESSED_SRGB8_ETC2:
|
||||
case GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:
|
||||
case GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Test glCopyTexImage[12]D() parameters for errors.
|
||||
*
|
||||
@@ -2337,6 +2370,9 @@ copytexture_error_check( struct gl_context *ctx, GLuint dimensions,
|
||||
GLint width, GLint height, GLint border )
|
||||
{
|
||||
GLint baseFormat;
|
||||
GLint rb_base_format;
|
||||
struct gl_renderbuffer *rb;
|
||||
GLenum rb_internal_format;
|
||||
|
||||
/* check target */
|
||||
if (!legal_texsubimage_target(ctx, dimensions, target)) {
|
||||
@@ -2381,28 +2417,59 @@ copytexture_error_check( struct gl_context *ctx, GLuint dimensions,
|
||||
return GL_TRUE;
|
||||
}
|
||||
|
||||
/* OpenGL ES 1.x and OpenGL ES 2.0 impose additional restrictions on the
|
||||
* internalFormat.
|
||||
*/
|
||||
if (_mesa_is_gles(ctx) && !_mesa_is_gles3(ctx)) {
|
||||
switch (internalFormat) {
|
||||
case GL_ALPHA:
|
||||
case GL_RGB:
|
||||
case GL_RGBA:
|
||||
case GL_LUMINANCE:
|
||||
case GL_LUMINANCE_ALPHA:
|
||||
break;
|
||||
default:
|
||||
rb = _mesa_get_read_renderbuffer(ctx, internalFormat);
|
||||
if (rb == NULL) {
|
||||
_mesa_error(ctx, GL_INVALID_OPERATION,
|
||||
"glCopyTexImage%dD(read buffer)", dimensions);
|
||||
return GL_TRUE;
|
||||
}
|
||||
|
||||
rb_internal_format = rb->InternalFormat;
|
||||
baseFormat = _mesa_base_tex_format(ctx, internalFormat);
|
||||
rb_base_format = _mesa_base_tex_format(ctx, rb->InternalFormat);
|
||||
if (baseFormat < 0) {
|
||||
_mesa_error(ctx, GL_INVALID_OPERATION,
|
||||
"glCopyTexImage%dD(internalFormat)", dimensions);
|
||||
return GL_TRUE;
|
||||
}
|
||||
|
||||
if (_mesa_is_color_format(internalFormat)) {
|
||||
if (rb_base_format < 0) {
|
||||
_mesa_error(ctx, GL_INVALID_VALUE,
|
||||
"glCopyTexImage%dD(internalFormat)", dimensions);
|
||||
return GL_TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
baseFormat = _mesa_base_tex_format(ctx, internalFormat);
|
||||
if (baseFormat < 0) {
|
||||
_mesa_error(ctx, GL_INVALID_VALUE,
|
||||
"glCopyTexImage%dD(internalFormat)", dimensions);
|
||||
if (_mesa_is_gles(ctx)) {
|
||||
bool valid = true;
|
||||
if (_mesa_base_format_component_count(baseFormat) >
|
||||
_mesa_base_format_component_count(rb_base_format)) {
|
||||
valid = false;
|
||||
}
|
||||
if (baseFormat == GL_DEPTH_COMPONENT ||
|
||||
baseFormat == GL_DEPTH_STENCIL ||
|
||||
rb_base_format == GL_DEPTH_COMPONENT ||
|
||||
rb_base_format == GL_DEPTH_STENCIL ||
|
||||
((baseFormat == GL_LUMINANCE_ALPHA ||
|
||||
baseFormat == GL_ALPHA) &&
|
||||
rb_base_format != GL_RGBA) ||
|
||||
internalFormat == GL_RGB9_E5) {
|
||||
valid = false;
|
||||
}
|
||||
if (internalFormat == GL_RGB9_E5) {
|
||||
valid = false;
|
||||
}
|
||||
if (!valid) {
|
||||
_mesa_error(ctx, GL_INVALID_OPERATION,
|
||||
"glCopyTexImage%dD(internalFormat)", dimensions);
|
||||
return GL_TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
if (is_srgb_format(internalFormat) != is_srgb_format(rb_internal_format)) {
|
||||
_mesa_error(ctx, GL_INVALID_OPERATION,
|
||||
"glCopyTexImage%dD(srgb usage mismatch)", dimensions);
|
||||
return GL_TRUE;
|
||||
}
|
||||
|
||||
@@ -2420,13 +2487,20 @@ copytexture_error_check( struct gl_context *ctx, GLuint dimensions,
|
||||
* integer format and the read color buffer is an integer format."
|
||||
*/
|
||||
if (_mesa_is_color_format(internalFormat)) {
|
||||
struct gl_renderbuffer *rb = ctx->ReadBuffer->_ColorReadBuffer;
|
||||
|
||||
if (_mesa_is_enum_format_integer(rb->InternalFormat) !=
|
||||
_mesa_is_enum_format_integer(internalFormat)) {
|
||||
_mesa_error(ctx, GL_INVALID_OPERATION,
|
||||
"glCopyTexImage%dD(integer vs non-integer)", dimensions);
|
||||
return GL_TRUE;
|
||||
bool is_int = _mesa_is_enum_format_integer(internalFormat);
|
||||
bool is_rbint = _mesa_is_enum_format_integer(rb_internal_format);
|
||||
if (is_int || is_rbint) {
|
||||
if (is_int != is_rbint) {
|
||||
_mesa_error(ctx, GL_INVALID_OPERATION,
|
||||
"glCopyTexImage%dD(integer vs non-integer)", dimensions);
|
||||
return GL_TRUE;
|
||||
} else if (_mesa_is_gles(ctx) &&
|
||||
_mesa_is_enum_format_unsigned_int(internalFormat) !=
|
||||
_mesa_is_enum_format_unsigned_int(rb_internal_format)) {
|
||||
_mesa_error(ctx, GL_INVALID_OPERATION,
|
||||
"glCopyTexImage%dD(signed vs unsigned integer)", dimensions);
|
||||
return GL_TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -1714,18 +1714,23 @@ _mesa_texstore_argb2101010(TEXSTORE_PARAMS)
|
||||
srcPacking,
|
||||
ctx->_ImageTransferState);
|
||||
const GLfloat *src = tempImage;
|
||||
GLushort aMask = 0;
|
||||
GLint img, row, col;
|
||||
if (!tempImage)
|
||||
return GL_FALSE;
|
||||
if (srcFormat == GL_RGB) {
|
||||
aMask = 0xffff;
|
||||
}
|
||||
for (img = 0; img < srcDepth; img++) {
|
||||
GLubyte *dstRow = dstSlices[img];
|
||||
if (baseInternalFormat == GL_RGBA) {
|
||||
if (baseInternalFormat == GL_RGBA || baseInternalFormat == GL_RGB) {
|
||||
for (row = 0; row < srcHeight; row++) {
|
||||
GLuint *dstUI = (GLuint *) dstRow;
|
||||
for (col = 0; col < srcWidth; col++) {
|
||||
GLushort a,r,g,b;
|
||||
|
||||
UNCLAMPED_FLOAT_TO_USHORT(a, src[ACOMP]);
|
||||
a = a | aMask;
|
||||
UNCLAMPED_FLOAT_TO_USHORT(r, src[RCOMP]);
|
||||
UNCLAMPED_FLOAT_TO_USHORT(g, src[GCOMP]);
|
||||
UNCLAMPED_FLOAT_TO_USHORT(b, src[BCOMP]);
|
||||
@@ -1734,20 +1739,6 @@ _mesa_texstore_argb2101010(TEXSTORE_PARAMS)
|
||||
}
|
||||
dstRow += dstRowStride;
|
||||
}
|
||||
} else if (baseInternalFormat == GL_RGB) {
|
||||
for (row = 0; row < srcHeight; row++) {
|
||||
GLuint *dstUI = (GLuint *) dstRow;
|
||||
for (col = 0; col < srcWidth; col++) {
|
||||
GLushort r,g,b;
|
||||
|
||||
UNCLAMPED_FLOAT_TO_USHORT(r, src[RCOMP]);
|
||||
UNCLAMPED_FLOAT_TO_USHORT(g, src[GCOMP]);
|
||||
UNCLAMPED_FLOAT_TO_USHORT(b, src[BCOMP]);
|
||||
dstUI[col] = PACK_COLOR_2101010_US(0xffff, r, g, b);
|
||||
src += 4;
|
||||
}
|
||||
dstRow += dstRowStride;
|
||||
}
|
||||
} else {
|
||||
ASSERT(0);
|
||||
}
|
||||
|
@@ -864,7 +864,8 @@ _mesa_uniform_matrix(struct gl_context *ctx, struct gl_shader_program *shProg,
|
||||
|
||||
/* GL_INVALID_VALUE is generated if `transpose' is not GL_FALSE.
|
||||
* http://www.khronos.org/opengles/sdk/docs/man/xhtml/glUniform.xml */
|
||||
if (ctx->API == API_OPENGLES || ctx->API == API_OPENGLES2) {
|
||||
if (ctx->API == API_OPENGLES
|
||||
|| (ctx->API == API_OPENGLES2 && ctx->Version < 30)) {
|
||||
if (transpose) {
|
||||
_mesa_error(ctx, GL_INVALID_VALUE,
|
||||
"glUniformMatrix(matrix transpose is not GL_FALSE)");
|
||||
|
@@ -151,21 +151,21 @@ update_array(struct gl_context *ctx,
|
||||
}
|
||||
|
||||
if (_mesa_is_gles(ctx)) {
|
||||
/* Once Mesa gets support for GL_OES_vertex_half_float this mask will
|
||||
* change. Adding support for this extension isn't quite as trivial as
|
||||
* we'd like because ES uses a different enum value for GL_HALF_FLOAT.
|
||||
*/
|
||||
legalTypesMask &= ~(FIXED_GL_BIT | HALF_BIT | DOUBLE_BIT);
|
||||
legalTypesMask &= ~(FIXED_GL_BIT | DOUBLE_BIT);
|
||||
|
||||
/* GL_INT and GL_UNSIGNED_INT data is not allowed in OpenGL ES until
|
||||
* 3.0. The 2_10_10_10 types are added in OpenGL ES 3.0 or
|
||||
* GL_OES_vertex_type_10_10_10_2.
|
||||
* GL_OES_vertex_type_10_10_10_2. GL_HALF_FLOAT data is not allowed
|
||||
* until 3.0 or with the GL_OES_vertex_half float extension, which isn't
|
||||
* quite as trivial as we'd like because it uses a different enum value
|
||||
* for GL_HALF_FLOAT_OES.
|
||||
*/
|
||||
if (ctx->Version < 30) {
|
||||
legalTypesMask &= ~(UNSIGNED_INT_BIT
|
||||
| INT_BIT
|
||||
| UNSIGNED_INT_2_10_10_10_REV_BIT
|
||||
| INT_2_10_10_10_REV_BIT);
|
||||
| INT_2_10_10_10_REV_BIT
|
||||
| HALF_BIT);
|
||||
}
|
||||
|
||||
/* BGRA ordering is not supported in ES contexts.
|
||||
@@ -1113,9 +1113,10 @@ _mesa_PrimitiveRestartIndex(GLuint index)
|
||||
|
||||
ASSERT_OUTSIDE_BEGIN_END(ctx);
|
||||
|
||||
if (ctx->Array.RestartIndex != index) {
|
||||
ctx->Array.RestartIndex = index;
|
||||
if (ctx->Array.PrimitiveRestart && ctx->Array._RestartIndex != index) {
|
||||
FLUSH_VERTICES(ctx, _NEW_TRANSFORM);
|
||||
ctx->Array.RestartIndex = index;
|
||||
ctx->Array._RestartIndex = index;
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -323,7 +323,28 @@ compute_version_es2(struct gl_context *ctx)
|
||||
ctx->Extensions.ARB_fragment_shader &&
|
||||
ctx->Extensions.ARB_texture_non_power_of_two &&
|
||||
ctx->Extensions.EXT_blend_equation_separate);
|
||||
if (ver_2_0) {
|
||||
/* FINISHME: This list isn't quite right. */
|
||||
const GLboolean ver_3_0 = (ctx->Extensions.ARB_half_float_vertex &&
|
||||
ctx->Extensions.ARB_map_buffer_range &&
|
||||
ctx->Extensions.ARB_shader_texture_lod &&
|
||||
ctx->Extensions.ARB_texture_float &&
|
||||
ctx->Extensions.ARB_texture_rg &&
|
||||
ctx->Extensions.ARB_texture_compression_rgtc &&
|
||||
ctx->Extensions.EXT_draw_buffers2 &&
|
||||
/* ctx->Extensions.ARB_framebuffer_object && */
|
||||
ctx->Extensions.EXT_framebuffer_sRGB &&
|
||||
ctx->Extensions.EXT_packed_float &&
|
||||
ctx->Extensions.EXT_texture_array &&
|
||||
ctx->Extensions.EXT_texture_shared_exponent &&
|
||||
ctx->Extensions.EXT_transform_feedback &&
|
||||
ctx->Extensions.NV_conditional_render &&
|
||||
ctx->Extensions.ARB_draw_instanced &&
|
||||
ctx->Extensions.ARB_uniform_buffer_object &&
|
||||
ctx->Extensions.EXT_texture_snorm &&
|
||||
ctx->Extensions.NV_primitive_restart);
|
||||
if (ver_3_0) {
|
||||
ctx->Version = 30;
|
||||
} else if (ver_2_0) {
|
||||
ctx->Version = 20;
|
||||
} else {
|
||||
_mesa_problem(ctx, "Incomplete OpenGL ES 2.0 support.");
|
||||
|
@@ -94,6 +94,7 @@ st_BeginQuery(struct gl_context *ctx, struct gl_query_object *q)
|
||||
/* convert GL query type to Gallium query type */
|
||||
switch (q->Target) {
|
||||
case GL_ANY_SAMPLES_PASSED:
|
||||
case GL_ANY_SAMPLES_PASSED_CONSERVATIVE:
|
||||
/* fall-through */
|
||||
case GL_SAMPLES_PASSED_ARB:
|
||||
type = PIPE_QUERY_OCCLUSION_COUNTER;
|
||||
|
@@ -230,8 +230,8 @@ st_draw_vbo(struct gl_context *ctx,
|
||||
/* The VBO module handles restart for the non-indexed GLDrawArrays
|
||||
* so we only set these fields for indexed drawing:
|
||||
*/
|
||||
info.primitive_restart = ctx->Array.PrimitiveRestart;
|
||||
info.restart_index = ctx->Array.RestartIndex;
|
||||
info.primitive_restart = ctx->Array._PrimitiveRestart;
|
||||
info.restart_index = ctx->Array._RestartIndex;
|
||||
}
|
||||
else {
|
||||
/* Transform feedback drawing is always non-indexed. */
|
||||
|
@@ -90,8 +90,8 @@ vbo_get_minmax_index(struct gl_context *ctx,
|
||||
GLuint *min_index, GLuint *max_index,
|
||||
const GLuint count)
|
||||
{
|
||||
const GLboolean restart = ctx->Array.PrimitiveRestart;
|
||||
const GLuint restartIndex = ctx->Array.RestartIndex;
|
||||
const GLboolean restart = ctx->Array._PrimitiveRestart;
|
||||
const GLuint restartIndex = ctx->Array._RestartIndex;
|
||||
const int index_size = vbo_sizeof_ib_type(ib->type);
|
||||
const char *indices;
|
||||
GLuint i;
|
||||
@@ -536,7 +536,7 @@ vbo_handle_primitive_restart(struct gl_context *ctx,
|
||||
|
||||
if ((ib != NULL) &&
|
||||
ctx->Const.PrimitiveRestartInSoftware &&
|
||||
ctx->Array.PrimitiveRestart) {
|
||||
ctx->Array._PrimitiveRestart) {
|
||||
/* Handle primitive restart in software */
|
||||
vbo_sw_primitive_restart(ctx, prim, nr_prims, ib);
|
||||
} else {
|
||||
@@ -572,10 +572,10 @@ vbo_draw_arrays(struct gl_context *ctx, GLenum mode, GLint start,
|
||||
prim[0].base_instance = baseInstance;
|
||||
|
||||
/* Implement the primitive restart index */
|
||||
if (ctx->Array.PrimitiveRestart && ctx->Array.RestartIndex < count) {
|
||||
if (ctx->Array._PrimitiveRestart && ctx->Array._RestartIndex < count) {
|
||||
GLuint primCount = 0;
|
||||
|
||||
if (ctx->Array.RestartIndex == start) {
|
||||
if (ctx->Array._RestartIndex == start) {
|
||||
/* special case: RestartIndex at beginning */
|
||||
if (count > 1) {
|
||||
prim[0].start = start + 1;
|
||||
@@ -583,7 +583,7 @@ vbo_draw_arrays(struct gl_context *ctx, GLenum mode, GLint start,
|
||||
primCount = 1;
|
||||
}
|
||||
}
|
||||
else if (ctx->Array.RestartIndex == start + count - 1) {
|
||||
else if (ctx->Array._RestartIndex == start + count - 1) {
|
||||
/* special case: RestartIndex at end */
|
||||
if (count > 1) {
|
||||
prim[0].start = start;
|
||||
@@ -594,10 +594,10 @@ vbo_draw_arrays(struct gl_context *ctx, GLenum mode, GLint start,
|
||||
else {
|
||||
/* general case: RestartIndex in middle, split into two prims */
|
||||
prim[0].start = start;
|
||||
prim[0].count = ctx->Array.RestartIndex - start;
|
||||
prim[0].count = ctx->Array._RestartIndex - start;
|
||||
|
||||
prim[1] = prim[0];
|
||||
prim[1].start = ctx->Array.RestartIndex + 1;
|
||||
prim[1].start = ctx->Array._RestartIndex + 1;
|
||||
prim[1].count = count - prim[1].start;
|
||||
|
||||
primCount = 2;
|
||||
|
@@ -171,7 +171,7 @@ vbo_sw_primitive_restart(struct gl_context *ctx,
|
||||
GLuint sub_prim_num;
|
||||
GLuint end_index;
|
||||
GLuint sub_end_index;
|
||||
GLuint restart_index = ctx->Array.RestartIndex;
|
||||
GLuint restart_index = ctx->Array._RestartIndex;
|
||||
struct _mesa_prim temp_prim;
|
||||
struct vbo_context *vbo = vbo_context(ctx);
|
||||
vbo_draw_func draw_prims_func = vbo->draw_prims;
|
||||
|
Reference in New Issue
Block a user