summaryrefslogtreecommitdiffstats
path: root/src/mesa/vbo
Commit message (Collapse)AuthorAgeFilesLines
* mesa: Change args to vbo_count_tessellated_primitives.Paul Berry2012-12-182-16/+21
| | | | | | | | | | | | | | No functional change--this simply paves the way to allow futures patches to call vbo_count_tessellated_primitives() during error checking, before the _mesa_prim struct has been constructed. This will be needed for GLES3, which requires draw calls to fail if there is not enough space available in transform feedback buffers to accommodate the primitives to be drawn. Reviewed-by: Ian Romanick <[email protected]> Reviewed-by: Jordan Justen <[email protected]> Reviewed-by: Brian Paul <[email protected]>
* mesa: don't initialize VBO vtxfmt in _vbo_CreateContextJordan Justen2012-12-163-9/+0
| | | | | | | | The driver should call _mesa_initialize_vbo_vtxfmt after computing the context version. Signed-off-by: Jordan Justen <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* mesa: Rename API_OPENGL to API_OPENGL_COMPAT.Paul Berry2012-11-292-5/+5
| | | | | | | | | | This should help avoid confusion now that we're using the gl_api enum to distinguishing between core and compatibility API's. The corresponding enum value for core API's is API_OPENGL_CORE. Acked-by: Eric Anholt <[email protected]> Acked-by: Matt Turner <[email protected]> Acked-by: Kenneth Graunke <[email protected]>
* vbo: move another line of code after declarationsBrian Paul2012-11-271-1/+1
| | | | Signed-off-by: Brian Paul <[email protected]>
* vbo: move code after declarations to fix MSVC errorsBrian Paul2012-11-271-7/+7
| | | | Reviewed-by: Ian Romanick <[email protected]>
* vbo: minor whitespace fixBrian Paul2012-11-271-1/+1
|
* mesa/vbo: Check for invalid types in various packed vertex functions.Kenneth Graunke2012-11-271-0/+43
| | | | | | | | | | | | | | According to the ARB_vertex_type_2_10_10_10_rev specification: "The error INVALID_ENUM is generated by VertexP*, NormalP*, TexCoordP*, MultiTexCoordP*, ColorP*, or SecondaryColorP if <type> is not UNSIGNED_INT_2_10_10_10_REV or INT_2_10_10_10_REV." Fixes 7 subcases of oglconform's packed-vertex test. v2: Add "gl" prefix to error messages (pointed out by Brian). Also rebase atop the ctx plumbing. Reviewed-by: Brian Paul <[email protected]>
* mesa/vbo: Support the ES 3.0 signed normalized scaling rules.Kenneth Graunke2012-11-271-2/+38
| | | | | | | | | | | | | | Traditionally, OpenGL has had two separate equations for converting from signed normalized fixed-point data to floating point data. One was used primarily for vertex data, while the other was primarily for texturing and framebuffer data. However, ES 3.0 and GL 4.2 change this, declaring there's only one equation to be used in all cases. Unfortunately, it's the other one. v2: Correctly convert 0b10 to -1.0, as pointed out by Chris Forbes. Reviewed-by: Chris Forbes <[email protected]>
* mesa/vbo: Plumb ctx through to the conv_i(10|2)_to_norm_float functions.Kenneth Graunke2012-11-271-59/+59
| | | | | | | | | The rules for converting these values actually depend on the current context API and version. The next patch will implement those changes. v2: Mark ctx as const, as suggested by Brian. Reviewed-by: Chris Forbes <[email protected]>
* mesa/vbo: Fix scaling issue in 2-bit signed normalized packing.Kenneth Graunke2012-11-211-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since a signed 2-bit integer can only represent -1, 0, or 1, it is tempting to simply to convert it directly to a float. This maps it onto the correct range of [-1.0, 1.0]. However, it gives different values compared to the usual equation: (2.0 * 1.0 + 1.0) * (1.0 / 3.0) = +1.0 (same) (2.0 * 0.0 + 1.0) * (1.0 / 3.0) = +0.33333333... (different) (2.0 * -1.0 + 1.0) * (1.0 / 3.0) = -0.33333333... (different) According to the GL_ARB_vertex_type_2_10_10_10_rev extension, signed normalization is performed using equation 2.2 from the GL 3.2 specification, which is: f = (2c + 1)/(2^b - 1). (2.2) Comments below that equation state: "In general, this representation is used for signed normalized fixed-point parameters in GL commands, such as vertex attribute values." Which is what we're doing here. The 3.2 specification goes on to declare an alternate formula: f = max{c/(2^(b-1) - 1), -1.0} (2.3) which is closer to the existing code, and maps the end points to exactly -1.0 and 1.0. Comments below the equation state: "In general, this representation is used for signed normalized fixed-point texture or framebuffer values." Which is *not* what we're doing here. It then states: "Everywhere that signed normalized fixed-point values are converted, the equation used is specified." This is the real clincher: the extension explicitly specifies that we must use equation 2.2, not 2.3. So we need to do (2x + 1) / 3. This matches the behavior expected by oglconform's packed-vertex test, and is correct for desktop GL (pre-4.2). It's not correct for ES 3.0, but a future patch will correct that. Signed-off-by: Kenneth Graunke <[email protected]> Tested-by: Marek Olšák <[email protected]>
* mesa/vbo: Fix scaling issue in 10-bit signed normalized packing.Kenneth Graunke2012-11-211-1/+1
| | | | | | | | | | | | | | | | | | | | For the 10-bit components, the divisor was incorrect. A 10-bit signed integer can represent -2^9 through 2^9 - 1, which leads to the following ranges: (float)value.x -> [ -512, 511] 2.0F * (float)value.x -> [-1024, 1022] 2.0F * (float)value.x + 1.0F -> [-1023, 1023] So dividing by 511 would incorrectly scale it to approximately: [-2.001956947, 2.001956947]. To correctly scale to [-1.0, 1.0], we need to divide by 1023. This correctly implements the desktop GL rules. ES 3.0 has different rules, but those will be implemented in a separate patch. Signed-off-by: Kenneth Graunke <[email protected]> Tested-by: Marek Olšák <[email protected]>
* Remove OpenVMS supportMatt Turner2012-11-161-62/+0
| | | | | | | | | | Not maintained since 2008. Doubtful that it's worked in quite a while. Also see commit 32ac8cb05 which removed VMS stuff from Makefile in 2009. Cc: Jouk Jansen <[email protected]> Reviewed-by: Brian Paul <[email protected]> Signed-off-by: Andreas Boll <[email protected]>
* vbo: use GLuint for numInstances to silence MSVC warningsBrian Paul2012-11-062-2/+2
| | | | Reviewed-by: Jose Fonseca <[email protected]>
* vbo: fix glVertexAttribI* functionsMarek Olšák2012-11-068-62/+139
| | | | | | | | | | | | | | | | | | | | | | The functions were broken, because they converted ints to floats. Now we can finally advertise OpenGL 3.0. ;) In this commit, the vbo module also tracks the type for each attrib in addition to the size. It can be one of FLOAT, INT, UNSIGNED_INT. The little ugliness is the vertex attribs are declared as floats even though there may be integer values. The code just copies integer values into them without any conversion. This implementation passes the glVertexAttribI piglit test which I am going to commit in piglit soon. The test covers vertex arrays, immediate mode and display lists. NOTE: This is a candidate for the stable branches. Reviewed-by: Brian Paul <[email protected]> v2: cosmetic changes as suggested by Brian
* vbo: silence MSVC double/float conversion warningsBrian Paul2012-10-291-2/+2
| | | | Reviewed-by: Jose Fonseca <[email protected]>
* mesa: Add notes about remaining NV_vertex_program code.Eric Anholt2012-10-151-0/+4
| | | | Reviewed-by: Brian Paul <[email protected]>
* mesa: Remove support for NV_vertex_program's attribute evaluation.Eric Anholt2012-10-153-22/+3
| | | | | | | | Note that the MAP2 getters were missing from the implementation. Neat. v2: Rebase on top of get.c changes. Reviewed-by: Brian Paul <[email protected]> (v1)
* mesa: Remove support for NV_vertex_program's special attributes aliasingEric Anholt2012-10-155-39/+0
| | | | Reviewed-by: Brian Paul <[email protected]>
* mesa: remove FEATURE_EXT_transform_feedback define.Oliver McFadden2012-09-151-10/+0
| | | | | Signed-off-by: Oliver McFadden <[email protected]> Reviewed-by: Brian Paul <[email protected]>
* mesa: remove FEATURE_evaluators define.Oliver McFadden2012-09-152-8/+0
| | | | | Signed-off-by: Oliver McFadden <[email protected]> Reviewed-by: Brian Paul <[email protected]>
* mesa: remove FEATURE_dlist define.Oliver McFadden2012-09-156-42/+0
| | | | | Signed-off-by: Oliver McFadden <[email protected]> Reviewed-by: Brian Paul <[email protected]>
* mesa: remove FEATURE_beginend define.Oliver McFadden2012-09-155-109/+0
| | | | | Signed-off-by: Oliver McFadden <[email protected]> Reviewed-by: Brian Paul <[email protected]>
* vbo: add a prefix to count_tessellated_primitivesDave Airlie2012-09-152-2/+2
| | | | | | | | | Just to make it consistent with the rest of vbo, since it would be an exported symbol anyways. Reviewed-by: Matt Turner <[email protected]> Acked-by: Kenneth Graunke <[email protected]> Signed-off-by: Dave Airlie <[email protected]>
* Remove useless checks for NULL before freeingMatt Turner2012-09-053-11/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch has been generated by the following Coccinelle semantic patch: // Remove useless checks for NULL before freeing // // free (NULL) is a no-op, so there is no need to avoid it @@ expression E; @@ + free (E); + E = NULL; - if (unlikely (E != NULL)) { - free(E); ( - E = NULL; | - E = 0; ) ... - } @@ expression E; type T; @@ + free ((T) E); + E = NULL; - if (unlikely (E != NULL)) { - free((T) E); ( - E = NULL; | - E = 0; ) ... - } @@ expression E; @@ + free (E); - if (unlikely (E != NULL)) { - free (E); - } @@ expression E; type T; @@ + free ((T) E); - if (unlikely (E != NULL)) { - free ((T) E); - } Reviewed-by: Brian Paul <[email protected]>
* Don't cast the return value of malloc/reallocMatt Turner2012-09-053-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | This patch has been generated by the following Coccinelle semantic patch: // Don't cast the return value of malloc/realloc. // // Casting the return value of malloc/realloc only stands to hide // errors. @@ type T; expression E1, E2; @@ - (T) ( _mesa_align_calloc(E1, E2) | _mesa_align_malloc(E1, E2) | calloc(E1, E2) | malloc(E1) | realloc(E1, E2) )
* mesa: s/FREE/free/Brian Paul2012-09-013-6/+6
| | | | | | | v2: replace instances in dri/common/ dirs Reviewed-by: Matt Turner <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* mesa: s/MALLOC/malloc/Brian Paul2012-09-011-1/+1
| | | | | | | v2: replace instances in dri/common/ dirs Reviewed-by: Matt Turner <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* mesa: Kill ES2 wrapper functionsIan Romanick2012-08-291-8/+20
| | | | | | | | | v2: Fix completely broken condition around ClearColorIiEXT and ClearColorIuiEXT. v3: Add special VertexAttrib handling for ES2. Signed-off-by: Ian Romanick <[email protected]>
* mesa/es: Validate glMaterial face and pname in Mesa code rather than the ES ↵Ian Romanick2012-08-291-2/+6
| | | | | | wrapper Signed-off-by: Ian Romanick <[email protected]>
* mesa: move more format helper functions to glformats.cBrian Paul2012-07-242-2/+2
|
* mesa: implement new DrawTransformFeedback functionsMarek Olšák2012-07-122-6/+101
| | | | Acked-by: Ian Romanick <[email protected]>
* vbo: optimize validation for glMultiDrawElementsMarek Olšák2012-06-281-12/+6
| | | | | | | | | Some parameters need to be checked only once. check_valid_to_render needs to be called only once. The validate function is based on the one for DrawElements. Reviewed-by: Brian Paul <[email protected]>
* vbo: first ASSERT_OUTSIDE_BEGIN_END then FLUSH, not the other way aroundMarek Olšák2012-06-281-22/+0
| | | | Reviewed-by: Brian Paul <[email protected]>
* vbo: don't call twice _mesa_valid_to_render in DrawArraysInstancedBaseInstanceMarek Olšák2012-06-281-5/+2
| | | | | | It's called in _mesa_validate_DrawArraysInstanced already. Reviewed-by: Brian Paul <[email protected]>
* mesa: more const qualifiers to match the latest glext.hBrian Paul2012-06-273-5/+6
| | | | | | | For some reason regular gcc on Linux didn't catch these but the mingw compiler did (generated errors, not warnings). v2: include the changes in src/mapi/ too
* mesa: rename ColorMaterialBitmask to _ColorMaterialBitmaskBrian Paul2012-06-271-1/+1
| | | | Since it's a derived field.
* mesa: Add support for GL_ARB_base_instanceFredrik Höglund2012-06-195-11/+113
| | | | Reviewed-by: Brian Paul <[email protected]>
* vbo: use software primitive restart in the VBO moduleJordan Justen2012-05-171-6/+37
| | | | | | | | | | When PrimitiveRestartInSoftware is set, the VBO module will handle primitive restart scenarios before calling the vbo->draw_prims drawing function. Signed-off-by: Jordan Justen <[email protected]> Reviewed-by: Ian Romanick <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* vbo: add software primitive restart supportJordan Justen2012-05-172-0/+239
| | | | | | | | | | | vbo_sw_primitive_restart implements primitive restart in software by splitting primitive draws apart. This is based on similar support in mesa/state_tracker/st_draw.c. Signed-off-by: Jordan Justen <[email protected]> Reviewed-by: Ian Romanick <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* mesa: implement DEBUG_ALWAYS_FLUSH debug optionBrian Paul2012-05-112-0/+20
| | | | | | | | This flag has been around for a while but it wasn't actually used anywhere. Now, setting this flag causes a glFlush() to be issued after each drawing call (including glBegin/End, glDrawElements, glDrawArrays, glDrawPixels, glCopyPixels and glBitmap).
* mesa: fix glMaterial / dlist bugBrian Paul2012-05-113-58/+152
| | | | | | | | | | | | | When glColorMaterial() is used to latch glColor commands to a material attribute, glMaterial calls to change that material should become no-ops. This failed to work properly when the glMaterial call was inside a display list. This removes the Material function from the vbo_attrib_tmp.h template file. We have separate/different implementations for the "save" and "exec" cases now. NOTE: This is a candidate for the 8.0 branch.
* vbo: add some commentsBrian Paul2012-05-082-1/+7
|
* mesa: add gl_context::NewDriverState and use it for vertex arraysMarek Olšák2012-05-087-4/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The vbo module recomputes its states if _NEW_ARRAY is set, so it shouldn't use the same flag to notify the driver. Since we've run out of bits in NewState and NewState is for core Mesa anyway, we need to find another way. This patch is the first to start decoupling the state flags meant only for core Mesa and those only for drivers. The idea is to have two flag sets: - gl_context::NewState - used by core Mesa only - gl_context::NewDriverState - used by drivers only (the flags are defined by the driver and opaque to core Mesa) It makes perfect sense to use NewState|=_NEW_ARRAY to notify the vbo module that the user changed vertex arrays, and the vbo module in turn sets a driver-specific flag to notify the driver that it should update its vertex array bindings. The driver decides which bits of NewDriverState should be set and stores them in gl_context::DriverFlags. Then, Core Mesa can do this: ctx->NewDriverState |= ctx->DriverFlags.NewArray; This patch implements this behavior and adapts st/mesa. DriverFlags.NewArray is set to ST_NEW_VERTEX_ARRAYS. Core Mesa only sets NewDriverState. It's the driver's responsibility to read it whenever it wants and reset it to 0. Reviewed-by: Brian Paul <[email protected]>
* mesa: move gl_client_array*[] from vbo_draw_func into gl_contextMarek Olšák2012-05-088-17/+43
| | | | | | | | | | | | | | | | | | In the future we'd like to treat vertex arrays as a state and not as a parameter to the draw function. This is the first step towards that goal. Part of the goal is to avoid array re-validation for every draw call. This commit adds: const struct gl_client_array **gl_context::Array::_DrawArrays. The pointer is changed in: * vbo_draw_method * vbo_rebase_prims - unused by gallium * vbo_split_prims - unused by gallium * st_RasterPos Reviewed-by: Brian Paul <[email protected]>
* vbo: move vbo_draw_method into vbo_context.hMarek Olšák2012-05-085-40/+38
| | | | | | I'll need vbo_context in that function soon. Reviewed-by: Brian Paul <[email protected]>
* vbo: call UpdateState directly when notifying a driver about _NEW_ARRAYMarek Olšák2012-04-234-14/+5
| | | | | | | | Core Mesa doesn't need to know about this. This also removes the hack in recalculate_input_bindings. Reviewed-by: Brian Paul <[email protected]>
* vbo: do FLUSH_CURRENT before validating and updating stateMarek Olšák2012-04-231-10/+16
| | | | | | | | | | This fixes an assertion failure since: commit 81afdd20f3f574ce29559d8ad77df5c77652009e vbo: don't check twice whether it's valid to render FLUSH_CURRENT may set _NEW_CURRENT_ATTRIB. Reviewed-by: Brian Paul <[email protected]>
* vbo: remove vbo_context::mat_currvalMarek Olšák2012-04-195-12/+8
| | | | | Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Mathias Fröhlich <[email protected]>
* vbo: remove vbo_context::generic_currvalMarek Olšák2012-04-197-12/+16
| | | | | Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Mathias Fröhlich <[email protected]>
* vbo: remove vbo_context::legacy_currvalMarek Olšák2012-04-197-16/+14
| | | | | | | | | | | | It's not nice when you have several variables pointing to the same array and you wanna ask your editor "where is this used" and you only get an answer for one of the four currval, legacy_currval, generic_currval, mat_currval, which is quite useless, because you never see the whole picture. Let's get rid of the additional pointers. Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Mathias Fröhlich <[email protected]>