Commit Graph

87 Commits

Author SHA1 Message Date
Marek Olšák 54272e18a6 gallium: add a pipe_context parameter to fence_finish
required by glClientWaitSync (GL 4.5 Core spec) that can optionally flush
the context

Reviewed-by: Rob Clark <robdclark@gmail.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
2016-08-10 01:11:10 +02:00
Marek Olšák a909210131 gallium: add render_condition_enable param to clear_render_target/depth_stencil
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
2016-08-10 01:10:21 +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
Marek Olšák d17b35e671 gallium: add PIPE_FLUSH_DEFERRED
There are 2 uses:
- Asynchronous flushing for multithreaded drivers.
- Return a fence without flushing (mid-command-buffer fence). The driver
  can defer flushing until fence_finish is called.

This is required to make Bioshock Infinite faster, which creates
1000 fences (flushes) per frame.

Reviewed-by: Edward O'Callaghan <funfunctor@folklore1984.net>
Reviewed-by: Rob Clark <robdclark@gmail.com>
2016-07-22 22:34:49 +02:00
Giuseppe Bilotta 60a27ad122 Remove wrongly repeated words in comments
Clean up misrepetitions ('if if', 'the the' etc) found throughout the
comments. This has been done manually, after grepping
case-insensitively for duplicate if, is, the, then, do, for, an,
plus a few other typos corrected in fly-by

v2:
    * proper commit message and non-joke title;
    * replace two 'as is' followed by 'is' to 'as-is'.
v3:
    * 'a integer' => 'an integer' and similar (originally spotted by
      Jason Ekstrand, I fixed a few other similar ones while at it)

Signed-off-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com>
Reviewed-by: Chad Versace <chad.versace@intel.com>
2016-06-23 13:55:03 -07:00
Ilia Mirkin 82fab73246 gallium: add API for setting window rectangles
Window rectangles apply to all framebuffer operations, either in
inclusive or exclusive mode. They may also be specified as part of a
blit operation.

In exclusive mode, any fragment inside any of the specified rectangles
will be discarded.

In inclusive mode, any fragment outside every rectangle will be
discarded.

The no-op state is to have 0 rectangles in exclusive mode.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
2016-06-18 12:59:12 -04:00
Marek Olšák 26171bd67e gallium: add pipe_context::set_active_query_state for pausing queries
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
2016-04-12 14:29:46 +02:00
Ilia Mirkin 40d7f02c67 gallium: add a way to store query result into buffer
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
2016-02-04 21:21:30 -05:00
Charmaine Lee 3038e8984d gallium/st: add pipe_context::generate_mipmap()
This patch adds a new interface to support hardware mipmap generation.
PIPE_CAP_GENERATE_MIPMAP is added to allow a driver to specify
if this new interface is supported; if not supported, the state tracker will
fallback to mipmap generation by rendering/texturing.

v2: add PIPE_CAP_GENERATE_MIPMAP to the disabled section for all drivers
v3: add format to the generate_mipmap interface to allow mipmap generation
    using a format other than the resource format
v4: fix return type of trace_context_generate_mipmap()

Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
2016-01-14 10:39:53 -07:00
Ilia Mirkin 3695b253f9 gallium: add PIPE_CAP_CLEAR_TEXTURE and clear_texture prototype
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
2015-11-11 19:20:41 -05:00
Ilia Mirkin fc76cc05e3 gallium: expose a debug message callback settable by context owner
This will allow gallium drivers to send messages to KHR_debug endpoints

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
2015-11-05 11:22:18 -05:00
Marek Olšák 05a12c53a3 gallium: add interface for writable shader images
PIPE_CAPs will be added some other time.

Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
2015-07-16 16:52:20 +02:00
Ilia Mirkin 6b26206120 gallium: add set_tess_state to configure default tessellation parameters
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Signed-off-by: Marek Olšák <marek.olsak@amd.com>
2015-05-16 14:51:22 +02:00
Ilia Mirkin 43e4b3e311 gallium: add an index argument to create_query
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
2014-07-01 11:34:31 -04:00
Roland Scheidegger f49e201df9 gallium/docs: improve documentation of render condition wrt blits.
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
2014-05-31 22:05:14 +02:00
Rob Clark 209522070e gallium/docs: clarify when query results are reset
It wasn't completely clear from the docs, so I had to figure out by
looking at piglit results.  Hopefully this saves the next driver writer
implementing queries some time.

Signed-off-by: Rob Clark <robclark@freedesktop.org>
2014-05-14 07:54:02 -04:00
Ilia Mirkin 88d8d88d8c gallium: add basic support for ARB_sample_shading
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
2014-04-26 11:52:01 -04:00
Ilia Mirkin 05d0223da3 gallium/docs: fix incorrect/missing references
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Brian Paul <brianp@vmware.com>
2014-04-01 10:17:13 -04:00
Ilia Mirkin 24b86cb304 gallium: add interface to clear buffers
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
2014-03-31 21:20:02 -04:00
Zack Rusin dfa25ea5cd gallium: allow setting of the internal stream output offset
D3D10 allows setting of the internal offset of a buffer, which is
in general only incremented via actual stream output writes. By
allowing setting of the internal offset draw_auto is capable
of rendering from buffers which have not been actually streamed
out to. Our interface didn't allow. This change functionally
shouldn't make any difference to OpenGL where instead of an
append_bitmask you just get a real array where -1 means append
(like in D3D) and 0 means do not append.

Signed-off-by: Zack Rusin <zackr@vmware.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
2014-03-07 12:49:33 -05:00
Marek Olšák 5f61f052b5 gallium: add interface for persistent and coherent buffer mappings
Required for ARB_buffer_storage.
2014-02-25 16:05:41 +01:00
Brian Paul a3ed98f7aa gallium: new, unified pipe_context::set_sampler_views() function
The new function replaces four old functions: set_fragment/vertex/
geometry/compute_sampler_views().

Note: at this time, it's expected that the 'start' parameter will
always be zero.

Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Tested-by: Emil Velikov <emil.l.velikov@gmail.com>
2013-10-23 10:15:38 -06:00
Brian Paul 55e81b06e7 gallium/docs: update bind_sampler_states() documentation 2013-10-03 14:05:28 -06:00
Marek Olšák 419cd5f2a2 gallium: add flush_resource context function
r600g needs explicit flushing before DRI2 buffers are presented on the screen.

v2: add (stub) implementations for all drivers, fix frontbuffer flushing
v3: fix galahad

Signed-off-by: Marek Olšák <marek.olsak@amd.com>
2013-09-20 20:35:55 +02:00
Roland Scheidegger bd3909f265 draw: clean up setting stream out information a bit
In particular noone is interested in the vertex count, so drop that,
and also drop the duplicated num_primitives_generated /
so.primitives_storage_needed variables in drivers. I am unable for now to figure
out if primitives_storage_needed in SO stats (used for d3d10) should
increase if SO is disabled, though the equivalent num_primitives_generated
used for OpenGL definitely should increase. In any case we were only counting
when SO is active both in softpipe and llvmpipe anyway so don't pretend there's
an independent num_primitives_generated counter which would count always.
(This means the PIPE_QUERY_PRIMITIVES_GENERATED count will still be wrong just
as before, should eventually fix this by doing either separate counting for this
query or adjust the code so it always counts this even if SO is inactive depending
on what's correct for d3d10.)

Reviewed-by: Brian Paul <brianp@vmware.com>
2013-08-27 16:59:39 +02:00
Roland Scheidegger cdf89d0b5c gallium: fix PIPE_QUERY_TIMESTAMP_DISJOINT
The semantics didn't really make sense, not really matching neither d3d9
(though the docs are all broken there) nor d3d10. So make it match d3d10
semantics, which actually gives meaning to the "disjoint" part.
Drivers are fixed up in a very primitive way, I have no idea what could
actually cause the counter to become unreliable so just always return
FALSE for the disjoint part.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
2013-06-19 23:47:35 +02:00
Roland Scheidegger 793e8e3d7e gallium: add condition parameter to render_condition
For conditional rendering this makes it possible to skip rendering
if either the predicate is true or false, as supported by d3d10
(in fact previously it was sort of implied skip rendering if predicate
is false for occlusion predicate, and true for so_overflow predicate).
There's no cap bit for this as presumably all drivers could do it trivially
(but this patch does not implement it for the drivers using true
hw predicates, nvxx, r600, radeonsi, no change is expected for OpenGL
functionality).

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
2013-06-18 18:01:24 +02:00
Roland Scheidegger 0f4c08aea2 gallium/docs: fix up transfer description for 1d arrays, add cube map arrays
Transfers always use z/depth for layers no matter if it's a 1d or 2d array
texture, we don't follow OpenGL's crazyness there. Luckily this appears to
only be a doc bug, everyone doing the right thing already.
While here also document z/depth parameter for cube map arrays.

v2: fix typo spotted by Eric Anholt

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
2013-06-07 21:15:01 +02:00
Zack Rusin eaabb4ead0 gallium: Add support for multiple viewports
Gallium supported only a single viewport/scissor combination. This
commit changes the interface to allow us to add support for multiple
viewports/scissors.

Signed-off-by: Zack Rusin <zackr@vmware.com>
Reviewed-by: Marek Olšák <maraeo@gmail.com>
Reviewed-by: José Fonseca<jfonseca@vmware.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
2013-05-25 09:49:20 -04:00
Christoph Bumiller c620aad71c gallium/docs: fix definition of PIPE_QUERY_SO_STATISTICS
Reviewed-by: Marek Olšák <maraeo@gmail.com>
2013-04-03 12:54:43 +02:00
José Fonseca 44a8e51354 d3d1x: Remove.
Unused/unmaintained.

Reviewed-by: Christoph Bumiller <e0425955@student.tuwien.ac.at>
2013-03-12 00:35:06 +00:00
Marek Olšák f04dd3d003 gallium: remove PIPE_CAP_DEPTHSTENCIL_CLEAR_SEPARATE
Reviewed-by: Brian Paul <brianp@vmware.com>
2013-01-15 16:47:18 +01:00
Andreas Boll ecb02c27fc gallium/docs: fix sphinx warning
src/gallium/docs/source/context.rst:495: WARNING:
malformed hyperlink target.

Reviewed-by: Brian Paul <brianp@vmware.com>
2012-10-24 14:14:03 +02:00
Marek Olšák 369e468889 gallium: unify transfer functions
"get_transfer + transfer_map" becomes "transfer_map".
"transfer_unmap + transfer_destroy" becomes "transfer_unmap".

transfer_map must create and return the transfer object and transfer_unmap
must destroy it.

transfer_map is successful if the returned buffer pointer is not NULL.
If transfer_map fails, the pointer to the transfer object remains unchanged
(i.e. doesn't have to be NULL).

Acked-by: Brian Paul <brianp@vmware.com>
2012-10-11 21:12:16 +02:00
Marek Olšák de80660c2b gallium: remove resource_resolve
The functionality is provided by the new blit function.

Tested-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
2012-09-30 18:57:57 +02:00
Marek Olšák c4df2e3337 gallium: add blit into the interface
Tested-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
2012-09-30 18:57:56 +02:00
Marek Olšák 7c799f8f6b gallium/docs: remove documentation of redefine_user_buffer 2012-05-12 13:09:19 +02:00
Francisco Jerez b8e808f1ef gallium/tgsi: Add resource write-back support.
Define a new STORE opcode with a role dual to the LOAD opcode, and add
flags to specify that a shader resource is intended for writing.
2012-05-11 12:39:41 +02:00
Francisco Jerez 5f55cbc7d9 gallium: Add context hooks for binding shader resources. 2012-05-11 12:39:40 +02:00
Francisco Jerez d9d82dcd00 gallium: Basic compute interface.
Define an interface that exposes the minimal functionality required to
implement some of the popular compute APIs.  This commit adds entry
points to set the grid layout and other state required to keep track
of the usual address spaces employed in compute APIs, to bind a
compute program, and execute it on the device.

Reviewed-by: Marek Olšák <maraeo@gmail.com>
2012-05-11 12:39:39 +02:00
Marek Olšák 861a029ddb gallium: interface changes necessary to implement transform feedback (v5)
Namely:
- EXT_transform_feedback
- ARB_transform_feedback2
- ARB_transform_feedback_instanced

The old interface was not useful for OpenGL and had to be reworked.

This interface was originally designed for OpenGL, but additional
changes have been made in order to make st/d3d1x support easier.

The most notable change is the stream-out info must be linked
with a vertex or geometry shader and cannot be set independently.
This is due to limitations of existing hardware (special shader
instructions must be used to write into stream-out buffers),
and it's also how OpenGL works (stream outputs must be specified
prior to linking shaders).

Other than that, each stream output buffer has a "view" into it that
internally maintains the number of bytes which have been written
into it. (one buffer can be bound in several different transform
feedback objects in OpenGL, so we must be able to have several views
around) The set_stream_output_targets function contains a parameter
saying whether new data should be appended or not.

Also, the view can optionally be used to provide the vertex
count for draw_vbo. Note that the count is supposed to be stored
in device memory and the CPU never gets to know its value.

OpenGL way | Gallium way
------------------------------------
BeginTF    = set_so_targets(append_bitmask = 0)
PauseTF    = set_so_targets(num_targets = 0)
ResumeTF   = set_so_targets(append_bitmask = ~0)
EndTF      = set_so_targets(num_targets = 0)
DrawTF     = use pipe_draw_info::count_from_stream_output

v2: * removed the reset_stream_output_targets function
    * added a parameter append_bitmask to set_stream_output_targets,
      each bit specifies whether new data should be appended to each
      buffer or not.
v3: * added PIPE_CAP_STREAM_OUTPUT_PAUSE_RESUME for ARB_tfb2,
      note that the draw-auto subset is always required (for d3d10),
      only the pause/resume functionality is limited if the CAP is not
      advertised
v4: * update gallium/docs
v5: * compactified struct pipe_stream_output_info, updated dump/trace
2011-12-15 18:51:48 +01:00
Christoph Bumiller 10f67c070b gallium: add new query types and missing documentation 2011-10-20 18:03:23 +02:00
Christoph Bumiller 94822c6d83 gallium: extend resource_resolve to accommodate BlitFramebuffer
Resolve via glBlitFramebuffer allows resolving a sub-region of a
renderbuffer to a different location in any mipmap level of some
other texture, and, with a new extension, even scaling. Therefore,
location and size parameters are needed.

The mask parameter was added because resolving only depth or only
stencil of a combined buffer is possible as well.

Full information about the blit operation allows the drivers to
take the most efficient path they possibly can.
2011-08-04 15:38:49 +02:00
José Fonseca bb78f6ad78 gallium/docs: Improve min_index/max_index description. 2011-04-16 10:18:20 +01:00
Marek Olšák aea4ed41ed gallium: add texture barrier support to the interface and st/mesa (v2)
v2: change the gallium entry point to texture_barrier.
2011-03-15 15:58:12 +01:00
José Fonseca 0562f44625 gallium/docs: Update PIPE_TRANSFER_xx docs. Reformat to use definitions. 2011-02-22 14:14:22 +00:00
Marek Olšák 588fa884d2 gallium: notify drivers about possible changes in user buffer contents
Also implement the redefine_user_buffer hook in the drivers.
2011-02-14 21:50:08 +01:00
Brian Paul 73e37d933d gallium/docs: more info about setting samplers and sampler views
Plus other assorted clarifications.
2011-02-03 13:47:12 -07:00
Brian Paul c5fb0518f4 gallium/docs: add info about transfer boxes and array textures 2011-01-28 20:25:27 -07:00
Zack Rusin 0657fc00dd gallium: add an interface for query predicates
as specified in the arb_occlusion_query2. just the interface.
2011-01-26 00:03:12 -05:00