summaryrefslogtreecommitdiffstats
path: root/src/glsl/main.cpp
diff options
context:
space:
mode:
authorPaul Berry <[email protected]>2011-07-07 14:01:40 -0700
committerPaul Berry <[email protected]>2011-07-22 09:45:11 -0700
commitf129f618fe8a5397774484f1b7afb42d4be809a0 (patch)
tree600040852abbc6ba234948b3b9a71f594448984c /src/glsl/main.cpp
parent12c22cab77f35a887d9f6790e0de4a8fa4b3b575 (diff)
glsl: Move functions into standalone_scaffolding.cpp for later reuse.
This patch moves the following functions from main.cpp (the main cpp file for the standalone executable that is used to create the built-in functions) to standalone_scaffolding.cpp, so that they can be re-used in other standalone executables: - initialize_context()* - _mesa_new_shader() - _mesa_reference_shader() *initialize_context contained some code that was specific to main.cpp, so it was split into two functions: initialize_context() (which remains in main.cpp), and initialize_context_from_defaults() (which is in standalone_scaffolding.cpp).
Diffstat (limited to 'src/glsl/main.cpp')
-rw-r--r--src/glsl/main.cpp60
1 files changed, 3 insertions, 57 deletions
diff --git a/src/glsl/main.cpp b/src/glsl/main.cpp
index 7952bb1a3e3..9f85096e1a1 100644
--- a/src/glsl/main.cpp
+++ b/src/glsl/main.cpp
@@ -29,80 +29,26 @@
#include "ir_print_visitor.h"
#include "program.h"
#include "loop_analysis.h"
-
-extern "C" struct gl_shader *
-_mesa_new_shader(struct gl_context *ctx, GLuint name, GLenum type);
-
-extern "C" void
-_mesa_reference_shader(struct gl_context *ctx, struct gl_shader **ptr,
- struct gl_shader *sh);
-
-/* Copied from shader_api.c for the stand-alone compiler.
- */
-void
-_mesa_reference_shader(struct gl_context *ctx, struct gl_shader **ptr,
- struct gl_shader *sh)
-{
- *ptr = sh;
-}
-
-struct gl_shader *
-_mesa_new_shader(struct gl_context *ctx, GLuint name, GLenum type)
-{
- struct gl_shader *shader;
-
- (void) ctx;
-
- assert(type == GL_FRAGMENT_SHADER || type == GL_VERTEX_SHADER);
- shader = rzalloc(NULL, struct gl_shader);
- if (shader) {
- shader->Type = type;
- shader->Name = name;
- shader->RefCount = 1;
- }
- return shader;
-}
+#include "standalone_scaffolding.h"
static void
initialize_context(struct gl_context *ctx, gl_api api)
{
- memset(ctx, 0, sizeof(*ctx));
-
- ctx->API = api;
-
- ctx->Extensions.ARB_ES2_compatibility = GL_TRUE;
- ctx->Extensions.ARB_draw_buffers = GL_TRUE;
- ctx->Extensions.ARB_draw_instanced = GL_TRUE;
- ctx->Extensions.ARB_fragment_coord_conventions = GL_TRUE;
- ctx->Extensions.EXT_texture_array = GL_TRUE;
- ctx->Extensions.NV_texture_rectangle = GL_TRUE;
- ctx->Extensions.EXT_texture3D = GL_TRUE;
+ initialize_context_to_defaults(ctx, api);
/* GLSL 1.30 isn't fully supported, but we need to advertise 1.30 so that
* the built-in functions for 1.30 can be built.
*/
ctx->Const.GLSLVersion = 130;
- /* 1.10 minimums. */
- ctx->Const.MaxLights = 8;
ctx->Const.MaxClipPlanes = 8;
- ctx->Const.MaxTextureUnits = 2;
+ ctx->Const.MaxDrawBuffers = 2;
/* More than the 1.10 minimum to appease parser tests taken from
* apps that (hopefully) already checked the number of coords.
*/
ctx->Const.MaxTextureCoordUnits = 4;
- ctx->Const.VertexProgram.MaxAttribs = 16;
- ctx->Const.VertexProgram.MaxUniformComponents = 512;
- ctx->Const.MaxVarying = 8;
- ctx->Const.MaxVertexTextureImageUnits = 0;
- ctx->Const.MaxCombinedTextureImageUnits = 2;
- ctx->Const.MaxTextureImageUnits = 2;
- ctx->Const.FragmentProgram.MaxUniformComponents = 64;
-
- ctx->Const.MaxDrawBuffers = 2;
-
ctx->Driver.NewShader = _mesa_new_shader;
}