[Mesa-dev] [PATCH 34/37] mesa: add support to query GL_TRANSFORM_FEEDBACK_BUFFER_INDEX
Timothy Arceri
timothy.arceri at collabora.com
Tue Mar 15 12:57:24 UTC 2016
---
src/compiler/glsl/link_varyings.cpp | 15 +++++++++------
src/compiler/glsl/link_varyings.h | 4 ++--
src/mesa/main/mtypes.h | 1 +
src/mesa/main/shader_query.cpp | 6 ++++++
4 files changed, 18 insertions(+), 8 deletions(-)
diff --git a/src/compiler/glsl/link_varyings.cpp b/src/compiler/glsl/link_varyings.cpp
index fb56d93..a01a8e5 100644
--- a/src/compiler/glsl/link_varyings.cpp
+++ b/src/compiler/glsl/link_varyings.cpp
@@ -791,8 +791,9 @@ tfeedback_decl::get_num_outputs() const
bool
tfeedback_decl::store(struct gl_context *ctx, struct gl_shader_program *prog,
struct gl_transform_feedback_info *info,
- unsigned buffer, const unsigned max_outputs,
- bool *explicit_stride, bool has_xfb_qualifiers) const
+ unsigned buffer, unsigned buffer_index,
+ const unsigned max_outputs, bool *explicit_stride,
+ bool has_xfb_qualifiers) const
{
assert(!this->next_buffer_separator);
@@ -889,6 +890,7 @@ tfeedback_decl::store(struct gl_context *ctx, struct gl_shader_program *prog,
this->orig_name);
info->Varyings[info->NumVarying].Type = this->type;
info->Varyings[info->NumVarying].Size = this->size;
+ info->Varyings[info->NumVarying].BufferIndex = buffer_index;
info->NumVarying++;
return true;
@@ -1042,8 +1044,8 @@ store_tfeedback_info(struct gl_context *ctx, struct gl_shader_program *prog,
/* GL_SEPARATE_ATTRIBS */
for (unsigned i = 0; i < num_tfeedback_decls; ++i) {
if (!tfeedback_decls[i].store(ctx, prog, &prog->LinkedTransformFeedback,
- num_buffers, num_outputs, NULL,
- has_xfb_qualifiers))
+ num_buffers, num_buffers, num_outputs,
+ NULL, has_xfb_qualifiers))
return false;
buffers |= 1 << num_buffers;
@@ -1074,6 +1076,7 @@ store_tfeedback_info(struct gl_context *ctx, struct gl_shader_program *prog,
buffer != tfeedback_decls[i].get_buffer()) {
/* we have moved to the next buffer so reset stream id */
buffer_stream_id = -1;
+ num_buffers++;
}
if (tfeedback_decls[i].is_next_buffer_separator()) {
@@ -1102,11 +1105,11 @@ store_tfeedback_info(struct gl_context *ctx, struct gl_shader_program *prog,
} else {
buffer = num_buffers;
}
- buffers |= 1 << num_buffers;
+ buffers |= 1 << buffer;
if (!tfeedback_decls[i].store(ctx, prog,
&prog->LinkedTransformFeedback,
- num_buffers, num_outputs,
+ buffer, num_buffers, num_outputs,
explicit_stride, has_xfb_qualifiers))
return false;
}
diff --git a/src/compiler/glsl/link_varyings.h b/src/compiler/glsl/link_varyings.h
index 1f77a50..81d3973 100644
--- a/src/compiler/glsl/link_varyings.h
+++ b/src/compiler/glsl/link_varyings.h
@@ -98,8 +98,8 @@ public:
unsigned get_num_outputs() const;
bool store(struct gl_context *ctx, struct gl_shader_program *prog,
struct gl_transform_feedback_info *info, unsigned buffer,
- const unsigned max_outputs, bool *explicit_stride,
- bool has_xfb_qualifiers) const;
+ unsigned buffer_index, const unsigned max_outputs,
+ bool *explicit_stride, bool has_xfb_qualifiers) const;
const tfeedback_candidate *find_candidate(gl_shader_program *prog,
hash_table *tfeedback_candidates);
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index 99745c1..8a95063 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -1619,6 +1619,7 @@ struct gl_transform_feedback_varying_info
{
char *Name;
GLenum Type;
+ GLint BufferIndex;
GLint Size;
GLint Offset;
};
diff --git a/src/mesa/main/shader_query.cpp b/src/mesa/main/shader_query.cpp
index 6263b0e..6169e63 100644
--- a/src/mesa/main/shader_query.cpp
+++ b/src/mesa/main/shader_query.cpp
@@ -1331,6 +1331,12 @@ _mesa_program_resource_prop(struct gl_shader_program *shProg,
default:
goto invalid_operation;
}
+
+ case GL_TRANSFORM_FEEDBACK_BUFFER_INDEX:
+ VALIDATE_TYPE(GL_TRANSFORM_FEEDBACK_VARYING);
+ *val = RESOURCE_XFV(res)->BufferIndex;
+ return 1;
+
default:
goto invalid_enum;
}
--
2.5.0
More information about the mesa-dev
mailing list