summaryrefslogtreecommitdiffstats
path: root/src/gallium/auxiliary/translate/translate_generic.c
Commit message (Collapse)AuthorAgeFilesLines
* draw: cleanup and fix instance id computationZack Rusin2013-07-251-2/+1
| | | | | | | | | | | | | | The instance id system value always starts at 0, even if the specified start instance is larger than 0. Instead of implicitly setting instance id to instance id plus start instance and then having to subtract instance id when computing the buffer offsets lets just set instance id to the proper instance id. This fixes instance id computation and cleansup buffer offset computation. Signed-off-by: Zack Rusin <[email protected]> Reviewed-by: Roland Scheidegger <[email protected]> Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Jose Fonseca <[email protected]>
* draw/translate: fix instancingZack Rusin2013-06-281-5/+12
| | | | | | | | | | | | | | | | | | We were incorrectly computing the buffer offset when using the instances. The buffer offset is always equal to: start_instance * stride + (instance_num / instance_divisor) * stride We were completely ignoring the start instance quite often producing instances that completely wrong, e.g. if start instance = 5, instance divisor = 2, then on the first iteration it should be: 5 * stride, not (5/2) * stride as we'd have currently, and if start instance = 1, instance divisor = 3, then on the first iteration it should be: 1 * stride, not 0 as we'd have. This fixes it and adjusts all the code to the changes. Signed-off-by: Zack Rusin <[email protected]>
* translate: Fix the fetch function assertions.José Fonseca2012-12-041-1/+3
| | | | | | fetch_rgba_float is NULL for integer formats, and vice-versa. Reviewed-by: Brian Paul <[email protected]>
* translate: Fix typo in is_legal_int_format_combo.Vinson Lee2012-08-071-1/+1
| | | | | | | Fixes same on both sides defect reported by Coverity. Signed-off-by: Vinson Lee <[email protected]> Reviewed-by: José Fonseca <[email protected]>
* translate: implement translation of 10_10_10_2 typesMarek Olšák2012-01-051-0/+148
| | | | | | | | | This is for GL_ARB_vertex_type_2_10_10_10_rev. I just took the code from u_format_table.c. It's based on pack_rgba_float. I had no other choice. The u_format hooks are not exactly compatible with translate. The cleanup of it is left for future work. Reviewed-by: Dave Airlie <[email protected]>
* translate: implement translation of (pure) integer formatsMarek Olšák2012-01-051-94/+252
| | | | | | | The conversion is limited to only a few cases, because converting to any other type shouldn't happen in any driver. Reviewed-by: Dave Airlie <[email protected]>
* translate: implement translation of half floats in the generic codepathMarek Olšák2012-01-051-0/+21
|
* translate: disable clamping of instanced array indexesBrian Paul2011-04-191-3/+6
| | | | | | This fixes piglit's draw-instanced-divisor test for softpipe on both the generic and SSE paths. This is temporary until we have the correct per-array max_index information.
* translate: Eliminate void pointer arithmetic.José Fonseca2010-08-161-1/+1
| | | | Non-portable.
* translate: add support for 8/16-bit indicesLuca Barbieri2010-08-161-0/+34
| | | | | Currently, only 32-bit indices are supported, but some use cases translate needs support for all types.
* translate_generic: factor out common code between linear and indexedLuca Barbieri2010-08-161-115/+62
| | | | This moves the common code into a separate ALWAYS_INLINE function.
* translate_generic: use memcpy if possible (v3)Luca Barbieri2010-08-161-33/+75
| | | | | | | | | | | | | | | | | | | | | | | | Changes in v3: - If we can do a copy, don't try to get an emit func, as that can assert(0) Changes in v2: - Add comment regarding copy_size When used in GPU drivers, translate can be used to simultaneously perform a gather operation, and convert away from unsupported formats. In this use case, input and output formats will often be identical: clearly it would make sense to use a memcpy in this case. Instead, translate will insist to convert to and from 32-bit floating point numbers. This is not only extremely expensive, but it also loses precision for 32/64-bit integers and 64-bit floating point numbers. This patch changes translate_generic to just use memcpy if the formats are identical, non-blocked, and with an integral number of bytes per pixel (note that all sensible vertex formats are like this).
* translate: allow clients to ask for supported output formatsLuca Barbieri2010-08-111-0/+80
| | | | | | | | | | | | | Currently translate asserts on unsupported output formats, making it impossible to use for some purposes, such as testing whether it actually works on all formats it supports. Removing the assert was met with opposition, so this change allows clients to ask whether an output format is supported, and they are thus able to avoid attempting to use it. Since this is just an addition to the API, no adverse effect is possible, and it makes the testsuite work again.
* Revert "translate_generic: return NULL instead of assert(0) if format not ↵Luca Barbieri2010-08-111-6/+9
| | | | | | | | | | | supported" This reverts commit 16b45ca7cefb3432b4133fe9d0b1dbfe3f286131. José Fonseca asked for a revert. Note that the testsuite will now segfault since it attempts to test all possible formats.
* translate_generic: fix broken A8R8G8B8_UNORM outputLuca Barbieri2010-08-111-3/+9
| | | | | | | translate was attempting to output A8R8G8B8_UNORM as if it were R8G8B8A8_UNORM. Now the tests just added pass.
* translate_generic: return NULL instead of assert(0) if format not supportedLuca Barbieri2010-08-111-9/+6
| | | | This gives the caller a chance to recover (or crash anyway otherwise).
* gallium/translate: make generic_run() and generic_run_elts() more alikeBrian Paul2010-08-031-19/+44
| | | | Plus more debug code and do clamping in generic_run().
* translate: don't crash on elts paths with instancesZack Rusin2010-06-161-10/+13
|
* translate: Make translate_generic truly generic.José Fonseca2010-05-031-301/+90
| | | | | PIPE_FORMAT_R10G10B10X2_USCALED, half floats, were not supported, so just rely on u_format for (almost) universal format support.
* translate: Take and respect a max_index argument.José Fonseca2010-04-261-6/+13
|
* gallium: fix BGRA vertex color swizzlesMarek Olšák2010-03-121-4/+4
| | | | | | | | | | | | | | The mapping for vertex_array_bgra: (gl -> st -> translate) GL_RGBA -> PIPE_FORMAT_R8G8B8A8 (RGBA) -> no swizzle (XYZW) GL_BGRA -> PIPE_FORMAT_A8R8G8B8 (ARGB) -> ZYXW (BGRA again??) Iẗ́'s pretty clear that PIPE_FORMAT_A8R8G8B8 here is wrong. This commit fixes the pipe format and removes obvious workarounds in util/translate. Tested with: softpipe, llvmpipe, r300g. Signed-off-by: José Fonseca <[email protected]>
* translate: Rename pipe formats.José Fonseca2010-03-011-4/+4
|
* Add lame support for instanceID to draw module.Michal Krol2009-12-301-9/+17
| | | | It's all screaming for integer support -- fake it with float for now.
* Implement instanced indexed draw.Michal Krol2009-12-301-3/+11
|
* Implement draw_arrays_instanced() in softpipe.Michal Krol2009-12-291-3/+13
| | | | | Modify the translate module to respect instance divisors and accept instance id as a parameter to calculate input vertex offset.
* gallium: replace // comments with /* */Brian Paul2009-10-021-1/+1
|
* gallium: silence warningsBrian Paul2008-09-031-0/+6
|
* gallium: refactor/replace p_util.h with util/u_memory.h and util/u_math.hBrian Paul2008-08-241-1/+1
| | | | Also, rename p_tile.[ch] to u_tile.[ch]
* gallium: Avoid double arithmetic.José Fonseca2008-06-241-1/+1
|
* gallium: added support for fixed-point formats, drawingBrian Paul2008-06-231-0/+18
|
* Merge branch 'gallium-vertex-linear' into gallium-0.1Jakob Bornecrantz2008-05-281-8/+8
|\ | | | | | | | | | | Conflicts: src/gallium/auxiliary/draw/draw_pt_varray.c
| * translate: mark functions as PIPE_CDECLKeith Whitwell2008-05-231-8/+8
| |
* | gallium: Windows CE portability fixes.José Fonseca2008-05-281-118/+118
|/
* translate: fix several bugsKeith Whitwell2008-04-191-7/+4
| | | | | | - specify cdecl calling convention on WIN32 - fix load bgra8 function - fix previous don't crash fix.
* translate: don't crash on failure to create sse versionKeith Whitwell2008-04-191-0/+11
|
* gallium: Get the translate module to build on msvc.José Fonseca2008-04-161-16/+16
| | | | | Appearently MSVC c-preprocessor parses "255.0f" as two tokens: "255.0" and "f", and performs variable substitution on "f".
* gallium: Switch one vertex path over to new translate moduleKeith Whitwell2008-04-151-14/+52
| | | | | Will eventually do this for all instances where we are converting vertices from one format to another.
* translate: typo in emit_B8G8R8A8_UNORMKeith Whitwell2008-04-151-4/+4
|
* gallium: add a generic vertex (or other) buffer translation moduleKeith Whitwell2008-04-151-0/+630