summaryrefslogtreecommitdiffstats
path: root/src/mesa/main
Commit message (Collapse)AuthorAgeFilesLines
* mesa/sso: Enable GL_ARB_separate_shader_objects by defaultIan Romanick2014-05-025-10/+2
| | | | | Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
* sso: Add display list support for ARB_separate_shader_objects new functionsIan Romanick2014-05-021-0/+911
| | | | | | | | With this patch, the piglit arb_separate_shader_object-dlist test passes. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
* mesa/sso: Refactor new function _mesa_bind_pipelineIan Romanick2014-05-022-3/+14
| | | | | | | | | Pull most of the guts out of _mesa_BindPipeline into a new utility function that can be use elsewhere (e.g., meta). Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
* mesa: Enable ARB_multi_bindFredrik Höglund2014-05-021-0/+1
| | | | | Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* mesa: Implement glBindImageTexturesFredrik Höglund2014-05-021-0/+138
| | | | | Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* mesa: Implement glBindVertexBuffersFredrik Höglund2014-05-021-0/+113
| | | | | | | | v2: Use the user provided offset and stride when the buffer ID is zero. Reviewed-by: Brian Paul <[email protected]> (v1) Reviewed-by: Ian Romanick <[email protected]> (v1) Reviewed-by: Kenneth Graunke <[email protected]> (v2)
* mesa: Implement glBindBuffersRangeFredrik Höglund2014-05-021-0/+367
| | | | | Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* mesa: Implement glBindBuffersBaseFredrik Höglund2014-05-021-0/+365
| | | | | Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* mesa: Add _mesa_set_transform_feedback_binding()Fredrik Höglund2014-05-022-9/+15
| | | | | Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* mesa: Refactor set_ubo_binding()Fredrik Höglund2014-05-021-14/+40
| | | | | | | | | Make set_ubo_binding() just update the binding, and move the code that does validation, flushes the vertices etc. into a new bind_uniform_buffer() function. Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* mesa: Add helper functions for looking up multiple buffersFredrik Höglund2014-05-022-0/+86
| | | | | | | | | v2: Document the difference between _mesa_lookup_bufferobj() and _mesa_multi_bind_lookup_bufferobj(). v3: Don't create the buffer objects when they don't exist. Reviewed-by: Brian Paul <[email protected]> (v2) Reviewed-by: Ian Romanick <[email protected]> (v2)
* mesa: Refactor set_atomic_buffer_binding()Fredrik Höglund2014-05-021-16/+40
| | | | | | | | | | Make set_atomic_buffer_binding() just update the binding, and move the code that does validation, flushes the vertices etc. into a new bind_atomic_buffer() function. Reviewed-by: Francisco Jerez <[email protected]> Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* mesa: Implement glBindTexturesFredrik Höglund2014-05-021-0/+120
| | | | | Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* mesa: Add a texUnit parameter to dd_function_table::BindTextureFredrik Höglund2014-05-022-4/+4
| | | | | | | | This is for glBindTextures(), since it doesn't change the active texture unit. Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* mesa: Add helper functions for looking up multiple texturesFredrik Höglund2014-05-022-0/+30
| | | | | Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* mesa: Implement glBindSamplersFredrik Höglund2014-05-021-0/+115
| | | | | Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* glapi: Add infrastructure for ARB_multi_bindFredrik Höglund2014-05-0211-0/+65
| | | | | Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* mesa: Add functions for doing unlocked hash table lookupsFredrik Höglund2014-05-022-9/+89
| | | | | | | | | | | | This patch adds functions for locking/unlocking the mutex, along with _mesa_HashLookupLocked() and _mesa_HashInsertLocked() that do lookups and insertions without locking the mutex. These functions will be used by the ARB_multi_bind entry points to avoid locking/unlocking the mutex for each binding point. Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* mesa: Optimize unbind_texobj_from_texunits()Fredrik Höglund2014-05-021-9/+11
| | | | | | | | | The texture can only be bound to the index that corresponds to its target, so there is no need to loop over all possible indices for every unit and checking if the texture is bound to it. Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* mesa: Add a _BoundTextures field in gl_texture_unitFredrik Höglund2014-05-023-0/+12
| | | | | | | | This will be used by glBindTextures() when unbinding textures, to avoid having to loop over all the targets. Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* mesa: Store the target index in gl_texture_objectFredrik Höglund2014-05-022-0/+4
| | | | | | | | This will be used by glBindTextures() so we don't have to look it up for each texture. Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* mesa: move declarations before code in texstore.cBrian Paul2014-05-011-8/+7
| | | | | | To fix MSVC build. Reviewed-by: Anuj Phogat <[email protected]>
* mesa: Allow FLOAT_32_UNSIGNED_INT_24_8_REV in get_tex_depth_stencil()Anuj Phogat2014-05-011-2/+2
| | | | | | | | Fixes a crash in Khronos OpenGL CTS packed_pixels tests. Cc: <[email protected]> Signed-off-by: Anuj Phogat <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* mesa: Add support to unpack depth-stencil texture in to ↵Anuj Phogat2014-05-012-1/+87
| | | | | | | | | | | | | | | | FLOAT_32_UNSIGNED_INT_24_8_REV V2: Follow the new naming convention for unpack functions. Use double precision for converting Z24 to a float. V3: Unpack stencil value to most significant byte. Use 'struct z32f_x24s8' type. V4: Unpack stencil value to least significant byte. Add a comment to clarify stencil packing. Cc: <[email protected]> Signed-off-by: Anuj Phogat <[email protected]> Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* mesa: Add new helper function _mesa_unpack_depth_stencil_row()Anuj Phogat2014-05-013-6/+32
| | | | | | | | | | This patch makes non-functional changes in the code. New helper function added here will make it easier to support more data types in the following patches. Cc: <[email protected]> Signed-off-by: Anuj Phogat <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* mesa: Remove redundant if checks in _mesa_texstore_xx_xx() functionsAnuj Phogat2014-05-011-89/+80
| | | | | | | | | This patch contains non-functional changes. Assertion checks made earlier in the functions make the if checks redundant. So, remove the if checks and unindent the code in if block. Signed-off-by: Anuj Phogat <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* mesa: Allow srcFormat=GL_DEPTH_STENCIL in _mesa_texstore_xx_xx() functionsAnuj Phogat2014-05-011-2/+4
| | | | | | | | | _mesa_texstore_z24_s8() and _mesa_texstore_z32f_x24s8() are capable of handling GL_DEPTH_STENCIL format. So, allow it in both the functions. Cc: <[email protected]> Signed-off-by: Anuj Phogat <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* mesa: Add missing types in _mesa_texstore_xx_xx() functionsAnuj Phogat2014-05-011-2/+6
| | | | | | | | | | | Depth-stencil teture targets are allowed to use source data of type GL_UNSIGNED_INT_24_8_EXT and GL_FLOAT_32_UNSIGNED_INT_24_8_REV. Fixes few crashes in Khronos OpenGL CTS packed_pixels tests. Cc: <[email protected]> Signed-off-by: Anuj Phogat <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* mesa: Add error condition for format=STENCIL_INDEX in glGetTexImage()Anuj Phogat2014-05-011-0/+5
| | | | | | | | | | From OpenGL 4.0 spec, page 306: "Calling GetTexImage with a format of STENCIL_INDEX causes the error INVALID_ENUM." Cc: <[email protected]> Signed-off-by: Anuj Phogat <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* mesa: Add entry for extension ARB_texture_stencil8Anuj Phogat2014-05-011-0/+1
| | | | | | | | V2: Alphabetize the new entry Cc: <[email protected]> Signed-off-by: Anuj Phogat <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* glsl: Apply the link error conditions to GL_ARB_fragment_coord_conventionsAnuj Phogat2014-05-011-0/+6
| | | | | | | | | | | | | | | Link error conditions added in previous patch are equally applicable to GL_ARB_fragment_coord_conventions implementation. Extension's spec says: "If gl_FragCoord is redeclared in any fragment shader in a program, it must be redeclared in all the fragment shaders in that program that have a static use of gl_FragCoord. All redeclarations of gl_FragCoord in all fragment shaders in a single program must have the same set of qualifiers." Signed-off-by: Anuj Phogat <[email protected]> Cc: <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* glsl: Link error if fs defines conflicting qualifiers for gl_FragCoordAnuj Phogat2014-05-011-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | GLSL 1.50 spec says: "If gl_FragCoord is redeclared in any fragment shader in a program, it must be redeclared in all the fragment shaders in that program that have a static use gl_FragCoord. All redeclarations of gl_FragCoord in all fragment shaders in a single program must have the same set of qualifiers." This patch causes the shader link to fail if we have multiple fragment shaders with conflicting layout qualifiers for gl_FragCoord. V2: Restructure the code and add conditions to correctly handle the following case: fragment shader 1: layout(origin_upper_left) in vec4 gl_FragCoord; void main() { foo(); gl_FragColor = gl_FragData; } fragment shader 2: layout(pixel_center_integer) in vec4 gl_FragCoord; void foo() { } V3: Allow linking in the following case: fragment shader 1: void main() { foo(); gl_FragColor = gl_FragCoord; } fragment shader 2: in vec4 gl_FragCoord; void foo() { ... } Signed-off-by: Anuj Phogat <[email protected]> Cc: <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* mesa: Use location VERT_ATTRIB_GENERIC0 for vertex attribute 0Anuj Phogat2014-05-012-7/+17
| | | | | | | | | | | | | | | | | | | In OpenGL 3.1 attribute 0 becomes non-magic, just like in OpenGL ES 2.0. Earlier versions of OpenGL used attribute 0 exclusively for vertex position. V2: Add a utility function _mesa_attr_zero_aliases_vertex() in varray.h Fixes 4 Khronos OpenGL CTS failures: glGetVertexAttrib depth24_basic depth24_precision rgb8_rgba8_rgb Cc: <[email protected]> Signed-off-by: Anuj Phogat <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* mesa: Fix querying location of nth element of an array variableAnuj Phogat2014-05-011-5/+66
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch makes changes to the behavior of glGetAttribLocation(), glGetFragDataLocation() and glGetFragDataIndex() functions. Code changes handle a case described in following example: shader program: layout(location = 1)in vec4[4] a; void main() { } Currently, glGetAttribLocation("a") returns 1. glGetAttribLocation("a[i]"), where i = {0, 1, 2, 3}, returns -1. But the expected locations for array elements are: 1, 2, 3 and 4 respectively. This clarification came up with the addition of ARB_program_interface_query to OpenGL 4.3. From Page 326 (page 347 of the PDF) of OpenGL 4.3 spec: "Otherwise, the command is equivalent to GetProgramResourceLocation(program, PROGRAM_INPUT, name);" And, From Page 101 (page 122 of the PDF) of OpenGL 4.3 spec: "A string provided to GetProgramResourceLocation or GetProgramResourceLocationIndex is considered to match an active variable if • the string exactly matches the name of the active variable; • if the string identifies the base name of an active array, where the string would exactly match the name of the variable if the suffix "[0]" were appended to the string; or • if the string identifies an active element of the array, where the string ends with the concatenation of the "[" character, an integer (with no "+" sign, extra leading zeroes, or whitespace) identifying an array element, and the "]" character, the integer is less than the number of active elements of the array variable, and where the string would exactly match the enumerated name of the array if the decimal integer were replaced with zero." V2: Simplify get_matching_index() function. Add relevant text from OpenGL spec in commit message. Fixes failures in Khronos OpenGL CTS tests: explicit_attrib_location_room draw_instanced_max_vertex_attribs Proprietary linux drivers of NVIDIA (331.49) matches the behavior expected by OpenGL 4.3 spec. Cc: <[email protected]> Signed-off-by: Anuj Phogat <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* mesa: Move declaration to top of block.José Fonseca2014-05-011-1/+2
| | | | To fix MSVC build. Trivial.
* mesa: Track maximum CurrentTexUnit to reduce glDeleteTextures() overhead.Eric Anholt2014-04-303-1/+12
| | | | | | | | No more walking 96*6 pointers looking to see if they're the current texture, when we only use the first 2 out of 96 units. -6.26002% +/- 1.87817% effect on cairo runtime on no-fbo-cache glamor (n=36). Reviewed-by: Kenneth Graunke <[email protected]>
* mesa: Rewrite shader-based texture image state updates.Eric Anholt2014-04-301-49/+73
| | | | | | | | | | | Instead of walking 6 shader stages for each of the 96 combined texture image units, now we just walk the samplers used in each shader stage. With cairo-perf-trace on Xephyr with glamor, I'm seeing a -6.50518% +/- 2.55601% effect on runtime (n=22) since the "drop _EnabledUnits" change. No significant performance difference on an apitrace of minecraft (n=442). Reviewed-by: Kenneth Graunke <[email protected]>
* mesa: Split the shader texture update logic from fixed function.Eric Anholt2014-04-301-90/+160
| | | | | | | | | | | | I want to avoid walking the entire long array texture image units, but the obvious way to do so means walking program samplers, and thus hitting the units in a random order. This change replaces the previous behavior of only setting up the fallback texture for a fragment shader with setting up the fallback texture for any shader that's missing a complete texture of the right target in its unit. Reviewed-by: Kenneth Graunke <[email protected]>
* mesa: Finish removing the _ReallyEnabled field.Eric Anholt2014-04-302-8/+2
| | | | | Reviewed-by: Matt Turner <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* mesa: Drop _ReallyEnabled usage from ff_fragment_shader.Eric Anholt2014-04-301-14/+3
| | | | | Reviewed-by: Matt Turner <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* mesa: Replace use of _ReallyEnabled as a boolean with use of _Current.Eric Anholt2014-04-303-3/+3
| | | | | | | | | | | | | I'm probably not the only person that has tried to kill _ReallyEnabled. This does the mechanical part of the work, and cleans _ReallyEnabled from i965. I think that using _Current makes texture management clearer: You can't have multiple targets in use in the same texture image unit at the same time, because there's just that one pointer. Reviewed-by: Matt Turner <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* mesa: Ensure that (unit->_Current != 0) == (unit->_ReallyEnabled != 0).Eric Anholt2014-04-301-0/+2
| | | | | | | | I'm going to try to delete _ReallyEnabled, which is this weird bitfield with either 0 or 1 bits set with just the reference to _Current. Reviewed-by: Matt Turner <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* mesa: Drop _EnabledUnits.Eric Anholt2014-04-303-8/+1
| | | | | | | | | | | The field wasn't really valid, since we've got more than 32 units now. It turns out it was mostly just used for checking != 0, or checking for fixed function coordinates, though. v2: Fix mis-conversion in xm_line.c (caught by Ken). Reviewed-by: Matt Turner <[email protected]> (v1) Reviewed-by: Kenneth Graunke <[email protected]>
* mesa: change invalid texture swizzle error to GL_INVALID_ENUMBrian Paul2014-04-301-2/+2
| | | | | | | | | The original GL_EXT_texture_swizzle extensions said GL_INVALID_OPERATION was to be generated when the an invalid swizzle was passed to glTexParameter(). But in OpenGL 3.3 and later, the error should be GL_INVALID_ENUM. Reviewed-by: Ian Romanick <[email protected]>
* mesa: overhaul debug namespace supportChia-I Wu2014-04-271-178/+88
| | | | | | | | | | | | | | | | | | _mesa_HashTable is not well-suited for us: it locks a mutex unnecessarily and it does not accept 0 as the key (and have branches to handle 1 specially). What we really need is a sparse array. Whether it should be implemented as a hash table, a list, or a bsearch()-able array requires investigations of the use models. We choose to implement it as a list for now, assuming it is common to have a short list of IDs in each (source, type) namespace. The code is simpler, and the memory footprint is lower. This also fixes several corner cases such as making messages to have different states at different severities. v2: use GLbitfield for State/DefaultState, and add a comment Signed-off-by: Chia-I Wu <[email protected]> Reviewed-by: Brian Paul <[email protected]>
* mesa: delay copying of debug groupsChia-I Wu2014-04-271-41/+89
| | | | | | | | | | | | Do not copy the debug group until it is about to be written. One likely scenario of using glPushDebugGroup/glPopDebugGroup is to enclose a sequence of GL commands and give them a human-readable description. There is no message control change in this scenario, and thus no need to copy. This also reduces the initial size of gl_debug_state from 306KB to 7KB. Signed-off-by: Chia-I Wu <[email protected]> Reviewed-by: Brian Paul <[email protected]>
* mesa: clean up debug output namespace handlingChia-I Wu2014-04-271-139/+211
| | | | | | | | | | | | | | | | | | Add functions to provide these operations on a struct gl_debug_namespace: init(): initialize the namespace copy(): copy all elements from one namespace to another clear(): clear all elements (to free the memories) set(): set the value of an element set_all(): set the value of all elements get(): get the value of an element A debug namespace is like a sparse array. The length of the array is huge, 2^sizeof(GLuint), but most of the elements assume the same value sepcified by set_all(). Signed-off-by: Chia-I Wu <[email protected]> Reviewed-by: Brian Paul <[email protected]>
* mesa: clean up debug groupsChia-I Wu2014-04-271-42/+48
| | | | | | | | | | | | Add struct gl_debug_group to hold all namespaces of a debug group. Replace the 3-dimensional array, Namespaces, in struct gl_debug_state by a 1-dimensional array of type struct gl_debug_groups. Turn the 4-dimensional array, Defaults, in struct gl_debug_state to a 1-dimensional array in struct gl_debug_namespace. Signed-off-by: Chia-I Wu <[email protected]> Reviewed-by: Brian Paul <[email protected]>
* mesa: clean up debug message logChia-I Wu2014-04-271-36/+42
| | | | | | | | | Remove NextMsgLength, and move members of struct gl_debug_state that belong to the message log to a new struct, gl_debug_log. Rename gl_debug_msg to gl_debug_message. Signed-off-by: Chia-I Wu <[email protected]> Reviewed-by: Brian Paul <[email protected]>
* mesa: use accessors for struct gl_debug_stateChia-I Wu2014-04-276-101/+154
| | | | | | | | | | | | | | | | When GL_DEBUG_OUTPUT_SYNCHRONOUS is GL_TRUE, drivers are allowed to log debug messages from other threads. That requires gl_debug_state to be protected by a mutex, even when it is a context state. While we do not spawn threads in Mesa yet, this commit makes it easier to do when we want to. Since the definition of struct gl_debug_state is no longer needed by the rest of the driver, move it to main/errors.c. This should make it even harder to use the struct incorrectly. v2: add comments for the accessors Signed-off-by: Chia-I Wu <[email protected]> Reviewed-by: Brian Paul <[email protected]>