Commit Graph

21 Commits

Author SHA1 Message Date
Thomas Hellstrom fc6be40011 gallium/postprocess: Fix resource freeing
The code was triggering asserts in DEBUG builds of the SVGA driver since
the reference count of the resource was never decremented before destroy.

Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2016-09-01 07:59:49 +02:00
Marek Olšák 1ffe77e7bb gallium: split transfer_inline_write into buffer and texture callbacks
to reduce the call indirections with u_resource_vtbl.

The worst call tree you could get was:
  - u_transfer_inline_write_vtbl
    - u_default_transfer_inline_write
      - u_transfer_map_vtbl
        - driver_transfer_map
      - u_transfer_unmap_vtbl
        - driver_transfer_unmap

That's 6 indirect calls. Some drivers only had 5. The goal is to have
1 indirect call for drivers that care. The resource type can be determined
statically at most call sites.

The new interface is:
  pipe_context::buffer_subdata(ctx, resource, usage, offset, size, data)
  pipe_context::texture_subdata(ctx, resource, level, usage, box, data,
                                stride, layer_stride)

v2: fix whitespace, correct ilo's behavior

Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Acked-by: Roland Scheidegger <sroland@vmware.com>
2016-07-23 13:33:42 +02:00
Edward O'Callaghan 150c289f60 gallium/auxiliary: Sanitize NULL checks into canonical form
Use NULL tests of the form `if (ptr)' or `if (!ptr)'.
They do not depend on the definition of the symbol NULL.
Further, they provide the opportunity for the accidental
assignment, are clear and succinct.

Signed-off-by: Edward O'Callaghan <eocallaghan@alterapraxis.com>
Signed-off-by: Marek Olšák <marek.olsak@amd.com>
2015-12-06 17:10:23 +01:00
Marek Olšák 85f5722f70 gallium/util: use cso_set_samplers 2015-07-23 00:59:23 +02:00
Park, Jeongmin 2e6ba6afdb postprocess: Check for depth buffer in pp_jimenezmlaa
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=88962
Signed-off-by: Marek Olšák <marek.olsak@amd.com>
2015-02-07 12:12:00 +01:00
Marek Olšák c32114460d gallium: remove PIPE_USAGE_STATIC
Reviewed-by: Brian Paul <brianp@vmware.com>
2014-02-06 17:37:34 +01:00
Marek Olšák 164dc6216a gallium: allow choosing which colorbuffers to clear
Required for glClearBuffer, which only clears one colorbuffer attachment.

Example:
   If the first colorbuffer is float and the second one is int:
      pipe->clear(pipe, PIPE_CLEAR_COLOR0, float_clear_color, ...);
      pipe->clear(pipe, PIPE_CLEAR_COLOR1, int_clear_color, ...);

This doesn't need any driver changes yet, because all drivers just use:
  if (flags & PIPE_CLEAR_COLOR) ..

The drivers which support GL 3.0 will have to implement it properly though.
2013-12-12 18:48:04 +01:00
Brian Paul c27d8cc0c9 postprocess: refactor header files, etc
Move private data structures and function prototypes out of the
public postprocess.h header file.
Create a pp_private.h for the shared, private data structures, functions.
Remove pp_program.h header.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
2013-11-18 08:56:34 -07:00
Brian Paul de2fd7dd0b postprocess: rename program to pp_program
To match the pp_ namespace convention.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
2013-11-18 08:56:34 -07:00
Marek Olšák 4c89ec1f69 gallium/postprocessing: convert blits to pipe->blit
PP saves current states to cso_context and then util_blit_pixels does
the same. cso_context doesn't like that and the original state is not
correctly restored.

Cc: mesa-stable@lists.freedesktop.org
Reviewed-by: Brian Paul <brianp@vmware.com>
2013-07-30 23:31:22 +02:00
Matthew McClure e87fc11cac postprocess: handle partial intialization failures.
This patch fixes segfaults observed when enabling the post processing
features. When the format is not supported, or a texture cannot be
created, the code must gracefully handle failure and report the error to
the calling code for proper failure handling.

To accomplish this the following changes were made to the filters.h
prototypes:

- bool return for pp_init_func
- Added pp_free_func for filter specific resource destruction

Fixes segfaults from backtraces:

* util_destroy_blit
  pp_free

* u_transfer_inline_write_vtbl
  pp_jimenezmlaa_init_run
  pp_init

This patch also uses tgsi_alloc_tokens to allocate temporary tokens in
pp_tgsi_to_state, instead of allocating the array on the stack. This
fixes the following stack corruption segfault in pp_run.c:

* _int_free
  aaline_delete_fs_state
  pp_free

Bug Number: 1021843
Reviewed-by: Brian Paul <brianp@vmware.com>
2013-06-27 09:44:29 -06:00
Marek Olšák d1b91e309b cso: add constant buffer save/restore feature for postprocessing
Postprocessing is an internal meta op and should restore the states
it changes.
2013-03-26 01:28:18 +01:00
Brian Paul bfc8b8fac5 postprocess: silence some MSVC float/int warnings 2013-03-21 09:24:35 -06:00
Brian Paul ea6f035ae9 gallium: consolidate CSO sampler and sampler_view functions
Merge the vertex/fragment versions of the cso_set/save/restore_samplers()
functions.  Now we pass the shader stage (PIPE_SHADER_x) to the function
to indicate vertex/fragment/geometry samplers.  For example:

cso_single_sampler(cso, PIPE_SHADER_FRAGMENT, unit, sampler);

This results in quite a bit of code reduction, fewer CSO functions and
support for geometry shaders.

Reviewed-by: Marek Olšák <maraeo@gmail.com>
2012-08-03 07:16:35 -06:00
Marek Olšák 5ba15d8d38 st/mesa: implement accelerated stencil blitting using shader stencil export
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2012-07-12 02:08:30 +02:00
Marek Olšák 24e0a26335 gallium/u_blit: drop not-very-useful wrapper around util_blit_pixels_writemask
just rename it to util_blit_pixels

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
2012-07-12 02:08:30 +02:00
Marek Olšák 507337864f gallium: change set_constant_buffer to be UBO-friendly 2012-04-30 01:09:57 +02:00
Vinson Lee 9288253051 pp: Reorder calloc to avoid memory leak on error path.
Fixes Coverity resource leak defect.

Reviewed-by: Brian Paul <brianp@vmware.com>
2011-11-05 22:06:35 -07:00
José Fonseca 4703f50e96 postprocess: Portability fixes. 2011-09-25 12:18:55 +01:00
Dave Airlie 6dd284f7c8 gallium: move clear paths from rgba to a pointer to a color union (v2)
This moves the gallium interface for clears from using a pointer to 4 floats to a pointer to a union of float/unsigned/int values.

Notes:
1. the value is opaque.
2. only when the value is used should it be interpretered according to
the surface format it is going to be used with.
3. float clears on integer buffers and vice-versa are undefined.

v2: fixed up vega and graw, dropped hunks that shouldn't have been in
patch.

Signed-off-by: Dave Airlie <airlied@redhat.com>
2011-09-18 15:12:47 +01:00
Lauri Kasanen caeb3cdf2f pp: Add Jimenez' MLAA
Signed-off-by: Lauri Kasanen <cand@gmx.com>
Signed-off-by: Brian Paul <brianp@vmware.com>
2011-08-19 16:51:06 -06:00