mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-25 04:20:08 +01:00
slang: add some comments related to geometry shaders
This commit is contained in:
parent
7c42390453
commit
f11e25ee95
2 changed files with 15 additions and 0 deletions
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue