6 A screen is an object representing the context-independent part of a device.
11 XXX some of these don't belong in this section.
19 Capability queries return information about the features and limits of the
20 driver/GPU. For floating-point values, use :ref:`get_paramf`, and for boolean
21 or integer values, use :ref:`get_param`.
23 The integer capabilities:
25 * ``PIPE_CAP_NPOT_TEXTURES``: Whether :term:`NPOT` textures may have repeat modes,
26 normalized coordinates, and mipmaps.
27 * ``PIPE_CAP_TWO_SIDED_STENCIL``: Whether the stencil test can also affect back-facing
29 * ``PIPE_CAP_GLSL``: Deprecated.
30 * ``PIPE_CAP_DUAL_SOURCE_BLEND``: Whether dual-source blend factors are supported. See
31 :ref:`Blend` for more information.
32 * ``PIPE_CAP_ANISOTROPIC_FILTER``: Whether textures can be filtered anisotropically.
33 * ``PIPE_CAP_POINT_SPRITE``: Whether point sprites are available.
34 * ``PIPE_CAP_MAX_RENDER_TARGETS``: The maximum number of render targets that may be
36 * ``PIPE_CAP_OCCLUSION_QUERY``: Whether occlusion queries are available.
37 * ``PIPE_CAP_TIMER_QUERY``: Whether timer queries are available.
38 * ``PIPE_CAP_TEXTURE_SHADOW_MAP``: indicates whether the fragment shader hardware
39 can do the depth texture / Z comparison operation in TEX instructions
41 * ``PIPE_CAP_TEXTURE_SWIZZLE``: Whether swizzling through sampler views is
43 * ``PIPE_CAP_MAX_TEXTURE_2D_LEVELS``: The maximum number of mipmap levels available
45 * ``PIPE_CAP_MAX_TEXTURE_3D_LEVELS``: The maximum number of mipmap levels available
47 * ``PIPE_CAP_MAX_TEXTURE_CUBE_LEVELS``: The maximum number of mipmap levels available
49 * ``PIPE_CAP_TEXTURE_MIRROR_CLAMP``: Whether mirrored texture coordinates with clamp
51 * ``PIPE_CAP_BLEND_EQUATION_SEPARATE``: Whether alpha blend equations may be different
52 from color blend equations, in :ref:`Blend` state.
53 * ``PIPE_CAP_SM3``: Whether the vertex shader and fragment shader support equivalent
54 opcodes to the Shader Model 3 specification. XXX oh god this is horrible
55 * ``PIPE_CAP_MAX_COMBINED_SAMPLERS``: The total number of samplers accessible from
56 the vertex and fragment shader, inclusive.
57 * ``PIPE_CAP_INDEP_BLEND_ENABLE``: Whether per-rendertarget blend enabling and channel
58 masks are supported. If 0, then the first rendertarget's blend mask is
59 replicated across all MRTs.
60 * ``PIPE_CAP_INDEP_BLEND_FUNC``: Whether per-rendertarget blend functions are
61 available. If 0, then the first rendertarget's blend functions affect all
63 * ``PIPE_CAP_DEPTHSTENCIL_CLEAR_SEPARATE``: Whether clearing only depth or only
64 stencil in a combined depth-stencil buffer is supported.
65 * ``PIPE_CAP_MAX_TEXTURE_ARRAY_LAYERS``: The maximum number of texture array
66 layers supported. If 0, the array textures are not supported at all and
67 the ARRAY texture targets are invalid.
68 * ``PIPE_CAP_TGSI_FS_COORD_ORIGIN_UPPER_LEFT``: Whether the TGSI property
69 FS_COORD_ORIGIN with value UPPER_LEFT is supported.
70 * ``PIPE_CAP_TGSI_FS_COORD_ORIGIN_LOWER_LEFT``: Whether the TGSI property
71 FS_COORD_ORIGIN with value LOWER_LEFT is supported.
72 * ``PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_HALF_INTEGER``: Whether the TGSI
73 property FS_COORD_PIXEL_CENTER with value HALF_INTEGER is supported.
74 * ``PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_INTEGER``: Whether the TGSI
75 property FS_COORD_PIXEL_CENTER with value INTEGER is supported.
77 The floating-point capabilities:
79 * ``PIPE_CAP_MAX_LINE_WIDTH``: The maximum width of a regular line.
80 * ``PIPE_CAP_MAX_LINE_WIDTH_AA``: The maximum width of a smoothed line.
81 * ``PIPE_CAP_MAX_POINT_WIDTH``: The maximum width and height of a point.
82 * ``PIPE_CAP_MAX_POINT_WIDTH_AA``: The maximum width and height of a smoothed point.
83 * ``PIPE_CAP_MAX_TEXTURE_ANISOTROPY``: The maximum level of anisotropy that can be
84 applied to anisotropically filtered textures.
85 * ``PIPE_CAP_MAX_TEXTURE_LOD_BIAS``: The maximum :term:`LOD` bias that may be applied
87 * ``PIPE_CAP_GUARD_BAND_LEFT``,
88 ``PIPE_CAP_GUARD_BAND_TOP``,
89 ``PIPE_CAP_GUARD_BAND_RIGHT``,
90 ``PIPE_CAP_GUARD_BAND_BOTTOM``: TODO
98 These are per-shader-stage capabitity queries. Different shader stages may
99 support different features.
101 * ``PIPE_SHADER_CAP_MAX_INSTRUCTIONS``: The maximum number of instructions.
102 * ``PIPE_SHADER_CAP_MAX_ALU_INSTRUCTIONS``: The maximum number of arithmetic instructions.
103 * ``PIPE_SHADER_CAP_MAX_TEX_INSTRUCTIONS``: The maximum number of texture instructions.
104 * ``PIPE_SHADER_CAP_MAX_TEX_INDIRECTIONS``: The maximum number of texture indirections.
105 * ``PIPE_SHADER_CAP_MAX_CONTROL_FLOW_DEPTH``: The maximum nested control flow depth.
106 * ``PIPE_SHADER_CAP_MAX_INPUTS``: The maximum number of input registers.
107 * ``PIPE_SHADER_CAP_MAX_CONSTS``: The maximum number of constants.
108 * ``PIPE_SHADER_CAP_MAX_CONST_BUFFERS``: Maximum number of constant buffers that can be bound
109 to any shader stage using ``set_constant_buffer``. If 0 or 1, the pipe will
110 only permit binding one constant buffer per shader, and the shaders will
111 not permit two-dimensional access to constants.
113 If a value greater than 0 is returned, the driver can have multiple
114 constant buffers bound to shader stages. The CONST register file can
115 be accessed with two-dimensional indices, like in the example below.
117 DCL CONST[0][0..7] # declare first 8 vectors of constbuf 0
118 DCL CONST[3][0] # declare first vector of constbuf 3
119 MOV OUT[0], CONST[0][3] # copy vector 3 of constbuf 0
121 For backwards compatibility, one-dimensional access to CONST register
122 file is still supported. In that case, the constbuf index is assumed
125 * ``PIPE_SHADER_CAP_MAX_TEMPS``: The maximum number of temporary registers.
126 * ``PIPE_SHADER_CAP_MAX_ADDRS``: The maximum number of address registers.
127 * ``PIPE_SHADER_CAP_MAX_PREDS``: The maximum number of predicate registers.
128 * ``PIPE_SHADER_CAP_TGSI_CONT_SUPPORTED``: Whether the continue opcode is supported.
129 * ``PIPE_SHADER_CAP_INDIRECT_INPUT_ADDR``: Whether indirect addressing
130 of the input file is supported.
131 * ``PIPE_SHADER_CAP_INDIRECT_OUTPUT_ADDR``: Whether indirect addressing
132 of the output file is supported.
133 * ``PIPE_SHADER_CAP_INDIRECT_TEMP_ADDR``: Whether indirect addressing
134 of the temporary file is supported.
135 * ``PIPE_SHADER_CAP_INDIRECT_CONST_ADDR``: Whether indirect addressing
136 of the constant file is supported.
137 * ``PIPE_SHADER_CAP_SUBROUTINES``: Whether subroutines are supported, i.e.
138 BGNSUB, ENDSUB, CAL, and RET, including RET in the main block.
139 * ``PIPE_SHADER_CAP_INTEGERS``: Whether integer opcodes are supported.
140 If unsupported, only float opcodes are supported.
141 * ``PIPE_SHADER_CAP_MAX_TEXTURE_SAMPLERS``: THe maximum number of texture
150 These flags indicate how a resource will be used and are specified at resource
151 creation time. Resources may be used in different roles
152 during their lifecycle. Bind flags are cumulative and may be combined to create
153 a resource which can be used for multiple things.
154 Depending on the pipe driver's memory management and these bind flags,
155 resources might be created and handled quite differently.
157 * ``PIPE_BIND_RENDER_TARGET``: A color buffer or pixel buffer which will be
158 rendered to. Any surface/resource attached to pipe_framebuffer_state::cbufs
159 must have this flag set.
160 * ``PIPE_BIND_DEPTH_STENCIL``: A depth (Z) buffer and/or stencil buffer. Any
161 depth/stencil surface/resource attached to pipe_framebuffer_state::zsbuf must
163 * ``PIPE_BIND_DISPLAY_TARGET``: A surface that can be presented to screen. Arguments to
164 pipe_screen::flush_front_buffer must have this flag set.
165 * ``PIPE_BIND_SAMPLER_VIEW``: A texture that may be sampled from in a fragment
167 * ``PIPE_BIND_VERTEX_BUFFER``: A vertex buffer.
168 * ``PIPE_BIND_INDEX_BUFFER``: An vertex index/element buffer.
169 * ``PIPE_BIND_CONSTANT_BUFFER``: A buffer of shader constants.
170 * ``PIPE_BIND_TRANSFER_WRITE``: A transfer object which will be written to.
171 * ``PIPE_BIND_TRANSFER_READ``: A transfer object which will be read from.
172 * ``PIPE_BIND_CUSTOM``:
173 * ``PIPE_BIND_SCANOUT``: A front color buffer or scanout buffer.
174 * ``PIPE_BIND_SHARED``: A sharable buffer that can be given to another
182 The PIPE_USAGE enums are hints about the expected usage pattern of a resource.
184 * ``PIPE_USAGE_DEFAULT``: Expect many uploads to the resource, intermixed with draws.
185 * ``PIPE_USAGE_DYNAMIC``: Expect many uploads to the resource, intermixed with draws.
186 * ``PIPE_USAGE_STATIC``: Same as immutable (?)
187 * ``PIPE_USAGE_IMMUTABLE``: Resource will not be changed after first upload.
188 * ``PIPE_USAGE_STREAM``: Upload will be followed by draw, followed by upload, ...
195 These flags are used when querying whether a particular pipe_format is
196 supported by the driver (with the `is_format_supported` function).
197 Some formats may only be supported for certain kinds of textures.
198 For example, a compressed format might only be used for POT textures.
200 * ``PIPE_TEXTURE_GEOM_NON_SQUARE``: The texture may not be square
201 * ``PIPE_TEXTURE_GEOM_NON_POWER_OF_TWO``: The texture dimensions may not be
213 Returns an identifying name for the screen.
218 Returns the screen vendor.
225 Get an integer/boolean screen parameter.
227 **param** is one of the :ref:`PIPE_CAP` names.
234 Get a floating-point screen parameter.
236 **param** is one of the :ref:`PIPE_CAP` names.
241 Create a pipe_context.
243 **priv** is private data of the caller, which may be put to various
244 unspecified uses, typically to do with implementing swapbuffers
245 and/or front-buffer rendering.
250 Determine if a resource in the given format can be used in a specific manner.
252 **format** the resource format
254 **target** one of the PIPE_TEXTURE_x flags
256 **sample_count** the number of samples. 0 and 1 mean no multisampling,
257 the maximum allowed legal value is 32.
259 **bindings** is a bitmask of :ref:`PIPE_BIND` flags.
261 **geom_flags** is a bitmask of PIPE_TEXTURE_GEOM_x flags.
263 Returns TRUE if all usages can be satisfied.
270 Create a new resource from a template.
271 The following fields of the pipe_resource must be specified in the template:
273 **target** one of the pipe_texture_target enums.
274 Note that PIPE_BUFFER and PIPE_TEXTURE_X are not really fundamentally different.
275 Modern APIs allow using buffers as shader resources.
277 **format** one of the pipe_format enums.
279 **width0** the width of the base mip level of the texture or size of the buffer.
281 **height0** the height of the base mip level of the texture
282 (1 for 1D or 1D array textures).
284 **depth0** the depth of the base mip level of the texture
285 (1 for everything else).
287 **array_size** the array size for 1D and 2D array textures.
288 For cube maps this must be 6, for other textures 1.
290 **last_level** the last mip map level present.
292 **nr_samples** the nr of msaa samples. 0 (or 1) specifies a resource
293 which isn't multisampled.
295 **usage** one of the PIPE_USAGE flags.
297 **bind** bitmask of the PIPE_BIND flags.
299 **flags** bitmask of PIPE_RESOURCE_FLAG flags.
306 Destroy a resource. A resource is destroyed if it has no more references.