2009-12-20 15:28:00 -08:00
|
|
|
Context
|
|
|
|
|
=======
|
|
|
|
|
|
|
|
|
|
The context object represents the purest, most directly accessible, abilities
|
|
|
|
|
of the device's 3D rendering pipeline.
|
|
|
|
|
|
|
|
|
|
Methods
|
|
|
|
|
-------
|
|
|
|
|
|
2009-12-20 19:41:50 -08:00
|
|
|
CSO State
|
|
|
|
|
^^^^^^^^^
|
|
|
|
|
|
|
|
|
|
All CSO state is created, bound, and destroyed, with triplets of methods that
|
|
|
|
|
all follow a specific naming scheme. For example, ``create_blend_state``,
|
|
|
|
|
``bind_blend_state``, and ``destroy_blend_state``.
|
|
|
|
|
|
|
|
|
|
CSO objects handled by the context object:
|
|
|
|
|
|
|
|
|
|
* :ref:`Blend`: ``*_blend_state``
|
|
|
|
|
* :ref:`Sampler`: These are special; they can be bound to either vertex or
|
|
|
|
|
fragment samplers, and they are bound in groups.
|
|
|
|
|
``bind_fragment_sampler_states``, ``bind_vertex_sampler_states``
|
|
|
|
|
* :ref:`Rasterizer`: ``*_rasterizer_state``
|
|
|
|
|
* :ref:`Depth, Stencil, & Alpha`: ``*_depth_stencil_alpha_state``
|
|
|
|
|
* :ref:`Shader`: These have two sets of methods. ``*_fs_state`` is for
|
|
|
|
|
fragment shaders, and ``*_vs_state`` is for vertex shaders.
|
|
|
|
|
|
2009-12-21 23:44:32 +00:00
|
|
|
|
|
|
|
|
Resource Binding State
|
|
|
|
|
^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
|
|
This state describes how resources in various flavours (textures,
|
|
|
|
|
buffers, surfaces) are bound to the driver.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
* ``set_constant_buffer``
|
|
|
|
|
* ``set_framebuffer_state``
|
|
|
|
|
* ``set_fragment_sampler_textures``
|
|
|
|
|
* ``set_vertex_sampler_textures``
|
|
|
|
|
* ``set_vertex_buffers``
|
|
|
|
|
|
|
|
|
|
|
2009-12-20 19:41:50 -08:00
|
|
|
Non-CSO State
|
|
|
|
|
^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
|
|
These pieces of state are too small, variable, and/or trivial to have CSO
|
|
|
|
|
objects. They all follow simple, one-method binding calls, e.g.
|
|
|
|
|
``set_edgeflags``.
|
|
|
|
|
|
|
|
|
|
* ``set_edgeflags``
|
|
|
|
|
* ``set_blend_color``
|
|
|
|
|
* ``set_clip_state``
|
|
|
|
|
* ``set_polygon_stipple``
|
|
|
|
|
* ``set_scissor_state``
|
|
|
|
|
* ``set_viewport_state``
|
|
|
|
|
* ``set_vertex_elements``
|
|
|
|
|
|
2009-12-21 23:44:32 +00:00
|
|
|
|
|
|
|
|
Clearing
|
|
|
|
|
^^^^^^^^
|
|
|
|
|
|
|
|
|
|
``clear`` initializes some or all of the surfaces currently bound to
|
|
|
|
|
the framebuffer to particular RGBA, depth, or stencil values.
|
|
|
|
|
|
|
|
|
|
Clear is one of the most difficult concepts to nail down to a single
|
|
|
|
|
interface and it seems likely that we will want to add additional
|
|
|
|
|
clear paths, for instance clearing surfaces not bound to the
|
|
|
|
|
framebuffer, or read-modify-write clears such as depth-only or
|
|
|
|
|
stencil-only clears of packed depth-stencil buffers.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Drawing
|
|
|
|
|
^^^^^^^
|
|
|
|
|
|
|
|
|
|
``draw_arrays``
|
|
|
|
|
|
|
|
|
|
``draw_elements``
|
|
|
|
|
|
|
|
|
|
``draw_range_elements``
|
|
|
|
|
|
|
|
|
|
|
2009-12-20 19:41:50 -08:00
|
|
|
Queries
|
|
|
|
|
^^^^^^^
|
|
|
|
|
|
2009-12-21 23:44:32 +00:00
|
|
|
Queries gather some statistic from the 3D pipeline over one or more
|
|
|
|
|
draws. Queries may be nested, though no state tracker currently
|
|
|
|
|
exercises this.
|
|
|
|
|
|
2009-12-20 19:41:50 -08:00
|
|
|
Queries can be created with ``create_query`` and deleted with
|
|
|
|
|
``destroy_query``. To enable a query, use ``begin_query``, and when finished,
|
|
|
|
|
use ``end_query`` to stop the query. Finally, ``get_query_result`` is used
|
|
|
|
|
to retrieve the results.
|
|
|
|
|
|
2009-12-21 23:44:32 +00:00
|
|
|
Flushing
|
|
|
|
|
^^^^^^^^
|
2009-12-20 19:41:50 -08:00
|
|
|
|
2009-12-21 23:44:32 +00:00
|
|
|
``flush``
|
2009-12-20 19:41:50 -08:00
|
|
|
|
|
|
|
|
|
2009-12-21 23:44:32 +00:00
|
|
|
Resource Busy Queries
|
|
|
|
|
^^^^^^^^^^^^^^^^^^^^^
|
2009-12-20 19:41:50 -08:00
|
|
|
|
2009-12-21 23:44:32 +00:00
|
|
|
``is_texture_referenced``
|
2009-12-20 19:41:50 -08:00
|
|
|
|
2009-12-21 23:44:32 +00:00
|
|
|
``is_buffer_referenced``
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Blitting
|
|
|
|
|
^^^^^^^^
|
2009-12-20 19:41:50 -08:00
|
|
|
|
|
|
|
|
These methods emulate classic blitter controls. They are not guaranteed to be
|
|
|
|
|
available; if they are set to NULL, then they are not present.
|
|
|
|
|
|
2009-12-21 23:44:32 +00:00
|
|
|
These methods operate directly on ``pipe_surface`` objects, and stand
|
|
|
|
|
apart from any 3D state in the context. Blitting functionality may be
|
|
|
|
|
moved to a separate abstraction at some point in the future.
|
|
|
|
|
|
2009-12-20 19:41:50 -08:00
|
|
|
``surface_fill`` performs a fill operation on a section of a surface.
|
|
|
|
|
|
|
|
|
|
``surface_copy`` blits a region of a surface to a region of another surface,
|
|
|
|
|
provided that both surfaces are the same format. The source and destination
|
|
|
|
|
may be the same surface, and overlapping blits are permitted.
|
|
|
|
|
|
2009-12-21 23:44:32 +00:00
|
|
|
The interfaces to these calls are likely to change to make it easier
|
|
|
|
|
for a driver to batch multiple blits with the same source and
|
|
|
|
|
destination.
|
|
|
|
|
|