summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Berry <[email protected]>2011-12-26 19:30:10 -0800
committerPaul Berry <[email protected]>2012-01-05 13:27:11 -0800
commit2169331d40e915d0d1065477a5c81d59f222a5c8 (patch)
tree9799b8561357665a6449b51f5cbc6eaac457a1e7
parent989b5722dc350b01c4148b1cd978b71ec4bcfe81 (diff)
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 <[email protected]>
-rw-r--r--src/glsl/linker.cpp1
-rw-r--r--src/mesa/main/mtypes.h7
2 files changed, 8 insertions, 0 deletions
diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp
index 128bbd54263..ef6a6e3647a 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 332b80ab7a9..dcb987116d2 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.