summaryrefslogtreecommitdiff
path: root/src/mesa/tnl
AgeCommit message (Collapse)AuthorFilesLines
2020-04-21Replace IS_INF_OR_NAN with util_is_inf_or_nanDylan Baker3-6/+6
Reviewed-by: Marek Olšák <marek.olsak@amd.com> Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com> Reviewed-by: Matt Turner <mattst88@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3024>
2020-04-21replace _mesa_is_pow_two with util_is_power_of_two_*Dylan Baker1-1/+1
Mostly this uses util_is_power_of_two_or_zero, which has the same behavior as _mesa_is_pow_two when the input is zero. In cases where the value is known to be != 0 ahead of time I used the _nonzero variant as it may be faster on some platforms. Reviewed-by: Eric Anholt <eric@anholt.net> Reviewed-by: Marek Olšák <marek.olsak@amd.com> Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com> Reviewed-by: Matt Turner <mattst88@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3024>
2020-04-13tnl: Code formatting in t_rebase.cIan Romanick1-60/+51
Many little changes. Almost everything is indentation or removal of trailing whitespace. Some places move a loop variable declaration to the loop. Some comments either re-wrapped or converted to single line. Reviewed-by: Marek Olšák <marek.olsak@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4512>
2020-04-13tnl: Code formatting in t_draw.cIan Romanick1-140/+132
So many little changes. Almost everything is indentation or removal of trailing whitespace. There's a couple places where an "else" is moved to the previous line with the "}". Some places move a loop variable declaration to the loop. One change of assert to unreachable. Reviewed-by: Marek Olšák <marek.olsak@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4512>
2020-04-13tnl: Silence unused parameter warnings in _tnl_split_inplaceIan Romanick3-10/+2
Unused since db0eb3a437f ("vbo: Fix up in-place splitting for non-contiguous/indexed primitives.") which landed in 2010. src/mesa/tnl/t_split_inplace.c: In function ‘_tnl_split_inplace’: src/mesa/tnl/t_split_inplace.c:270:27: warning: unused parameter ‘min_index’ [-Wunused-parameter] 270 | GLuint min_index, | ~~~~~~~^~~~~~~~~ src/mesa/tnl/t_split_inplace.c:271:27: warning: unused parameter ‘max_index’ [-Wunused-parameter] 271 | GLuint max_index, | ~~~~~~~^~~~~~~~~ Reviewed-by: Marek Olšák <marek.olsak@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4512>
2020-04-13tnl: Silence unused parameter warnings in dump_draw_infoIan Romanick1-10/+4
src/mesa/tnl/t_split_copy.c: In function ‘dump_draw_info’: src/mesa/tnl/t_split_copy.c:149:35: warning: unused parameter ‘ctx’ [-Wunused-parameter] 149 | dump_draw_info(struct gl_context *ctx, | ~~~~~~~~~~~~~~~~~~~^~~ src/mesa/tnl/t_split_copy.c:154:23: warning: unused parameter ‘min_index’ [-Wunused-parameter] 154 | GLuint min_index, | ~~~~~~~^~~~~~~~~ src/mesa/tnl/t_split_copy.c:155:23: warning: unused parameter ‘max_index’ [-Wunused-parameter] 155 | GLuint max_index) | ~~~~~~~^~~~~~~~~ Reviewed-by: Marek Olšák <marek.olsak@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4512>
2020-04-13tnl: Silence unused parameter warnings in _tnl_draw_primsIan Romanick5-18/+9
A tangled mess of a couple parameters that nobody wanted. src/mesa/tnl/t_draw.c: In function ‘_tnl_draw_prims’: src/mesa/tnl/t_draw.c:440:42: warning: unused parameter ‘tfb_vertcount’ [-Wunused-parameter] 440 | struct gl_transform_feedback_object *tfb_vertcount, | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~ src/mesa/tnl/t_draw.c:441:35: warning: unused parameter ‘stream’ [-Wunused-parameter] 441 | unsigned stream) | ~~~~~~~~~^~~~~~ Reviewed-by: Marek Olšák <marek.olsak@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4512>
2020-04-13tnl: Silence unused parameter 'attrib' warning in convert_half_to_floatIan Romanick1-8/+7
Also clean up some trivial code / whitespace style issues. src/mesa/tnl/t_draw.c: In function ‘convert_half_to_float’: src/mesa/tnl/t_draw.c:121:57: warning: unused parameter ‘attrib’ [-Wunused-parameter] 121 | const struct gl_array_attributes *attrib, | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~ Reviewed-by: Marek Olšák <marek.olsak@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4512>
2020-04-13tnl: Don't dereference NULL obj pointer in t_rebase_primsIan Romanick1-10/+13
Structurally the code is now similar to the handling of other gl_buffer_object::obj pointers elsewhere in TNL. The fixes tag is a little bit misleading. I think the change in that commit just exposes a previously existing bug. Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/2746 Fixes: f3cce7087a5 ("mesa: don't ever bind NullBufferObj for glBindBuffer targets") Reviewed-by: Marek Olšák <marek.olsak@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4512>
2020-04-13tnl: Don't dereference NULL obj pointer in replay_initIan Romanick1-8/+10
Structurally the code is now similar to the handling of other gl_buffer_object::obj pointers elsewhere in TNL. The fixes tag is a little bit misleading. I think the change in that commit just exposes a previously existing bug. Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/2746 Fixes: f3cce7087a5 ("mesa: don't ever bind NullBufferObj for glBindBuffer targets") Reviewed-by: Marek Olšák <marek.olsak@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4512>
2020-04-13tnl: Don't dereference NULL obj pointer in bind_indicesIan Romanick1-14/+16
Structurally the code is now similar to bind_inputs. The fixes tag is a little bit misleading. I think the change in that commit just exposes a previously existing bug. Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/2746 Fixes: f3cce7087a5 ("mesa: don't ever bind NullBufferObj for glBindBuffer targets") Reviewed-by: Marek Olšák <marek.olsak@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4512>
2020-04-06mesa: remove no longer needed _mesa_is_bufferobj functionMarek Olšák3-7/+7
All buffers have Name != 0. Note that there is no longer the pointer dereference to get Name, so it's faster. Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4466>
2020-04-06mesa: don't ever bind NullBufferObj for glBindBuffer targetsMarek Olšák3-4/+4
Since VAOs don't use NullBufferObj for vertex attribs anymore, let's remove more uses of NullBufferObj. Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4466>
2020-04-06mesa: don't ever set NullBufferObj in gl_vertex_array_bindingMarek Olšák1-7/+11
This improves performance by 5% in the game "torcs", FPS: 98.83 -> 103.73 It does a lot of glPush/PopClientAttrib, which exacerbates the overhead of setting NullBufferObj. Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4466>
2020-03-27Move compiler.h and imports.h/c from src/mesa/main into src/utilMarek Olšák15-15/+15
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4324>
2020-03-04mesa: remove _mesa_index_buffer::index_size in favor of index_size_shiftMarek Olšák4-16/+13
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com> Suggested-by: Ian Romanick <ian.d.romanick@intel.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4052>
2020-03-04mesa: add index_size_shift = log2(index_size) into _mesa_index_bufferMarek Olšák3-0/+3
for faster division Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com> Reviewed-by: Ian Romanick <ian.d.romanic@intel.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4052>
2020-02-28mesa: move num_instances and base_instance out of _mesa_primMarek Olšák8-12/+39
They are never used by multi draws and internal draws. Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com> Reviewed-by: Ian Romanick <ian.d.romanick@intel.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3990>
2020-02-28mesa: remove redundant _mesa_prim::is_indexedMarek Olšák1-1/+0
Instead, check (ib != NULL) like all other drivers. Reviewed-by: Ian Romanick <ian.d.romanick@intel.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3990>
2020-02-28mesa: remove unused "indirect" parameter from Driver.DrawMarek Olšák5-13/+9
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3990>
2018-11-21mesa: Factor out struct gl_vertex_format.Mathias Fröhlich2-23/+17
Factor out struct gl_vertex_format from array attributes. The data type is supposed to describe the type of a vertex element. At this current stage the data type is only used with the VAO, but actually is useful in various other places. Due to the bitfields being used, special care needs to be taken for the glGet code paths. v2: Change unsigned char -> GLubyte. Use struct assignment for struct gl_vertex_format. Reviewed-by: Brian Paul <brianp@vmware.com> Reviewed-by: Marek Olšák <marek.olsak@amd.com> Signed-off-by: Mathias Fröhlich <Mathias.Froehlich@web.de>
2018-11-21tnl: Use gl_array_attribute::_ElementSize.Mathias Fröhlich1-9/+2
Instead of open coding the size computation, use the already available gl_array_attribute::_ElementSize value. Reviewed-by: Brian Paul <brianp@vmware.com> Reviewed-by: Marek Olšák <marek.olsak@amd.com> Signed-off-by: Mathias Fröhlich <Mathias.Froehlich@web.de>
2018-09-06tnl: Fix green gun regression in xonotic.Mathias Fröhlich1-1/+1
Fix an other regression of mesa: Make gl_vertex_array contain pointers to first order VAO members. The regression showed up with drivers using the tnl module and was reproducible using xonotic-glx -benchmark demos/the-big-keybench.dem. Fixes: 64d2a204805 mesa: Make gl_vertex_array contain pointers to first order VAO members. Tested-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Reviewed-by: Ian Romanick <ian.d.romanick@intel.com> Signed-off-by: Mathias Fröhlich <Mathias.Froehlich@web.de>
2018-08-28mesa: Add support for AMD_depth_clamp_separateSagar Ghuge2-5/+9
Enable _mesa_PushAttrib() and _mesa_PopAttrib() to handle GL_DEPTH_CLAMP_NEAR_AMD and GL_DEPTH_CLAMP_FAR_AMD tokens. Remove DepthClamp, because DepthClampNear + DepthClampFar replaces it, as suggested by Marek Olsak. Driver that enables AMD_depth_clamp_separate will only ever look at DepthClampNear and DepthClampFar, as suggested by Ian Romanick. v2: 1) Remove unnecessary parentheses (Marek Olsak) 2) if AMD_depth_clamp_separate is unsupported, TEST_AND_UPDATE GL_DEPTH_CLAMP only (Marek Olsak) 3) Clamp against near and far plane separately (Marek Olsak) 4) Clip point separately for near and far Z clipping plane (Marek Olsak) v3: Clamp raster position zw to the range [min(n,f), 0] for near plane and [0, max(n,f)] for far plane (Marek Olsak) v4: Use MIN2 and MAX2 instead of CLAMP (Marek Olsak) Signed-off-by: Sagar Ghuge <sagar.ghuge@intel.com> Reviewed-by: Ian Romanick <ian.d.romanick@intel.com> Reviewed-by: Marek Olšák <marek.olsak@amd.com>
2018-05-10mesa/vbo/tnl: Move gl_vertex_array related stuff to tnl.Mathias Fröhlich10-34/+180
The only remaining users of gl_vertex_array are tnl based drivers. So move everything related to that into tnl and rename it accordingly. Reviewed-by: Brian Paul <brianp@vmware.com> Signed-off-by: Mathias Fröhlich <Mathias.Froehlich@web.de>
2018-05-10mesa: Remove Array._DrawArrays.Mathias Fröhlich2-7/+6
Only tnl based drivers still use this array. So remove it from core mesa and use Array._DrawVAO instead. Reviewed-by: Brian Paul <brianp@vmware.com> Signed-off-by: Mathias Fröhlich <Mathias.Froehlich@web.de>
2018-04-12mesa: include mtypes.h lessMarek Olšák4-0/+6
- remove mtypes.h from most header files - add main/menums.h for often used definitions - remove main/core.h v2: fix radv build Reviewed-by: Brian Paul <brianp@vmware.com>
2018-03-31vbo: Move vbo_split into the tnl module.Mathias Fröhlich8-7/+1258
Move the files, adapt to the naming scheme in tnl, update callers and build system. Reviewed-by: Brian Paul <brianp@vmware.com> Signed-off-by: Mathias Fröhlich <Mathias.Froehlich@web.de>
2018-03-31vbo: Readd the arrays argument to the legacy draw methods.Mathias Fröhlich3-11/+7
The legacy draw paths from back before 2012 contained a gl_vertex_array array for the inputs to be used for draw. So all draw methods from legacy drivers and everything that goes through tnl are originally written for this calling convention. The same goes for tools like t_rebase or vbo_split*, that even partly still have the original calling convention with a currently unused such pointer. Back in 2012 patch 50f7e75 mesa: move gl_client_array*[] from vbo_draw_func into gl_context introduced Array._DrawArrays, which was something that was IMO aiming for a similar direction than Array._DrawVAO introduced recently. Now several tools like t_rebase and vbo_split*, which are mostly used by tnl based drivers, would need to be converted to use the internal Array._DrawVAO instead of Array._DrawArrays. The same goes for the driver backends that use any of these tools. Alternatively we can reintroduce the gl_vertex_array array in its call argument list and put these tools finally into the tnl directory. So this change reintroduces this gl_vertex_array array for the legacy draw paths that are still required for the tools t_rebase and vbo_split*. A followup will move vbo_split also into tnl. Note that none of the affected drivers use the DriverFlags.NewArray driver bit. So it should be safe to remove this also for the legacy draw path. Reviewed-by: Brian Paul <brianp@vmware.com> Signed-off-by: Mathias Fröhlich <Mathias.Froehlich@web.de>
2018-03-31tnl: Push down the gl_vertex_array inputs into tnl drivers.Mathias Fröhlich4-6/+59
Reviewed-by: Brian Paul <brianp@vmware.com> Signed-off-by: Mathias Fröhlich <Mathias.Froehlich@web.de>
2018-03-10mesa: Make gl_vertex_array contain pointers to first order VAO members.Mathias Fröhlich3-52/+65
Instead of keeping a copy of the vertex array content in struct gl_vertex_array only keep pointers to the first order information originaly in the VAO. For that represent the current values by struct gl_array_attributes and struct gl_vertex_buffer_binding. v2: Change comments. Remove gl... prefix from variables except in the i965 directory where it was like that before. Reindent because of that. Reviewed-by: Brian Paul <brianp@vmware.com> Signed-off-by: Mathias Fröhlich <Mathias.Froehlich@web.de>
2018-02-13mesa: separate legacy stuff from gl_texture_unit into gl_fixedfunc_texture_unitMarek Olšák1-4/+6
Reviewed-by: Brian Paul <brianp@vmware.com>
2018-02-06vbo: Move vbo_rebase into its only caller module tnl.Mathias Fröhlich3-3/+294
Signed-off-by: Mathias Fröhlich <Mathias.Froehlich@web.de> Reviewed-by: Brian Paul <brianp@vmware.com>
2018-02-01mesa: Put materials at the end of the generic block.Mathias Fröhlich1-2/+2
The materials are now moved to the end of the generic attributes block to the range 4-15. Before, the way the position and generic 0 attribute is handled was dependent on the presence and kind of the currently attached vertex program. With this change the way the position attribute and the generic 0 attribute is treated only depends on the enabled flag of those two arrays. This will later help to untangle the update dependencies between enabled arrays and shader inputs. v2: s,VERT_ATTRIB_MAT_OFFSET,VERT_ATTRIB_MAT0,g Signed-off-by: Mathias Fröhlich <Mathias.Froehlich@web.de> Reviewed-by: Brian Paul <brianp@vmware.com>
2018-02-01mesa: Use defines for the aliased material array attributes.Mathias Fröhlich1-1/+1
Instead of just assuming that the material attributes just overlap with the generic attributes 0-12, give them symbolic defines so that we can easier move them to an other range. Signed-off-by: Mathias Fröhlich <Mathias.Froehlich@web.de> Reviewed-by: Brian Paul <brianp@vmware.com>
2017-12-25tnl: fix not having texture coords in ATI_fs in swrastMiklós Máté1-1/+2
ATI_fs in swrast only had access to texture coordinates if there was a valid texture bound and texturing was enabled. Piglit: spec/ati_fragment_shader/render-sources and render-notexture Signed-off-by: Miklós Máté <mtmkls@gmail.com>
2017-11-25mesa: remove unused vertex attrib WEIGHTMarek Olšák1-2/+1
We don't support ARB_vertex_blend. Note that the attribute aliasing check for ARB_vertex_program had to be rewritten. vbo_context: 20344 -> 20008 bytes gl_context: 74672 -> 74616 bytes Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2017-11-25mesa: don't assign numbers to vertex attrib enums manuallyMarek Olšák1-53/+53
I plan to remove one of them. Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2017-10-10mesa: move _mesa_exec_malloc/free() prototypes to their own headerBrian Paul1-0/+1
Try to start removing things from the cluttered imports.h file. v2: add new header to Makefile.sources Reviewed-by: Roland Scheidegger <sroland@vmware.com>
2017-06-22mesa: replace VP/FP/ATIfs _Enabled flags with helper functionsMarek Olšák1-1/+3
These are only used in the GL compatibility profile. Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com> Reviewed-by: Brian Paul <brianp@vmware.com> Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
2017-04-22mesa: replace _mesa_index_buffer::type with index_sizeMarek Olšák1-4/+4
This avoids repeated translations of the enum. Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu> Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2017-03-31tnl: remove unused var to silence warningBrian Paul1-2/+0
Trivial.
2017-03-29mesa: remove dd_function_table::BindProgramMarek Olšák1-8/+0
Reviewed-by: Edward O'Callaghan <funfunctor@folklore1984.net> Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com> Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
2016-11-20tnl: remove unneeded #include "util/simple_list.h"Brian Paul2-2/+0
Reviewed-by: Vinson Lee <vlee@freedesktop.org>
2016-11-17st/mesa/r200/i915/i965: move ARB program fields into a unionTimothy Arceri1-2/+2
It's common for games to compile 2000 programs or more so at 32bits x 2000 programs x 22 fields x 2 (at least) stages This should give us something like 352 kilobytes in savings once we add some more glsl only fields. Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
2016-10-28mesa: rename gl_client_array -> gl_vertex_arrayBrian Paul2-7/+7
The term "client array" is a legacy thing dating back to the pre-VBO era when _all_ vertex arrays lived in client memory. Nowadays, it only contains vertex array state which is derived from gl_array_attributes and gl_vertex_buffer_binding. It's used by the VBO module and some drivers. Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
2016-10-26r200/glsl/st/mesa: use common outputs written fieldTimothy Arceri2-4/+6
And set outputs written directly in shader_info. st/mesa changes where: Reviewed-by: Marek Olšák <marek.olsak@amd.com> Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
2016-10-26r200/i915/st/mesa/compiler: use common inputs read fieldTimothy Arceri2-4/+4
And set set inputs_read directly in shader_info. To avoid regressions between changes this change is a squashed version of the following patches. st/mesa changes where: Reviewed-by: Marek Olšák <marek.olsak@amd.com> Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
2016-10-26st/mesa/r200/i915/i965: eliminate gl_fragment_programTimothy Arceri1-4/+4
Here we move OriginUpperLeft and PixelCenterInteger into gl_program all other fields have been replace by shader_info. V2: Don't use anonymous union/structs to hold vertex/fragment fields suggested by Ian. Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
2016-10-26mesa/i965/i915/r200: eliminate gl_vertex_programTimothy Arceri3-16/+16
Here we move the only field in gl_vertex_program to the ARB program fields in gl_program. Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>