Iago Toral Quiroga [Mon, 10 Nov 2014 16:45:55 +0000 (17:45 +0100)]
mesa: Remove _mesa_pack_rgba_span_float and tmp_pack.h
_mesa_pack_rgba_span_float was the last of the color span functions
and we have replaced all calls to it with calls to _mesa_format_convert,
so we can remove it together with tmp_pack.h which was used to
generate the pack functions for multiple types that were used from
the various color span functions that have been removed.
Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
Iago Toral Quiroga [Mon, 10 Nov 2014 11:25:57 +0000 (12:25 +0100)]
mesa: Remove _mesa_unpack_color_span_float
And various helper functions that went unused after removing it.
Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
Iago Toral Quiroga [Mon, 10 Nov 2014 08:55:18 +0000 (09:55 +0100)]
mesa: Remove (signed) integer pack and span functions.
These are no longer used now that we moved to _mesa_format_convert.
Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
Iago Toral Quiroga [Mon, 10 Nov 2014 08:49:14 +0000 (09:49 +0100)]
mesa: Remove _mesa_unpack_color_span_ubyte
This is no longer used anywhere after moving to _mesa_format_convert.
Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
Iago Toral Quiroga [Fri, 7 Nov 2014 11:20:11 +0000 (12:20 +0100)]
mesa: Remove _mesa_make_temp_float_image
Now that we have _mesa_format_convert we don't need this.
This was only used to create temporary RGBA float images in the process
of storing some compressed formats. These can call _mesa_texstore
with a RGBA/float dst to achieve the same goal.
Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
Iago Toral Quiroga [Fri, 7 Nov 2014 10:17:29 +0000 (11:17 +0100)]
mesa: Remove _mesa_make_temp_ubyte_image
Now that we have _mesa_format_convert we don't need this.
texstore_rgba will use the GL_COLOR_INDEX to RGBA conversion
helpers instead and compressed formats that used
_mesa_make_temp_ubyte_image to create an ubyte RGBA temporary
image can call _mesa_texstore with a RGBA/ubyte dst to
achieve the same goal.
Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
Iago Toral Quiroga [Thu, 6 Nov 2014 15:46:13 +0000 (16:46 +0100)]
mesa: Remove _mesa_unpack_color_span_uint
This is no longer used.
Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
Eduardo Lima Mitev [Tue, 21 Oct 2014 17:11:41 +0000 (19:11 +0200)]
mesa: Replace _mesa_unpack_bitmap with _mesa_unpack_image()
_mesa_unpack_bitmap() was introduced by commit
02b801c to handle the case
when data is stored in PBO by display lists, in the context of this bug:
Incorrect pixels read back if draw bitmap texture through Display list
https://bugs.freedesktop.org/show_bug.cgi?id=10370
Since _mesa_unpack_image() already handles the case of GL_BITMAP, this patch
removes _mesa_unpack_bitmap() and makes affected calls go through
_mesa_unapck_image() instead.
The sample test attached to the original bug report passes with this change
and there are no piglit regressions.
Signed-off-by: Eduardo Lima Mitev <elima@igalia.com>
Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
Iago Toral Quiroga [Thu, 27 Nov 2014 07:31:00 +0000 (08:31 +0100)]
mesa: Let _mesa_swizzle_and_convert take array format types instead of GL types
In the future we would like to have a format conversion library that is
independent of GL so we can share it with Gallium. This is a step in that
direction.
Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
Iago Toral Quiroga [Wed, 26 Nov 2014 09:20:55 +0000 (10:20 +0100)]
st/mesa: Use _mesa_format_convert to implement st_GetTexImage.
Instead of using _mesa_pack_rgba_span_float. This should allow us to remove
that function in a later patch.
Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
Iago Toral Quiroga [Mon, 10 Nov 2014 10:25:20 +0000 (11:25 +0100)]
swrast: Use _mesa_format_convert to implement draw_rgba_pixels.
This is the only place that uses _mesa_unpack_color_span_float so after
this we should be able to remove that function.
Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
Iago Toral Quiroga [Wed, 26 Nov 2014 09:19:54 +0000 (10:19 +0100)]
mesa: Use _mesa_format_convert to implement get_tex_rgba_compressed.
Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
Iago Toral Quiroga [Mon, 27 Oct 2014 13:40:55 +0000 (14:40 +0100)]
mesa: use _mesa_format_convert to implement get_tex_rgba_uncompressed.
Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
Iago Toral Quiroga [Thu, 23 Oct 2014 08:04:56 +0000 (10:04 +0200)]
mesa: use _mesa_format_convert to implement glReadPixels.
Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
Iago Toral Quiroga [Wed, 15 Oct 2014 11:42:11 +0000 (13:42 +0200)]
mesa: Use _mesa_format_convert to implement texstore_rgba.
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>
Iago Toral Quiroga [Fri, 7 Nov 2014 07:32:14 +0000 (08:32 +0100)]
mesa: Add helpers to extract GL_COLOR_INDEX to RGBA float/ubyte
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>
Iago Toral Quiroga [Wed, 29 Oct 2014 12:32:43 +0000 (13:32 +0100)]
mesa: Add RGBA to Luminance conversion helpers
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>
Iago Toral Quiroga [Thu, 30 Oct 2014 10:55:02 +0000 (11:55 +0100)]
mesa: Add _mesa_swap2_copy and _mesa_swap4_copy
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>
Samuel Iglesias Gonsalvez [Wed, 15 Oct 2014 11:03:06 +0000 (13:03 +0200)]
mesa/pack: use _mesa_format_from_format_and_type in _mesa_pack_rgba_span_from_*
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>
Iago Toral Quiroga [Fri, 5 Dec 2014 12:10:08 +0000 (13:10 +0100)]
mesa: Add helper to convert a GL format and type to a mesa (array) format.
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>
Iago Toral Quiroga [Wed, 26 Nov 2014 08:39:35 +0000 (09:39 +0100)]
mesa: Add a helper _mesa_compute_rgba2base2rgba_component_mapping
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>
Iago Toral Quiroga [Wed, 26 Nov 2014 08:05:08 +0000 (09:05 +0100)]
mesa: Add a rebase_swizzle parameter to _mesa_format_convert
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>
Iago Toral Quiroga [Thu, 6 Nov 2014 12:19:45 +0000 (13:19 +0100)]
mesa: Expose compute_component_mapping as _mesa_compute_component_mapping
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>
Jason Ekstrand [Mon, 25 Aug 2014 17:55:06 +0000 (10:55 -0700)]
mesa: Add an implementation of a master convert function.
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>
Samuel Iglesias Gonsalvez [Fri, 10 Oct 2014 10:46:02 +0000 (12:46 +0200)]
mesa/pack: refactor _mesa_pack_rgba_span_float()
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>
Samuel Iglesias Gonsalvez [Fri, 10 Oct 2014 11:06:36 +0000 (13:06 +0200)]
mesa/main/pack_tmp.h: Add float conversion support
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>
Samuel Iglesias Gonsalvez [Fri, 10 Oct 2014 08:38:06 +0000 (10:38 +0200)]
mesa/pack: use autogenerated format_pack functions
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>
Samuel Iglesias Gonsalvez [Fri, 3 Oct 2014 07:39:55 +0000 (09:39 +0200)]
mesa: use format conversion functions in swrast
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>
Samuel Iglesias Gonsalvez [Wed, 8 Oct 2014 09:06:21 +0000 (11:06 +0200)]
mesa/formats: add new mesa formats and their pack/unpack functions.
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>
Samuel Iglesias Gonsalvez [Wed, 8 Oct 2014 14:02:21 +0000 (16:02 +0200)]
mesa/format_pack: Add _mesa_pack_int_rgba_row()
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>
Samuel Iglesias Gonsalvez [Thu, 2 Oct 2014 10:37:52 +0000 (12:37 +0200)]
mesa: Add _mesa_pack_uint_rgba_row() format conversion function
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>
Jason Ekstrand [Fri, 22 Aug 2014 16:49:09 +0000 (09:49 -0700)]
mesa: Autogenerate format_unpack.c
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>
Jason Ekstrand [Thu, 21 Aug 2014 19:38:05 +0000 (12:38 -0700)]
mesa: Autogenerate most of format_pack.c
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>
Samuel Iglesias Gonsalvez [Fri, 21 Nov 2014 07:53:21 +0000 (08:53 +0100)]
configure: require python mako module
It is now a hard dependency because of the autogeneration of
format pack and unpack functions.
Update the documentation to reflect this change.
v2:
- Inline python script in m4 file and use PYTHON2
v3:
- Remove semicolons and quotes and change coding style
- Add Ilia Mirkin suggestion to use Python's split functionality.
- Use AX_CHECK_PYTHON_MAKO_MODULE name.
- Change to MIT license
Signed-off-by: Samuel Iglesias Gonsalvez <siglesias@igalia.com>
Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
Jason Ekstrand [Tue, 26 Aug 2014 21:26:44 +0000 (14:26 -0700)]
mesa: Add a _mesa_is_format_color_format helper
Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
Iago Toral Quiroga [Wed, 26 Nov 2014 09:38:44 +0000 (10:38 +0100)]
mesa: Let _mesa_get_format_base_format also handle mesa_array_format.
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>
Jason Ekstrand [Sat, 23 Aug 2014 17:45:00 +0000 (10:45 -0700)]
main: Add a concept of an array format
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>
Iago Toral Quiroga [Mon, 10 Nov 2014 10:30:15 +0000 (11:30 +0100)]
swrast: Remove unused variable.
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
Samuel Iglesias Gonsalvez [Mon, 27 Oct 2014 15:15:36 +0000 (16:15 +0100)]
mesa: Fix _mesa_swizzle_and_convert integer conversions to clamp properly
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>
Jason Ekstrand [Thu, 21 Aug 2014 19:30:10 +0000 (12:30 -0700)]
mesa/format_utils: Prefix and expose the conversion helper functions
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>
Iago Toral Quiroga [Fri, 28 Nov 2014 09:03:56 +0000 (10:03 +0100)]
mesa: Fix incorrect assertion in init_teximage_fields_ms
_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>
Samuel Iglesias Gonsalvez [Fri, 7 Nov 2014 09:43:32 +0000 (10:43 +0100)]
mesa: Fix get_texbuffer_format().
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>
Jason Ekstrand [Sat, 23 Aug 2014 03:32:27 +0000 (20:32 -0700)]
mesa: Fix A1R5G5B5 packing/unpacking
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>
Jason Ekstrand [Fri, 22 Aug 2014 22:06:52 +0000 (15:06 -0700)]
mesa/colormac: Remove an unused macro
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>
Jason Ekstrand [Fri, 22 Aug 2014 20:39:23 +0000 (13:39 -0700)]
mesa: Fix packing/unpacking of MESA_FORMAT_R5G6B5_UNORM
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>
Jason Ekstrand [Sat, 23 Aug 2014 15:36:46 +0000 (08:36 -0700)]
mesa: Fix clamping to -1.0 in snorm_to_float
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>
Emil Velikov [Mon, 12 Jan 2015 10:42:16 +0000 (10:42 +0000)]
docs: add news item and link release notes for mesa 10.3.7/10.4.2
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
Emil Velikov [Mon, 12 Jan 2015 10:36:23 +0000 (10:36 +0000)]
docs: Add sha256 sums for the 10.4.2 release
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
(cherry picked from commit
14f1659b4311589959b2513e437f0229174eb5ae)
Emil Velikov [Mon, 12 Jan 2015 10:30:28 +0000 (10:30 +0000)]
Add release notes for the 10.4.2 release
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
(cherry picked from commit
02f2e97c3ee4a10696bfce79b6299d478bb6e59a)
Emil Velikov [Mon, 12 Jan 2015 10:17:08 +0000 (10:17 +0000)]
docs: Add sha256 sums for the 10.3.7 release
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
(cherry picked from commit
20e0546cc2aa2a32919c3fb179507a60bef8e6e7)
Emil Velikov [Mon, 12 Jan 2015 10:06:40 +0000 (10:06 +0000)]
Add release notes for the 10.3.7 release
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
(cherry picked from commit
6b00e5585a765a82219ceffce2840308df52b44b)
Kenneth Graunke [Sat, 10 Jan 2015 04:46:17 +0000 (20:46 -0800)]
i965: Respect the no_8 flag on Gen6, not just Gen7+.
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
Ian Romanick [Sun, 21 Dec 2014 20:06:23 +0000 (12:06 -0800)]
mesa: Always generate GL_INVALID_OPERATION in _mesa_GetProgramBinary
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>
Ian Romanick [Sun, 21 Dec 2014 20:03:57 +0000 (12:03 -0800)]
mesa: Ensure that length is set to zero in _mesa_GetProgramBinary
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>
Ian Romanick [Sun, 21 Dec 2014 20:03:09 +0000 (12:03 -0800)]
mesa: Add missing error checks in _mesa_ProgramBinary
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>
Eric Anholt [Sun, 11 Jan 2015 02:30:39 +0000 (15:30 +1300)]
vc4: Clamp the inputs to the blend equation to [0, 1].
Fixes the remaining ARB_color_buffer_float rendering tests.
Eric Anholt [Sun, 11 Jan 2015 02:22:22 +0000 (15:22 +1300)]
vc4: Add a little helper for clamping to [0,1].
Eric Anholt [Sun, 11 Jan 2015 01:52:26 +0000 (14:52 +1300)]
vc4: Fix up statechange management for uncompiled/compiled FS/VS.
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.
Eric Anholt [Sat, 10 Jan 2015 21:58:58 +0000 (10:58 +1300)]
vc4: Fix clear color setup for RGB565.
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.
Eric Anholt [Sat, 10 Jan 2015 02:59:56 +0000 (15:59 +1300)]
vc4: Avoid the save/restore of r3 for raddr conflicts, just use ra31.
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).
Eric Anholt [Sat, 10 Jan 2015 02:01:48 +0000 (15:01 +1300)]
vc4: Allow dead code elimination of VPM reads.
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%)
Eric Anholt [Sat, 10 Jan 2015 01:30:25 +0000 (14:30 +1300)]
vc4: Cook up the draw-time VPM setup info during shader compile.
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.
Eric Anholt [Sat, 10 Jan 2015 01:57:16 +0000 (14:57 +1300)]
vc4: Split two notions of instructions having side effects.
Some ops can't be DCEd, while some of the ops that are just important due
to the args they have can be.
Eric Anholt [Sat, 10 Jan 2015 01:07:12 +0000 (14:07 +1300)]
vc4: Redo VPM reads as a read file.
This will let us do copy propagation of the VPM reads.
Eric Anholt [Sat, 10 Jan 2015 01:34:16 +0000 (14:34 +1300)]
vc4: Fix miscalculation of the VPM space.
We pass in a byte offset, not dword. I'm rather scared that this actually
managed to pass piglit, but it does fix gears.
Eric Anholt [Fri, 9 Jan 2015 20:56:34 +0000 (12:56 -0800)]
vc4: Pack VPM attr contents according to just the size of the attribute.
total instructions in shared programs: 40960 -> 39753 (-2.95%)
instructions in affected programs: 20871 -> 19664 (-5.78%)
Eric Anholt [Fri, 9 Jan 2015 02:32:29 +0000 (18:32 -0800)]
vc4: Restructure color packing as a series of channel replacements.
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%)
Eric Anholt [Fri, 9 Jan 2015 15:22:50 +0000 (07:22 -0800)]
vc4: Fix the no-copy-propagating-from-TLB_COLOR_READ check.
Our MOV's dst obviously won't be the TLB_COLOR_READ's def, because we're
ssa.
Eric Anholt [Wed, 7 Jan 2015 23:15:22 +0000 (15:15 -0800)]
vc4: Move global seqno short-circuiting to vc4_wait_seqno().
Any other caller would want it, too.
Eric Anholt [Fri, 12 Dec 2014 19:35:28 +0000 (11:35 -0800)]
state_tracker: Fix assertion failures in conditional block movs.
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>
Matt Turner [Sat, 20 Dec 2014 20:21:46 +0000 (12:21 -0800)]
i965: Consider SEL.{GE,L} to be commutative operations.
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Matt Turner [Mon, 5 Jan 2015 02:04:13 +0000 (18:04 -0800)]
i965/cfg: Fix end_ip of last basic block.
start_ip and end_ip are inclusive.
Increases instruction counts in 64 shaders in shader-db, likely
indicative of them previously being misoptimized.
Brian Paul [Thu, 8 Jan 2015 21:10:12 +0000 (14:10 -0700)]
mesa: compute row stride outside of loop and fix MSVC compilation error
Can't do void pointer arithmetic with MSVC.
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
Brian Paul [Thu, 8 Jan 2015 21:08:58 +0000 (14:08 -0700)]
mesa: fix MSVC compilation errors
Move assertions after declarations and don't use void pointer arithmetic.
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
Laura Ekstrand [Mon, 15 Dec 2014 22:57:34 +0000 (14:57 -0800)]
main: Checking for cube completeness in TextureSubImage.
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 <anuj.phogat@gmail.com>
Laura Ekstrand [Mon, 15 Dec 2014 22:57:08 +0000 (14:57 -0800)]
main: Checking for cube completeness in GetTextureImage.
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 <anuj.phogat@gmail.com>
Laura Ekstrand [Thu, 1 Jan 2015 00:31:50 +0000 (16:31 -0800)]
main: Added _mesa_cube_level_complete to check for the completeness of an arbitrary cube map level.
Reviewed-by: Chad Versace <chad.versace@intel.com>
Laura Ekstrand [Fri, 12 Dec 2014 19:02:02 +0000 (11:02 -0800)]
main: glDeleteTextures now throws GL_INVALID_VALUE if n is negative.
This is in conformance with the OpenGL spec.
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
Laura Ekstrand [Tue, 9 Dec 2014 21:40:45 +0000 (13:40 -0800)]
main: Refactor in teximage.c to handle NULL from _mesa_get_current_tex_object.
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
Laura Ekstrand [Wed, 3 Dec 2014 01:51:30 +0000 (17:51 -0800)]
main: Added entry point for glTextureBuffer.
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
Laura Ekstrand [Tue, 2 Dec 2014 01:30:44 +0000 (17:30 -0800)]
main: Fix texObj->Immutable flag update in _mesa_texture_image_multisample.
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
Laura Ekstrand [Tue, 6 Jan 2015 20:09:38 +0000 (12:09 -0800)]
main: Added entry points for glTextureStorage[23]DMultisample.
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
Laura Ekstrand [Tue, 6 Jan 2015 20:08:43 +0000 (12:08 -0800)]
main: Added entry point for glGenerateTextureMipmap.
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
Laura Ekstrand [Tue, 6 Jan 2015 19:48:38 +0000 (11:48 -0800)]
main: Added entry points for glCompressedTextureSubImage*D.
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
Laura Ekstrand [Tue, 6 Jan 2015 19:39:04 +0000 (11:39 -0800)]
main: Added entry point for glGetCompressedTextureImage.
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
Laura Ekstrand [Wed, 10 Dec 2014 00:49:09 +0000 (16:49 -0800)]
main: Added entry point for glGetTextureImage.
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
Laura Ekstrand [Wed, 12 Nov 2014 19:56:12 +0000 (11:56 -0800)]
main: Nameless texture creation and deletion. Does not affect normal creation and deletion paths.
In implementing ARB_DIRECT_STATE_ACCESS functions, it is often necessary to
abstract the functionality of a traditional GL API function into a backend
that both the traditional and dsa API functions can share. For instance,
glTexParameteri and glTextureParameteri both call _mesa_texture_parameteri,
which takes a context object and a texture object as arguments.
The existance of such backend functions provides the opportunity for
driver internals (such as meta) to pass around the actual texture object
rather than its ID or target, saving on texture object storage and look-up
overhead.
This patch provides nameless texture creation and deletion for meta. This
will be used in an upcoming refactor of meta.
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
Laura Ekstrand [Tue, 6 Jan 2015 18:05:40 +0000 (10:05 -0800)]
main: Added entry points for CopyTextureSubImage*D.
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
Laura Ekstrand [Tue, 6 Jan 2015 18:04:31 +0000 (10:04 -0800)]
main: Fixed some comments in texparam.c
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
Laura Ekstrand [Wed, 10 Dec 2014 23:35:38 +0000 (15:35 -0800)]
main: Added entry points for glGetTextureParameteriv, Iiv, and Iuiv.
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
Laura Ekstrand [Wed, 10 Dec 2014 23:32:20 +0000 (15:32 -0800)]
main: Added entry point for glGetTextureParameterfv.
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
Laura Ekstrand [Wed, 10 Dec 2014 23:19:59 +0000 (15:19 -0800)]
main: Added entry points for glGetTextureLevelParameteriv, fv.
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
Laura Ekstrand [Thu, 11 Dec 2014 00:55:52 +0000 (16:55 -0800)]
main: legal_get_tex_level_parameter_target now handles GL_TEXTURE_CUBE_MAP.
ARB_DIRECT_STATE_ACCESS functions allow an effective target of
GL_TEXTURE_CUBE_MAP.
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
Laura Ekstrand [Thu, 11 Dec 2014 00:57:50 +0000 (16:57 -0800)]
main: Added entry points for glTextureParameteriv, Iiv, Iuiv.
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
Laura Ekstrand [Tue, 6 Jan 2015 00:48:34 +0000 (16:48 -0800)]
main: Added entry point for glTextureParameteri.
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
Laura Ekstrand [Thu, 11 Dec 2014 00:19:21 +0000 (16:19 -0800)]
main: Added entry point for glTextureParameterfv.
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
Laura Ekstrand [Thu, 11 Dec 2014 00:33:18 +0000 (16:33 -0800)]
main: Added entry point for glTextureParameterf.
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
Laura Ekstrand [Thu, 11 Dec 2014 00:13:31 +0000 (16:13 -0800)]
main: Added get_texobj_by_name in texparam.c.
This is a convenience function for *Texture*Parameter functions.
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
Laura Ekstrand [Thu, 11 Dec 2014 00:32:16 +0000 (16:32 -0800)]
main: set_tex_parameterf now handles errors according to the OpenGL 4.5 Specification.
Beginning in the OpenGL 4.3 core specification, certain error handling has
changed. One example shown here is that INVALID_ENUM is thrown instead of
INVALID_OPERATION when a user attempts to set sampler parameters for a
multisample target.
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
Laura Ekstrand [Thu, 11 Dec 2014 00:30:46 +0000 (16:30 -0800)]
main: set_tex_parameteri now handles errors according to the OpenGL 4.5 Specification.
Beginning in the OpenGL 4.3 core specification, some error handling has
changed (see OpenGL 4.5 core spec, 30.10.2014, Section 8.10 Texture
Parameters, pages 228-29). As an example, changing sampler states with a
multisample target throws INVALID_ENUM rather than INVALID_OPERATION.
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>