aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa/main
Commit message (Collapse)AuthorAgeFilesLines
* mesa: Don't choose S3TC for generic compression if we can't compress.Eric Anholt2013-08-301-4/+8
| | | | | | | | | | | | | If the app is asking us to do GL_COMPRESSED_RGBA, then the app obviously doesn't have pre-compressed data to hand us. So don't choose a storage format that we won't actually be able to compress and store. Fixes black screen in warzone2100 when libtxc_dxtn is not present. Also 66 piglit tests. NOTE: This is a candidate for the 9.2 branch. Reported-by: Paul Wise <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* mesa: Rip out more extension checking from texformat.c.Eric Anholt2013-08-301-10/+4
| | | | | | | | You should only be flagging the formats as supported if you support them anyway. NOTE: This is a candidate for the 9.2 branch. (required for next commit) Reviewed-by: Kenneth Graunke <[email protected]>
* mesa/main: Check for 0 size draws after validation.Fabian Bieler2013-08-271-21/+30
| | | | | | | | | | | | | | | | | | | When validating draw parameters move check for 0 draw count last (drawing with count 0 is not an error), so that other parameters (e.g.: the primitive type) are validated and the correct errors (if applicable) are generated. >From the OpenGL 3.3 spec page 33 (page 48 of the PDF): "[Regarding DrawArraysOneInstance, in terms of which other draw operations are defined:] If count is negative, an INVALID_VALUE error is generated." This patch also changes the bahavior of MultiDrawElements to perform the draw operation if some primitive's index counts are zero. Signed-off-by: Fabian Bieler <[email protected]> Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Paul Berry <[email protected]>
* mesa: init dst values in COPY_CLEAN_4V_TYPE_AS_FLOAT()Brian Paul2013-08-261-1/+2
| | | | | | to silence gcc 4.8.1 warnings. And improve the ASSERT(0) call. Reviewed-by: Chad Versace <[email protected]>
* mesa: Set query->EverBound in glQueryCounter().Kenneth Graunke2013-08-251-0/+1
| | | | | | | | | | | | | | | | | | | | | glIsQuery is supposed to return false for names returned by glGenQueries until their first use. BeginQuery is a use, but QueryCounter is also a use. From the ARB_timer_query spec: "A timer query object is created with the command void QueryCounter(uint id, enum target); [...] If <id> is an unused query object name, the name is marked as used [...]" Fixes Piglit's spec/ARB_timer_query/query-lifetime. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Ian Romanick <[email protected]> Reviewed-by: Chad Versace <[email protected]> Cc: [email protected]
* glsl: Refactor handling of gl_ClipDistance/gl_ClipVertex linkage rules for GS.Paul Berry2013-08-232-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | This patch extracts the following logic from validate_vertex_shader_executable(): (a) Generate an error if the shader writes to both gl_ClipDistance and gl_ClipVertex. (b) Record whether the shader writes to gl_ClipDistance in gl_shader_program for use by the back-end. (c) Record the size of gl_ClipDistance in gl_shader_program for use by transform feedback logic. And moves it into a function that is shared between vertex and geometry shaders. Strictly speaking we only need to have shared logic for (b) and (c) right now (since (a) only matters in compatibility contexts, and we're only implementing geometry shaders in core contexts right now). But the three are closely related enough that it seems sensible to keep them together. Reviewed-by: Kenneth Graunke <[email protected]> Reviewed-by: Ian Romanick <[email protected]> Reviewed-by: Matt Turner <[email protected]>
* mesa: Fix assertion error with glDebugMessageControlTimothy Arceri2013-08-231-13/+2
| | | | | | | | | | | enums were being converted twice resulting in incorrect values. The extra conversion has been removed and the redundant assert is removed also. Cc: 9.2 <[email protected]> Signed-off-by: Timothy Arceri <[email protected]> Reviewed-by: Brian Paul <[email protected]>
* mesa: Specify a better GL_MAX_SERVER_WAIT_TIMEOUT limit.Kenneth Graunke2013-08-221-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | The previous value of (GLuint64) ~0 has some problems: GL_MAX_SERVER_WAIT_TIMEOUT is supposed to be a GLuint64 value, but has to be queried via GetInteger64v(), which returns a GLint64. This means that some applications are likely to treat it as a signed integer, where ~0 means -1. Negative values are nonsensical and problematic. When interpreted correctly, ~0 translates to about 0.58 million years, which seems rather excessive. This patch changes it to 0x1fff7fffffff, which is about 1.11 years. This is still plenty long, and is the same as both an int64 and uint64. Applications that accidentally store it in a 32-bit int/unsigned also get a non-negative value, which is again the same as both int and unsigned. This value was suggested by Ian Romanick. v2: Add the ULL prefix on the constant (suggested by Ian). Fixes Piglit's spec/!OpenGL 3.2/get-integer-64v. Signed-off-by: Kenneth Graunke <[email protected]> Cc: [email protected]
* mesa: Never advertise _S3TC compressed formatsIan Romanick2013-08-211-12/+0
| | | | | | | | | | | | The NVIDIA driver doesn't expose them, and piglit's arb_texture_compression-invalid-formats expects them to not be there. This, with the previous commit, fixes piglit arb_texture_compression-invalid-formats. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Anuj Phogat <[email protected]> Cc: "9.2" <[email protected]>
* mesa: Only advertise GL_ETC1_RGB8_OES in ES contextsIan Romanick2013-08-211-1/+9
| | | | | | | | | There is no extension for this format in desktop GL, so an application can't give the format back to glCompressedTexImage2D. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Anuj Phogat <[email protected]> Cc: "9.2" <[email protected]>
* mesa: use ARRAY_SIZE() macro instead of magic numberBrian Paul2013-08-201-1/+1
| | | | Reviewed-by: Kenneth Graunke <[email protected]>
* mesa: Update the BGRA vertex array error handlingFredrik Höglund2013-08-151-1/+19
| | | | | | | | The error code was changed from INVALID_VALUE to INVALID_OPERATION in OpenGL 3.3. We should also generate an error when size is BGRA and normalized is FALSE. Reviewed-by: Kenneth Graunke <[email protected]>
* mesa: Use _mesa_detach_renderbuffer when deleting a textureIan Romanick2013-08-132-20/+48
| | | | | | | | | | | | | | | | | | | | The functional change is that now invalidate_framebuffer is called if the texture is actually detached from one of the currently bound FBOs. Previously this was only done for renderbuffers. The remaining changes make the texture delete path look more similar to the renderbuffer delete path. This includes adding relevant spec quotations to justify the behavior. Fixes piglit fbo-incomplete "delete texture of bound FBO" test. v2: Move 'fb->Attachment[i].Texture == att' check from previous patch to this patch... where it was intended to be in the first place. Noticed by Chad. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Chad Versace <[email protected]> Cc: "9.2" <[email protected]>
* mesa: Make detach_renderbuffer available outside fbobject.cIan Romanick2013-08-132-9/+38
| | | | | | | | | | | | | | Also add a return value indicating whether any work was done. This will be used by the next patch. v2: Move 'fb->Attachment[i].Texture == att' check to the next patch... where it was intended to be in the first place. Noticed by Chad. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Chad Versace <[email protected]> Cc: "9.2" <[email protected]>
* main: Fix deprecation of glLineWidth()Paul Berry2013-08-091-1/+2
| | | | | | | | | | | | | | | | | | | | | From section E.1 (Profiles and Deprecated Features of OpenGL 3.0) of the OpenGL 3.0 spec: "LineWidth is not deprecated, but values greater than 1.0 will generate an INVALID VALUE error" From context it is clear that values greater than 1.0 should only generate an INVALID VALUE error in a forward-compatible context. The code was correctly quoting this spec text, but it was disallowing all line widths in forward-compatible contexts, instead of just widths greater than 1.0. This patch introduces the correct check, so that setting a line width of 1.0 or less is permitted. Reviewed-by: Matt Turner <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* mesa: Generate a renderbuffer wrapper even if the texture has no imageIan Romanick2013-08-061-2/+3
| | | | | | | | | | This prevents a segfault in check_begin_texture_render when an FBO is rebound while in this state. This fixes the piglit test fbo-incomplete-invalid-texture. Signed-off-by: Ian Romanick <[email protected]> Acked-by: Kenneth Graunke <[email protected]> Cc: "9.1 9.2" [email protected]
* mesa: Validate the layer selection of an array texture tooIan Romanick2013-08-061-4/+30
| | | | | | | | | | | | | | Previously only the slice of a 3D texture was validated in the FBO completeness check. This fixes the failure in the 'invalid layer of an array texture' subtest of piglit's fbo-incomplete test. v2: 1D_ARRAY textures have Depth == 1. Instead, compare against Height. v3: Handle CUBE_MAP_ARRAY textures too. Noticed by Marek. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]> Cc: "9.1 9.2" [email protected]
* mesa: Don't call driver RenderTexture for invalid zoffsetIan Romanick2013-08-061-0/+6
| | | | | | | | | | | | | | | This fixes the segfault in the 'invalid slice of 3D texture' and 'invalid layer of an array texture' subtests of piglit's fbo-incomplete test. The 'invalid layer of an array texture' subtest still fails. v2: Fix off-by-one comparison error noticed by Chris Forbes. Also, 1D_ARRAY textures have Depth == 1. Instead, compare against Height. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]> [v1] Cc: "9.1 9.2" [email protected]
* mesa: Don't call driver RenderTexture for really broken texturesIan Romanick2013-08-061-2/+20
| | | | | | | | | This fixes the segfault in the '0x0 texture' subtest of piglit's fbo-incomplete test. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]> Cc: "9.1 9.2" [email protected]
* mesa: Remove stray debug printfs in attachment completeness codeIan Romanick2013-08-061-2/+0
| | | | | | Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]> Cc: "9.1 9.2" [email protected]
* mesa: Treat glBindFramebuffer and glBindFramebufferEXT more correctlyIan Romanick2013-08-062-11/+19
| | | | | | | | | | | | | | | | | Allow user-generated names for glBindFramebufferEXT on desktop GL. Disallow its use altogether for core profiles. Names bound with glBindFramebuffer in desktop OpenGL are still (incorrectly) shared across the share group instead of being per-context. This gets us a bit closer to being strictly conformant. v2: Disallow glBindFramebufferEXT in 3.1 by not installing it in the dispatch table. Suggested by Jordan. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]> [v1] Reviewed-by: Jordan Justen <[email protected]> [v1] Cc: [email protected]
* mesa: Treat glBindRenderbuffer and glBindRenderbufferEXT correctlyIan Romanick2013-08-062-7/+18
| | | | | | | | | | | | | Allow user-generated names for glBindRenderbufferEXT on desktop GL. Disallow its use altogether for core profiles. v2: Disallow glBindRenderbufferEXT in 3.1 by not installing it in the dispatch table. Suggested by Jordan. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]> [v1] Reviewed-by: Jordan Justen <[email protected]> [v1] Cc: [email protected]
* mesa: Use MIN3 instead of two MIN2s.Matt Turner2013-08-021-4/+5
|
* mesa: Update comments to match newer specs.Matt Turner2013-08-022-2/+2
| | | | | Old GL 1.x specs used 'b' but newer specs use 'p'. The line immediately above the second hunk also uses 'p'.
* main: Warn that geometry shader support is experimental.Paul Berry2013-08-011-0/+6
| | | | | | | | | | | | | | | | | | | Geometry shader support in the Mesa front end is still fairly preliminary. Many features are untested, and the following things are known not to work: - The gl_in interface block - The gl_ClipDistance input - Transform feedback of geometry shader outputs - Constants that are new in GLSL 1.50 (e.g. gl_MaxGeometryInputComponents) This isn't a problem, since no back-end drivers currently enable geometry shaders. However, to make sure no one gets the wrong impression, emit a nasty warning to let the user know that geometry shader support isn't complete. Reviewed-by: Kenneth Graunke <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* glsl: Export the compiler's GS layout qualifiers to the gl_shader.Eric Anholt2013-08-011-0/+18
| | | | | | | | | | | | | | | | Next step is to validate them at link time. v2 (Paul Berry <[email protected]>): Don't attempt to export the layout qualifiers in the event of a compile error, since some of them are set up by ast_to_hir(), and ast_to_hir() isn't guaranteed to have run in the event of a compile error. Reviewed-by: Kenneth Graunke <[email protected]> v3 (Paul Berry <[email protected]>): Use PRIM_UNKNOWN to represent "not set in this shader". Reviewed-by: Ian Romanick <[email protected]>
* main: Fix delete_shader_cb() for geometry shadersPaul Berry2013-08-011-1/+2
| | | | | Reviewed-by: Ian Romanick <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* mesa: Validate the drawing primitive against the geometry shader input ↵Fabian Bieler2013-08-011-0/+68
| | | | | | | | primitive type. Reviewed-by: Paul Berry <[email protected]> Reviewed-by: Ian Romanick <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* mesa/shaderapi: Allow 0 GEOMETRY_VERTICES_OUT.Fabian Bieler2013-08-011-1/+1
| | | | | | | | | | ARB_geometry_shader4 spec Errors: "The error INVALID_VALUE is generated by ProgramParameteriARB if <pname> is GEOMETRY_VERTICES_OUT_ARB and <value> is negative." Reviewed-by: Paul Berry <[email protected]> Reviewed-by: Ian Romanick <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* mesa: Copy linked program data for GS.Paul Berry2013-08-012-1/+12
| | | | | | | | | | The documentation for gl_shader_program.Geom and gl_geometry_program says that the former is copied to the latter at link time, but this wasn't happening. This patch causes _mesa_ir_link_shader() to perform the copy, and updates comment accordingly. Reviewed-by: Ian Romanick <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* mesa: Refactor copying of linked program data.Paul Berry2013-08-013-2/+32
| | | | | | | | | | | | | This patch creates a single function to copy the the UsesClipDistance flag from gl_shader_program.Vert to gl_vertex_program. Previously this logic was duplicated in the i965-specific function brw_link_shader() and the core mesa function _mesa_ir_link_shader(). This logic will have to be expanded to support geometry shaders, and I don't want to have to update it in two separate places. Reviewed-by: Ian Romanick <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* glsl: support compilation of geometry shadersBryan Cain2013-08-011-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | This commit adds all of the parsing and semantics for GLSL 150 style geometry shaders. v2 (Paul Berry <[email protected]>): Add a few missing calls to get_pipeline_stage(). Fix some signed/unsigned comparison warnings. Fix handling of NULL consumer in assign_varying_locations(). v3 (Bryan Cain <[email protected]>): fix indexing order of 2D arrays. Also, allow interpolation qualifiers in geometry shaders. v4 (Paul Berry <[email protected]>): Eliminate get_pipeline_stage()--it is no longer needed thanks to 030ca23 (mesa: renumber shader indices according to their placement in pipeline). Remove 2D stuff. Move vertices_per_prim() to ir.h, so that it will be accessible from outside the linker. Remove inject_num_vertices_visitor. Rework for GLSL 1.50. Reviewed-by: Ian Romanick <[email protected]> v5 (Paul Berry <[email protected]>): Split out do_set_program_inouts() argument refactoring to a separate patch. Move geom_array_resizing_visitor to later in the series. Reviewed-by: Kenneth Graunke <[email protected]>
* mesa: account for geometry shader texture fetches in update_texture_stateBryan Cain2013-08-011-5/+13
| | | | | Reviewed-by: Ian Romanick <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* main: Allow for the possibility of GL 3.2 without ARB_geometry_shader4.Paul Berry2013-08-016-7/+16
| | | | | | | | | | | | | | | | | | | | | | Previously, we assumed that the only way Mesa would expose geometry shader support was via the ARB_geometry_shader4 extension. But this extension has some extra complications over GL 3.2 (interactions with compatibility-only features, and link-time initialization of the constant gl_VerticesIn). So we want to allow for the possibility of supporting GL 3.2 (with GLSL 1.50 style geometry shaders) even if ctx->Extensions.ARB_geometry_shader4 is false. This patch adds a new function, _mesa_has_geometry_shaders(), which returns true if either ARB_geometry_shader4 is supported or the GL version is at least 3.2 desktop. Since compute_version() only enables GL 3.2 functionality when GLSL 1.50 support is present, a sufficient way for a back-end to advertise geometry shader support is to set ctx->Const.GLSLVersion >= 150. v2: Remove unnecessary ctx->Const.GeometryShaders150 constant. Reviewed-by: Ian Romanick <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* main: Fix geometry shader error messages (missing right paren)Paul Berry2013-08-011-3/+3
| | | | | Reviewed-by: Ian Romanick <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* Correct clamping of TEXTURE_{MAX, BASE}_LEVELCorey Richardson2013-08-011-2/+20
| | | | | | | | | | | | | Previously, if TEXTURE_IMMUTABLE_FORMAT was TRUE, the levels were allowed to be set like usual, but ARB_texture_storage states: > if TEXTURE_IMMUTABLE_FORMAT is TRUE, then level_base is clamped to the range > [0, <levels> - 1] and level_max is then clamped to the range [level_base, > <levels> - 1], where <levels> is the parameter passed the call to > TexStorage* for the texture object Reviewed-by: Matt Turner <[email protected]> Signed-off-by: Corey Richardson <[email protected]>
* De-tab and align comments in gl_texture_objectCorey Richardson2013-08-011-22/+23
| | | | | | Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Matt Turner <[email protected]> Signed-off-by: Corey Richardson <[email protected]>
* mesa: fix multisampling proxy textures not being queryableMikko Juola2013-07-311-0/+2
| | | | | | | | | | | | The code that checks if some texture target is valid for glGetTexLevelParameter*() was not programmed to check for multisampling proxy textures. This made it impossible(?) to use the proxy textures for their intended purpose as glGetTexLevelParameter*() would just fail on you. Reviewed-by: Brian Paul <[email protected]> Cc: [email protected]
* mesa: fix proxy textures becoming immutable and unusableMikko Juola2013-07-311-1/+1
| | | | | | | | | | | | | | glTexStorage*() functions make textures immutable. This carries on to proxy textures. Error checking in texture storage functions prevents proxy textures from working after first time because internally, they became immutable. This commit makes the error checking ignore the immutability flag when working with proxy textures. Reviewed-by: Brian Paul <[email protected]> Cc: [email protected]
* mesa: fix proxy textures not working with default texture bindingMikko Juola2013-07-311-1/+1
| | | | | | | | | | | | | When working with the glTexStorage*() functions, the error checking checks that a non-default (i.e., non-zero) texture is currently bound. However, this check made glTexStorage*() functions fail with proxy textures when the default texture is bound. Proxy textures do not care about the current texture bindings so for them this check should not be done. Reviewed-by: Brian Paul <[email protected]> Cc: [email protected]
* mesa: fix number of mipmaps calculation for proxy texturesMikko Juola2013-07-311-0/+10
| | | | | | | | | | | | The function _mesa_get_tex_max_num_levels() is supposed to calculate the number of mipmap levels but it was not written to handle proxy textures, at best returning a maximum of 1 mipmap level. Because of this, at least glTexStorage*() calls would incorrectly fail when used with proxy textures with more than one mipmap level. Reviewed-by: Brian Paul <[email protected]> Cc: [email protected]
* mesa: improve free() cleanup in generate_mipmap_compressed()Brian Paul2013-07-311-10/+7
| | | | | | | | | | Free all our temporary buffers in one place at the end of the function. Fixes memory leak detected by Coverity. Note: This is a candidate for the 9.x branches Cc: [email protected] Reviewed-by: José Fonseca <[email protected]>
* mesa,glsl,st/dri: add a new driconf option force_glsl_version for UnigineMarek Olšák2013-07-301-0/+6
| | | | | | | | See documentation in mtypes.h. Reviewed-by: Kenneth Graunke <[email protected]> Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* mesa: add MESA_GLSL debug flag to dump shaders on compile errorMarek Olšák2013-07-302-5/+15
| | | | | | Reviewed-by: Kenneth Graunke <[email protected]> Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* mesa: default texture buffer format should be R8 in the core profileMarek Olšák2013-07-301-2/+2
| | | | | | | | | Cc: [email protected] Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Ian Romanick <[email protected]> v2: Since we don't expose the extension in the compatibility profile, the "if (API == CORE) .. else .." statement is removed.
* mesa: default DEPTH_TEXTURE_MODE should be RED in the core profileMarek Olšák2013-07-302-4/+6
| | | | | | | Cc: [email protected] Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Ian Romanick <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* mesa: Remove broken assertion about enabled texture targets.Kenneth Graunke2013-07-291-4/+2
| | | | | | | | | | | | | | | For GLSL programs, enabledTargets can have more than one bit set. For example, a shader that uses sampler2D and samplerCube uniforms will have both TEXTURE_2D_BIT and TEXTURE_CUBE_BIT set. The code that sets _ReallyEnabled already handles this, selecting the "highest priority" texture target. We should simply use that. Fixes new Piglit test incomplete-textures-of-multiple-types. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=62698 Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Brian Paul <[email protected]>
* mesa: Expose OES_surfaceless_context.Matt Turner2013-07-291-0/+1
| | | | | | | | | EGL_KHR_surfaceless_context extension allows contexts to be made current without a default winsys fbo. This extension specifies what ES 1.1 and 2.0 should do (the ES 3.0 spec already does). Reviewed-by: Jordan Justen <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* mesa: Return GL_FRAMEBUFFER_UNDEFINED if the winsys fbo is incomplete.Matt Turner2013-07-291-2/+6
| | | | | | | Specified by ARB_framebuffer_object, GL 3.0, and ES 3.0. Reviewed-by: Jordan Justen <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* mesa: Disable GL_EXT_framebuffer_object in core profiles and OpenGL 3.1Ian Romanick2013-07-261-1/+1
| | | | | | | | | | | | GL_EXT_framebuffer_object differs from GL_ARB_framebuffer_object in ways that we can't and don't implement in core profiles. Exposing it is a lie, so we shouldn't do that. It's possible the some other GL_EXT_framebuffer_* extensions should be disabled, but it's not quite so clear cut. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>