diff options
Diffstat (limited to 'mesalib/src/mesa/main/shaderapi.c')
-rw-r--r-- | mesalib/src/mesa/main/shaderapi.c | 48 |
1 files changed, 41 insertions, 7 deletions
diff --git a/mesalib/src/mesa/main/shaderapi.c b/mesalib/src/mesa/main/shaderapi.c index c349b0cb5..d184b114c 100644 --- a/mesalib/src/mesa/main/shaderapi.c +++ b/mesalib/src/mesa/main/shaderapi.c @@ -179,7 +179,7 @@ validate_shader_target(const struct gl_context *ctx, GLenum type) case GL_VERTEX_SHADER: return ctx->Extensions.ARB_vertex_shader; case GL_GEOMETRY_SHADER_ARB: - return _mesa_is_desktop_gl(ctx) && ctx->Extensions.ARB_geometry_shader4; + return _mesa_has_geometry_shaders(ctx); default: return false; } @@ -478,8 +478,7 @@ get_programiv(struct gl_context *ctx, GLuint program, GLenum pname, GLint *param /* Are geometry shaders available in this context? */ - const bool has_gs = - _mesa_is_desktop_gl(ctx) && ctx->Extensions.ARB_geometry_shader4; + const bool has_gs = _mesa_has_geometry_shaders(ctx); /* Are uniform buffer objects available in this context? */ @@ -743,6 +742,12 @@ compile_shader(struct gl_context *ctx, GLuint shaderObj) if (!sh) return; + /* Geometry shaders are not yet fully supported, so issue a warning message + * if we're compiling one. + */ + if (sh->Type == GL_GEOMETRY_SHADER) + printf("WARNING: Geometry shader support is currently experimental.\n"); + options = &ctx->ShaderCompilerOptions[_mesa_shader_type_to_index(sh->Type)]; /* set default pragma state for shader */ @@ -1635,10 +1640,10 @@ _mesa_ProgramParameteri(GLuint program, GLenum pname, GLint value) if (!_mesa_is_desktop_gl(ctx) || !ctx->Extensions.ARB_geometry_shader4) break; - if (value < 1 || + if (value < 0 || (unsigned) value > ctx->Const.MaxGeometryOutputVertices) { _mesa_error(ctx, GL_INVALID_VALUE, - "glProgramParameteri(GL_GEOMETRY_VERTICES_OUT_ARB=%d", + "glProgramParameteri(GL_GEOMETRY_VERTICES_OUT_ARB=%d)", value); return; } @@ -1658,7 +1663,7 @@ _mesa_ProgramParameteri(GLuint program, GLenum pname, GLint value) break; default: _mesa_error(ctx, GL_INVALID_VALUE, - "glProgramParameteri(geometry input type = %s", + "glProgramParameteri(geometry input type = %s)", _mesa_lookup_enum_by_nr(value)); return; } @@ -1675,7 +1680,7 @@ _mesa_ProgramParameteri(GLuint program, GLenum pname, GLint value) break; default: _mesa_error(ctx, GL_INVALID_VALUE, - "glProgramParameteri(geometry output type = %s", + "glProgramParameteri(geometry output type = %s)", _mesa_lookup_enum_by_nr(value)); return; } @@ -1843,3 +1848,32 @@ _mesa_CreateShaderProgramEXT(GLenum type, const GLchar *string) return program; } + + +/** + * Copy program-specific data generated by linking from the gl_shader_program + * object to a specific gl_program object. + */ +void +_mesa_copy_linked_program_data(gl_shader_type type, + const struct gl_shader_program *src, + struct gl_program *dst) +{ + switch (type) { + case MESA_SHADER_VERTEX: { + struct gl_vertex_program *dst_vp = (struct gl_vertex_program *) dst; + dst_vp->UsesClipDistance = src->Vert.UsesClipDistance; + } + break; + case MESA_SHADER_GEOMETRY: { + struct gl_geometry_program *dst_gp = (struct gl_geometry_program *) dst; + dst_gp->VerticesIn = src->Geom.VerticesIn; + dst_gp->VerticesOut = src->Geom.VerticesOut; + dst_gp->InputType = src->Geom.InputType; + dst_gp->OutputType = src->Geom.OutputType; + } + break; + default: + break; + } +} |