aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa/vbo/vbo_attrib_tmp.h
Commit message (Collapse)AuthorAgeFilesLines
* vbo: pass only either uint32_t or uint64_t into ATTR_UNIONMarek Olšák2020-02-111-7/+8
| | | | | | | This makes the next commit possible. Reviewed-by: Mathias Fröhlich <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3766>
* vbo: move reusable code from vbo_attrib_tmp.h into vbo_util.hMarek Olšák2020-02-041-97/+1
| | | | | Reviewed-by: Kristian H. Kristensen <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3611>
* mesa: Correct the is_vertex_position decision for dlists.Mathias Fröhlich2019-05-041-14/+0
| | | | | | | | | | | | We have to use _mesa_inside_dlist_begin_end instead of _mesa_inside_begin_end to see if we are inside a glBegin/glEnd block in case of display lists. So split the is_vertex_position function used in vertex attribute processing into a imm and dlist variant and use the appropriate _mesa_inside_begin_end variant. Reviewed-by: Brian Paul <[email protected]> Signed-off-by: Mathias Fröhlich <[email protected]>
* mesa: replace some API_OPENGL_CORE checks with _mesa_is_desktop_glMarek Olšák2018-02-231-2/+2
| | | | | | | This is more accurate with respect to the compatibility profile. Tested-by: Dieter Nützel <[email protected]> Reviewed-by: Brian Paul <[email protected]>
* vbo: s/VBO_ATTRIB_INDEX/VBO_ATTRIB_COLOR_INDEX/Brian Paul2018-01-291-2/+2
| | | | | | | | To match the VERT_ATTRIB_COLOR_INDEX name. Give a name to the previously anonymous enum of VBO_ATTRIB_x values. Update the comment on the enum. Reviewed-by: Mathias Fröhlich <[email protected]>
* vbo: fix glVertexAttrib(index=0)Brian Paul2017-08-241-2/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Depending on which extension or GL spec you read the behavior of glVertexAttrib(index=0) either sets the current value for generic attribute 0, or it emits a vertex just like glVertex(). I believe it should do either, depending on context (see below). The piglit gl-2.0-vertex-const-attr test declares two vertex attributes: attribute vec2 vertex; attribute vec4 attr; and the GLSL linker assigns "vertex" to location 0 and "attr" to location 1. The test passes. But if the declarations were reversed such that "attr" was location 0 and "vertex" was location 1, the test would fail to draw properly. The problem is the call to glVertexAttrib(index=0) to set attr's value was interpreted as glVertex() and did not set generic attribute[0]'s value. Interesting, calling glVertex() outside glBegin/End (which is effectively what the piglit test does) does not generate a GL error. I believe the behavior of glVertexAttrib(index=0) should depend on whether it's called inside or outside of glBegin/glEnd(). If inside glBegin/End(), it should act like glVertex(). Else, it should behave like glVertexAttrib(index > 0). This seems to be what NVIDIA does. This patch makes two changes: 1. Check if we're inside glBegin/End for glVertexAttrib() 2. Fix the vertex array binding for recalculate_input_bindings(). As it was, we were using &vbo->currval[VBO_ATTRIB_POS], but that's interpreted as a zero-stride attribute and doesn't make sense for array drawing. No Piglit regressions. Fixes updated gl-2.0-vertex-const-attr test and passes new gl-2.0-vertex-attrib-0 test. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=101941 Reviewed-by: Marek Olšák <[email protected]> Reviewed-by: Charmaine Lee <[email protected]>
* vbo: use new _is_vertex_position() helper in vbo_attrib_tmp.hBrian Paul2017-08-211-36/+46
| | | | | | | Makes the code a bit more understandable. Reviewed-by: Samuel Pitoiset <[email protected]> Reviewed-by: Marek Olšák <[email protected]>
* mesa: add support for unsigned 64-bit vertex attributesSamuel Pitoiset2017-06-141-0/+19
| | | | | | | | This adds support in the VBO and array code to handle unsigned 64-bit vertex attributes as specified by ARB_bindless_texture. Signed-off-by: Samuel Pitoiset <[email protected]> Reviewed-by: Nicolai Hähnle <[email protected]>
* mapi: add GL_ARB_bindless_texture entry pointsSamuel Pitoiset2017-06-141-0/+9
| | | | | Signed-off-by: Samuel Pitoiset <[email protected]> Reviewed-by: Nicolai Hähnle <[email protected]>
* util: Move format_r11g11b10f.h to src/utilJason Ekstrand2016-08-051-1/+1
| | | | | | | It's used from both mesa main and gallium. Signed-off-by: Jason Ekstrand <[email protected]> Reviewed-by: Roland Scheidegger <[email protected]>
* mesa/vbo: fix check for zero aliases with 2/10/10/10Dave Airlie2016-05-101-1/+1
| | | | | | | | | This fixes: GL33-CTS.gtf33.GL3Tests.vertex_type_2_10_10_10_rev.vertex_type_2_10_10_10_rev_attrib Reviewed-by: Kenneth Graunke <[email protected]> Cc: [email protected] Signed-off-by: Dave Airlie <[email protected]>
* mesa/vbo: add support for 64-bit vertex attributes. (v1)Dave Airlie2015-05-081-3/+116
| | | | | | | | | | | | This adds support in the vbo and array code to handle double vertex attributes. v0.2: merge code to handle doubles in vbo layer. v1: don't use v0, merge api_array elt code. Acked-by: Ilia Mirkin <[email protected]> Reviewed-by: Ian Romanick <[email protected]> Signed-off-by: Dave Airlie <[email protected]>
* vbo: improve the code style by adjust the preprocessing c code directivesMarius Predut2015-03-111-41/+33
| | | | | | | | | | Brian Paul review suggestion: there's more macro use here than necessary. Removed and redefine some #define preprocessing directives. Removed the directive input parameter 'T' . No functional changes. Signed-off-by: Marius Predut <[email protected]> Reviewed-by: Brian Paul <[email protected]>
* mesa: use fi_type in vertex attribute codeMarius Predut2015-02-251-4/+18
| | | | | | | | | | | | | | | | | | | | | | | For 32-bit builds, floating point operations use x86 FPU registers, not SSE registers. If we're actually storing an integer in a float variable, the value might get modified when written to memory. This patch changes the VBO code to use the fi_type (float/int union) to store/copy vertex attributes. Also, this can improve performance on x86 because moving floats with integer registers instead of FP registers is faster. Neil Roberts review: - include changes on all places that are storing attribute values. - check with and without -O3 compiler flag. Brian Paul review: - use fi_type type instead gl_constant_value type - fix a bunch of nit-picks. - fix compiler warnings Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=82668 Signed-off-by: Marius Predut <[email protected]> Reviewed-by: Brian Paul <[email protected]>
* vbo: fix an unitialized-variable warningMarek Olšák2015-02-211-0/+1
| | | | | | | It looks like a bug to me. Cc: 10.5 10.4 10.3 <[email protected]> Reviewed-by: Brian Paul <[email protected]>
* mesa: Use location VERT_ATTRIB_GENERIC0 for vertex attribute 0Anuj Phogat2014-05-011-22/+23
| | | | | | | | | | | | | | | | | | | 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]>
* s/Tungsten Graphics/VMware/José Fonseca2014-01-171-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Tungsten Graphics Inc. was acquired by VMware Inc. in 2008. Leaving the old copyright name is creating unnecessary confusion, hence this change. This was the sed script I used: $ cat tg2vmw.sed # Run as: # # git reset --hard HEAD && find include scons src -type f -not -name 'sed*' -print0 | xargs -0 sed -i -f tg2vmw.sed # # Rename copyrights s/Tungsten Gra\(ph\|hp\)ics,\? [iI]nc\.\?\(, Cedar Park\)\?\(, Austin\)\?\(, \(Texas\|TX\)\)\?\.\?/VMware, Inc./g /Copyright/s/Tungsten Graphics\(,\? [iI]nc\.\)\?\(, Cedar Park\)\?\(, Austin\)\?\(, \(Texas\|TX\)\)\?\.\?/VMware, Inc./ s/TUNGSTEN GRAPHICS/VMWARE/g # Rename emails s/[email protected]/[email protected]/ s/[email protected]/[email protected]/g s/jrfonseca-at-tungstengraphics-dot-com/jfonseca-at-vmware-dot-com/ s/jrfonseca\[email protected]/[email protected]/g s/keithw\[email protected]/[email protected]/g s/[email protected]/[email protected]/g s/thomas-at-tungstengraphics-dot-com/thellstom-at-vmware-dot-com/ s/[email protected]/[email protected]/ # Remove dead links s@Tungsten Graphics (http://www.tungstengraphics.com)@Tungsten Graphics@g # C string src/gallium/state_trackers/vega/api_misc.c s/"Tungsten Graphics, Inc"/"VMware, Inc"/ Reviewed-by: Brian Paul <[email protected]>
* vbo: add 10_11_11 support to vbo_attrib_tmpChris Forbes2013-11-081-6/+26
| | | | | Signed-off-by: Chris Forbes <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
* vbo: fix MSVC double->float conversion warningsBrian Paul2013-10-311-2/+2
|
* 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]>
* vbo: fix glVertexAttribI* functionsMarek Olšák2012-11-061-39/+47
| | | | | | | | | | | | | | | | | | | | | | 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: fix glMaterial / dlist bugBrian Paul2012-05-111-58/+0
| | | | | | | | | | | | | 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.
* mesa: s/INLINE/inline/Brian Paul2011-10-011-6/+6
| | | | | | | INLINE is still seen in some files (some generated files, etc) but this is a good start. Acked-by: Kenneth Graunke <[email protected]>
* mesa: fix error handling for glMaterial*Yuanhan Liu2011-09-201-1/+12
| | | | | | | | | | | | | | | Trigger GL_INVALID_ENUM error if the face paramter is not a valid value. Trigger GL_INVALID_VALUE error if the GL_SHININESS value is out side [0, ctx->Constant.MaxShiniess]. v2: fix the max shininess value. v3: suggested by Brian, move the face check into glMaterialfv function to reduce code duplicate. Also, refactor the error message. Signed-off-by: Yuanhan Liu <[email protected]> Signed-off-by: Brian Paul <[email protected]>
* mesa/vbo: s/inline/INLINE/Vinson Lee2011-09-061-6/+6
| | | | MSVC does not support inline keyword.
* mesa/vbo: add ARB_vertex_type_2_10_10_10_rev APIs.Dave Airlie2011-09-061-2/+399
| | | | | | | | | | | | | | | This adds the vertex processing paths for the 2101010 types. It converts the attributes to floats for all the immediate entry points, some entrypoints are normalised and the attrib APIs take a normalized parameter. There are four main paths, ui10 -> float unnormalized i10 -> float unnormalized ui10 -> float normalized i10 -> float normalized along with the ui2/i2 equivs. Signed-off-by: Dave Airlie <[email protected]>
* vbo: generate GL_INVALID_VALUE for bad glVertexAttrib indexBrian Paul2011-03-011-23/+23
|
* mesa: implement integer-valued vertex attribute functionsBrian Paul2010-10-281-0/+201
| | | | The integers still get converted to floats. That'll have to change someday.
* vbo: re-indent fileBrian Paul2010-10-281-181/+234
|
* mesa: rename MAX_VERTEX_ATTRIBS to MAX_VERTEX_GENERIC_ATTRIBSBrian Paul2009-05-221-8/+8
| | | | | Be clearer that this is the number of generic vertex program/shader attributes, not counting the legacy attributes (pos, normal, color, etc).
* Remove special-case handling for index and edgeflagKeith Whitwell2007-01-151-2/+3
| | | | | This isn't required with the changes to core mesa and the new attribute layout.
* Checkpoint of new vbo-building code. Currently builds regular arraysKeith Whitwell2006-10-291-0/+485
rather than VBO's - VBOs are easy but need to look closer at the driver interface. The trivial/tri demo works.