From aac2cccccfd701ae8d7ce0813c28c64498d4a076 Mon Sep 17 00:00:00 2001 From: Roland Scheidegger Date: Mon, 26 Apr 2010 19:50:57 +0200 Subject: gallium: interface changes for multisampling add function to set sample mask, and state for alpha-to-coverage and alpha-to-one. Also make it possible to query for supported sample count with is_msaa_supported(). Use explicit resource_resolve() to resolve a resource. Note that it is illegal to bind a unresolved resource as a sampler view, must be resolved first (as per d3d10 and OGL APIs, binding unresolved resource would mean that special texture fetch functions need to be used which give explicit control over what samples to fetch, which isn't supported yet). Also change surface_fill() and surface_copy() to operate directly on resources. Blits should operate directly on resources, most often state trackers just used get_tex_surface() then did a blit. Note this also means the blit bind flags are gone, if a driver implements this functionality it is expected to handle it for all resources having depth_stencil/render_target/sampler_view bind flags (might even require it for all bind flags?). Might want to introduce quality levels for MSAA later. Might need to revisit this for hw which does instant resolve. --- src/gallium/docs/source/context.rst | 16 +++++++++++----- src/gallium/docs/source/screen.rst | 13 ++++++++++--- 2 files changed, 21 insertions(+), 8 deletions(-) (limited to 'src/gallium/docs') diff --git a/src/gallium/docs/source/context.rst b/src/gallium/docs/source/context.rst index c82e681a254..374711b3c5c 100644 --- a/src/gallium/docs/source/context.rst +++ b/src/gallium/docs/source/context.rst @@ -54,6 +54,7 @@ objects. They all follow simple, one-method binding calls, e.g. * ``set_stencil_ref`` sets the stencil front and back reference values which are used as comparison values in stencil test. * ``set_blend_color`` +* ``set_sample_mask`` * ``set_clip_state`` * ``set_polygon_stipple`` * ``set_scissor_state`` sets the bounds for the scissor test, which culls @@ -255,15 +256,20 @@ Blitting These methods emulate classic blitter controls. They are not guaranteed to be available; if they are set to NULL, then they are not present. -These methods operate directly on ``pipe_surface`` objects, and stand +These methods operate directly on ``pipe_resource`` 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. -``surface_fill`` performs a fill operation on a section of a surface. +``resource_fill_region`` performs a fill operation on a section of a resource. -``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. +``resource_copy_region`` blits a region of a subresource of a resource to a +region of another subresource of a resource, provided that both resources have the +same format. The source and destination may be the same resource, and overlapping +blits are permitted. + +``resource_resolve`` resolves a multisampled resource into a non-multisampled +one. Formats and dimensions must match. This function must be present if a driver +supports multisampling. 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 diff --git a/src/gallium/docs/source/screen.rst b/src/gallium/docs/source/screen.rst index c5815f8939c..2a8f6967ea9 100644 --- a/src/gallium/docs/source/screen.rst +++ b/src/gallium/docs/source/screen.rst @@ -128,9 +128,6 @@ resources might be created and handled quite differently. * ``PIPE_BIND_VERTEX_BUFFER``: A vertex buffer. * ``PIPE_BIND_INDEX_BUFFER``: An vertex index/element buffer. * ``PIPE_BIND_CONSTANT_BUFFER``: A buffer of shader constants. -* ``PIPE_BIND_BLIT_SOURCE``: A blit source, as given to surface_copy. -* ``PIPE_BIND_BLIT_DESTINATION``: A blit destination, as given to surface_copy - and surface_fill. * ``PIPE_BIND_TRANSFER_WRITE``: A transfer object which will be written to. * ``PIPE_BIND_TRANSFER_READ``: A transfer object which will be read from. * ``PIPE_BIND_CUSTOM``: @@ -223,6 +220,16 @@ Determine if a resource in the given format can be used in a specific manner. Returns TRUE if all usages can be satisfied. +is_msaa_supported +^^^^^^^^^^^^^^^^^ + +Determine if a format supports multisampling with a given number of samples. + +**format** the resource format + +**sample_count** the number of samples. Valid query range is 2-32. + +Returns TRUE if sample_count number of samples is supported with this format. .. _resource_create: -- cgit v1.2.3 From f1cf6b0d371c907938fd3780ef7a53f294ec1064 Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Mon, 17 May 2010 12:00:59 -0700 Subject: gallium/docs: Update for timer queries. --- src/gallium/docs/source/context.rst | 13 ++++++++++--- src/gallium/docs/source/screen.rst | 3 +++ 2 files changed, 13 insertions(+), 3 deletions(-) (limited to 'src/gallium/docs') diff --git a/src/gallium/docs/source/context.rst b/src/gallium/docs/source/context.rst index c82e681a254..66028a63b59 100644 --- a/src/gallium/docs/source/context.rst +++ b/src/gallium/docs/source/context.rst @@ -200,9 +200,16 @@ returned). Otherwise, if the ``wait`` parameter is FALSE, the call will not block and the return value will be TRUE if the query has completed or FALSE otherwise. -A common type of query is the occlusion query which counts the number of -fragments/pixels which are written to the framebuffer (and not culled by -Z/stencil/alpha testing or shader KILL instructions). +The most common type of query is the occlusion query, +``PIPE_QUERY_OCCLUSION_COUNTER``, which counts the number of fragments which +are written to the framebuffer without being culled by +:ref:`Depth, Stencil, & Alpha` testing or shader KILL instructions. + +Another type of query, ``PIPE_QUERY_TIME_ELAPSED``, returns the amount of +time, in milliseconds, the context takes to perform operations. + +Gallium does not guarantee the availability of any query types; one must +always check the capabilities of the :ref:`Screen` first. Conditional Rendering diff --git a/src/gallium/docs/source/screen.rst b/src/gallium/docs/source/screen.rst index 71b7aec35a5..96257f93df9 100644 --- a/src/gallium/docs/source/screen.rst +++ b/src/gallium/docs/source/screen.rst @@ -1,3 +1,5 @@ +.. _screen: + Screen ====== @@ -33,6 +35,7 @@ The integer capabilities: * ``MAX_RENDER_TARGETS``: The maximum number of render targets that may be bound. * ``OCCLUSION_QUERY``: Whether occlusion queries are available. +* ``TIMER_QUERY``: Whether timer queries are available. * ``TEXTURE_SHADOW_MAP``: XXX * ``MAX_TEXTURE_2D_LEVELS``: The maximum number of mipmap levels available for a 2D texture. -- cgit v1.2.3 From bb81f65b18b98cb539edf88e171e58fabd732ca3 Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Mon, 17 May 2010 12:58:29 -0700 Subject: gallium/docs: Fix missing ref. Can't ref in the middle of a paragraph. --- src/gallium/docs/source/context.rst | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'src/gallium/docs') diff --git a/src/gallium/docs/source/context.rst b/src/gallium/docs/source/context.rst index 66028a63b59..bce1eef9be1 100644 --- a/src/gallium/docs/source/context.rst +++ b/src/gallium/docs/source/context.rst @@ -291,11 +291,6 @@ data to be written to the resource at this point. The returned map points to the start of the mapped range according to the box region, not the beginning of the resource. -.. _transfer_flush_region: -``transfer_flush_region`` If a transfer was created with TRANFER_FLUSH_EXPLICIT, -only the region specified is guaranteed to be written to. This is relative to -the mapped range, not the beginning of the resource. - ``transfer_unmap`` remove the memory mapping for the transfer object. Any pointers into the map should be considered invalid and discarded. @@ -303,6 +298,16 @@ Any pointers into the map should be considered invalid and discarded. Basically get_transfer, transfer_map, data write, transfer_unmap, and transfer_destroy all in one. +.. _transfer_flush_region: + +transfer_flush_region +%%%%%%%%%%%%%%%%%%%%% + +If a transfer was created with ``FLUSH_EXPLICIT``, it will not automatically +be flushed on write or unmap. Flushes must be requested with +``transfer_flush_region``. Flush ranges are relative to the mapped range, not +the beginning of the resource. + .. _pipe_transfer: PIPE_TRANSFER @@ -322,5 +327,4 @@ These flags control the behavior of a transfer object. operations pending on the resource are undefined. Cannot be used with ``READ``. * ``FLUSH_EXPLICIT``: Written ranges will be notified later with - :ref:`transfer_flush_region`. Cannot be used with - ``READ``. + :ref:`transfer_flush_region`. Cannot be used with ``READ``. -- cgit v1.2.3 From 7f19b65b1ae4b68129b476b3089264ea9b25e6e6 Mon Sep 17 00:00:00 2001 From: Mathias Fröhlich Date: Wed, 19 May 2010 08:46:51 -0600 Subject: gallium/docs: s/milli/nano/ --- src/gallium/docs/source/context.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/gallium/docs') diff --git a/src/gallium/docs/source/context.rst b/src/gallium/docs/source/context.rst index bce1eef9be1..ec358e34545 100644 --- a/src/gallium/docs/source/context.rst +++ b/src/gallium/docs/source/context.rst @@ -206,7 +206,7 @@ are written to the framebuffer without being culled by :ref:`Depth, Stencil, & Alpha` testing or shader KILL instructions. Another type of query, ``PIPE_QUERY_TIME_ELAPSED``, returns the amount of -time, in milliseconds, the context takes to perform operations. +time, in nanoseconds, the context takes to perform operations. Gallium does not guarantee the availability of any query types; one must always check the capabilities of the :ref:`Screen` first. -- cgit v1.2.3 From bfc702d1e7470d611600dad18e0f829d08281eed Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Wed, 12 May 2010 14:08:22 +0100 Subject: gallium: Add new fine grained PIPE_CAP_xx for shader limits. PIPE_CAP_GLSL and PIPE_CAP_SM3 not removed yet, as opcode support is not yet covered. --- src/gallium/docs/source/screen.rst | 16 ++++++++++++++++ src/gallium/include/pipe/p_defines.h | 24 ++++++++++++++++++++++++ 2 files changed, 40 insertions(+) (limited to 'src/gallium/docs') diff --git a/src/gallium/docs/source/screen.rst b/src/gallium/docs/source/screen.rst index c5815f8939c..71b7aec35a5 100644 --- a/src/gallium/docs/source/screen.rst +++ b/src/gallium/docs/source/screen.rst @@ -101,6 +101,22 @@ The floating-point capabilities: * ``GUARD_BAND_LEFT``, ``GUARD_BAND_TOP``, ``GUARD_BAND_RIGHT``, ``GUARD_BAND_BOTTOM``: XXX +Fragment shader limits: + +* ``PIPE_CAP_MAX_FS_INSTRUCTIONS``: The maximum number of instructions. +* ``PIPE_CAP_MAX_FS_ALU_INSTRUCTIONS``: The maximum number of arithmetic instructions. +* ``PIPE_CAP_MAX_FS_TEX_INSTRUCTIONS``: The maximum number of texture instructions. +* ``PIPE_CAP_MAX_FS_TEX_INDIRECTIONS``: The maximum number of texture indirections. +* ``PIPE_CAP_MAX_FS_CONTROL_FLOW_DEPTH``: The maximum nested control flow depth. +* ``PIPE_CAP_MAX_FS_INPUTS``: The maximum number of input registers. +* ``PIPE_CAP_MAX_FS_CONSTS``: The maximum number of constants. +* ``PIPE_CAP_MAX_FS_TEMPS``: The maximum number of temporary registers. +* ``PIPE_CAP_MAX_FS_ADDRS``: The maximum number of address registers. +* ``PIPE_CAP_MAX_FS_PREDS``: The maximum number of predicate registers. + +Vertex shader limits: + +* ``PIPE_CAP_MAX_VS_*``: Identical to ``PIPE_CAP_MAX_FS_*``. .. _pipe_bind: diff --git a/src/gallium/include/pipe/p_defines.h b/src/gallium/include/pipe/p_defines.h index 7e43edcff8c..2d363dd47b6 100644 --- a/src/gallium/include/pipe/p_defines.h +++ b/src/gallium/include/pipe/p_defines.h @@ -457,6 +457,30 @@ enum pipe_cap { PIPE_CAP_TGSI_FS_COORD_ORIGIN_LOWER_LEFT, PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_HALF_INTEGER, PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_INTEGER, + + /* + * Shader limits. + */ + PIPE_CAP_MAX_FS_INSTRUCTIONS, + PIPE_CAP_MAX_FS_ALU_INSTRUCTIONS, + PIPE_CAP_MAX_FS_TEX_INSTRUCTIONS, + PIPE_CAP_MAX_FS_TEX_INDIRECTIONS, + PIPE_CAP_MAX_FS_CONTROL_FLOW_DEPTH, + PIPE_CAP_MAX_FS_INPUTS, + PIPE_CAP_MAX_FS_CONSTS, + PIPE_CAP_MAX_FS_TEMPS, + PIPE_CAP_MAX_FS_ADDRS, + PIPE_CAP_MAX_FS_PREDS, + PIPE_CAP_MAX_VS_INSTRUCTIONS, + PIPE_CAP_MAX_VS_ALU_INSTRUCTIONS, + PIPE_CAP_MAX_VS_TEX_INSTRUCTIONS, + PIPE_CAP_MAX_VS_TEX_INDIRECTIONS, + PIPE_CAP_MAX_VS_CONTROL_FLOW_DEPTH, + PIPE_CAP_MAX_VS_INPUTS, + PIPE_CAP_MAX_VS_CONSTS, + PIPE_CAP_MAX_VS_TEMPS, + PIPE_CAP_MAX_VS_ADDRS, + PIPE_CAP_MAX_VS_PREDS }; -- cgit v1.2.3 From 6272d7632a8d2948e45698d1c75eae8c441c3916 Mon Sep 17 00:00:00 2001 From: Roland Scheidegger Date: Mon, 17 May 2010 20:52:08 +0200 Subject: gallium: another interface change for multisampling due to popular request, use nr_samples parameter in is_format_supported() instead of new is_msaa_supported() query. This makes it easily possible to query if a format with a given sample count is also supported not only as render target, but for sampler views (note that texture sampling from multisampled resources isn't supported yet). It is not quite how dx10 format msaa queries work, but we might need to revisit format queries completely in the future anyway. --- src/gallium/docs/source/screen.rst | 14 +++----------- src/gallium/include/pipe/p_screen.h | 12 ++---------- 2 files changed, 5 insertions(+), 21 deletions(-) (limited to 'src/gallium/docs') diff --git a/src/gallium/docs/source/screen.rst b/src/gallium/docs/source/screen.rst index 2a8f6967ea9..5a60ee00a69 100644 --- a/src/gallium/docs/source/screen.rst +++ b/src/gallium/docs/source/screen.rst @@ -214,23 +214,15 @@ Determine if a resource in the given format can be used in a specific manner. **target** one of the PIPE_TEXTURE_x flags +**sample_count** the number of samples. 0 and 1 mean no multisampling, +the maximum allowed legal value is 32. + **bindings** is a bitmask of :ref:`PIPE_BIND` flags. **geom_flags** is a bitmask of PIPE_TEXTURE_GEOM_x flags. Returns TRUE if all usages can be satisfied. -is_msaa_supported -^^^^^^^^^^^^^^^^^ - -Determine if a format supports multisampling with a given number of samples. - -**format** the resource format - -**sample_count** the number of samples. Valid query range is 2-32. - -Returns TRUE if sample_count number of samples is supported with this format. - .. _resource_create: resource_create diff --git a/src/gallium/include/pipe/p_screen.h b/src/gallium/include/pipe/p_screen.h index 1bad045b162..9cb949a4465 100644 --- a/src/gallium/include/pipe/p_screen.h +++ b/src/gallium/include/pipe/p_screen.h @@ -89,7 +89,7 @@ struct pipe_screen { struct pipe_context * (*context_create)( struct pipe_screen *, void *priv ); - + /** * Check if the given pipe_format is supported as a texture or * drawing surface. @@ -99,18 +99,10 @@ struct pipe_screen { boolean (*is_format_supported)( struct pipe_screen *, enum pipe_format format, enum pipe_texture_target target, + unsigned sample_count, unsigned bindings, unsigned geom_flags ); - /** - * Check if the given pipe_format is supported with a requested - * number of samples for msaa. - * \param sample_count number of samples for multisampling - */ - boolean (*is_msaa_supported)( struct pipe_screen *, - enum pipe_format format, - unsigned sample_count ); - /** * Create a new texture object, using the given template info. */ -- cgit v1.2.3 From 379db6a36b32912be8fd8808ceb95ca5cffa7850 Mon Sep 17 00:00:00 2001 From: Roland Scheidegger Date: Mon, 17 May 2010 21:02:24 +0200 Subject: gallium: clean up resource_copy_region function Previously, surface_copy was said to allow overlapping blits, and it was "optional". However, some state trackers actually assumed it is always present, and quite some code (like in u_blit) assumed overlapping isn't allowed. Hence, resource_copy_region (and in the same spirit, resource_fill_region) is now mandatory, but overlapping blits are no longer allowed. A driver can plug in the cpu fallback util_resource_copy_region if it does not want to provide its own implementation, though this is not optimal. --- src/gallium/docs/source/context.rst | 7 +++---- src/gallium/include/pipe/p_context.h | 2 -- 2 files changed, 3 insertions(+), 6 deletions(-) (limited to 'src/gallium/docs') diff --git a/src/gallium/docs/source/context.rst b/src/gallium/docs/source/context.rst index 374711b3c5c..ac3c3c7bdbd 100644 --- a/src/gallium/docs/source/context.rst +++ b/src/gallium/docs/source/context.rst @@ -253,8 +253,7 @@ Resource Busy Queries Blitting ^^^^^^^^ -These methods emulate classic blitter controls. They are not guaranteed to be -available; if they are set to NULL, then they are not present. +These methods emulate classic blitter controls. These methods operate directly on ``pipe_resource`` objects, and stand apart from any 3D state in the context. Blitting functionality may be @@ -264,8 +263,8 @@ moved to a separate abstraction at some point in the future. ``resource_copy_region`` blits a region of a subresource of a resource to a region of another subresource of a resource, provided that both resources have the -same format. The source and destination may be the same resource, and overlapping -blits are permitted. +same format. The source and destination may be the same resource, but overlapping +blits are not permitted. ``resource_resolve`` resolves a multisampled resource into a non-multisampled one. Formats and dimensions must match. This function must be present if a driver diff --git a/src/gallium/include/pipe/p_context.h b/src/gallium/include/pipe/p_context.h index 6ce8ba953a7..6b729831768 100644 --- a/src/gallium/include/pipe/p_context.h +++ b/src/gallium/include/pipe/p_context.h @@ -238,8 +238,6 @@ struct pipe_context { /** * Resource functions for blit-like functionality * - * The pipe driver is allowed to set these functions to NULL, and in that - * case, they will not be available. * If a driver supports multisampling, resource_resolve must be available. */ /*@{*/ -- cgit v1.2.3 From db0ddb7c0196c11cd47066bbf6af3febbefb7100 Mon Sep 17 00:00:00 2001 From: Roland Scheidegger Date: Tue, 18 May 2010 21:42:09 +0200 Subject: docs: update differences to d3d11 --- src/gallium/docs/d3d11ddi.txt | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) (limited to 'src/gallium/docs') diff --git a/src/gallium/docs/d3d11ddi.txt b/src/gallium/docs/d3d11ddi.txt index 8f2509ce035..d9c2b441a94 100644 --- a/src/gallium/docs/d3d11ddi.txt +++ b/src/gallium/docs/d3d11ddi.txt @@ -79,7 +79,7 @@ set_clip_state set_polygon_stipple + Gallium supports polygon stipple -surface_fill +resource_fill_region + Gallium supports subrectangle fills of surfaces, D3D10 only supports full clears of views * DirectX 10/11 DDI functions and Gallium equivalents @@ -114,11 +114,10 @@ CheckDeferredContextHandleSizes (D3D11 only) CheckFormatSupport -> screen->is_format_supported ! Gallium passes usages to this function, D3D11 returns them - Gallium does not differentiate between blendable and non-blendable render targets - - Gallium lacks multisampled-texture and multisampled-render-target usages + ! Gallium includes sample count directly, D3D11 uses additional query CheckMultisampleQualityLevels - * could merge this with is_format_supported - - Gallium lacks multisampling support + ! is merged with is_format_supported CommandListExecute (D3D11 only) - Gallium does not support command lists @@ -139,7 +138,6 @@ ClearUnorderedAccessViewUint (D3D11 only) CreateBlendState (extended in D3D10.1) -> create_blend_state # D3D10 does not support per-RT blend modes (but per-RT blending), only D3D10.1 does - - Gallium lacks alpha-to-coverage + Gallium supports logic ops + Gallium supports dithering + Gallium supports using the broadcast alpha component of the blend constant color @@ -198,7 +196,6 @@ CreateQuery -> create_query CreateRasterizerState - Gallium lacks clamping of polygon offset depth biases - Gallium lacks support to disable depth clipping - - Gallium lacks multisampling + Gallium, like OpenGL, supports PIPE_POLYGON_MODE_POINT + Gallium, like OpenGL, supports per-face polygon fill modes + Gallium, like OpenGL, supports culling everything @@ -228,7 +225,6 @@ CreateResource -> texture_create or buffer_create ! D3D11 specifies mapping flags (i.e. read/write/discard);:it's unclear what they are used for here - D3D11 supports odd things in the D3D10_DDI_RESOURCE_MISC_FLAG enum (D3D10_DDI_RESOURCE_MISC_DISCARD_ON_PRESENT, D3D11_DDI_RESOURCE_MISC_BUFFER_ALLOW_RAW_VIEWS, D3D11_DDI_RESOURCE_MISC_BUFFER_STRUCTURED) - Gallium does not support indirect draw call parameter buffers - - Gallium lacks multisampling - Gallium lacks array textures ! D3D11 supports specifying hardware modes and other stuff here for scanout resources + Gallium allows specifying minimum buffer alignment @@ -400,7 +396,7 @@ ResourceCopy ResourceCopyRegion ResourceConvert (D3D10.1+ only) ResourceConvertRegion (D3D10.1+ only) - -> surface_copy + -> resource_copy_region - Gallium does not support hardware buffer copies - Gallium does not support copying 3D texture subregions in a single call @@ -410,8 +406,7 @@ ResourceIsStagingBusy -> is_texture_referenced, is_buffer_referenced ResourceReadAfterWriteHazard ! Gallium specifies hides this, except for the render and texture caches -ResourceResolveSubresource - - Gallium does not support multisample sample resolution +ResourceResolveSubresource -> resource_resolve ResourceMap ResourceUnmap @@ -433,9 +428,8 @@ StagingResourceUnmap ResourceUpdateSubresourceUP -> transfer functionality, transfer_inline_write in gallium-resources DefaultConstantBufferUpdateSubresourceUP -> transfer functionality, transfer_inline_write in gallium-resources -SetBlendState -> bind_blend_state and set_blend_color - ! D3D11 fuses bind_blend_state and set_blend_color in a single function - - Gallium lacks the sample mask +SetBlendState -> bind_blend_state, set_blend_color and set_sample_mask + ! D3D11 fuses bind_blend_state, set_blend_color and set_sample_mask in a single function SetDepthStencilState -> bind_depth_stencil_alpha_state and set_stencil_ref ! D3D11 fuses bind_depth_stencil_alpha_state and set_stencil_ref in a single function -- cgit v1.2.3 From 0ff2373131011cf3d7dec737aa4ef5f54d2b7ba5 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Fri, 21 May 2010 15:38:48 +0100 Subject: docs: update rasterizer for ccw changes Also rearrange some of the fields into point/line/polygon categories. --- src/gallium/docs/source/cso/rasterizer.rst | 135 +++++++++++++++++------------ 1 file changed, 80 insertions(+), 55 deletions(-) (limited to 'src/gallium/docs') diff --git a/src/gallium/docs/source/cso/rasterizer.rst b/src/gallium/docs/source/cso/rasterizer.rst index 56a601a8d06..ad1612f93e3 100644 --- a/src/gallium/docs/source/cso/rasterizer.rst +++ b/src/gallium/docs/source/cso/rasterizer.rst @@ -46,6 +46,78 @@ There are several important exceptions to the specification of this rule. second vertex, not the first. This permits each segment of the fan to have a different color. +Polygons +-------- + +light_twoside +^^^^^^^^^^^^^ + +If set, there are per-vertex back-facing colors. The hardware +(perhaps assisted by :ref:`Draw`) should be set up to use this state +along with the front/back information to set the final vertex colors +prior to rasterization. + +The frontface vertex shader color output is marked with TGSI semantic +COLOR[0], and backface COLOR[1]. + +front_ccw + Indicates whether the window order of front-facing polygons is + counter-clockwise (TRUE) or clockwise (FALSE). + +cull_mode + Indicates which faces of polygons to cull, either PIPE_FACE_NONE + (cull no polygons), PIPE_FACE_FRONT (cull front-facing polygons), + PIPE_FACE_BACK (cull back-facing polygons), or + PIPE_FACE_FRONT_AND_BACK (cull all polygons). + +fill_front + Indicates how to fill front-facing polygons, either + PIPE_POLYGON_MODE_FILL, PIPE_POLYGON_MODE_LINE or + PIPE_POLYGON_MODE_POINT. +fill_back + Indicates how to fill back-facing polygons, either + PIPE_POLYGON_MODE_FILL, PIPE_POLYGON_MODE_LINE or + PIPE_POLYGON_MODE_POINT. + +poly_stipple_enable + Whether polygon stippling is enabled. +poly_smooth + Controls OpenGL-style polygon smoothing/antialiasing + +offset_point + If set, point-filled polygons will have polygon offset factors applied +offset_line + If set, line-filled polygons will have polygon offset factors applied +offset_tri + If set, filled polygons will have polygon offset factors applied + +offset_units + Specifies the polygon offset bias +offset_scale + Specifies the polygon offset scale + + + +Lines +----- + +line_width + The width of lines. +line_smooth + Whether lines should be smoothed. Line smoothing is simply anti-aliasing. +line_stipple_enable + Whether line stippling is enabled. +line_stipple_pattern + 16-bit bitfield of on/off flags, used to pattern the line stipple. +line_stipple_factor + When drawing a stippled line, each bit in the stipple pattern is + repeated N times, where N = line_stipple_factor + 1. +line_last_pixel + Controls whether the last pixel in a line is drawn or not. OpenGL + omits the last pixel to avoid double-drawing pixels at the ends of lines + when drawing connected lines. + + Points ------ @@ -89,68 +161,21 @@ coordinates are not generated. Some renderers always internally translate points into quads; this state still affects those renderers by overriding other rasterization state. -Other Members -^^^^^^^^^^^^^ - -light_twoside - If set, there are per-vertex back-facing colors. :ref:`Draw` - uses this state along with the front/back information to set the - final vertex colors prior to rasterization. - -front_winding - Indicates the window order of front-facing polygons, either - PIPE_WINDING_CW or PIPE_WINDING_CCW - -cull_mode - Indicates which polygons to cull, either PIPE_WINDING_NONE (cull no - polygons), PIPE_WINDING_CW (cull clockwise-winding polygons), - PIPE_WINDING_CCW (cull counter clockwise-winding polygons), or - PIPE_WINDING_BOTH (cull all polygons). - -fill_cw - Indicates how to fill clockwise polygons, either PIPE_POLYGON_MODE_FILL, - PIPE_POLYGON_MODE_LINE or PIPE_POLYGON_MODE_POINT. -fill_ccw - Indicates how to fill counter clockwise polygons, either - PIPE_POLYGON_MODE_FILL, PIPE_POLYGON_MODE_LINE or PIPE_POLYGON_MODE_POINT. - -poly_stipple_enable - Whether polygon stippling is enabled. -poly_smooth - Controls OpenGL-style polygon smoothing/antialiasing -offset_cw - If set, clockwise polygons will have polygon offset factors applied -offset_ccw - If set, counter clockwise polygons will have polygon offset factors applied -offset_units - Specifies the polygon offset bias -offset_scale - Specifies the polygon offset scale - -line_width - The width of lines. -line_smooth - Whether lines should be smoothed. Line smoothing is simply anti-aliasing. -line_stipple_enable - Whether line stippling is enabled. -line_stipple_pattern - 16-bit bitfield of on/off flags, used to pattern the line stipple. -line_stipple_factor - When drawing a stippled line, each bit in the stipple pattern is - repeated N times, where N = line_stipple_factor + 1. -line_last_pixel - Controls whether the last pixel in a line is drawn or not. OpenGL - omits the last pixel to avoid double-drawing pixels at the ends of lines - when drawing connected lines. - point_smooth Whether points should be smoothed. Point smoothing turns rectangular points into circles or ovals. point_size_per_vertex - Whether vertices have a point size element. + Whether the vertex shader is expected to have a point size output. + Undefined behaviour is permitted if there is disagreement between + this flag and the actual bound shader. point_size The size of points, if not specified per-vertex. + + +Other Members +------------- + scissor Whether the scissor test is enabled. -- cgit v1.2.3 From 0cd70b554cb0bb9280f83fddf4f1451fddd37230 Mon Sep 17 00:00:00 2001 From: Roland Scheidegger Date: Fri, 28 May 2010 23:57:47 +0200 Subject: gallium: clear interface changes clears were a bit limited in gallium: - no scissoring (OGL only) nor explicit rectangle list (d3d9) - no color/stencil masks (OGL only) - no separate depth/stencil clears (d3d9/d3d10/OGL) - cannot really clear single color buffer (only with resource_fill_region) Additionally, d3d can clear surfaces not currently bound to the framebuffer. It is, however, not easy to find some common ground what a clear should be able to do, due to both API requirements and also hw differences (a case which might be able to use a special clear path on one hw might need a "normal" quad render on another). Hence several clear methods are provided, and a driver should implement all of them. - clear: slightly modified to also be able to clear only depth or stencil in a combined depth/stencil surface. This is however optional based on driver capability though ideally it wouldn't be optional. AFAIK this is in fact something used by applications quite a bit. Otherwise, for now still doesn't allow clearing with scissors/mask (or single color buffers) - clearRT: clears a single (potentially unbound) color surface. This was formerly roughly known as resource_fill_region. mesa st will not currently use this, though potentially would be useful for GL ClearBuffer. - clearDS: similar to above except for depth stencil surfaces. Note that clearDS/clearRT currently handle can handle partial clear. This might change however. --- src/gallium/docs/d3d11ddi.txt | 2 +- src/gallium/docs/source/context.rst | 27 ++++++++++++++++++------- src/gallium/include/pipe/p_context.h | 39 ++++++++++++++++++++++++------------ src/gallium/include/pipe/p_defines.h | 6 ++++-- 4 files changed, 51 insertions(+), 23 deletions(-) (limited to 'src/gallium/docs') diff --git a/src/gallium/docs/d3d11ddi.txt b/src/gallium/docs/d3d11ddi.txt index d9c2b441a94..e3368fdbd69 100644 --- a/src/gallium/docs/d3d11ddi.txt +++ b/src/gallium/docs/d3d11ddi.txt @@ -79,7 +79,7 @@ set_clip_state set_polygon_stipple + Gallium supports polygon stipple -resource_fill_region +clearRT/clearDS + Gallium supports subrectangle fills of surfaces, D3D10 only supports full clears of views * DirectX 10/11 DDI functions and Gallium equivalents diff --git a/src/gallium/docs/source/context.rst b/src/gallium/docs/source/context.rst index 89c02b1b703..037afb0743a 100644 --- a/src/gallium/docs/source/context.rst +++ b/src/gallium/docs/source/context.rst @@ -102,14 +102,29 @@ the LOD range the texture is going to be constrained to. Clearing ^^^^^^^^ +Clear is one of the most difficult concepts to nail down to a single +interface (due to both different requirements from APIs and also driver/hw +specific differences). + ``clear`` initializes some or all of the surfaces currently bound to the framebuffer to particular RGBA, depth, or stencil values. +Currently, this does not take into account color or stencil write masks (as +used by GL), and always clears the whole surfaces (no scissoring as used by +GL clear or explicit rectangles like d3d9 uses). It can, however, also clear +only depth or stencil in a combined depth/stencil surface, if the driver +supports PIPE_CAP_DEPTHSTENCIL_CLEAR_SEPARATE. +If a surface includes several layers/slices (XXX: not yet...) then all layers +will be cleared. -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. +``clearRT`` clears a single color rendertarget with the specified color +value. While it is only possible to clear one surface at a time (which can +include several layers), this surface need not be bound to the framebuffer. + +``clearDS``clears a single depth, stencil or depth/stencil surface with +the specified depth and stencil values (for combined depth/stencil buffers, +is is also possible to only clear one or the other part). While it is only +possible to clear one surface at a time (which can include several layers), +this surface need not be bound to the framebuffer. Drawing @@ -266,8 +281,6 @@ These methods operate directly on ``pipe_resource`` 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. -``resource_fill_region`` performs a fill operation on a section of a resource. - ``resource_copy_region`` blits a region of a subresource of a resource to a region of another subresource of a resource, provided that both resources have the same format. The source and destination may be the same resource, but overlapping diff --git a/src/gallium/include/pipe/p_context.h b/src/gallium/include/pipe/p_context.h index 6b729831768..51f52406d1d 100644 --- a/src/gallium/include/pipe/p_context.h +++ b/src/gallium/include/pipe/p_context.h @@ -256,17 +256,6 @@ struct pipe_context { unsigned srcx, unsigned srcy, unsigned srcz, unsigned width, unsigned height); - /** - * Fill a region of a resource with a constant value. - * Resources with nr_samples > 1 are not allowed. - */ - void (*resource_fill_region)(struct pipe_context *pipe, - struct pipe_resource *dst, - struct pipe_subresource subdst, - unsigned dstx, unsigned dsty, unsigned dstz, - unsigned width, unsigned height, - unsigned value); - /** * Resolve a multisampled resource into a non-multisampled one. * Source and destination must have the same size and same format. @@ -290,9 +279,33 @@ struct pipe_context { */ void (*clear)(struct pipe_context *pipe, unsigned buffers, - const float *rgba, + const float *rgba, double depth, - unsigned stencil); + unsigned stencil); + + /** + * Clear a color rendertarget surface. + * \param rgba pointer to an array of one float for each of r, g, b, a. + */ + void (*clearRT)(struct pipe_context *pipe, + struct pipe_surface *dst, + const float *rgba, + unsigned dstx, unsigned dsty, + unsigned width, unsigned height); + + /** + * Clear a depth-stencil surface. + * \param clear_flags bitfield of PIPE_CLEAR_DEPTH/STENCIL values. + * \param depth depth clear value in [0,1]. + * \param stencil stencil clear value + */ + void (*clearDS)(struct pipe_context *pipe, + struct pipe_surface *dst, + unsigned clear_flags, + double depth, + unsigned stencil, + unsigned dstx, unsigned dsty, + unsigned width, unsigned height); /** Flush rendering * \param flags bitmask of PIPE_FLUSH_x tokens) diff --git a/src/gallium/include/pipe/p_defines.h b/src/gallium/include/pipe/p_defines.h index b54a6ef8247..420649c5a9b 100644 --- a/src/gallium/include/pipe/p_defines.h +++ b/src/gallium/include/pipe/p_defines.h @@ -189,9 +189,10 @@ enum pipe_texture_target { */ /** All color buffers currently bound */ #define PIPE_CLEAR_COLOR (1 << 0) +#define PIPE_CLEAR_DEPTH (1 << 1) +#define PIPE_CLEAR_STENCIL (1 << 2) /** Depth/stencil combined */ -#define PIPE_CLEAR_DEPTHSTENCIL (1 << 1) - +#define PIPE_CLEAR_DEPTHSTENCIL (PIPE_CLEAR_DEPTH | PIPE_CLEAR_STENCIL) /** * Transfer object usage flags @@ -453,6 +454,7 @@ enum pipe_cap { PIPE_CAP_INDEP_BLEND_ENABLE, /** different blend funcs per rendertarget */ PIPE_CAP_INDEP_BLEND_FUNC, + PIPE_CAP_DEPTHSTENCIL_CLEAR_SEPARATE, PIPE_CAP_TGSI_FS_COORD_ORIGIN_UPPER_LEFT, PIPE_CAP_TGSI_FS_COORD_ORIGIN_LOWER_LEFT, PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_HALF_INTEGER, -- cgit v1.2.3 From d9c6ebb4fec0059734d94767ea7fe99c848693a5 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Tue, 1 Jun 2010 16:25:05 +0100 Subject: gallium/docs: Update FRAC -> FRC. --- src/gallium/docs/source/tgsi.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/gallium/docs') diff --git a/src/gallium/docs/source/tgsi.rst b/src/gallium/docs/source/tgsi.rst index e2c8602da02..411dce856a3 100644 --- a/src/gallium/docs/source/tgsi.rst +++ b/src/gallium/docs/source/tgsi.rst @@ -287,7 +287,7 @@ This instruction replicates its result. dst.w = src0.x \times src1.x + src0.y \times src1.y + src2.x -.. opcode:: FRAC - Fraction +.. opcode:: FRC - Fraction .. math:: -- cgit v1.2.3 From a6e5c6c000df8655de3b41d5809547bb41c88c23 Mon Sep 17 00:00:00 2001 From: Roland Scheidegger Date: Thu, 3 Jun 2010 16:33:25 +0200 Subject: gallium: rename clearRT / clearDS to clear_render_target / clear_depth_stencil more consistent with rest of gallium naming conventions. Also rename driver-internal names for these the same. --- src/gallium/auxiliary/util/u_blitter.c | 26 ++++++------ src/gallium/auxiliary/util/u_blitter.h | 24 +++++------ src/gallium/auxiliary/util/u_clear.h | 8 ++-- src/gallium/auxiliary/util/u_surface.c | 14 +++---- src/gallium/auxiliary/util/u_surface.h | 10 ++--- src/gallium/docs/source/context.rst | 8 ++-- src/gallium/drivers/failover/fo_context.c | 4 +- src/gallium/drivers/i915/i915_surface.c | 28 ++++++------- src/gallium/drivers/i965/brw_pipe_clear.c | 28 ++++++------- src/gallium/drivers/identity/id_context.c | 60 +++++++++++++-------------- src/gallium/drivers/nv50/nv50_surface.c | 12 +++--- src/gallium/drivers/nvfx/nvfx_surface.c | 28 ++++++------- src/gallium/drivers/r300/r300_blit.c | 36 ++++++++-------- src/gallium/drivers/rbug/rbug_context.c | 60 +++++++++++++-------------- src/gallium/drivers/trace/tr_context.c | 38 ++++++++--------- src/gallium/include/pipe/p_context.h | 24 +++++------ src/gallium/state_trackers/python/p_context.i | 26 ++++++------ 17 files changed, 217 insertions(+), 217 deletions(-) (limited to 'src/gallium/docs') diff --git a/src/gallium/auxiliary/util/u_blitter.c b/src/gallium/auxiliary/util/u_blitter.c index d05a193bf8d..9ae7b38e6e9 100644 --- a/src/gallium/auxiliary/util/u_blitter.c +++ b/src/gallium/auxiliary/util/u_blitter.c @@ -26,7 +26,7 @@ /** * @file - * Blitter utility to facilitate acceleration of the clear, clearRT, clearDS + * Blitter utility to facilitate acceleration of the clear, clear_render_target, clear_depth_stencil * resource_copy_region functions. * * @author Marek Olšák @@ -781,11 +781,11 @@ void util_blitter_copy_region(struct blitter_context *blitter, } /* Clear a region of a color surface to a constant value. */ -void util_blitter_clearRT(struct blitter_context *blitter, - struct pipe_surface *dstsurf, - const float *rgba, - unsigned dstx, unsigned dsty, - unsigned width, unsigned height) +void util_blitter_clear_render_target(struct blitter_context *blitter, + struct pipe_surface *dstsurf, + const float *rgba, + unsigned dstx, unsigned dsty, + unsigned width, unsigned height) { struct blitter_context_priv *ctx = (struct blitter_context_priv*)blitter; struct pipe_context *pipe = ctx->pipe; @@ -822,13 +822,13 @@ void util_blitter_clearRT(struct blitter_context *blitter, } /* Clear a region of a depth stencil surface. */ -void util_blitter_clearDS(struct blitter_context *blitter, - struct pipe_surface *dstsurf, - unsigned clear_flags, - double depth, - unsigned stencil, - unsigned dstx, unsigned dsty, - unsigned width, unsigned height) +void util_blitter_clear_depth_stencil(struct blitter_context *blitter, + struct pipe_surface *dstsurf, + unsigned clear_flags, + double depth, + unsigned stencil, + unsigned dstx, unsigned dsty, + unsigned width, unsigned height) { struct blitter_context_priv *ctx = (struct blitter_context_priv*)blitter; struct pipe_context *pipe = ctx->pipe; diff --git a/src/gallium/auxiliary/util/u_blitter.h b/src/gallium/auxiliary/util/u_blitter.h index f894fd5a933..10143a5e0f2 100644 --- a/src/gallium/auxiliary/util/u_blitter.h +++ b/src/gallium/auxiliary/util/u_blitter.h @@ -129,11 +129,11 @@ void util_blitter_copy_region(struct blitter_context *blitter, * already required to be saved: * - framebuffer state */ -void util_blitter_clearRT(struct blitter_context *blitter, - struct pipe_surface *dst, - const float *rgba, - unsigned dstx, unsigned dsty, - unsigned width, unsigned height); +void util_blitter_clear_render_target(struct blitter_context *blitter, + struct pipe_surface *dst, + const float *rgba, + unsigned dstx, unsigned dsty, + unsigned width, unsigned height); /** * Clear a region of a depth-stencil surface, both stencil and depth @@ -143,13 +143,13 @@ void util_blitter_clearRT(struct blitter_context *blitter, * already required to be saved: * - framebuffer state */ -void util_blitter_clearDS(struct blitter_context *blitter, - struct pipe_surface *dst, - unsigned clear_flags, - double depth, - unsigned stencil, - unsigned dstx, unsigned dsty, - unsigned width, unsigned height); +void util_blitter_clear_depth_stencil(struct blitter_context *blitter, + struct pipe_surface *dst, + unsigned clear_flags, + double depth, + unsigned stencil, + unsigned dstx, unsigned dsty, + unsigned width, unsigned height); /* The functions below should be used to save currently bound constant state * objects inside a driver. The objects are automatically restored at the end diff --git a/src/gallium/auxiliary/util/u_clear.h b/src/gallium/auxiliary/util/u_clear.h index 07088a7a727..ad69df3f898 100644 --- a/src/gallium/auxiliary/util/u_clear.h +++ b/src/gallium/auxiliary/util/u_clear.h @@ -46,14 +46,14 @@ util_clear(struct pipe_context *pipe, unsigned i; for (i = 0; i < framebuffer->nr_cbufs; i++) { struct pipe_surface *ps = framebuffer->cbufs[i]; - pipe->clearRT(pipe, ps, rgba, 0, 0, ps->width, ps->height); + pipe->clear_render_target(pipe, ps, rgba, 0, 0, ps->width, ps->height); } } if (buffers & PIPE_CLEAR_DEPTHSTENCIL) { struct pipe_surface *ps = framebuffer->zsbuf; - pipe->clearDS(pipe, ps, buffers & PIPE_CLEAR_DEPTHSTENCIL, - depth, stencil, - 0, 0, ps->width, ps->height); + pipe->clear_depth_stencil(pipe, ps, buffers & PIPE_CLEAR_DEPTHSTENCIL, + depth, stencil, + 0, 0, ps->width, ps->height); } } diff --git a/src/gallium/auxiliary/util/u_surface.c b/src/gallium/auxiliary/util/u_surface.c index 1b4eaf2a6e6..9dd1002f5f6 100644 --- a/src/gallium/auxiliary/util/u_surface.c +++ b/src/gallium/auxiliary/util/u_surface.c @@ -196,19 +196,19 @@ util_resource_copy_region(struct pipe_context *pipe, /** - * Fallback for pipe->clearRT() function. + * Fallback for pipe->clear_render_target() function. * XXX this looks too hackish to be really useful. * cpp > 4 looks like a gross hack at best... - * and we're missing the equivalent clearDS fallback. + * and we're missing the equivalent clear_depth_stencil fallback. * Plus can't use these transfer fallbacks when clearing * multisampled surfaces for instance. */ void -util_clearRT(struct pipe_context *pipe, - struct pipe_surface *dst, - const float *rgba, - unsigned dstx, unsigned dsty, - unsigned width, unsigned height) +util_clear_render_target(struct pipe_context *pipe, + struct pipe_surface *dst, + const float *rgba, + unsigned dstx, unsigned dsty, + unsigned width, unsigned height) { struct pipe_transfer *dst_trans; void *dst_map; diff --git a/src/gallium/auxiliary/util/u_surface.h b/src/gallium/auxiliary/util/u_surface.h index b640c793085..d8fb9f1d6f9 100644 --- a/src/gallium/auxiliary/util/u_surface.h +++ b/src/gallium/auxiliary/util/u_surface.h @@ -57,11 +57,11 @@ util_resource_copy_region(struct pipe_context *pipe, unsigned w, unsigned h); extern void -util_clearRT(struct pipe_context *pipe, - struct pipe_surface *dst, - const float *rgba, - unsigned dstx, unsigned dsty, - unsigned width, unsigned height); +util_clear_render_target(struct pipe_context *pipe, + struct pipe_surface *dst, + const float *rgba, + unsigned dstx, unsigned dsty, + unsigned width, unsigned height); diff --git a/src/gallium/docs/source/context.rst b/src/gallium/docs/source/context.rst index 037afb0743a..27d352b7a39 100644 --- a/src/gallium/docs/source/context.rst +++ b/src/gallium/docs/source/context.rst @@ -116,12 +116,12 @@ supports PIPE_CAP_DEPTHSTENCIL_CLEAR_SEPARATE. If a surface includes several layers/slices (XXX: not yet...) then all layers will be cleared. -``clearRT`` clears a single color rendertarget with the specified color -value. While it is only possible to clear one surface at a time (which can +``clear_render_target`` clears a single color rendertarget with the specified +color value. While it is only possible to clear one surface at a time (which can include several layers), this surface need not be bound to the framebuffer. -``clearDS``clears a single depth, stencil or depth/stencil surface with -the specified depth and stencil values (for combined depth/stencil buffers, +``clear_depth_stencil``clears a single depth, stencil or depth/stencil surface +with the specified depth and stencil values (for combined depth/stencil buffers, is is also possible to only clear one or the other part). While it is only possible to clear one surface at a time (which can include several layers), this surface need not be bound to the framebuffer. diff --git a/src/gallium/drivers/failover/fo_context.c b/src/gallium/drivers/failover/fo_context.c index 9f32cbf2967..9c9c1bdc452 100644 --- a/src/gallium/drivers/failover/fo_context.c +++ b/src/gallium/drivers/failover/fo_context.c @@ -146,8 +146,8 @@ struct pipe_context *failover_create( struct pipe_context *hw, failover->pipe.draw_arrays = failover_draw_arrays; failover->pipe.draw_elements = failover_draw_elements; failover->pipe.clear = hw->clear; - failover->pipe.clearRT = hw->clearRT; - failover->pipe.clearDS = hw->clearDS; + failover->pipe.clear_render_target = hw->clear_render_target; + failover->pipe.clear_depth_stencil = hw->clear_depth_stencil; /* No software occlusion fallback (or other optional functionality) * at this point - if the hardware doesn't support it, don't diff --git a/src/gallium/drivers/i915/i915_surface.c b/src/gallium/drivers/i915/i915_surface.c index d9316a1f36f..7869be8f682 100644 --- a/src/gallium/drivers/i915/i915_surface.c +++ b/src/gallium/drivers/i915/i915_surface.c @@ -95,11 +95,11 @@ i915_surface_copy(struct pipe_context *pipe, static void -i915_clearRT(struct pipe_context *pipe, - struct pipe_surface *dst, - const float *rgba, - unsigned dstx, unsigned dsty, - unsigned width, unsigned height) +i915_clear_render_target(struct pipe_context *pipe, + struct pipe_surface *dst, + const float *rgba, + unsigned dstx, unsigned dsty, + unsigned width, unsigned height) { struct i915_texture *tex = i915_texture(dst->texture); struct pipe_resource *pt = &tex->b.b; @@ -120,13 +120,13 @@ i915_clearRT(struct pipe_context *pipe, } static void -i915_clearDS(struct pipe_context *pipe, - struct pipe_surface *dst, - unsigned clear_flags, - double depth, - unsigned stencil, - unsigned dstx, unsigned dsty, - unsigned width, unsigned height) +i915_clear_depth_stencil(struct pipe_context *pipe, + struct pipe_surface *dst, + unsigned clear_flags, + double depth, + unsigned stencil, + unsigned dstx, unsigned dsty, + unsigned width, unsigned height) { struct i915_texture *tex = i915_texture(dst->texture); struct pipe_resource *pt = &tex->b.b; @@ -209,8 +209,8 @@ void i915_init_surface_functions(struct i915_context *i915) { i915->base.resource_copy_region = i915_surface_copy; - i915->base.clearRT = i915_clearRT; - i915->base.clearDS = i915_clearDS; + i915->base.clear_render_target = i915_clear_render_target; + i915->base.clear_depth_stencil = i915_clear_depth_stencil; } /* No good reason for these to be in the screen. diff --git a/src/gallium/drivers/i965/brw_pipe_clear.c b/src/gallium/drivers/i965/brw_pipe_clear.c index b7d8cd5890e..d5cff338a66 100644 --- a/src/gallium/drivers/i965/brw_pipe_clear.c +++ b/src/gallium/drivers/i965/brw_pipe_clear.c @@ -227,11 +227,11 @@ static void brw_clear(struct pipe_context *pipe, } /* XXX should respect region */ -static void brw_clearRT(struct pipe_context *pipe, - struct pipe_surface *dst, - const float *rgba, - unsigned dstx, unsigned dsty, - unsigned width, unsigned height) +static void brw_clear_render_target(struct pipe_context *pipe, + struct pipe_surface *dst, + const float *rgba, + unsigned dstx, unsigned dsty, + unsigned width, unsigned height) { struct brw_context *brw = brw_context( pipe ); @@ -241,13 +241,13 @@ static void brw_clearRT(struct pipe_context *pipe, } /* XXX should respect region */ -static void brw_clearDS(struct pipe_context *pipe, - struct pipe_surface *dst, - unsigned clear_flags, - double depth, - unsigned stencil, - unsigned dstx, unsigned dsty, - unsigned width, unsigned height) +static void brw_clear_depth_stencil(struct pipe_context *pipe, + struct pipe_surface *dst, + unsigned clear_flags, + double depth, + unsigned stencil, + unsigned dstx, unsigned dsty, + unsigned width, unsigned height) { struct brw_context *brw = brw_context( pipe ); @@ -260,8 +260,8 @@ static void brw_clearDS(struct pipe_context *pipe, void brw_pipe_clear_init( struct brw_context *brw ) { brw->base.clear = brw_clear; - brw->base.clearRT = brw_clearRT; - brw->base.clearDS = brw_clearDS; + brw->base.clear_render_target = brw_clear_render_target; + brw->base.clear_depth_stencil = brw_clear_depth_stencil; } diff --git a/src/gallium/drivers/identity/id_context.c b/src/gallium/drivers/identity/id_context.c index 0c3704ceae5..898e0b3af83 100644 --- a/src/gallium/drivers/identity/id_context.c +++ b/src/gallium/drivers/identity/id_context.c @@ -666,48 +666,48 @@ identity_clear(struct pipe_context *_pipe, } static void -identity_clearRT(struct pipe_context *_pipe, - struct pipe_surface *_dst, - const float *rgba, - unsigned dstx, unsigned dsty, - unsigned width, unsigned height) +identity_clear_render_target(struct pipe_context *_pipe, + struct pipe_surface *_dst, + const float *rgba, + unsigned dstx, unsigned dsty, + unsigned width, unsigned height) { struct identity_context *id_pipe = identity_context(_pipe); struct identity_surface *id_surface_dst = identity_surface(_dst); struct pipe_context *pipe = id_pipe->pipe; struct pipe_surface *dst = id_surface_dst->surface; - pipe->clearRT(pipe, - dst, - rgba, - dstx, - dsty, - width, - height); + pipe->clear_render_target(pipe, + dst, + rgba, + dstx, + dsty, + width, + height); } static void -identity_clearDS(struct pipe_context *_pipe, - struct pipe_surface *_dst, - unsigned clear_flags, - double depth, - unsigned stencil, - unsigned dstx, unsigned dsty, - unsigned width, unsigned height) +identity_clear_depth_stencil(struct pipe_context *_pipe, + struct pipe_surface *_dst, + unsigned clear_flags, + double depth, + unsigned stencil, + unsigned dstx, unsigned dsty, + unsigned width, unsigned height) { struct identity_context *id_pipe = identity_context(_pipe); struct identity_surface *id_surface_dst = identity_surface(_dst); struct pipe_context *pipe = id_pipe->pipe; struct pipe_surface *dst = id_surface_dst->surface; - pipe->clearDS(pipe, - dst, - clear_flags, - depth, - stencil, - dstx, - dsty, - width, - height); + pipe->clear_depth_stencil(pipe, + dst, + clear_flags, + depth, + stencil, + dstx, + dsty, + width, + height); } @@ -933,8 +933,8 @@ identity_context_create(struct pipe_screen *_screen, struct pipe_context *pipe) id_pipe->base.set_vertex_buffers = identity_set_vertex_buffers; id_pipe->base.resource_copy_region = identity_resource_copy_region; id_pipe->base.clear = identity_clear; - id_pipe->base.clearRT = identity_clearRT; - id_pipe->base.clearDS = identity_clearDS; + id_pipe->base.clear_render_target = identity_clear_render_target; + id_pipe->base.clear_depth_stencil = identity_clear_depth_stencil; id_pipe->base.flush = identity_flush; id_pipe->base.is_resource_referenced = identity_is_resource_referenced; id_pipe->base.create_sampler_view = identity_context_create_sampler_view; diff --git a/src/gallium/drivers/nv50/nv50_surface.c b/src/gallium/drivers/nv50/nv50_surface.c index 470df1b2a20..5535610e0a2 100644 --- a/src/gallium/drivers/nv50/nv50_surface.c +++ b/src/gallium/drivers/nv50/nv50_surface.c @@ -224,11 +224,11 @@ nv50_surface_copy(struct pipe_context *pipe, /* XXX this should probably look more along the lines of nv50_clear */ static void -nv50_clearRT(struct pipe_context *pipe, - struct pipe_surface *dst, - const float *rgba, - unsigned dstx, unsigned dsty, - unsigned width, unsigned height) +nv50_clear_render_target(struct pipe_context *pipe, + struct pipe_surface *dst, + const float *rgba, + unsigned dstx, unsigned dsty, + unsigned width, unsigned height) { struct nv50_context *nv50 = nv50_context(pipe); struct nv50_screen *screen = nv50->screen; @@ -264,7 +264,7 @@ void nv50_init_surface_functions(struct nv50_context *nv50) { nv50->pipe.resource_copy_region = nv50_surface_copy; - nv50->pipe.clearRT = nv50_clearRT; + nv50->pipe.clear_render_target = nv50_clear_render_target; } diff --git a/src/gallium/drivers/nvfx/nvfx_surface.c b/src/gallium/drivers/nvfx/nvfx_surface.c index c853f36f552..44e1af2e6a2 100644 --- a/src/gallium/drivers/nvfx/nvfx_surface.c +++ b/src/gallium/drivers/nvfx/nvfx_surface.c @@ -56,11 +56,11 @@ nvfx_surface_copy(struct pipe_context *pipe, } static void -nvfx_clearRT(struct pipe_context *pipe, - struct pipe_surface *dst, - const float *rgba, - unsigned dstx, unsigned dsty, - unsigned width, unsigned height) +nvfx_clear_render_target(struct pipe_context *pipe, + struct pipe_surface *dst, + const float *rgba, + unsigned dstx, unsigned dsty, + unsigned width, unsigned height) { struct nvfx_context *nvfx = nvfx_context(pipe); struct nv04_surface_2d *eng2d = nvfx->screen->eng2d; @@ -71,13 +71,13 @@ nvfx_clearRT(struct pipe_context *pipe, } static void -nvfx_clearDS(struct pipe_context *pipe, - struct pipe_surface *dst, - unsigned clear_flags, - double depth, - unsigned stencil, - unsigned dstx, unsigned dsty, - unsigned width, unsigned height) +nvfx_clear_depth_stencil(struct pipe_context *pipe, + struct pipe_surface *dst, + unsigned clear_flags, + double depth, + unsigned stencil, + unsigned dstx, unsigned dsty, + unsigned width, unsigned height) { struct nvfx_context *nvfx = nvfx_context(pipe); struct nv04_surface_2d *eng2d = nvfx->screen->eng2d; @@ -91,6 +91,6 @@ void nvfx_init_surface_functions(struct nvfx_context *nvfx) { nvfx->pipe.resource_copy_region = nvfx_surface_copy; - nvfx->pipe.clearRT = nvfx_clearRT; - nvfx->pipe.clearDS = nvfx_clearDS; + nvfx->pipe.clear_render_target = nvfx_clear_render_target; + nvfx->pipe.clear_depth_stencil = nvfx_clear_depth_stencil; } diff --git a/src/gallium/drivers/r300/r300_blit.c b/src/gallium/drivers/r300/r300_blit.c index 3acd0740f93..49ec51fd132 100644 --- a/src/gallium/drivers/r300/r300_blit.c +++ b/src/gallium/drivers/r300/r300_blit.c @@ -189,43 +189,43 @@ static void r300_resource_copy_region(struct pipe_context *pipe, } /* Clear a region of a color surface to a constant value. */ -static void r300_clearRT(struct pipe_context *pipe, - struct pipe_surface *dst, - const float *rgba, - unsigned dstx, unsigned dsty, - unsigned width, unsigned height) +static void r300_clear_render_target(struct pipe_context *pipe, + struct pipe_surface *dst, + const float *rgba, + unsigned dstx, unsigned dsty, + unsigned width, unsigned height) { struct r300_context *r300 = r300_context(pipe); r300_blitter_save_states(r300); util_blitter_save_framebuffer(r300->blitter, r300->fb_state.state); - util_blitter_clearRT(r300->blitter, dst, rgba, - dstx, dsty, width, height); + util_blitter_clear_render_target(r300->blitter, dst, rgba, + dstx, dsty, width, height); } /* Clear a region of a depth stencil surface. */ -static void r300_clearDS(struct pipe_context *pipe, - struct pipe_surface *dst, - unsigned clear_flags, - double depth, - unsigned stencil, - unsigned dstx, unsigned dsty, - unsigned width, unsigned height) +static void r300_clear_depth_stencil(struct pipe_context *pipe, + struct pipe_surface *dst, + unsigned clear_flags, + double depth, + unsigned stencil, + unsigned dstx, unsigned dsty, + unsigned width, unsigned height) { struct r300_context *r300 = r300_context(pipe); r300_blitter_save_states(r300); util_blitter_save_framebuffer(r300->blitter, r300->fb_state.state); - util_blitter_clearDS(r300->blitter, dst, clear_flags, depth, stencil, - dstx, dsty, width, height); + util_blitter_clear_depth_stencil(r300->blitter, dst, clear_flags, depth, stencil, + dstx, dsty, width, height); } void r300_init_blit_functions(struct r300_context *r300) { r300->context.clear = r300_clear; - r300->context.clearRT = r300_clearRT; - r300->context.clearDS = r300_clearDS; + r300->context.clear_render_target = r300_clear_render_target; + r300->context.clear_depth_stencil = r300_clear_depth_stencil; r300->context.resource_copy_region = r300_resource_copy_region; } diff --git a/src/gallium/drivers/rbug/rbug_context.c b/src/gallium/drivers/rbug/rbug_context.c index b2948311b94..164d811ab48 100644 --- a/src/gallium/drivers/rbug/rbug_context.c +++ b/src/gallium/drivers/rbug/rbug_context.c @@ -817,49 +817,49 @@ rbug_clear(struct pipe_context *_pipe, } static void -rbug_clearRT(struct pipe_context *_pipe, - struct pipe_surface *_dst, - const float *rgba, - unsigned dstx, unsigned dsty, - unsigned width, unsigned height) +rbug_clear_render_target(struct pipe_context *_pipe, + struct pipe_surface *_dst, + const float *rgba, + unsigned dstx, unsigned dsty, + unsigned width, unsigned height) { struct rbug_context *rb_pipe = rbug_context(_pipe); struct rbug_surface *rb_surface_dst = rbug_surface(_dst); struct pipe_context *pipe = rb_pipe->pipe; struct pipe_surface *dst = rb_surface_dst->surface; - pipe->clearRT(pipe, - dst, - rgba, - dstx, - dsty, - width, - height); + pipe->clear_render_target(pipe, + dst, + rgba, + dstx, + dsty, + width, + height); } static void -rbug_clearDS(struct pipe_context *_pipe, - struct pipe_surface *_dst, - unsigned clear_flags, - double depth, - unsigned stencil, - unsigned dstx, unsigned dsty, - unsigned width, unsigned height) +rbug_clear_depth_stencil(struct pipe_context *_pipe, + struct pipe_surface *_dst, + unsigned clear_flags, + double depth, + unsigned stencil, + unsigned dstx, unsigned dsty, + unsigned width, unsigned height) { struct rbug_context *rb_pipe = rbug_context(_pipe); struct rbug_surface *rb_surface_dst = rbug_surface(_dst); struct pipe_context *pipe = rb_pipe->pipe; struct pipe_surface *dst = rb_surface_dst->surface; - pipe->clearDS(pipe, - dst, - clear_flags, - depth, - stencil, - dstx, - dsty, - width, - height); + pipe->clear_depth_stencil(pipe, + dst, + clear_flags, + depth, + stencil, + dstx, + dsty, + width, + height); } static void @@ -1095,8 +1095,8 @@ rbug_context_create(struct pipe_screen *_screen, struct pipe_context *pipe) rb_pipe->base.set_sample_mask = rbug_set_sample_mask; rb_pipe->base.resource_copy_region = rbug_resource_copy_region; rb_pipe->base.clear = rbug_clear; - rb_pipe->base.clearRT = rbug_clearRT; - rb_pipe->base.clearDS = rbug_clearDS; + rb_pipe->base.clear_render_target = rbug_clear_render_target; + rb_pipe->base.clear_depth_stencil = rbug_clear_depth_stencil; rb_pipe->base.flush = rbug_flush; rb_pipe->base.is_resource_referenced = rbug_is_resource_referenced; rb_pipe->base.create_sampler_view = rbug_context_create_sampler_view; diff --git a/src/gallium/drivers/trace/tr_context.c b/src/gallium/drivers/trace/tr_context.c index e8ac33f6e51..7584b8d437b 100644 --- a/src/gallium/drivers/trace/tr_context.c +++ b/src/gallium/drivers/trace/tr_context.c @@ -1109,18 +1109,18 @@ trace_context_clear(struct pipe_context *_pipe, static INLINE void -trace_context_clearRT(struct pipe_context *_pipe, - struct pipe_surface *dst, - const float *rgba, - unsigned dstx, unsigned dsty, - unsigned width, unsigned height) +trace_context_clear_render_target(struct pipe_context *_pipe, + struct pipe_surface *dst, + const float *rgba, + unsigned dstx, unsigned dsty, + unsigned width, unsigned height) { struct trace_context *tr_ctx = trace_context(_pipe); struct pipe_context *pipe = tr_ctx->pipe; dst = trace_surface_unwrap(tr_ctx, dst); - trace_dump_call_begin("pipe_context", "clearRT"); + trace_dump_call_begin("pipe_context", "clear_render_target"); trace_dump_arg(ptr, pipe); trace_dump_arg(ptr, dst); @@ -1130,26 +1130,26 @@ trace_context_clearRT(struct pipe_context *_pipe, trace_dump_arg(uint, width); trace_dump_arg(uint, height); - pipe->clearRT(pipe, dst, rgba, dstx, dsty, width, height); + pipe->clear_render_target(pipe, dst, rgba, dstx, dsty, width, height); trace_dump_call_end(); } static INLINE void -trace_context_clearDS(struct pipe_context *_pipe, - struct pipe_surface *dst, - unsigned clear_flags, - double depth, - unsigned stencil, - unsigned dstx, unsigned dsty, - unsigned width, unsigned height) +trace_context_clear_depth_stencil(struct pipe_context *_pipe, + struct pipe_surface *dst, + unsigned clear_flags, + double depth, + unsigned stencil, + unsigned dstx, unsigned dsty, + unsigned width, unsigned height) { struct trace_context *tr_ctx = trace_context(_pipe); struct pipe_context *pipe = tr_ctx->pipe; dst = trace_surface_unwrap(tr_ctx, dst); - trace_dump_call_begin("pipe_context", "clearDS"); + trace_dump_call_begin("pipe_context", "clear_depth_stencil"); trace_dump_arg(ptr, pipe); trace_dump_arg(ptr, dst); @@ -1161,8 +1161,8 @@ trace_context_clearDS(struct pipe_context *_pipe, trace_dump_arg(uint, width); trace_dump_arg(uint, height); - pipe->clearDS(pipe, dst, clear_flags, depth, stencil, - dstx, dsty, width, height); + pipe->clear_depth_stencil(pipe, dst, clear_flags, depth, stencil, + dstx, dsty, width, height); trace_dump_call_end(); } @@ -1479,8 +1479,8 @@ trace_context_create(struct trace_screen *tr_scr, tr_ctx->base.set_vertex_buffers = trace_context_set_vertex_buffers; tr_ctx->base.resource_copy_region = trace_context_resource_copy_region; tr_ctx->base.clear = trace_context_clear; - tr_ctx->base.clearRT = trace_context_clearRT; - tr_ctx->base.clearDS = trace_context_clearDS; + tr_ctx->base.clear_render_target = trace_context_clear_render_target; + tr_ctx->base.clear_depth_stencil = trace_context_clear_depth_stencil; tr_ctx->base.flush = trace_context_flush; tr_ctx->base.is_resource_referenced = trace_is_resource_referenced; diff --git a/src/gallium/include/pipe/p_context.h b/src/gallium/include/pipe/p_context.h index 51f52406d1d..3e082bef2ff 100644 --- a/src/gallium/include/pipe/p_context.h +++ b/src/gallium/include/pipe/p_context.h @@ -287,11 +287,11 @@ struct pipe_context { * Clear a color rendertarget surface. * \param rgba pointer to an array of one float for each of r, g, b, a. */ - void (*clearRT)(struct pipe_context *pipe, - struct pipe_surface *dst, - const float *rgba, - unsigned dstx, unsigned dsty, - unsigned width, unsigned height); + void (*clear_render_target)(struct pipe_context *pipe, + struct pipe_surface *dst, + const float *rgba, + unsigned dstx, unsigned dsty, + unsigned width, unsigned height); /** * Clear a depth-stencil surface. @@ -299,13 +299,13 @@ struct pipe_context { * \param depth depth clear value in [0,1]. * \param stencil stencil clear value */ - void (*clearDS)(struct pipe_context *pipe, - struct pipe_surface *dst, - unsigned clear_flags, - double depth, - unsigned stencil, - unsigned dstx, unsigned dsty, - unsigned width, unsigned height); + void (*clear_depth_stencil)(struct pipe_context *pipe, + struct pipe_surface *dst, + unsigned clear_flags, + double depth, + unsigned stencil, + unsigned dstx, unsigned dsty, + unsigned width, unsigned height); /** Flush rendering * \param flags bitmask of PIPE_FLUSH_x tokens) diff --git a/src/gallium/state_trackers/python/p_context.i b/src/gallium/state_trackers/python/p_context.i index 6a6da1477cf..0294e769a63 100644 --- a/src/gallium/state_trackers/python/p_context.i +++ b/src/gallium/state_trackers/python/p_context.i @@ -447,10 +447,10 @@ error1: src->texture, subsrc, srcx, srcy, src->zslice, width, height); } - void clearRT(struct st_surface *dst, - float *rgba, - unsigned x, unsigned y, - unsigned width, unsigned height) + void clear_render_target(struct st_surface *dst, + float *rgba, + unsigned x, unsigned y, + unsigned width, unsigned height) { struct pipe_surface *_dst = NULL; @@ -458,18 +458,18 @@ error1: if(!_dst) SWIG_exception(SWIG_ValueError, "couldn't acquire destination surface for writing"); - $self->pipe->clearRT($self->pipe, _dst, rgba, x, y, width, height); + $self->pipe->clear_render_target($self->pipe, _dst, rgba, x, y, width, height); fail: pipe_surface_reference(&_dst, NULL); } - void clearDS(struct st_surface *dst, - unsigned clear_flags, - double depth, - unsigned stencil, - unsigned x, unsigned y, - unsigned width, unsigned height) + void clear_depth_stencil(struct st_surface *dst, + unsigned clear_flags, + double depth, + unsigned stencil, + unsigned x, unsigned y, + unsigned width, unsigned height) { struct pipe_surface *_dst = NULL; @@ -477,8 +477,8 @@ error1: if(!_dst) SWIG_exception(SWIG_ValueError, "couldn't acquire destination surface for writing"); - $self->pipe->clearDS($self->pipe, _dst, clear_flags, depth, stencil, - x, y, width, height); + $self->pipe->clear_depth_stencil($self->pipe, _dst, clear_flags, depth, stencil, + x, y, width, height); fail: pipe_surface_reference(&_dst, NULL); -- cgit v1.2.3 From 2c22b8e61dc4adab658c6198feea30c006aa6c58 Mon Sep 17 00:00:00 2001 From: Zack Rusin Date: Tue, 1 Jun 2010 12:47:23 -0400 Subject: gallium: make draw auto work and add relevant caps and docs --- src/gallium/auxiliary/draw/draw_pt_so_emit.c | 2 ++ src/gallium/auxiliary/draw/draw_vbuf.h | 8 ++++++++ src/gallium/docs/d3d11ddi.txt | 9 +++------ src/gallium/docs/source/context.rst | 17 +++++++++++++++++ src/gallium/drivers/softpipe/sp_prim_vbuf.c | 10 ++++++++++ src/gallium/drivers/softpipe/sp_screen.c | 2 ++ src/gallium/include/pipe/p_defines.h | 1 + 7 files changed, 43 insertions(+), 6 deletions(-) (limited to 'src/gallium/docs') diff --git a/src/gallium/auxiliary/draw/draw_pt_so_emit.c b/src/gallium/auxiliary/draw/draw_pt_so_emit.c index b982e4c529c..8a065a378be 100644 --- a/src/gallium/auxiliary/draw/draw_pt_so_emit.c +++ b/src/gallium/auxiliary/draw/draw_pt_so_emit.c @@ -163,6 +163,8 @@ void draw_pt_so_emit( struct pt_so_emit *emit, stride, ~0); translate->run(translate, 0, vertex_count, draw->instance_id, so_buffer); + + render->set_stream_output_info(render, 0, vertex_count); } diff --git a/src/gallium/auxiliary/draw/draw_vbuf.h b/src/gallium/auxiliary/draw/draw_vbuf.h index 83ae26a9c2b..8d9768246ed 100644 --- a/src/gallium/auxiliary/draw/draw_vbuf.h +++ b/src/gallium/auxiliary/draw/draw_vbuf.h @@ -117,6 +117,14 @@ struct vbuf_render { void (*release_vertices)( struct vbuf_render * ); void (*destroy)( struct vbuf_render * ); + + + /** + * Called after writing data to the stream out buffers + */ + void (*set_stream_output_info)( struct vbuf_render *vbufr, + unsigned buffer_index, + unsigned vertices_count ); }; diff --git a/src/gallium/docs/d3d11ddi.txt b/src/gallium/docs/d3d11ddi.txt index e3368fdbd69..0954c2926df 100644 --- a/src/gallium/docs/d3d11ddi.txt +++ b/src/gallium/docs/d3d11ddi.txt @@ -177,7 +177,7 @@ CreateElementLayout -> create_vertex_elements_state ! D3D11 has an extra flag (InputSlotClass) that is the same as instance_divisor == 0 CreateGeometryShader -> create_gs_state -CreateGeometryShaderWithStreamOutput -> create_gs_state +CreateGeometryShaderWithStreamOutput -> create_gs_state + create_stream_output_state CreatePixelShader -> create_fs_state CreateVertexShader -> create_vs_state > bytecode is different (see D3d10tokenizedprogramformat.hpp) @@ -220,7 +220,6 @@ CreateResource -> texture_create or buffer_create # Note that hardware often has the implicit rule, so the D3D11 interface seems to make little sense # Also, the D3D11 API does not allow the user to specify mipmap sizes, so this really seems a dubious decision on Microsoft's part - D3D11 supports specifying initial data to write in the resource - - Gallium lacks support for stream output buffer usage - Gallium does not support unordered access buffers ! D3D11 specifies mapping flags (i.e. read/write/discard);:it's unclear what they are used for here - D3D11 supports odd things in the D3D10_DDI_RESOURCE_MISC_FLAG enum (D3D10_DDI_RESOURCE_MISC_DISCARD_ON_PRESENT, D3D11_DDI_RESOURCE_MISC_BUFFER_ALLOW_RAW_VIEWS, D3D11_DDI_RESOURCE_MISC_BUFFER_STRUCTURED) @@ -275,8 +274,7 @@ DispatchIndirect (D3D11 only) Draw -> draw_arrays ! D3D11 sets primitive modes separately with IaSetTopology: it's not obvious which is better -DrawAuto - - Gallium lacks stream out and DrawAuto +DrawAuto -> draw_auto DrawIndexed -> draw_elements ! D3D11 sets primitive modes separately with IaSetTopology: it's not obvious which is better @@ -468,8 +466,7 @@ SetViewports ShaderResourceViewReadAfterWriteHazard -> flush(PIPE_FLUSH_RENDER_CACHE) - Gallium does not support specifying this per-render-target/view -SoSetTargets - - Gallium does not support stream out +SoSetTargets -> set_stream_output_buffers VsSetConstantBuffers -> for(i = StartBuffer; i < NumBuffers; ++i) set_constant_buffer(PIPE_SHADER_VERTEX, i, phBuffers[i]) * may want to split into fragment/vertex-specific versions diff --git a/src/gallium/docs/source/context.rst b/src/gallium/docs/source/context.rst index 27d352b7a39..0242dedbf3b 100644 --- a/src/gallium/docs/source/context.rst +++ b/src/gallium/docs/source/context.rst @@ -295,6 +295,23 @@ for a driver to batch multiple blits with the same source and destination. +Stream Output +^^^^^^^^^^^^^ + +Stream output, also known as transform feedback allows writing the results of the +vertex pipeline (after the geometry shader or vertex shader if no geometry shader +is present) to be written to a buffer created with a ``PIPE_BIND_STREAM_OUTPUT`` +flag. + +First a stream output state needs to be created with the +``create_stream_output_state`` call. It specific the details of what's being written, +to which buffer and with what kind of a writemask. + +Then target buffers needs to be set with the call to ``set_stream_output_buffers`` +which sets the buffers and the offsets from the start of those buffer to where +the data will be written to. + + Transfers ^^^^^^^^^ diff --git a/src/gallium/drivers/softpipe/sp_prim_vbuf.c b/src/gallium/drivers/softpipe/sp_prim_vbuf.c index db0d1755103..06691e83953 100644 --- a/src/gallium/drivers/softpipe/sp_prim_vbuf.c +++ b/src/gallium/drivers/softpipe/sp_prim_vbuf.c @@ -542,6 +542,15 @@ sp_vbuf_draw_arrays(struct vbuf_render *vbr, uint start, uint nr) } } +static void +sp_vbuf_so_info(struct vbuf_render *vbr, uint buffer, uint vertices) +{ + struct softpipe_vbuf_render *cvbr = softpipe_vbuf_render(vbr); + struct softpipe_context *softpipe = cvbr->softpipe; + + softpipe->so_target.so_count[buffer] += vertices; +} + static void sp_vbuf_destroy(struct vbuf_render *vbr) @@ -575,6 +584,7 @@ sp_create_vbuf_backend(struct softpipe_context *sp) cvbr->base.draw_elements = sp_vbuf_draw_elements; cvbr->base.draw_arrays = sp_vbuf_draw_arrays; cvbr->base.release_vertices = sp_vbuf_release_vertices; + cvbr->base.set_stream_output_info = sp_vbuf_so_info; cvbr->base.destroy = sp_vbuf_destroy; cvbr->softpipe = sp; diff --git a/src/gallium/drivers/softpipe/sp_screen.c b/src/gallium/drivers/softpipe/sp_screen.c index 8abe7f50e17..fc57d3eb611 100644 --- a/src/gallium/drivers/softpipe/sp_screen.c +++ b/src/gallium/drivers/softpipe/sp_screen.c @@ -115,6 +115,8 @@ softpipe_get_param(struct pipe_screen *screen, enum pipe_cap param) case PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_HALF_INTEGER: case PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_INTEGER: return 1; + case PIPE_CAP_STREAM_OUTPUT: + return 1; case PIPE_CAP_MAX_VS_INSTRUCTIONS: case PIPE_CAP_MAX_FS_INSTRUCTIONS: diff --git a/src/gallium/include/pipe/p_defines.h b/src/gallium/include/pipe/p_defines.h index be42c272221..f47db407dc1 100644 --- a/src/gallium/include/pipe/p_defines.h +++ b/src/gallium/include/pipe/p_defines.h @@ -447,6 +447,7 @@ enum pipe_cap { PIPE_CAP_TGSI_CONT_SUPPORTED, PIPE_CAP_BLEND_EQUATION_SEPARATE, PIPE_CAP_SM3, /*< Shader Model, supported */ + PIPE_CAP_STREAM_OUTPUT, PIPE_CAP_MAX_PREDICATE_REGISTERS, /** Maximum texture image units accessible from vertex and fragment shaders * combined */ -- cgit v1.2.3 From 517a4fb051017caa446730977899c9d36ca18d87 Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Wed, 16 Jun 2010 11:10:46 -0700 Subject: gallium/docs: Fix RST error. --- src/gallium/docs/source/context.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/gallium/docs') diff --git a/src/gallium/docs/source/context.rst b/src/gallium/docs/source/context.rst index 0242dedbf3b..9e3a272993b 100644 --- a/src/gallium/docs/source/context.rst +++ b/src/gallium/docs/source/context.rst @@ -120,7 +120,7 @@ will be cleared. color value. While it is only possible to clear one surface at a time (which can include several layers), this surface need not be bound to the framebuffer. -``clear_depth_stencil``clears a single depth, stencil or depth/stencil surface +``clear_depth_stencil`` clears a single depth, stencil or depth/stencil surface with the specified depth and stencil values (for combined depth/stencil buffers, is is also possible to only clear one or the other part). While it is only possible to clear one surface at a time (which can include several layers), -- cgit v1.2.3 From e7d05f1f0d2b16b316a1a801baba0d237272b094 Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Wed, 16 Jun 2010 16:52:52 -0700 Subject: gallium/docs: Flesh out the distro information. I'm not sure I picked the best voice here. I might come back to this later. --- src/gallium/docs/source/context.rst | 2 ++ src/gallium/docs/source/distro.rst | 54 ++++++++++++++++++++++++++++++------- 2 files changed, 46 insertions(+), 10 deletions(-) (limited to 'src/gallium/docs') diff --git a/src/gallium/docs/source/context.rst b/src/gallium/docs/source/context.rst index 9e3a272993b..4e35a4c4082 100644 --- a/src/gallium/docs/source/context.rst +++ b/src/gallium/docs/source/context.rst @@ -1,3 +1,5 @@ +.. _context: + Context ======= diff --git a/src/gallium/docs/source/distro.rst b/src/gallium/docs/source/distro.rst index 100afe33972..6ba5a056f45 100644 --- a/src/gallium/docs/source/distro.rst +++ b/src/gallium/docs/source/distro.rst @@ -10,69 +10,100 @@ Drivers Cell ^^^^ +Simple driver for the IBM Cell architecture. Runs faster than :ref:`softpipe` +on Cell-based machines. + Failover ^^^^^^^^ -Deprecated. +Broken and deprecated. Intel i915 ^^^^^^^^^^ +Driver for Intel i915 and i945 chipsets. + Intel i965 ^^^^^^^^^^ -Highly experimental. +Highly experimental driver for Intel i965 chipsets. Identity ^^^^^^^^ -Wrapper driver. +Wrapper driver. The identity driver is a simple skeleton that passes through +all of its :ref:`Context` and :ref:`Screen` methods to an underlying Context +and Screen, and as such, it is an excellent starting point for new drivers. LLVM Softpipe ^^^^^^^^^^^^^ -nVidia nv30 -^^^^^^^^^^^ +A version of :ref:`softpipe` that uses the Low-Level Virtual Machine to +dynamically generate optimized rasterizing pipelines. -nVidia nv40 +nVidia nvfx ^^^^^^^^^^^ +Driver for the nVidia nv30 and nv40 families of GPUs. + nVidia nv50 ^^^^^^^^^^^ +Driver for the nVidia nv50 family of GPUs. + VMWare SVGA ^^^^^^^^^^^ +Driver for VMWare virtualized guest operating system graphics processing. + ATI r300 ^^^^^^^^ -Testing-quality. +Driver for the ATI/AMD r300, r400, and r500 families of GPUs. + +.. _softpipe: Softpipe ^^^^^^^^ -Reference software rasterizer. +Reference software rasterizer. Slow but accurate. Trace ^^^^^ -Wrapper driver. +Wrapper driver. Trace dumps an XML record of the calls made to the +:ref:`Context` and :ref:`Screen` objects that it wraps. State Trackers -------------- +.. _dri: + Direct Rendering Infrastructure ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +Tracker that implements the client-side DRI protocol, for providing direct +acceleration services to X11 servers with the DRI extension. Supports DRI1 +and DRI2. Only GL is supported. + +.. _egl: + EGL ^^^ +Tracker for the Khronos EGL standard, used to set up GL and GLES contexts +without extra knowledge of the underlying windowing system. + GLX ^^^ MesaGL ^^^^^^ +Tracker implementing a GL state machine. Not usable as a standalone tracker; +Mesa should be built with another state tracker, such as :ref:`DRI` or +:ref:`EGL`. + Python ^^^^^^ @@ -82,9 +113,12 @@ OpenVG WGL ^^^ -Xorg XFree86 DDX +Xorg/XFree86 DDX ^^^^^^^^^^^^^^^^ +Tracker for XFree86 and Xorg X11 servers. Provides device-dependent +modesetting and acceleration as a DDX driver. + Auxiliary --------- -- cgit v1.2.3 From 92867dcc42089a71031d1d49f574dc64af9387de Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Wed, 16 Jun 2010 16:56:55 -0700 Subject: gallium/docs: R and RG texture swizzles. We *did* reach an agreement on this a few months ago, and now the docs reflect it. However, we never got around to UV and Z... --- src/gallium/docs/source/tgsi.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/gallium/docs') diff --git a/src/gallium/docs/source/tgsi.rst b/src/gallium/docs/source/tgsi.rst index 411dce856a3..03f27cda80e 100644 --- a/src/gallium/docs/source/tgsi.rst +++ b/src/gallium/docs/source/tgsi.rst @@ -1420,9 +1420,9 @@ well. +--------------------+--------------+--------------------+--------------+ | Texture Components | Gallium | OpenGL | Direct3D 9 | +====================+==============+====================+==============+ -| R | XXX TBD | (r, 0, 0, 1) | (r, 1, 1, 1) | +| R | (r, 0, 0, 1) | (r, 0, 0, 1) | (r, 1, 1, 1) | +--------------------+--------------+--------------------+--------------+ -| RG | XXX TBD | (r, g, 0, 1) | (r, g, 1, 1) | +| RG | (r, g, 0, 1) | (r, g, 0, 1) | (r, g, 1, 1) | +--------------------+--------------+--------------------+--------------+ | RGB | (r, g, b, 1) | (r, g, b, 1) | (r, g, b, 1) | +--------------------+--------------+--------------------+--------------+ -- cgit v1.2.3 From 9d4cb6ea36aa0335aa8a6a1e1adc39e40ec5138d Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Wed, 16 Jun 2010 18:34:32 -0700 Subject: gallium/docs: Label opcodes by capability bits. --- src/gallium/docs/source/tgsi.rst | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) (limited to 'src/gallium/docs') diff --git a/src/gallium/docs/source/tgsi.rst b/src/gallium/docs/source/tgsi.rst index 03f27cda80e..706383a0c73 100644 --- a/src/gallium/docs/source/tgsi.rst +++ b/src/gallium/docs/source/tgsi.rst @@ -26,9 +26,11 @@ each of the components of *dst*. When this happens, the result is said to be Instruction Set --------------- -From GL_NV_vertex_program +Core ISA ^^^^^^^^^^^^^^^^^^^^^^^^^ +These opcodes are guaranteed to be available regardless of the driver being +used. .. opcode:: ARL - Address Register Load @@ -637,10 +639,6 @@ This instruction replicates its result. Considered for removal. -From GL_NV_vertex_program2 -^^^^^^^^^^^^^^^^^^^^^^^^^^ - - .. opcode:: ARA - Address Register Add TBD @@ -827,11 +825,14 @@ This instruction replicates its result. Considered for removal. -From GL_NV_gpu_program4 +Compute ISA ^^^^^^^^^^^^^^^^^^^^^^^^ +These opcodes are primarily provided for special-use computational shaders. Support for these opcodes indicated by a special pipe capability bit (TBD). +XXX so let's discuss it, yeah? + .. opcode:: CEIL - Ceiling .. math:: @@ -989,10 +990,17 @@ Support for these opcodes indicated by a special pipe capability bit (TBD). TBD +.. note:: + + Support for CONT is determined by a special capability bit, + ``TGSI_CONT_SUPPORTED``. See :ref:`Screen` for more information. + -From GL_NV_geometry_program4 +Geometry ISA ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +These opcodes are only supported in geometry shaders; they have no meaning +in any other type of shader. .. opcode:: EMIT - Emit @@ -1004,9 +1012,11 @@ From GL_NV_geometry_program4 TBD -From GLSL +GLSL ISA ^^^^^^^^^^ +These opcodes are part of :term:`GLSL`'s opcode set. Support for these +opcodes is determined by a special capability bit, ``GLSL``. .. opcode:: BGNLOOP - Begin a Loop @@ -1045,6 +1055,7 @@ This instruction replicates its result. ps_2_x ^^^^^^^^^^^^ +XXX wait what .. opcode:: CALLNZ - Subroutine Call If Not Zero @@ -1062,7 +1073,7 @@ ps_2_x .. _doubleopcodes: -Double Opcodes +Double ISA ^^^^^^^^^^^^^^^ .. opcode:: DADD - Add Double -- cgit v1.2.3 From dbc95e8edca408346c5a2fae5e584658c5feea76 Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Wed, 16 Jun 2010 18:34:51 -0700 Subject: gallium/docs: Remove unneeded "doubles", add double blurb. --- src/gallium/docs/source/tgsi.rst | 31 ++++++++++++++++++------------- 1 file changed, 18 insertions(+), 13 deletions(-) (limited to 'src/gallium/docs') diff --git a/src/gallium/docs/source/tgsi.rst b/src/gallium/docs/source/tgsi.rst index 706383a0c73..ba844a2d26c 100644 --- a/src/gallium/docs/source/tgsi.rst +++ b/src/gallium/docs/source/tgsi.rst @@ -1076,7 +1076,12 @@ XXX wait what Double ISA ^^^^^^^^^^^^^^^ -.. opcode:: DADD - Add Double +The double-precision opcodes reinterpret four-component vectors into +two-component vectors with doubled precision in each component. + +Support for these opcodes is XXX undecided. :T + +.. opcode:: DADD - Add .. math:: @@ -1085,7 +1090,7 @@ Double ISA dst.zw = src0.zw + src1.zw -.. opcode:: DDIV - Divide Double +.. opcode:: DDIV - Divide .. math:: @@ -1093,7 +1098,7 @@ Double ISA dst.zw = src0.zw / src1.zw -.. opcode:: DSEQ - Set Double on Equal +.. opcode:: DSEQ - Set on Equal .. math:: @@ -1101,7 +1106,7 @@ Double ISA dst.zw = src0.zw == src1.zw ? 1.0F : 0.0F -.. opcode:: DSLT - Set Double on Less than +.. opcode:: DSLT - Set on Less than .. math:: @@ -1109,7 +1114,7 @@ Double ISA dst.zw = src0.zw < src1.zw ? 1.0F : 0.0F -.. opcode:: DFRAC - Double Fraction +.. opcode:: DFRAC - Fraction .. math:: @@ -1118,7 +1123,7 @@ Double ISA dst.zw = src.zw - \lfloor src.zw\rfloor -.. opcode:: DFRACEXP - Convert Double Number to Fractional and Integral Components +.. opcode:: DFRACEXP - Convert Number to Fractional and Integral Components .. math:: @@ -1126,7 +1131,7 @@ Double ISA dst0.zw = frexp(src.zw, dst1.zw) -.. opcode:: DLDEXP - Multiple Double Number by Integral Power of 2 +.. opcode:: DLDEXP - Multiple Number by Integral Power of 2 .. math:: @@ -1134,7 +1139,7 @@ Double ISA dst.zw = ldexp(src0.zw, src1.zw) -.. opcode:: DMIN - Minimum Double +.. opcode:: DMIN - Minimum .. math:: @@ -1142,7 +1147,7 @@ Double ISA dst.zw = min(src0.zw, src1.zw) -.. opcode:: DMAX - Maximum Double +.. opcode:: DMAX - Maximum .. math:: @@ -1150,7 +1155,7 @@ Double ISA dst.zw = max(src0.zw, src1.zw) -.. opcode:: DMUL - Multiply Double +.. opcode:: DMUL - Multiply .. math:: @@ -1159,7 +1164,7 @@ Double ISA dst.zw = src0.zw \times src1.zw -.. opcode:: DMAD - Multiply And Add Doubles +.. opcode:: DMAD - Multiply And Add .. math:: @@ -1168,7 +1173,7 @@ Double ISA dst.zw = src0.zw \times src1.zw + src2.zw -.. opcode:: DRCP - Reciprocal Double +.. opcode:: DRCP - Reciprocal .. math:: @@ -1176,7 +1181,7 @@ Double ISA dst.zw = \frac{1}{src.zw} -.. opcode:: DSQRT - Square root double +.. opcode:: DSQRT - Square Root .. math:: -- cgit v1.2.3 From f98c462770ad26888c4c89f7e0989c2dba48e77d Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Wed, 16 Jun 2010 18:45:50 -0700 Subject: gallium/docs: Explain DFRACEXP/DLDEXP. --- src/gallium/docs/source/tgsi.rst | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) (limited to 'src/gallium/docs') diff --git a/src/gallium/docs/source/tgsi.rst b/src/gallium/docs/source/tgsi.rst index ba844a2d26c..ecab7cb8097 100644 --- a/src/gallium/docs/source/tgsi.rst +++ b/src/gallium/docs/source/tgsi.rst @@ -1125,19 +1125,29 @@ Support for these opcodes is XXX undecided. :T .. opcode:: DFRACEXP - Convert Number to Fractional and Integral Components +Like the ``frexp()`` routine in many math libraries, this opcode stores the +exponent of its source to ``dst0``, and the significand to ``dst1``, such that +:math:`dst1 \times 2^{dst0} = src` . + .. math:: - dst0.xy = frexp(src.xy, dst1.xy) + dst0.xy = exp(src.xy) + + dst1.xy = frac(src.xy) + + dst0.zw = exp(src.zw) + + dst1.zw = frac(src.zw) - dst0.zw = frexp(src.zw, dst1.zw) +.. opcode:: DLDEXP - Multiply Number by Integral Power of 2 -.. opcode:: DLDEXP - Multiple Number by Integral Power of 2 +This opcode is the inverse of :opcode:`DFRACEXP`. .. math:: - dst.xy = ldexp(src0.xy, src1.xy) + dst.xy = src0.xy \times 2^{src1.xy} - dst.zw = ldexp(src0.zw, src1.zw) + dst.zw = src0.zw \times 2^{src1.zw} .. opcode:: DMIN - Minimum -- cgit v1.2.3 From 1e6d51e805baa11eff17ea784c92ffc7933c56c5 Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Wed, 16 Jun 2010 18:57:51 -0700 Subject: gallium/docs: GLSL glossary entry. --- src/gallium/docs/source/glossary.rst | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/gallium/docs') diff --git a/src/gallium/docs/source/glossary.rst b/src/gallium/docs/source/glossary.rst index 0696cb5d277..acde56eafc4 100644 --- a/src/gallium/docs/source/glossary.rst +++ b/src/gallium/docs/source/glossary.rst @@ -21,3 +21,7 @@ Glossary LOD Level of Detail. Also spelled "LoD." The value that determines when the switches between mipmaps occur during texture sampling. + + GLSL + GL Shading Language. The official, common high-level shader language used + in GL 2.0 and above. -- cgit v1.2.3 From 50b3f2e789e6b73673e2cc2469d9b6f29cc47f48 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 23 Jun 2010 17:00:10 -0600 Subject: gallium/docs: fix definitions of TGSI_SEMANTIC_POSITION, COLOR --- src/gallium/docs/source/tgsi.rst | 44 ++++++++++++++++++++++++---------------- 1 file changed, 26 insertions(+), 18 deletions(-) (limited to 'src/gallium/docs') diff --git a/src/gallium/docs/source/tgsi.rst b/src/gallium/docs/source/tgsi.rst index ecab7cb8097..f5678c744b5 100644 --- a/src/gallium/docs/source/tgsi.rst +++ b/src/gallium/docs/source/tgsi.rst @@ -1306,38 +1306,46 @@ Declaration Semantic TGSI_SEMANTIC_POSITION """""""""""""""""""""" -Position, sometimes known as HPOS or WPOS for historical reasons, is the -location of the vertex in space, in ``(x, y, z, w)`` format. ``x``, ``y``, and ``z`` -are the Cartesian coordinates, and ``w`` is the homogenous coordinate and used -for the perspective divide, if enabled. +For vertex shaders, TGSI_SEMANTIC_POSITION indicates the vertex shader +output register which contains the homogeneous vertex position in the clip +space coordinate system. After clipping, the X, Y and Z components of the +vertex will be divided by the W value to get normalized device coordinates. -As a vertex shader output, position should be scaled to the viewport. When -used in fragment shaders, position will be in window coordinates. The convention -used depends on the FS_COORD_ORIGIN and FS_COORD_PIXEL_CENTER properties. +For fragment shaders, TGSI_SEMANTIC_POSITION is used to indicate that +fragment shader input contains the fragment's window position. The X +component starts at zero and always increases from left to right. +The Y component starts at zero and always increases but Y=0 may either +indicate the top of the window or the bottom depending on the fragment +coordinate origin convention (see TGSI_PROPERTY_FS_COORD_ORIGIN). +The Z coordinate ranges from 0 to 1 to represent depth from the front +to the back of the Z buffer. The W component contains the reciprocol +of the interpolated vertex position W component. -XXX additionally, is there a way to configure the perspective divide? it's -accelerated on most chipsets AFAIK... -Position, if not specified, usually defaults to ``(0, 0, 0, 1)``, and can -be partially specified as ``(x, y, 0, 1)`` or ``(x, y, z, 1)``. - -XXX usually? can we solidify that? TGSI_SEMANTIC_COLOR """"""""""""""""""" -Colors are used to, well, color the primitives. Colors are always in -``(r, g, b, a)`` format. +For vertex shader outputs or fragment shader inputs/outputs, this +label indicates that the resister contains an R,G,B,A color. + +Several shader inputs/outputs may contain colors so the semantic index +is used to distinguish them. For example, color[0] may be the diffuse +color while color[1] may be the specular color. + +This label is needed so that the flat/smooth shading can be applied +to the right interpolants during rasterization. + -If alpha is not specified, it defaults to 1. TGSI_SEMANTIC_BCOLOR """""""""""""""""""" Back-facing colors are only used for back-facing polygons, and are only valid in vertex shader outputs. After rasterization, all polygons are front-facing -and COLOR and BCOLOR end up occupying the same slots in the fragment, so -all BCOLORs effectively become regular COLORs in the fragment shader. +and COLOR and BCOLOR end up occupying the same slots in the fragment shader, +so all BCOLORs effectively become regular COLORs in the fragment shader. + TGSI_SEMANTIC_FOG """"""""""""""""" -- cgit v1.2.3 From a544a8a82a74885e0c4bfb3a2c90d1bec07bd01e Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 23 Jun 2010 17:38:42 -0600 Subject: gallium/docs: update TEXTURE_SHADOW_MAP MAX_PREDICATE_REGISTERS --- src/gallium/docs/source/screen.rst | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'src/gallium/docs') diff --git a/src/gallium/docs/source/screen.rst b/src/gallium/docs/source/screen.rst index 48d9d570b6f..e3ef49c862c 100644 --- a/src/gallium/docs/source/screen.rst +++ b/src/gallium/docs/source/screen.rst @@ -36,7 +36,9 @@ The integer capabilities: bound. * ``OCCLUSION_QUERY``: Whether occlusion queries are available. * ``TIMER_QUERY``: Whether timer queries are available. -* ``TEXTURE_SHADOW_MAP``: XXX +* ``TEXTURE_SHADOW_MAP``: indicates whether the fragment shader hardware + can do the depth texture / Z comparison operation in TEX instructions + for shadow testing. * ``MAX_TEXTURE_2D_LEVELS``: The maximum number of mipmap levels available for a 2D texture. * ``MAX_TEXTURE_3D_LEVELS``: The maximum number of mipmap levels available @@ -55,7 +57,13 @@ The integer capabilities: from color blend equations, in :ref:`Blend` state. * ``SM3``: Whether the vertex shader and fragment shader support equivalent opcodes to the Shader Model 3 specification. XXX oh god this is horrible -* ``MAX_PREDICATE_REGISTERS``: XXX +* ``MAX_PREDICATE_REGISTERS``: indicates the number of predicate registers + available. Predicate register may be set as a side-effect of ALU + instructions to indicate less than, greater than or equal to zero. + Later instructions can use a predicate register to control writing to + each channel of destination registers. NOTE: predicate registers have + not been fully implemented in Gallium at this time. See the + GL_NV_fragment_program extension for more info (look for "condition codes"). * ``MAX_COMBINED_SAMPLERS``: The total number of samplers accessible from the vertex and fragment shader, inclusive. * ``MAX_CONST_BUFFERS``: Maximum number of constant buffers that can be bound -- cgit v1.2.3 From 7315300fa5a5e63c16b9e258feb4df76176b5b4b Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 23 Jun 2010 17:38:58 -0600 Subject: gallium/docs: document TGSI_SEMANTIC_EDGEFLAG --- src/gallium/docs/source/tgsi.rst | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src/gallium/docs') diff --git a/src/gallium/docs/source/tgsi.rst b/src/gallium/docs/source/tgsi.rst index f5678c744b5..205e7b8539d 100644 --- a/src/gallium/docs/source/tgsi.rst +++ b/src/gallium/docs/source/tgsi.rst @@ -1397,7 +1397,15 @@ back-facing. TGSI_SEMANTIC_EDGEFLAG """""""""""""""""""""" -XXX no clue +For vertex shaders, this sematic label indicates that an input or +output is a boolean edge flag. The register layout is [F, x, x, x] +where F is 0.0 or 1.0 and x = don't care. Normally, the vertex shader +simply copies the edge flag input to the edgeflag output. + +Edge flags are used to control which lines or points are actually +drawn when the polygon mode converts triangles/quads/polygons into +points or lines. + Properties -- cgit v1.2.3 From 1e10464557308d0fe31c7b30f1be41e1a8c2245c Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Wed, 23 Jun 2010 13:57:30 -0700 Subject: gallium/docs: Slight clarification and formatting for Blend. --- src/gallium/docs/source/cso/blend.rst | 39 ++++++++++++++++++++++++++++------- 1 file changed, 32 insertions(+), 7 deletions(-) (limited to 'src/gallium/docs') diff --git a/src/gallium/docs/source/cso/blend.rst b/src/gallium/docs/source/cso/blend.rst index c74396284cc..a3ccc671982 100644 --- a/src/gallium/docs/source/cso/blend.rst +++ b/src/gallium/docs/source/cso/blend.rst @@ -14,21 +14,46 @@ in other modern and legacy drawing APIs. XXX blurb about dual-source blends +Logical Operations +------------------ + +Logical operations, also known as logicops, lops, or rops, are supported. +Only two-operand logicops are available. When logicops are enabled, all other +blend state is ignored, including per-render-target state, so logicops are +performed on all enabled render targets. + +XXX do lops still apply if blend_enable isn't set? + Members ------- +These members affect all render targets. + +dither +%%%%%% + +Whether dithering is enabled. + +.. note:: + Dithering is completely implementation-dependent. It may be ignored by + drivers for any reason, and some render targets may always or never be + dithered depending on their format or usage flags. + +logicop_enable +%%%%%%%%%%%%%% + +Whether the blender should perform a logicop instead of blending. + +logicop_func +%%%%%%%%%%%% + +The logicop to use. One of ``PIPE_LOGICOP``. + independent_blend_enable If enabled, blend state is different for each render target, and for each render target set in the respective member of the rt array. If disabled, blend state is the same for all render targets, and only the first member of the rt array contains valid data. -logicop_enable - Enables logic ops. Cannot be enabled at the same time as blending, and - is always the same for all render targets. -logicop_func - The logic operation to use if logic ops are enabled. One of PIPE_LOGICOP. -dither - Whether dithering is enabled. Note: Dithering is implementation-dependent. rt Contains the per-rendertarget blend state. -- cgit v1.2.3 From 06a75bd8730fea6cb04b2e6b1754704fc196f050 Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Wed, 23 Jun 2010 14:25:26 -0700 Subject: gallium/docs: Add lop table. Was feeling kind of weird without it. --- src/gallium/docs/source/cso/blend.rst | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'src/gallium/docs') diff --git a/src/gallium/docs/source/cso/blend.rst b/src/gallium/docs/source/cso/blend.rst index a3ccc671982..d97e3d32e92 100644 --- a/src/gallium/docs/source/cso/blend.rst +++ b/src/gallium/docs/source/cso/blend.rst @@ -24,6 +24,32 @@ performed on all enabled render targets. XXX do lops still apply if blend_enable isn't set? +For a source component `s` and destination component `d`, the logical +operations are defined as taking the bits of each channel of each component, +and performing one of the following operations per-channel: + +* ``CLEAR``: 0 +* ``NOR``: :math:`\lnot(s \lor d)` +* ``AND_INVERTED``: :math:`\lnot s \land d` +* ``COPY_INVERTED``: :math:`\lnot s` +* ``AND_REVERSE``: :math:`s \land \lnot d` +* ``INVERT``: :math:`\lnot d` +* ``XOR``: :math:`s \oplus d` +* ``NAND``: :math:`\lnot(s \land d)` +* ``AND``: :math:`s \land d` +* ``EQUIV``: :math:`\lnot(s \oplus d)` +* ``NOOP``: :math:`d` +* ``OR_INVERTED``: :math:`\lnot s \lor d` +* ``COPY``: :math:`s` +* ``OR_REVERSE``: :math:`s \lor \lnot d` +* ``OR``: :math:`s \lor d` +* ``SET``: 1 + +.. note:: + The logical operation names and definitions match those of the OpenGL API, + and are similar to the ROP2 and ROP3 definitions of GDI. This is + intentional, to ease transitions to Gallium. + Members ------- -- cgit v1.2.3 From 05a18f48e573ba0f2657f52d32ff868ef828ec8f Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 24 Jun 2010 07:21:15 -0600 Subject: gallium/docs: updated remaining semantic label docs --- src/gallium/docs/source/tgsi.rst | 55 ++++++++++++++++++++++++---------------- 1 file changed, 33 insertions(+), 22 deletions(-) (limited to 'src/gallium/docs') diff --git a/src/gallium/docs/source/tgsi.rst b/src/gallium/docs/source/tgsi.rst index 205e7b8539d..e588c5b7bd8 100644 --- a/src/gallium/docs/source/tgsi.rst +++ b/src/gallium/docs/source/tgsi.rst @@ -1286,6 +1286,8 @@ wrapping rules. Declaration Semantic ^^^^^^^^^^^^^^^^^^^^^^^^ + Vertex and fragment shader input and output registers may be labeled + with semantic information consisting of a name and index. Follows Declaration token if Semantic bit is set. @@ -1321,6 +1323,10 @@ The Z coordinate ranges from 0 to 1 to represent depth from the front to the back of the Z buffer. The W component contains the reciprocol of the interpolated vertex position W component. +Fragment shaders may also declare an output register with +TGSI_SEMANTIC_POSITION. Only the Z component is writable. This allows +the fragment shader to change the fragment's Z position. + TGSI_SEMANTIC_COLOR @@ -1350,49 +1356,54 @@ so all BCOLORs effectively become regular COLORs in the fragment shader. TGSI_SEMANTIC_FOG """"""""""""""""" -The fog coordinate historically has been used to replace the depth coordinate -for generation of fog in dedicated fog blocks. Gallium, however, does not use -dedicated fog acceleration, placing it entirely in the fragment shader -instead. +Vertex shader inputs and outputs and fragment shader inputs may be +labeled with TGSI_SEMANTIC_FOG to indicate that the register contains +a fog coordinate in the form (F, 0, 0, 1). Typically, the fragment +shader will use the fog coordinate to compute a fog blend factor which +is used to blend the normal fragment color with a constant fog color. + +Only the first component matters when writing from the vertex shader; +the driver will ensure that the coordinate is in this format when used +as a fragment shader input. -The fog coordinate should be written in ``(f, 0, 0, 1)`` format. Only the first -component matters when writing from the vertex shader; the driver will ensure -that the coordinate is in this format when used as a fragment shader input. TGSI_SEMANTIC_PSIZE """"""""""""""""""" -PSIZE, or point size, is used to specify point sizes per-vertex. It should -be in ``(s, 0, 0, 1)`` format, where ``s`` is the (possibly clamped) point size. -Only the first component matters when writing from the vertex shader. +Vertex shader input and output registers may be labeled with +TGIS_SEMANTIC_PSIZE to indicate that the register contains a point size +in the form (S, 0, 0, 1). The point size controls the width or diameter +of points for rasterization. This label cannot be used in fragment +shaders. When using this semantic, be sure to set the appropriate state in the :ref:`rasterizer` first. + TGSI_SEMANTIC_GENERIC """"""""""""""""""""" -Generic semantics are nearly always used for texture coordinate attributes, -in ``(s, t, r, q)`` format. ``t`` and ``r`` may be unused for certain kinds -of lookups, and ``q`` is the level-of-detail bias for biased sampling. +All vertex/fragment shader inputs/outputs not labeled with any other +semantic label can be considered to be generic attributes. Typical +uses of generic inputs/outputs are texcoords and user-defined values. -These attributes are called "generic" because they may be used for anything -else, including parameters, texture generation information, or anything that -can be stored inside a four-component vector. TGSI_SEMANTIC_NORMAL """""""""""""""""""" -Vertex normal; could be used to implement per-pixel lighting for legacy APIs -that allow mixing fixed-function and programmable stages. +Indicates that a vertex shader input is a normal vector. This is +typically only used for legacy graphics APIs. + TGSI_SEMANTIC_FACE """""""""""""""""" -FACE is the facing bit, to store the facing information for the fragment -shader. ``(f, 0, 0, 1)`` is the format. The first component will be positive -when the fragment is front-facing, and negative when the component is -back-facing. +This label applies to fragment shader inputs only and indicates that +the register contains front/back-face information of the form (F, 0, +0, 1). The first component will be positive when the fragment belongs +to a front-facing polygon, and negative when the fragment belongs to a +back-facing polygon. + TGSI_SEMANTIC_EDGEFLAG """""""""""""""""""""" -- cgit v1.2.3 From 49735d1c6c6d8dbb41eba0495be0c657b6714fe8 Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Thu, 24 Jun 2010 07:13:10 -0700 Subject: gallium/docs: Lops override the rest of the blending state when enabled. --- src/gallium/docs/source/cso/blend.rst | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/gallium/docs') diff --git a/src/gallium/docs/source/cso/blend.rst b/src/gallium/docs/source/cso/blend.rst index d97e3d32e92..7bde10c1245 100644 --- a/src/gallium/docs/source/cso/blend.rst +++ b/src/gallium/docs/source/cso/blend.rst @@ -20,9 +20,11 @@ Logical Operations Logical operations, also known as logicops, lops, or rops, are supported. Only two-operand logicops are available. When logicops are enabled, all other blend state is ignored, including per-render-target state, so logicops are -performed on all enabled render targets. +performed on all render targets. -XXX do lops still apply if blend_enable isn't set? +.. warning:: + The blend_enable flag is ignored for all render targets when logical + operations are enabled. For a source component `s` and destination component `d`, the logical operations are defined as taking the bits of each channel of each component, -- cgit v1.2.3 From 474dc40fb4a99ff0f8d86538407cd90b7ee3bb14 Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Thu, 24 Jun 2010 07:54:00 -0700 Subject: gallium/docs: Vertex data formats. I'm not sure if I really got it right. This seems like one of those "Duh, of course it works that way" things, but I'd like the documentation to be readable by people not acquainted with OGL/D3D. --- src/gallium/docs/source/cso/velems.rst | 41 +++++++++++++++++++++++++++++++--- 1 file changed, 38 insertions(+), 3 deletions(-) (limited to 'src/gallium/docs') diff --git a/src/gallium/docs/source/cso/velems.rst b/src/gallium/docs/source/cso/velems.rst index 92cde014fb8..978ad4a2434 100644 --- a/src/gallium/docs/source/cso/velems.rst +++ b/src/gallium/docs/source/cso/velems.rst @@ -3,9 +3,44 @@ Vertex Elements =============== -This state controls format etc. of the input attributes contained -in the pipe_vertex_buffer(s). There's one pipe_vertex_element array member -for each input attribute. +This state controls the format of the input attributes contained in +pipe_vertex_buffers. There is one pipe_vertex_element array member for each +input attribute. + +Input Formats +------------- + +Gallium supports a diverse range of formats for vertex data. Drivers are +guaranteed to support 32-bit floating-point vectors of one to four components. +Additionally, they may support the following formats: + +* Integers, signed or unsigned, normalized or non-normalized, 8, 16, or 32 + bits wide +* Floating-point, 16, 32, or 64 bits wide + +At this time, support for varied vertex data formats is limited by driver +deficiencies. It is planned to support a single uniform set of formats for all +Gallium drivers at some point. + +Rather than attempt to specify every small nuance of behavior, Gallium uses a +very simple set of rules for padding out unspecified components. If an input +uses less than four components, it will be padded out with the constant vector +``(0, 0, 0, 1)``. + +Fog, point size, the facing bit, and edgeflags, all are in the standard format +of ``(x, 0, 0, 1)``, and so only the first component of those inputs is used. + +Position +%%%%%%%% + +Vertex position may be specified with two to four components. Using less than +two components is not allowed. + +Colors +%%%%%% + +Colors, both front- and back-facing, may omit the alpha component, only using +three components. Using less than three components is not allowed. Members ------- -- cgit v1.2.3 From 0a663bb4dbfd8389fd659184cfa4007b268fb140 Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Tue, 27 Jul 2010 16:34:57 -0700 Subject: gallium/docs: Fix VMware spelling. --- src/gallium/docs/source/distro.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/gallium/docs') diff --git a/src/gallium/docs/source/distro.rst b/src/gallium/docs/source/distro.rst index 6ba5a056f45..e379ad32719 100644 --- a/src/gallium/docs/source/distro.rst +++ b/src/gallium/docs/source/distro.rst @@ -51,10 +51,10 @@ nVidia nv50 Driver for the nVidia nv50 family of GPUs. -VMWare SVGA +VMware SVGA ^^^^^^^^^^^ -Driver for VMWare virtualized guest operating system graphics processing. +Driver for VMware virtualized guest operating system graphics processing. ATI r300 ^^^^^^^^ -- cgit v1.2.3 From 8bae190f18dfa91cd60d91d91169503c3addb11f Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Wed, 28 Jul 2010 01:09:40 -0700 Subject: gallium/docs: Fix VMware spelling. --- src/gallium/docs/source/conf.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/gallium/docs') diff --git a/src/gallium/docs/source/conf.py b/src/gallium/docs/source/conf.py index ccc84405c41..99e665234eb 100644 --- a/src/gallium/docs/source/conf.py +++ b/src/gallium/docs/source/conf.py @@ -38,7 +38,7 @@ master_doc = 'index' # General information about the project. project = u'Gallium' -copyright = u'2009, VMWare, X.org, Nouveau' +copyright = u'2009, VMware, X.org, Nouveau' # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the @@ -176,7 +176,7 @@ htmlhelp_basename = 'Galliumdoc' # (source start file, target name, title, author, documentclass [howto/manual]). latex_documents = [ ('index', 'Gallium.tex', u'Gallium Documentation', - u'VMWare, X.org, Nouveau', 'manual'), + u'VMware, X.org, Nouveau', 'manual'), ] # The name of an image file (relative to this directory) to place at the top of -- cgit v1.2.3 From e7f69c459af3274b9d1435c06a15b14eb40e4cc5 Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Sat, 17 Jul 2010 22:00:04 +0800 Subject: gallium/docs: Document draw_vbo and set_index_buffer. Document the new unified drawing method and remove references to old ones. --- src/gallium/docs/d3d11ddi.txt | 30 ++++++++------------ src/gallium/docs/source/context.rst | 55 +++++++++++-------------------------- 2 files changed, 27 insertions(+), 58 deletions(-) (limited to 'src/gallium/docs') diff --git a/src/gallium/docs/d3d11ddi.txt b/src/gallium/docs/d3d11ddi.txt index 0954c2926df..f8155c828b1 100644 --- a/src/gallium/docs/d3d11ddi.txt +++ b/src/gallium/docs/d3d11ddi.txt @@ -66,9 +66,6 @@ Unordered access view: view supporting random read/write access (usually from co clear + Gallium supports clearing both render targets and depth/stencil with a single call -draw_range_elements - + Gallium supports indexed draw with explicit range - fence_signalled fence_finish + D3D10/D3D11 don't appear to support explicit fencing; queries can often substitute though, and flushing is supported @@ -271,31 +268,27 @@ Dispatch (D3D11 only) DispatchIndirect (D3D11 only) - Gallium does not support compute shaders -Draw -> draw_arrays +Draw -> draw_vbo ! D3D11 sets primitive modes separately with IaSetTopology: it's not obvious which is better DrawAuto -> draw_auto -DrawIndexed -> draw_elements +DrawIndexed -> draw_vbo ! D3D11 sets primitive modes separately with IaSetTopology: it's not obvious which is better - * may want to add a separate set_index_buffer - - Gallium lacks base vertex for indexed draw calls - + D3D11 lacks draw_range_elements functionality, which is required for OpenGL + + D3D11 lacks explicit range, which is required for OpenGL -DrawIndexedInstanced -> draw_elements_instanced +DrawIndexedInstanced -> draw_vbo ! D3D11 sets primitive modes separately with IaSetTopology: it's not obvious which is better - * may want to add a separate set_index_buffer - - Gallium lacks base vertex for indexed draw calls -DrawIndexedInstancedIndirect (D3D11 only) -> call draw_elements_instanced multiple times in software - # this allows to use an hardware buffer to specify the parameters for multiple draw_elements_instanced calls +DrawIndexedInstancedIndirect (D3D11 only) + # this allows to use an hardware buffer to specify the parameters for multiple draw_vbo calls - Gallium does not support draw call parameter buffers and indirect draw -DrawInstanced -> draw_arrays_instanced +DrawInstanced -> draw_vbo ! D3D11 sets primitive modes separately with IaSetTopology: it's not obvious which is better -DrawInstancedIndirect (D3D11 only) -> call draw_arrays_instanced multiple times in software - # this allows to use an hardware buffer to specify the parameters for multiple draw_arrays_instanced calls +DrawInstancedIndirect (D3D11 only) + # this allows to use an hardware buffer to specify the parameters for multiple draw_vbo calls - Gallium does not support draw call parameter buffers and indirect draws DsSetConstantBuffers (D3D11 only) @@ -332,10 +325,9 @@ HsSetShaderResources (D3D11 only) HsSetShaderWithIfaces (D3D11 only) - Gallium does not support hull shaders -IaSetIndexBuffer - ! Gallium passes this to the draw_elements or draw_elements_instanced calls +IaSetIndexBuffer -> set_index_buffer + Gallium supports 8-bit indices - ! the D3D11 interface allows index-size-unaligned byte offsets into index buffers; it's not clear whether they actually work + # the D3D11 interface allows index-size-unaligned byte offsets into the index buffer; most drivers will abort with an assertion IaSetInputLayout -> bind_vertex_elements_state diff --git a/src/gallium/docs/source/context.rst b/src/gallium/docs/source/context.rst index 4e35a4c4082..f241411a002 100644 --- a/src/gallium/docs/source/context.rst +++ b/src/gallium/docs/source/context.rst @@ -45,6 +45,7 @@ buffers, surfaces) are bound to the driver. * ``set_vertex_buffers`` +* ``set_index_buffer`` Non-CSO State ^^^^^^^^^^^^^ @@ -132,50 +133,26 @@ this surface need not be bound to the framebuffer. Drawing ^^^^^^^ -``draw_arrays`` draws a specified primitive. +``draw_vbo`` draws a specified primitive. The primitive mode and other +properties are described by ``pipe_draw_info``. -This command is equivalent to calling ``draw_arrays_instanced`` -with ``startInstance`` set to 0 and ``instanceCount`` set to 1. +The ``mode``, ``start``, and ``count`` fields of ``pipe_draw_info`` specify the +the mode of the primitive and the vertices to be fetched, in the range between +``start`` to ``start``+``count``-1, inclusive. -``draw_elements`` draws a specified primitive using an optional -index buffer. +Every instance with instanceID in the range between ``start_instance`` and +``start_instance``+``instance_count``-1, inclusive, will be drawn. -This command is equivalent to calling ``draw_elements_instanced`` -with ``startInstance`` set to 0 and ``instanceCount`` set to 1. +All vertex indices must fall inside the range given by ``min_index`` and +``max_index``. In case non-indexed draw, ``min_index`` should be set to +``start`` and ``max_index`` should be set to ``start``+``count``-1. -``draw_range_elements`` +``index_bias`` is a value added to every vertex index before fetching vertex +attributes. It does not affect ``min_index`` and ``max_index``. -XXX: this is (probably) a temporary entrypoint, as the range -information should be available from the vertex_buffer state. -Using this to quickly evaluate a specialized path in the draw -module. - -``draw_arrays_instanced`` draws multiple instances of the same primitive. - -This command is equivalent to calling ``draw_elements_instanced`` -with ``indexBuffer`` set to NULL and ``indexSize`` set to 0. - -``draw_elements_instanced`` draws multiple instances of the same primitive -using an optional index buffer. - -For instanceID in the range between ``startInstance`` -and ``startInstance``+``instanceCount``-1, inclusive, draw a primitive -specified by ``mode`` and sequential numbers in the range between ``start`` -and ``start``+``count``-1, inclusive. - -If ``indexBuffer`` is not NULL, it specifies an index buffer with index -byte size of ``indexSize``. The sequential numbers are used to lookup -the index buffer and the resulting indices in turn are used to fetch -vertex attributes. - -If ``indexBuffer`` is NULL, the sequential numbers are used directly -as indices to fetch vertex attributes. - -``indexBias`` is a value which is added to every index read from the index -buffer before fetching vertex attributes. - -``minIndex`` and ``maxIndex`` describe minimum and maximum index contained in -the index buffer. +If there is an index buffer bound, and ``indexed`` field is true, all vertex +indices will be looked up in the index buffer. ``min_index``, ``max_index``, +and ``index_bias`` apply after index lookup. If a given vertex element has ``instance_divisor`` set to 0, it is said it contains per-vertex data and effective vertex attribute address needs -- cgit v1.2.3 From ccbd9ae7cc5b3fcda23fe79573e70b4fc40f3939 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Thu, 5 Aug 2010 10:58:02 +0100 Subject: docs: clarify point sprite discussion Plagiarizes email explanation from Roland. --- src/gallium/docs/source/cso/rasterizer.rst | 39 ++++++++++++++++++------------ 1 file changed, 23 insertions(+), 16 deletions(-) (limited to 'src/gallium/docs') diff --git a/src/gallium/docs/source/cso/rasterizer.rst b/src/gallium/docs/source/cso/rasterizer.rst index ad1612f93e3..ee3419ccfca 100644 --- a/src/gallium/docs/source/cso/rasterizer.rst +++ b/src/gallium/docs/source/cso/rasterizer.rst @@ -126,11 +126,15 @@ sprite_coord_enable Specifies if a texture unit has its texture coordinates replaced or not. This is a packed bitfield containing the enable for all texcoords -- if all bits -are zero, point sprites are effectively disabled. If any bit is set, then -point_smooth and point_quad_rasterization are ignored; point smoothing is -disabled and points are always rasterized as quads. If enabled, the four -vertices of the resulting quad will be assigned texture coordinates, -according to sprite_coord_mode. +are zero, point sprites are effectively disabled. + +If any bit is set, then point_smooth MUST be disabled (there are no +round sprites) and point_quad_rasterization MUST be true (sprites are +always rasterized as quads). Any mismatch between these states should +be considered a bug in the state-tracker. + +If enabled, the four vertices of the resulting quad will be assigned +texture coordinates, according to sprite_coord_mode. sprite_coord_mode ^^^^^^^^^^^^^^^^^ @@ -141,20 +145,23 @@ have coordinates (0,0,0,1). For PIPE_SPRITE_COORD_UPPER_LEFT, the upper-left vertex will have coordinates (0,0,0,1). This state is used by :ref:`Draw` to generate texcoords. -.. note:: - - When geometry shaders are available, a special geometry shader could be - used instead of this functionality, to convert incoming points into quads - with the proper texture coordinates. - point_quad_rasterization ^^^^^^^^^^^^^^^^^^^^^^^^ -Determines if points should be rasterized as quads or points. Certain APIs, -like Direct3D, always use quad rasterization for points, regardless of -whether point sprites are enabled or not. If this state is enabled, point -smoothing and antialiasing are disabled. If it is disabled, point sprite -coordinates are not generated. +Determines if points should be rasterized according to quad or point +rasterization rules. + +OpenGL actually has quite different rasterization rules for points and +point sprites - hence this indicates if points should be rasterized as +points or according to point sprite (which decomposes them into quads, +basically) rules. + +Additionally Direct3D will always use quad rasterization rules for +points, regardless of whether point sprites are enabled or not. + +If this state is enabled, point smoothing and antialiasing are +disabled. If it is disabled, point sprite coordinates are not +generated. .. note:: -- cgit v1.2.3 From d62b29f567f7dd41d7abf3c931065ea54e90f48b Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Sun, 15 Aug 2010 00:59:57 +0100 Subject: gallium/docs: Add a debugging section --- src/gallium/docs/source/debugging.rst | 96 +++++++++++++++++++++++++++++++++++ src/gallium/docs/source/index.rst | 1 + 2 files changed, 97 insertions(+) create mode 100644 src/gallium/docs/source/debugging.rst (limited to 'src/gallium/docs') diff --git a/src/gallium/docs/source/debugging.rst b/src/gallium/docs/source/debugging.rst new file mode 100644 index 00000000000..74f51bc0ea7 --- /dev/null +++ b/src/gallium/docs/source/debugging.rst @@ -0,0 +1,96 @@ +Debugging +========= + +Debugging utilities in gallium. + +Debug Variables +^^^^^^^^^^^^^^^ + +All drivers respond to a couple of debug enviromental variables. Below is +a collection of them. Set them as you would any normal enviromental variable +for the platform/operating system you are running. For linux this can be +done by typing "export var=value" into a console and then running the +program from that console. + +Common +"""""" + +GALLIUM_PRINT_OPTIONS (false) + +This options controls if the debug variables should be printed to stderr. +This is probably the most usefull variable since it allows you to find +which variables a driver responds to. + +GALLIUM_RBUG (false) + +Controls if the :ref:`rbug` should be used. + +GALLIUM_TRACE ("") + +If not set tracing is not used, if set it will write the output to the file +specifed by the variable. So setting it to "trace.xml" will write the output +to the file "trace.xml". + +GALLIUM_DUMP_CPU (false) + +Dump information about the current cpu that the driver is running on. + +TGSI_PRINT_SANITY (false) + +Gallium has a inbuilt shader sanity checker, this option controls if results +from it should be printed. This include warnings such as unused variables. + +DRAW_USE_LLVM (false) + +Should the :ref:`draw` module use llvm for vertex and geometry shaders. + +ST_DEBUG (0x0) + +Debug :ref:`flags` for the GL state tracker. + + +Driver specific +""""""""""""""" + +I915_DEBUG (0x0) + +Debug :ref:`flags` for the i915 driver. + +I915_NO_HW (false) + +Stop the i915 driver from submitting commands to the hardware. + +I915_DUMP_CMD (false) + +Dump all commands going to the hardware. + +LP_DEBUG (0x0) + +Debug :ref:`flags` for the llvmpipe driver. + +LP_NUM_THREADS (num cpus) + +Number of threads that the llvmpipe driver should use. + + +.. _flags: + +Flags +""""" + +The variables of type all take a string with comma seperated +flags to enable different debugging for different parts of the drivers +or state tracker. If set to "help" the driver will print a list of flags +to which the variable can be set to. Order does not matter. + + +.. _rbug: + +Remote Debugger +^^^^^^^^^^^^^^^ + +Or rbug for short allows for runtime inspections of :ref:`Context`, +:ref:`Screen`, Resources and Shaders; pauseing and stepping of draw calls; +and runtime disable and replacement of shaders. Is used with rbug-gui which +is hosted outside of the main mesa repositor. Rbug is can be used over a +network connection so the debbuger does not need to be on the same machine. diff --git a/src/gallium/docs/source/index.rst b/src/gallium/docs/source/index.rst index 54bc883fced..6c19842dac4 100644 --- a/src/gallium/docs/source/index.rst +++ b/src/gallium/docs/source/index.rst @@ -12,6 +12,7 @@ Contents: :maxdepth: 2 intro + debugging tgsi screen context -- cgit v1.2.3 From fe19935a127916ab2f1957c48ad1da652935928f Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Sun, 15 Aug 2010 00:57:18 +0100 Subject: gallium/docs: Add rbug to distribution --- src/gallium/docs/source/distro.rst | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/gallium/docs') diff --git a/src/gallium/docs/source/distro.rst b/src/gallium/docs/source/distro.rst index e379ad32719..70d75b51e65 100644 --- a/src/gallium/docs/source/distro.rst +++ b/src/gallium/docs/source/distro.rst @@ -74,6 +74,11 @@ Trace Wrapper driver. Trace dumps an XML record of the calls made to the :ref:`Context` and :ref:`Screen` objects that it wraps. +Rbug +^^^^ + +Wrapper driver. :ref:`rbug` driver used with stand alone rbug-gui. + State Trackers -------------- -- cgit v1.2.3 From bf357aedffd659e43ef9ceefa875c08991a5f46d Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Sun, 15 Aug 2010 03:05:18 -0700 Subject: gallium/docs: Add formatting for envvar role; change debugging. Per Jakob's request. Not super-pretty, but it's a good point for modding later. --- src/gallium/docs/source/conf.py | 2 +- src/gallium/docs/source/debugging.rst | 24 +++++++++++------------ src/gallium/docs/source/exts/formatting.py | 31 ++++++++++++++++++++++++++++++ src/gallium/docs/source/exts/tgsi.py | 17 ---------------- 4 files changed, 44 insertions(+), 30 deletions(-) create mode 100644 src/gallium/docs/source/exts/formatting.py delete mode 100644 src/gallium/docs/source/exts/tgsi.py (limited to 'src/gallium/docs') diff --git a/src/gallium/docs/source/conf.py b/src/gallium/docs/source/conf.py index 99e665234eb..0846e7d0ece 100644 --- a/src/gallium/docs/source/conf.py +++ b/src/gallium/docs/source/conf.py @@ -22,7 +22,7 @@ sys.path.append(os.path.abspath('exts')) # Add any Sphinx extension module names here, as strings. They can be extensions # coming with Sphinx (named 'sphinx.ext.*') or your custom ones. -extensions = ['sphinx.ext.pngmath', 'tgsi'] +extensions = ['sphinx.ext.pngmath', 'formatting'] # Add any paths that contain templates here, relative to this directory. templates_path = ['_templates'] diff --git a/src/gallium/docs/source/debugging.rst b/src/gallium/docs/source/debugging.rst index 74f51bc0ea7..f29bf53dfec 100644 --- a/src/gallium/docs/source/debugging.rst +++ b/src/gallium/docs/source/debugging.rst @@ -15,36 +15,36 @@ program from that console. Common """""" -GALLIUM_PRINT_OPTIONS (false) +.. envvar:: GALLIUM_PRINT_OPTIONS (false) This options controls if the debug variables should be printed to stderr. This is probably the most usefull variable since it allows you to find which variables a driver responds to. -GALLIUM_RBUG (false) +.. envvar:: GALLIUM_RBUG (false) Controls if the :ref:`rbug` should be used. -GALLIUM_TRACE ("") +.. envvar:: GALLIUM_TRACE ("") If not set tracing is not used, if set it will write the output to the file specifed by the variable. So setting it to "trace.xml" will write the output to the file "trace.xml". -GALLIUM_DUMP_CPU (false) +.. envvar:: GALLIUM_DUMP_CPU (false) Dump information about the current cpu that the driver is running on. -TGSI_PRINT_SANITY (false) +.. envvar:: TGSI_PRINT_SANITY (false) Gallium has a inbuilt shader sanity checker, this option controls if results from it should be printed. This include warnings such as unused variables. -DRAW_USE_LLVM (false) +.. envvar:: DRAW_USE_LLVM (false) Should the :ref:`draw` module use llvm for vertex and geometry shaders. -ST_DEBUG (0x0) +.. envvar:: ST_DEBUG (0x0) Debug :ref:`flags` for the GL state tracker. @@ -52,23 +52,23 @@ Debug :ref:`flags` for the GL state tracker. Driver specific """"""""""""""" -I915_DEBUG (0x0) +.. envvar:: I915_DEBUG (0x0) Debug :ref:`flags` for the i915 driver. -I915_NO_HW (false) +.. envvar:: I915_NO_HW (false) Stop the i915 driver from submitting commands to the hardware. -I915_DUMP_CMD (false) +.. envvar:: I915_DUMP_CMD (false) Dump all commands going to the hardware. -LP_DEBUG (0x0) +.. envvar:: LP_DEBUG (0x0) Debug :ref:`flags` for the llvmpipe driver. -LP_NUM_THREADS (num cpus) +.. envvar:: LP_NUM_THREADS (num cpus) Number of threads that the llvmpipe driver should use. diff --git a/src/gallium/docs/source/exts/formatting.py b/src/gallium/docs/source/exts/formatting.py new file mode 100644 index 00000000000..14865f36033 --- /dev/null +++ b/src/gallium/docs/source/exts/formatting.py @@ -0,0 +1,31 @@ +# formatting.py +# Sphinx extension providing formatting for Gallium-specific data +# (c) Corbin Simpson 2010 +# Public domain to the extent permitted; contact author for special licensing + +import docutils.nodes +import sphinx.addnodes + +def parse_envvar(env, sig, signode): + envvar, t, default = sig.split(" ", 2) + envvar = envvar.strip().upper() + t = " Type: %s" % t.strip(" <>").lower() + default = " Default: %s" % default.strip(" ()") + signode += sphinx.addnodes.desc_name(envvar, envvar) + signode += sphinx.addnodes.desc_type(t, t) + signode += sphinx.addnodes.desc_annotation(default, default) + return envvar + +def parse_opcode(env, sig, signode): + opcode, desc = sig.split("-", 1) + opcode = opcode.strip().upper() + desc = " (%s)" % desc.strip() + signode += sphinx.addnodes.desc_name(opcode, opcode) + signode += sphinx.addnodes.desc_annotation(desc, desc) + return opcode + +def setup(app): + app.add_description_unit("envvar", "envvar", "%s (environment variable)", + parse_envvar) + app.add_description_unit("opcode", "opcode", "%s (TGSI opcode)", + parse_opcode) diff --git a/src/gallium/docs/source/exts/tgsi.py b/src/gallium/docs/source/exts/tgsi.py deleted file mode 100644 index e92cd5c4d1b..00000000000 --- a/src/gallium/docs/source/exts/tgsi.py +++ /dev/null @@ -1,17 +0,0 @@ -# tgsi.py -# Sphinx extension providing formatting for TGSI opcodes -# (c) Corbin Simpson 2010 - -import docutils.nodes -import sphinx.addnodes - -def parse_opcode(env, sig, signode): - opcode, desc = sig.split("-", 1) - opcode = opcode.strip().upper() - desc = " (%s)" % desc.strip() - signode += sphinx.addnodes.desc_name(opcode, opcode) - signode += sphinx.addnodes.desc_annotation(desc, desc) - return opcode - -def setup(app): - app.add_description_unit("opcode", "opcode", "%s (TGSI opcode)", parse_opcode) -- cgit v1.2.3 From 2d53dc873ea1d9e0e3e4c1cf08a63621661e422f Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Sun, 15 Aug 2010 03:26:58 -0700 Subject: gallium/docs: Cleanup debugging. Spelling, grammar, organization. --- src/gallium/docs/source/debugging.rst | 55 +++++++++++++++++++---------------- 1 file changed, 30 insertions(+), 25 deletions(-) (limited to 'src/gallium/docs') diff --git a/src/gallium/docs/source/debugging.rst b/src/gallium/docs/source/debugging.rst index f29bf53dfec..42bda5aee93 100644 --- a/src/gallium/docs/source/debugging.rst +++ b/src/gallium/docs/source/debugging.rst @@ -6,10 +6,10 @@ Debugging utilities in gallium. Debug Variables ^^^^^^^^^^^^^^^ -All drivers respond to a couple of debug enviromental variables. Below is -a collection of them. Set them as you would any normal enviromental variable -for the platform/operating system you are running. For linux this can be -done by typing "export var=value" into a console and then running the +All drivers respond to a set of common debug environment variables, as well as +some driver-specific variables. Set them as normal environment variables for +the platform or operating system you are running. For example, for Linux this +can be done by typing "export var=value" into a console and then running the program from that console. Common @@ -17,9 +17,9 @@ Common .. envvar:: GALLIUM_PRINT_OPTIONS (false) -This options controls if the debug variables should be printed to stderr. -This is probably the most usefull variable since it allows you to find -which variables a driver responds to. +This option controls if the debug variables should be printed to stderr. This +is probably the most useful variable, since it allows you to find which +variables a driver uses. .. envvar:: GALLIUM_RBUG (false) @@ -27,29 +27,34 @@ Controls if the :ref:`rbug` should be used. .. envvar:: GALLIUM_TRACE ("") -If not set tracing is not used, if set it will write the output to the file -specifed by the variable. So setting it to "trace.xml" will write the output -to the file "trace.xml". +If set, this variable will cause the :ref:`Trace` output to be written to the +specified file. Paths may be relative or absolute; relative paths are relative +to the working directory. For example, setting it to "trace.xml" will cause +the trace to be written to a file of the same name in the working directory. .. envvar:: GALLIUM_DUMP_CPU (false) -Dump information about the current cpu that the driver is running on. +Dump information about the current CPU that the driver is running on. .. envvar:: TGSI_PRINT_SANITY (false) -Gallium has a inbuilt shader sanity checker, this option controls if results -from it should be printed. This include warnings such as unused variables. +Gallium has a built-in shader sanity checker. This option controls whether +the shader sanity checker prints its warnings and errors to stderr. .. envvar:: DRAW_USE_LLVM (false) -Should the :ref:`draw` module use llvm for vertex and geometry shaders. +Whether the :ref:`Draw` module will attempt to use LLVM for vertex and geometry shaders. + + +State tracker-specific +"""""""""""""""""""""" .. envvar:: ST_DEBUG (0x0) Debug :ref:`flags` for the GL state tracker. -Driver specific +Driver-specific """"""""""""""" .. envvar:: I915_DEBUG (0x0) @@ -68,7 +73,7 @@ Dump all commands going to the hardware. Debug :ref:`flags` for the llvmpipe driver. -.. envvar:: LP_NUM_THREADS (num cpus) +.. envvar:: LP_NUM_THREADS (number of CPUs) Number of threads that the llvmpipe driver should use. @@ -78,10 +83,10 @@ Number of threads that the llvmpipe driver should use. Flags """"" -The variables of type all take a string with comma seperated -flags to enable different debugging for different parts of the drivers -or state tracker. If set to "help" the driver will print a list of flags -to which the variable can be set to. Order does not matter. +The variables of type "flags" all take a string with comma-separated flags to +enable different debugging for different parts of the drivers or state +tracker. If set to "help", the driver will print a list of flags which the +variable accepts. Order does not matter. .. _rbug: @@ -89,8 +94,8 @@ to which the variable can be set to. Order does not matter. Remote Debugger ^^^^^^^^^^^^^^^ -Or rbug for short allows for runtime inspections of :ref:`Context`, -:ref:`Screen`, Resources and Shaders; pauseing and stepping of draw calls; -and runtime disable and replacement of shaders. Is used with rbug-gui which -is hosted outside of the main mesa repositor. Rbug is can be used over a -network connection so the debbuger does not need to be on the same machine. +The remote debugger, commonly known as rbug, allows for runtime inspections of +:ref:`Context`, :ref:`Screen`, :ref:`Resource` and :ref:`Shader` objects; and +pausing and stepping of :ref:`Draw` calls. Is used with rbug-gui which is +hosted outside of the main mesa repository. rbug is can be used over a network +connection, so the debugger does not need to be on the same machine. -- cgit v1.2.3 From d377abd93fed4f5d27047bf3c8b9a032a21c5224 Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Fri, 20 Aug 2010 02:28:36 +0100 Subject: gallium/docs: Add Galahad --- src/gallium/docs/source/debugging.rst | 4 ++++ src/gallium/docs/source/distro.rst | 9 +++++++++ 2 files changed, 13 insertions(+) (limited to 'src/gallium/docs') diff --git a/src/gallium/docs/source/debugging.rst b/src/gallium/docs/source/debugging.rst index 42bda5aee93..e081cbf74e1 100644 --- a/src/gallium/docs/source/debugging.rst +++ b/src/gallium/docs/source/debugging.rst @@ -21,6 +21,10 @@ This option controls if the debug variables should be printed to stderr. This is probably the most useful variable, since it allows you to find which variables a driver uses. +.. envvar:: GALLIUM_GALAHAD (false) + +Controls if the :ref:`galahad` sanity checker module should be used. + .. envvar:: GALLIUM_RBUG (false) Controls if the :ref:`rbug` should be used. diff --git a/src/gallium/docs/source/distro.rst b/src/gallium/docs/source/distro.rst index 70d75b51e65..08c8eab890a 100644 --- a/src/gallium/docs/source/distro.rst +++ b/src/gallium/docs/source/distro.rst @@ -79,6 +79,15 @@ Rbug Wrapper driver. :ref:`rbug` driver used with stand alone rbug-gui. +.. _galahad: + +Galahad +^^^^^^^ + +Wrapper driver. Sanity checker for the internal gallium state. Normally +a driver should n't have to sanity check the input it gets from a state +tracker. Any wrong state received should be perceived as a state tracker bug. + State Trackers -------------- -- cgit v1.2.3 From 72b3e3fee37413fefe205fa03a111a0180ed19c1 Mon Sep 17 00:00:00 2001 From: Luca Barbieri Date: Thu, 15 Apr 2010 09:02:29 +0200 Subject: gallium: add PIPE_TEXTURE_RECT target This allows to properly support OpenGL rectangle textures in a well defined way, especially on drivers that don't expose PIPE_CAP_NPOT_TEXTURES. --- src/gallium/docs/source/index.rst | 1 + src/gallium/docs/source/resources.rst | 41 +++++++++++++++++++++++++++++++++++ src/gallium/include/pipe/p_defines.h | 4 +++- 3 files changed, 45 insertions(+), 1 deletion(-) create mode 100644 src/gallium/docs/source/resources.rst (limited to 'src/gallium/docs') diff --git a/src/gallium/docs/source/index.rst b/src/gallium/docs/source/index.rst index 6c19842dac4..2a73e3ab59d 100644 --- a/src/gallium/docs/source/index.rst +++ b/src/gallium/docs/source/index.rst @@ -15,6 +15,7 @@ Contents: debugging tgsi screen + resources context cso distro diff --git a/src/gallium/docs/source/resources.rst b/src/gallium/docs/source/resources.rst new file mode 100644 index 00000000000..a380e5080c8 --- /dev/null +++ b/src/gallium/docs/source/resources.rst @@ -0,0 +1,41 @@ +Resources +========= + +Resources represent objects that hold data: textures and buffers. + +They are mostly modelled after the resources in Direct3D 10/11, but with a +different transfer/update mechanism, and more features for OpenGL support. + +Resource targets +---------------- + +Resource targets determine the type of a resource. + +Note that drivers may not actually have the restrictions listed regarding +coordinate normalization and wrap modes, and in fact efficient OpenCL +support will probably require drivers that don't have any of them, which +will probably be advertised with an appropriate cap. + +TODO: document all targets. Note that both 3D and cube have restrictions +that depend on the hardware generation. + +TODO: can buffers have a non-R8 format? + +PIPE_TEXTURE_RECT +^^^^^^^^^^^^^^^^^ +2D surface with OpenGL GL_TEXTURE_RECTANGLE semantics. + +depth must be 1 +- last_level must be 0 +- Must use unnormalized coordinates +- Must use a clamp wrap mode + +PIPE_TEXTURE_2D +^^^^^^^^^^^^^^^ +2D surface accessed with normalized coordinates. + +- If PIPE_CAP_NPOT_TEXTURES is not supported, + width and height must be powers of two +- Mipmaps can be used +- Must use normalized coordinates +- No special restrictions on wrap modes diff --git a/src/gallium/include/pipe/p_defines.h b/src/gallium/include/pipe/p_defines.h index 00aa2076ed5..35eccf1c907 100644 --- a/src/gallium/include/pipe/p_defines.h +++ b/src/gallium/include/pipe/p_defines.h @@ -135,13 +135,15 @@ enum pipe_error { #define PIPE_STENCIL_OP_DECR_WRAP 6 #define PIPE_STENCIL_OP_INVERT 7 -/** Texture types */ +/** Texture types. + * See the documentation for info on PIPE_TEXTURE_RECT vs PIPE_TEXTURE_2D */ enum pipe_texture_target { PIPE_BUFFER = 0, PIPE_TEXTURE_1D = 1, PIPE_TEXTURE_2D = 2, PIPE_TEXTURE_3D = 3, PIPE_TEXTURE_CUBE = 4, + PIPE_TEXTURE_RECT = 5, PIPE_MAX_TEXTURE_TYPES }; -- cgit v1.2.3 From c843a60e6319f38991a3519c11a6525416593c04 Mon Sep 17 00:00:00 2001 From: Luca Barbieri Date: Fri, 20 Aug 2010 13:11:58 +0200 Subject: gallium/docs: improve documentation for resources --- src/gallium/docs/source/resources.rst | 160 +++++++++++++++++++++++++++++++++- 1 file changed, 157 insertions(+), 3 deletions(-) (limited to 'src/gallium/docs') diff --git a/src/gallium/docs/source/resources.rst b/src/gallium/docs/source/resources.rst index a380e5080c8..c8a5766821b 100644 --- a/src/gallium/docs/source/resources.rst +++ b/src/gallium/docs/source/resources.rst @@ -1,11 +1,26 @@ -Resources -========= +Resources and derived objects +============================= Resources represent objects that hold data: textures and buffers. They are mostly modelled after the resources in Direct3D 10/11, but with a different transfer/update mechanism, and more features for OpenGL support. +Resources can be used in several ways, and it is required to specify all planned uses through an appropriate set of bind flags. + +TODO: write much more on resources + +Transfers +--------- + +Transfers are the mechanism used to access resources with the CPU. + +OpenGL: OpenGL supports mapping buffers and has inline transfer functions for both buffers and textures + +D3D11: D3D11 lacks transfers, but has special resource types that are mappable to the CPU address space + +TODO: write much more on transfers + Resource targets ---------------- @@ -21,21 +36,160 @@ that depend on the hardware generation. TODO: can buffers have a non-R8 format? +PIPE_BUFFER +^^^^^^^^^^^ + +Buffer resource: can be used as a vertex, index, constant buffer (appropriate bind flags must be requested). + +They can be bound to stream output if supported. +TODO: what about the restrictions lifted by the several later GL transform feedback extensions? How does one advertise that in Gallium? + +They can be also be bound to a shader stage as usual. +TODO: are all drivers supposed to support this? how does this work exactly? are there size limits? + +They can be also be bound to the framebuffer as usual. +TODO: are all drivers supposed to support this? how does this work exactly? are there size limits? +TODO: is there any chance of supporting GL pixel buffer object acceleration with this? + +- depth0 must be 1 +- last_level must be 0 +- TODO: what about normalization? +- TODO: wrap modes/other sampling state? +- TODO: are arbitrary formats supported? in which cases? + +OpenGL: vertex buffers in GL 1.5 or GL_ARB_vertex_buffer_object + +- Binding to stream out requires GL 3.0 or GL_NV_transform_feedback +- Binding as constant buffers requires GL 3.1 or GL_ARB_uniform_buffer_object +- Binding to a sampling stage requires GL 3.1 or GL_ARB_texture_buffer_object +- TODO: can they be bound to an FBO? + +D3D11: buffer resources +- Binding to a render target requires D3D_FEATURE_LEVEL_10_0 + +PIPE_TEXTURE_1D +^^^^^^^^^^^^^^^ +1D surface accessed with normalized coordinates. + +UNIMPLEMENTED: 1D texture arrays not supported + +- If PIPE_CAP_NPOT_TEXTURES is not supported, + width must be a power of two +- height0 must be 1 +- depth0 must be 1 +- Mipmaps can be used +- Must use normalized coordinates + +OpenGL: GL_TEXTURE_1D in GL 1.0 + +- PIPE_CAP_NPOT_TEXTURES is equivalent to GL 2.0 or GL_ARB_texture_non_power_of_two + +D3D11: 1D textures in D3D_FEATURE_LEVEL_10_0 + PIPE_TEXTURE_RECT ^^^^^^^^^^^^^^^^^ 2D surface with OpenGL GL_TEXTURE_RECTANGLE semantics. -depth must be 1 +- depth0 must be 1 - last_level must be 0 - Must use unnormalized coordinates - Must use a clamp wrap mode +OpenGL: GL_TEXTURE_RECTANGLE in GL 3.1 or GL_ARB_texture_rectangle or GL_NV_texture_rectangle + +OpenCL: can create OpenCL images based on this, that can then be sampled arbitrarily + +D3D11: not supported (only PIPE_TEXTURE_2D with normalized coordinates is supported) + PIPE_TEXTURE_2D ^^^^^^^^^^^^^^^ 2D surface accessed with normalized coordinates. +UNIMPLEMENTED: 2D texture arrays not supported + - If PIPE_CAP_NPOT_TEXTURES is not supported, width and height must be powers of two +- depth0 must be 1 - Mipmaps can be used - Must use normalized coordinates - No special restrictions on wrap modes + +OpenGL: GL_TEXTURE_2D in GL 1.0 + +- PIPE_CAP_NPOT_TEXTURES is equivalent to GL 2.0 or GL_ARB_texture_non_power_of_two + +OpenCL: can create OpenCL images based on this, that can then be sampled arbitrarily + +D3D11: 2D textures + +- PIPE_CAP_NPOT_TEXTURES is equivalent to D3D_FEATURE_LEVEL_9_3 + +PIPE_TEXTURE_3D +^^^^^^^^^^^^^^^ + +3-dimensional array of texels. +Mipmap dimensions are reduced in all 3 coordinates. + +- If PIPE_CAP_NPOT_TEXTURES is not supported, + width, height and depth must be powers of two +- Must use normalized coordinates + +OpenGL: GL_TEXTURE_3D in GL 1.2 or GL_EXT_texture3D + +- PIPE_CAP_NPOT_TEXTURES is equivalent to GL 2.0 or GL_ARB_texture_non_power_of_two + +D3D11: 3D textures + +- PIPE_CAP_NPOT_TEXTURES is equivalent to D3D_FEATURE_LEVEL_10_0 + +PIPE_TEXTURE_CUBE +^^^^^^^^^^^^^^^^^ + +Cube maps consist of 6 2D faces. +The 6 surfaces form an imaginary cube, and sampling happens by mapping an +input 3-vector to the point of the cube surface in that direction. + +Sampling may be optionally seamless, resulting in filtering taking samples +from multiple surfaces near to the edge. +UNIMPLEMENTED: seamless cube map sampling not supported + +UNIMPLEMENTED: cube map arrays not supported + +- Width and height must be equal +- If PIPE_CAP_NPOT_TEXTURES is not supported, + width and height must be powers of two +- Must use normalized coordinates + +OpenGL: GL_TEXTURE_CUBE_MAP in GL 1.3 or EXT_texture_cube_map + +- PIPE_CAP_NPOT_TEXTURES is equivalent to GL 2.0 or GL_ARB_texture_non_power_of_two +- Seamless cube maps require GL 3.2 or GL_ARB_seamless_cube_map or GL_AMD_seamless_cubemap_per_texture +- Cube map arrays require GL 4.0 or GL_ARB_texture_cube_map_array + +D3D11: 2D array textures with the D3D11_RESOURCE_MISC_TEXTURECUBE flag + +- PIPE_CAP_NPOT_TEXTURES is equivalent to D3D_FEATURE_LEVEL_10_0 +- Cube map arrays require D3D_FEATURE_LEVEL_10_1 +- TODO: are (non)seamless cube maps supported in D3D11? how? + +Surfaces +-------- + +Surfaces are views of a resource that can be bound as a framebuffer to serve as the render target or depth buffer. + +TODO: write much more on surfaces + +OpenGL: FBOs are collections of surfaces in GL 3.0 or GL_ARB_framebuffer_object + +D3D11: render target views and depth/stencil views + +Sampler views +------------- + +Sampler views are views of a resource that can be bound to a pipeline stage to be sampled from shaders. + +TODO: write much more on sampler views + +OpenGL: texture objects are actually sampler view and resource in a single unit + +D3D11: shader resource views -- cgit v1.2.3 From bc3cff2a4fbc690d7dcaf81cb821093950efee31 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Fri, 20 Aug 2010 11:38:33 +0100 Subject: gallium/docs: notes on scissor state --- src/gallium/docs/source/context.rst | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/gallium/docs') diff --git a/src/gallium/docs/source/context.rst b/src/gallium/docs/source/context.rst index f241411a002..8250c30f2ab 100644 --- a/src/gallium/docs/source/context.rst +++ b/src/gallium/docs/source/context.rst @@ -63,7 +63,9 @@ objects. They all follow simple, one-method binding calls, e.g. * ``set_scissor_state`` sets the bounds for the scissor test, which culls pixels before blending to render targets. If the :ref:`Rasterizer` does not have the scissor test enabled, then the scissor bounds never need to - be set since they will not be used. + be set since they will not be used. Note that scissor xmin and ymin are + inclusive, but xmax and ymax are exclusive. The inclusive ranges in x + and y would be [xmin..xmax-1] and [ymin..ymax-1]. * ``set_viewport_state`` -- cgit v1.2.3 From 91a93257615390f75320c27645167d08b82b46b9 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Mon, 13 Sep 2010 11:14:54 +0100 Subject: gallium: Change the resource_copy_region semantics to allow copies between different yet compatible formats --- src/gallium/docs/source/context.rst | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/gallium/docs') diff --git a/src/gallium/docs/source/context.rst b/src/gallium/docs/source/context.rst index 8250c30f2ab..5342fc25dc1 100644 --- a/src/gallium/docs/source/context.rst +++ b/src/gallium/docs/source/context.rst @@ -263,9 +263,11 @@ apart from any 3D state in the context. Blitting functionality may be moved to a separate abstraction at some point in the future. ``resource_copy_region`` blits a region of a subresource of a resource to a -region of another subresource of a resource, provided that both resources have the -same format. The source and destination may be the same resource, but overlapping -blits are not permitted. +region of another subresource of a resource, provided that both resources have +the same format, or compatible formats, i.e., formats for which copying the +bytes from the source resource unmodified to the destination resource will +achieve the same effect of a textured quad blitter. The source and destination +may be the same resource, but overlapping blits are not permitted. ``resource_resolve`` resolves a multisampled resource into a non-multisampled one. Formats and dimensions must match. This function must be present if a driver -- cgit v1.2.3 From 49cb978aa46af0d86ab609013d7883c8105a6d1d Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 17 Sep 2010 18:41:05 -0600 Subject: gallium: better docs for pipe_rasterizer_state::sprite_coord_enable --- src/gallium/docs/source/cso/rasterizer.rst | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) (limited to 'src/gallium/docs') diff --git a/src/gallium/docs/source/cso/rasterizer.rst b/src/gallium/docs/source/cso/rasterizer.rst index ee3419ccfca..d547055096f 100644 --- a/src/gallium/docs/source/cso/rasterizer.rst +++ b/src/gallium/docs/source/cso/rasterizer.rst @@ -124,17 +124,24 @@ Points sprite_coord_enable ^^^^^^^^^^^^^^^^^^^ -Specifies if a texture unit has its texture coordinates replaced or not. This -is a packed bitfield containing the enable for all texcoords -- if all bits -are zero, point sprites are effectively disabled. +Controls automatic texture coordinate generation for rendering sprite points. + +When bit k in the sprite_coord_enable bitfield is set, then generic +input k to the fragment shader will get an automatically computed +texture coordinate. + +The texture coordinate will be of the form (s, t, 0, 1) where s varies +from 0 to 1 from left to right while t varies from 0 to 1 according to +the state of 'sprite_coord_mode' (see below). If any bit is set, then point_smooth MUST be disabled (there are no round sprites) and point_quad_rasterization MUST be true (sprites are always rasterized as quads). Any mismatch between these states should be considered a bug in the state-tracker. -If enabled, the four vertices of the resulting quad will be assigned -texture coordinates, according to sprite_coord_mode. +This feature is implemented in the :ref:`Draw` module but may also be +implemented natively by GPUs or implemented with a geometry shader. + sprite_coord_mode ^^^^^^^^^^^^^^^^^ @@ -145,6 +152,7 @@ have coordinates (0,0,0,1). For PIPE_SPRITE_COORD_UPPER_LEFT, the upper-left vertex will have coordinates (0,0,0,1). This state is used by :ref:`Draw` to generate texcoords. + point_quad_rasterization ^^^^^^^^^^^^^^^^^^^^^^^^ -- cgit v1.2.3 From f964f92bcc7d4fbbceb16ea972fbbdd278953d75 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 17 Sep 2010 18:48:50 -0600 Subject: gallium/docs: added new pipeline.txt diagram This diagram shows the rendering pipeline with an emphasis on the inputs/outputs for each stage. Some stages emit new vertex attributes and others consume some attributes. --- src/gallium/docs/source/pipeline.txt | 128 +++++++++++++++++++++++++++++++++++ 1 file changed, 128 insertions(+) create mode 100644 src/gallium/docs/source/pipeline.txt (limited to 'src/gallium/docs') diff --git a/src/gallium/docs/source/pipeline.txt b/src/gallium/docs/source/pipeline.txt new file mode 100644 index 00000000000..fd1fbe9c76f --- /dev/null +++ b/src/gallium/docs/source/pipeline.txt @@ -0,0 +1,128 @@ +XXX this could be converted/formatted for Sphinx someday. +XXX do not use tabs in this file. + + + + position ] + primary/secondary colors ] + generics (normals, ] + texcoords, fog) ] User vertices / arrays + point size ] + edge flag ] + primitive ID } System-generated values + vertex ID } + | | | + V V V + +-------------------+ + | Vertex shader | + +-------------------+ + | | | + V V V + position + clip distance + generics + front/back & primary/secondary colors + point size + edge flag + primitive ID + | | | + V V V + +------------------------+ + | Geometry shader | + | (consume vertex ID) | + | (may change prim type) | + +------------------------+ + | | | + V V V + [...] + fb layer + | | | + V V V + +--------------------------+ + | Clipper | + | (consume clip distances) | + +--------------------------+ + | | | + V V V + +-------------------+ + | Polygon Culling | + +-------------------+ + | | | + V V V + +-----------------------+ + | Choose front or | + | back face color | + | (consume other color) | + +-----------------------+ + | | | + V V V + [...] + primary/secondary colors only + | | | + V V V + +-------------------+ + | Polygon Offset | + +-------------------+ + | | | + V V V + +----------------------+ + | Unfilled polygons | + | (consume edge flags) | + | (change prim type) | + +----------------------+ + | | | + V V V + position + generics + primary/secondary colors + point size + primitive ID + fb layer + | | | + V V V + +---------------------------------+ + | Optional Draw module helpers | + | * Polygon Stipple | + | * Line Stipple | + | * Line AA/smooth (as tris) | + | * Wide lines (as tris) | + | * Wide points/sprites (as tris) | + | * Point AA/smooth (as tris) | + | (NOTE: these stages may emit | + | new/extra generic attributes | + | such as texcoords) | + +---------------------------------+ + | | | + V V V + position ] + generics (+ new/extra ones) ] + primary/secondary colors ] Software rast vertices + point size ] + primitive ID ] + fb layer ] + | | | + V V V + +---------------------+ + | Triangle/Line/Point | + | Rasterization | + +---------------------+ + | | | + V V V + generic attribs + primary/secondary colors + primitive ID + fragment win coord pos } System-generated values + front/back face flag } + | | | + V V V + +-------------------+ + | Fragment shader | + +-------------------+ + | | | + V V V + zero or more colors + zero or one Z value + + +NOTE: The instance ID is not shown. It can be imagined to be a global variable +accessible to all shader stages. -- cgit v1.2.3 From d323118c3ef1ed197e61e7a80e0ddafbe9e70ecb Mon Sep 17 00:00:00 2001 From: Tilman Sauerbeck Date: Sun, 19 Sep 2010 09:03:11 +0200 Subject: gallium/docs: Fixed a typo in the SCS opcode description. Signed-off-by: Tilman Sauerbeck --- src/gallium/docs/source/tgsi.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/gallium/docs') diff --git a/src/gallium/docs/source/tgsi.rst b/src/gallium/docs/source/tgsi.rst index e588c5b7bd8..4c1f47ac670 100644 --- a/src/gallium/docs/source/tgsi.rst +++ b/src/gallium/docs/source/tgsi.rst @@ -726,7 +726,7 @@ This instruction replicates its result. dst.z = 0 - dst.y = 1 + dst.w = 1 .. opcode:: TXB - Texture Lookup With Bias -- cgit v1.2.3 From 1bcdc504d10b7776cc96d63efd9e9432a66a2a90 Mon Sep 17 00:00:00 2001 From: Tilman Sauerbeck Date: Tue, 21 Sep 2010 21:57:35 +0200 Subject: gallium/docs: The RET opcode may appear anywhere in a subroutine. Signed-off-by: Tilman Sauerbeck --- src/gallium/docs/source/tgsi.rst | 2 -- 1 file changed, 2 deletions(-) (limited to 'src/gallium/docs') diff --git a/src/gallium/docs/source/tgsi.rst b/src/gallium/docs/source/tgsi.rst index 4c1f47ac670..9e02d43ab74 100644 --- a/src/gallium/docs/source/tgsi.rst +++ b/src/gallium/docs/source/tgsi.rst @@ -678,8 +678,6 @@ This instruction replicates its result. pc = pop() - Potential restrictions: - * Only occurs at end of function. .. opcode:: SSG - Set Sign -- cgit v1.2.3