blob: 21f5f9111a0824a20786520405440f098c13d4e1 [file] [log] [blame]
Corbin Simpson8283e202009-12-20 15:28:00 -08001Context
2=======
3
4The context object represents the purest, most directly accessible, abilities
5of the device's 3D rendering pipeline.
6
7Methods
8-------
9
Corbin Simpsona524aab2009-12-20 19:41:50 -080010CSO State
11^^^^^^^^^
12
13All CSO state is created, bound, and destroyed, with triplets of methods that
14all follow a specific naming scheme. For example, ``create_blend_state``,
15``bind_blend_state``, and ``destroy_blend_state``.
16
17CSO objects handled by the context object:
18
19* :ref:`Blend`: ``*_blend_state``
20* :ref:`Sampler`: These are special; they can be bound to either vertex or
21 fragment samplers, and they are bound in groups.
22 ``bind_fragment_sampler_states``, ``bind_vertex_sampler_states``
23* :ref:`Rasterizer`: ``*_rasterizer_state``
24* :ref:`Depth, Stencil, & Alpha`: ``*_depth_stencil_alpha_state``
25* :ref:`Shader`: These have two sets of methods. ``*_fs_state`` is for
26 fragment shaders, and ``*_vs_state`` is for vertex shaders.
27
Keith Whitwellf3347fe2009-12-21 23:44:32 +000028
29Resource Binding State
30^^^^^^^^^^^^^^^^^^^^^^
31
32This state describes how resources in various flavours (textures,
33buffers, surfaces) are bound to the driver.
34
35
36* ``set_constant_buffer``
37* ``set_framebuffer_state``
38* ``set_fragment_sampler_textures``
39* ``set_vertex_sampler_textures``
40* ``set_vertex_buffers``
41
42
Corbin Simpsona524aab2009-12-20 19:41:50 -080043Non-CSO State
44^^^^^^^^^^^^^
45
46These pieces of state are too small, variable, and/or trivial to have CSO
47objects. They all follow simple, one-method binding calls, e.g.
48``set_edgeflags``.
49
50* ``set_edgeflags``
51* ``set_blend_color``
52* ``set_clip_state``
Corbin Simpsona524aab2009-12-20 19:41:50 -080053* ``set_polygon_stipple``
54* ``set_scissor_state``
55* ``set_viewport_state``
Corbin Simpsona524aab2009-12-20 19:41:50 -080056* ``set_vertex_elements``
57
Keith Whitwellf3347fe2009-12-21 23:44:32 +000058
59Clearing
60^^^^^^^^
61
62``clear`` initializes some or all of the surfaces currently bound to
63the framebuffer to particular RGBA, depth, or stencil values.
64
65Clear is one of the most difficult concepts to nail down to a single
66interface and it seems likely that we will want to add additional
67clear paths, for instance clearing surfaces not bound to the
68framebuffer, or read-modify-write clears such as depth-only or
69stencil-only clears of packed depth-stencil buffers.
70
71
72Drawing
Corbin Simpsona524aab2009-12-20 19:41:50 -080073^^^^^^^
74
Corbin Simpsona524aab2009-12-20 19:41:50 -080075``draw_arrays``
76
77``draw_elements``
78
79``draw_range_elements``
80
Keith Whitwellf3347fe2009-12-21 23:44:32 +000081
82Queries
83^^^^^^^
84
85Queries gather some statistic from the 3D pipeline over one or more
86draws. Queries may be nested, though no state tracker currently
87exercises this.
88
89Queries can be created with ``create_query`` and deleted with
90``destroy_query``. To enable a query, use ``begin_query``, and when finished,
91use ``end_query`` to stop the query. Finally, ``get_query_result`` is used
92to retrieve the results.
93
94Flushing
95^^^^^^^^
96
Corbin Simpsona524aab2009-12-20 19:41:50 -080097``flush``
98
Keith Whitwellf3347fe2009-12-21 23:44:32 +000099
100Resource Busy Queries
101^^^^^^^^^^^^^^^^^^^^^
102
103``is_texture_referenced``
104
105``is_buffer_referenced``
106
107
108
109Blitting
110^^^^^^^^
Corbin Simpsona524aab2009-12-20 19:41:50 -0800111
112These methods emulate classic blitter controls. They are not guaranteed to be
113available; if they are set to NULL, then they are not present.
114
Keith Whitwellf3347fe2009-12-21 23:44:32 +0000115These methods operate directly on ``pipe_surface`` objects, and stand
116apart from any 3D state in the context. Blitting functionality may be
117moved to a separate abstraction at some point in the future.
118
Corbin Simpsona524aab2009-12-20 19:41:50 -0800119``surface_fill`` performs a fill operation on a section of a surface.
120
121``surface_copy`` blits a region of a surface to a region of another surface,
122provided that both surfaces are the same format. The source and destination
123may be the same surface, and overlapping blits are permitted.
124
Keith Whitwellf3347fe2009-12-21 23:44:32 +0000125The interfaces to these calls are likely to change to make it easier
126for a driver to batch multiple blits with the same source and
127destination.
128