summaryrefslogtreecommitdiffstats
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
* 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 <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
* 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 <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
* mesa: Autogenerate format_unpack.cJason Ekstrand2015-01-126-4396/+915
| | | | | | | | | | | | | | | | | | | | | | | | | Signed-off-by: Jason Ekstrand <[email protected]> v2 by Samuel Iglesias <[email protected]>: - Add usage of INDENT_FLAGS in Makefile.am v3 by Samuel Iglesias <[email protected]>: - Modify unpack_float_*() and unpack_ubyte_*() function generation to use c.datatype() and f.datatype() - Fix out-of-tree build v4 by Samuel Iglesias <[email protected]>: - 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 <[email protected]>: - Don't allow float to non-normalized integer format conversions. Signed-off-by: Samuel Iglesias Gonsalvez <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
* 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 <[email protected]> v2 by Samuel Iglesias <[email protected]> - 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 <[email protected]> - Merge format_convert.py into format_parser.py - Adapt pack_*_* function generations - Fix out-of-tree build v4 by Samuel Iglesias <[email protected]> - _get_datatype() is now a helper function v5 by Samuel Iglesias <[email protected]> - 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 <[email protected]>: - 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 <[email protected]>: - Add assert to check that sRGB formats are 8-bit size. Signed-off-by: Samuel Iglesias Gonsalvez <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
* mesa: Add a _mesa_is_format_color_format helperJason Ekstrand2015-01-122-0/+22
| | | | | Reviewed-by: Jason Ekstrand <[email protected]> Reviewed-by: Anuj Phogat <[email protected]>
* 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 <[email protected]>
* 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 <[email protected]>: - 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 <[email protected]>: - Include compiler.h in formats.h, which is necessary to build in MSVC as indicated by Brian Paul. Reviewed-by: Jason Ekstrand <[email protected]>
* swrast: Remove unused variable.Iago Toral Quiroga2015-01-121-3/+0
| | | | | Reviewed-by: Ian Romanick <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
* 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 <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
* mesa/format_utils: Prefix and expose the conversion helper functionsJason Ekstrand2015-01-122-161/+159
| | | | | | | | | | | Signed-off-by: Jason Ekstrand <[email protected]> v2 by Samuel Iglesias <[email protected]>: - Fix compilation errors Signed-off-by: Samuel Iglesias Gonsalvez <[email protected]> Reviewed-by: Ian Romanick <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
* 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 <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
* 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 <[email protected]> Reviewed-by: Ian Romanick <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
* 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 <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* 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 <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* 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 <[email protected]>: - Fix comment in formats.h Signed-off-by: Jason Ekstrand <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]> Reviewed-by: Anuj Phogat <[email protected]>
* 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 <[email protected]>: - Modify snorm_to_float() to avoid doing the division when x == -MAX_INT(src_bits) Cc: 10.4 <[email protected]> Reviewed-by: Ian Romanick <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
* 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" <[email protected]> Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Kristian Høgsberg <[email protected]> Reviewed-by: Matt Turner <[email protected]> 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 <[email protected]> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=87516 Reviewed-by: Kenneth Graunke <[email protected]> Acked-by: Leight Bade <[email protected]>
* 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 <[email protected]> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=87516 Reviewed-by: Kenneth Graunke <[email protected]> Acked-by: Leight Bade <[email protected]>
* mesa: Add missing error checks in _mesa_ProgramBinaryIan Romanick2015-01-121-2/+25
| | | | | | | Signed-off-by: Ian Romanick <[email protected]> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=87516 Reviewed-by: Kenneth Graunke <[email protected]> Acked-by: Leight Bade <[email protected]>
* 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 <[email protected]>
* i965: Consider SEL.{GE,L} to be commutative operations.Matt Turner2015-01-082-10/+27
| | | | Reviewed-by: Kenneth Graunke <[email protected]>
* i965/cfg: Fix end_ip of last basic block.Matt Turner2015-01-081-1/+1
| | | | | | | start_ip and end_ip are inclusive. Increases instruction counts in 64 shaders in shader-db, likely indicative of them previously being misoptimized.
* mesa: compute row stride outside of loop and fix MSVC compilation errorBrian Paul2015-01-081-2/+4
| | | | | | Can't do void pointer arithmetic with MSVC. Reviewed-by: Jose Fonseca <[email protected]>
* mesa: fix MSVC compilation errorsBrian Paul2015-01-081-5/+5
| | | | | | Move assertions after declarations and don't use void pointer arithmetic. Reviewed-by: Jose Fonseca <[email protected]>
* main: Checking for cube completeness in TextureSubImage.Laura Ekstrand2015-01-081-13/+35
| | | | | | | | This is part of a potential solution to a spec bug. Cube completeness is a concept from glGenerateMipmap, but it seems reasonable to check for it in TextureSubImage when target=GL_TEXTURE_CUBE_MAP. Reviewed-by: Anuj Phogat <[email protected]>
* main: Checking for cube completeness in GetTextureImage.Laura Ekstrand2015-01-081-12/+35
| | | | | | | | This is part of a potential solution to a spec bug. Cube completeness is a concept from glGenerateMipmap, but it seems reasonable to check for it in GetTextureImage when the target is GL_TEXTURE_CUBE_MAP. Reviewed-by: Anuj Phogat <[email protected]>
* main: Added _mesa_cube_level_complete to check for the completeness of an ↵Laura Ekstrand2015-01-082-9/+18
| | | | | | arbitrary cube map level. Reviewed-by: Chad Versace <[email protected]>
* main: glDeleteTextures now throws GL_INVALID_VALUE if n is negative.Laura Ekstrand2015-01-081-0/+5
| | | | | | This is in conformance with the OpenGL spec. Reviewed-by: Anuj Phogat <[email protected]>
* main: Refactor in teximage.c to handle NULL from _mesa_get_current_tex_object.Laura Ekstrand2015-01-081-0/+22
| | | | Reviewed-by: Anuj Phogat <[email protected]>
* main: Added entry point for glTextureBuffer.Laura Ekstrand2015-01-084-16/+92
| | | | Reviewed-by: Anuj Phogat <[email protected]>
* main: Fix texObj->Immutable flag update in _mesa_texture_image_multisample.Laura Ekstrand2015-01-081-1/+1
| | | | Reviewed-by: Anuj Phogat <[email protected]>
* main: Added entry points for glTextureStorage[23]DMultisample.Laura Ekstrand2015-01-084-28/+137
| | | | Reviewed-by: Anuj Phogat <[email protected]>
* main: Added entry point for glGenerateTextureMipmap.Laura Ekstrand2015-01-084-20/+62
| | | | Reviewed-by: Anuj Phogat <[email protected]>
* main: Added entry points for glCompressedTextureSubImage*D.Laura Ekstrand2015-01-084-52/+256
| | | | Reviewed-by: Anuj Phogat <[email protected]>
* main: Added entry point for glGetCompressedTextureImage.Laura Ekstrand2015-01-084-45/+141
| | | | Reviewed-by: Anuj Phogat <[email protected]>