summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorZack Rusin <[email protected]>2010-07-07 16:41:01 -0400
committerZack Rusin <[email protected]>2010-07-08 00:28:29 -0400
commitf11e25ee957549ab867fac4f17a5c61fd9172794 (patch)
tree91743f66faed4bb398ebad70c7b2a5ebafc9b2dc /src
parent7c42390453e611367cf1ba11446692ec04e0abfb (diff)
slang: add some comments related to geometry shaders
Diffstat (limited to 'src')
-rw-r--r--src/mesa/slang/slang_codegen.c3
-rw-r--r--src/mesa/slang/slang_link.c12
2 files changed, 15 insertions, 0 deletions
diff --git a/src/mesa/slang/slang_codegen.c b/src/mesa/slang/slang_codegen.c
index b2fe5b1f863..8ebe2980767 100644
--- a/src/mesa/slang/slang_codegen.c
+++ b/src/mesa/slang/slang_codegen.c
@@ -4191,6 +4191,9 @@ _slang_gen_variable(slang_assemble_ctx * A, slang_operation *oper)
slang_variable *var = _slang_variable_locate(oper->locals, name, GL_TRUE);
slang_ir_node *n;
if (!var || !var->declared) {
+ /* Geometry shader set gl_VerticesIn at link time
+ * so we need to way with resolving this variable
+ * until then */
if (A->program->Target == MESA_GEOMETRY_PROGRAM &&
!strcmp((char*)name, "gl_VerticesIn") ){
A->UnresolvedRefs = GL_TRUE;
diff --git a/src/mesa/slang/slang_link.c b/src/mesa/slang/slang_link.c
index c89ab8b9f66..bc2bd31fda5 100644
--- a/src/mesa/slang/slang_link.c
+++ b/src/mesa/slang/slang_link.c
@@ -810,6 +810,12 @@ remove_extra_version_directives(GLchar *source)
}
}
+/* Returns the number of vertices per geometry shader
+ * input primitive.
+ * XXX: duplicated in Gallium in u_vertices_per_prim
+ * method. Once Mesa core will start using Gallium
+ * this should be removed
+ */
static int
vertices_per_prim(int prim)
{
@@ -865,6 +871,8 @@ concat_shaders(struct gl_shader_program *shProg, GLenum shaderType)
return NULL;
}
+ /* Geometry shader will inject definition of
+ * const int gl_VerticesIn */
if (shaderType == GL_GEOMETRY_SHADER_ARB) {
totalLen += 32;
}
@@ -883,6 +891,10 @@ concat_shaders(struct gl_shader_program *shProg, GLenum shaderType)
len += shaderLengths[i];
}
}
+ /* if it's geometry shader we need to inject definition
+ * of "const int gl_VerticesIn = X;" where X is the number
+ * of vertices per input primitive
+ */
if (shaderType == GL_GEOMETRY_SHADER_ARB) {
GLchar gs_pre[32];
GLuint num_verts = vertices_per_prim(shProg->Geom.InputType);