~ubuntu-branches/ubuntu/precise/mesa/precise-updates

« back to all changes in this revision

Viewing changes to src/glsl/standalone_scaffolding.cpp

  • Committer: Package Import Robot
  • Author(s): Robert Hooker
  • Date: 2012-02-02 12:05:48 UTC
  • mfrom: (1.7.1) (3.3.27 sid)
  • Revision ID: package-import@ubuntu.com-20120202120548-nvkma85jq0h4coix
Tags: 8.0~rc2-0ubuntu4
Drop drisearchdir handling, it is no longer needed with multiarch
and dri-alternates being removed.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright © 2011 Intel Corporation
 
3
 *
 
4
 * Permission is hereby granted, free of charge, to any person obtaining a
 
5
 * copy of this software and associated documentation files (the "Software"),
 
6
 * to deal in the Software without restriction, including without limitation
 
7
 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
 
8
 * and/or sell copies of the Software, and to permit persons to whom the
 
9
 * Software is furnished to do so, subject to the following conditions:
 
10
 *
 
11
 * The above copyright notice and this permission notice (including the next
 
12
 * paragraph) shall be included in all copies or substantial portions of the
 
13
 * Software.
 
14
 *
 
15
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 
16
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 
17
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
 
18
 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 
19
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
 
20
 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
 
21
 * DEALINGS IN THE SOFTWARE.
 
22
 */
 
23
 
 
24
/* This file declares stripped-down versions of functions that
 
25
 * normally exist outside of the glsl folder, so that they can be used
 
26
 * when running the GLSL compiler standalone (for unit testing or
 
27
 * compiling builtins).
 
28
 */
 
29
 
 
30
#include "standalone_scaffolding.h"
 
31
 
 
32
#include <assert.h>
 
33
#include <string.h>
 
34
#include "ralloc.h"
 
35
 
 
36
void
 
37
_mesa_reference_shader(struct gl_context *ctx, struct gl_shader **ptr,
 
38
                       struct gl_shader *sh)
 
39
{
 
40
   (void) ctx;
 
41
   *ptr = sh;
 
42
}
 
43
 
 
44
struct gl_shader *
 
45
_mesa_new_shader(struct gl_context *ctx, GLuint name, GLenum type)
 
46
{
 
47
   struct gl_shader *shader;
 
48
 
 
49
   (void) ctx;
 
50
 
 
51
   assert(type == GL_FRAGMENT_SHADER || type == GL_VERTEX_SHADER);
 
52
   shader = rzalloc(NULL, struct gl_shader);
 
53
   if (shader) {
 
54
      shader->Type = type;
 
55
      shader->Name = name;
 
56
      shader->RefCount = 1;
 
57
   }
 
58
   return shader;
 
59
}
 
60
 
 
61
void initialize_context_to_defaults(struct gl_context *ctx, gl_api api)
 
62
{
 
63
   memset(ctx, 0, sizeof(*ctx));
 
64
 
 
65
   ctx->API = api;
 
66
 
 
67
   ctx->Extensions.dummy_false = false;
 
68
   ctx->Extensions.dummy_true = true;
 
69
   ctx->Extensions.ARB_ES2_compatibility = true;
 
70
   ctx->Extensions.ARB_draw_instanced = true;
 
71
   ctx->Extensions.ARB_fragment_coord_conventions = true;
 
72
   ctx->Extensions.EXT_texture_array = true;
 
73
   ctx->Extensions.NV_texture_rectangle = true;
 
74
   ctx->Extensions.EXT_texture3D = true;
 
75
   ctx->Extensions.OES_EGL_image_external = true;
 
76
 
 
77
   ctx->Const.GLSLVersion = 120;
 
78
 
 
79
   /* 1.20 minimums. */
 
80
   ctx->Const.MaxLights = 8;
 
81
   ctx->Const.MaxClipPlanes = 6;
 
82
   ctx->Const.MaxTextureUnits = 2;
 
83
   ctx->Const.MaxTextureCoordUnits = 2;
 
84
   ctx->Const.VertexProgram.MaxAttribs = 16;
 
85
 
 
86
   ctx->Const.VertexProgram.MaxUniformComponents = 512;
 
87
   ctx->Const.MaxVarying = 8; /* == gl_MaxVaryingFloats / 4 */
 
88
   ctx->Const.MaxVertexTextureImageUnits = 0;
 
89
   ctx->Const.MaxCombinedTextureImageUnits = 2;
 
90
   ctx->Const.MaxTextureImageUnits = 2;
 
91
   ctx->Const.FragmentProgram.MaxUniformComponents = 64;
 
92
 
 
93
   ctx->Const.MaxDrawBuffers = 1;
 
94
}