context.rst revision 848b8605
1.. _context: 2 3Context 4======= 5 6A Gallium rendering context encapsulates the state which effects 3D 7rendering such as blend state, depth/stencil state, texture samplers, 8etc. 9 10Note that resource/texture allocation is not per-context but per-screen. 11 12 13Methods 14------- 15 16CSO State 17^^^^^^^^^ 18 19All Constant State Object (CSO) state is created, bound, and destroyed, 20with triplets of methods that all follow a specific naming scheme. 21For example, ``create_blend_state``, ``bind_blend_state``, and 22``destroy_blend_state``. 23 24CSO objects handled by the context object: 25 26* :ref:`Blend`: ``*_blend_state`` 27* :ref:`Sampler`: Texture sampler states are bound separately for fragment, 28 vertex, geometry and compute shaders with the ``bind_sampler_states`` 29 function. The ``start`` and ``num_samplers`` parameters indicate a range 30 of samplers to change. NOTE: at this time, start is always zero and 31 the CSO module will always replace all samplers at once (no sub-ranges). 32 This may change in the future. 33* :ref:`Rasterizer`: ``*_rasterizer_state`` 34* :ref:`depth-stencil-alpha`: ``*_depth_stencil_alpha_state`` 35* :ref:`Shader`: These are create, bind and destroy methods for vertex, 36 fragment and geometry shaders. 37* :ref:`vertexelements`: ``*_vertex_elements_state`` 38 39 40Resource Binding State 41^^^^^^^^^^^^^^^^^^^^^^ 42 43This state describes how resources in various flavours (textures, 44buffers, surfaces) are bound to the driver. 45 46 47* ``set_constant_buffer`` sets a constant buffer to be used for a given shader 48 type. index is used to indicate which buffer to set (some apis may allow 49 multiple ones to be set, and binding a specific one later, though drivers 50 are mostly restricted to the first one right now). 51 52* ``set_framebuffer_state`` 53 54* ``set_vertex_buffers`` 55 56* ``set_index_buffer`` 57 58 59Non-CSO State 60^^^^^^^^^^^^^ 61 62These pieces of state are too small, variable, and/or trivial to have CSO 63objects. They all follow simple, one-method binding calls, e.g. 64``set_blend_color``. 65 66* ``set_stencil_ref`` sets the stencil front and back reference values 67 which are used as comparison values in stencil test. 68* ``set_blend_color`` 69* ``set_sample_mask`` 70* ``set_min_samples`` sets the minimum number of samples that must be run. 71* ``set_clip_state`` 72* ``set_polygon_stipple`` 73* ``set_scissor_states`` sets the bounds for the scissor test, which culls 74 pixels before blending to render targets. If the :ref:`Rasterizer` does 75 not have the scissor test enabled, then the scissor bounds never need to 76 be set since they will not be used. Note that scissor xmin and ymin are 77 inclusive, but xmax and ymax are exclusive. The inclusive ranges in x 78 and y would be [xmin..xmax-1] and [ymin..ymax-1]. The number of scissors 79 should be the same as the number of set viewports and can be up to 80 PIPE_MAX_VIEWPORTS. 81* ``set_viewport_states`` 82 83 84Sampler Views 85^^^^^^^^^^^^^ 86 87These are the means to bind textures to shader stages. To create one, specify 88its format, swizzle and LOD range in sampler view template. 89 90If texture format is different than template format, it is said the texture 91is being cast to another format. Casting can be done only between compatible 92formats, that is formats that have matching component order and sizes. 93 94Swizzle fields specify they way in which fetched texel components are placed 95in the result register. For example, ``swizzle_r`` specifies what is going to be 96placed in first component of result register. 97 98The ``first_level`` and ``last_level`` fields of sampler view template specify 99the LOD range the texture is going to be constrained to. Note that these 100values are in addition to the respective min_lod, max_lod values in the 101pipe_sampler_state (that is if min_lod is 2.0, and first_level 3, the first mip 102level used for sampling from the resource is effectively the fifth). 103 104The ``first_layer`` and ``last_layer`` fields specify the layer range the 105texture is going to be constrained to. Similar to the LOD range, this is added 106to the array index which is used for sampling. 107 108* ``set_sampler_views`` binds an array of sampler views to a shader stage. 109 Every binding point acquires a reference 110 to a respective sampler view and releases a reference to the previous 111 sampler view. 112 113* ``create_sampler_view`` creates a new sampler view. ``texture`` is associated 114 with the sampler view which results in sampler view holding a reference 115 to the texture. Format specified in template must be compatible 116 with texture format. 117 118* ``sampler_view_destroy`` destroys a sampler view and releases its reference 119 to associated texture. 120 121Shader Resources 122^^^^^^^^^^^^^^^^ 123 124Shader resources are textures or buffers that may be read or written 125from a shader without an associated sampler. This means that they 126have no support for floating point coordinates, address wrap modes or 127filtering. 128 129Shader resources are specified for all the shader stages at once using 130the ``set_shader_resources`` method. When binding texture resources, 131the ``level``, ``first_layer`` and ``last_layer`` pipe_surface fields 132specify the mipmap level and the range of layers the texture will be 133constrained to. In the case of buffers, ``first_element`` and 134``last_element`` specify the range within the buffer that will be used 135by the shader resource. Writes to a shader resource are only allowed 136when the ``writable`` flag is set. 137 138Surfaces 139^^^^^^^^ 140 141These are the means to use resources as color render targets or depthstencil 142attachments. To create one, specify the mip level, the range of layers, and 143the bind flags (either PIPE_BIND_DEPTH_STENCIL or PIPE_BIND_RENDER_TARGET). 144Note that layer values are in addition to what is indicated by the geometry 145shader output variable XXX_FIXME (that is if first_layer is 3 and geometry 146shader indicates index 2, the 5th layer of the resource will be used). These 147first_layer and last_layer parameters will only be used for 1d array, 2d array, 148cube, and 3d textures otherwise they are 0. 149 150* ``create_surface`` creates a new surface. 151 152* ``surface_destroy`` destroys a surface and releases its reference to the 153 associated resource. 154 155Stream output targets 156^^^^^^^^^^^^^^^^^^^^^ 157 158Stream output, also known as transform feedback, allows writing the primitives 159produced by the vertex pipeline to buffers. This is done after the geometry 160shader or vertex shader if no geometry shader is present. 161 162The stream output targets are views into buffer resources which can be bound 163as stream outputs and specify a memory range where it's valid to write 164primitives. The pipe driver must implement memory protection such that any 165primitives written outside of the specified memory range are discarded. 166 167Two stream output targets can use the same resource at the same time, but 168with a disjoint memory range. 169 170Additionally, the stream output target internally maintains the offset 171into the buffer which is incremented everytime something is written to it. 172The internal offset is equal to how much data has already been written. 173It can be stored in device memory and the CPU actually doesn't have to query 174it. 175 176The stream output target can be used in a draw command to provide 177the vertex count. The vertex count is derived from the internal offset 178discussed above. 179 180* ``create_stream_output_target`` create a new target. 181 182* ``stream_output_target_destroy`` destroys a target. Users of this should 183 use pipe_so_target_reference instead. 184 185* ``set_stream_output_targets`` binds stream output targets. The parameter 186 offset is an array which specifies the internal offset of the buffer. The 187 internal offset is, besides writing, used for reading the data during the 188 draw_auto stage, i.e. it specifies how much data there is in the buffer 189 for the purposes of the draw_auto stage. -1 means the buffer should 190 be appended to, and everything else sets the internal offset. 191 192NOTE: The currently-bound vertex or geometry shader must be compiled with 193the properly-filled-in structure pipe_stream_output_info describing which 194outputs should be written to buffers and how. The structure is part of 195pipe_shader_state. 196 197Clearing 198^^^^^^^^ 199 200Clear is one of the most difficult concepts to nail down to a single 201interface (due to both different requirements from APIs and also driver/hw 202specific differences). 203 204``clear`` initializes some or all of the surfaces currently bound to 205the framebuffer to particular RGBA, depth, or stencil values. 206Currently, this does not take into account color or stencil write masks (as 207used by GL), and always clears the whole surfaces (no scissoring as used by 208GL clear or explicit rectangles like d3d9 uses). It can, however, also clear 209only depth or stencil in a combined depth/stencil surface. 210If a surface includes several layers then all layers will be cleared. 211 212``clear_render_target`` clears a single color rendertarget with the specified 213color value. While it is only possible to clear one surface at a time (which can 214include several layers), this surface need not be bound to the framebuffer. 215 216``clear_depth_stencil`` clears a single depth, stencil or depth/stencil surface 217with the specified depth and stencil values (for combined depth/stencil buffers, 218is is also possible to only clear one or the other part). While it is only 219possible to clear one surface at a time (which can include several layers), 220this surface need not be bound to the framebuffer. 221 222``clear_buffer`` clears a PIPE_BUFFER resource with the specified clear value 223(which may be multiple bytes in length). Logically this is a memset with a 224multi-byte element value starting at offset bytes from resource start, going 225for size bytes. It is guaranteed that size % clear_value_size == 0. 226 227 228Drawing 229^^^^^^^ 230 231``draw_vbo`` draws a specified primitive. The primitive mode and other 232properties are described by ``pipe_draw_info``. 233 234The ``mode``, ``start``, and ``count`` fields of ``pipe_draw_info`` specify the 235the mode of the primitive and the vertices to be fetched, in the range between 236``start`` to ``start``+``count``-1, inclusive. 237 238Every instance with instanceID in the range between ``start_instance`` and 239``start_instance``+``instance_count``-1, inclusive, will be drawn. 240 241If there is an index buffer bound, and ``indexed`` field is true, all vertex 242indices will be looked up in the index buffer. 243 244In indexed draw, ``min_index`` and ``max_index`` respectively provide a lower 245and upper bound of the indices contained in the index buffer inside the range 246between ``start`` to ``start``+``count``-1. This allows the driver to 247determine which subset of vertices will be referenced during te draw call 248without having to scan the index buffer. Providing a over-estimation of the 249the true bounds, for example, a ``min_index`` and ``max_index`` of 0 and 2500xffffffff respectively, must give exactly the same rendering, albeit with less 251performance due to unreferenced vertex buffers being unnecessarily DMA'ed or 252processed. Providing a underestimation of the true bounds will result in 253undefined behavior, but should not result in program or system failure. 254 255In case of non-indexed draw, ``min_index`` should be set to 256``start`` and ``max_index`` should be set to ``start``+``count``-1. 257 258``index_bias`` is a value added to every vertex index after lookup and before 259fetching vertex attributes. 260 261When drawing indexed primitives, the primitive restart index can be 262used to draw disjoint primitive strips. For example, several separate 263line strips can be drawn by designating a special index value as the 264restart index. The ``primitive_restart`` flag enables/disables this 265feature. The ``restart_index`` field specifies the restart index value. 266 267When primitive restart is in use, array indexes are compared to the 268restart index before adding the index_bias offset. 269 270If a given vertex element has ``instance_divisor`` set to 0, it is said 271it contains per-vertex data and effective vertex attribute address needs 272to be recalculated for every index. 273 274 attribAddr = ``stride`` * index + ``src_offset`` 275 276If a given vertex element has ``instance_divisor`` set to non-zero, 277it is said it contains per-instance data and effective vertex attribute 278address needs to recalculated for every ``instance_divisor``-th instance. 279 280 attribAddr = ``stride`` * instanceID / ``instance_divisor`` + ``src_offset`` 281 282In the above formulas, ``src_offset`` is taken from the given vertex element 283and ``stride`` is taken from a vertex buffer associated with the given 284vertex element. 285 286The calculated attribAddr is used as an offset into the vertex buffer to 287fetch the attribute data. 288 289The value of ``instanceID`` can be read in a vertex shader through a system 290value register declared with INSTANCEID semantic name. 291 292 293Queries 294^^^^^^^ 295 296Queries gather some statistic from the 3D pipeline over one or more 297draws. Queries may be nested, though not all state trackers exercise this. 298 299Queries can be created with ``create_query`` and deleted with 300``destroy_query``. To start a query, use ``begin_query``, and when finished, 301use ``end_query`` to end the query. 302 303``create_query`` takes a query type (``PIPE_QUERY_*``), as well as an index, 304which is the vertex stream for ``PIPE_QUERY_PRIMITIVES_GENERATED`` and 305``PIPE_QUERY_PRIMITIVES_EMITTED``, and allocates a query structure. 306 307``begin_query`` will clear/reset previous query results. 308 309``get_query_result`` is used to retrieve the results of a query. If 310the ``wait`` parameter is TRUE, then the ``get_query_result`` call 311will block until the results of the query are ready (and TRUE will be 312returned). Otherwise, if the ``wait`` parameter is FALSE, the call 313will not block and the return value will be TRUE if the query has 314completed or FALSE otherwise. 315 316The interface currently includes the following types of queries: 317 318``PIPE_QUERY_OCCLUSION_COUNTER`` counts the number of fragments which 319are written to the framebuffer without being culled by 320:ref:`depth-stencil-alpha` testing or shader KILL instructions. 321The result is an unsigned 64-bit integer. 322This query can be used with ``render_condition``. 323 324In cases where a boolean result of an occlusion query is enough, 325``PIPE_QUERY_OCCLUSION_PREDICATE`` should be used. It is just like 326``PIPE_QUERY_OCCLUSION_COUNTER`` except that the result is a boolean 327value of FALSE for cases where COUNTER would result in 0 and TRUE 328for all other cases. 329This query can be used with ``render_condition``. 330 331``PIPE_QUERY_TIME_ELAPSED`` returns the amount of time, in nanoseconds, 332the context takes to perform operations. 333The result is an unsigned 64-bit integer. 334 335``PIPE_QUERY_TIMESTAMP`` returns a device/driver internal timestamp, 336scaled to nanoseconds, recorded after all commands issued prior to 337``end_query`` have been processed. 338This query does not require a call to ``begin_query``. 339The result is an unsigned 64-bit integer. 340 341``PIPE_QUERY_TIMESTAMP_DISJOINT`` can be used to check the 342internal timer resolution and whether the timestamp counter has become 343unreliable due to things like throttling etc. - only if this is FALSE 344a timestamp query (within the timestamp_disjoint query) should be trusted. 345The result is a 64-bit integer specifying the timer resolution in Hz, 346followed by a boolean value indicating whether the timestamp counter 347is discontinuous or disjoint. 348 349``PIPE_QUERY_PRIMITIVES_GENERATED`` returns a 64-bit integer indicating 350the number of primitives processed by the pipeline (regardless of whether 351stream output is active or not). 352 353``PIPE_QUERY_PRIMITIVES_EMITTED`` returns a 64-bit integer indicating 354the number of primitives written to stream output buffers. 355 356``PIPE_QUERY_SO_STATISTICS`` returns 2 64-bit integers corresponding to 357the result of 358``PIPE_QUERY_PRIMITIVES_EMITTED`` and 359the number of primitives that would have been written to stream output buffers 360if they had infinite space available (primitives_storage_needed), in this order. 361XXX the 2nd value is equivalent to ``PIPE_QUERY_PRIMITIVES_GENERATED`` but it is 362unclear if it should be increased if stream output is not active. 363 364``PIPE_QUERY_SO_OVERFLOW_PREDICATE`` returns a boolean value indicating 365whether the stream output targets have overflowed as a result of the 366commands issued between ``begin_query`` and ``end_query``. 367This query can be used with ``render_condition``. 368 369``PIPE_QUERY_GPU_FINISHED`` returns a boolean value indicating whether 370all commands issued before ``end_query`` have completed. However, this 371does not imply serialization. 372This query does not require a call to ``begin_query``. 373 374``PIPE_QUERY_PIPELINE_STATISTICS`` returns an array of the following 37564-bit integers: 376Number of vertices read from vertex buffers. 377Number of primitives read from vertex buffers. 378Number of vertex shader threads launched. 379Number of geometry shader threads launched. 380Number of primitives generated by geometry shaders. 381Number of primitives forwarded to the rasterizer. 382Number of primitives rasterized. 383Number of fragment shader threads launched. 384Number of tessellation control shader threads launched. 385Number of tessellation evaluation shader threads launched. 386If a shader type is not supported by the device/driver, 387the corresponding values should be set to 0. 388 389Gallium does not guarantee the availability of any query types; one must 390always check the capabilities of the :ref:`Screen` first. 391 392 393Conditional Rendering 394^^^^^^^^^^^^^^^^^^^^^ 395 396A drawing command can be skipped depending on the outcome of a query 397(typically an occlusion query, or streamout overflow predicate). 398The ``render_condition`` function specifies the query which should be checked 399prior to rendering anything. Functions always honoring render_condition include 400(and are limited to) draw_vbo, clear, clear_render_target, clear_depth_stencil. 401The blit function (but not resource_copy_region, which seems inconsistent) 402can also optionally honor the current render condition. 403 404If ``render_condition`` is called with ``query`` = NULL, conditional 405rendering is disabled and drawing takes place normally. 406 407If ``render_condition`` is called with a non-null ``query`` subsequent 408drawing commands will be predicated on the outcome of the query. 409Commands will be skipped if ``condition`` is equal to the predicate result 410(for non-boolean queries such as OCCLUSION_QUERY, zero counts as FALSE, 411non-zero as TRUE). 412 413If ``mode`` is PIPE_RENDER_COND_WAIT the driver will wait for the 414query to complete before deciding whether to render. 415 416If ``mode`` is PIPE_RENDER_COND_NO_WAIT and the query has not yet 417completed, the drawing command will be executed normally. If the query 418has completed, drawing will be predicated on the outcome of the query. 419 420If ``mode`` is PIPE_RENDER_COND_BY_REGION_WAIT or 421PIPE_RENDER_COND_BY_REGION_NO_WAIT rendering will be predicated as above 422for the non-REGION modes but in the case that an occlusion query returns 423a non-zero result, regions which were occluded may be ommitted by subsequent 424drawing commands. This can result in better performance with some GPUs. 425Normally, if the occlusion query returned a non-zero result subsequent 426drawing happens normally so fragments may be generated, shaded and 427processed even where they're known to be obscured. 428 429 430Flushing 431^^^^^^^^ 432 433``flush`` 434 435 436``flush_resource`` 437 438Flush the resource cache, so that the resource can be used 439by an external client. Possible usage: 440- flushing a resource before presenting it on the screen 441- flushing a resource if some other process or device wants to use it 442This shouldn't be used to flush caches if the resource is only managed 443by a single pipe_screen and is not shared with another process. 444(i.e. you shouldn't use it to flush caches explicitly if you want to e.g. 445use the resource for texturing) 446 447 448 449Resource Busy Queries 450^^^^^^^^^^^^^^^^^^^^^ 451 452``is_resource_referenced`` 453 454 455 456Blitting 457^^^^^^^^ 458 459These methods emulate classic blitter controls. 460 461These methods operate directly on ``pipe_resource`` objects, and stand 462apart from any 3D state in the context. Blitting functionality may be 463moved to a separate abstraction at some point in the future. 464 465``resource_copy_region`` blits a region of a resource to a region of another 466resource, provided that both resources have the same format, or compatible 467formats, i.e., formats for which copying the bytes from the source resource 468unmodified to the destination resource will achieve the same effect of a 469textured quad blitter.. The source and destination may be the same resource, 470but overlapping blits are not permitted. 471This can be considered the equivalent of a CPU memcpy. 472 473``blit`` blits a region of a resource to a region of another resource, including 474scaling, format conversion, and up-/downsampling, as well as a destination clip 475rectangle (scissors). It can also optionally honor the current render condition 476(but either way the blit itself never contributes anything to queries currently 477gathering data). 478As opposed to manually drawing a textured quad, this lets the pipe driver choose 479the optimal method for blitting (like using a special 2D engine), and usually 480offers, for example, accelerated stencil-only copies even where 481PIPE_CAP_SHADER_STENCIL_EXPORT is not available. 482 483 484Transfers 485^^^^^^^^^ 486 487These methods are used to get data to/from a resource. 488 489``transfer_map`` creates a memory mapping and the transfer object 490associated with it. 491The returned pointer points to the start of the mapped range according to 492the box region, not the beginning of the resource. If transfer_map fails, 493the returned pointer to the buffer memory is NULL, and the pointer 494to the transfer object remains unchanged (i.e. it can be non-NULL). 495 496``transfer_unmap`` remove the memory mapping for and destroy 497the transfer object. The pointer into the resource should be considered 498invalid and discarded. 499 500``transfer_inline_write`` performs a simplified transfer for simple writes. 501Basically transfer_map, data write, and transfer_unmap all in one. 502 503 504The box parameter to some of these functions defines a 1D, 2D or 3D 505region of pixels. This is self-explanatory for 1D, 2D and 3D texture 506targets. 507 508For PIPE_TEXTURE_1D_ARRAY and PIPE_TEXTURE_2D_ARRAY, the box::z and box::depth 509fields refer to the array dimension of the texture. 510 511For PIPE_TEXTURE_CUBE, the box:z and box::depth fields refer to the 512faces of the cube map (z + depth <= 6). 513 514For PIPE_TEXTURE_CUBE_ARRAY, the box:z and box::depth fields refer to both 515the face and array dimension of the texture (face = z % 6, array = z / 6). 516 517 518.. _transfer_flush_region: 519 520transfer_flush_region 521%%%%%%%%%%%%%%%%%%%%% 522 523If a transfer was created with ``FLUSH_EXPLICIT``, it will not automatically 524be flushed on write or unmap. Flushes must be requested with 525``transfer_flush_region``. Flush ranges are relative to the mapped range, not 526the beginning of the resource. 527 528 529 530.. _texture_barrier: 531 532texture_barrier 533%%%%%%%%%%%%%%% 534 535This function flushes all pending writes to the currently-set surfaces and 536invalidates all read caches of the currently-set samplers. 537 538 539 540.. _memory_barrier: 541 542memory_barrier 543%%%%%%%%%%%%%%% 544 545This function flushes caches according to which of the PIPE_BARRIER_* flags 546are set. 547 548 549 550.. _pipe_transfer: 551 552PIPE_TRANSFER 553^^^^^^^^^^^^^ 554 555These flags control the behavior of a transfer object. 556 557``PIPE_TRANSFER_READ`` 558 Resource contents read back (or accessed directly) at transfer create time. 559 560``PIPE_TRANSFER_WRITE`` 561 Resource contents will be written back at transfer_unmap time (or modified 562 as a result of being accessed directly). 563 564``PIPE_TRANSFER_MAP_DIRECTLY`` 565 a transfer should directly map the resource. May return NULL if not supported. 566 567``PIPE_TRANSFER_DISCARD_RANGE`` 568 The memory within the mapped region is discarded. Cannot be used with 569 ``PIPE_TRANSFER_READ``. 570 571``PIPE_TRANSFER_DISCARD_WHOLE_RESOURCE`` 572 Discards all memory backing the resource. It should not be used with 573 ``PIPE_TRANSFER_READ``. 574 575``PIPE_TRANSFER_DONTBLOCK`` 576 Fail if the resource cannot be mapped immediately. 577 578``PIPE_TRANSFER_UNSYNCHRONIZED`` 579 Do not synchronize pending operations on the resource when mapping. The 580 interaction of any writes to the map and any operations pending on the 581 resource are undefined. Cannot be used with ``PIPE_TRANSFER_READ``. 582 583``PIPE_TRANSFER_FLUSH_EXPLICIT`` 584 Written ranges will be notified later with :ref:`transfer_flush_region`. 585 Cannot be used with ``PIPE_TRANSFER_READ``. 586 587``PIPE_TRANSFER_PERSISTENT`` 588 Allows the resource to be used for rendering while mapped. 589 PIPE_RESOURCE_FLAG_MAP_PERSISTENT must be set when creating 590 the resource. 591 If COHERENT is not set, memory_barrier(PIPE_BARRIER_MAPPED_BUFFER) 592 must be called to ensure the device can see what the CPU has written. 593 594``PIPE_TRANSFER_COHERENT`` 595 If PERSISTENT is set, this ensures any writes done by the device are 596 immediately visible to the CPU and vice versa. 597 PIPE_RESOURCE_FLAG_MAP_COHERENT must be set when creating 598 the resource. 599 600Compute kernel execution 601^^^^^^^^^^^^^^^^^^^^^^^^ 602 603A compute program can be defined, bound or destroyed using 604``create_compute_state``, ``bind_compute_state`` or 605``destroy_compute_state`` respectively. 606 607Any of the subroutines contained within the compute program can be 608executed on the device using the ``launch_grid`` method. This method 609will execute as many instances of the program as elements in the 610specified N-dimensional grid, hopefully in parallel. 611 612The compute program has access to four special resources: 613 614* ``GLOBAL`` represents a memory space shared among all the threads 615 running on the device. An arbitrary buffer created with the 616 ``PIPE_BIND_GLOBAL`` flag can be mapped into it using the 617 ``set_global_binding`` method. 618 619* ``LOCAL`` represents a memory space shared among all the threads 620 running in the same working group. The initial contents of this 621 resource are undefined. 622 623* ``PRIVATE`` represents a memory space local to a single thread. 624 The initial contents of this resource are undefined. 625 626* ``INPUT`` represents a read-only memory space that can be 627 initialized at ``launch_grid`` time. 628 629These resources use a byte-based addressing scheme, and they can be 630accessed from the compute program by means of the LOAD/STORE TGSI 631opcodes. Additional resources to be accessed using the same opcodes 632may be specified by the user with the ``set_compute_resources`` 633method. 634 635In addition, normal texture sampling is allowed from the compute 636program: ``bind_sampler_states`` may be used to set up texture 637samplers for the compute stage and ``set_sampler_views`` may 638be used to bind a number of sampler views to it. 639