summaryrefslogtreecommitdiffstats
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
* mesa: Use _mesa_format_convert to implement texstore_rgba.Iago Toral Quiroga2015-01-121-613/+70
| | | | | | | | | | Notice that _mesa_format_convert does not handle byte-swapping scenarios, GL_COLOR_INDEX or MESA_FORMAT_YCBCR(_REV), so these must be handled separately. Also, remove all the code that goes unused after using _mesa_format_convert. Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
* mesa: Add helpers to extract GL_COLOR_INDEX to RGBA float/ubyteIago Toral Quiroga2015-01-122-0/+99
| | | | | | | | | | | | | | | | | | | | | We only use _mesa_make_temp_ubyte_image in texstore.c to convert GL_COLOR_INDEX to RGBA, but this helper does more stuff than this. All uses of this helper can be replaced with calls to _mesa_format_convert except for this GL_COLOR_INDEX conversion. This patch extracts the GL_COLOR_INDEX to RGBA logic to a separate helper so we can use that instead from texstore.c. In future patches we will replace all remaining calls to _mesa_make_temp_ubyte_image in the repository (related to compressed formats) with calls to _mesa_format_convert so we can remove _mesa_make_temp_ubyte_image and related functions. v2: - Remove ‘for’ loop initial declaration. They are only allowed in C99 or C11 mode. Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
* mesa: Add RGBA to Luminance conversion helpersIago Toral Quiroga2015-01-122-0/+224
| | | | | | | | | | | | | | | | | | For glReadPixels with a Luminance destination format we compute luminance values from RGBA as L=R+G+B. This, however, requires ad-hoc implementation, since pack/unpack functions or _mesa_swizzle_and_convert won't do this (and thus, neither will _mesa_format_convert). This patch adds helpers to do this computation so they can be used to support conversion to luminance formats. The current implementation of glReadPixels does this computation as part of the span functions in pack.c (see _mesa_pack_rgba_span_float), that do this together with other things like type conversion, etc. We do not want to use these functions but use _mesa_format_convert instead (later patches will remove the color span functions), so we need to extract this functionality as helpers. Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
* mesa: Add _mesa_swap2_copy and _mesa_swap4_copyIago Toral Quiroga2015-01-122-10/+32
| | | | | | | | | | | | | | | | | We have _mesa_swap{2,4} but these do in-place byte-swapping only. The new functions receive an extra parameter so we can swap bytes on a source input array and store the results in a (possibly different) destination array. This is useful to implement byte-swapping in pixel uploads, since in this case we need to swap bytes on the src data which is owned by the application so we can't do an in-place byte swap. v2: - Include compiler.h in image.h, which is necessary to build in MSCV as indicated by Brian Paul. Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
* mesa/pack: use _mesa_format_from_format_and_type in _mesa_pack_rgba_span_from_*Samuel Iglesias Gonsalvez2015-01-121-256/+26
| | | | | | | | We had previously added the needed mesa formats, so we can simplify the code further. Signed-off-by: Samuel Iglesias Gonsalvez <siglesias@igalia.com> Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
* mesa: Add helper to convert a GL format and type to a mesa (array) format.Iago Toral Quiroga2015-01-122-0/+279
| | | | | | | | | | | | v2 after review by Jason Ekstrand: - Move _mesa_format_from_format_and_type to glformats - Return a mesa_format for GL_UNSIGNED_INT_8_8_8_8(_REV) v3: - Adapted to the new implementation of mesa_array_format as a plain uint32_t bitfield. Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
* mesa: Add a helper _mesa_compute_rgba2base2rgba_component_mappingIago Toral Quiroga2015-01-122-0/+58
| | | | | | | This will come in handy when callers of _mesa_format_convert need to compute the rebase swizzle parameter to use. Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
* mesa: Add a rebase_swizzle parameter to _mesa_format_convertIago Toral Quiroga2015-01-122-70/+171
| | | | | | | | | | | | | | | | | | | | | The new parameter allows callers to provide a rebase swizzle that the function needs to use to match the requirements of the base internal format involved. This is necessary when the source or destination internal formats (depending on whether we are doing the conversion for a pixel download or a pixel upload respectively) do not match the base formats of the source or destination formats of the conversion. This can happen when the driver does not support the internal formats and uses a different format to store pixel data internally. For example, a texture upload from RGB to Luminance in a driver that does not support textures with a Luminance format may decide to store the Luminance data as RGBA. In this case we want to store the RGBA values as (R,R,R,1). Following the same example, when we download from that texture to RGBA we want to read (R,0,0,1). The rebase_swizzle parameter allows these transforms to happen. Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
* mesa: Expose compute_component_mapping as _mesa_compute_component_mappingIago Toral Quiroga2015-01-123-207/+209
| | | | | | | | | | | | | | This is necessary to handle conversions between array types where the driver does not support the dst format requested by the client and chooses a different format instead. We will need this in _mesa_format_convert, so move it to format_utils.c, prefix it with '_mesa_' and make it available to other files. v2: - Move _mesa_compute_component_mapping to glformats Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
* mesa: Add an implementation of a master convert function.Jason Ekstrand2015-01-122-0/+418
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | v2 by Iago Toral <itoral@igalia.com>: - When testing if we can directly pack we should use the src format to check if we are packing from an RGBA format. The original code used the dst format for the ubyte case by mistake. - Fixed incorrect number of bits for dst, it was computed using the src format instead of the dst format. - If the dst format is an array format, check if it is signed. We were only checking this for the case where it was not an array format, but we need to know this in both scenarios. - Fixed incorrect swizzle transform for the cases where we convert between array formats. - Compute is_signed and bits only once and for the dst format. We were computing these for the src format too but they were overwritten by the dst values immediately after. - Be more careful when selecting the integer path. Specifically, check that both src and dst are integer types. Checking only one of them should suffice since OpenGL does not allow conversions between normalized and integer types, but putting extra care here makes sense and also makes the actual requirements for this path more clear. - The format argument for pack functions is the destination format we are packing to, not the source format (which has to be RGBA). - Expose RGBA8888_* to other files. These will come in handy when in need to test if a given array format is RGBA or in need to pass RGBA formats to mesa_format_convert. v3 by Samuel Iglesias <siglesias@igalia.com>: - Add an RGBA8888_INT definition. v4 by Iago Toral <itoral@igalia.com> after review by Jason Ekstrand: - Added documentation for _mesa_format_convert. - Added additional explanatory comments for integer conversions. - Ensure that we use _messa_swizzle_and_convert for all signed source formats. - Squashed: do not directly (un)pack to RGBA UINT if the source is not unsigned. v5 by Iago Toral <itoral@igalia.com>: - Adapted to the new implementation of mesa_array_format as a plain uint32_t bitfield. Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
* mesa/pack: refactor _mesa_pack_rgba_span_float()Samuel Iglesias Gonsalvez2015-01-122-1166/+153
| | | | | | | | | | | Use autogenerated format pack functions and take advantage of some macros to reduce source code, facilitating its maintenance. Unfortunately, dstType == GL_UNSIGNED_SHORT cannot simplified like the others, so keep it as it is. Signed-off-by: Samuel Iglesias Gonsalvez <siglesias@igalia.com> Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
* mesa/main/pack_tmp.h: Add float conversion supportSamuel Iglesias Gonsalvez2015-01-121-1/+74
| | | | | | | We will use this in a later patch to refactor _mesa_pack_rgba_span_float. Signed-off-by: Samuel Iglesias Gonsalvez <siglesias@igalia.com> Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
* mesa/pack: use autogenerated format_pack functionsSamuel Iglesias Gonsalvez2015-01-121-525/+138
| | | | | | | | | Take advantage of new mesa formats and new format_pack functions to reduce source code in _mesa_pack_rgba_span_from_ints() and _mesa_pack_rgba_span_from_uints(). Signed-off-by: Samuel Iglesias Gonsalvez <siglesias@igalia.com> Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
* mesa: use format conversion functions in swrastSamuel Iglesias Gonsalvez2015-01-121-1237/+122
| | | | | | | | This commit adds a macro to facilitate the task of using format conversions functions but keeps the same API. Signed-off-by: Samuel Iglesias Gonsalvez <siglesias@igalia.com> Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
* mesa/formats: add new mesa formats and their pack/unpack functions.Samuel Iglesias Gonsalvez2015-01-125-1/+145
| | | | | | | | | | | | | This will be used to refactor code in pack.c and support conversion to/from these types in a master convert function that will be added later. v2: - Fix autogeneration of MESA_FORMAT_A2R10G10B10_UNORM pack/unpack functions Signed-off-by: Samuel Iglesias Gonsalvez <siglesias@igalia.com> Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
* mesa/format_pack: Add _mesa_pack_int_rgba_row()Samuel Iglesias Gonsalvez2015-01-122-0/+88
| | | | | | | | | | | | | | | | | | | | This will be used to unify code in pack.c. v2: - Modify pack_int_*() function generator to use c.datatype() and f.datatype() v3: - Only autogenerate pack_int_*() functions for non-normalized integer formats. v4: - Use _mesa_unsigned_to_unsigned() in pack_int_*() because, in order to be able to pack both signed and unsigned formats, we need to sign-extend. Signed-off-by: Samuel Iglesias Gonsalvez <siglesias@igalia.com> Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
* mesa: Add _mesa_pack_uint_rgba_row() format conversion functionSamuel Iglesias Gonsalvez2015-01-122-0/+87
| | | | | | | | | | | | | | | | | | We will use this later on to handle uint conversion scenarios in a master convert function. v2: - Modify pack_uint_*() function generation to use c.datatype() and f.datatype(). - Remove UINT_TO_FLOAT() macro usage from pack_uint*() - Remove "if not f.is_normalized()" conditional as pack_uint*() functions are only autogenerated for non normalized formats. v3: - Add clamping for non-normalized integer formats in pack_uint*() Signed-off-by: Samuel Iglesias Gonsalvez <siglesias@igalia.com> Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
* mesa: Autogenerate format_unpack.cJason Ekstrand2015-01-126-4396/+915
| | | | | | | | | | | | | | | | | | | | | | | | | Signed-off-by: Jason Ekstrand <jason.ekstrand@intel.com> v2 by Samuel Iglesias <siglesias@igalia.com>: - Add usage of INDENT_FLAGS in Makefile.am v3 by Samuel Iglesias <siglesias@igalia.com>: - Modify unpack_float_*() and unpack_ubyte_*() function generation to use c.datatype() and f.datatype() - Fix out-of-tree build v4 by Samuel Iglesias <siglesias@igalia.com>: - format_unpack.c.mako is now format_unpack.py, with the template code inlined. It now auto-generates format_unpack.c - Add format_unpack.c to gitignore. - Simplify Makefile.am change - Modify SConscript to build format_unpack.c with scons v5 by Samuel Iglesias <siglesias@igalia.com>: - Don't allow float to non-normalized integer format conversions. Signed-off-by: Samuel Iglesias Gonsalvez <siglesias@igalia.com> Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
* mesa: Autogenerate most of format_pack.cJason Ekstrand2015-01-127-2983/+985
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We were auto-generating it before. The problem was that the autogeneration tool we were using was called "copy, paste, and edit". Let's use a more sensible solution. Signed-off-by: Jason Ekstrand <jason.ekstrand@intel.com> v2 by Samuel Iglesias <siglesias@igalia.com> - Remove format_pack.c as it is now autogenerated - Add usage of INDENT_FLAGS in Makefile.am - Remove trailing blank line v3 by Samuel Iglesias <siglesias@igalia.com> - Merge format_convert.py into format_parser.py - Adapt pack_*_* function generations - Fix out-of-tree build v4 by Samuel Iglesias <siglesias@igalia.com> - _get_datatype() is now a helper function v5 by Samuel Iglesias <siglesias@igalia.com> - format_pack.c.mako is now format_pack.py, with the template code inlined. It now auto-generates format_pack.c - Simplify Makefile.am change. - Modify SConscript to build format_pack.c with scons. - Remove run_mako.py - Add format_pack.c to gitignore v6 by Samuel Iglesias <siglesias@igalia.com>: - Don't allow float to non-normalized integer format conversions. - Add non-normalized formats support for ubyte packing functions. Merge the previously separated patch. - Add clamping for non-normalized integer formats in pack_ubyte*() v7 by Samuel Iglesias <siglesias@igalia.com>: - Add assert to check that sRGB formats are 8-bit size. Signed-off-by: Samuel Iglesias Gonsalvez <siglesias@igalia.com> Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
* mesa: Add a _mesa_is_format_color_format helperJason Ekstrand2015-01-122-0/+22
| | | | | Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com> Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
* mesa: Let _mesa_get_format_base_format also handle mesa_array_format.Iago Toral Quiroga2015-01-122-4/+74
| | | | | | | | | | | | | | | | | | | | | | If we need the base format for a mesa_array_format we have to find the matching mesa_format first. This is expensive because it requires to loop through all existing mesa formats until we find the right match. We can resolve the base format of an array format directly by looking at its swizzle information. Also, we can have _mesa_get_format_base_format accept an uint32_t which can pack either a mesa_format or a mesa_array_format and resolve the base format for either type. This way clients do not need to check if they have a mesa_format or a mesa_array_format and call different functions depending on the case. Another reason to resolve the base format for array formats directly is that we don't have matching mesa_format enums for every possible array format, so for some GL format/type combinations we can produce array formats that don't have a corresponding mesa format, in which case we would not be able to find the base format. Example format=GL_RGB, type=GL_UNSIGNED_SHORT. This type would map to something like MESA_FORMAT_RGB_UNORM16, but we don't have that. Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
* main: Add a concept of an array formatJason Ekstrand2015-01-123-1/+209
| | | | | | | | | | | | | | | | | | | | An array format is a 32-bit integer format identifier that can represent any format that can be represented as an array of standard GL datatypes. Whie the MESA_FORMAT enums provide several of these, they don't account for all of them. v2 by Iago Toral Quiroga <itoral@igalia.com>: - Implement mesa_array_format as a plain bitfiled uint32_t type instead of using a struct inside a union to access the various components packed in it. This is necessary to support bigendian properly, as pointed out by Ian. - Squashed: Make float types normalized v3 by Iago Toral Quiroga <itoral@igalia.com>: - Include compiler.h in formats.h, which is necessary to build in MSVC as indicated by Brian Paul. Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
* swrast: Remove unused variable.Iago Toral Quiroga2015-01-121-3/+0
| | | | | Reviewed-by: Ian Romanick <ian.d.romanick@intel.com> Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
* mesa: Fix _mesa_swizzle_and_convert integer conversions to clamp properlySamuel Iglesias Gonsalvez2015-01-122-53/+94
| | | | | | | | | | | | | | | | | | | | | | | | | Fix various conversion paths that involved integer data types of different sizes (uint16_t to uint8_t, int16_t to uint8_t, etc) that were not being clamped properly. Also, one of the paths was incorrectly assigning the value 12, instead of 1, to the constant "one". v2: - Create auxiliary clamping functions and use them in all paths that required clamp because of different source and destination sizes and signed-unsigned conversions. v3: - Create MIN_INT macro and use it. v4: - Add _mesa_float_to_[un]signed() and mesa_half_to_[un]signed() auxiliary functions. - Add clamp for float-to-integer conversions in _mesa_swizzle_and_convert() Signed-off-by: Samuel Iglesias Gonsalvez <siglesias@igalia.com> Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
* mesa/format_utils: Prefix and expose the conversion helper functionsJason Ekstrand2015-01-122-161/+159
| | | | | | | | | | | Signed-off-by: Jason Ekstrand <jason.ekstrand@intel.com> v2 by Samuel Iglesias <siglesias@igalia.com>: - Fix compilation errors Signed-off-by: Samuel Iglesias Gonsalvez <siglesias@igalia.com> Reviewed-by: Ian Romanick <ian.d.romanick@intel.com> Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
* mesa: Fix incorrect assertion in init_teximage_fields_msIago Toral Quiroga2015-01-121-1/+1
| | | | | | | | | | | | | | | | _BaseFormat is a GLenum (unsigned int) so testing if its value is greater than 0 to detect the cases where _mesa_base_tex_format returns -1 doesn't work. Fixing the assertion breaks the arb_texture_view-lifetime-format piglit test on nouveau, since that test calls _mesa_base_tex_format with GL_R16F with a context that does not have ARB_texture_float, so it returns -1 for the BaseFormat, which was not being caught properly by the ASSERT in init_teximage_fields_ms until now. Reviewed-by: Ian Romanick <ian.d.romanick@intel.com> Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
* mesa: Fix get_texbuffer_format().Samuel Iglesias Gonsalvez2015-01-121-2/+2
| | | | | | | | | We were returning incorrect mesa formats for GL_LUMINANCE_ALPHA16I_EXT and GL_LUMINANCE_ALPHA32I_EXT. Signed-off-by: Samuel Iglesias Gonsalvez <siglesias@igalia.com> Reviewed-by: Ian Romanick <ian.d.romanick@intel.com> Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
* mesa: Fix A1R5G5B5 packing/unpackingJason Ekstrand2015-01-124-19/+11
| | | | | | | | As with B5G6R5, these have been left broken with comments saying they are. Signed-off-by: Jason Ekstrand <jason.ekstrand@intel.com> Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com> Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
* mesa/colormac: Remove an unused macroJason Ekstrand2015-01-121-3/+0
| | | | | | | | | The PACK_565_REV macro is no longer used. It was also extremely confusing because it's actually a byteswapped 565 not reversed 565. Signed-off-by: Jason Ekstrand <jason.ekstrand@intel.com> Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com> Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
* mesa: Fix packing/unpacking of MESA_FORMAT_R5G6B5_UNORMJason Ekstrand2015-01-126-27/+18
| | | | | | | | | | | | | | Aparently, the packing/unpacking functions for these formats have differed from the format description in formats.h. Instead of fixing this, people simply left a comment saying it was broken. Let's actually fix it for real. v2 by Samuel Iglesias <siglesias@igalia.com>: - Fix comment in formats.h Signed-off-by: Jason Ekstrand <jason.ekstrand@intel.com> Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com> Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
* mesa: Fix clamping to -1.0 in snorm_to_floatJason Ekstrand2015-01-121-1/+1
| | | | | | | | | | | | | This patch fixes the return of a wrong value when x is lower than -MAX_INT(src_bits) as the result would not be between [-1.0 1.0]. v2 by Samuel Iglesias <siglesias@igalia.com>: - Modify snorm_to_float() to avoid doing the division when x == -MAX_INT(src_bits) Cc: 10.4 <mesa-stable@lists.freedesktop.org> Reviewed-by: Ian Romanick <ian.d.romanick@intel.com> Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
* i965: Respect the no_8 flag on Gen6, not just Gen7+.Kenneth Graunke2015-01-121-2/+2
| | | | | | | | | | | | | | | When doing repclears, we only want to use the SIMD16 program, not the SIMD8 one. Kristian added this to the Gen7+ code, but apparently we missed it in the Gen6 code. This patch copies that code over. Approximately doubles the performance in a clear microbenchmark from mesa-demos (clearspd -width 500 -height 500 +color) on Sandybridge. Cc: "10.4 10.3" <mesa-stable@lists.freedesktop.org> Signed-off-by: Kenneth Graunke <kenneth@whitecape.org> Reviewed-by: Kristian Høgsberg <krh@bitplanet.net> Reviewed-by: Matt Turner <mattst88@gmail.com> References: https://code.google.com/p/chrome-os-partner/issues/detail?id=34681
* mesa: Always generate GL_INVALID_OPERATION in _mesa_GetProgramBinaryIan Romanick2015-01-121-0/+2
| | | | | | | | | | | There are no binary formats supported, so what are you doing? At least this gives the application developer some feedback about what's going on. The spec gives no guidance about what to do in this scenario. Signed-off-by: Ian Romanick <ian.d.romanick@intel.com> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=87516 Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> Acked-by: Leight Bade <leith@mapbox.com>
* mesa: Ensure that length is set to zero in _mesa_GetProgramBinaryIan Romanick2015-01-121-6/+20
| | | | | | | | | v2: Fix assignment of length. Noticed by Julien Cristau. Signed-off-by: Ian Romanick <ian.d.romanick@intel.com> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=87516 Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> Acked-by: Leight Bade <leith@mapbox.com>
* mesa: Add missing error checks in _mesa_ProgramBinaryIan Romanick2015-01-121-2/+25
| | | | | | | Signed-off-by: Ian Romanick <ian.d.romanick@intel.com> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=87516 Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> Acked-by: Leight Bade <leith@mapbox.com>
* vc4: Clamp the inputs to the blend equation to [0, 1].Eric Anholt2015-01-111-1/+10
| | | | Fixes the remaining ARB_color_buffer_float rendering tests.
* vc4: Add a little helper for clamping to [0,1].Eric Anholt2015-01-111-4/+10
|
* vc4: Fix up statechange management for uncompiled/compiled FS/VS.Eric Anholt2015-01-112-11/+10
| | | | | | | | No need to recheck the FS compile when the VS source has changed, but there *is* a need to recheck the VS compile when the compiled VS has changed (since the live inputs may change). Fixes es3conform's blend test.
* vc4: Fix clear color setup for RGB565.Eric Anholt2015-01-111-1/+4
| | | | | | | The util_pack_color() thing only sets up the low bits of the union, so only return them, too. Fixes intermittent failure on fbo-alphatest-formats and es3conform's framebuffer-objects test under simulation.
* vc4: Avoid the save/restore of r3 for raddr conflicts, just use ra31.Eric Anholt2015-01-112-38/+11
| | | | | | | | | | | | | Turns out this was harmful in code quality: total instructions in shared programs: 39487 -> 38845 (-1.63%) instructions in affected programs: 22522 -> 21880 (-2.85%) This costs us yet another register, which is painful since it means more programs might fail to compile). However, the alternative was causing us trouble where we'd save/restore r3 while it contained a MIN-ed direct texture offset, causing the kernel to fail to validate our shaders (such as in GLB2.7).
* vc4: Allow dead code elimination of VPM reads.Eric Anholt2015-01-102-1/+44
| | | | | | | | This gets a bunch of dead reads out of the CSes, which don't read most attributes generally. total instructions in shared programs: 39753 -> 39487 (-0.67%) instructions in affected programs: 4721 -> 4455 (-5.63%)
* vc4: Cook up the draw-time VPM setup info during shader compile.Eric Anholt2015-01-104-11/+28
| | | | | | This will give the compiler the chance to dead-code eliminate unused VPM reads. This is particularly a big deal in the CS where a bunch of vattrs are just not going to be used.
* vc4: Split two notions of instructions having side effects.Eric Anholt2015-01-105-4/+15
| | | | | Some ops can't be DCEd, while some of the ops that are just important due to the args they have can be.
* vc4: Redo VPM reads as a read file.Eric Anholt2015-01-105-16/+16
| | | | This will let us do copy propagation of the VPM reads.
* vc4: Fix miscalculation of the VPM space.Eric Anholt2015-01-101-1/+1
| | | | | We pass in a byte offset, not dword. I'm rather scared that this actually managed to pass piglit, but it does fix gears.
* vc4: Pack VPM attr contents according to just the size of the attribute.Eric Anholt2015-01-103-11/+9
| | | | | total instructions in shared programs: 40960 -> 39753 (-2.95%) instructions in affected programs: 20871 -> 19664 (-5.78%)
* vc4: Restructure color packing as a series of channel replacements.Eric Anholt2015-01-104-49/+60
| | | | | | | | | I'm using this in some WIP commits for doing blending in 8888 instead of vec4. But it also gives us these results immediately, thanks to allowing more uniforms/immediates in the arguments: total instructions in shared programs: 41027 -> 40960 (-0.16%) instructions in affected programs: 4381 -> 4314 (-1.53%)
* vc4: Fix the no-copy-propagating-from-TLB_COLOR_READ check.Eric Anholt2015-01-101-1/+1
| | | | | Our MOV's dst obviously won't be the TLB_COLOR_READ's def, because we're ssa.
* vc4: Move global seqno short-circuiting to vc4_wait_seqno().Eric Anholt2015-01-102-6/+3
| | | | Any other caller would want it, too.
* state_tracker: Fix assertion failures in conditional block movs.Eric Anholt2015-01-101-31/+26
| | | | | | | | | | | | | If you had a conditional assignment of an array or struct (say, from the if-lowering pass), we'd try doing swizzle_for_size() on the aggregate type, and it would assertion fail due to vector_elements==0. Instead, extend emit_block_mov() to handle emitting the conditional operations, which also means we'll have appropriate writemasks/swizzles on the CMPs within a struct containing various-sized members. Fixes 20 testcases in es3conform on vc4. Reviewed-by: Jose Fonseca <jfonseca@vmware.com>