summaryrefslogtreecommitdiffstats
path: root/src/mesa/program
Commit message (Collapse)AuthorAgeFilesLines
* mesa: reorder prog_instructionDave Airlie2015-03-211-3/+3
| | | | | | | | reduces size from 64 to 56 bytes. Acked-by: Brian Paul <[email protected]> Reviewed-by: Alex Deucher [email protected]> Signed-off-by: Dave Airlie <[email protected]>
* mesa: use strdup() instead of _mesa_strdup()Brian Paul2015-03-114-6/+6
| | | | | | | | | We were already using strdup() in various places in Mesa. Get rid of the _mesa_strdup() wrapper. All the callers pass a non-NULL argument so the NULL check isn't needed either. Reviewed-by: Jose Fonseca <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* mesa: include stdio.h where neededBrian Paul2015-03-051-0/+1
| | | | | | | Instead of relying on glapi.h or some other header to provide it. Acked-by: Matt Turner <[email protected]> Reviewed-by: José Fonseca <[email protected]>
* mesa/program: replace Elements() with ARRAY_SIZE()Brian Paul2015-03-024-12/+12
| | | | Acked-by: Ilia Mirkin <[email protected]>
* mesa: trim down includes of compiler.hBrian Paul2015-03-021-1/+0
| | | | | | | In some cases, glheader.h is the right #include. Also remove some instances of struct _glapi_table declarations. Acked-by: Matt Turner <[email protected]>
* mesa: move ONE_DIV_SQRT_LN2 to prog_statevars.cBrian Paul2015-02-281-0/+3
| | | | Reviewed-by: Ian Romanick <[email protected]>
* mesa: trim down #includes in compiler.hBrian Paul2015-02-261-1/+1
| | | | | | | | Don't include stuff we don't need. Fix a few #includes elsewhere to keep thing building. Reviewed-by: Matt Turner <[email protected]> Reviewed-by: Jose Fonseca <[email protected]>
* mesa: include stdarg.h only where it's usedBrian Paul2015-02-261-0/+2
| | | | | Reviewed-by: Matt Turner <[email protected]> Reviewed-by: Jose Fonseca <[email protected]>
* mesa: remove INV_SQRTF() macroBrian Paul2015-02-241-1/+1
| | | | | Reviewed-by: Roland Scheidegger <[email protected]> Reviewed-by: Matt Turner <[email protected]>
* mesa: replace FABSF with fabsfBrian Paul2015-02-241-15/+15
| | | | Reviewed-by: Matt Turner <[email protected]>
* mesa: replace FLOORF with floorfBrian Paul2015-02-241-9/+9
| | | | Reviewed-by: Matt Turner <[email protected]>
* mesa: replace FREXPF, LDEXPF with frexpf, ldexpfBrian Paul2015-02-241-2/+3
| | | | | | Start getting rid of some imports.h macros. Use the c99 functions instead. Reviewed-by: Matt Turner <[email protected]>
* mesa: Use assert() instead of ASSERT wrapper.Matt Turner2015-02-2310-77/+77
| | | | Acked-by: Eric Anholt <[email protected]>
* glsl/ir: Add builtin function support for doublesDave Airlie2015-02-191-0/+11
| | | | | | | v2: add d2b, more ir_constant stuff (Ilia) Signed-off-by: Dave Airlie <[email protected]> Reviewed-by: Ilia Mirkin <[email protected]>
* mesa: add double uniform support. (v5)Dave Airlie2015-02-191-2/+24
| | | | | | | | | | | | | | | | This adds support for the new uniform interfaces from ARB_gpu_shader_fp64. v2: support ARB_separate_shader_objects ProgramUniform*d* (Ian) don't allow boolean uniforms to be updated (issue 15) (Ian) v3: fix size_mul v4: Teach uniform update to take into account double precision (Topi) v5: add transpose for double case (Ilia) Signed-off-by: Dave Airlie <[email protected]> Reviewed-by: Ilia Mirkin <[email protected]>
* Revert use of Mesa IR optimizer for ARB_fragment_programsCarl Worth2015-02-121-3/+0
| | | | | | | | | | | | | | | | | | | | Commit f82f2fb3dc770902f1657ab1c22e6004faa3afab added use of the Mesa IR optimizer for both ARB_fragment_program and ARB_vertex_program, but only justified the vertex-program portions with measured performance improvements. Meanwhile, the optimizer was seen to generate hundreds of unused immediates without discarding them, causing failures. Discard the use of the optimizer for now to fix the regression. (In the future, we anticpate things moving from Mesa IR to NIR for better optimization anyway.) Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=82477 Reviewed-by: Ian Romanick <[email protected]> CC: "10.3 10.4 10.5" <[email protected]>
* program: Remove _mesa_nop_vertex_program/_mesa_nop_fragment_program.Matt Turner2015-02-112-97/+0
| | | | | | | | | | | | Dead since commit 284ce20901b0c2cfab1d952cc129b8f3cd068f12 Author: Eric Anholt <[email protected]> Date: Fri Aug 20 10:52:14 2010 -0700 Remove remnants of the old glsl compiler. Reviewed-by: Kenneth Graunke <[email protected]>
* glsl: Improve precision of mod(x,y)Iago Toral Quiroga2015-02-031-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently, Mesa uses the lowering pass MOD_TO_FRACT to implement mod(x,y) as y * fract(x/y). This implementation has a down side though: it introduces precision errors due to the fract() operation. Even worse, since the result of fract() is multiplied by y, the larger y gets the larger the precision error we produce, so for large enough numbers the precision loss is significant. Some examples on i965: Operation Precision error ----------------------------------------------------- mod(-1.951171875, 1.9980468750) 0.0000000447 mod(121.57, 13.29) 0.0000023842 mod(3769.12, 321.99) 0.0000762939 mod(3769.12, 1321.99) 0.0001220703 mod(-987654.125, 123456.984375) 0.0160663128 mod( 987654.125, 123456.984375) 0.0312500000 This patch replaces the current lowering pass with a different one (MOD_TO_FLOOR) that follows the recommended implementation in the GLSL man pages: mod(x,y) = x - y * floor(x/y) This implementation eliminates the precision errors at the expense of an additional add instruction on some systems. On systems that can do negate with multiply-add in a single operation this new implementation would come at no additional cost. v2 (Ian Romanick) - Do not clone operands because when they are expressions we would be duplicating them and that can lead to suboptimal code. Fixes the following 16 dEQP tests: dEQP-GLES3.functional.shaders.builtin_functions.precision.mod.mediump_* dEQP-GLES3.functional.shaders.builtin_functions.precision.mod.highp_* Reviewed-by: Ian Romanick <[email protected]>
* mesa: Move simple_list.h to src/util.Eric Anholt2015-01-281-1/+1
| | | | | | We have two copies of it in the tree, I'm going to delete one. Reviewed-by: Marek Olšák <[email protected]>
* mesa: Build with subdir-objects.Matt Turner2015-01-231-2/+0
|
* mesa: Add assert to check number of vector elementsJan Vesely2015-01-211-0/+1
| | | | | | | | The below code crashes when vector_elements <= 0 Fixes Warray-bounds warnings Signed-off-by: Jan Vesely <[email protected]> Reviewed-by: Jose Fonseca <[email protected]>
* mesa: Fix some signed-unsigned comparison warningsJan Vesely2015-01-213-5/+5
| | | | | | | | v2: s/unsigned int/unsigned/ in prog_optimize.c Signed-off-by: Jan Vesely <[email protected]> Reviewed-by: David Heidelberg <[email protected]> Reviewed-by: Jose Fonseca <[email protected]>
* mesa: remove comparisons that are always trueJan Vesely2015-01-212-3/+0
| | | | | Signed-off-by: Jan Vesely <[email protected]> Reviewed-by: Jose Fonseca <[email protected]>
* mesa: Add iterate method for string_to_uint_mapTapani Pälli2015-01-161-0/+34
| | | | | | | | | | | | | | | | | | | | | | | | | The upcoming shader cache needs this to be able to cache hash data from the gl_shader_program structure. Edited-by: Carl Worth <[email protected]>: There is an internal implementation detail that the hash table underlying the struct string_to_uint_map stores each value internally as (value+1). The user needn't be very concerned with this (other than knowing that a value of UINT_MAX cannot be stored) since put() adds 1 and get() subtracts 1. So in this commit, rather than call the user's function directly with hash_table_call_foreach, we call through a wrapper that fixes up the off-by-one values before the caller's callback sees them. And with this wrapper in place, we also give a better signature to the callback function being passed to iterate(), so that this callback function can actually expect a char* and an unsigned argument, (rather than a couple of void* ). Reviewed-by: Ian Romanick <[email protected]> Reviewed-by: Tapani Pälli <[email protected]>
* program: remove extern "C" usage in sampler.cppBrian Paul2014-12-161-5/+4
| | | | | Reviewed-by: Anuj Phogat <[email protected]> Reviewed-by: Jose Fonseca <[email protected]>
* program: remove extern "C" around #includesBrian Paul2014-12-161-4/+3
| | | | | Reviewed-by: Anuj Phogat <[email protected]> Reviewed-by: Jose Fonseca <[email protected]>
* program: add #ifndef SAMPLER_H wrapperBrian Paul2014-12-161-0/+7
| | | | | Reviewed-by: Anuj Phogat <[email protected]> Reviewed-by: Jose Fonseca <[email protected]>
* mesa: put extern "C" in src/mesa/program/*h header filesBrian Paul2014-12-164-0/+43
| | | | | Reviewed-by: Anuj Phogat <[email protected]> Reviewed-by: Jose Fonseca <[email protected]>
* ir_to_mesa: remove unused 'target' variableBrian Paul2014-12-121-1/+0
| | | | Reviewed-by: Ian Romanick <[email protected]>
* program: Delete dead _mesa_realloc_instructions.Matt Turner2014-12-082-21/+0
| | | | | | Dead since 2010 (commit 284ce209). Reviewed-by: Ian Romanick <[email protected]>
* Don't cast the return value of malloc/reallocMatt Turner2014-12-082-8/+2
| | | | | | | See commit 2b7a972e for the Coccinelle script. Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* ir_to_mesa: Remove sat to clamp lowering passAbdiel Janulgue2014-12-081-3/+1
| | | | | | | | | | | | | | | Fixes an infinite loop in swrast where the lowering pass unpacks saturate into clamp but the opt_algebraic pass tries to do the opposite. v3 (Ian): This is a revert of commit cfa8c1cb "ir_to_mesa: lower ir_unop_saturate" on the ir_to_mesa.cpp portion. prog_execute.c can handle saturates in vertex shaders, so classic swrast shouldn't need this lowering pass. Cc: "10.4" <[email protected]> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=83463 Reviewed-by: Matt Turner <[email protected]> Signed-off-by: Abdiel Janulgue <[email protected]>
* mesa: remove unused functions in prog_execute.cBrian Paul2014-12-011-74/+0
| | | | Reviewed-by: Kenneth Graunke <[email protected]>
* mesa: Drop unused NV_fragment_program opcodes.Eric Anholt2014-11-244-177/+0
| | | | | | | | | The extension itself was deleted 2 years ago. There are still some prog_instruction opcodes from NV_fp that exist because they're used by ir_to_mesa.cpp, though. Reviewed-by: Jose Fonseca <[email protected]> Reviewed-by: Ian Roamnick <[email protected]>
* mesa: Drop unused SFL/STR opcodes.Eric Anholt2014-11-243-16/+0
| | | | | | | | They're part of NV_vertex_program2, which I'm pretty sure we're never going to support. Reviewed-by: Jose Fonseca <[email protected]> Reviewed-by: Ian Roamnick <[email protected]>
* util: add _mesa_strtod and _mesa_strtofChia-I Wu2014-10-301-0/+1
| | | | | | | | | Both core mesa and glsl have their own wrappers for strtof_l. Merge and move them to util/. They are compiled with a C++ compiler so that we can make them thread-safe in a following commit. Signed-off-by: Chia-I Wu <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* mesa: Silence unused parameter warning in _mesa_clear_shader_program_dataIan Romanick2014-10-241-1/+1
| | | | | | | | | Just remove the parameter. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Matt Turner <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* st/mesa: Fix paths used in Android buildsTomasz Figa2014-10-031-0/+2
| | | | | | | | | | | | | | | | | | With current makefiles the build fails because source and build paths are generated incorrectly. With Android build system the top_srcdir and top_builddir variables are undefined and all paths are relative to where Android.mk is located. This ends up with path likes external/mesa/src/mesa/src/mesa/ for both source and build paths, which are obviously wrong. This patch fixes this by overriding resulting SRCDIR and BUILDDIR variables with empty string, so that paths end up being relative to Android.mk file again. Appending correct build path to generated files is already done in Android.gen.mk. Signed-off-by: Tomasz Figa <[email protected]> CC: <[email protected]> Reviewed-by: Emil Velikov <[email protected]>
* util: Include in Android buildsTomasz Figa2014-10-031-0/+1
| | | | | | | | | | This patch fixes Android build failures by including src/util directory in compilation. Files inside of this directory are compiled into libmesa_util static library and linked with resulting libGLES_mesa. Signed-off-by: Tomasz Figa <[email protected]> CC: <[email protected]> Reviewed-by: Emil Velikov <[email protected]>
* glsl: Make ir_variable::num_state_slots and ir_variable::state_slots privateIan Romanick2014-09-301-7/+7
| | | | | | | | | | | | Also move num_state_slots inside ir_variable_data for better packing. The payoff for this will come in a few more patches. No change Valgrind massif results for a trimmed apitrace of dota2. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Matt Turner <[email protected]> Reviewed-by: Tapani Pälli <[email protected]>
* mesa: Use realloc() instead of _mesa_realloc() and remove the latter.Matt Turner2014-09-242-6/+4
| | | | Reviewed-by: Ian Romanick <[email protected]>
* mesa: Move register_allocate.c to util.Eric Anholt2014-09-232-733/+0
| | | | | | | | | | | | | The r300 gallium driver is using it outside of the Mesa tree, and I wanted to do so for vc4 as well. Rather than make the multiple-definitions problem even more complicated, just move it to more-shared code. v2: Don't forget to delete the symlink in r300 (review by Matt). Delete more r300-helper references (review by Emil) Don't prefix util/ header inclusion with "util/" (review by Emil) Reviewed-by: Matt Turner <[email protected]> (v1) Reviewed-by: Emil Velikov <[email protected]> (v1)
* mesa: add null checks in symbol_table.cJuha-Pekka Heikkila2014-09-231-0/+30
| | | | | Signed-off-by: Juha-Pekka Heikkila <[email protected]> Reviewed-by: Anuj Phogat <[email protected]>
* mesa: fix prog_optimize.c assertions triggered by SWZ opcodeBrian Paul2014-09-181-5/+4
| | | | | | | | | | | | | The SWZ instruction can have swizzle terms >4 (SWIZZLE_ZERO, SWIZZLE_ONE). These swizzle terms caused a few assertions to fail. This started happening after the commit "mesa: Actually use the Mesa IR optimizer for ARB programs." when replaying some apitrace files. A new piglit test (tests/asmparsertest/shaders/ARBfp1.0/swz-08.txt) exercises this. Cc: "10.3" <[email protected]> Reviewed-by: Charmaine Lee <[email protected]>
* ra: assert against unsigned underflow in q_totalConnor Abbott2014-09-121-0/+1
| | | | | | | | q_total should never go below 0 (which is why it's defined as unsigned), and if it does, then something is seriously wrong. Signed-off-by: Connor Abbott <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* ra: note a restriction in the interfence graph APIConnor Abbott2014-09-121-1/+4
| | | | | | | | | As noted in the previous commit, this was introduced in 567e2769b81863b6dffdac3826a6b729ce6ea37c ("ra: make the p, q test more efficient"), but I forgot to mention it. Signed-off-by: Connor Abbott <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* ir_to_mesa: Stop converting uniform booleans.Kenneth Graunke2014-09-091-6/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Excess conversions considered harmful. Recently Matt reworked the boolean uniform handling to use the value of UniformBooleanTrue, rather than integer 1, when uploading uniforms: mesa: Upload boolean uniforms using UniformBooleanTrue. glsl: Use UniformBooleanTrue value for uniform initializers. Marek then set the default to 1.0f for drivers without native integer support: mesa: set UniformBooleanTrue = 1.0f by default However, ir_to_mesa was assuming a value of integer 1, and arranging for it to be converted to 1.0f on upload. Since Marek's commit, we were uploading 1.0f = 0x3f800000 which was being interpreted as the integer value 1065353216 and converted to float as 1.06535322E9, which broke assumptions in ir_to_mesa that "true" was exactly 1.0f. +13 Piglits on classic swrast (fs-bool-less-compare-true, {vs,fs}-op-not-bool-using-if, glsl-1.20/execution/uniform-initializer). Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=83573 Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Matt Turner <[email protected]>
* Eliminate several cases of multiplication in arguments to callocCarl Worth2014-09-033-5/+5
| | | | | | | | | | | | | | | | | | | | | | In commit 32f2fd1c5d6088692551c80352b7d6fa35b0cd09, several calls to _mesa_calloc(x) were replaced with calls to calloc(1, x). This is strictly equivalent to what the code was doing previously. But for cases where "x" involves multiplication, now that we are explicitly using the two-argument calloc, we can do one step better and replace: calloc(1, A * B); with: calloc(A, B); The advantage of the latter is that calloc will detect any overflow that would have resulted from the multiplication and will fail the allocation, (whereas the former would return a small allocation). So this fix can change potentially exploitable buffer overruns into segmentation faults. Reviewed-by: Matt Turner <[email protected]>
* mesa/program_cache: calloc the correct size for the cache.Dave Airlie2014-09-021-1/+1
| | | | | | | | | Coverity reported this, and I think this is the right solution, since cache->items is struct cache_item ** not struct cache_item *, we also realloc it using struct cache_item * at some point. Reviewed-by: Tapani Pälli <[email protected]> Signed-off-by: Dave Airlie <[email protected]>
* ir_to_mesa, glsl_to_tgsi: Remove try_emit_saturateAbdiel Janulgue2014-08-311-48/+0
| | | | | | | | | Now that saturate is implemented natively as instruction, we can cut down on unneeded functionality. Reviewed-by: Matt Turner <[email protected]> Reviewed-by: Ian Romanick <[email protected]> Signed-off-by: Abdiel Janulgue <[email protected]>