~ubuntu-branches/ubuntu/quantal/mesa/quantal

« back to all changes in this revision

Viewing changes to src/mesa/shader/slang/slang_mesa.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Sebastien Bacher
  • Date: 2007-02-21 12:44:07 UTC
  • mfrom: (1.2.1 upstream)
  • mto: This revision was merged to the branch mainline in revision 22.
  • Revision ID: james.westby@ubuntu.com-20070221124407-rgcacs32mycrtadl
ImportĀ upstreamĀ versionĀ 6.5.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 * Mesa 3-D graphics library
3
 
 * Version:  6.3
4
 
 *
5
 
 * Copyright (C) 2005  Brian Paul   All Rights Reserved.
6
 
 *
7
 
 * Permission is hereby granted, free of charge, to any person obtaining a
8
 
 * copy of this software and associated documentation files (the "Software"),
9
 
 * to deal in the Software without restriction, including without limitation
10
 
 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
11
 
 * and/or sell copies of the Software, and to permit persons to whom the
12
 
 * Software is furnished to do so, subject to the following conditions:
13
 
 *
14
 
 * The above copyright notice and this permission notice shall be included
15
 
 * in all copies or substantial portions of the Software.
16
 
 *
17
 
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
18
 
 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
 
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
20
 
 * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
21
 
 * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
22
 
 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23
 
 */
24
 
 
25
 
#include "slang_mesa.h"
26
 
#include "Initialisation.h"
27
 
#include "Include/Common.h"
28
 
#include "Include/ShHandle.h"
29
 
#include "Public/ShaderLang.h"
30
 
 
31
 
 
32
 
class TGenericCompiler: public TCompiler
33
 
{
34
 
public:
35
 
        TGenericCompiler (EShLanguage l, int dOptions): TCompiler(l, infoSink), debugOptions(dOptions)
36
 
        {
37
 
        }
38
 
public:
39
 
        virtual bool compile (TIntermNode *root)
40
 
        {
41
 
                haveValidObjectCode = true;
42
 
                return haveValidObjectCode;
43
 
        }
44
 
        TInfoSink infoSink;
45
 
        int debugOptions;
46
 
};
47
 
 
48
 
TCompiler *ConstructCompiler (EShLanguage language, int debugOptions)
49
 
{
50
 
        return new TGenericCompiler (language, debugOptions);
51
 
}
52
 
 
53
 
void DeleteCompiler (TCompiler *compiler)
54
 
{
55
 
        delete compiler;
56
 
}
57
 
 
58
 
class TGenericLinker: public TLinker
59
 
{
60
 
public:
61
 
        TGenericLinker (EShExecutable e, int dOptions): TLinker(e, infoSink), debugOptions(dOptions)
62
 
        {
63
 
        }
64
 
public:
65
 
        bool link (TCompilerList &, TUniformMap *)
66
 
        {
67
 
                return true;
68
 
        }
69
 
        void getAttributeBindings (ShBindingTable const **t) const
70
 
        {
71
 
        }
72
 
        TInfoSink infoSink;
73
 
        int debugOptions;
74
 
};
75
 
 
76
 
TShHandleBase *ConstructLinker (EShExecutable executable, int debugOptions)
77
 
{
78
 
        return new TGenericLinker (executable, debugOptions);
79
 
}
80
 
 
81
 
void DeleteLinker (TShHandleBase *linker)
82
 
{
83
 
        delete linker;
84
 
}
85
 
 
86
 
class TUniformLinkedMap: public TUniformMap
87
 
{
88
 
public:
89
 
        TUniformLinkedMap()
90
 
        {
91
 
        }
92
 
public:
93
 
        virtual int getLocation (const char *name)
94
 
        {
95
 
                return 0;
96
 
        }
97
 
};
98
 
 
99
 
TUniformMap *ConstructUniformMap ()
100
 
{
101
 
        return new TUniformLinkedMap;
102
 
}
103
 
 
104
 
void DeleteUniformMap (TUniformMap *map)
105
 
{
106
 
        delete map;
107
 
}
108
 
 
109
 
 
110
 
namespace std
111
 
{
112
 
 
113
 
void _Xran ()
114
 
{
115
 
        /* XXX fix this under Linux */
116
 
        /*_THROW(out_of_range, "invalid string position");*/
117
 
}
118
 
 
119
 
void _Xlen ()
120
 
{
121
 
        /* XXX fix this under Linux */
122
 
        /*_THROW(length_error, "string too long");*/
123
 
}
124
 
 
125
 
}
126
 
 
127
 
 
128
 
/* these functions link with extern "C" */
129
 
 
130
 
int _mesa_isalnum (char c)
131
 
{
132
 
        return (c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z') || (c >= '0' && c <= '9');
133
 
}
134
 
 
135
 
int _glslang_3dlabs_InitProcess ()
136
 
{
137
 
        return InitProcess () ? 1 : 0;
138
 
}
139
 
 
140
 
int _glslang_3dlabs_ShInitialize ()
141
 
{
142
 
        return ShInitialize () ? 1 : 0;
143
 
}
144