Mesa (master): mesa: Add gl_transform_feedback_info::ComponentOffset.

Paul Berry stereotype441 at kemper.freedesktop.org
Thu Jan 5 21:31:09 UTC 2012


Module: Mesa
Branch: master
Commit: 2169331d40e915d0d1065477a5c81d59f222a5c8
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=2169331d40e915d0d1065477a5c81d59f222a5c8

Author: Paul Berry <stereotype441 at gmail.com>
Date:   Mon Dec 26 19:30:10 2011 -0800

mesa: Add gl_transform_feedback_info::ComponentOffset.

When using transform feedback, there are three circumstances in which
it is useful for Mesa to instruct a driver to stream out just a
portion of a varying slot (rather than the whole vec4):

(a) When a varying is smaller than a vec4, Mesa needs to instruct the
driver to stream out just the first one, two, or three components of
the varying slot.

(b) In the future, when we implement varying packing, some varyings
will be offset within the vec4, so Mesa will have to instruct the
driver to stream out an arbitrary contiguous subset of the components
of the varying slot (e.g. .yzw or .yz).

(c) On drivers that set gl_shader_compiler_options::LowerClipDistance,
if the client requests that an element of gl_ClipDistance be streamed
out using transform feedback, Mesa will have to instruct the driver to
stream out a single component of one of the gl_ClipDistance varying
slots.

Previous to this patch, only (a) was possible, since
gl_transform_feedback_info specified only the number of components of
the varying slot to stream out.  This patch adds
gl_transform_feedback_info::ComponentOffset, which indicates which
components should be streamed out.

Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>

---

 src/glsl/linker.cpp    |    1 +
 src/mesa/main/mtypes.h |    7 +++++++
 2 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp
index 128bbd5..ef6a6e3 100644
--- a/src/glsl/linker.cpp
+++ b/src/glsl/linker.cpp
@@ -1606,6 +1606,7 @@ tfeedback_decl::store(struct gl_shader_program *prog,
       info->Outputs[info->NumOutputs].NumComponents = this->vector_elements;
       info->Outputs[info->NumOutputs].OutputBuffer = buffer;
       info->Outputs[info->NumOutputs].DstOffset = info->BufferStride[buffer];
+      info->Outputs[info->NumOutputs].ComponentOffset = 0;
       ++info->NumOutputs;
       info->BufferStride[buffer] += this->vector_elements;
    }
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index 332b80a..dcb9871 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -1839,6 +1839,13 @@ struct gl_transform_feedback_info {
 
       /** offset (in DWORDs) of this output within the interleaved structure */
       unsigned DstOffset;
+
+      /**
+       * Offset into the output register of the data to output.  For example,
+       * if NumComponents is 2 and ComponentOffset is 1, then the data to
+       * offset is in the y and z components of the output register.
+       */
+      unsigned ComponentOffset;
    } Outputs[MAX_PROGRAM_OUTPUTS];
 
    /** Transform feedback varyings used for the linking of this shader program.




More information about the mesa-commit mailing list