Compare commits

...

67 Commits

Author SHA1 Message Date
Jordan Justen
ae0120f247 texformat: use MESA_FORMAT_ARGB2101010 with GL_UNSIGNED_INT_2_10_10_10_REV
Choose MESA_FORMAT_ARGB2101010 when storing
GL_RGBA + GL_UNSIGNED_INT_2_10_10_10_REV or
GL_RGB + GL_UNSIGNED_INT_2_10_10_10_REV.

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
2013-01-04 17:26:02 -08:00
Jordan Justen
787bbe65ff texstore argb2101010: merge GL_RGBA and GL_RGB cases
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
2013-01-04 17:26:02 -08:00
Jordan Justen
5f96348c60 pack: handle GL_RGB+GL_UNSIGNED_INT_2_10_10_10_REV case
For floats, if GL_RGB is the source, then alpha should be set to
1.0F.

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
2013-01-04 17:26:02 -08:00
Jordan Justen
fe23a2c5e1 i965 teximage: allocate texture image buffer for fallback path
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
2013-01-04 17:26:02 -08:00
Jordan Justen
54d744bfc4 i965 teximage: don't call _mesa_store_teximage if format/type==GL_NONE
Mesa core's copyteximage calls the driver with format/type==GL_NONE
to "Allocate texture memory". In this case, we shouldn't call
_mesa_store_teximage.

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
2013-01-04 17:26:01 -08:00
Jordan Justen
b1c62e9533 glformats: allow GL_RGB+GL_UNSIGNED_INT_2_10_10_10_REV for GLES2/3
This format is allowed by the GL_EXT_texture_type_2_10_10_10_REV
extension.

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
2013-01-04 17:26:01 -08:00
Jordan Justen
0faa38ccc6 readpix: for implentation format/type, ignore int vs. non-int check
In ES or GL+GL_ARB_ES2_compatibility, the usage of
format = IMPLEMENTATION_COLOR_READ_FORMAT +
type = IMPLEMENTATION_COLOR_READ_TYPE
can function, even if the src/dst int vs. non-int types
differ.

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
2013-01-04 17:26:01 -08:00
Jordan Justen
ed9f608070 readpix: raise priority of FBO completeness error
GTF/gles3 test suite wants this error to have higher priority
than the type checking.

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
2013-01-04 17:26:01 -08:00
Jordan Justen
b68dc0c5ee readpix: add error checking for GLES3
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
2013-01-04 17:26:01 -08:00
Jordan Justen
add9b77cbd readpix: use integer conversion for RGBA/UNSIGNED_BYTE
If the source read buffer is integer based, and the the read
pixels type is RGBA/UNSIGNED_BYTE, then use the integer pixel
conversion path.

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
2013-01-04 17:26:01 -08:00
Jordan Justen
64e0be7d0b glformats: support _mesa_bytes_per_pixel for 2101010+GL_RGB
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
2013-01-04 17:26:01 -08:00
Jordan Justen
166c4d211d copytexture: update error checking for GLES3
Changes based on GTF/gles3 conformance test suite.

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
2013-01-04 17:26:01 -08:00
Jordan Justen
fef9526cb6 copytexture: make sure is_srgb(src) == is_srgb(dst)
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
2013-01-04 17:26:01 -08:00
Jordan Justen
a33dc45d2f framebuffer: add _mesa_get_read_renderbuffer
This returns the current read renderbuffer for the specified
format type.

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
2013-01-04 17:26:01 -08:00
Jordan Justen
95da613011 copytexture: for GLES make sure integer signed vs. unsigned matches
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
2013-01-04 17:26:01 -08:00
Jordan Justen
9824382dbd glformats: add _mesa_base_format_component_count
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
2013-01-04 17:26:01 -08:00
Matt Turner
067e9170ef teximage: use _mesa_es3_error_check_format_and_type for GLES3
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
2013-01-04 17:26:00 -08:00
Matt Turner
28236b2f28 glformats: add _mesa_es3_error_check_format_and_type
This function checks for ES3 compatible
format/type/internalFormat/dimension combinations.

[jordan.l.justen@intel.com: additional tweaks for gles3-gtf]
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
2013-01-04 17:26:00 -08:00
Jordan Justen
a1ef7b34ce fbobject: add additional fbo completeness checks for GLES
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
2013-01-04 17:26:00 -08:00
Jordan Justen
8d99b25045 glformats: add functions to detect signed/unsigned integer types
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
2013-01-04 17:26:00 -08:00
Jordan Justen
3613e67b4a unpack: support unpacking MESA_FORMAT_ARGB2101010
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
2013-01-04 17:26:00 -08:00
Jordan Justen
566ce73fab pack: adjust clamping for int=>ubyte conversion
gles3conform expects than when converting from a signed
int to an unsigned byte, the output will be clamped at a
max of 0x7f. This impacts conversion from
int16_t => uint8_t and int32_t => uint8_t.

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
2013-01-04 17:26:00 -08:00
Jordan Justen
4fd482b841 fbobject: don't allow LUMINANCE/INTENSITY/ALPHA fbo on GLES
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
2013-01-04 17:26:00 -08:00
Kenneth Graunke
555245eeb7 Fix-up for "mesa: Rework crazy error code rules in glDrawBuffers()."
This should be squashed into the earlier patch when mailing it out for
review or merging it to master.

The error path was missing a "return" like all the other error paths.
Also, we may as well call it glDrawBuffers in the error message since
the ARB suffix doesn't exist in ES 3.
2013-01-04 17:25:29 -08:00
Ian Romanick
e76ddbf0f8 i965: Don't maintain programs for ff state when there is no ff
NOTE: This is a candidate for the 9.0 branch.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
2013-01-04 17:25:29 -08:00
Ian Romanick
8b89a5bbf5 mesa: Don't muck about with ff state when there is no ff
NOTE: This is a candidate for the 9.0 branch.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
2013-01-04 17:25:29 -08:00
Chad Versace
56e2a876e4 egl/dri2: Add plumbing for EGL_OPENGL_ES3_BIT_KHR
Fixes error EGL_BAD_ATTRIBUTE in the tests below on Intel Sandybridge:
    * piglit egl-create-context-verify-gl-flavor, testcase OpenGL ES 3.0
    * gles3conform, revision 19700, when runnning GL3Tests with -fbo

This plumbing is added in order to comply with the EGL_KHR_create_context
spec. According to the EGL_KHR_create_context spec, it is illegal to call
eglCreateContext(EGL_CONTEXT_MAJOR_VERSION_KHR=3) with a config whose
EGL_RENDERABLE_TYPE does not contain the EGL_OPENGL_ES3_BIT_KHR. The
pertinent
portion of the spec is quoted below; the key word is "respectively".

  * If <config> is not a valid EGLConfig, or does not support the
    requested client API, then an EGL_BAD_CONFIG error is generated
    (this includes requesting creation of an OpenGL ES 1.x, 2.0, or
    3.0 context when the EGL_RENDERABLE_TYPE attribute of <config>
    does not contain EGL_OPENGL_ES_BIT, EGL_OPENGL_ES2_BIT, or
    EGL_OPENGL_ES3_BIT_KHR respectively).

To create this patch, I searched for all the ES2 bit plumbing by calling
`git grep "ES2_BIT\|DRI_API_GLES2" src/egl`, and then at each location
added a case for ES3.

Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2013-01-04 17:25:29 -08:00
Chad Versace
acac9cdde0 intel: Expose support for DRI_API_GLES3
If the hardware/driver combo supports GLES3, then set the GLES3 bit in
intel_screen's bitmask of supported DRI API's.  Neither the EGL nor GLX
layer uses the bit yet.

Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2013-01-04 17:25:29 -08:00
Chad Versace
8a88168a90 dri: Define enum __DRI_API_GLES3
This enum corresponds to EGL_OPENGL_ES3_BIT_KHR.
Neither the GLX nor EGL layer use the enum yet.

I don't like the GLES bits. I'd prefer that all GLES APIs be exposed
through a single API bit, as is done in GLX_EXT_create_context_es_profile.
But, we need this GLES3 enum in order to do the plumbing necessary to
correctly support EGL_OPENGL_ES3_BIT_KHR as required by the
EGL_KHR_create_context spec.

Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2013-01-04 17:25:28 -08:00
Chad Versace
18aca7ac5a intel: Move validation of context version into intelInitContext
Each driver (i830, i915, i965) used independent but similar code to
validate the requested context version. With the rececnt arrival of GLES3,
that logic has needed an update. Rather than apply identical updates to
each drivers validation code, let's just move the validation into the
shared routine intelInitContext.

This refactor required some incidental changes to functions
i830CreateContext and intelInitContext. For each function, this patch:
    - Adds context version parameters to the signature.
    - Adds a DRI_CTX_ERROR out param to the signature.
    - Sets the DRI_CTX_ERROR at each early return.

Tested against gen6 with piglit egl-create-context-verify-gl-flavor.
Verified that this patch does not change the set of exposed EGL context
flavors.

Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2013-01-04 17:25:28 -08:00
Chad Versace
4dd38352e5 intel: Set screen's api mask according to hw capabilities (v3)
Before this patch, intelInitScreen2 set DRIScreen::api_mask with the hacky
heuristic below:

    if (gen >= 3)
        api_mask = GL | GLES1 | GLES2;
    else
        api_mask = 0;

This hack was likely broken on gen2 (i830), but I don't care enough to
properly investigate. It appears that every EGLConfig on i830 has
EGL_RENDERABLE_TYPE=0, and thus eglCreateContext will never succeed.
Anyway, moving on to living drivers...

With the arrival of EGL_OPENGL_ES3_BIT_KHR, this heuristic is now
insufficient. We must enable the GLES3 bit if and only if the driver is
capable of creating a GLES3 context. This requires us to determine the
maximum supported context version supported by the hardware/driver for
each api *during initialization of intel_screen*.

Therefore, this patch adds four new fields to intel_screen which indicate
the maximum supported context version for each api:
  max_gl_core_version
  max_gl_compat_version
  max_gl_es1_version
  max_gl_es2_version

The api mask is now correctly set as:

    api_mask = GL;
    if (max_gl_es1_version > 0)
        api_mask |= GLES1;
    if (max_gl_es2_version > 0)
        api_mask |= GLES2;

Tested against gen6 with piglit egl-create-context-verify-gl-flavor.
Verified that this patch does not change the set of exposed EGL context
flavors.

v2:
  - Replace the if-tree on gen with a switch, for Ian.
  - Unconditionally enable the DRI_API_OPENGL bit, for Ian.

v3:
  - Drop max gl version to 1.4 on gen3 if !has_occlusion_query,
    because occlusion queries entered core in 1.5. For Ian.

Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
Reviewed-by: Ian Romanick <ian.d.romanick.intel.com>
2013-01-04 17:25:28 -08:00
Chad Versace
a0333d34a7 i965: Bump maximum supported ES2 context version to 3.0
Since patch "i965: Validate requested GLES context version in
brwCreateContext", we have been able to create ES 3.0 contexts due to the
max version check.  So...bump the max version.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
2013-01-04 17:25:28 -08:00
Paul Berry
5d1c69be02 i965/Gen6+: Enable ARB_ES3_compatibility extension
IMPORTANT: this patch should not be pushed to master until ES3 support
is fully implemented on i965/Gen6+.
2013-01-04 17:25:28 -08:00
Ian Romanick
e68b841b3c i965: Add support for GL_ANY_SAMPLES_PASSED_CONSERVATIVE
We just treat this as an alias for GL_ANY_SAMPLES_PASSED.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2013-01-04 17:25:28 -08:00
Ian Romanick
3b495d815f mesa/es3: Enable ES 3.0 API and shading language version
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
2013-01-04 17:25:28 -08:00
Matt Turner
0538b36bac glcpp: Reject token pasting operator in GLES
The GLSL ES 3.0 spec (Section 12.17) says:
"GLSL ES 1.00 removed token pasting and other functionality."

NOTE: This is a candidate for the stable branches.
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Carl Worth <cworth@cworth.org>
2013-01-04 17:25:28 -08:00
Carl Worth
d3d6e05349 glcpp: Make undefined macros illegal in #if and #elif for GLES3
Simply emitting a nicely-formatted error message if any undefined macro is
encountered in a parser context expecting an expression.

With this commit, the following piglit test now passes:

	spec/glsl-es-3.00/compiler/undefined-macro.vert

Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2013-01-04 17:25:28 -08:00
Carl Worth
4014ee4567 glcpp: Add a flag to the parser state to indicate GLES.
This can be triggered either by creation of a GLES context (with
api == API_OPENGLES2) or else by a #version directive with version
value 100 or with a string of "es" following the version value.

There's no behavioral change with this commit—just preparation for ES-specific
behavior in the preprocessor in the future.

Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2013-01-04 17:25:28 -08:00
Matt Turner
b83a83dcdf mesa: Return INVALID_ENUM for glReadPixels(..., GL_DEPTH_*, ...) on ES 3
I'm not sure if this is the correct fix. The
_mesa_es_error_check_format_and_type function (used above in the ES 1
and 2 cases) was originally added for glTexImage checking and allows
GL_DEPTH_STENCIL/GL_UNSIGNED_INT_24_8 combinations. Using it in ES 3
causes other tests to regress.

Fixes es3conform's packed_depth_stencil_error test.
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> (v1)
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
2013-01-04 17:25:28 -08:00
Matt Turner
19864a4b1c mesa: Return INVALID_OPERATION when type is known but not allowed
INVALID_ENUM is for when the type is simply not known.

Fixes part of es3conform's packed_depth_stencil_error test.
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2013-01-04 17:25:28 -08:00
Matt Turner
24d89bc7ea mesa: Use _mesa_lookup_enum_by_nr in tex*_error_check
Reviewed-by: Brian Paul <brianp@vmware.com>
2013-01-04 17:25:27 -08:00
Matt Turner
84b2017c30 mesa: Allow HALF_FLOAT in glVertexAttribPointer
Fixes es3conform's half_float_max_vertex_dimensions and
half_float_textures tests.
2013-01-04 17:25:27 -08:00
Matt Turner
a9c1fa067c mesa: Reject texture-only formats as renderbuffer formats in ES 3
ES 3 specifies some formats as texture-only (i.e., not available for
renderbuffers).

See the "Required Texture Formats" section (pg 126) of the ES 3 spec.

Fixes es3conform's color_buffer_unsupported_format test.
Acked-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
2013-01-04 17:25:27 -08:00
Kenneth Graunke
d9228105e1 mesa: Fix default value of BUFFER_ACCESS_FLAGS.
According to both the GL 3.0 and ES 3.0 specifications (table 2.7 for GL
and table 2.8 for ES), the default value of BUFFER_ACCESS_FLAGS is
supposed to be zero.

Note that there are two related quantities: the obsolete BUFFER_ACCESS
enum and the new BUFFER_ACCESS_FLAGS bitfield.

BUFFER_ACCESS can only be GL_READ_ONLY, GL_WRITE_ONLY, or GL_READ_WRITE;
BUFFER_ACCESS_FLAGS can easily represent all three via GL_MAP_WRITE_BIT,
GL_MAP_READ_BIT, and their logical or.  It also supports more flags.

Thus, Mesa only stores the bitfield, and simply computes the old enum
when queried, via simplified_access_mode(bufObj->AccessFlags).

The tricky part is that, while BUFFER_ACCESS_FLAGS defaults to 0,
BUFFER_ACCESS defaults to GL_READ_WRITE for desktop [GL 3.0, table 2.8]
and GL_WRITE_ONLY_OES for ES [the GL_EXT_map_buffer_range extension].

Mesa tried to implement this by setting the default AccessFlags to
GL_MAP_READ_BIT | GL_MAP_WRITE_BIT on desktop, and GL_MAP_WRITE_BIT on
ES.  But in all specifications, it needs to be 0.

This patch moves that logic into simplified_access_mode(): when
AccessFlags == 0, it now returns GL_READ_WRITE for desktop and
GL_WRITE_ONLY for ES 1/2.  (BUFFER_ACCESS doesn't exist on ES 3.0,
so it's irrelevant there.)

With that in place, it changes the AccessFlags default to 0.

Fixes three es3conform tsets:
- copy_buffer_defaults
- map_buffer_range_modify_indices
- pixel_buffer_object_default_parameters
2013-01-04 17:25:27 -08:00
Kenneth Graunke
4b7bea48ee mesa: Rework crazy error code rules in glDrawBuffers().
Perhaps most importantly, this patch adds comments quoting the relevant
spec paragraphs above each error condition.

It also makes three changes:
- For FBOs, GL_COLOR_ATTACHMENTm where m >= MaxDrawBuffers is supposed
  to generate INVALID_OPERATION (not INVALID_ENUM).
- Constants that refer to multiple buffers (such as FRONT, BACK, LEFT,
  RIGHT, and FRONT_AND_BACK) are supposed to generate INVALID_OPERATION,
  not INVALID_ENUM.
- In ES 3.0, for FBOs, buffers[i] must be NONE or GL_COLOR_ATTACHMENTi
  or else INVALID_OPERATION occurs.  (This is a new restriction.)

Fixes es3conform's draw-buffers-api test.
2013-01-04 17:25:27 -08:00
Ian Romanick
b1a21a9f7c mesa/es3: Add support for GL_PRIMITIVE_RESTART_FIXED_INDEX
This requires some derived state.  The cut vertex used is either the
value specified by glPrimitiveRestartIndex or it's hard-coded to ~0.
The derived state gl_array_attrib::_RestartIndex captures this value.
In addition, the derived state gl_array_attrib::_PrimitiveRestart is set
whenever either gl_array_attrib::PrimitiveRestart or
gl_array_attrib::PrimitiveRestartFixedIndex is set.

v2: Use _mesa_is_gles3.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
2013-01-04 17:25:27 -08:00
Ian Romanick
f7a82c00cd mesa/es3: Add support for GL_ANY_SAMPLES_PASSED_CONSERVATIVE query target
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
2013-01-04 17:25:27 -08:00
Ian Romanick
d053e8e85b mesa/es3: Allow transpose matrix uniforms in GLES3
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
2013-01-04 17:25:27 -08:00
Matt Turner
0f16eafa17 mesa: Rename and wire-up GetInteger64i_v
The function was named badly and wasn't in the dispatch table,
making it hard to find.

Fixes transform_feedback2_states and gets a few other transform
feedback tests closer to working in es3conform.

Reviewed-by Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2013-01-04 17:25:27 -08:00
Matt Turner
43413b3fdd mesa: Correct glGet{Boolean,Integer}i_v names
Reviewed-by Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2013-01-04 17:25:27 -08:00
Matt Turner
974d48a061 mesa: Allow GL_DEPTH_STENCIL_ATTACHMENT in ES 3
Fixes framebuffer_srgb_default_encoding_fbo and 5 packed_depth_stencil
tests from es3conform.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2013-01-04 17:25:27 -08:00
Chad Versace
173e4f7a42 mesa: Support more glGet enums for ES3
For glGetIntegerv, add support for the following in an OpenGL ES 3.0
context:
    GL_MAJOR_VERSION
    GL_MINOR_VERSION
    GL_NUM_EXTENSIONS

See Table 6.29 of the OpenGL ES 3.0 spec.

Fixes error GL_INVALID_ENUM in piglit egl-create-context-verify-gl-flavor,
testcase for OpenGL ES 3.0.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> (v1)
Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Signed-off-by: Chad Versace <chad.versace@linux.intel.com>
2013-01-04 17:25:26 -08:00
Matt Turner
026099f93a mesa: Support querying GL_MAX_ELEMENT_INDEX in ES 3
The ES 3 spec says that the minumum allowable value is 2^24-1, but the
GL 4.3 and ARB_ES3_compatibility specs require 2^32-1, so return 2^32-1.

Fixes es3conform's element_index_uint_constants test.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2013-01-04 17:25:26 -08:00
Matt Turner
feba88049f mesa: De-duplicate ES2 queries
From GL/GLES/GL_CORE and GLES2 -> GL/GL_CORE/GLES2.

Yes, we really were exposing ES2_compatibility queries on ES 1.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2013-01-04 17:25:26 -08:00
Matt Turner
cf6ddcecda mesa: Allow glGet* queries on EXT_texture_lod_bias data in ES 3
Fixes the remaining 4 texture_lod_bias failures in es3conform.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2013-01-04 17:25:26 -08:00
Matt Turner
244d6eb094 mesa: Allow glGet* queries on EXT_framebuffer_blit data in ES 3
Fixes 2 framebuffer_blit es3conform tests.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2013-01-04 17:25:26 -08:00
Matt Turner
7a4eca8280 mesa: Allow glGet* queries on ARB_fragment/vertex_shader data in ES 3
Fixes uniform_buffer_object_implementation_dependent_limits in
es3conform.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2013-01-04 17:25:26 -08:00
Matt Turner
3d0890d39d mesa: Allow glGet* queries on ARB_framebuffer_object data in ES 3
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2013-01-04 17:25:26 -08:00
Matt Turner
2a18d71dbe mesa: Allow glGet* queries on ARB_transform_feedback2 data in ES 3
Fixes the transform_feedback2_init_defaults test from es3conform.

The ES 3 spec lists these as TRANSFORM_FEEDBACK_PAUSED and
TRANSFORM_FEEDBACK_ACTIVE.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2013-01-04 17:25:26 -08:00
Matt Turner
13fa793585 mesa: Allow glGet* queries on EXT_transform_feedback data in ES 3
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2013-01-04 17:25:26 -08:00
Matt Turner
fca1ec5bfa mesa: Allow glGet* queries on ARB_sync data in ES 3
Fixes the sync_coverage_max_server_wait_timeout test in es3conform.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2013-01-04 17:25:26 -08:00
Matt Turner
5b9df1c245 mesa: Allow glGet* queries of EXT_pbo data in ES 3
Fixes pixel_buffer_object_default_binding and gets other tests in
es3conform closer to passing.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2013-01-04 17:25:26 -08:00
Matt Turner
bdea9b9460 mesa: Allow glGet* queries of select ARB_ubo data in ES 3
Fixes 5 uniform_buffer_object tests in es3conform.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2013-01-04 17:25:26 -08:00
Matt Turner
e1ccb71996 Add ES 3 handling to get.c and get_hash_generator.py
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2013-01-04 17:25:26 -08:00
Matt Turner
db902c4948 glapi: Move ARB_base_instance to the correct location
It's #107, it shouldn't be added after the #116 comment.

Reviewed-by: Fredrik Höglund <fredrik@kde.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2013-01-04 17:25:25 -08:00
Matt Turner
a40737f505 mesa/tests: Add ARB_ES3_compatibility enums
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2013-01-04 17:25:25 -08:00
Matt Turner
dbee8d3ea2 glapi: Add enums for ARB_ES3_compatibility
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2013-01-04 17:25:25 -08:00
62 changed files with 1548 additions and 410 deletions

View File

@@ -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

View File

@@ -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");

View File

@@ -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:

View File

@@ -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;
}

View File

@@ -37,6 +37,7 @@
(EGL_OPENGL_ES_BIT | \
EGL_OPENVG_BIT | \
EGL_OPENGL_ES2_BIT | \
EGL_OPENGL_ES3_BIT_KHR | \
EGL_OPENGL_BIT)

View File

@@ -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 ");

View File

@@ -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;
}

View File

@@ -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;
}

View File

@@ -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,

View File

@@ -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;

View 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>

View File

@@ -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 *"/>

View File

@@ -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

View File

@@ -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. -->

View File

@@ -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:

View File

@@ -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:

View File

@@ -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;
}

View File

@@ -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

View File

@@ -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;
}

View File

@@ -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 );

View File

@@ -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;
}

View File

@@ -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);

View File

@@ -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;
}

View File

@@ -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);

View File

@@ -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)

View File

@@ -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);

View File

@@ -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;

View File

@@ -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);
}
}

View File

@@ -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;
}

View File

@@ -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 */

View File

@@ -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)

View File

@@ -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;

View File

@@ -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;
}

View File

@@ -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))

View File

@@ -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;

View File

@@ -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));

View File

@@ -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.
*/

View File

@@ -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);

View File

@@ -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:

View File

@@ -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 );

View File

@@ -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

View File

@@ -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" ],

View File

@@ -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 */

View File

@@ -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;
}

View File

@@ -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
}

View File

@@ -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;
/**

View File

@@ -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;

View File

@@ -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

View File

@@ -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;
}
}
}

View File

@@ -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);

View File

@@ -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

View File

@@ -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 }
};

View File

@@ -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);

View File

@@ -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;
}
}
}

View File

@@ -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);
}

View File

@@ -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)");

View File

@@ -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;
}
}

View File

@@ -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.");

View File

@@ -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;

View File

@@ -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. */

View File

@@ -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;

View File

@@ -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;