Ripped away bgfx
parent
dc1ee2e33c
commit
0922f482f8
|
@ -1,21 +0,0 @@
|
|||
shallow_clone: true
|
||||
|
||||
os:
|
||||
- Visual Studio 2017
|
||||
|
||||
environment:
|
||||
matrix:
|
||||
- TOOLSET: vs2015
|
||||
- TOOLSET: vs2017
|
||||
|
||||
configuration:
|
||||
- Debug
|
||||
- Release
|
||||
|
||||
install:
|
||||
- git clone --depth 1 https://github.com/bkaradzic/bx ..\bx
|
||||
- git clone --depth 1 https://github.com/bkaradzic/bimg ..\bimg
|
||||
- ..\bx\tools\bin\windows\genie --with-tools --with-examples %TOOLSET%
|
||||
|
||||
build:
|
||||
project: .build/projects/$(TOOLSET)/bgfx.sln
|
|
@ -1,19 +0,0 @@
|
|||
root = true
|
||||
|
||||
[*]
|
||||
indent_style = tab
|
||||
indent_size = 4
|
||||
end_of_line = lf
|
||||
max_line_length = 100
|
||||
insert_final_newline = true
|
||||
trim_trailing_whitespace = true
|
||||
|
||||
[include/bgfx/c99/*.h]
|
||||
indent_style = space
|
||||
|
||||
[*.ninja]
|
||||
indent_style = space
|
||||
|
||||
[*.md]
|
||||
trim_trailing_whitespace = false
|
||||
max_line_length = 80
|
|
@ -1,11 +0,0 @@
|
|||
*.c eol=lf
|
||||
*.cpp eol=lf
|
||||
*.h eol=lf
|
||||
*.sc eol=lf
|
||||
*.sh eol=lf
|
||||
*.m eol=lf
|
||||
*.mm eol=lf
|
||||
*.md eol=lf
|
||||
*.lua eol=lf
|
||||
*.mk eol=lf
|
||||
makefile eol=lf
|
|
@ -1,7 +0,0 @@
|
|||
.build
|
||||
.debug
|
||||
.DS_Store
|
||||
.git
|
||||
.svn
|
||||
tags
|
||||
.gdb_history
|
|
@ -1,33 +0,0 @@
|
|||
language: cpp
|
||||
matrix:
|
||||
include:
|
||||
- compiler: gcc
|
||||
os: linux
|
||||
- compiler: clang
|
||||
os: osx
|
||||
|
||||
addons:
|
||||
apt:
|
||||
sources:
|
||||
- ubuntu-toolchain-r-test
|
||||
packages:
|
||||
- gcc-5
|
||||
- g++-5
|
||||
- clang
|
||||
|
||||
before_script:
|
||||
- git clone --depth 1 https://github.com/bkaradzic/bx ../bx
|
||||
- git clone --depth 1 https://github.com/bkaradzic/bimg ../bimg
|
||||
|
||||
script:
|
||||
- if [ "$TRAVIS_OS_NAME" == "linux" ]; then make build CXX="g++-5" CC="gcc-5"; fi
|
||||
- if [ "$TRAVIS_OS_NAME" == "osx" ]; then make build; fi
|
||||
|
||||
branches:
|
||||
only:
|
||||
- master
|
||||
|
||||
notifications:
|
||||
email: false
|
||||
|
||||
osx_image: xcode9.3
|
|
@ -1,37 +0,0 @@
|
|||
root = true
|
||||
|
||||
[etc1/*]
|
||||
indent_style = space
|
||||
indent_size = 4
|
||||
|
||||
[fcpp/*]
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
|
||||
[iqa/*]
|
||||
indent_style = tab
|
||||
indent_size = 4
|
||||
|
||||
[libsquish/*]
|
||||
indent_style = tab
|
||||
indent_size = 4
|
||||
|
||||
[ocornut-imgui/*]
|
||||
indent_style = space
|
||||
indent_size = 4
|
||||
|
||||
[ocornut-imgui/*.inl]
|
||||
indent_style = space
|
||||
indent_size = 4
|
||||
|
||||
[pvrtc/*]
|
||||
indent_style = space
|
||||
indent_size = 4
|
||||
|
||||
[remotery/*]
|
||||
indent_style = space
|
||||
indent_size = 4
|
||||
|
||||
[glsl-optimizer/*]
|
||||
indent_style = space
|
||||
indent_size = 3
|
|
@ -1,3 +0,0 @@
|
|||
fcpp
|
||||
*.o
|
||||
*~
|
|
@ -1,38 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 1993-2011 Daniel Stenberg
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms,
|
||||
* with or without modification, are permitted provided
|
||||
* that the following conditions are met:
|
||||
*
|
||||
* Redistributions of source code must retain the above
|
||||
* copyright notice, this list of conditions and the
|
||||
* following disclaimer.
|
||||
*
|
||||
* Redistributions in binary form must reproduce the above
|
||||
* copyright notice, this list of conditions and the following
|
||||
* disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* Neither the name of the copyright holder nor the names
|
||||
* of any other contributors may be used to endorse or
|
||||
* promote products derived from this software without
|
||||
* specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
|
||||
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
|
||||
* OF SUCH DAMAGE.
|
||||
*/
|
||||
|
|
@ -1,56 +0,0 @@
|
|||
/******************************************************************************
|
||||
* FREXXWARE
|
||||
* ----------------------------------------------------------------------------
|
||||
*
|
||||
* Project: Frexx C Preprocessor
|
||||
* $Source: /home/user/start/cpp/RCS/FPPBase.h,v $
|
||||
* $Revision: 1.3 $
|
||||
* $Date: 1993/12/06 13:51:20 $
|
||||
* $Author: start $
|
||||
* $State: Exp $
|
||||
* $Locker: start $
|
||||
*
|
||||
* ----------------------------------------------------------------------------
|
||||
* $Log: FPPBase.h,v $
|
||||
* Revision 1.3 1993/12/06 13:51:20 start
|
||||
* A lot of new stuff (too much to mention)
|
||||
*
|
||||
* Revision 1.2 1993/11/11 07:16:39 start
|
||||
* New stuff
|
||||
*
|
||||
* Revision 1.2 1993/11/11 07:16:39 start
|
||||
* New stuff
|
||||
*
|
||||
* Revision 1.1 1993/11/03 09:15:59 start
|
||||
* Initial revision
|
||||
*
|
||||
*
|
||||
*****************************************************************************/
|
||||
#ifndef FPP_BASE_H
|
||||
#define FPP_BASE_H
|
||||
|
||||
/*
|
||||
** $Filename: libraries/FPPbase.h $
|
||||
** $Release: 1.0 $
|
||||
** $Date: 1993/12/06 13:51:20 $
|
||||
**
|
||||
** (C) Copyright 1992, 1993 by FrexxWare
|
||||
** All Rights Reserved
|
||||
*/
|
||||
|
||||
#include <exec/types.h>
|
||||
#include <exec/libraries.h>
|
||||
|
||||
struct FPPBase {
|
||||
struct Library LibNode;
|
||||
UBYTE Flags;
|
||||
UBYTE pad;
|
||||
/* long word aligned */
|
||||
ULONG SysLib;
|
||||
ULONG DosLib;
|
||||
ULONG SegList;
|
||||
};
|
||||
|
||||
#define FPPNAME "fpp.library"
|
||||
|
||||
#endif
|
|
@ -1,35 +0,0 @@
|
|||
/******************************************************************************
|
||||
* FREXXWARE
|
||||
* ----------------------------------------------------------------------------
|
||||
*
|
||||
* Project: Frexx C Preprocessor
|
||||
* $Source: /home/user/start/cpp/RCS/FPP_protos.h,v $
|
||||
* $Revision: 1.3 $
|
||||
* $Date: 1993/12/06 13:51:20 $
|
||||
* $Author: start $
|
||||
* $State: Exp $
|
||||
* $Locker: start $
|
||||
*
|
||||
* ----------------------------------------------------------------------------
|
||||
* $Log: FPP_protos.h,v $
|
||||
* Revision 1.3 1993/12/06 13:51:20 start
|
||||
* A lot of new stuff (too much to mention)
|
||||
*
|
||||
* Revision 1.2 1993/11/11 07:16:39 start
|
||||
* New stuff
|
||||
*
|
||||
* Revision 1.2 1993/11/11 07:16:39 start
|
||||
* New stuff
|
||||
*
|
||||
* Revision 1.1 1993/11/03 09:15:59 start
|
||||
* Initial revision
|
||||
*
|
||||
*
|
||||
*****************************************************************************/
|
||||
/******************************************************
|
||||
*
|
||||
* FPP_protos.h
|
||||
*
|
||||
*******/
|
||||
|
||||
int fppPreProcess(struct fppTag *);
|
|
@ -1,13 +0,0 @@
|
|||
Frexx CPP (C Preprocessor)
|
||||
|
||||
Copyright (c) by Daniel Stenberg 1993 - 2011
|
||||
|
||||
This is a C preprocessor. It is a project based on public domain code, then
|
||||
forked by Daniel in 1993 and future work has been done under a BSD license.
|
||||
|
||||
The C preprocessor is now (mostly?) ANSI C compliant, and some tweaks have
|
||||
been applied to also make it fairly usable to process other data files, such
|
||||
as HTML for simple web sites.
|
||||
|
||||
WWW: http://daniel.haxx.se/projects/fcpp/
|
||||
Code: https://github.com/bagder/fcpp
|
|
@ -1,249 +0,0 @@
|
|||
/******************************************************************************
|
||||
* FREXXWARE
|
||||
* ----------------------------------------------------------------------------
|
||||
*
|
||||
* Project: Frexx C Preprocessor
|
||||
* $Source: /home/user/start/cpp/RCS/cpp.h,v $
|
||||
* $Revision: 1.3 $
|
||||
* $Date: 1993/12/06 13:51:20 $
|
||||
* $Author: start $
|
||||
* $State: Exp $
|
||||
* $Locker: start $
|
||||
*
|
||||
* ----------------------------------------------------------------------------
|
||||
* $Log: cpp.h,v $
|
||||
* Revision 1.3 1993/12/06 13:51:20 start
|
||||
* A lot of new stuff (too much to mention)
|
||||
*
|
||||
* Revision 1.2 1993/11/11 07:16:39 start
|
||||
* New stuff
|
||||
*
|
||||
* Revision 1.2 1993/11/11 07:16:39 start
|
||||
* New stuff
|
||||
*
|
||||
* Revision 1.1 1993/11/03 09:15:59 start
|
||||
* Initial revision
|
||||
*
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
/*
|
||||
* I n t e r n a l D e f i n i t i o n s f o r C P P
|
||||
*
|
||||
* In general, definitions in this file should not be changed.
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#ifndef toupper
|
||||
#define toupper(c) ((c) + ('A' - 'a'))
|
||||
#endif /* no toupper */
|
||||
#ifndef tolower
|
||||
#define tolower(c) ((c) + ('a' - 'A'))
|
||||
#endif /* no tolower */
|
||||
|
||||
#ifndef TRUE
|
||||
#define TRUE 1
|
||||
#define FALSE 0
|
||||
#endif
|
||||
#ifndef EOS
|
||||
/*
|
||||
* This is predefined in Decus C
|
||||
*/
|
||||
#define EOS '\0' /* End of string */
|
||||
#endif
|
||||
#define EOF_CHAR 0 /* Returned by get() on eof */
|
||||
#define NULLST ((char *) NULL) /* Pointer to nowhere (linted) */
|
||||
#define DEF_NOARGS (-1) /* #define foo vs #define foo() */
|
||||
|
||||
/*
|
||||
* The following may need to change if the host system doesn't use ASCII.
|
||||
*/
|
||||
#define QUOTE_PARM 0x1C /* Magic quoting operator */
|
||||
#define DEF_MAGIC 0x1D /* Magic for #defines */
|
||||
#define TOK_SEP 0x1E /* Token concatenation delim. */
|
||||
#define COM_SEP 0x1F /* Magic comment separator */
|
||||
|
||||
/*
|
||||
* Note -- in Ascii, the following will map macro formals onto DEL + the
|
||||
* C1 control character region (decimal 128 .. (128 + PAR_MAC)) which will
|
||||
* be ok as long as PAR_MAC is less than 33). Note that the last PAR_MAC
|
||||
* value is reserved for string substitution.
|
||||
*/
|
||||
|
||||
#define MAC_PARM 0x7F /* Macro formals start here */
|
||||
#ifndef OS9
|
||||
#if (PAR_MAC >= 33)
|
||||
#error "assertion fails -- PAR_MAC isn't less than 33"
|
||||
|
||||
#endif
|
||||
#endif
|
||||
#define LASTPARM (PAR_MAC - 1)
|
||||
|
||||
/*
|
||||
* Character type codes.
|
||||
*/
|
||||
|
||||
#define INV 0 /* Invalid, must be zero */
|
||||
#define OP_EOE INV /* End of expression */
|
||||
#define DIG 1 /* Digit */
|
||||
#define LET 2 /* Identifier start */
|
||||
#define FIRST_BINOP OP_ADD
|
||||
#define OP_ADD 3
|
||||
#define OP_SUB 4
|
||||
#define OP_MUL 5
|
||||
#define OP_DIV 6
|
||||
#define OP_MOD 7
|
||||
#define OP_ASL 8
|
||||
#define OP_ASR 9
|
||||
#define OP_AND 10 /* &, not && */
|
||||
#define OP_OR 11 /* |, not || */
|
||||
#define OP_XOR 12
|
||||
#define OP_EQ 13
|
||||
#define OP_NE 14
|
||||
#define OP_LT 15
|
||||
#define OP_LE 16
|
||||
#define OP_GE 17
|
||||
#define OP_GT 18
|
||||
#define OP_ANA 19 /* && */
|
||||
#define OP_ORO 20 /* || */
|
||||
#define OP_QUE 21 /* ? */
|
||||
#define OP_COL 22 /* : */
|
||||
#define OP_CMA 23 /* , (relevant?) */
|
||||
#define LAST_BINOP OP_CMA /* Last binary operand */
|
||||
/*
|
||||
* The following are unary.
|
||||
*/
|
||||
#define FIRST_UNOP OP_PLU /* First Unary operand */
|
||||
#define OP_PLU 24 /* + (draft ANSI standard) */
|
||||
#define OP_NEG 25 /* - */
|
||||
#define OP_COM 26 /* ~ */
|
||||
#define OP_NOT 27 /* ! */
|
||||
#define LAST_UNOP OP_NOT
|
||||
#define OP_LPA 28 /* ( */
|
||||
#define OP_RPA 29 /* ) */
|
||||
#define OP_END 30 /* End of expression marker */
|
||||
#define OP_MAX (OP_END + 1) /* Number of operators */
|
||||
#define OP_FAIL (OP_END + 1) /* For error returns */
|
||||
|
||||
/*
|
||||
* The following are for lexical scanning only.
|
||||
*/
|
||||
|
||||
#define QUO 65 /* Both flavors of quotation */
|
||||
#define DOT 66 /* . might start a number */
|
||||
#define SPA 67 /* Space and tab */
|
||||
#define BSH 68 /* Just a backslash */
|
||||
#define END 69 /* EOF */
|
||||
|
||||
/*
|
||||
* These bits are set in ifstack[]
|
||||
*/
|
||||
#define WAS_COMPILING 1 /* TRUE if compile set at entry */
|
||||
#define ELSE_SEEN 2 /* TRUE when #else processed */
|
||||
#define TRUE_SEEN 4 /* TRUE when #if TRUE processed */
|
||||
|
||||
/*
|
||||
* Define bits for the basic types and their adjectives
|
||||
*/
|
||||
|
||||
#define T_CHAR 1
|
||||
#define T_INT 2
|
||||
#define T_FLOAT 4
|
||||
#define T_DOUBLE 8
|
||||
#define T_SHORT 16
|
||||
#define T_LONG 32
|
||||
#define T_SIGNED 64
|
||||
#define T_UNSIGNED 128
|
||||
#define T_PTR 256 /* Pointer */
|
||||
#define T_FPTR 512 /* Pointer to functions */
|
||||
|
||||
/*
|
||||
* The DEFBUF structure stores information about #defined
|
||||
* macros. Note that the defbuf->repl information is always
|
||||
* in malloc storage.
|
||||
*/
|
||||
|
||||
typedef struct defbuf {
|
||||
struct defbuf *link; /* Next define in chain */
|
||||
char *repl; /* -> replacement */
|
||||
int hash; /* Symbol table hash */
|
||||
int nargs; /* For define(args) */
|
||||
char name[1]; /* #define name */
|
||||
} DEFBUF;
|
||||
|
||||
/*
|
||||
* The FILEINFO structure stores information about open files
|
||||
* and macros being expanded.
|
||||
*/
|
||||
|
||||
typedef struct fileinfo {
|
||||
char *bptr; /* Buffer pointer */
|
||||
int line; /* for include or macro */
|
||||
FILE *fp; /* File if non-null */
|
||||
struct fileinfo *parent; /* Link to includer */
|
||||
char *filename; /* File/macro name */
|
||||
char *progname; /* From #line statement */
|
||||
unsigned int unrecur; /* For macro recursion */
|
||||
char buffer[1]; /* current input line */
|
||||
} FILEINFO;
|
||||
|
||||
/*
|
||||
* The SIZES structure is used to store the values for #if sizeof
|
||||
*/
|
||||
|
||||
typedef struct sizes {
|
||||
short bits; /* If this bit is set, */
|
||||
short size; /* this is the datum size value */
|
||||
short psize; /* this is the pointer size */
|
||||
} SIZES;
|
||||
/*
|
||||
* nomacarg is a built-in #define on Decus C.
|
||||
*/
|
||||
|
||||
#ifdef nomacarg
|
||||
#define cput generate /* cput concatenates tokens */
|
||||
#else
|
||||
#if COMMENT_INVISIBLE
|
||||
#define cput(c) { if (c != TOK_SEP && c != COM_SEP) putchar(c); }
|
||||
#else
|
||||
#define cput(c) { if (c != TOK_SEP) putchar(c); }
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef nomacarg
|
||||
#define streq(s1, s2) (strcmp(s1, s2) == 0)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Note: IO_NORMAL and IO_ERROR are defined in the Decus C stdio.h file
|
||||
*/
|
||||
#ifndef IO_NORMAL
|
||||
#define IO_NORMAL 0
|
||||
#endif
|
||||
#ifndef IO_ERROR
|
||||
#define IO_ERROR 1
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Externs
|
||||
*/
|
||||
|
||||
#include "fpp.h" /* structs and defines */
|
||||
#include "cppadd.h" /* Added prototypes for ANSI complience! */
|
||||
|
||||
#ifdef AMIGA
|
||||
#include <dos.h>
|
||||
extern int _OSERR;
|
||||
#endif
|
||||
|
||||
extern char type[]; /* Character classifier */
|
||||
|
||||
#define compiling global->ifstack[0]
|
||||
#if DEBUG
|
||||
extern int debug; /* Debug level */
|
||||
#endif
|
||||
extern SIZES size_table[]; /* For #if sizeof sizes */
|
||||
|
||||
#define MAX_SPACE_SIZE 512 /* maximum number of whitespaces possible
|
||||
to remember */
|
|
@ -1,600 +0,0 @@
|
|||
/******************************************************************************
|
||||
Copyright (c) 1993 - 2011 Daniel Stenberg
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
******************************************************************************/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <ctype.h>
|
||||
#include "cppdef.h"
|
||||
#include "cpp.h"
|
||||
|
||||
#if defined(AMIGA)
|
||||
#include <dos.h>
|
||||
#if defined(SHARED)
|
||||
int _OSERR=0;
|
||||
char *_ProgramName="junk";
|
||||
void __stdargs _XCEXIT(long a) { return; }
|
||||
#endif
|
||||
#endif
|
||||
|
||||
FILE_LOCAL ReturnCode output(struct Global *, int); /* Output one character */
|
||||
FILE_LOCAL void sharp(struct Global *);
|
||||
INLINE FILE_LOCAL ReturnCode cppmain(struct Global *);
|
||||
|
||||
int fppPreProcess(struct fppTag *tags)
|
||||
{
|
||||
size_t i=0;
|
||||
ReturnCode ret; /* cpp return code */
|
||||
int retVal; /* fppPreProcess return code */
|
||||
struct Global *global;
|
||||
|
||||
global=(struct Global *)malloc(sizeof(struct Global));
|
||||
if(!global)
|
||||
return(FPP_OUT_OF_MEMORY);
|
||||
|
||||
memset(global, 0, sizeof(struct Global));
|
||||
|
||||
global->infile=NULL;
|
||||
global->line=0;
|
||||
global->wrongline=0;
|
||||
global->errors=0;
|
||||
global->recursion=0;
|
||||
global->rec_recover=TRUE;
|
||||
global->instring=FALSE;
|
||||
global->inmacro=FALSE;
|
||||
global->workp=NULL;
|
||||
global->keepcomments = FALSE; /* Write out comments flag */
|
||||
global->cflag = FALSE; /* -C option (keep comments) */
|
||||
global->eflag = FALSE; /* -E option (never fail) */
|
||||
global->nflag = 0; /* -N option (no predefines) */
|
||||
global->wflag = FALSE; /* -W option (write #defines) */
|
||||
|
||||
global->ifstack[0]=TRUE; /* #if information */
|
||||
global->ifptr = global->ifstack;
|
||||
global->incend = global->incdir;
|
||||
|
||||
/* names defined at cpp start */
|
||||
global->preset[0]="frexxcpp"; /* This is the Frexx cpp program */
|
||||
#if defined( amiga )
|
||||
global->preset[1]="amiga";
|
||||
global->preset[2]="m68000";
|
||||
global->preset[3]="amigados";
|
||||
global->preset[4]= NULL; /* Must be last */
|
||||
#elif defined( unix )
|
||||
global->preset[1]="unix";
|
||||
global->preset[2]= NULL;
|
||||
#endif
|
||||
|
||||
/* Note: order is important */
|
||||
global->magic[0] = "__LINE__";
|
||||
global->magic[1] = "__FILE__";
|
||||
global->magic[2] = "__FUNCTION__";
|
||||
global->magic[3] = "__FUNC_LINE__";
|
||||
global->magic[4] = NULL; /* Must be last */
|
||||
|
||||
global->funcline = 0;
|
||||
|
||||
global->cplusplus=1;
|
||||
global->sharpfilename=NULL;
|
||||
|
||||
global->parmp=NULL;
|
||||
global->nargs=0;
|
||||
|
||||
global->macro=NULL;
|
||||
global->evalue=0;
|
||||
|
||||
global->depends=NULL;
|
||||
global->input=NULL;
|
||||
global->output=NULL;
|
||||
global->error=NULL;
|
||||
global->first_file=NULL;
|
||||
global->userdata=NULL;
|
||||
|
||||
global->linelines=TRUE;
|
||||
global->warnillegalcpp = FALSE;
|
||||
global->outputLINE = TRUE;
|
||||
global->warnnoinclude = TRUE;
|
||||
global->showversion = TRUE;
|
||||
global->showincluded = FALSE;
|
||||
global->showspace = FALSE;
|
||||
global->nestcomments = FALSE;
|
||||
global->warnnestcomments = FALSE;
|
||||
global->outputfile = TRUE;
|
||||
global->included = 0;
|
||||
|
||||
global->comment = FALSE;
|
||||
global->rightconcat = FALSE;
|
||||
global->work[0] = '\0';
|
||||
global->initialfunc = NULL;
|
||||
|
||||
memset(global->symtab, 0, SBSIZE * sizeof(DEFBUF *));
|
||||
|
||||
ret=initdefines(global); /* O.S. specific def's */
|
||||
if(ret)
|
||||
return(ret);
|
||||
dooptions(global, tags); /* Command line -flags */
|
||||
ret=addfile(global, stdin, global->work); /* "open" main input file */
|
||||
|
||||
global->out = global->outputfile;
|
||||
|
||||
if(!ret)
|
||||
ret=cppmain(global); /* Process main file */
|
||||
if ((i = (global->ifptr - global->ifstack)) != 0) {
|
||||
#if OLD_PREPROCESSOR
|
||||
cwarn(global, ERROR_IFDEF_DEPTH, i);
|
||||
#else
|
||||
cerror(global, ERROR_IFDEF_DEPTH, i);
|
||||
#endif
|
||||
}
|
||||
fflush(stdout);
|
||||
// BK - fclose(stdout);
|
||||
delalldefines(global);
|
||||
|
||||
retVal = IO_NORMAL;
|
||||
if (global->errors > 0 && !global->eflag)
|
||||
retVal = IO_ERROR;
|
||||
free(global->tokenbuf);
|
||||
free(global->functionname);
|
||||
free(global->spacebuf);
|
||||
free(global);
|
||||
return retVal; /* No errors or -E option set */
|
||||
}
|
||||
|
||||
INLINE FILE_LOCAL
|
||||
ReturnCode cppmain(struct Global *global)
|
||||
{
|
||||
/*
|
||||
* Main process for cpp -- copies tokens from the current input
|
||||
* stream (main file, include file, or a macro) to the output
|
||||
* file.
|
||||
*/
|
||||
|
||||
int c; /* Current character */
|
||||
int counter; /* newlines and spaces */
|
||||
ReturnCode ret; /* return code variable type */
|
||||
|
||||
long bracelevel = 0;
|
||||
long parenlevel = 0;
|
||||
long bracketlevel = 0;
|
||||
int fake = 0;
|
||||
|
||||
#define MAX_FUNC_LENGTH 50
|
||||
|
||||
char tempfunc[MAX_FUNC_LENGTH + 1];
|
||||
char tempfunc2[MAX_FUNC_LENGTH + 1];
|
||||
char define = 0; /* probability of a function define phase in the program */
|
||||
char prev = 0; /* previous type */
|
||||
char go = 0;
|
||||
char include = 0;
|
||||
char initfunc = 0;
|
||||
|
||||
/* Initialize for reading tokens */
|
||||
global->tokenbsize = 50;
|
||||
global->tokenbuf = malloc(global->tokenbsize + 1);
|
||||
if(!global->tokenbuf)
|
||||
return(FPP_OUT_OF_MEMORY);
|
||||
|
||||
global->functionname = malloc(global->tokenbsize + 1);
|
||||
if(!global->functionname)
|
||||
return(FPP_OUT_OF_MEMORY);
|
||||
global->functionname[0] = '\0';
|
||||
|
||||
if(global->showspace) {
|
||||
global->spacebuf = (char *)malloc(MAX_SPACE_SIZE);
|
||||
if(!global->spacebuf)
|
||||
return(FPP_OUT_OF_MEMORY);
|
||||
}
|
||||
|
||||
if(global->showversion)
|
||||
Error(global, VERSION_TEXT);
|
||||
|
||||
/*
|
||||
* Explicitly output a #line at the start of cpp output so
|
||||
* that lint (etc.) knows the name of the original source
|
||||
* file. If we don't do this explicitly, we may get
|
||||
* the name of the first #include file instead.
|
||||
*/
|
||||
if(global->linelines) /* if #line lines are wanted! */
|
||||
sharp(global);
|
||||
/*
|
||||
* This loop is started "from the top" at the beginning of each line
|
||||
* wrongline is set TRUE in many places if it is necessary to write
|
||||
* a #line record. (But we don't write them when expanding macros.)
|
||||
*
|
||||
* The counter variable has two different uses: at
|
||||
* the start of a line, it counts the number of blank lines that
|
||||
* have been skipped over. These are then either output via
|
||||
* #line records or by outputting explicit blank lines.
|
||||
* When expanding tokens within a line, the counter remembers
|
||||
* whether a blank/tab has been output. These are dropped
|
||||
* at the end of the line, and replaced by a single blank
|
||||
* within lines.
|
||||
*/
|
||||
|
||||
include = global->included;
|
||||
|
||||
while(include--) {
|
||||
openinclude(global, global->include[(unsigned)include], TRUE);
|
||||
}
|
||||
|
||||
for (;;) {
|
||||
counter = 0; /* Count empty lines */
|
||||
for (;;) { /* For each line, ... */
|
||||
global->comment = FALSE; /* No comment yet! */
|
||||
global->chpos = 0; /* Count whitespaces */
|
||||
while (type[(c = get(global))] == SPA) /* Skip leading blanks */
|
||||
if(global->showspace) {
|
||||
if(global->chpos<MAX_SPACE_SIZE-1)
|
||||
/* we still have buffer to store this! */
|
||||
global->spacebuf[global->chpos++]=(char)c;
|
||||
}
|
||||
if (c == '\n') { /* If line's all blank, */
|
||||
if(global->comment) {
|
||||
/* A comment was output! */
|
||||
Putchar(global, '\n');
|
||||
}
|
||||
else
|
||||
++counter; /* Do nothing now */
|
||||
}
|
||||
else if (c == '#') { /* Is 1st non-space '#' */
|
||||
global->keepcomments = FALSE; /* Don't pass comments */
|
||||
ret = control(global, &counter); /* Yes, do a #command */
|
||||
if(ret)
|
||||
return(ret);
|
||||
global->keepcomments = (global->cflag && compiling);
|
||||
}
|
||||
else if (c == EOF_CHAR) /* At end of file? */
|
||||
break;
|
||||
else if (!compiling) { /* #ifdef false? */
|
||||
skipnl(global); /* Skip to newline */
|
||||
counter++; /* Count it, too. */
|
||||
} else {
|
||||
break; /* Actual token */
|
||||
}
|
||||
}
|
||||
if (c == EOF_CHAR) /* Exit process at */
|
||||
break; /* End of file */
|
||||
/*
|
||||
* If the loop didn't terminate because of end of file, we
|
||||
* know there is a token to compile. First, clean up after
|
||||
* absorbing newlines. counter has the number we skipped.
|
||||
*/
|
||||
if(global->linelines) { /* if #line lines are wanted! */
|
||||
if ((global->wrongline && global->infile->fp != NULL) || counter > 4)
|
||||
sharp(global); /* Output # line number */
|
||||
else { /* If just a few, stuff */
|
||||
while (--counter >= 0) /* them out ourselves */
|
||||
Putchar(global, (int)'\n');
|
||||
}
|
||||
}
|
||||
if(global->showspace) {
|
||||
/* Show all whitespaces! */
|
||||
global->spacebuf[global->chpos] = '\0';
|
||||
Putstring(global, global->spacebuf);
|
||||
}
|
||||
|
||||
/*
|
||||
* Process each token on this line.
|
||||
*/
|
||||
unget(global); /* Reread the char. */
|
||||
for (;;) { /* For the whole line, */
|
||||
do { /* Token concat. loop */
|
||||
for (global->chpos = counter = 0; type[(c = get(global))] == SPA;) {
|
||||
#if COMMENT_INVISIBLE
|
||||
if (c != COM_SEP)
|
||||
counter++;
|
||||
#else
|
||||
if(global->showspace && global->chpos < MAX_SPACE_SIZE-1) {
|
||||
global->spacebuf[global->chpos++]=(char)c;
|
||||
}
|
||||
counter++; /* Skip over blanks */
|
||||
#endif
|
||||
}
|
||||
if (c == EOF_CHAR || c == '\n')
|
||||
break; /* Exit line loop */
|
||||
else if (counter > 0) { /* If we got any spaces */
|
||||
if(!global->showspace) /* We don't output all spaces */
|
||||
Putchar(global, (int)' ');/* Output one space */
|
||||
else {
|
||||
global->spacebuf[global->chpos] = '\0';
|
||||
Putstring(global, global->spacebuf); /* Output all whitespaces */
|
||||
}
|
||||
}
|
||||
if((ret=macroid(global, &c))) /* Grab the token */
|
||||
return(ret);
|
||||
} while (type[c] == LET && catenate(global, &ret) && !ret);
|
||||
if(ret)
|
||||
/* If the loop was broken because of a fatal error! */
|
||||
return(ret);
|
||||
if (c == EOF_CHAR || c == '\n') /* From macro exp error */
|
||||
break; /* Exit line loop */
|
||||
go++;
|
||||
switch (type[c]) {
|
||||
case LET:
|
||||
go =0;
|
||||
/* Quite ordinary token */
|
||||
Putstring(global, global->tokenbuf);
|
||||
|
||||
if(!define) {
|
||||
/* Copy the name */
|
||||
strncpy(tempfunc, global->tokenbuf, MAX_FUNC_LENGTH);
|
||||
tempfunc[MAX_FUNC_LENGTH]=0;
|
||||
}
|
||||
/* fputs(global->tokenbuf, stdout); */
|
||||
break;
|
||||
case DIG: /* Output a number */
|
||||
case DOT: /* Dot may begin floats */
|
||||
go = 0;
|
||||
ret=scannumber(global, c, (ReturnCode(*)(struct Global *, int))output);
|
||||
if(ret)
|
||||
return(ret);
|
||||
break;
|
||||
case QUO: /* char or string const */
|
||||
go = 0;
|
||||
/* Copy it to output */
|
||||
if(!global->webmode) {
|
||||
ret=scanstring(global, c,
|
||||
(ReturnCode(*)(struct Global *, int))output);
|
||||
if(ret)
|
||||
return(ret);
|
||||
break;
|
||||
}
|
||||
/* FALLTHROUGH */
|
||||
default: /* Some other character */
|
||||
|
||||
define++;
|
||||
switch(c) {
|
||||
case '{':
|
||||
if(! bracelevel++ && define > 2) {
|
||||
/*
|
||||
* This is a starting brace. If there is a probability of a
|
||||
* function defining, we copy the `tempfunc' function name to
|
||||
* `global->functionname'.
|
||||
*/
|
||||
strcpy(global->functionname, tempfunc2);
|
||||
global->funcline = global->line;
|
||||
|
||||
if(global->outputfunctions) {
|
||||
/*
|
||||
* Output the discovered function name to stderr!
|
||||
*/
|
||||
Error(global, "#> Function defined at line %d: %s <#\n",
|
||||
global->line,
|
||||
global->functionname);
|
||||
}
|
||||
|
||||
if(global->initialfunc) {
|
||||
int a;
|
||||
for(a=0; a<global->excluded; a++) {
|
||||
/* check for excluded functions */
|
||||
if(!strcmp(global->functionname,
|
||||
global->excludedinit[a]))
|
||||
break;
|
||||
}
|
||||
if(a==global->excluded) {
|
||||
expstuff(global, "__brace__", "{");
|
||||
expstuff(global, "__init_func__", global->initialfunc);
|
||||
initfunc = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
break;
|
||||
case '}':
|
||||
go = 0;
|
||||
if( (--bracelevel == initfunc) &&
|
||||
strcmp(global->infile->filename, "__init_func__") ) {
|
||||
/* we just stepped out of the function! */
|
||||
global->functionname[0] = '\0';
|
||||
global->funcline = 0;
|
||||
define = 1;
|
||||
|
||||
if(initfunc) {
|
||||
Putchar(global, '}');
|
||||
bracelevel--;
|
||||
initfunc=0;
|
||||
}
|
||||
}
|
||||
fake = 0;
|
||||
break;
|
||||
|
||||
case ';':
|
||||
case ',':
|
||||
if(go == 2) {
|
||||
define = 1;
|
||||
fake = 0;
|
||||
go--;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case '(':
|
||||
if(! parenlevel++ && !bracelevel) {
|
||||
if(go == 2) {
|
||||
/* foobar(text) -> "(" is found. This can't be a
|
||||
function */
|
||||
go--;
|
||||
define = 1;
|
||||
break;
|
||||
}
|
||||
if( define < 2 && prev == LET) {
|
||||
/* This is the first parenthesis on the ground brace
|
||||
level, and we did previously not have a probable
|
||||
function name */
|
||||
strncpy(tempfunc2, global->tokenbuf, MAX_FUNC_LENGTH);
|
||||
tempfunc2[MAX_FUNC_LENGTH]=0;
|
||||
define++;
|
||||
}
|
||||
else {
|
||||
/* we have a fake start */
|
||||
fake++;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case ')':
|
||||
if(! --parenlevel && !bracelevel && define>1 && !fake) {
|
||||
/*
|
||||
* The starting parentheses level and
|
||||
* the starting brace level.
|
||||
* This might be the start of a function defining coming
|
||||
* up!
|
||||
*/
|
||||
define++; /* increase probability */
|
||||
fake = 0;
|
||||
go = 1;
|
||||
}
|
||||
break;
|
||||
case '[':
|
||||
bracketlevel++;
|
||||
break;
|
||||
case ']':
|
||||
bracketlevel--;
|
||||
break;
|
||||
}
|
||||
define--; /* decrease function probability */
|
||||
|
||||
Putchar(global, c); /* Just output it */
|
||||
break;
|
||||
} /* Switch ends */
|
||||
prev = type[c];
|
||||
} /* Line for loop */
|
||||
|
||||
if (c == '\n') { /* Compiling at EOL? */
|
||||
Putchar(global, '\n'); /* Output newline, if */
|
||||
if (global->infile->fp == NULL) /* Expanding a macro, */
|
||||
global->wrongline = TRUE; /* Output # line later */
|
||||
}
|
||||
} /* Continue until EOF */
|
||||
|
||||
if(global->showbalance) {
|
||||
if(bracketlevel) {
|
||||
cwarn(global, WARN_BRACKET_DEPTH, bracketlevel);
|
||||
}
|
||||
if(parenlevel) {
|
||||
cwarn(global, WARN_PAREN_DEPTH, parenlevel);
|
||||
}
|
||||
if(bracelevel) {
|
||||
cwarn(global, WARN_BRACE_DEPTH, bracelevel);
|
||||
}
|
||||
}
|
||||
if (global->wflag) {
|
||||
global->out = TRUE; /* enable output */
|
||||
outdefines(global); /* Write out #defines */
|
||||
}
|
||||
return(FPP_OK);
|
||||
}
|
||||
|
||||
FILE_LOCAL
|
||||
ReturnCode output(struct Global *global, int c)
|
||||
{
|
||||
/*
|
||||
* Output one character to stdout -- output() is passed as an
|
||||
* argument to scanstring()
|
||||
*/
|
||||
#if COMMENT_INVISIBLE
|
||||
if (c != TOK_SEP && c != COM_SEP)
|
||||
#else
|
||||
if (c != TOK_SEP)
|
||||
#endif
|
||||
Putchar(global, c);
|
||||
return(FPP_OK);
|
||||
}
|
||||
|
||||
void Putchar(struct Global *global, int c)
|
||||
{
|
||||
/*
|
||||
* Output one character to stdout or to output function!
|
||||
*/
|
||||
if(!global->out)
|
||||
return;
|
||||
#if defined(UNIX)
|
||||
if(global->output)
|
||||
global->output(c, global->userdata);
|
||||
else
|
||||
putchar(c);
|
||||
#else /* amiga */
|
||||
global->output(c, global->userdata);
|
||||
#endif
|
||||
}
|
||||
|
||||
void Putstring(struct Global *global, char *string)
|
||||
{
|
||||
/*
|
||||
* Output a string! One letter at a time to the Putchar routine!
|
||||
*/
|
||||
|
||||
if(!string)
|
||||
return;
|
||||
|
||||
while(*string)
|
||||
Putchar(global, *string++);
|
||||
}
|
||||
|
||||
void Putint(struct Global *global, int number)
|
||||
{
|
||||
/*
|
||||
* Output the number as a string.
|
||||
*/
|
||||
|
||||
char buffer[16]; /* an integer can't be that big! */
|
||||
char *point=buffer;
|
||||
|
||||
sprintf(buffer, "%d", number);
|
||||
|
||||
while(*point)
|
||||
Putchar(global, *point++);
|
||||
}
|
||||
|
||||
|
||||
FILE_LOCAL
|
||||
void sharp(struct Global *global)
|
||||
{
|
||||
/*
|
||||
* Output a line number line.
|
||||
*/
|
||||
|
||||
char *name;
|
||||
if (global->keepcomments) /* Make sure # comes on */
|
||||
Putchar(global, '\n'); /* a fresh, new line. */
|
||||
/* printf("#%s %d", LINE_PREFIX, global->line); */
|
||||
|
||||
Putchar(global, '#');
|
||||
if(global->outputLINE)
|
||||
Putstring(global, LINE_PREFIX);
|
||||
Putchar(global, ' ');
|
||||
Putint(global, global->line);
|
||||
|
||||
if (global->infile->fp != NULL) {
|
||||
name = (global->infile->progname != NULL)
|
||||
? global->infile->progname : global->infile->filename;
|
||||
if (global->sharpfilename == NULL
|
||||
|| (global->sharpfilename != NULL && !streq(name, global->sharpfilename))) {
|
||||
if (global->sharpfilename != NULL)
|
||||
free(global->sharpfilename);
|
||||
global->sharpfilename = savestring(global, name);
|
||||
/* printf(" \"%s\"", name); */
|
||||
Putstring(global, " \"");
|
||||
Putstring(global, name);
|
||||
Putchar(global, '\"');
|
||||
}
|
||||
}
|
||||
Putchar(global, '\n');
|
||||
global->wrongline = FALSE;
|
||||
return;
|
||||
}
|
|
@ -1,773 +0,0 @@
|
|||
/******************************************************************************
|
||||
Copyright (c) 1999 Daniel Stenberg
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
******************************************************************************/
|
||||
#include <stdio.h>
|
||||
#include <ctype.h>
|
||||
#include "cppdef.h"
|
||||
#include "cpp.h"
|
||||
|
||||
#ifdef _AMIGA
|
||||
#include <proto/dos.h>
|
||||
#endif
|
||||
|
||||
FILE_LOCAL void dump_line(struct Global *, int *);
|
||||
FILE_LOCAL ReturnCode doif(struct Global *, int);
|
||||
INLINE FILE_LOCAL ReturnCode doinclude(struct Global *);
|
||||
INLINE FILE_LOCAL int hasdirectory(char *, char *);
|
||||
|
||||
|
||||
/*
|
||||
* Generate (by hand-inspection) a set of unique values for each control
|
||||
* operator. Note that this is not guaranteed to work for non-Ascii
|
||||
* machines. CPP won't compile if there are hash conflicts.
|
||||
*/
|
||||
|
||||
#define L_assert ('a' + ('s' << 1))
|
||||
#define L_define ('d' + ('f' << 1))
|
||||
#define L_elif ('e' + ('i' << 1))
|
||||
#define L_else ('e' + ('s' << 1))
|
||||
#define L_endif ('e' + ('d' << 1))
|
||||
#define L_error ('e' + ('r' << 1))
|
||||
#define L_if ('i' + (EOS << 1))
|
||||
#define L_ifdef ('i' + ('d' << 1))
|
||||
#define L_ifndef ('i' + ('n' << 1))
|
||||
#define L_include ('i' + ('c' << 1))
|
||||
#define L_line ('l' + ('n' << 1))
|
||||
#define L_nogood (EOS + (EOS << 1)) /* To catch #i */
|
||||
#define L_pragma ('p' + ('a' << 1))
|
||||
#define L_undef ('u' + ('d' << 1))
|
||||
|
||||
ReturnCode control( struct Global *global,
|
||||
int *counter ) /* Pending newline counter */
|
||||
{
|
||||
/*
|
||||
* Process #control lines. Simple commands are processed inline,
|
||||
* while complex commands have their own subroutines.
|
||||
*
|
||||
* The counter is used to force out a newline before #line, and
|
||||
* #pragma commands. This prevents these commands from ending up at
|
||||
* the end of the previous line if cpp is invoked with the -C option.
|
||||
*/
|
||||
|
||||
int c;
|
||||
char *tp;
|
||||
int hash;
|
||||
char *ep;
|
||||
ReturnCode ret;
|
||||
|
||||
c = skipws( global );
|
||||
|
||||
if( c == '\n' || c == EOF_CHAR )
|
||||
{
|
||||
(*counter)++;
|
||||
|
||||
return(FPP_OK);
|
||||
}
|
||||
|
||||
if( !isdigit(c) )
|
||||
scanid( global, c ); /* Get #word to tokenbuf */
|
||||
else
|
||||
{
|
||||
unget( global ); /* Hack -- allow #123 as a */
|
||||
|
||||
strcpy( global->tokenbuf, "line" ); /* synonym for #line 123 */
|
||||
}
|
||||
|
||||
hash = (global->tokenbuf[1] == EOS) ? L_nogood : (global->tokenbuf[0] + (global->tokenbuf[2] << 1));
|
||||
|
||||
switch( hash )
|
||||
{
|
||||
case L_assert:
|
||||
tp = "assert";
|
||||
break;
|
||||
case L_define:
|
||||
tp = "define";
|
||||
break;
|
||||
case L_elif:
|
||||
tp = "elif";
|
||||
break;
|
||||
case L_else:
|
||||
tp = "else";
|
||||
break;
|
||||
case L_endif:
|
||||
tp = "endif";
|
||||
break;
|
||||
case L_error:
|
||||
tp = "error";
|
||||
break;
|
||||
case L_if:
|
||||
tp = "if";
|
||||
break;
|
||||
case L_ifdef:
|
||||
tp = "ifdef";
|
||||
break;
|
||||
case L_ifndef:
|
||||
tp = "ifndef";
|
||||
break;
|
||||
case L_include:
|
||||
tp = "include";
|
||||
break;
|
||||
case L_line:
|
||||
tp = "line";
|
||||
break;
|
||||
case L_pragma:
|
||||
tp = "pragma";
|
||||
break;
|
||||
case L_undef:
|
||||
tp = "undef";
|
||||
break;
|
||||
default:
|
||||
hash = L_nogood;
|
||||
case L_nogood:
|
||||
tp = "";
|
||||
break;
|
||||
}
|
||||
|
||||
if( !streq( tp, global->tokenbuf ) )
|
||||
hash = L_nogood;
|
||||
|
||||
/*
|
||||
* hash is set to a unique value corresponding to the
|
||||
* control keyword (or L_nogood if we think it's nonsense).
|
||||
*/
|
||||
if( global->infile->fp == NULL )
|
||||
cwarn( global, WARN_CONTROL_LINE_IN_MACRO, global->tokenbuf );
|
||||
|
||||
if( !compiling )
|
||||
{ /* Not compiling now */
|
||||
switch( hash )
|
||||
{
|
||||
case L_if: /* These can't turn */
|
||||
case L_ifdef: /* compilation on, but */
|
||||
case L_ifndef: /* we must nest #if's */
|
||||
if( ++global->ifptr >= &global->ifstack[BLK_NEST] )
|
||||
{
|
||||
cfatal( global, FATAL_TOO_MANY_NESTINGS, global->tokenbuf );
|
||||
|
||||
return( FPP_TOO_MANY_NESTED_STATEMENTS );
|
||||
}
|
||||
|
||||
*global->ifptr = 0; /* !WAS_COMPILING */
|
||||
|
||||
case L_line: /* Many */
|
||||
/*
|
||||
* Are pragma's always processed?
|
||||
*/
|
||||
case L_pragma: /* options */
|
||||
case L_include: /* are uninteresting */
|
||||
case L_define: /* if we */
|
||||
case L_undef: /* aren't */
|
||||
case L_assert: /* compiling. */
|
||||
case L_error:
|
||||
dump_line( global, counter ); /* Ignore rest of line */
|
||||
return(FPP_OK);
|
||||
}
|
||||
}
|
||||
/*
|
||||
* Make sure that #line and #pragma are output on a fresh line.
|
||||
*/
|
||||
if( *counter > 0 && (hash == L_line || hash == L_pragma) )
|
||||
{
|
||||
Putchar( global, '\n' );
|
||||
|
||||
(*counter)--;
|
||||
}
|
||||
|
||||
switch( hash )
|
||||
{
|
||||
case L_line:
|
||||
/*
|
||||
* Parse the line to update the line number and "progname"
|
||||
* field and line number for the next input line.
|
||||
* Set wrongline to force it out later.
|
||||
*/
|
||||
c = skipws( global );
|
||||
|
||||
global->workp = global->work; /* Save name in work */
|
||||
|
||||
while( c != '\n' && c != EOF_CHAR )
|
||||
{
|
||||
if( (ret = save( global, c )) )
|
||||
return(ret);
|
||||
|
||||
c = get( global );
|
||||
}
|
||||
|
||||
unget( global );
|
||||
|
||||
if( (ret = save( global, EOS )) )
|
||||
return(ret);
|
||||
|
||||
/*
|
||||
* Split #line argument into <line-number> and <name>
|
||||
* We subtract 1 as we want the number of the next line.
|
||||
*/
|
||||
global->line = atoi(global->work) - 1; /* Reset line number */
|
||||
|
||||
for( tp = global->work; isdigit(*tp) || type[(unsigned)*tp] == SPA; tp++)
|
||||
; /* Skip over digits */
|
||||
|
||||
if( *tp != EOS )
|
||||
{
|
||||
/* Got a filename, so: */
|
||||
|
||||
if( *tp == '"' && (ep = strrchr(tp + 1, '"')) != NULL )
|
||||
{
|
||||
tp++; /* Skip over left quote */
|
||||
|
||||
*ep = EOS; /* And ignore right one */
|
||||
}
|
||||
|
||||
if( global->infile->progname != NULL )
|
||||
/* Give up the old name if it's allocated. */
|
||||
free( global->infile->progname );
|
||||
|
||||
global->infile->progname = savestring( global, tp );
|
||||
}
|
||||
|
||||
global->wrongline = TRUE; /* Force output later */
|
||||
break;
|
||||
|
||||
case L_include:
|
||||
ret = doinclude( global );
|
||||
if( ret )
|
||||
return(ret);
|
||||
break;
|
||||
|
||||
case L_define:
|
||||
ret = dodefine( global );
|
||||
if( ret )
|
||||
return(ret);
|
||||
break;
|
||||
|
||||
case L_undef:
|
||||
doundef( global );
|
||||
break;
|
||||
|
||||
case L_else:
|
||||
if( global->ifptr == &global->ifstack[0] )
|
||||
{
|
||||
cerror( global, ERROR_STRING_MUST_BE_IF, global->tokenbuf );
|
||||
|
||||
dump_line( global, counter );
|
||||
|
||||
return( FPP_OK );
|
||||
}
|
||||
else if( (*global->ifptr & ELSE_SEEN) != 0 )
|
||||
{
|
||||
cerror( global, ERROR_STRING_MAY_NOT_FOLLOW_ELSE, global->tokenbuf );
|
||||
|
||||
dump_line( global, counter );
|
||||
|
||||
return( FPP_OK );
|
||||
}
|
||||
|
||||
*global->ifptr |= ELSE_SEEN;
|
||||
|
||||
if( (*global->ifptr & WAS_COMPILING) != 0 )
|
||||
{
|
||||
if( compiling || (*global->ifptr & TRUE_SEEN) != 0 )
|
||||
compiling = FALSE;
|
||||
else
|
||||
{
|
||||
compiling = TRUE;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case L_elif:
|
||||
if( global->ifptr == &global->ifstack[0] )
|
||||
{
|
||||
cerror( global, ERROR_STRING_MUST_BE_IF, global->tokenbuf );
|
||||
|
||||
dump_line( global, counter );
|
||||
|
||||
return( FPP_OK );
|
||||
}
|
||||
else if( (*global->ifptr & ELSE_SEEN) != 0 )
|
||||
{
|
||||
cerror( global, ERROR_STRING_MAY_NOT_FOLLOW_ELSE, global->tokenbuf );
|
||||
|
||||
dump_line( global, counter );
|
||||
|
||||
return( FPP_OK );
|
||||
}
|
||||
|
||||
if( (*global->ifptr & (WAS_COMPILING | TRUE_SEEN)) != WAS_COMPILING )
|
||||
{
|
||||
compiling = FALSE; /* Done compiling stuff */
|
||||
|
||||
dump_line( global, counter ); /* Skip this clause */
|
||||
|
||||
return( FPP_OK );
|
||||
}
|
||||
|
||||
ret = doif( global, L_if );
|
||||
|
||||
if( ret )
|
||||
return(ret);
|
||||
|
||||
break;
|
||||
|
||||
case L_error:
|
||||
cerror(global, ERROR_ERROR);
|
||||
break;
|
||||
|
||||
case L_if:
|
||||
case L_ifdef:
|
||||
case L_ifndef:
|
||||
if( ++global->ifptr < &global->ifstack[BLK_NEST] )
|
||||
{
|
||||
*global->ifptr = WAS_COMPILING;
|
||||
|
||||
ret = doif( global, hash );
|
||||
|
||||
if( ret )
|
||||
return(ret);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
cfatal( global, FATAL_TOO_MANY_NESTINGS, global->tokenbuf );
|
||||
|
||||
return( FPP_TOO_MANY_NESTED_STATEMENTS );
|
||||
|
||||
case L_endif:
|
||||
if( global->ifptr == &global->ifstack[0] )
|
||||
{
|
||||
cerror( global, ERROR_STRING_MUST_BE_IF, global->tokenbuf );
|
||||
|
||||
dump_line( global, counter );
|
||||
|
||||
return(FPP_OK);
|
||||
}
|
||||
|
||||
if( !compiling && (*global->ifptr & WAS_COMPILING) != 0 )
|
||||
global->wrongline = TRUE;
|
||||
|
||||
compiling = ((*global->ifptr & WAS_COMPILING) != 0);
|
||||
|
||||
--global->ifptr;
|
||||
|
||||
break;
|
||||
|
||||
case L_assert:
|
||||
{
|
||||
int result;
|
||||
|
||||
ret = eval( global, &result );
|
||||
|
||||
if(ret)
|
||||
return(ret);
|
||||
|
||||
if( result == 0 )
|
||||
cerror( global, ERROR_PREPROC_FAILURE );
|
||||
}
|
||||
break;
|
||||
|
||||
case L_pragma:
|
||||
/*
|
||||
* #pragma is provided to pass "options" to later
|
||||
* passes of the compiler. cpp doesn't have any yet.
|
||||
*/
|
||||
Putstring( global, "#pragma " );
|
||||
|
||||
while( (c = get( global ) ) != '\n' && c != EOF_CHAR )
|
||||
Putchar( global, c );
|
||||
|
||||
unget( global );
|
||||
|
||||
Putchar( global, '\n' );
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
/*
|
||||
* Undefined #control keyword.
|
||||
* Note: the correct behavior may be to warn and
|
||||
* pass the line to a subsequent compiler pass.
|
||||
* This would allow #asm or similar extensions.
|
||||
*/
|
||||
if( global->warnillegalcpp )
|
||||
cwarn( global, WARN_ILLEGAL_COMMAND, global->tokenbuf );
|
||||
|
||||
Putchar( global, '#' );
|
||||
Putstring( global, global->tokenbuf );
|
||||
Putchar( global, ' ' );
|
||||
|
||||
while( (c = get( global ) ) != '\n' && c != EOF_CHAR )
|
||||
Putchar( global, c );
|
||||
|
||||
unget( global );
|
||||
|
||||
Putchar( global, '\n' );
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
if( hash != L_include )
|
||||
{
|
||||
#if OLD_PREPROCESSOR
|
||||
/*
|
||||
* Ignore the rest of the #control line so you can write
|
||||
* #if foo
|
||||
* #endif foo
|
||||
*/
|
||||
dump_line( global, counter ); /* Take common exit */
|
||||
|
||||
return( FPP_OK );
|
||||
#else
|
||||
if( skipws( global ) != '\n' )
|
||||
{
|
||||
cwarn( global, WARN_UNEXPECTED_TEXT_IGNORED );
|
||||
|
||||
skipnl( global );
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
(*counter)++;
|
||||
|
||||
return( FPP_OK );
|
||||
}
|
||||
|
||||
FILE_LOCAL
|
||||
void dump_line(struct Global *global, int *counter)
|
||||
{
|
||||
skipnl( global ); /* Ignore rest of line */
|
||||
|
||||
(*counter)++;
|
||||
}
|
||||
|
||||
FILE_LOCAL
|
||||
ReturnCode doif(struct Global *global, int hash)
|
||||
{
|
||||
/*
|
||||
* Process an #if, #ifdef, or #ifndef. The latter two are straightforward,
|
||||
* while #if needs a subroutine of its own to evaluate the expression.
|
||||
*
|
||||
* doif() is called only if compiling is TRUE. If false, compilation
|
||||
* is always supressed, so we don't need to evaluate anything. This
|
||||
* supresses unnecessary warnings.
|
||||
*/
|
||||
|
||||
int c;
|
||||
int found;
|
||||
ReturnCode ret;
|
||||
|
||||
if( (c = skipws( global ) ) == '\n' || c == EOF_CHAR )
|
||||
{
|
||||
unget( global );
|
||||
|
||||
cerror( global, ERROR_MISSING_ARGUMENT );
|
||||
|
||||
#if !OLD_PREPROCESSOR
|
||||
skipnl( global ); /* Prevent an extra */
|
||||
|
||||
unget( global ); /* Error message */
|
||||
#endif
|
||||
|
||||
return(FPP_OK);
|
||||
}
|
||||
|
||||
if( hash == L_if )
|
||||
{
|
||||
unget( global );
|
||||
|
||||
ret = eval( global, &found );
|
||||
|
||||
if( ret )
|
||||
return( ret );
|
||||
|
||||
found = (found != 0); /* Evaluate expr, != 0 is TRUE */
|
||||
|
||||
hash = L_ifdef; /* #if is now like #ifdef */
|
||||
}
|
||||
else
|
||||
{
|
||||
if( type[c] != LET )
|
||||
{ /* Next non-blank isn't letter */
|
||||
/* ... is an error */
|
||||
cerror( global, ERROR_MISSING_ARGUMENT );
|
||||
|
||||
#if !OLD_PREPROCESSOR
|
||||
skipnl( global ); /* Prevent an extra */
|
||||
|
||||
unget( global ); /* Error message */
|
||||
#endif
|
||||
|
||||
return(FPP_OK);
|
||||
}
|
||||
|
||||
found = ( lookid( global, c ) != NULL ); /* Look for it in symbol table */
|
||||
}
|
||||
|
||||
if( found == (hash == L_ifdef) )
|
||||
{
|
||||
compiling = TRUE;
|
||||
|
||||
*global->ifptr |= TRUE_SEEN;
|
||||
}
|
||||
else
|
||||
compiling = FALSE;
|
||||
|
||||
return(FPP_OK);
|
||||
}
|
||||
|
||||
INLINE FILE_LOCAL
|
||||
ReturnCode doinclude( struct Global *global )
|
||||
{
|
||||
/*
|
||||
* Process the #include control line.
|
||||
* There are three variations:
|
||||
*
|
||||
* #include "file" search somewhere relative to the
|
||||
* current source file, if not found,
|
||||
* treat as #include <file>.
|
||||
*
|
||||
* #include <file> Search in an implementation-dependent
|
||||
* list of places.
|
||||
*
|
||||
* #include token Expand the token, it must be one of
|
||||
* "file" or <file>, process as such.
|
||||
*
|
||||
* Note: the November 12 draft forbids '>' in the #include <file> format.
|
||||
* This restriction is unnecessary and not implemented.
|
||||
*/
|
||||
|
||||
int c;
|
||||
int delim;
|
||||
ReturnCode ret;
|
||||
|
||||
delim = skipws( global );
|
||||
|
||||
if( (ret = macroid( global, &delim )) )
|
||||
return(ret);
|
||||
|
||||
if( delim != '<' && delim != '"' )
|
||||
{
|
||||
cerror( global, ERROR_INCLUDE_SYNTAX );
|
||||
|
||||
return( FPP_OK );
|
||||
}
|
||||
|
||||
if( delim == '<' )
|
||||
delim = '>';
|
||||
|
||||
global->workp = global->work;
|
||||
|
||||
while( (c = get(global)) != '\n' && c != EOF_CHAR )
|
||||
if( (ret = save( global, c )) ) /* Put it away. */
|
||||
return( ret );
|
||||
|
||||
unget( global ); /* Force nl after include */
|
||||
|
||||
/*
|
||||
* The draft is unclear if the following should be done.
|
||||
*/
|
||||
while( --global->workp >= global->work &&
|
||||
(*global->workp == ' ' || *global->workp == '\t') )
|
||||
; /* Trim blanks from filename */
|
||||
|
||||
if( *global->workp != delim )
|
||||
{
|
||||
cerror( global, ERROR_INCLUDE_SYNTAX );
|
||||
|
||||
return(FPP_OK);
|
||||
}
|
||||
|
||||
*global->workp = EOS; /* Terminate filename */
|
||||
|
||||
ret = openinclude( global, global->work, (delim == '"') );
|
||||
|
||||
if( ret && global->warnnoinclude )
|
||||
{
|
||||
/*
|
||||
* Warn if #include file isn't there.
|
||||
*/
|
||||
cwarn( global, WARN_CANNOT_OPEN_INCLUDE, global->work );
|
||||
}
|
||||
|
||||
return( FPP_OK );
|
||||
}
|
||||
|
||||
#ifdef _AMIGA
|
||||
ReturnCode MultiAssignLoad( struct Global *global, char *incptr, char *filename, char *tmpname );
|
||||
#endif
|
||||
|
||||
ReturnCode openinclude( struct Global *global,
|
||||
char *filename, /* Input file name */
|
||||
int searchlocal ) /* TRUE if #include "file" */
|
||||
{
|
||||
/*
|
||||
* Actually open an include file. This routine is only called from
|
||||
* doinclude() above, but was written as a separate subroutine for
|
||||
* programmer convenience. It searches the list of directories
|
||||
* and actually opens the file, linking it into the list of
|
||||
* active files. Returns ReturnCode. No error message is printed.
|
||||
*/
|
||||
|
||||
char **incptr;
|
||||
char tmpname[NWORK]; /* Filename work area */
|
||||
size_t len;
|
||||
|
||||
if( filename[0] == '/' )
|
||||
{
|
||||
if( ! openfile( global, filename ) )
|
||||
return(FPP_OK);
|
||||
}
|
||||
|
||||
if( searchlocal )
|
||||
{
|
||||
/*
|
||||
* Look in local directory first.
|
||||
* Try to open filename relative to the directory of the current
|
||||
* source file (as opposed to the current directory). (ARF, SCK).
|
||||
* Note that the fully qualified pathname is always built by
|
||||
* discarding the last pathname component of the source file
|
||||
* name then tacking on the #include argument.
|
||||
*/
|
||||
if( hasdirectory( global->infile->filename, tmpname ) )
|
||||
strcat( tmpname, filename );
|
||||
else
|
||||
strcpy( tmpname, filename );
|
||||
|
||||
if( ! openfile( global, tmpname ) )
|
||||
return(FPP_OK);
|
||||
}
|
||||
|
||||
/*
|
||||
* Look in any directories specified by -I command line
|
||||
* arguments, then in the builtin search list.
|
||||
*/
|
||||
for( incptr = global->incdir; incptr < global->incend; incptr++ )
|
||||
{
|
||||
len = strlen(*incptr);
|
||||
|
||||
if( len + strlen(filename) >= sizeof(tmpname) )
|
||||
{
|
||||
cfatal( global, FATAL_FILENAME_BUFFER_OVERFLOW );
|
||||
|
||||
return( FPP_FILENAME_BUFFER_OVERFLOW );
|
||||
}
|
||||
else
|
||||
{
|
||||
if( (*incptr)[len-1] != '/' )
|
||||
sprintf( tmpname, "%s/%s", *incptr, filename );
|
||||
else
|
||||
sprintf( tmpname, "%s%s", *incptr, filename );
|
||||
|
||||
if( !openfile( global, tmpname ) )
|
||||
return(FPP_OK);
|
||||
}
|
||||
}
|
||||
|
||||
return( FPP_NO_INCLUDE );
|
||||
}
|
||||
|
||||
INLINE FILE_LOCAL
|
||||
int hasdirectory( char *source, /* Directory to examine */
|
||||
char *result ) /* Put directory stuff here */
|
||||
{
|
||||
/*
|
||||
* If a device or directory is found in the source filename string, the
|
||||
* node/device/directory part of the string is copied to result and
|
||||
* hasdirectory returns TRUE. Else, nothing is copied and it returns FALSE.
|
||||
*/
|
||||
|
||||
char *tp2;
|
||||
|
||||
if( (tp2 = strrchr( source, '/' ) ) == NULL )
|
||||
return(FALSE);
|
||||
|
||||
strncpy( result, source, tp2 - source + 1 );
|
||||
|
||||
result[tp2 - source + 1] = EOS;
|
||||
|
||||
return( TRUE );
|
||||
}
|
||||
|
||||
#ifdef _AMIGA
|
||||
//
|
||||
// amp July 9, 1997
|
||||
//
|
||||
// Use the OS Luke...
|
||||
//
|
||||
// We do the sneaky version and let the OS do all
|
||||
// the hard work so we don't have to mess around
|
||||
// a lot ;)
|
||||
//
|
||||
ReturnCode MultiAssignLoad( struct Global *global, char *incptr, char *filename, char *tmpname )
|
||||
|
||||
{ /* MultiAssignLoad */
|
||||
|
||||
struct MsgPort *FSTask;
|
||||
struct DevProc *DevProc = NULL;
|
||||
LONG RtnCode = FPP_NO_INCLUDE;
|
||||
|
||||
FSTask = GetFileSysTask();
|
||||
|
||||
do
|
||||
{
|
||||
//
|
||||
// This should not bring up a requester.
|
||||
// check to see if cpp does in fact tweek
|
||||
// the process WindowPtr.
|
||||
//
|
||||
DevProc = GetDeviceProc( incptr, DevProc );
|
||||
|
||||
if( DevProc )
|
||||
{
|
||||
SetFileSysTask( DevProc->dvp_Port );
|
||||
|
||||
//
|
||||
// Normally we would pass the lock and filename
|
||||
// to the Load() routine, which would CD to the
|
||||
// directory and Open(filename), but in order to
|
||||
// satisfy the exisiting openfile() function, we
|
||||
// bite the bullet and build the complete pathspec
|
||||
// rather than add the standard Load() routine.
|
||||
//
|
||||
if( NameFromLock( DevProc->dvp_Lock, tmpname, NWORK ) )
|
||||
{
|
||||
AddPart( tmpname, filename, NWORK );
|
||||
|
||||
RtnCode = openfile( global, tmpname );
|
||||
|
||||
if( ! RtnCode )
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
} while ( RtnCode &&
|
||||
DevProc &&
|
||||
(DevProc->dvp_Flags & DVPF_ASSIGN) &&
|
||||
IoErr() == ERROR_OBJECT_NOT_FOUND); /* repeat if multi-assign */
|
||||
|
||||
SetFileSysTask( FSTask );
|
||||
|
||||
if( DevProc )
|
||||
FreeDeviceProc( DevProc );
|
||||
|
||||
return RtnCode;
|
||||
|
||||
} /* MultiAssignLoad */
|
||||
#endif //_AMIGA
|
|
@ -1,401 +0,0 @@
|
|||
/******************************************************************************
|
||||
Copyright (c) 1999 Daniel Stenberg
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
******************************************************************************/
|
||||
#include <stdio.h>
|
||||
#include <ctype.h>
|
||||
#include <time.h> /*OIS*0.92*/
|
||||
#include "cppdef.h"
|
||||
#include "cpp.h"
|
||||
|
||||
ReturnCode openfile(struct Global *global, char *filename)
|
||||
{
|
||||
/*
|
||||
* Open a file, add it to the linked list of open files.
|
||||
* This is called only from openfile() in cpp2.c.
|
||||
*/
|
||||
|
||||
FILE *fp;
|
||||
ReturnCode ret;
|
||||
|
||||
if ((fp = fopen(filename, "r")) == NULL)
|
||||
ret=FPP_OPEN_ERROR;
|
||||
else
|
||||
ret=addfile(global, fp, filename);
|
||||
|
||||
if(!ret && global->depends) {
|
||||
global->depends(filename, global->userdata);
|
||||
}
|
||||
|
||||
if(!ret && global->showincluded) {
|
||||
/* no error occured! */
|
||||
Error(global, "cpp: included \"");
|
||||
Error(global, filename);
|
||||
Error(global, "\"\n");
|
||||
}
|
||||
return(ret);
|
||||
}
|
||||
|
||||
ReturnCode addfile(struct Global *global,
|
||||
FILE *fp, /* Open file pointer */
|
||||
char *filename) /* Name of the file */
|
||||
{
|
||||
/*
|
||||
* Initialize tables for this open file. This is called from openfile()
|
||||
* above (for #include files), and from the entry to cpp to open the main
|
||||
* input file. It calls a common routine, getfile() to build the FILEINFO
|
||||
* structure which is used to read characters. (getfile() is also called
|
||||
* to setup a macro replacement.)
|
||||
*/
|
||||
|
||||
FILEINFO *file;
|
||||
ReturnCode ret;
|
||||
|
||||
ret = getfile(global, NBUFF, filename, &file);
|
||||
if(ret)
|
||||
return(ret);
|
||||
file->fp = fp; /* Better remember FILE * */
|
||||
file->buffer[0] = EOS; /* Initialize for first read */
|
||||
global->line = 1; /* Working on line 1 now */
|
||||
global->wrongline = TRUE; /* Force out initial #line */
|
||||
return(FPP_OK);
|
||||
}
|
||||
|
||||
int dooptions(struct Global *global, struct fppTag *tags)
|
||||
{
|
||||
/*
|
||||
* dooptions is called to process command line arguments (-Detc).
|
||||
* It is called only at cpp startup.
|
||||
*/
|
||||
DEFBUF *dp;
|
||||
char end=FALSE; /* end of taglist */
|
||||
|
||||
while(tags && !end) {
|
||||
switch(tags->tag) {
|
||||
case FPPTAG_END:
|
||||
end=TRUE;
|
||||
break;
|
||||
case FPPTAG_INITFUNC:
|
||||
global->initialfunc = (char *) tags->data;
|
||||
break;
|
||||
case FPPTAG_DISPLAYFUNCTIONS:
|
||||
global->outputfunctions = tags->data?1:0;
|
||||
break;
|
||||
case FPPTAG_RIGHTCONCAT:
|
||||
global->rightconcat = tags->data?1:0;
|
||||
break;
|
||||
case FPPTAG_OUTPUTMAIN:
|
||||
global->outputfile = tags->data?1:0;
|
||||
break;
|
||||
case FPPTAG_NESTED_COMMENTS:
|
||||
global->nestcomments = tags->data?1:0;
|
||||
break;
|
||||
case FPPTAG_WARNMISSINCLUDE:
|
||||
global->warnnoinclude = tags->data?1:0;
|
||||
break;
|
||||
case FPPTAG_WARN_NESTED_COMMENTS:
|
||||
global->warnnestcomments = tags->data?1:0;
|
||||
break;
|
||||
case FPPTAG_OUTPUTSPACE:
|
||||
global->showspace = tags->data?1:0;
|
||||
break;
|
||||
case FPPTAG_OUTPUTBALANCE:
|
||||
global->showbalance = tags->data?1:0;
|
||||
break;
|
||||
case FPPTAG_OUTPUTINCLUDES:
|
||||
global->showincluded = tags->data?1:0;
|
||||
break;
|
||||
case FPPTAG_IGNOREVERSION:
|
||||
global->showversion = tags->data?1:0;
|
||||
break;
|
||||
case FPPTAG_WARNILLEGALCPP:
|
||||
global->warnillegalcpp = tags->data?1:0;
|
||||
break;
|
||||
case FPPTAG_OUTPUTLINE:
|
||||
global->outputLINE = tags->data?1:0;
|
||||
break;
|
||||
case FPPTAG_KEEPCOMMENTS:
|
||||
if(tags->data) {
|
||||
global->cflag = TRUE;
|
||||
global->keepcomments = TRUE;
|
||||
}
|
||||
break;
|
||||
case FPPTAG_DEFINE:
|
||||
/*
|
||||
* If the option is just "-Dfoo", make it -Dfoo=1
|
||||
*/
|
||||
{
|
||||
char *symbol=(char *)tags->data;
|
||||
char *text=symbol;
|
||||
while (*text != EOS && *text != '=')
|
||||
text++;
|
||||
if (*text == EOS)
|
||||
text = "1";
|
||||
else
|
||||
*text++ = EOS;
|
||||
/*
|
||||
* Now, save the word and its definition.
|
||||
*/
|
||||
dp = defendel(global, symbol, FALSE);
|
||||
if(!dp)
|
||||
return(FPP_OUT_OF_MEMORY);
|
||||
dp->repl = savestring(global, text);
|
||||
dp->nargs = DEF_NOARGS;
|
||||
}
|
||||
break;
|
||||
case FPPTAG_IGNORE_NONFATAL:
|
||||
global->eflag = TRUE;
|
||||
break;
|
||||
case FPPTAG_INCLUDE_DIR:
|
||||
if (global->incend >= &global->incdir[NINCLUDE]) {
|
||||
cfatal(global, FATAL_TOO_MANY_INCLUDE_DIRS);
|
||||
return(FPP_TOO_MANY_INCLUDE_DIRS);
|
||||
}
|
||||
*global->incend++ = (char *)tags->data;
|
||||
break;
|
||||
case FPPTAG_INCLUDE_FILE:
|
||||
case FPPTAG_INCLUDE_MACRO_FILE:
|
||||
if (global->included >= NINCLUDE) {
|
||||
cfatal(global, FATAL_TOO_MANY_INCLUDE_FILES);
|
||||
return(FPP_TOO_MANY_INCLUDE_FILES);
|
||||
}
|
||||
global->include[(unsigned)global->included] = (char *)tags->data;
|
||||
|
||||
global->includeshow[(unsigned)global->included] =
|
||||
(tags->tag == FPPTAG_INCLUDE_FILE);
|
||||
|
||||
global->included++;
|
||||
break;
|
||||
case FPPTAG_BUILTINS:
|
||||
global->nflag|=(tags->data?NFLAG_BUILTIN:0);
|
||||
break;
|
||||
case FPPTAG_PREDEFINES:
|
||||
global->nflag|=(tags->data?NFLAG_PREDEFINE:0);
|
||||
break;
|
||||
case FPPTAG_IGNORE_CPLUSPLUS:
|
||||
global->cplusplus=!tags->data;
|
||||
break;
|
||||
case FPPTAG_SIZEOF_TABLE:
|
||||
{
|
||||
SIZES *sizp; /* For -S */
|
||||
int size; /* For -S */
|
||||
int isdatum; /* FALSE for -S* */
|
||||
int endtest; /* For -S */
|
||||
|
||||
char *text=(char *)tags->data;
|
||||
|
||||
sizp = size_table;
|
||||
if ((isdatum = (*text != '*'))) /* If it's just -S, */
|
||||
endtest = T_FPTR; /* Stop here */
|
||||
else { /* But if it's -S* */
|
||||
text++; /* Step over '*' */
|
||||
endtest = 0; /* Stop at end marker */
|
||||
}
|
||||
while (sizp->bits != endtest && *text != EOS) {
|
||||
if (!isdigit(*text)) { /* Skip to next digit */
|
||||
text++;
|
||||
continue;
|
||||
}
|
||||
size = 0; /* Compile the value */
|
||||
while (isdigit(*text)) {
|
||||
size *= 10;
|
||||
size += (*text++ - '0');
|
||||
}
|
||||
if (isdatum)
|
||||
sizp->size = size; /* Datum size */
|
||||
else
|
||||
sizp->psize = size; /* Pointer size */
|
||||
sizp++;
|
||||
}
|
||||
if (sizp->bits != endtest)
|
||||
cwarn(global, WARN_TOO_FEW_VALUES_TO_SIZEOF, NULL);
|
||||
else if (*text != EOS)
|
||||
cwarn(global, WARN_TOO_MANY_VALUES_TO_SIZEOF, NULL);
|
||||
}
|
||||
break;
|
||||
case FPPTAG_UNDEFINE:
|
||||
if (defendel(global, (char *)tags->data, TRUE) == NULL)
|
||||
cwarn(global, WARN_NOT_DEFINED, tags->data);
|
||||
break;
|
||||
case FPPTAG_OUTPUT_DEFINES:
|
||||
global->wflag++;
|
||||
break;
|
||||
case FPPTAG_INPUT_NAME:
|
||||
strcpy(global->work, tags->data); /* Remember input filename */
|
||||
global->first_file=tags->data;
|
||||
break;
|
||||
case FPPTAG_DEPENDS:
|
||||
global->depends=(void (*)(char *, void *))tags->data;
|
||||
break;
|
||||
case FPPTAG_INPUT:
|
||||
global->input=(char *(*)(char *, int, void *))tags->data;
|
||||
break;
|
||||
case FPPTAG_OUTPUT:
|
||||
global->output=(void (*)(int, void *))tags->data;
|
||||
break;
|
||||
case FPPTAG_ERROR:
|
||||
global->error=(void (*)(void *, char *, va_list))tags->data;
|
||||
break;
|
||||
case FPPTAG_USERDATA:
|
||||
global->userdata=tags->data;
|
||||
break;
|
||||
case FPPTAG_LINE:
|
||||
global->linelines= tags->data?1:0;
|
||||
break;
|
||||
case FPPTAG_EXCLFUNC:
|
||||
global->excludedinit[ global->excluded++ ] = (char *)tags->data;
|
||||
break;
|
||||
case FPPTAG_WEBMODE:
|
||||
global->webmode=(tags->data?1:0);
|
||||
break;
|
||||
default:
|
||||
cwarn(global, WARN_INTERNAL_ERROR, NULL);
|
||||
break;
|
||||
}
|
||||
tags++;
|
||||
}
|
||||
return(0);
|
||||
}
|
||||
|
||||
ReturnCode initdefines(struct Global *global)
|
||||
{
|
||||
/*
|
||||
* Initialize the built-in #define's. There are two flavors:
|
||||
* #define decus 1 (static definitions)
|
||||
* #define __FILE__ ?? (dynamic, evaluated by magic)
|
||||
* Called only on cpp startup.
|
||||
*
|
||||
* Note: the built-in static definitions are supressed by the -N option.
|
||||
* __LINE__, __FILE__, __TIME__ and __DATE__ are always present.
|
||||
*/
|
||||
|
||||
char **pp;
|
||||
char *tp;
|
||||
DEFBUF *dp;
|
||||
struct tm *tm;
|
||||
|
||||
int i;
|
||||
time_t tvec;
|
||||
|
||||
static char months[12][4] = {
|
||||
"Jan", "Feb", "Mar", "Apr", "May", "Jun",
|
||||
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
|
||||
};
|
||||
|
||||
/*
|
||||
* Predefine the built-in symbols. Allow the
|
||||
* implementor to pre-define a symbol as "" to
|
||||
* eliminate it.
|
||||
*/
|
||||
if (!(global->nflag & NFLAG_BUILTIN)) {
|
||||
for (pp = global->preset; *pp != NULL; pp++) {
|
||||
if (*pp[0] != EOS) {
|
||||
dp = defendel(global, *pp, FALSE);
|
||||
if(!dp)
|
||||
return(FPP_OUT_OF_MEMORY);
|
||||
dp->repl = savestring(global, "1");
|
||||
dp->nargs = DEF_NOARGS;
|
||||
}
|
||||
}
|
||||
}
|
||||
/*
|
||||
* The magic pre-defines (__FILE__ and __LINE__ are
|
||||
* initialized with negative argument counts. expand()
|
||||
* notices this and calls the appropriate routine.
|
||||
* DEF_NOARGS is one greater than the first "magic" definition.
|
||||
*/
|
||||
if (!(global->nflag & NFLAG_PREDEFINE)) {
|
||||
for (pp = global->magic, i = DEF_NOARGS; *pp != NULL; pp++) {
|
||||
dp = defendel(global, *pp, FALSE);
|
||||
if(!dp)
|
||||
return(FPP_OUT_OF_MEMORY);
|
||||
dp->nargs = --i;
|
||||
}
|
||||
#if OK_DATE
|
||||
/*
|
||||
* Define __DATE__ as today's date.
|
||||
*/
|
||||
dp = defendel(global, "__DATE__", FALSE);
|
||||
tp = malloc(14);
|
||||
if(!tp || !dp)
|
||||
return(FPP_OUT_OF_MEMORY);
|
||||
dp->repl = tp;
|
||||
dp->nargs = DEF_NOARGS;
|
||||
time(&tvec);
|
||||
tm = localtime(&tvec);
|
||||
sprintf(tp, "\"%3s %2d %4d\"", /* "Aug 20 1988" */
|
||||
months[tm->tm_mon],
|
||||
tm->tm_mday,
|
||||
tm->tm_year + 1900);
|
||||
|
||||
/*
|
||||
* Define __TIME__ as this moment's time.
|
||||
*/
|
||||
dp = defendel(global, "__TIME__", FALSE);
|
||||
tp = malloc(11);
|
||||
if(!tp || !dp)
|
||||
return(FPP_OUT_OF_MEMORY);
|
||||
dp->repl = tp;
|
||||
dp->nargs = DEF_NOARGS;
|
||||
sprintf(tp, "\"%2d:%02d:%02d\"", /* "20:42:31" */
|
||||
tm->tm_hour,
|
||||
tm->tm_min,
|
||||
tm->tm_sec);
|
||||
#endif
|
||||
}
|
||||
return(FPP_OK);
|
||||
}
|
||||
|
||||
void delbuiltindefines(struct Global *global)
|
||||
{
|
||||
/*
|
||||
* Delete the built-in #define's.
|
||||
*/
|
||||
char **pp;
|
||||
|
||||
|
||||
/*
|
||||
* Delete the built-in symbols, unless -WW.
|
||||
*/
|
||||
if (global->wflag < 2) {
|
||||
for (pp = global->preset; *pp != NULL; pp++) {
|
||||
defendel(global, *pp, TRUE);
|
||||
}
|
||||
}
|
||||
/*
|
||||
* The magic pre-defines __FILE__ and __LINE__
|
||||
*/
|
||||
for (pp = global->magic; *pp != NULL; pp++) {
|
||||
defendel(global, *pp, TRUE);
|
||||
}
|
||||
#if OK_DATE
|
||||
/*
|
||||
* Undefine __DATE__.
|
||||
*/
|
||||
defendel(global, "__DATE__", TRUE);
|
||||
|
||||
/*
|
||||
* Undefine __TIME__.
|
||||
*/
|
||||
defendel(global, "__TIME__", TRUE);
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
|
@ -1,633 +0,0 @@
|
|||
/******************************************************************************
|
||||
Copyright (c) 1999 Daniel Stenberg
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
******************************************************************************/
|
||||
#include <stdio.h>
|
||||
#include <ctype.h>
|
||||
#include "cppdef.h"
|
||||
#include "cpp.h"
|
||||
|
||||
INLINE FILE_LOCAL ReturnCode checkparm(struct Global *, int, DEFBUF *, int);
|
||||
INLINE FILE_LOCAL ReturnCode stparmscan(struct Global *, int);
|
||||
INLINE FILE_LOCAL ReturnCode textput(struct Global *, char *);
|
||||
FILE_LOCAL ReturnCode charput(struct Global *, int);
|
||||
INLINE FILE_LOCAL ReturnCode expcollect(struct Global *);
|
||||
INLINE FILE_LOCAL char *doquoting(char *, char *);
|
||||
|
||||
|
||||
ReturnCode dodefine(struct Global *global)
|
||||
{
|
||||
/*
|
||||
* Called from control when a #define is scanned. This module
|
||||
* parses formal parameters and the replacement string. When
|
||||
* the formal parameter name is encountered in the replacement
|
||||
* string, it is replaced by a character in the range 128 to
|
||||
* 128+NPARAM (this allows up to 32 parameters within the
|
||||
* Dec Multinational range). If cpp is ported to an EBCDIC
|
||||
* machine, you will have to make other arrangements.
|
||||
*
|
||||
* There is some special case code to distinguish
|
||||
* #define foo bar
|
||||
* from #define foo() bar
|
||||
*
|
||||
* Also, we make sure that
|
||||
* #define foo foo
|
||||
* expands to "foo" but doesn't put cpp into an infinite loop.
|
||||
*
|
||||
* A warning message is printed if you redefine a symbol to a
|
||||
* different text. I.e,
|
||||
* #define foo 123
|
||||
* #define foo 123
|
||||
* is ok, but
|
||||
* #define foo 123
|
||||
* #define foo +123
|
||||
* is not.
|
||||
*
|
||||
* The following subroutines are called from define():
|
||||
* checkparm called when a token is scanned. It checks through the
|
||||
* array of formal parameters. If a match is found, the
|
||||
* token is replaced by a control byte which will be used
|
||||
* to locate the parameter when the macro is expanded.
|
||||
* textput puts a string in the macro work area (parm[]), updating
|
||||
* parmp to point to the first free byte in parm[].
|
||||
* textput() tests for work buffer overflow.
|
||||
* charput puts a single character in the macro work area (parm[])
|
||||
* in a manner analogous to textput().
|
||||
*/
|
||||
int c;
|
||||
DEFBUF *dp; /* -> new definition */
|
||||
int isredefine; /* TRUE if redefined */
|
||||
char *old = NULL; /* Remember redefined */
|
||||
ReturnCode ret;
|
||||
#if OK_CONCAT
|
||||
int quoting; /* Remember we saw a # */
|
||||
#endif
|
||||
|
||||
if (type[(c = skipws(global))] != LET) {
|
||||
cerror(global, ERROR_DEFINE_SYNTAX);
|
||||
global->inmacro = FALSE; /* Stop <newline> hack */
|
||||
return(FPP_OK);
|
||||
}
|
||||
isredefine = FALSE; /* Set if redefining */
|
||||
if ((dp = lookid(global, c)) == NULL) { /* If not known now */
|
||||
dp = defendel(global, global->tokenbuf, FALSE); /* Save the name */
|
||||
if(!dp)
|
||||
return(FPP_OUT_OF_MEMORY);
|
||||
} else { /* It's known: */
|
||||
isredefine = TRUE; /* Remember this fact */
|
||||
old = dp->repl; /* Remember replacement */
|
||||
dp->repl = NULL; /* No replacement now */
|
||||
}
|
||||
global->parlist[0] = global->parmp = global->parm; /* Setup parm buffer */
|
||||
if ((c = get(global)) == '(') { /* With arguments? */
|
||||
global->nargs = 0; /* Init formals counter */
|
||||
do { /* Collect formal parms */
|
||||
if (global->nargs >= LASTPARM) {
|
||||
cfatal(global, FATAL_TOO_MANY_ARGUMENTS_MACRO);
|
||||
return(FPP_TOO_MANY_ARGUMENTS);
|
||||
} else if ((c = skipws(global)) == ')')
|
||||
break; /* Got them all */
|
||||
else if (type[c] != LET) { /* Bad formal syntax */
|
||||
cerror(global, ERROR_DEFINE_SYNTAX);
|
||||
global->inmacro = FALSE; /* Stop <newline> hack */
|
||||
return(FPP_OK);
|
||||
}
|
||||
scanid(global, c); /* Get the formal param */
|
||||
global->parlist[global->nargs++] = global->parmp; /* Save its start */
|
||||
ret=textput(global, global->tokenbuf); /* Save text in parm[] */
|
||||
if(ret)
|
||||
return(ret);
|
||||
} while ((c = skipws(global)) == ','); /* Get another argument */
|
||||
if (c != ')') { /* Must end at ) */
|
||||
cerror(global, ERROR_DEFINE_SYNTAX);
|
||||
global->inmacro = FALSE; /* Stop <newline> hack */
|
||||
return(FPP_OK);
|
||||
}
|
||||
c = ' '; /* Will skip to body */
|
||||
}
|
||||
else {
|
||||
/*
|
||||
* DEF_NOARGS is needed to distinguish between
|
||||
* "#define foo" and "#define foo()".
|
||||
*/
|
||||
global->nargs = DEF_NOARGS; /* No () parameters */
|
||||
}
|
||||
if (type[c] == SPA) /* At whitespace? */
|
||||
c = skipws(global); /* Not any more. */
|
||||
global->workp = global->work; /* Replacement put here */
|
||||
global->inmacro = TRUE; /* Keep \<newline> now */
|
||||
quoting = 0; /* No # seen yet. */
|
||||
while (c != EOF_CHAR && c != '\n') { /* Compile macro body */
|
||||
#if OK_CONCAT
|
||||
if (c == '#') { /* Token concatenation? */
|
||||
if ((c = get(global)) != '#') { /* No, not really */
|
||||
quoting = 1; /* Maybe quoting op. */
|
||||
continue;
|
||||
}
|
||||
while (global->workp > global->work && type[(unsigned)*(global->workp - 1)] == SPA)
|
||||
--global->workp; /* Erase leading spaces */
|
||||
// if ((ret=save(global, TOK_SEP))) /* Stuff a delimiter */
|
||||
// return(ret);
|
||||
c = skipws(global); /* Eat whitespace */
|
||||
continue;
|
||||
}
|
||||
#endif
|
||||
switch (type[c]) {
|
||||
case LET:
|
||||
#if OK_CONCAT
|
||||
ret=checkparm(global, c, dp, quoting); /* Might be a formal */
|
||||
#else
|
||||
ret=checkparm(c, dp); /* Might be a formal */
|
||||
#endif
|
||||
if(ret)
|
||||
return(ret);
|
||||
break;
|
||||
|
||||
case DIG: /* Number in mac. body */
|
||||
case DOT: /* Maybe a float number */
|
||||
ret=scannumber(global, c, save); /* Scan it off */
|
||||
if(ret)
|
||||
return(ret);
|
||||
break;
|
||||
|
||||
case QUO: /* String in mac. body */
|
||||
ret=stparmscan(global, c);
|
||||
if(ret)
|
||||
return(ret);
|
||||
break;
|
||||
|
||||
case BSH: /* Backslash */
|
||||
ret=save(global, '\\');
|
||||
if(ret)
|
||||
return(ret);
|
||||
if ((c = get(global)) == '\n')
|
||||
global->wrongline = TRUE;
|
||||
ret=save(global, c);
|
||||
if(ret)
|
||||
return(ret);
|
||||
break;
|
||||
|
||||
case SPA: /* Absorb whitespace */
|
||||
/*
|
||||
* Note: the "end of comment" marker is passed on
|
||||
* to allow comments to separate tokens.
|
||||
*/
|
||||
if (global->workp[-1] == ' ') /* Absorb multiple */
|
||||
break; /* spaces */
|
||||
else if (c == '\t')
|
||||
c = ' '; /* Normalize tabs */
|
||||
/* Fall through to store character */
|
||||
default: /* Other character */
|
||||
ret=save(global, c);
|
||||
if(ret)
|
||||
return(ret);
|
||||
break;
|
||||
}
|
||||
c = get(global);
|
||||
quoting = 0; /* Only when immediately*/
|
||||
/* preceding a formal */
|
||||
}
|
||||
global->inmacro = FALSE; /* Stop newline hack */
|
||||
unget(global); /* For control check */
|
||||
if (global->workp > global->work && global->workp[-1] == ' ') /* Drop trailing blank */
|
||||
global->workp--;
|
||||
*global->workp = EOS; /* Terminate work */
|
||||
dp->repl = savestring(global, global->work); /* Save the string */
|
||||
dp->nargs = global->nargs; /* Save arg count */
|
||||
if (isredefine) { /* Error if redefined */
|
||||
if ((old != NULL && dp->repl != NULL && !streq(old, dp->repl))
|
||||
|| (old == NULL && dp->repl != NULL)
|
||||
|| (old != NULL && dp->repl == NULL)) {
|
||||
cerror(global, ERROR_REDEFINE, dp->name);
|
||||
}
|
||||
if (old != NULL) /* We don't need the */
|
||||
free(old); /* old definition now. */
|
||||
}
|
||||
return(FPP_OK);
|
||||
}
|
||||
|
||||
INLINE FILE_LOCAL
|
||||
ReturnCode checkparm(struct Global *global,
|
||||
int c,
|
||||
DEFBUF *dp,
|
||||
int quoting) /* Preceded by a # ? */
|
||||
{
|
||||
/*
|
||||
* Replace this param if it's defined. Note that the macro name is a
|
||||
* possible replacement token. We stuff DEF_MAGIC in front of the token
|
||||
* which is treated as a LETTER by the token scanner and eaten by
|
||||
* the output routine. This prevents the macro expander from
|
||||
* looping if someone writes "#define foo foo".
|
||||
*/
|
||||
|
||||
int i;
|
||||
char *cp;
|
||||
ReturnCode ret=FPP_OK;
|
||||
|
||||
scanid(global, c); /* Get parm to tokenbuf */
|
||||
for (i = 0; i < global->nargs; i++) { /* For each argument */
|
||||
if (streq(global->parlist[i], global->tokenbuf)) { /* If it's known */
|
||||
#if OK_CONCAT
|
||||
if (quoting) { /* Special handling of */
|
||||
ret=save(global, QUOTE_PARM); /* #formal inside defn */
|
||||
if(ret)
|
||||
return(ret);
|
||||
}
|
||||
#endif
|
||||
ret=save(global, i + MAC_PARM); /* Save a magic cookie */
|
||||
return(ret); /* And exit the search */
|
||||
}
|
||||
}
|
||||
if (streq(dp->name, global->tokenbuf)) /* Macro name in body? */
|
||||
ret=save(global, DEF_MAGIC); /* Save magic marker */
|
||||
for (cp = global->tokenbuf; *cp != EOS;) /* And save */
|
||||
ret=save(global, *cp++); /* The token itself */
|
||||
return(ret);
|
||||
}
|
||||
|
||||
INLINE FILE_LOCAL
|
||||
ReturnCode stparmscan(struct Global *global, int delim)
|
||||
{
|
||||
/*
|
||||
* Normal string parameter scan.
|
||||
*/
|
||||
|
||||
unsigned char *wp;
|
||||
int i;
|
||||
ReturnCode ret;
|
||||
|
||||
wp = (unsigned char *)global->workp; /* Here's where it starts */
|
||||
ret=scanstring(global, delim, save);
|
||||
if(ret)
|
||||
return(ret); /* Exit on scanstring error */
|
||||
global->workp[-1] = EOS; /* Erase trailing quote */
|
||||
wp++; /* -> first string content byte */
|
||||
for (i = 0; i < global->nargs; i++) {
|
||||
if (streq(global->parlist[i], (char *)wp)) {
|
||||
*wp++ = MAC_PARM + PAR_MAC; /* Stuff a magic marker */
|
||||
*wp++ = (i + MAC_PARM); /* Make a formal marker */
|
||||
*wp = wp[-3]; /* Add on closing quote */
|
||||
global->workp = (char *)wp + 1; /* Reset string end */
|
||||
return(FPP_OK);
|
||||
}
|
||||
}
|
||||
global->workp[-1] = wp[-1]; /* Nope, reset end quote. */
|
||||
return(FPP_OK);
|
||||
}
|
||||
|
||||
void doundef(struct Global *global)
|
||||
/*
|
||||
* Remove the symbol from the defined list.
|
||||
* Called from the #control processor.
|
||||
*/
|
||||
{
|
||||
int c;
|
||||
if (type[(c = skipws(global))] != LET)
|
||||
cerror(global, ERROR_ILLEGAL_UNDEF);
|
||||
else {
|
||||
scanid(global, c); /* Get name to tokenbuf */
|
||||
(void) defendel(global, global->tokenbuf, TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
INLINE FILE_LOCAL
|
||||
ReturnCode textput(struct Global *global, char *text)
|
||||
{
|
||||
/*
|
||||
* Put the string in the parm[] buffer.
|
||||
*/
|
||||
|
||||
size_t size;
|
||||
|
||||
size = strlen(text) + 1;
|
||||
if ((global->parmp + size) >= &global->parm[NPARMWORK]) {
|
||||
cfatal(global, FATAL_MACRO_AREA_OVERFLOW);
|
||||
return(FPP_WORK_AREA_OVERFLOW);
|
||||
} else {
|
||||
strcpy(global->parmp, text);
|
||||
global->parmp += size;
|
||||
}
|
||||
return(FPP_OK);
|
||||
}
|
||||
|
||||
FILE_LOCAL
|
||||
ReturnCode charput(struct Global *global, int c)
|
||||
{
|
||||
/*
|
||||
* Put the byte in the parm[] buffer.
|
||||
*/
|
||||
|
||||
if (global->parmp >= &global->parm[NPARMWORK]) {
|
||||
cfatal(global, FATAL_MACRO_AREA_OVERFLOW);
|
||||
return(FPP_WORK_AREA_OVERFLOW);
|
||||
}
|
||||
*global->parmp++ = c;
|
||||
return(FPP_OK);
|
||||
}
|
||||
|
||||
/*
|
||||
* M a c r o E x p a n s i o n
|
||||
*/
|
||||
|
||||
ReturnCode expand(struct Global *global, DEFBUF *tokenp)
|
||||
{
|
||||
/*
|
||||
* Expand a macro. Called from the cpp mainline routine (via subroutine
|
||||
* macroid()) when a token is found in the symbol table. It calls
|
||||
* expcollect() to parse actual parameters, checking for the correct number.
|
||||
* It then creates a "file" containing a single line containing the
|
||||
* macro with actual parameters inserted appropriately. This is
|
||||
* "pushed back" onto the input stream. (When the get() routine runs
|
||||
* off the end of the macro line, it will dismiss the macro itself.)
|
||||
*/
|
||||
int c;
|
||||
FILEINFO *file;
|
||||
ReturnCode ret=FPP_OK;
|
||||
|
||||
/*
|
||||
* If no macro is pending, save the name of this macro
|
||||
* for an eventual error message.
|
||||
*/
|
||||
if (global->recursion++ == 0)
|
||||
global->macro = tokenp;
|
||||
else if (global->recursion == RECURSION_LIMIT) {
|
||||
cerror(global, ERROR_RECURSIVE_MACRO, tokenp->name, global->macro->name);
|
||||
if (global->rec_recover) {
|
||||
do {
|
||||
c = get(global);
|
||||
} while (global->infile != NULL && global->infile->fp == NULL);
|
||||
unget(global);
|
||||
global->recursion = 0;
|
||||
return(FPP_OK);
|
||||
}
|
||||
}
|
||||
/*
|
||||
* Here's a macro to expand.
|
||||
*/
|
||||
global->nargs = 0; /* Formals counter */
|
||||
global->parmp = global->parm; /* Setup parm buffer */
|
||||
switch (tokenp->nargs) {
|
||||
case (-2): /* __LINE__ */
|
||||
if(global->infile->fp)
|
||||
/* This is a file */
|
||||
sprintf(global->work, "%d", global->line);
|
||||
else
|
||||
/* This is a macro! Find out the file line number! */
|
||||
for (file = global->infile; file != NULL; file = file->parent) {
|
||||
if (file->fp != NULL) {
|
||||
sprintf(global->work, "%d", file->line);
|
||||
break;
|
||||
}
|
||||
}
|
||||
ret=ungetstring(global, global->work);
|
||||
if(ret)
|
||||
return(ret);
|
||||
break;
|
||||
|
||||
case (-3): /* __FILE__ */
|
||||
for (file = global->infile; file != NULL; file = file->parent) {
|
||||
if (file->fp != NULL) {
|
||||
sprintf(global->work, "\"%s\"", (file->progname != NULL)
|
||||
? file->progname : file->filename);
|
||||
ret=ungetstring(global, global->work);
|
||||
if(ret)
|
||||
return(ret);
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case (-4): /* __FUNC__ */
|
||||
sprintf(global->work, "\"%s\"", global->functionname[0]?
|
||||
global->functionname : "<unknown function>");
|
||||
ret=ungetstring(global, global->work);
|
||||
if(ret)
|
||||
return(ret);
|
||||
break;
|
||||
|
||||
case (-5): /* __FUNC_LINE__ */
|
||||
sprintf(global->work, "%d", global->funcline);
|
||||
ret=ungetstring(global, global->work);
|
||||
if(ret)
|
||||
return(ret);
|
||||
break;
|
||||
|
||||
default:
|
||||
/*
|
||||
* Nothing funny about this macro.
|
||||
*/
|
||||
if (tokenp->nargs < 0) {
|
||||
cfatal(global, FATAL_ILLEGAL_MACRO, tokenp->name);
|
||||
return(FPP_ILLEGAL_MACRO);
|
||||
}
|
||||
while ((c = skipws(global)) == '\n') /* Look for (, skipping */
|
||||
global->wrongline = TRUE; /* spaces and newlines */
|
||||
if (c != '(') {
|
||||
/*
|
||||
* If the programmer writes
|
||||
* #define foo() ...
|
||||
* ...
|
||||
* foo [no ()]
|
||||
* just write foo to the output stream.
|
||||
*/
|
||||
unget(global);
|
||||
cwarn(global, WARN_MACRO_NEEDS_ARGUMENTS, tokenp->name);
|
||||
|
||||
/* fputs(tokenp->name, stdout); */
|
||||
Putstring(global, tokenp->name);
|
||||
return(FPP_OK);
|
||||
} else if (!(ret=expcollect(global))) { /* Collect arguments */
|
||||
if (tokenp->nargs != global->nargs) { /* Should be an error? */
|
||||
cwarn(global, WARN_WRONG_NUMBER_ARGUMENTS, tokenp->name);
|
||||
}
|
||||
} else { /* Collect arguments */
|
||||
return(ret); /* We failed in argument colleting! */
|
||||
}
|
||||
case DEF_NOARGS: /* No parameters just stuffs */
|
||||
ret=expstuff(global, tokenp->name, tokenp->repl); /* expand macro */
|
||||
} /* nargs switch */
|
||||
return(ret);
|
||||
}
|
||||
|
||||
INLINE FILE_LOCAL
|
||||
ReturnCode expcollect(struct Global *global)
|
||||
{
|
||||
/*
|
||||
* Collect the actual parameters for this macro.
|
||||
*/
|
||||
|
||||
int c;
|
||||
int paren; /* For embedded ()'s */
|
||||
ReturnCode ret;
|
||||
|
||||
for (;;) {
|
||||
paren = 0; /* Collect next arg. */
|
||||
while ((c = skipws(global)) == '\n')/* Skip over whitespace */
|
||||
global->wrongline = TRUE; /* and newlines. */
|
||||
if (c == ')') { /* At end of all args? */
|
||||
/*
|
||||
* Note that there is a guard byte in parm[]
|
||||
* so we don't have to check for overflow here.
|
||||
*/
|
||||
*global->parmp = EOS; /* Make sure terminated */
|
||||
break; /* Exit collection loop */
|
||||
}
|
||||
else if (global->nargs >= LASTPARM) {
|
||||
cfatal(global, FATAL_TOO_MANY_ARGUMENTS_EXPANSION);
|
||||
return(FPP_TOO_MANY_ARGUMENTS);
|
||||
}
|
||||
global->parlist[global->nargs++] = global->parmp; /* At start of new arg */
|
||||
for (;; c = cget(global)) { /* Collect arg's bytes */
|
||||
if (c == EOF_CHAR) {
|
||||
cerror(global, ERROR_EOF_IN_ARGUMENT);
|
||||
return(FPP_EOF_IN_MACRO); /* Sorry. */
|
||||
}
|
||||
else if (c == '\\') { /* Quote next character */
|
||||
charput(global, c); /* Save the \ for later */
|
||||
charput(global, cget(global)); /* Save the next char. */
|
||||
continue; /* And go get another */
|
||||
}
|
||||
else if (type[c] == QUO) { /* Start of string? */
|
||||
ret=scanstring(global, c, (ReturnCode (*)(struct Global *, int))charput); /* Scan it off */
|
||||
if(ret)
|
||||
return(ret);
|
||||
continue; /* Go get next char */
|
||||
}
|
||||
else if (c == '(') /* Worry about balance */
|
||||
paren++; /* To know about commas */
|
||||
else if (c == ')') { /* Other side too */
|
||||
if (paren == 0) { /* At the end? */
|
||||
unget(global); /* Look at it later */
|
||||
break; /* Exit arg getter. */
|
||||
}
|
||||
paren--; /* More to come. */
|
||||
}
|
||||
else if (c == ',' && paren == 0) /* Comma delimits args */
|
||||
break;
|
||||
else if (c == '\n') /* Newline inside arg? */
|
||||
global->wrongline = TRUE; /* We'll need a #line */
|
||||
charput(global, c); /* Store this one */
|
||||
} /* Collect an argument */
|
||||
charput(global, EOS); /* Terminate argument */
|
||||
} /* Collect all args. */
|
||||
return(FPP_OK); /* Normal return */
|
||||
}
|
||||
|
||||
|
||||
#if OK_CONCAT
|
||||
|
||||
INLINE FILE_LOCAL
|
||||
char *doquoting(char *to, char *from)
|
||||
{
|
||||
*to++ = '"';
|
||||
while (*from) {
|
||||
if (*from == '\\' || *from == '"')
|
||||
*to++ = '\\';
|
||||
*to++ = *from++;
|
||||
}
|
||||
*to++ = '"';
|
||||
|
||||
return to;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
ReturnCode expstuff(struct Global *global,
|
||||
char *MacroName,
|
||||
char *MacroReplace)
|
||||
{
|
||||
/*
|
||||
* Stuff the macro body, replacing formal parameters by actual parameters.
|
||||
*/
|
||||
int c; /* Current character */
|
||||
char *inp; /* -> repl string */
|
||||
char *defp; /* -> macro output buff */
|
||||
size_t size; /* Actual parm. size */
|
||||
char *defend; /* -> output buff end */
|
||||
int string_magic; /* String formal hack */
|
||||
FILEINFO *file; /* Funny #include */
|
||||
ReturnCode ret;
|
||||
#if OK_CONCAT
|
||||
char quoting; /* Quote macro argument */
|
||||
#endif
|
||||
|
||||
ret = getfile(global, NBUFF, MacroName, &file);
|
||||
if(ret)
|
||||
return(ret);
|
||||
inp = MacroReplace; /* -> macro replacement */
|
||||
defp = file->buffer; /* -> output buffer */
|
||||
defend = defp + (NBUFF - 1); /* Note its end */
|
||||
if (inp != NULL) {
|
||||
quoting = 0;
|
||||
while ((c = (*inp++ & 0xFF)) != EOS) {
|
||||
#if OK_CONCAT
|
||||
if (c == QUOTE_PARM) { /* Special token for # */
|
||||
quoting = 1; /* set flag, for later */
|
||||
continue; /* Get next character */
|
||||
}
|
||||
#endif
|
||||
if (c >= MAC_PARM && c <= (MAC_PARM + PAR_MAC)) {
|
||||
string_magic = (c == (MAC_PARM + PAR_MAC));
|
||||
if (string_magic)
|
||||
c = (*inp++ & 0xFF);
|
||||
/*
|
||||
* Replace formal parameter by actual parameter string.
|
||||
*/
|
||||
if ((c -= MAC_PARM) < global->nargs) {
|
||||
size = strlen(global->parlist[c]);
|
||||
#if OK_CONCAT
|
||||
if (quoting) {
|
||||
size++;
|
||||
size *= 2; /* worst case condition */
|
||||
}
|
||||
#endif
|
||||
if ((defp + size) >= defend) {
|
||||
cfatal(global, FATAL_OUT_OF_SPACE_IN_ARGUMENT, MacroName);
|
||||
return(FPP_OUT_OF_SPACE_IN_MACRO_EXPANSION);
|
||||
}
|
||||
/*
|
||||
* Erase the extra set of quotes.
|
||||
*/
|
||||
if (string_magic && defp[-1] == global->parlist[c][0]) {
|
||||
strcpy(defp-1, global->parlist[c]);
|
||||
defp += (size - 2);
|
||||
}
|
||||
#if OK_CONCAT
|
||||
else if (quoting)
|
||||
defp = doquoting(defp, global->parlist[c]);
|
||||
#endif
|
||||
else {
|
||||
strcpy(defp, global->parlist[c]);
|
||||
defp += size;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (defp >= defend) {
|
||||
cfatal(global, FATAL_OUT_OF_SPACE_IN_ARGUMENT, MacroName);
|
||||
return(FPP_OUT_OF_SPACE_IN_MACRO_EXPANSION);
|
||||
} else
|
||||
*defp++ = c;
|
||||
quoting = 0;
|
||||
}
|
||||
}
|
||||
*defp = EOS;
|
||||
return(FPP_OK);
|
||||
}
|
||||
|
|
@ -1,903 +0,0 @@
|
|||
/******************************************************************************
|
||||
Copyright (c) 1999 Daniel Stenberg
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
******************************************************************************/
|
||||
#include <stdio.h>
|
||||
#include <ctype.h>
|
||||
#include "cppdef.h"
|
||||
#include "cpp.h"
|
||||
|
||||
INLINE FILE_LOCAL ReturnCode evallex(struct Global *, int, int *);
|
||||
INLINE FILE_LOCAL ReturnCode dosizeof(struct Global *, int *);
|
||||
INLINE FILE_LOCAL int bittest(int);
|
||||
INLINE FILE_LOCAL int evalnum(struct Global *, int);
|
||||
INLINE FILE_LOCAL int evalchar(struct Global *, int);
|
||||
INLINE FILE_LOCAL int *evaleval(struct Global *, int *, int, int);
|
||||
|
||||
/*
|
||||
* Evaluate an #if expression.
|
||||
*/
|
||||
|
||||
static char *opname[] = { /* For debug and error messages */
|
||||
"end of expression", "val", "id",
|
||||
"+", "-", "*", "/", "%",
|
||||
"<<", ">>", "&", "|", "^",
|
||||
"==", "!=", "<", "<=", ">=", ">",
|
||||
"&&", "||", "?", ":", ",",
|
||||
"unary +", "unary -", "~", "!", "(", ")", "(none)",
|
||||
};
|
||||
|
||||
/*
|
||||
* opdope[] has the operator precedence:
|
||||
* Bits
|
||||
* 7 Unused (so the value is always positive)
|
||||
* 6-2 Precedence (000x .. 017x)
|
||||
* 1-0 Binary op. flags:
|
||||
* 01 The binop flag should be set/cleared when this op is seen.
|
||||
* 10 The new value of the binop flag.
|
||||
* Note: Expected, New binop
|
||||
* constant 0 1 Binop, end, or ) should follow constants
|
||||
* End of line 1 0 End may not be preceeded by an operator
|
||||
* binary 1 0 Binary op follows a value, value follows.
|
||||
* unary 0 0 Unary op doesn't follow a value, value follows
|
||||
* ( 0 0 Doesn't follow value, value or unop follows
|
||||
* ) 1 1 Follows value. Op follows.
|
||||
*/
|
||||
|
||||
static char opdope[OP_MAX] = {
|
||||
0001, /* End of expression */
|
||||
0002, /* Digit */
|
||||
0000, /* Letter (identifier) */
|
||||
0141, 0141, 0151, 0151, 0151, /* ADD, SUB, MUL, DIV, MOD */
|
||||
0131, 0131, 0101, 0071, 0071, /* ASL, ASR, AND, OR, XOR */
|
||||
0111, 0111, 0121, 0121, 0121, 0121, /* EQ, NE, LT, LE, GE, GT */
|
||||
0061, 0051, 0041, 0041, 0031, /* ANA, ORO, QUE, COL, CMA */
|
||||
/*
|
||||
* Unary op's follow
|
||||
*/
|
||||
0160, 0160, 0160, 0160, /* NEG, PLU, COM, NOT */
|
||||
0170, 0013, 0023, /* LPA, RPA, END */
|
||||
};
|
||||
/*
|
||||
* OP_QUE and OP_RPA have alternate precedences:
|
||||
*/
|
||||
#define OP_RPA_PREC 0013
|
||||
#define OP_QUE_PREC 0034
|
||||
|
||||
/*
|
||||
* S_ANDOR and S_QUEST signal "short-circuit" boolean evaluation, so that
|
||||
* #if FOO != 0 && 10 / FOO ...
|
||||
* doesn't generate an error message. They are stored in optab.skip.
|
||||
*/
|
||||
#define S_ANDOR 2
|
||||
#define S_QUEST 1
|
||||
|
||||
typedef struct optab {
|
||||
char op; /* Operator */
|
||||
char prec; /* Its precedence */
|
||||
char skip; /* Short-circuit: TRUE to skip */
|
||||
} OPTAB;
|
||||
|
||||
#ifdef nomacargs
|
||||
FILE_LOCAL int
|
||||
isbinary(op)
|
||||
int op;
|
||||
{
|
||||
return (op >= FIRST_BINOP && op <= LAST_BINOP);
|
||||
}
|
||||
|
||||
FILE_LOCAL int
|
||||
isunary(op)
|
||||
int op;
|
||||
{
|
||||
return (op >= FIRST_UNOP && op <= LAST_UNOP);
|
||||
}
|
||||
#else
|
||||
#define isbinary(op) (op >= FIRST_BINOP && op <= LAST_BINOP)
|
||||
#define isunary(op) (op >= FIRST_UNOP && op <= LAST_UNOP)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* The following definitions are used to specify basic variable sizes.
|
||||
*/
|
||||
|
||||
#if OK_SIZEOF
|
||||
|
||||
#ifndef S_CHAR
|
||||
#define S_CHAR (sizeof (char))
|
||||
#endif
|
||||
#ifndef S_SINT
|
||||
#ifdef manx /* Aztec/Manx C does not like "short int" */
|
||||
#define S_SINT (sizeof (short))
|
||||
#else
|
||||
#define S_SINT (sizeof (short int))
|
||||
#endif
|
||||
#endif
|
||||
#ifndef S_INT
|
||||
#define S_INT (sizeof (int))
|
||||
#endif
|
||||
#ifndef S_LINT
|
||||
#define S_LINT (sizeof (long int))
|
||||
#endif
|
||||
#ifndef S_FLOAT
|
||||
#define S_FLOAT (sizeof (float))
|
||||
#endif
|
||||
#ifndef S_DOUBLE
|
||||
#define S_DOUBLE (sizeof (double))
|
||||
#endif
|
||||
#ifndef S_PCHAR
|
||||
#define S_PCHAR (sizeof (char *))
|
||||
#endif
|
||||
#ifndef S_PSINT
|
||||
#ifdef manx /* Aztec/Manx C does not like "short int" */
|
||||
#define S_PSINT (sizeof (short *))
|
||||
#else
|
||||
#define S_PSINT (sizeof (short int *))
|
||||
#endif
|
||||
#endif
|
||||
#ifndef S_PINT
|
||||
#define S_PINT (sizeof (int *))
|
||||
#endif
|
||||
#ifndef S_PLINT
|
||||
#define S_PLINT (sizeof (long int *))
|
||||
#endif
|
||||
#ifndef S_PFLOAT
|
||||
#define S_PFLOAT (sizeof (float *))
|
||||
#endif
|
||||
#ifndef S_PDOUBLE
|
||||
#define S_PDOUBLE (sizeof (double *))
|
||||
#endif
|
||||
#ifndef S_PFPTR
|
||||
#define S_PFPTR (sizeof (int (*)()))
|
||||
#endif
|
||||
|
||||
|
||||
typedef struct types {
|
||||
short type; /* This is the bit if */
|
||||
char *name; /* this is the token word */
|
||||
} TYPES;
|
||||
|
||||
static TYPES basic_types[] = {
|
||||
{ T_CHAR, "char", },
|
||||
{ T_INT, "int", },
|
||||
{ T_FLOAT, "float", },
|
||||
{ T_DOUBLE, "double", },
|
||||
{ T_SHORT, "short", },
|
||||
{ T_LONG, "long", },
|
||||
{ T_SIGNED, "signed", },
|
||||
{ T_UNSIGNED, "unsigned", },
|
||||
{ 0, NULL, }, /* Signal end */
|
||||
};
|
||||
|
||||
/*
|
||||
* Test_table[] is used to test for illegal combinations.
|
||||
*/
|
||||
static short test_table[] = {
|
||||
T_FLOAT | T_DOUBLE | T_LONG | T_SHORT,
|
||||
T_FLOAT | T_DOUBLE | T_CHAR | T_INT,
|
||||
T_FLOAT | T_DOUBLE | T_SIGNED | T_UNSIGNED,
|
||||
T_LONG | T_SHORT | T_CHAR,
|
||||
0 /* end marker */
|
||||
};
|
||||
|
||||
/*
|
||||
* The order of this table is important -- it is also referenced by
|
||||
* the command line processor to allow run-time overriding of the
|
||||
* built-in size values. The order must not be changed:
|
||||
* char, short, int, long, float, double (func pointer)
|
||||
*/
|
||||
SIZES size_table[] = {
|
||||
{ T_CHAR, S_CHAR, S_PCHAR }, /* char */
|
||||
{ T_SHORT, S_SINT, S_PSINT }, /* short int */
|
||||
{ T_INT, S_INT, S_PINT }, /* int */
|
||||
{ T_LONG, S_LINT, S_PLINT }, /* long */
|
||||
{ T_FLOAT, S_FLOAT, S_PFLOAT }, /* float */
|
||||
{ T_DOUBLE, S_DOUBLE, S_PDOUBLE }, /* double */
|
||||
{ T_FPTR, 0, S_PFPTR }, /* int (*()) */
|
||||
{ 0, 0, 0 }, /* End of table */
|
||||
};
|
||||
|
||||
#endif /* OK_SIZEOF */
|
||||
|
||||
ReturnCode eval(struct Global *global, int *eval)
|
||||
{
|
||||
/*
|
||||
* Evaluate an expression. Straight-forward operator precedence.
|
||||
* This is called from control() on encountering an #if statement.
|
||||
* It calls the following routines:
|
||||
* evallex Lexical analyser -- returns the type and value of
|
||||
* the next input token.
|
||||
* evaleval Evaluate the current operator, given the values on
|
||||
* the value stack. Returns a pointer to the (new)
|
||||
* value stack.
|
||||
* For compatiblity with older cpp's, this return returns 1 (TRUE)
|
||||
* if a syntax error is detected.
|
||||
*/
|
||||
int op; /* Current operator */
|
||||
int *valp; /* -> value vector */
|
||||
OPTAB *opp; /* Operator stack */
|
||||
int prec; /* Op precedence */
|
||||
int binop; /* Set if binary op. needed */
|
||||
int op1; /* Operand from stack */
|
||||
int skip; /* For short-circuit testing */
|
||||
int value[NEXP]; /* Value stack */
|
||||
OPTAB opstack[NEXP]; /* Operand stack */
|
||||
ReturnCode ret;
|
||||
char again=TRUE;
|
||||
|
||||
valp = value;
|
||||
opp = opstack;
|
||||
opp->op = OP_END; /* Mark bottom of stack */
|
||||
opp->prec = opdope[OP_END]; /* And its precedence */
|
||||
opp->skip = 0; /* Not skipping now */
|
||||
binop = 0;
|
||||
|
||||
while(again) {
|
||||
ret=evallex(global, opp->skip, &op);
|
||||
if(ret)
|
||||
return(ret);
|
||||
if (op == OP_SUB && binop == 0)
|
||||
op = OP_NEG; /* Unary minus */
|
||||
else if (op == OP_ADD && binop == 0)
|
||||
op = OP_PLU; /* Unary plus */
|
||||
else if (op == OP_FAIL) {
|
||||
*eval=1; /* Error in evallex */
|
||||
return(FPP_OK);
|
||||
}
|
||||
if (op == DIG) { /* Value? */
|
||||
if (binop != 0) {
|
||||
cerror(global, ERROR_MISPLACED_CONSTANT);
|
||||
*eval=1;
|
||||
return(FPP_OK);
|
||||
} else if (valp >= &value[NEXP-1]) {
|
||||
cerror(global, ERROR_IF_OVERFLOW);
|
||||
*eval=1;
|
||||
return(FPP_OK);
|
||||
} else {
|
||||
*valp++ = global->evalue;
|
||||
binop = 1;
|
||||
}
|
||||
again=TRUE;
|
||||
continue;
|
||||
} else if (op > OP_END) {
|
||||
cerror(global, ERROR_ILLEGAL_IF_LINE);
|
||||
*eval=1;
|
||||
return(FPP_OK);
|
||||
}
|
||||
prec = opdope[op];
|
||||
if (binop != (prec & 1)) {
|
||||
cerror(global, ERROR_OPERATOR, opname[op]);
|
||||
*eval=1;
|
||||
return(FPP_OK);
|
||||
}
|
||||
binop = (prec & 2) >> 1;
|
||||
do {
|
||||
if (prec > opp->prec) {
|
||||
if (op == OP_LPA)
|
||||
prec = OP_RPA_PREC;
|
||||
else if (op == OP_QUE)
|
||||
prec = OP_QUE_PREC;
|
||||
op1 = opp->skip; /* Save skip for test */
|
||||
/*
|
||||
* Push operator onto op. stack.
|
||||
*/
|
||||
opp++;
|
||||
if (opp >= &opstack[NEXP]) {
|
||||
cerror(global, ERROR_EXPR_OVERFLOW, opname[op]);
|
||||
*eval=1;
|
||||
return(FPP_OK);
|
||||
}
|
||||
opp->op = op;
|
||||
opp->prec = prec;
|
||||
skip = (valp[-1] != 0); /* Short-circuit tester */
|
||||
/*
|
||||
* Do the short-circuit stuff here. Short-circuiting
|
||||
* stops automagically when operators are evaluated.
|
||||
*/
|
||||
if ((op == OP_ANA && !skip)
|
||||
|| (op == OP_ORO && skip))
|
||||
opp->skip = S_ANDOR; /* And/or skip starts */
|
||||
else if (op == OP_QUE) /* Start of ?: operator */
|
||||
opp->skip = (op1 & S_ANDOR) | ((!skip) ? S_QUEST : 0);
|
||||
else if (op == OP_COL) { /* : inverts S_QUEST */
|
||||
opp->skip = (op1 & S_ANDOR)
|
||||
| (((op1 & S_QUEST) != 0) ? 0 : S_QUEST);
|
||||
}
|
||||
else { /* Other ops leave */
|
||||
opp->skip = op1; /* skipping unchanged. */
|
||||
}
|
||||
again=TRUE;
|
||||
continue;
|
||||
}
|
||||
/*
|
||||
* Pop operator from op. stack and evaluate it.
|
||||
* End of stack and '(' are specials.
|
||||
*/
|
||||
skip = opp->skip; /* Remember skip value */
|
||||
switch ((op1 = opp->op)) { /* Look at stacked op */
|
||||
case OP_END: /* Stack end marker */
|
||||
if (op == OP_EOE) {
|
||||
*eval=valp[-1]; /* Finished ok. */
|
||||
return(FPP_OK);
|
||||
}
|
||||
/* Read another op. */
|
||||
again=TRUE;
|
||||
continue;
|
||||
case OP_LPA: /* ( on stack */
|
||||
if (op != OP_RPA) { /* Matches ) on input */
|
||||
cerror(global, ERROR_UNBALANCED_PARENS, opname[op]);
|
||||
*eval=1;
|
||||
return(FPP_OK);
|
||||
}
|
||||
opp--; /* Unstack it */
|
||||
/* -- Fall through */
|
||||
case OP_QUE:
|
||||
/* Evaluate true expr. */
|
||||
again=TRUE;
|
||||
continue;
|
||||
case OP_COL: /* : on stack. */
|
||||
opp--; /* Unstack : */
|
||||
if (opp->op != OP_QUE) { /* Matches ? on stack? */
|
||||
cerror(global, ERROR_MISPLACED, opname[(unsigned)opp->op]);
|
||||
*eval=1;
|
||||
return(FPP_OK);
|
||||
}
|
||||
/*
|
||||
* Evaluate op1.
|
||||
*/
|
||||
default: /* Others: */
|
||||
opp--; /* Unstack the operator */
|
||||
valp = evaleval(global, valp, op1, skip);
|
||||
again=FALSE;
|
||||
} /* op1 switch end */
|
||||
} while (!again); /* Stack unwind loop */
|
||||
}
|
||||
return(FPP_OK);
|
||||
}
|
||||
|
||||
INLINE FILE_LOCAL
|
||||
ReturnCode evallex(struct Global *global,
|
||||
int skip, /* TRUE if short-circuit evaluation */
|
||||
int *op)
|
||||
{
|
||||
/*
|
||||
* Set *op to next eval operator or value. Called from eval(). It
|
||||
* calls a special-purpose routines for 'char' strings and
|
||||
* numeric values:
|
||||
* evalchar called to evaluate 'x'
|
||||
* evalnum called to evaluate numbers.
|
||||
*/
|
||||
|
||||
int c, c1, t;
|
||||
ReturnCode ret;
|
||||
char loop;
|
||||
|
||||
do { /* while(loop); */
|
||||
/* again: */
|
||||
loop=FALSE;
|
||||
do { /* Collect the token */
|
||||
c = skipws(global);
|
||||
if((ret=macroid(global, &c)))
|
||||
return(ret);
|
||||
if (c == EOF_CHAR || c == '\n') {
|
||||
unget(global);
|
||||
*op=OP_EOE; /* End of expression */
|
||||
return(FPP_OK);
|
||||
}
|
||||
} while ((t = type[c]) == LET && catenate(global, &ret) && !ret);
|
||||
if(ret)
|
||||
/* If the loop was broken because of a fatal error! */
|
||||
return(ret);
|
||||
if (t == INV) { /* Total nonsense */
|
||||
if (!skip) {
|
||||
if (isascii(c) && isprint(c))
|
||||
cerror(global, ERROR_ILLEGAL_CHARACTER, c);
|
||||
else
|
||||
cerror(global, ERROR_ILLEGAL_CHARACTER2, c);
|
||||
}
|
||||
return(FPP_ILLEGAL_CHARACTER);
|
||||
} else if (t == QUO) { /* ' or " */
|
||||
if (c == '\'') { /* Character constant */
|
||||
global->evalue = evalchar(global, skip); /* Somewhat messy */
|
||||
*op=DIG; /* Return a value */
|
||||
return(FPP_OK);
|
||||
}
|
||||
cerror(global, ERROR_STRING_IN_IF);
|
||||
return(FPP_CANT_USE_STRING_IN_IF);
|
||||
} else if (t == LET) { /* ID must be a macro */
|
||||
if (streq(global->tokenbuf, "defined")) { /* Or defined name */
|
||||
c1 = c = skipws(global);
|
||||
if (c == '(') /* Allow defined(name) */
|
||||
c = skipws(global);
|
||||
if (type[c] == LET) {
|
||||
global->evalue = (lookid(global, c) != NULL);
|
||||
if (c1 != '(' /* Need to balance */
|
||||
|| skipws(global) == ')') { /* Did we balance? */
|
||||
*op=DIG;
|
||||
return(FPP_OK); /* Parsed ok */
|
||||
}
|
||||
}
|
||||
cerror(global, ERROR_DEFINED_SYNTAX);
|
||||
return(FPP_BAD_IF_DEFINED_SYNTAX);
|
||||
}
|
||||
#if OK_SIZEOF
|
||||
else if (streq(global->tokenbuf, "sizeof")) { /* New sizeof hackery */
|
||||
ret=dosizeof(global, op); /* Gets own routine */
|
||||
return(ret);
|
||||
}
|
||||
#endif
|
||||
global->evalue = 0;
|
||||
*op=DIG;
|
||||
return(FPP_OK);
|
||||
}
|
||||
else if (t == DIG) { /* Numbers are harder */
|
||||
global->evalue = evalnum(global, c);
|
||||
}
|
||||
else if (strchr("!=<>&|\\", c) != NULL) {
|
||||
/*
|
||||
* Process a possible multi-byte lexeme.
|
||||
*/
|
||||
c1 = cget(global); /* Peek at next char */
|
||||
switch (c) {
|
||||
case '!':
|
||||
if (c1 == '=') {
|
||||
*op=OP_NE;
|
||||
return(FPP_OK);
|
||||
}
|
||||
break;
|
||||
|
||||
case '=':
|
||||
if (c1 != '=') { /* Can't say a=b in #if */
|
||||
unget(global);
|
||||
cerror(global, ERROR_ILLEGAL_ASSIGN);
|
||||
return (FPP_IF_ERROR);
|
||||
}
|
||||
*op=OP_EQ;
|
||||
return(FPP_OK);
|
||||
|
||||
case '>':
|
||||
case '<':
|
||||
if (c1 == c) {
|
||||
*op= ((c == '<') ? OP_ASL : OP_ASR);
|
||||
return(FPP_OK);
|
||||
} else if (c1 == '=') {
|
||||
*op= ((c == '<') ? OP_LE : OP_GE);
|
||||
return(FPP_OK);
|
||||
}
|
||||
break;
|
||||
|
||||
case '|':
|
||||
case '&':
|
||||
if (c1 == c) {
|
||||
*op= ((c == '|') ? OP_ORO : OP_ANA);
|
||||
return(FPP_OK);
|
||||
}
|
||||
break;
|
||||
|
||||
case '\\':
|
||||
if (c1 == '\n') { /* Multi-line if */
|
||||
loop=TRUE;
|
||||
break;
|
||||
}
|
||||
cerror(global, ERROR_ILLEGAL_BACKSLASH);
|
||||
return(FPP_IF_ERROR);
|
||||
}
|
||||
if(!loop)
|
||||
unget(global);
|
||||
}
|
||||
} while(loop);
|
||||
*op=t;
|
||||
return(FPP_OK);
|
||||
}
|
||||
|
||||
#if OK_SIZEOF
|
||||
|
||||
INLINE FILE_LOCAL
|
||||
ReturnCode dosizeof(struct Global *global, int *result)
|
||||
{
|
||||
/*
|
||||
* Process the sizeof (basic type) operation in an #if string.
|
||||
* Sets evalue to the size and returns
|
||||
* DIG success
|
||||
* OP_FAIL bad parse or something.
|
||||
*/
|
||||
int c;
|
||||
TYPES *tp;
|
||||
SIZES *sizp;
|
||||
short *testp;
|
||||
short typecode;
|
||||
ReturnCode ret;
|
||||
|
||||
if ((c = skipws(global)) != '(') {
|
||||
unget(global);
|
||||
cerror(global, ERROR_SIZEOF_SYNTAX);
|
||||
return(FPP_SIZEOF_ERROR);
|
||||
}
|
||||
/*
|
||||
* Scan off the tokens.
|
||||
*/
|
||||
typecode = 0;
|
||||
while ((c = skipws(global))) {
|
||||
if((ret=macroid(global, &c)))
|
||||
return(ret);
|
||||
/* (I) return on fail! */
|
||||
if (c == EOF_CHAR || c == '\n') {
|
||||
/* End of line is a bug */
|
||||
unget(global);
|
||||
cerror(global, ERROR_SIZEOF_SYNTAX);
|
||||
return(FPP_SIZEOF_ERROR);
|
||||
} else if (c == '(') { /* thing (*)() func ptr */
|
||||
if (skipws(global) == '*'
|
||||
&& skipws(global) == ')') { /* We found (*) */
|
||||
if (skipws(global) != '(') /* Let () be optional */
|
||||
unget(global);
|
||||
else if (skipws(global) != ')') {
|
||||
unget(global);
|
||||
cerror(global, ERROR_SIZEOF_SYNTAX);
|
||||
return(FPP_SIZEOF_ERROR);
|
||||
}
|
||||
typecode |= T_FPTR; /* Function pointer */
|
||||
} else { /* Junk is a bug */
|
||||
unget(global);
|
||||
cerror(global, ERROR_SIZEOF_SYNTAX);
|
||||
return(FPP_SIZEOF_ERROR);
|
||||
}
|
||||
}
|
||||
else if (type[c] != LET) /* Exit if not a type */
|
||||
break;
|
||||
else if (!catenate(global, &ret) && !ret) { /* Maybe combine tokens */
|
||||
/*
|
||||
* Look for this unexpandable token in basic_types.
|
||||
* The code accepts "int long" as well as "long int"
|
||||
* which is a minor bug as bugs go (and one shared with
|
||||
* a lot of C compilers).
|
||||
*/
|
||||
for (tp = basic_types; tp->name != NULLST; tp++) {
|
||||
if (streq(global->tokenbuf, tp->name))
|
||||
break;
|
||||
}
|
||||
if (tp->name == NULLST) {
|
||||
cerror(global, ERROR_SIZEOF_UNKNOWN, global->tokenbuf);
|
||||
return(FPP_SIZEOF_ERROR);
|
||||
}
|
||||
typecode |= tp->type; /* Or in the type bit */
|
||||
} else if(ret)
|
||||
return(ret);
|
||||
}
|
||||
/*
|
||||
* We are at the end of the type scan. Chew off '*' if necessary.
|
||||
*/
|
||||
if (c == '*') {
|
||||
typecode |= T_PTR;
|
||||
c = skipws(global);
|
||||
}
|
||||
if (c == ')') { /* Last syntax check */
|
||||
for (testp = test_table; *testp != 0; testp++) {
|
||||
if (!bittest(typecode & *testp)) {
|
||||
cerror(global, ERROR_SIZEOF_ILLEGAL_TYPE);
|
||||
return(FPP_SIZEOF_ERROR);
|
||||
}
|
||||
}
|
||||
/*
|
||||
* We assume that all function pointers are the same size:
|
||||
* sizeof (int (*)()) == sizeof (float (*)())
|
||||
* We assume that signed and unsigned don't change the size:
|
||||
* sizeof (signed int) == (sizeof unsigned int)
|
||||
*/
|
||||
if ((typecode & T_FPTR) != 0) /* Function pointer */
|
||||
typecode = T_FPTR | T_PTR;
|
||||
else { /* Var or var * datum */
|
||||
typecode &= ~(T_SIGNED | T_UNSIGNED);
|
||||
if ((typecode & (T_SHORT | T_LONG)) != 0)
|
||||
typecode &= ~T_INT;
|
||||
}
|
||||
if ((typecode & ~T_PTR) == 0) {
|
||||
cerror(global, ERROR_SIZEOF_NO_TYPE);
|
||||
return(FPP_SIZEOF_ERROR);
|
||||
}
|
||||
/*
|
||||
* Exactly one bit (and possibly T_PTR) may be set.
|
||||
*/
|
||||
for (sizp = size_table; sizp->bits != 0; sizp++) {
|
||||
if ((typecode & ~T_PTR) == sizp->bits) {
|
||||
global->evalue = ((typecode & T_PTR) != 0)
|
||||
? sizp->psize : sizp->size;
|
||||
*result=DIG;
|
||||
return(FPP_OK);
|
||||
}
|
||||
} /* We shouldn't fail */
|
||||
cerror(global, ERROR_SIZEOF_BUG, typecode);
|
||||
return(FPP_SIZEOF_ERROR);
|
||||
}
|
||||
unget(global);
|
||||
cerror(global, ERROR_SIZEOF_SYNTAX);
|
||||
return(FPP_SIZEOF_ERROR);
|
||||
}
|
||||
|
||||
INLINE FILE_LOCAL
|
||||
int bittest(int value)
|
||||
{
|
||||
/*
|
||||
* TRUE if value is zero or exactly one bit is set in value.
|
||||
*/
|
||||
|
||||
#if (4096 & ~(-4096)) == 0
|
||||
return ((value & ~(-value)) == 0);
|
||||
#else
|
||||
/*
|
||||
* Do it the hard way (for non 2's complement machines)
|
||||
*/
|
||||
return (value == 0 || value ^ (value - 1) == (value * 2 - 1));
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif /* OK_SIZEOF */
|
||||
|
||||
INLINE FILE_LOCAL
|
||||
int evalnum(struct Global *global, int c)
|
||||
{
|
||||
/*
|
||||
* Expand number for #if lexical analysis. Note: evalnum recognizes
|
||||
* the unsigned suffix, but only returns a signed int value.
|
||||
*/
|
||||
|
||||
int value;
|
||||
int base;
|
||||
int c1;
|
||||
|
||||
if (c != '0')
|
||||
base = 10;
|
||||
else if ((c = cget(global)) == 'x' || c == 'X') {
|
||||
base = 16;
|
||||
c = cget(global);
|
||||
}
|
||||
else base = 8;
|
||||
value = 0;
|
||||
for (;;) {
|
||||
c1 = c;
|
||||
if (isascii(c) && isupper(c1))
|
||||
c1 = tolower(c1);
|
||||
if (c1 >= 'a')
|
||||
c1 -= ('a' - 10);
|
||||
else c1 -= '0';
|
||||
if (c1 < 0 || c1 >= base)
|
||||
break;
|
||||
value *= base;
|
||||
value += c1;
|
||||
c = cget(global);
|
||||
}
|
||||
if (c == 'u' || c == 'U') /* Unsigned nonsense */
|
||||
c = cget(global);
|
||||
unget(global);
|
||||
return (value);
|
||||
}
|
||||
|
||||
INLINE FILE_LOCAL
|
||||
int evalchar(struct Global *global,
|
||||
int skip) /* TRUE if short-circuit evaluation */
|
||||
/*
|
||||
* Get a character constant
|
||||
*/
|
||||
{
|
||||
int c;
|
||||
int value;
|
||||
int count;
|
||||
|
||||
global->instring = TRUE;
|
||||
if ((c = cget(global)) == '\\') {
|
||||
switch ((c = cget(global))) {
|
||||
case 'a': /* New in Standard */
|
||||
#if ('a' == '\a' || '\a' == ALERT)
|
||||
value = ALERT; /* Use predefined value */
|
||||
#else
|
||||
value = '\a'; /* Use compiler's value */
|
||||
#endif
|
||||
break;
|
||||
|
||||
case 'b':
|
||||
value = '\b';
|
||||
break;
|
||||
|
||||
case 'f':
|
||||
value = '\f';
|
||||
break;
|
||||
|
||||
case 'n':
|
||||
value = '\n';
|
||||
break;
|
||||
|
||||
case 'r':
|
||||
value = '\r';
|
||||
break;
|
||||
|
||||
case 't':
|
||||
value = '\t';
|
||||
break;
|
||||
|
||||
case 'v': /* New in Standard */
|
||||
#if ('v' == '\v' || '\v' == VT)
|
||||
value = VT; /* Use predefined value */
|
||||
#else
|
||||
value = '\v'; /* Use compiler's value */
|
||||
#endif
|
||||
break;
|
||||
|
||||
case 'x': /* '\xFF' */
|
||||
count = 3;
|
||||
value = 0;
|
||||
while ((((c = get(global)) >= '0' && c <= '9')
|
||||
|| (c >= 'a' && c <= 'f')
|
||||
|| (c >= 'A' && c <= 'F'))
|
||||
&& (--count >= 0)) {
|
||||
value *= 16;
|
||||
value += (c <= '9') ? (c - '0') : ((c & 0xF) + 9);
|
||||
}
|
||||
unget(global);
|
||||
break;
|
||||
|
||||
default:
|
||||
if (c >= '0' && c <= '7') {
|
||||
count = 3;
|
||||
value = 0;
|
||||
while (c >= '0' && c <= '7' && --count >= 0) {
|
||||
value *= 8;
|
||||
value += (c - '0');
|
||||
c = get(global);
|
||||
}
|
||||
unget(global);
|
||||
} else
|
||||
value = c;
|
||||
break;
|
||||
}
|
||||
} else if (c == '\'')
|
||||
value = 0;
|
||||
else value = c;
|
||||
/*
|
||||
* We warn on multi-byte constants and try to hack
|
||||
* (big|little)endian machines.
|
||||
*/
|
||||
#if BIG_ENDIAN
|
||||
count = 0;
|
||||
#endif
|
||||
while ((c = get(global)) != '\'' && c != EOF_CHAR && c != '\n') {
|
||||
if (!skip)
|
||||
cwarn(global, WARN_MULTIBYTE_NOT_PORTABLE, c);
|
||||
#if BIG_ENDIAN
|
||||
count += BITS_CHAR;
|
||||
value += (c << count);
|
||||
#else
|
||||
value <<= BITS_CHAR;
|
||||
value += c;
|
||||
#endif
|
||||
}
|
||||
global->instring = FALSE;
|
||||
return (value);
|
||||
}
|
||||
|
||||
INLINE FILE_LOCAL
|
||||
int *evaleval(struct Global *global,
|
||||
int *valp,
|
||||
int op,
|
||||
int skip) /* TRUE if short-circuit evaluation */
|
||||
{
|
||||
/*
|
||||
* Apply the argument operator to the data on the value stack.
|
||||
* One or two values are popped from the value stack and the result
|
||||
* is pushed onto the value stack.
|
||||
*
|
||||
* OP_COL is a special case.
|
||||
*
|
||||
* evaleval() returns the new pointer to the top of the value stack.
|
||||
*/
|
||||
int v1, v2 = 0;
|
||||
|
||||
if (isbinary(op))
|
||||
v2 = *--valp;
|
||||
v1 = *--valp;
|
||||
switch (op) {
|
||||
case OP_EOE:
|
||||
break;
|
||||
case OP_ADD:
|
||||
v1 += v2;
|
||||
break;
|
||||
case OP_SUB:
|
||||
v1 -= v2;
|
||||
break;
|
||||
case OP_MUL:
|
||||
v1 *= v2;
|
||||
break;
|
||||
case OP_DIV:
|
||||
case OP_MOD:
|
||||
if (v2 == 0) {
|
||||
if (!skip) {
|
||||
cwarn(global, WARN_DIVISION_BY_ZERO,
|
||||
(op == OP_DIV) ? "divide" : "mod");
|
||||
}
|
||||
v1 = 0;
|
||||
}
|
||||
else if (op == OP_DIV)
|
||||
v1 /= v2;
|
||||
else
|
||||
v1 %= v2;
|
||||
break;
|
||||
case OP_ASL:
|
||||
v1 <<= v2;
|
||||
break;
|
||||
case OP_ASR:
|
||||
v1 >>= v2;
|
||||
break;
|
||||
case OP_AND:
|
||||
v1 &= v2;
|
||||
break;
|
||||
case OP_OR:
|
||||
v1 |= v2;
|
||||
break;
|
||||
case OP_XOR:
|
||||
v1 ^= v2;
|
||||
break;
|
||||
case OP_EQ:
|
||||
v1 = (v1 == v2);
|
||||
break;
|
||||
case OP_NE:
|
||||
v1 = (v1 != v2);
|
||||
break;
|
||||
case OP_LT:
|
||||
v1 = (v1 < v2);
|
||||
break;
|
||||
case OP_LE:
|
||||
v1 = (v1 <= v2);
|
||||
break;
|
||||
case OP_GE:
|
||||
v1 = (v1 >= v2);
|
||||
break;
|
||||
case OP_GT:
|
||||
v1 = (v1 > v2);
|
||||
break;
|
||||
case OP_ANA:
|
||||
v1 = (v1 && v2);
|
||||
break;
|
||||
case OP_ORO:
|
||||
v1 = (v1 || v2);
|
||||
break;
|
||||
case OP_COL:
|
||||
/*
|
||||
* v1 has the "true" value, v2 the "false" value.
|
||||
* The top of the value stack has the test.
|
||||
*/
|
||||
v1 = (*--valp) ? v1 : v2;
|
||||
break;
|
||||
case OP_NEG:
|
||||
v1 = (-v1);
|
||||
break;
|
||||
case OP_PLU:
|
||||
break;
|
||||
case OP_COM:
|
||||
v1 = ~v1;
|
||||
break;
|
||||
case OP_NOT:
|
||||
v1 = !v1;
|
||||
break;
|
||||
default:
|
||||
cerror(global, ERROR_IF_OPERAND, op);
|
||||
v1 = 0;
|
||||
}
|
||||
*valp++ = v1;
|
||||
return (valp);
|
||||
}
|
File diff suppressed because it is too large
Load Diff
|
@ -1,414 +0,0 @@
|
|||
/******************************************************************************
|
||||
* FREXXWARE
|
||||
* ----------------------------------------------------------------------------
|
||||
*
|
||||
* Project: Frexx C Preprocessor
|
||||
* $Source: /home/user/start/cpp/RCS/cppadd.h,v $
|
||||
* $Revision: 1.5 $
|
||||
* $Date: 1994/01/24 09:38:12 $
|
||||
* $Author: start $
|
||||
* $State: Exp $
|
||||
* $Locker: start $
|
||||
*
|
||||
* ----------------------------------------------------------------------------
|
||||
* $Log: cppadd.h,v $
|
||||
* Revision 1.5 1994/01/24 09:38:12 start
|
||||
* Added the 'rightconcat' in the global structure.
|
||||
*
|
||||
* Revision 1.4 1993/12/06 13:51:20 start
|
||||
* A lot of new stuff (too much to mention)
|
||||
*
|
||||
* Revision 1.3 1993/11/29 14:01:13 start
|
||||
* New features added
|
||||
*
|
||||
* Revision 1.2 1993/11/11 07:16:39 start
|
||||
* New stuff
|
||||
*
|
||||
* Revision 1.1 1993/11/03 09:15:59 start
|
||||
* Initial revision
|
||||
*
|
||||
*
|
||||
*****************************************************************************/
|
||||
/**********************************************************************
|
||||
*
|
||||
* cppadd.h
|
||||
*
|
||||
* Prototypes and structures added by Daniel Stenberg.
|
||||
*
|
||||
*******/
|
||||
|
||||
#include <stdarg.h>
|
||||
#include "memory.h"
|
||||
|
||||
struct Global {
|
||||
|
||||
/*
|
||||
* Commonly used global variables:
|
||||
* line is the current input line number.
|
||||
* wrongline is set in many places when the actual output
|
||||
* line is out of sync with the numbering, e.g,
|
||||
* when expanding a macro with an embedded newline.
|
||||
*
|
||||
* tokenbuf holds the last identifier scanned (which might
|
||||
* be a candidate for macro expansion).
|
||||
* errors is the running cpp error counter.
|
||||
* infile is the head of a linked list of input files (extended by
|
||||
* #include and macros being expanded). infile always points
|
||||
* to the current file/macro. infile->parent to the includer,
|
||||
* etc. infile->fd is NULL if this input stream is a macro.
|
||||
*/
|
||||
int line; /* Current line number */
|
||||
int wrongline; /* Force #line to compiler */
|
||||
char *tokenbuf; /* Buffer for current input token */
|
||||
char *functionname; /* Buffer for current function */
|
||||
int funcline; /* Line number of current function */
|
||||
int tokenbsize; /* Allocated size of tokenbuf, */
|
||||
/* not counting zero at end. */
|
||||
int errors; /* cpp error counter */
|
||||
FILEINFO *infile; /* Current input file */
|
||||
#if DEBUG
|
||||
int debug; /* TRUE if debugging now */
|
||||
#endif
|
||||
/*
|
||||
* This counter is incremented when a macro expansion is initiated.
|
||||
* If it exceeds a built-in value, the expansion stops -- this tests
|
||||
* for a runaway condition:
|
||||
* #define X Y
|
||||
* #define Y X
|
||||
* X
|
||||
* This can be disabled by falsifying rec_recover. (Nothing does this
|
||||
* currently: it is a hook for an eventual invocation flag.)
|
||||
*/
|
||||
int recursion; /* Infinite recursion counter */
|
||||
int rec_recover; /* Unwind recursive macros */
|
||||
|
||||
/*
|
||||
* instring is set TRUE when a string is scanned. It modifies the
|
||||
* behavior of the "get next character" routine, causing all characters
|
||||
* to be passed to the caller (except <DEF_MAGIC>). Note especially that
|
||||
* comments and \<newline> are not removed from the source. (This
|
||||
* prevents cpp output lines from being arbitrarily long).
|
||||
*
|
||||
* inmacro is set by #define -- it absorbs comments and converts
|
||||
* form-feed and vertical-tab to space, but returns \<newline>
|
||||
* to the caller. Strictly speaking, this is a bug as \<newline>
|
||||
* shouldn't delimit tokens, but we'll worry about that some other
|
||||
* time -- it is more important to prevent infinitly long output lines.
|
||||
*
|
||||
* instring and inmarcor are parameters to the get() routine which
|
||||
* were made global for speed.
|
||||
*/
|
||||
int instring; /* TRUE if scanning string */
|
||||
int inmacro; /* TRUE if #defining a macro */
|
||||
|
||||
/*
|
||||
* work[] and workp are used to store one piece of text in a temporay
|
||||
* buffer. To initialize storage, set workp = work. To store one
|
||||
* character, call save(c); (This will fatally exit if there isn't
|
||||
* room.) To terminate the string, call save(EOS). Note that
|
||||
* the work buffer is used by several subroutines -- be sure your
|
||||
* data won't be overwritten. The extra byte in the allocation is
|
||||
* needed for string formal replacement.
|
||||
*/
|
||||
char work[NWORK + 1]; /* Work buffer */
|
||||
char *workp; /* Work buffer pointer */
|
||||
|
||||
/*
|
||||
* keepcomments is set TRUE by the -C option. If TRUE, comments
|
||||
* are written directly to the output stream. This is needed if
|
||||
* the output from cpp is to be passed to lint (which uses commands
|
||||
* embedded in comments). cflag contains the permanent state of the
|
||||
* -C flag. keepcomments is always falsified when processing #control
|
||||
* commands and when compilation is supressed by a false #if
|
||||
*
|
||||
* If eflag is set, CPP returns "success" even if non-fatal errors
|
||||
* were detected.
|
||||
*
|
||||
* If nflag is non-zero, no symbols are predefined except __LINE__.
|
||||
* __FILE__, and __DATE__. If nflag > 1, absolutely no symbols
|
||||
* are predefined.
|
||||
*/
|
||||
char keepcomments; /* Write out comments flag */
|
||||
char cflag; /* -C option (keep comments) */
|
||||
char eflag; /* -E option (never fail) */
|
||||
char nflag; /* -N option (no predefines) */
|
||||
char wflag; /* -W option (write #defines) */
|
||||
|
||||
/*
|
||||
* ifstack[] holds information about nested #if's. It is always
|
||||
* accessed via *ifptr. The information is as follows:
|
||||
* WAS_COMPILING state of compiling flag at outer level.
|
||||
* ELSE_SEEN set TRUE when #else seen to prevent 2nd #else.
|
||||
* TRUE_SEEN set TRUE when #if or #elif succeeds
|
||||
* ifstack[0] holds the compiling flag. It is TRUE if compilation
|
||||
* is currently enabled. Note that this must be initialized TRUE.
|
||||
*/
|
||||
char ifstack[BLK_NEST]; /* #if information */
|
||||
char *ifptr; /* -> current ifstack[] */
|
||||
|
||||
/*
|
||||
* incdir[] stores the -i directories (and the system-specific
|
||||
* #include <...> directories.
|
||||
*/
|
||||
char *incdir[NINCLUDE]; /* -i directories */
|
||||
char **incend; /* -> free space in incdir[] */
|
||||
|
||||
/*
|
||||
* include[] stores the -X and -x files.
|
||||
*/
|
||||
char *include[NINCLUDE];
|
||||
char includeshow[NINCLUDE]; /* show it or not! */
|
||||
char included;
|
||||
|
||||
/*
|
||||
* This is the table used to predefine target machine and operating
|
||||
* system designators. It may need hacking for specific circumstances.
|
||||
* Note: it is not clear that this is part of the Ansi Standard.
|
||||
* The -B option supresses preset definitions.
|
||||
*/
|
||||
char *preset[5]; /* names defined at cpp start */
|
||||
|
||||
/*
|
||||
* The value of these predefined symbols must be recomputed whenever
|
||||
* they are evaluated. The order must not be changed.
|
||||
*/
|
||||
char *magic[5]; /* Note: order is important */
|
||||
|
||||
/*
|
||||
* This is the variable saying if Cpp should remove C++ style comments from
|
||||
* the output. Default is... TRUE, yes, pronto, do it!!!
|
||||
*/
|
||||
|
||||
char cplusplus;
|
||||
|
||||
char *sharpfilename;
|
||||
|
||||
|
||||
/*
|
||||
* parm[], parmp, and parlist[] are used to store #define() argument
|
||||
* lists. nargs contains the actual number of parameters stored.
|
||||
*/
|
||||
char parm[NPARMWORK + 1]; /* define param work buffer */
|
||||
char *parmp; /* Free space in parm */
|
||||
char *parlist[LASTPARM]; /* -> start of each parameter */
|
||||
int nargs; /* Parameters for this macro */
|
||||
|
||||
DEFBUF *macro; /* Catches start of infinite macro */
|
||||
|
||||
DEFBUF *symtab[SBSIZE]; /* Symbol table queue headers */
|
||||
|
||||
int evalue; /* Current value from evallex() */
|
||||
|
||||
void (*depends)(char *filename, void *); /* depends function */
|
||||
|
||||
char *(*input)(char *, int, void *); /* Input function */
|
||||
|
||||
char *first_file; /* Preprocessed file. */
|
||||
|
||||
void *userdata; /* Data sent to input function */
|
||||
|
||||
void (*output)(int, void *); /* output function */
|
||||
|
||||
void (*error)(void *, char *, va_list); /* error function */
|
||||
|
||||
char linelines;
|
||||
|
||||
char warnillegalcpp; /* warn for illegal preprocessor instructions? */
|
||||
|
||||
char outputLINE; /* output 'line' in #line instructions */
|
||||
|
||||
char showversion; /* display version */
|
||||
|
||||
char showincluded; /* display included files */
|
||||
|
||||
char showbalance; /* display paren balance */
|
||||
|
||||
char showspace; /* display all whitespaces as they are */
|
||||
|
||||
char comment; /* TRUE if a comment just has been written to output */
|
||||
|
||||
char *spacebuf; /* Buffer to store whitespaces in if -H */
|
||||
|
||||
long chpos; /* Number of whitespaces in buffer */
|
||||
|
||||
char nestcomments; /* Allow nested comments */
|
||||
|
||||
char warnnestcomments; /* Warn at nested comments */
|
||||
|
||||
char warnnoinclude; /* Warn at missing include file */
|
||||
|
||||
char outputfile; /* output the main file */
|
||||
|
||||
char out; /* should we output anything now? */
|
||||
|
||||
char rightconcat; /* should the right part of a concatenation be avaluated
|
||||
before the concat (TRUE) or after (FALSE) */
|
||||
char *initialfunc; /* file to include first in all functions */
|
||||
|
||||
char *excludedinit[20]; /* functions (names) excluded from the initfunc */
|
||||
int excluded;
|
||||
|
||||
char outputfunctions; /* output all discovered functions to stderr! */
|
||||
|
||||
char webmode; /* WWW process mode */
|
||||
};
|
||||
|
||||
typedef enum {
|
||||
ERROR_STRING_MUST_BE_IF,
|
||||
ERROR_STRING_MAY_NOT_FOLLOW_ELSE,
|
||||
ERROR_ERROR,
|
||||
ERROR_PREPROC_FAILURE,
|
||||
ERROR_MISSING_ARGUMENT,
|
||||
ERROR_INCLUDE_SYNTAX,
|
||||
ERROR_DEFINE_SYNTAX,
|
||||
ERROR_REDEFINE,
|
||||
ERROR_ILLEGAL_UNDEF,
|
||||
ERROR_RECURSIVE_MACRO,
|
||||
ERROR_EOF_IN_ARGUMENT,
|
||||
ERROR_MISPLACED_CONSTANT,
|
||||
ERROR_IF_OVERFLOW,
|
||||
ERROR_ILLEGAL_IF_LINE,
|
||||
ERROR_OPERATOR,
|
||||
ERROR_EXPR_OVERFLOW,
|
||||
ERROR_UNBALANCED_PARENS,
|
||||
ERROR_MISPLACED,
|
||||
ERROR_STRING_IN_IF,
|
||||
ERROR_DEFINED_SYNTAX,
|
||||
ERROR_ILLEGAL_ASSIGN,
|
||||
ERROR_ILLEGAL_BACKSLASH,
|
||||
ERROR_SIZEOF_SYNTAX,
|
||||
ERROR_SIZEOF_UNKNOWN,
|
||||
ERROR_SIZEOF_ILLEGAL_TYPE,
|
||||
ERROR_SIZEOF_NO_TYPE,
|
||||
ERROR_UNTERMINATED_STRING,
|
||||
ERROR_EOF_IN_COMMENT,
|
||||
ERROR_IFDEF_DEPTH,
|
||||
ERROR_ILLEGAL_CHARACTER,
|
||||
ERROR_ILLEGAL_CHARACTER2,
|
||||
ERROR_SIZEOF_BUG,
|
||||
ERROR_IF_OPERAND,
|
||||
ERROR_STRANG_CHARACTER,
|
||||
ERROR_STRANG_CHARACTER2,
|
||||
|
||||
BORDER_ERROR_WARN, /* below this number: errors, above: warnings */
|
||||
|
||||
WARN_CONTROL_LINE_IN_MACRO,
|
||||
WARN_ILLEGAL_COMMAND,
|
||||
WARN_UNEXPECTED_TEXT_IGNORED,
|
||||
WARN_TOO_FEW_VALUES_TO_SIZEOF,
|
||||
WARN_TOO_MANY_VALUES_TO_SIZEOF,
|
||||
WARN_NOT_DEFINED,
|
||||
WARN_INTERNAL_ERROR,
|
||||
WARN_MACRO_NEEDS_ARGUMENTS,
|
||||
WARN_WRONG_NUMBER_ARGUMENTS,
|
||||
WARN_DIVISION_BY_ZERO,
|
||||
WARN_ILLEGAL_OCTAL,
|
||||
WARN_MULTIBYTE_NOT_PORTABLE,
|
||||
WARN_CANNOT_OPEN_INCLUDE,
|
||||
WARN_BRACKET_DEPTH,
|
||||
WARN_PAREN_DEPTH,
|
||||
WARN_BRACE_DEPTH,
|
||||
WARN_NESTED_COMMENT,
|
||||
|
||||
BORDER_WARN_FATAL, /* below this number: warnings, above: fatals */
|
||||
|
||||
FATAL_TOO_MANY_NESTINGS,
|
||||
FATAL_FILENAME_BUFFER_OVERFLOW,
|
||||
FATAL_TOO_MANY_INCLUDE_DIRS,
|
||||
FATAL_TOO_MANY_INCLUDE_FILES,
|
||||
FATAL_TOO_MANY_ARGUMENTS_MACRO,
|
||||
FATAL_MACRO_AREA_OVERFLOW,
|
||||
FATAL_ILLEGAL_MACRO,
|
||||
FATAL_TOO_MANY_ARGUMENTS_EXPANSION,
|
||||
FATAL_OUT_OF_SPACE_IN_ARGUMENT,
|
||||
FATAL_WORK_AREA_OVERFLOW,
|
||||
FATAL_WORK_BUFFER_OVERFLOW,
|
||||
FATAL_OUT_OF_MEMORY,
|
||||
FATAL_TOO_MUCH_PUSHBACK
|
||||
|
||||
|
||||
} ErrorCode;
|
||||
|
||||
/**********************************************************************
|
||||
* RETURN CODES:
|
||||
*********************************************************************/
|
||||
|
||||
typedef enum {
|
||||
FPP_OK,
|
||||
FPP_OUT_OF_MEMORY,
|
||||
FPP_TOO_MANY_NESTED_STATEMENTS,
|
||||
FPP_FILENAME_BUFFER_OVERFLOW,
|
||||
FPP_NO_INCLUDE,
|
||||
FPP_OPEN_ERROR,
|
||||
FPP_TOO_MANY_ARGUMENTS,
|
||||
FPP_WORK_AREA_OVERFLOW,
|
||||
FPP_ILLEGAL_MACRO,
|
||||
FPP_EOF_IN_MACRO,
|
||||
FPP_OUT_OF_SPACE_IN_MACRO_EXPANSION,
|
||||
FPP_ILLEGAL_CHARACTER,
|
||||
FPP_CANT_USE_STRING_IN_IF,
|
||||
FPP_BAD_IF_DEFINED_SYNTAX,
|
||||
FPP_IF_ERROR,
|
||||
FPP_SIZEOF_ERROR,
|
||||
FPP_UNTERMINATED_STRING,
|
||||
FPP_TOO_MANY_INCLUDE_DIRS,
|
||||
FPP_TOO_MANY_INCLUDE_FILES,
|
||||
FPP_INTERNAL_ERROR,
|
||||
|
||||
FPP_LAST_ERROR
|
||||
} ReturnCode;
|
||||
|
||||
/* Nasty defines to make them appear as three different functions! */
|
||||
#define cwarn cerror
|
||||
#define cfatal cerror
|
||||
|
||||
|
||||
/**********************************************************************
|
||||
* PROTOTYPES:
|
||||
*********************************************************************/
|
||||
int PREFIX fppPreProcess(REG(a0) struct fppTag *);
|
||||
void Freemem(void *);
|
||||
void Error(struct Global *, char *, ...);
|
||||
void Putchar(struct Global *, int);
|
||||
void Putstring(struct Global *, char *);
|
||||
void Putint(struct Global *, int);
|
||||
char *savestring(struct Global *, char *);
|
||||
ReturnCode addfile(struct Global *, FILE *, char *);
|
||||
int catenate(struct Global *, ReturnCode *);
|
||||
void cerror(struct Global *, ErrorCode, ...);
|
||||
ReturnCode control(struct Global *, int *);
|
||||
ReturnCode dodefine(struct Global *);
|
||||
int dooptions(struct Global *, struct fppTag *);
|
||||
void doundef(struct Global *);
|
||||
void dumpparm(char *);
|
||||
ReturnCode expand(struct Global *, DEFBUF *);
|
||||
int get(struct Global *);
|
||||
ReturnCode initdefines(struct Global *);
|
||||
void outdefines(struct Global *);
|
||||
ReturnCode save(struct Global *, int);
|
||||
void scanid(struct Global *, int);
|
||||
ReturnCode scannumber(struct Global *, int, ReturnCode(*)(struct Global *, int));
|
||||
ReturnCode scanstring(struct Global *, int, ReturnCode(*)(struct Global *, int));
|
||||
void unget(struct Global *);
|
||||
ReturnCode ungetstring(struct Global *, char *);
|
||||
ReturnCode eval(struct Global *, int *);
|
||||
#ifdef DEBUG_EVAL
|
||||
void dumpstack(OPTAB[NEXP], register OPTAB *, int [NEXP], register int *);
|
||||
#endif
|
||||
void skipnl(struct Global *);
|
||||
int skipws(struct Global *);
|
||||
ReturnCode macroid(struct Global *, int *);
|
||||
ReturnCode getfile(struct Global *, size_t, char *, FILEINFO **);
|
||||
DEFBUF *lookid(struct Global *, int );
|
||||
DEFBUF *defendel(struct Global *, char *, int);
|
||||
#if DEBUG
|
||||
void dumpdef(char *);
|
||||
void dumpadef(char *, register DEFBUF *);
|
||||
#endif
|
||||
ReturnCode openfile(struct Global *,char *);
|
||||
int cget(struct Global *);
|
||||
void delbuiltindefines(struct Global *);
|
||||
void delalldefines(struct Global *);
|
||||
char *Getmem(struct Global *, int);
|
||||
ReturnCode openinclude(struct Global *, char *, int);
|
||||
ReturnCode expstuff(struct Global *, char *, char *);
|
|
@ -1,383 +0,0 @@
|
|||
/******************************************************************************
|
||||
* FREXXWARE
|
||||
* ----------------------------------------------------------------------------
|
||||
*
|
||||
* Project: Frexx C Preprocessor
|
||||
* $Source: /home/user/start/cpp/RCS/cppdef.h,v $
|
||||
* $Revision: 1.4 $
|
||||
* $Date: 1993/12/06 13:51:20 $
|
||||
* $Author: start $
|
||||
* $State: Exp $
|
||||
* $Locker: start $
|
||||
*
|
||||
* ----------------------------------------------------------------------------
|
||||
* $Log: cppdef.h,v $
|
||||
* Revision 1.4 1993/12/06 13:51:20 start
|
||||
* A lot of new stuff (too much to mention)
|
||||
*
|
||||
* Revision 1.3 1993/11/29 14:01:13 start
|
||||
* New features added
|
||||
*
|
||||
* Revision 1.2 1993/11/11 07:16:39 start
|
||||
* New stuff
|
||||
*
|
||||
* Revision 1.1 1993/11/03 09:15:59 start
|
||||
* Initial revision
|
||||
*
|
||||
*
|
||||
*****************************************************************************/
|
||||
#ifdef EMACS
|
||||
|
||||
/* Use the Emacs config file to find out what type of machine */
|
||||
|
||||
#define NO_SHORTNAMES
|
||||
|
||||
/* Convert Emacs's conventions for BIG_ENDIAN to cpp's convention. */
|
||||
#ifdef BIG_ENDIAN
|
||||
#undef BIG_ENDIAN
|
||||
#define BIG_ENDIAN TRUE
|
||||
#else /* not BIG_ENDIAN */
|
||||
#define BIG_ENDIAN FALSE
|
||||
#endif /* BIG_ENDIAN */
|
||||
|
||||
/* Emacs uses the names index and rindex and defines them as str(r)chr if nec;
|
||||
cpp uses the opposite convention. Here we flush the macro definitions for
|
||||
Emacs and add the ones cpp wants. */
|
||||
|
||||
#ifdef index
|
||||
#undef index
|
||||
#undef rindex
|
||||
#else /* index is not defined as a macro */
|
||||
#define strchr index
|
||||
#define strrchr rindex
|
||||
#endif /* index is not defined as a macro */
|
||||
|
||||
#define NBUFF 2048
|
||||
#define NWORK 2048
|
||||
|
||||
#endif /* EMACS */
|
||||
|
||||
/*
|
||||
* S y s t e m D e p e n d e n t
|
||||
* D e f i n i t i o n s f o r C P P
|
||||
*
|
||||
* Definitions in this file may be edited to configure CPP for particular
|
||||
* host operating systems and target configurations.
|
||||
*
|
||||
* NOTE: cpp assumes it is compiled by a compiler that supports macros
|
||||
* with arguments. If this is not the case (as for Decus C), #define
|
||||
* nomacarg -- and provide function equivalents for all macros.
|
||||
*
|
||||
* cpp also assumes the host and target implement the Ascii character set.
|
||||
* If this is not the case, you will have to do some editing here and there.
|
||||
*/
|
||||
|
||||
/*
|
||||
* This redundant definition of TRUE and FALSE works around
|
||||
* a limitation of Decus C.
|
||||
*/
|
||||
#ifndef TRUE
|
||||
#define TRUE 1
|
||||
#define FALSE 0
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Define the HOST operating system. This is needed so that
|
||||
* cpp can use appropriate filename conventions.
|
||||
*/
|
||||
#define SYS_UNKNOWN 0
|
||||
#define SYS_UNIX 1
|
||||
#define SYS_VMS 2
|
||||
#define SYS_RSX 3
|
||||
#define SYS_RT11 4
|
||||
#define SYS_LATTICE 5
|
||||
#define SYS_ONYX 6
|
||||
#define SYS_68000 7
|
||||
#define SYS_AMIGADOS 8
|
||||
|
||||
#ifndef HOST
|
||||
#ifdef unix
|
||||
#define HOST SYS_UNIX
|
||||
#else
|
||||
#ifdef amiga
|
||||
#define HOST SYS_AMIGADOS
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/*
|
||||
* We assume that the target is the same as the host system
|
||||
*/
|
||||
#ifndef TARGET
|
||||
#define TARGET HOST
|
||||
#endif
|
||||
|
||||
/*
|
||||
* In order to predefine machine-dependent constants,
|
||||
* several strings are defined here:
|
||||
*
|
||||
* MACHINE defines the target cpu (by name)
|
||||
* SYSTEM defines the target operating system
|
||||
* COMPILER defines the target compiler
|
||||
*
|
||||
* The above may be #defined as "" if they are not wanted.
|
||||
* They should not be #defined as NULL.
|
||||
*
|
||||
* LINE_PREFIX defines the # output line prefix, if not "line"
|
||||
* This should be defined as "" if cpp is to replace
|
||||
* the "standard" C pre-processor.
|
||||
*/
|
||||
#define LINE_PREFIX "line"
|
||||
/*
|
||||
* FILE_LOCAL marks functions which are referenced only in the
|
||||
* file they reside. Some C compilers allow these
|
||||
* to be marked "static" even though they are referenced
|
||||
* by "extern" statements elsewhere.
|
||||
*
|
||||
* OK_DOLLAR Should be set TRUE if $ is a valid alphabetic character
|
||||
* in identifiers (default), or zero if $ is invalid.
|
||||
* Default is TRUE.
|
||||
*
|
||||
* OK_CONCAT Should be set TRUE if # may be used to concatenate
|
||||
* tokens in macros (per the Ansi Draft Standard) or
|
||||
* FALSE for old-style # processing (needed if cpp is
|
||||
* to process assembler source code).
|
||||
*/
|
||||
#define OK_CONCAT TRUE
|
||||
/*
|
||||
* OK_DATE Predefines the compilation date if set TRUE.
|
||||
* Not permitted by the Nov. 12, 1984 Draft Standard.
|
||||
*/
|
||||
#define OK_DATE TRUE
|
||||
/*
|
||||
*
|
||||
* OK_SIZEOF Permits sizeof in #if preprocessor expressions.
|
||||
* According to K&R V2 (page 232), this is not allowed.
|
||||
*/
|
||||
#define OK_SIZEOF TRUE
|
||||
/*
|
||||
* S_CHAR etc. Define the sizeof the basic TARGET machine word types.
|
||||
* By default, sizes are set to the values for the HOST
|
||||
* computer. If this is inappropriate, see the code in
|
||||
* cpp3.c for details on what to change. Also, if you
|
||||
* have a machine where sizeof (signed int) differs from
|
||||
* sizeof (unsigned int), you will have to edit code and
|
||||
* tables in cpp3.c (and extend the -S option definition.)
|
||||
*
|
||||
* CPP_LIBRARY May be defined if you have a site-specific include directory
|
||||
* which is to be searched *before* the operating-system
|
||||
* specific directories.
|
||||
*/
|
||||
|
||||
#define MACHINE "amiga", "m68000"
|
||||
#define SYSTEM "amigados"
|
||||
|
||||
|
||||
/*
|
||||
* defaults
|
||||
*/
|
||||
|
||||
#ifndef MSG_PREFIX
|
||||
#define MSG_PREFIX "cpp: "
|
||||
#endif
|
||||
|
||||
/*
|
||||
* OLD_PREPROCESSOR forces the definition of OK_DOLLAR, OK_CONCAT,
|
||||
* COMMENT_INVISIBLE to values appropriate for
|
||||
* an old-style preprocessor.
|
||||
*/
|
||||
|
||||
#if OLD_PREPROCESSOR
|
||||
#define OK_DOLLAR FALSE
|
||||
#define OK_CONCAT FALSE
|
||||
#define COMMENT_INVISIBLE TRUE
|
||||
#endif
|
||||
|
||||
/*
|
||||
* RECURSION_LIMIT may be set to -1 to disable the macro recursion test.
|
||||
*/
|
||||
#ifndef RECURSION_LIMIT
|
||||
#define RECURSION_LIMIT 1000
|
||||
#endif
|
||||
|
||||
/*
|
||||
* BITS_CHAR may be defined to set the number of bits per character.
|
||||
* it is needed only for multi-byte character constants.
|
||||
*/
|
||||
#ifndef BITS_CHAR
|
||||
#define BITS_CHAR 8
|
||||
#endif
|
||||
|
||||
/*
|
||||
* BIG_ENDIAN is set TRUE on machines (such as the IBM 360 series)
|
||||
* where 'ab' stores 'a' in the high-bits and 'b' in the low-bits.
|
||||
* It is set FALSE on machines (such as the PDP-11 and Vax-11)
|
||||
* where 'ab' stores 'a' in the low-bits and 'b' in the high-bits.
|
||||
* (Or is it the other way around?) -- Warning: BIG_ENDIAN code is untested.
|
||||
* [I *seems* to be the other way around, according to the code /OIS]
|
||||
*/
|
||||
#ifndef BIG_ENDIAN
|
||||
#define BIG_ENDIAN FALSE
|
||||
#endif
|
||||
|
||||
/*
|
||||
* COMMENT_INVISIBLE may be defined to allow "old-style" comment
|
||||
* processing, whereby the comment becomes a zero-length token
|
||||
* delimiter. This permitted tokens to be concatenated in macro
|
||||
* expansions. This was removed from the Draft Ansi Standard.
|
||||
*/
|
||||
#ifndef COMMENT_INVISIBLE
|
||||
#define COMMENT_INVISIBLE FALSE
|
||||
#endif
|
||||
|
||||
/*
|
||||
* OK_DOLLAR enables use of $ as a valid "letter" in identifiers.
|
||||
* This is a permitted extension to the Ansi Standard and is required
|
||||
* for e.g., VMS, RSX-11M, etc. It should be set FALSE if cpp is
|
||||
* used to preprocess assembler source on Unix systems. OLD_PREPROCESSOR
|
||||
* sets OK_DOLLAR FALSE for that reason.
|
||||
*/
|
||||
#ifndef OK_DOLLAR
|
||||
#define OK_DOLLAR TRUE
|
||||
#endif
|
||||
|
||||
/*
|
||||
* OK_CONCAT enables (one possible implementation of) token concatenation.
|
||||
* If cpp is used to preprocess Unix assembler source, this should be
|
||||
* set FALSE as the concatenation character, #, is used by the assembler.
|
||||
*/
|
||||
#ifndef OK_CONCAT
|
||||
#define OK_CONCAT TRUE
|
||||
#endif
|
||||
|
||||
/*
|
||||
* OK_DATE may be enabled to predefine today's date as a string
|
||||
* at the start of each compilation. This is apparently not permitted
|
||||
* by the Draft Ansi Standard.
|
||||
*/
|
||||
#ifndef OK_DATE
|
||||
#define OK_DATE TRUE
|
||||
#endif
|
||||
|
||||
/*
|
||||
* OK_SIZEOF may be defined to allow sizeof(type) in #if expressions.
|
||||
* Actually, it is none of the preprocessors business how large these
|
||||
* things are, as they might be different with different compiler
|
||||
* options. Also, according to K&R V2, page 232, it is nonstandard.
|
||||
* This option was added in the PDC process, under no. *OIS*0.92*.
|
||||
*/
|
||||
#ifndef OK_SIZEOF
|
||||
#define OK_SIZEOF FALSE
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Some common definitions.
|
||||
*/
|
||||
|
||||
#ifndef DEBUG
|
||||
#define DEBUG FALSE
|
||||
#endif
|
||||
|
||||
/*
|
||||
* The following definitions are used to allocate memory for
|
||||
* work buffers. In general, they should not be modified
|
||||
* by implementors.
|
||||
*
|
||||
* PAR_MAC The maximum number of #define parameters (31 per Standard)
|
||||
* Note: we need another one for strings.
|
||||
* NBUFF Input buffer size
|
||||
* NWORK Work buffer size -- the longest macro
|
||||
* must fit here after expansion.
|
||||
* NEXP The nesting depth of #if expressions
|
||||
* NINCLUDE The number of directories that may be specified
|
||||
* on a per-system basis, or by the -I option.
|
||||
* BLK_NEST The number of nested #if's permitted.
|
||||
*/
|
||||
|
||||
#ifndef PAR_MAC
|
||||
#define PAR_MAC (31 + 1)
|
||||
#endif
|
||||
|
||||
#ifndef NBUFF
|
||||
#define NBUFF 512
|
||||
#endif
|
||||
|
||||
#ifndef NWORK
|
||||
#define NWORK 512
|
||||
#endif
|
||||
|
||||
#ifndef NEXP
|
||||
#define NEXP 128
|
||||
#endif
|
||||
|
||||
#ifndef NINCLUDE
|
||||
#define NINCLUDE 20
|
||||
#endif
|
||||
|
||||
#ifndef NPARMWORK
|
||||
#define NPARMWORK (NWORK * 2)
|
||||
#endif
|
||||
|
||||
#ifndef BLK_NEST
|
||||
#define BLK_NEST 32
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* Some special constants. These may need to be changed if cpp
|
||||
* is ported to a wierd machine.
|
||||
*
|
||||
* NOTE: if cpp is run on a non-ascii machine, ALERT and VT may
|
||||
* need to be changed. They are used to implement the proposed
|
||||
* ANSI standard C control characters '\a' and '\v' only.
|
||||
* DEL is used to tag macro tokens to prevent #define foo foo
|
||||
* from looping. Note that we don't try to prevent more elaborate
|
||||
* #define loops from occurring.
|
||||
*/
|
||||
|
||||
#ifndef ALERT
|
||||
#define ALERT '\007' /* '\a' is "Bell" */
|
||||
#endif
|
||||
|
||||
#ifndef VT
|
||||
#define VT '\013' /* Vertical Tab CTRL/K */
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Functions can be declared/defined static to only become in the
|
||||
* scope for functions of the same source file.
|
||||
*/
|
||||
|
||||
#ifndef FILE_LOCAL
|
||||
#define FILE_LOCAL static /* file-unique globals */
|
||||
#endif
|
||||
|
||||
/*
|
||||
* For compilers supporting inlining, the INLINE macro has been added to
|
||||
* functions called from only one place. There might still be some
|
||||
* functions that should have this macro.
|
||||
*/
|
||||
#ifdef AMIGA
|
||||
#define INLINE __inline /* Amiga compiler SAS/C 6.x supports this! */
|
||||
#else
|
||||
#define INLINE /* don't support that kind of stuff */
|
||||
#endif
|
||||
|
||||
#if defined(AMIGA) && defined(SHARED)
|
||||
#define PREFIX __asm __saveds
|
||||
#define REG(x) register __ ## x
|
||||
#else
|
||||
#define PREFIX
|
||||
#define REG(x)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* SBSIZE defines the number of hash-table slots for the symbol table.
|
||||
*/
|
||||
#ifndef SBSIZE
|
||||
#define SBSIZE 64
|
||||
#endif
|
||||
|
||||
#define VERSION_TEXT "Frexx C Preprocessor v1.5.1 " \
|
||||
"Copyright (C) by FrexxWare 1993 - 2002.\n" \
|
||||
"Compiled " __DATE__ "\n"
|
|
@ -1,2 +0,0 @@
|
|||
#!
|
||||
fppPreProcess
|
|
@ -1,4 +0,0 @@
|
|||
##base _FPPBase
|
||||
##bias 30
|
||||
fppPreProcess(a)(A0)
|
||||
##end
|
|
@ -1,162 +0,0 @@
|
|||
/******************************************************************************
|
||||
* FREXXWARE
|
||||
* ----------------------------------------------------------------------------
|
||||
*
|
||||
* Project: Frexx C Preprocessor
|
||||
* $Source: /home/user/start/cpp/RCS/fpp.h,v $
|
||||
* $Revision: 1.5 $
|
||||
* $Date: 1994/01/24 09:38:45 $
|
||||
* $Author: start $
|
||||
* $State: Exp $
|
||||
* $Locker: start $
|
||||
*
|
||||
* ----------------------------------------------------------------------------
|
||||
* $Log: fpp.h,v $
|
||||
* Revision 1.5 1994/01/24 09:38:45 start
|
||||
* Added FPPTAG_RIGHTCONCAT.
|
||||
*
|
||||
* Revision 1.4 1993/12/06 13:51:20 start
|
||||
* A lot of new stuff (too much to mention)
|
||||
*
|
||||
* Revision 1.3 1993/11/29 14:01:13 start
|
||||
* New features added
|
||||
*
|
||||
* Revision 1.2 1993/11/11 07:16:39 start
|
||||
* New stuff
|
||||
*
|
||||
* Revision 1.1 1993/11/03 09:15:59 start
|
||||
* Initial revision
|
||||
*
|
||||
*
|
||||
*****************************************************************************/
|
||||
/**********************************************************************
|
||||
*
|
||||
* fpp.h
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
struct fppTag {
|
||||
int tag;
|
||||
void *data;
|
||||
};
|
||||
|
||||
#ifndef TRUE
|
||||
#define TRUE 1
|
||||
#endif
|
||||
|
||||
#ifndef FALSE
|
||||
#define FALSE 0
|
||||
#endif
|
||||
|
||||
#define NFLAG_BUILTIN 1
|
||||
#define NFLAG_PREDEFINE 2
|
||||
|
||||
/* end of taglist: */
|
||||
#define FPPTAG_END 0
|
||||
|
||||
/* To make the preprocessed output keep the comments: */
|
||||
#define FPPTAG_KEEPCOMMENTS 1 /* data is TRUE or FALSE */
|
||||
|
||||
/* To define symbols to the preprocessor: */
|
||||
#define FPPTAG_DEFINE 2 /* data is the string "symbol" or "symbol=<value>" */
|
||||
|
||||
/* To make the preprocessor ignore all non-fatal errors: */
|
||||
#define FPPTAG_IGNORE_NONFATAL 3 /* data is TRUE or FALSE */
|
||||
|
||||
/* To add an include directory to the include directory list: */
|
||||
#define FPPTAG_INCLUDE_DIR 4 /* data is directory name ending with a '/' (on
|
||||
amiga a ':' is also valid) */
|
||||
|
||||
/* To define all machine specific built-in #defines, default is TRUE: */
|
||||
#define FPPTAG_BUILTINS 5 /* data is TRUE or FALSE */
|
||||
|
||||
/* To define predefines like __LINE__, __DATE__, etc. default is TRUE: */
|
||||
#define FPPTAG_PREDEFINES 6 /* data is TRUE or FALSE */
|
||||
|
||||
/* To make fpp leave C++ comments in the output: */
|
||||
#define FPPTAG_IGNORE_CPLUSPLUS 7 /* data is TRUE or FALSE */
|
||||
|
||||
/* To define new sizes to #if sizeof: */
|
||||
#define FPPTAG_SIZEOF_TABLE 8 /* data is sizeof table string */
|
||||
|
||||
/* To undefine symbols: */
|
||||
#define FPPTAG_UNDEFINE 9 /* data is symbol name */
|
||||
|
||||
/* Output all #defines: */
|
||||
#define FPPTAG_OUTPUT_DEFINES 10 /* data is TRUE or FALSE */
|
||||
|
||||
/* Initial input file name: */
|
||||
#define FPPTAG_INPUT_NAME 11 /* data is string */
|
||||
|
||||
/* Input function: */
|
||||
#define FPPTAG_INPUT 12 /* data is an input funtion */
|
||||
|
||||
/* Output function: */
|
||||
#define FPPTAG_OUTPUT 13 /* data is an output function */
|
||||
|
||||
/* User data, sent in the last argument to the input function: */
|
||||
#define FPPTAG_USERDATA 14 /* data is user data */
|
||||
|
||||
/* Whether to exclude #line instructions in the output, default is FALSE */
|
||||
#define FPPTAG_LINE 15 /* data is TRUE or FALSE */
|
||||
|
||||
/* Error function. This is called when FPP finds any warning/error/fatal: */
|
||||
#define FPPTAG_ERROR 16 /* data is function pointer to a
|
||||
"void (*)(void *, char *, va_list)" */
|
||||
|
||||
/* Whether to warn for illegal cpp instructions */
|
||||
#define FPPTAG_WARNILLEGALCPP 17 /* data is boolean, default is FALSE */
|
||||
|
||||
/* Output the 'line' keyword on #line-lines? */
|
||||
#define FPPTAG_OUTPUTLINE 18 /* data is boolean, default is TRUE */
|
||||
|
||||
/* Do not output the version information string */
|
||||
#define FPPTAG_IGNOREVERSION 19 /* data is boolean, default is FALSE */
|
||||
|
||||
/* Output all included file names to stderr */
|
||||
#define FPPTAG_OUTPUTINCLUDES 20 /* data is boolean, default is FALSE */
|
||||
|
||||
/* Display warning if there is any brace, bracket or parentheses unbalance */
|
||||
#define FPPTAG_OUTPUTBALANCE 21 /* data is boolean, default is FALSE */
|
||||
|
||||
/* Display all whitespaces in the source */
|
||||
#define FPPTAG_OUTPUTSPACE 22 /* data is boolean, default is FALSE */
|
||||
|
||||
/* Allow nested comments */
|
||||
#define FPPTAG_NESTED_COMMENTS 23 /* data is boolean, default is FALSE */
|
||||
|
||||
/* Enable warnings at nested comments */
|
||||
#define FPPTAG_WARN_NESTED_COMMENTS 24 /* data is boolean, default is FALSE */
|
||||
|
||||
/* Enable warnings at missing includes */
|
||||
#define FPPTAG_WARNMISSINCLUDE 25 /* data is boolean, default is TRUE */
|
||||
|
||||
/* Output the main file */
|
||||
#define FPPTAG_OUTPUTMAIN 26 /* data is boolean, default is TRUE */
|
||||
|
||||
/* Include file */
|
||||
#define FPPTAG_INCLUDE_FILE 27 /* data is char pointer */
|
||||
|
||||
/* Include macro file */
|
||||
#define FPPTAG_INCLUDE_MACRO_FILE 28 /* data is char pointer */
|
||||
|
||||
/* Evaluate the right part of a concatenate before the concat */
|
||||
#define FPPTAG_RIGHTCONCAT 29 /* data is boolean, default is FALSE */
|
||||
|
||||
/* Include the specified file at the beginning of each function */
|
||||
#define FPPTAG_INITFUNC 30 /* data is char pointer or NULL */
|
||||
|
||||
/* Define function to be excluded from the "beginning-function-addings" */
|
||||
#define FPPTAG_EXCLFUNC 31 /* data is char pointer */
|
||||
|
||||
/* Enable output of all function names defined in the source */
|
||||
#define FPPTAG_DISPLAYFUNCTIONS 32
|
||||
|
||||
/* Switch on WWW-mode */
|
||||
#define FPPTAG_WEBMODE 33
|
||||
|
||||
/* Depends function: */
|
||||
#define FPPTAG_DEPENDS 34 /* data is an depends funtion */
|
||||
|
||||
int fppPreProcess(struct fppTag *);
|
|
@ -1,20 +0,0 @@
|
|||
#ifdef RCS
|
||||
static char rcsid[]="$Id$";
|
||||
#endif
|
||||
/******************************************************************************
|
||||
* FREXXWARE
|
||||
* ----------------------------------------------------------------------------
|
||||
*
|
||||
* Project: Frexx C Preprocessor
|
||||
* $Source$
|
||||
* $Revision$
|
||||
* $Date$
|
||||
* $Author$
|
||||
* $State$
|
||||
* $Locker$
|
||||
*
|
||||
* ----------------------------------------------------------------------------
|
||||
* $Log$
|
||||
*
|
||||
*****************************************************************************/
|
||||
#pragma libcall FPPBase fppPreProcess 1E 801
|
|
@ -1,86 +0,0 @@
|
|||
##############################################################################
|
||||
## FREXXWARE
|
||||
##############################################################################
|
||||
##
|
||||
## Project: Frexx C Preprocessor
|
||||
## $Source: /home/user/start/cpp/RCS/makefile,v $
|
||||
## $Revision: 1.3 $
|
||||
## $Date: 1994/06/02 09:11:24 $
|
||||
## $Author: start $
|
||||
## $State: Exp $
|
||||
## $Locker: $
|
||||
##
|
||||
##############################################################################
|
||||
## $Log: makefile,v $
|
||||
# Revision 1.3 1994/06/02 09:11:24 start
|
||||
# Now uses 'gcc' and -O!
|
||||
#
|
||||
# Revision 1.2 1993/11/11 07:16:39 start
|
||||
# New stuff
|
||||
#
|
||||
# Revision 1.1 1993/11/03 09:19:28 start
|
||||
# Initial revision
|
||||
#
|
||||
##
|
||||
##############################################################################
|
||||
|
||||
# Frexx PreProcessor Makefile
|
||||
|
||||
#HOST =-tp -B/home/danne/code/cpp/ -Wp\,-Q\,-Dunix\,-Ddpc\,-DAIX
|
||||
#DEFINES = -Dunix -Dpdc -DAIX -DUNIX -DDEBUG
|
||||
DEFINES = -Dunix -Dpdc -DUNIX -DDEBUG
|
||||
DEBUGFLAG = -g
|
||||
LD = ld
|
||||
LDFLAGS =
|
||||
LIB = libfpp.a
|
||||
CPP = fpp
|
||||
FILECPP = fcpp
|
||||
TEMP = templib.o
|
||||
EXPORT = fpp.exp
|
||||
CC = gcc
|
||||
CFLAGS = $(DEBUGFLAG) $(DEFINES)
|
||||
AR = ar
|
||||
ARFLAGS = rv
|
||||
.SUFFIXES: .o .c .c~ .h .h~ .a .i
|
||||
OBJS = cpp1.o cpp2.o cpp3.o cpp4.o cpp5.o cpp6.o
|
||||
FILEOBJS = cpp1.o cpp2.o cpp3.o cpp4.o cpp5.o cpp6.o usecpp.o
|
||||
|
||||
# ** compile cpp
|
||||
#
|
||||
|
||||
#all: $(LIB) $(CPP)
|
||||
all: $(FILECPP)
|
||||
|
||||
$(LIB) : $(OBJS) $(EXPORT)
|
||||
$(LD) $(OBJS) -o $(TEMP) -bE:$(EXPORT) -bM:SRE -T512 -H512 -lc
|
||||
rm -f $(LIB)
|
||||
$(AR) $(ARFLAGS) $(LIB) $(TEMP)
|
||||
rm $(TEMP)
|
||||
|
||||
$(CPP) : usecpp.c
|
||||
$(CC) $(CFLAGS) -o $(CPP) usecpp.c -L. -lfpp
|
||||
|
||||
$(FILECPP) : $(FILEOBJS)
|
||||
$(CC) $(FILEOBJS) -o $(FILECPP)
|
||||
|
||||
.c.o:
|
||||
$(CC) $(CFLAGS) -c $<
|
||||
|
||||
cpp1.o:cpp1.c
|
||||
cpp2.o:cpp2.c
|
||||
cpp3.o:cpp3.c
|
||||
cpp4.o:cpp4.c
|
||||
cpp5.o:cpp5.c
|
||||
cpp6.o:cpp6.c
|
||||
memory.o:memory.c
|
||||
|
||||
usecpp.o:usecpp.c
|
||||
|
||||
clean :
|
||||
rm -f *.o $(FILECPP)
|
||||
|
||||
tgz:
|
||||
rm -f makefile*~
|
||||
(dir=`pwd`;name=`basename $$dir`;echo Creates $$name.tar.gz; cd .. ; \
|
||||
tar -cf $$name.tar `ls $$name/*.[ch] $$name/*.exp $$name/*.fd $$name/makefile*` ; \
|
||||
gzip $$name.tar ; chmod a+r $$name.tar.gz ; mv $$name.tar.gz $$name/)
|
|
@ -1,602 +0,0 @@
|
|||
/******************************************************************************
|
||||
Copyright (c) 1999 Daniel Stenberg
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
******************************************************************************/
|
||||
/******************************************************************************
|
||||
* FREXXWARE
|
||||
* ----------------------------------------------------------------------------
|
||||
*
|
||||
* Project: Frexx C Preprocessor
|
||||
* $Source: /home/user/start/cpp/RCS/usecpp.c,v $
|
||||
* $Revision: 1.6 $
|
||||
* $Date: 1994/06/02 09:11:01 $
|
||||
* $Author: start $
|
||||
* $State: Exp $
|
||||
* $Locker: start $
|
||||
*
|
||||
* ----------------------------------------------------------------------------
|
||||
* $Log: usecpp.c,v $
|
||||
* Revision 1.6 1994/06/02 09:11:01 start
|
||||
* Added the '-n' option!
|
||||
*
|
||||
* Revision 1.5 1994/06/02 08:51:49 start
|
||||
* Added three more command line parameters
|
||||
* Made -h invokes exit nice
|
||||
*
|
||||
* Revision 1.4 1994/01/24 09:37:17 start
|
||||
* Major difference.
|
||||
*
|
||||
* Revision 1.3 1993/12/06 13:51:20 start
|
||||
* A lot of new stuff (too much to mention)
|
||||
*
|
||||
* Revision 1.2 1993/11/11 07:16:39 start
|
||||
* New stuff
|
||||
*
|
||||
* Revision 1.1 1993/11/03 09:13:08 start
|
||||
* Initial revision
|
||||
*
|
||||
*
|
||||
*****************************************************************************/
|
||||
/**********************************************************************
|
||||
*
|
||||
* usecpp.c
|
||||
*
|
||||
* This is a routine that is should be used to call functions in the
|
||||
* fpp.library. We supply the own_input() and own_output() functions to
|
||||
* the preprocessor to remain flexible.
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifdef AMIGA
|
||||
#include <proto/exec.h>
|
||||
#include <exec/types.h>
|
||||
|
||||
#if defined(SHARED)
|
||||
#include <exec/libraries.h>
|
||||
#include <libraries/dos.h>
|
||||
|
||||
#include "fpp_pragmas.h"
|
||||
#include "fpp_protos.h"
|
||||
#include "FPPBase.h"
|
||||
struct Library *FPPBase=NULL;
|
||||
#define PREFIX __saveds
|
||||
#define REG(x) register __ ## x
|
||||
#else
|
||||
#define PREFIX
|
||||
#define REG(x)
|
||||
#endif
|
||||
|
||||
#elif defined(UNIX)
|
||||
#if defined(OS9)
|
||||
#include <types.h>
|
||||
#else
|
||||
#include <sys/types.h>
|
||||
#ifdef BSD
|
||||
#include <sys/unistd.h> /* for BSD systems (SUN OS at least) */
|
||||
#endif
|
||||
#endif
|
||||
#define PREFIX
|
||||
#define REG(x)
|
||||
#endif
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <ctype.h>
|
||||
#ifndef OS9
|
||||
#include <stdarg.h>
|
||||
#else
|
||||
#define va_list void *
|
||||
#endif
|
||||
|
||||
#include "fpp.h"
|
||||
#define MAX_TAGS 40 /* maximum number of tags allowed! */
|
||||
#define FILE_LOCAL static
|
||||
|
||||
#define CPP_PREFS_FILE "cpp.prefs"
|
||||
#ifdef AMIGA
|
||||
#define DEFAULT_CPP_PREFS_FILE "s:cpp.prefs"
|
||||
#else
|
||||
#define DEFAULT_CPP_PREFS_FILE "$HOME/cpp.prefs"
|
||||
#endif
|
||||
|
||||
FILE_LOCAL char PREFIX *own_input(char *, int, void *);
|
||||
FILE_LOCAL void PREFIX own_output(int, void *);
|
||||
FILE_LOCAL void PREFIX own_error(void *, char *, va_list);
|
||||
FILE_LOCAL int SetOptions(int, char **, struct fppTag **);
|
||||
FILE_LOCAL char GetPrefs(struct fppTag **, char **);
|
||||
FILE_LOCAL char DoString(struct fppTag **, char *);
|
||||
|
||||
#ifdef AMIGA
|
||||
extern long __stack=8000;
|
||||
#endif
|
||||
|
||||
FILE_LOCAL char ignore=FALSE; /* if we should ignore strange flags! */
|
||||
FILE_LOCAL char display=FALSE; /* display all options in use! */
|
||||
|
||||
FILE_LOCAL char dontreadprefs; /* set if only the command line is valid */
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
struct fppTag tags[MAX_TAGS];
|
||||
int i;
|
||||
struct fppTag *tagptr = tags;
|
||||
char *dealloc;
|
||||
|
||||
/*
|
||||
* Append system-specific directories to the include directory list.
|
||||
* The include directories will be searched through in the same order
|
||||
* as you add them in the taglist!
|
||||
* The directory _must_ end with a proper directory speparator!
|
||||
*/
|
||||
|
||||
tagptr->tag=FPPTAG_INCLUDE_DIR;
|
||||
#if defined (AMIGA)
|
||||
tagptr->data = "INCLUDE:";
|
||||
#elif defined (OS9)
|
||||
tagptr->data = "/dd/defs/";
|
||||
#else
|
||||
tagptr->data = "/usr/include/";
|
||||
#endif
|
||||
tagptr++;
|
||||
|
||||
if(GetPrefs(&tagptr, &dealloc))
|
||||
return(0);
|
||||
|
||||
if( !(i = SetOptions(argc, argv, &tagptr)))
|
||||
return(0);
|
||||
|
||||
if (argc - i >2) {
|
||||
printf("Too many file arguments. Usage: cpp [options] [input [output]]\n");
|
||||
return(-1);
|
||||
}
|
||||
|
||||
tagptr->tag=FPPTAG_INPUT;
|
||||
tagptr->data=(void *)own_input;
|
||||
tagptr++;
|
||||
|
||||
if(i<argc) {
|
||||
/*
|
||||
* Open input file, "-" means use stdin.
|
||||
*/
|
||||
if (strcmp(argv[i], "-")) {
|
||||
if (freopen(argv[i], "r", stdin) == NULL) {
|
||||
perror(argv[i]);
|
||||
fprintf(stderr, "Can't open input file \"%s\"", argv[i]);
|
||||
return(-2);
|
||||
}
|
||||
tagptr->tag=FPPTAG_INPUT_NAME;
|
||||
tagptr->data=argv[i];
|
||||
tagptr++;
|
||||
if(display)
|
||||
fprintf(stderr, "cpp: input: %s\n", argv[i]);
|
||||
} else /* Else, just get stdin */
|
||||
if(display)
|
||||
fprintf(stderr, "cpp: input: [stdin]\n");
|
||||
i++;
|
||||
} else
|
||||
if(display)
|
||||
fprintf(stderr, "cpp: input: [stdin]\n");
|
||||
|
||||
if(i<argc) {
|
||||
/*
|
||||
* Get output file, "-" means use stdout.
|
||||
*/
|
||||
if (strcmp(argv[i], "-")) {
|
||||
if (freopen(argv[i], "w", stdout) == NULL) {
|
||||
perror(argv[i]);
|
||||
fprintf(stderr, "Can't open output file \"%s\"", argv[i]);
|
||||
return(-1);
|
||||
}
|
||||
if(display)
|
||||
fprintf(stderr, "cpp: output: %s\n", argv[i]);
|
||||
} else
|
||||
if(display)
|
||||
fprintf(stderr, "cpp: output: [stdout]\n");
|
||||
} else
|
||||
if(display)
|
||||
fprintf(stderr, "cpp: output: [stdout]\n");
|
||||
|
||||
tagptr->tag=FPPTAG_OUTPUT;
|
||||
tagptr->data=(void *)own_output;
|
||||
tagptr++;
|
||||
|
||||
tagptr->tag=FPPTAG_ERROR;
|
||||
tagptr->data=(void *)own_error;
|
||||
tagptr++;
|
||||
|
||||
/* The LAST tag: */
|
||||
|
||||
tagptr->tag=FPPTAG_END;
|
||||
tagptr->data=0;
|
||||
tagptr++;
|
||||
|
||||
#if defined(SHARED) && defined(AMIGA)
|
||||
if(!(FPPBase=OpenLibrary(FPPNAME, 1))) {
|
||||
printf("Error opening %s!\n", FPPNAME);
|
||||
return(-1);
|
||||
}
|
||||
#endif
|
||||
fppPreProcess(tags);
|
||||
|
||||
#if defined(SHARED) && defined(AMIGA)
|
||||
CloseLibrary((struct Library *)FPPBase);
|
||||
#endif
|
||||
/*
|
||||
* Preprocess ready!
|
||||
*/
|
||||
|
||||
if( dealloc )
|
||||
free( dealloc );
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
FILE_LOCAL
|
||||
char PREFIX *own_input(char *buffer, int size, void *userdata)
|
||||
{
|
||||
return(fgets(buffer, size, stdin));
|
||||
}
|
||||
|
||||
FILE_LOCAL
|
||||
void PREFIX own_output(int c, void *userdata)
|
||||
{
|
||||
putchar(c);
|
||||
}
|
||||
|
||||
FILE_LOCAL
|
||||
void PREFIX own_error(void *userdata, char *format, va_list arg)
|
||||
{
|
||||
vfprintf(stderr, format, arg);
|
||||
}
|
||||
|
||||
FILE_LOCAL
|
||||
char GetPrefs(struct fppTag **tagptr, char **string)
|
||||
{
|
||||
|
||||
FILE *PrefsFile_PF;
|
||||
unsigned Length_U;
|
||||
char *PrefsBuffer_PC;
|
||||
char ret= 0;
|
||||
char *environ;
|
||||
|
||||
*string = NULL;
|
||||
|
||||
/* Open prefs file for read */
|
||||
if ( (PrefsFile_PF = fopen(CPP_PREFS_FILE, "r")) ||
|
||||
(PrefsFile_PF = fopen(DEFAULT_CPP_PREFS_FILE, "r"))) {
|
||||
|
||||
fseek(PrefsFile_PF, 0 , SEEK_END);
|
||||
Length_U = ftell(PrefsFile_PF);
|
||||
fseek(PrefsFile_PF, 0, SEEK_SET);
|
||||
|
||||
if (*string = (char *)malloc(Length_U+1)) {
|
||||
fread(*string, 1, Length_U, PrefsFile_PF);
|
||||
(*string)[Length_U] = '\0';
|
||||
|
||||
ret = !DoString(tagptr, *string);
|
||||
}
|
||||
fclose(PrefsFile_PF);
|
||||
if(ret) {
|
||||
free( *string );
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
if(environ = getenv("CPP_PREFS")) {
|
||||
ret= !DoString(tagptr, environ);
|
||||
if(ret && *string)
|
||||
free( *string );
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
FILE_LOCAL
|
||||
char DoString(struct fppTag **tagptr, char *string)
|
||||
{
|
||||
char *argv[MAX_TAGS];
|
||||
int argc=1;
|
||||
do {
|
||||
while(*string && *string != '-')
|
||||
string++;
|
||||
|
||||
if(!*string)
|
||||
break;
|
||||
|
||||
argv[argc]=string;
|
||||
|
||||
do {
|
||||
string++;
|
||||
if(*string=='\"') {
|
||||
do
|
||||
string++;
|
||||
while(*string != '\"');
|
||||
string++;
|
||||
}
|
||||
} while(*string && *string!=' ' && *string != '\n' && *string != '\t');
|
||||
argc++;
|
||||
if(*string) {
|
||||
*string='\0';
|
||||
string++;
|
||||
} else
|
||||
break;
|
||||
} while(1);
|
||||
|
||||
return (SetOptions(argc, argv, tagptr));
|
||||
}
|
||||
|
||||
FILE_LOCAL
|
||||
int SetOptions(int argc, char **argv, struct fppTag **tagptr)
|
||||
{
|
||||
int i;
|
||||
char *ap;
|
||||
for (i = 1; i < argc; i++) {
|
||||
ap = argv[i];
|
||||
if (*ap++ != '-' || *ap == '\0')
|
||||
break;
|
||||
else {
|
||||
char c = *ap++;
|
||||
|
||||
if(display)
|
||||
fprintf(stderr, "cpp: option: %s\n", ap-2);
|
||||
|
||||
switch (c) { /* Command character */
|
||||
case 'Q': /* ignore unknown flags but */
|
||||
ignore=1; /* output them on stderr */
|
||||
break;
|
||||
|
||||
case 'q': /* ignore unknown flags */
|
||||
ignore=2;
|
||||
break;
|
||||
|
||||
case 'H': /* display all whitespaces */
|
||||
(*tagptr)->tag = FPPTAG_OUTPUTSPACE;
|
||||
(*tagptr)->data= (void *)TRUE;
|
||||
(*tagptr)++;
|
||||
break;
|
||||
|
||||
case 'b': /* display unbalance */
|
||||
(*tagptr)->tag = FPPTAG_OUTPUTBALANCE;
|
||||
(*tagptr)->data= (void *)TRUE;
|
||||
(*tagptr)++;
|
||||
break;
|
||||
|
||||
case 'f': /* output all defined functions! */
|
||||
(*tagptr)->tag = FPPTAG_DISPLAYFUNCTIONS;
|
||||
(*tagptr)->data= (void *)TRUE;
|
||||
(*tagptr)++;
|
||||
break;
|
||||
|
||||
case 'F': /* output all included files! */
|
||||
(*tagptr)->tag = FPPTAG_OUTPUTINCLUDES;
|
||||
(*tagptr)->data= (void *)TRUE;
|
||||
(*tagptr)++;
|
||||
break;
|
||||
|
||||
case 'V': /* do not output version */
|
||||
(*tagptr)->tag = FPPTAG_IGNOREVERSION;
|
||||
(*tagptr)->data= (void *)FALSE;
|
||||
(*tagptr)++;
|
||||
break;
|
||||
|
||||
case 'C': /* Keep comments */
|
||||
(*tagptr)->tag = FPPTAG_KEEPCOMMENTS;
|
||||
(*tagptr)->data= (void *)TRUE;
|
||||
(*tagptr)++;
|
||||
break;
|
||||
|
||||
case 'D': /* Define symbol */
|
||||
(*tagptr)->tag=FPPTAG_DEFINE;
|
||||
(*tagptr)->data=argv[i]+2;
|
||||
(*tagptr)++;
|
||||
break;
|
||||
|
||||
case 'd': /* Display all options */
|
||||
fprintf(stderr, "FOUND -d flag!\n");
|
||||
display = TRUE;
|
||||
break;
|
||||
|
||||
case 'E': /* Ignore non-fatal errors */
|
||||
(*tagptr)->tag=FPPTAG_IGNORE_NONFATAL;
|
||||
(*tagptr)->data=(void *)TRUE;
|
||||
(*tagptr)++;
|
||||
break;
|
||||
|
||||
case 'I': /* Include directory */
|
||||
(*tagptr)->tag=FPPTAG_INCLUDE_DIR;
|
||||
(*tagptr)->data=ap;
|
||||
(*tagptr)++;
|
||||
break;
|
||||
|
||||
case 'J': /* Allow nested comments */
|
||||
(*tagptr)->tag=FPPTAG_NESTED_COMMENTS;
|
||||
(*tagptr)->data=ap;
|
||||
(*tagptr)++;
|
||||
break;
|
||||
|
||||
case 'j': /* Warn at nested comments */
|
||||
(*tagptr)->tag=FPPTAG_WARN_NESTED_COMMENTS;
|
||||
(*tagptr)->data=ap;
|
||||
(*tagptr)++;
|
||||
break;
|
||||
|
||||
case 'L':
|
||||
if(*ap == 'L') { /* Do not output #line */
|
||||
(*tagptr)->tag=FPPTAG_LINE;
|
||||
} else {
|
||||
/* Do not output the 'line' keyword */
|
||||
(*tagptr)->tag=FPPTAG_OUTPUTLINE;
|
||||
}
|
||||
(*tagptr)->data=(void *)FALSE;
|
||||
(*tagptr)++;
|
||||
break;
|
||||
|
||||
case 'M': /* Do not warn at missing includes */
|
||||
(*tagptr)->tag=FPPTAG_WARNMISSINCLUDE;
|
||||
(*tagptr)->data=(void *)FALSE;
|
||||
(*tagptr)++;
|
||||
break;
|
||||
|
||||
case 'n':
|
||||
dontreadprefs^=1; /* toggle prefsreading, default is read prefs */
|
||||
|
||||
/*
|
||||
* This flag should reset all previously added tags!
|
||||
*/
|
||||
|
||||
break;
|
||||
|
||||
case 'N': /* No machine specific built-ins */
|
||||
(*tagptr)->tag=FPPTAG_BUILTINS;
|
||||
(*tagptr)->data=(void *)FALSE;
|
||||
(*tagptr)++;
|
||||
break;
|
||||
|
||||
case 'B': /* No predefines like __LINE__, etc. */
|
||||
(*tagptr)->tag=FPPTAG_PREDEFINES;
|
||||
(*tagptr)->data=(void *)FALSE;
|
||||
(*tagptr)++;
|
||||
break;
|
||||
|
||||
case 'P': /* No C++ comments */
|
||||
(*tagptr)->tag=FPPTAG_IGNORE_CPLUSPLUS;
|
||||
(*tagptr)->data=(void *)TRUE;
|
||||
(*tagptr)++;
|
||||
break;
|
||||
|
||||
case 'p': /* warn about illegal # - instructions */
|
||||
(*tagptr)->tag = FPPTAG_WARNILLEGALCPP;
|
||||
(*tagptr)->data= (void *)TRUE;
|
||||
(*tagptr)++;
|
||||
break;
|
||||
|
||||
case 'R':
|
||||
(*tagptr)->tag = FPPTAG_RIGHTCONCAT;
|
||||
(*tagptr)->data= (void *)TRUE;
|
||||
(*tagptr)++;
|
||||
break;
|
||||
|
||||
case 's': /* sizeof table */
|
||||
(*tagptr)->tag=FPPTAG_INITFUNC;
|
||||
(*tagptr)->data=ap;
|
||||
(*tagptr)++;
|
||||
break;
|
||||
|
||||
case 't': /* excluded functions */
|
||||
(*tagptr)->tag=FPPTAG_EXCLFUNC;
|
||||
(*tagptr)->data=ap;
|
||||
(*tagptr)++;
|
||||
break;
|
||||
|
||||
case 'S': /* sizeof table */
|
||||
(*tagptr)->tag=FPPTAG_SIZEOF_TABLE;
|
||||
(*tagptr)->data=ap;
|
||||
(*tagptr)++;
|
||||
break;
|
||||
|
||||
case 'U': /* Undefine symbol */
|
||||
(*tagptr)->tag=FPPTAG_UNDEFINE;
|
||||
(*tagptr)->data=ap;
|
||||
(*tagptr)++;
|
||||
break;
|
||||
|
||||
case 'w': /* Output all #defines but not the
|
||||
main file */
|
||||
(*tagptr)->tag=FPPTAG_OUTPUTMAIN;
|
||||
(*tagptr)->data=(void *)FALSE;
|
||||
(*tagptr)++;
|
||||
|
||||
case 'W': /* Output all #defines */
|
||||
if(!strncmp(ap, "WW", 2)) {
|
||||
(*tagptr)->tag=FPPTAG_WEBMODE;
|
||||
(*tagptr)->data=(void *)TRUE;
|
||||
(*tagptr)++;
|
||||
}
|
||||
else {
|
||||
(*tagptr)->tag=FPPTAG_OUTPUT_DEFINES;
|
||||
(*tagptr)->data=(void *)TRUE;
|
||||
(*tagptr)++;
|
||||
}
|
||||
break;
|
||||
|
||||
case 'X':
|
||||
(*tagptr)->tag=FPPTAG_INCLUDE_FILE;
|
||||
(*tagptr)->data=ap;
|
||||
(*tagptr)++;
|
||||
break;
|
||||
|
||||
/*
|
||||
case 'x':
|
||||
tags[tag]->tag=FPPTAG_INCLUDE_MACRO_FILE;
|
||||
tags[tag++]->data=ap;
|
||||
break;
|
||||
*/
|
||||
case 'h':
|
||||
case '?': /* if a question mark is possible to specify! */
|
||||
default: /* What is this one? */
|
||||
if( ignore < 2 && c != 'h') {
|
||||
fprintf(stderr, "cpp: unknown option: -%s\n", ap-1);
|
||||
}
|
||||
if(!ignore || c == 'h') {
|
||||
fprintf(stderr,
|
||||
"Usage: cpp [options] [infile [outfile] ]\n\n"
|
||||
"The following options are valid:\n"
|
||||
" -B\tNo mahcine specific built-in symbols\n"
|
||||
" -b\tOutput any parentheses, brace or bracket unbalance\n"
|
||||
" -C\tWrite source file comments to output\n"
|
||||
" -D\tDefine a symbol with the given (optional) value \"symbol[=value]\"\n"
|
||||
" -d\tDisplay all specified options\n"
|
||||
" -E\tIgnore non-fatal errors\n"
|
||||
" -F\tOutput all included file names on stderr\n"
|
||||
" -f\tOutput all defined functions' names on stderr\n"
|
||||
" -H\tOutput all whitespaces from the source file\n"
|
||||
" -h\tOutput this help text\n"
|
||||
" -I\tAdd directory to the #include search list\n"
|
||||
" -J\tAllow nested comments\n"
|
||||
" -j\tEnable warnings for nested comments\n"
|
||||
" -LL\tDon't output #line instructions\n"
|
||||
" -L\tDon't output the 'line' keyword in \"#line\" instructions\n"
|
||||
" -M\tDon't warn for missing include files\n"
|
||||
" -N\tDon't predefine target-specific names\n"
|
||||
" -n\tToggle prefs usage\n"
|
||||
" -P\tDon't recognize C++ comment style\n"
|
||||
" -p\tEnable warnings on non ANSI preprocessor instructions\n"
|
||||
" -Q\tIgnore but visualize undefined flags\n"
|
||||
" -q\tIgnore all undefined flags\n"
|
||||
" -R\tEvaluate the right part first in symbol concatenations\n"
|
||||
" -s\tInclude the following string at the top of each function\n"
|
||||
" -S\tSpecify sizes for #if sizeof\n"
|
||||
" -t\tThis function should not get an initial function\n"
|
||||
" -U\tUndefine symbol\n"
|
||||
" -V\tDon't output version information\n"
|
||||
" -W\tOutput all #defines\n"
|
||||
" -WWW\tWeb mode preprocessing\n"
|
||||
" -w\tOnly output #defines\n"
|
||||
" -X\tInclude file\n");
|
||||
return(0);
|
||||
} /* if (!ignore) */
|
||||
} /* Switch on all options */
|
||||
} /* If it's a -option */
|
||||
} /* For all arguments */
|
||||
|
||||
return i;
|
||||
|
||||
} /* end of function */
|
|
@ -1,13 +0,0 @@
|
|||
This is an implementation of Tom Forsyth's "Linear-Speed Vertex Cache
|
||||
Optimization" algorithm as described here:
|
||||
http://home.comcast.net/~tom_forsyth/papers/fast_vert_cache_opt.html
|
||||
|
||||
This code was authored and released into the public domain by
|
||||
Adrian Stone (stone@gameangst.com).
|
||||
|
||||
THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
SHALL ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE FOR ANY DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
|
||||
IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
@ -1,361 +0,0 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// This is an implementation of Tom Forsyth's "Linear-Speed Vertex Cache
|
||||
// Optimization" algorithm as described here:
|
||||
// http://home.comcast.net/~tom_forsyth/papers/fast_vert_cache_opt.html
|
||||
//
|
||||
// This code was authored and released into the public domain by
|
||||
// Adrian Stone (stone@gameangst.com).
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
// SHALL ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE FOR ANY DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
|
||||
// IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#include <stdint.h>
|
||||
#include <assert.h>
|
||||
#include <math.h>
|
||||
#include <vector>
|
||||
#include <algorithm>
|
||||
|
||||
namespace Forsyth
|
||||
{
|
||||
//-----------------------------------------------------------------------------
|
||||
// OptimizeFaces
|
||||
//-----------------------------------------------------------------------------
|
||||
// Parameters:
|
||||
// indexList
|
||||
// input index list
|
||||
// indexCount
|
||||
// the number of indices in the list
|
||||
// vertexCount
|
||||
// the largest index value in indexList
|
||||
// vertexBaseIndex
|
||||
// starting vertex index subtracted from each index in indexList to
|
||||
// allow safe operation on multiple objects in a single index buffer
|
||||
// newIndexList
|
||||
// a pointer to a preallocated buffer the same size as indexList to
|
||||
// hold the optimized index list
|
||||
// lruCacheSize
|
||||
// the size of the simulated post-transform cache (max:64)
|
||||
//-----------------------------------------------------------------------------
|
||||
template<class IndexT>
|
||||
void OptimizeFacesImpl(const IndexT* indexList, uint32_t indexCount, uint32_t vertexCount, IndexT vertexBaseIndex, IndexT* newIndexList, uint16_t lruCacheSize);
|
||||
|
||||
void OptimizeFaces(const uint16_t* indexList, uint32_t indexCount, uint32_t vertexCount, uint16_t vertexBaseIndex, uint16_t* newIndexList, uint16_t lruCacheSize)
|
||||
{
|
||||
OptimizeFacesImpl<uint16_t>( indexList, indexCount, vertexCount, vertexBaseIndex, newIndexList, lruCacheSize );
|
||||
}
|
||||
|
||||
void OptimizeFaces(const uint32_t* indexList, uint32_t indexCount, uint32_t vertexCount, uint32_t vertexBaseIndex, uint32_t* newIndexList, uint16_t lruCacheSize)
|
||||
{
|
||||
OptimizeFacesImpl<uint32_t>( indexList, indexCount, vertexCount, vertexBaseIndex, newIndexList, lruCacheSize );
|
||||
}
|
||||
|
||||
namespace
|
||||
{
|
||||
// code for computing vertex score was taken, as much as possible
|
||||
// directly from the original publication.
|
||||
float ComputeVertexCacheScore(int cachePosition, int vertexCacheSize)
|
||||
{
|
||||
const float FindVertexScore_CacheDecayPower = 1.5f;
|
||||
const float FindVertexScore_LastTriScore = 0.75f;
|
||||
|
||||
float score = 0.0f;
|
||||
if ( cachePosition < 0 )
|
||||
{
|
||||
// Vertex is not in FIFO cache - no score.
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( cachePosition < 3 )
|
||||
{
|
||||
// This vertex was used in the last triangle,
|
||||
// so it has a fixed score, whichever of the three
|
||||
// it's in. Otherwise, you can get very different
|
||||
// answers depending on whether you add
|
||||
// the triangle 1,2,3 or 3,1,2 - which is silly.
|
||||
score = FindVertexScore_LastTriScore;
|
||||
}
|
||||
else
|
||||
{
|
||||
assert ( cachePosition < vertexCacheSize );
|
||||
// Points for being high in the cache.
|
||||
const float scaler = 1.0f / ( vertexCacheSize - 3 );
|
||||
score = 1.0f - ( cachePosition - 3 ) * scaler;
|
||||
score = powf ( score, FindVertexScore_CacheDecayPower );
|
||||
}
|
||||
}
|
||||
|
||||
return score;
|
||||
}
|
||||
|
||||
float ComputeVertexValenceScore(uint32_t numActiveFaces)
|
||||
{
|
||||
const float FindVertexScore_ValenceBoostScale = 2.0f;
|
||||
const float FindVertexScore_ValenceBoostPower = 0.5f;
|
||||
|
||||
float score = 0.f;
|
||||
|
||||
// Bonus points for having a low number of tris still to
|
||||
// use the vert, so we get rid of lone verts quickly.
|
||||
float valenceBoost = powf ( static_cast<float>(numActiveFaces),
|
||||
-FindVertexScore_ValenceBoostPower );
|
||||
score += FindVertexScore_ValenceBoostScale * valenceBoost;
|
||||
|
||||
return score;
|
||||
}
|
||||
|
||||
|
||||
const int kMaxVertexCacheSize = 64;
|
||||
const uint32_t kMaxPrecomputedVertexValenceScores = 64;
|
||||
float s_vertexCacheScores[kMaxVertexCacheSize+1][kMaxVertexCacheSize];
|
||||
float s_vertexValenceScores[kMaxPrecomputedVertexValenceScores];
|
||||
|
||||
bool ComputeVertexScores()
|
||||
{
|
||||
for (int cacheSize=0; cacheSize<=kMaxVertexCacheSize; ++cacheSize)
|
||||
{
|
||||
for (int cachePos=0; cachePos<cacheSize; ++cachePos)
|
||||
{
|
||||
s_vertexCacheScores[cacheSize][cachePos] = ComputeVertexCacheScore(cachePos, cacheSize);
|
||||
}
|
||||
}
|
||||
|
||||
for (uint32_t valence=0; valence<kMaxPrecomputedVertexValenceScores; ++valence)
|
||||
{
|
||||
s_vertexValenceScores[valence] = ComputeVertexValenceScore(valence);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
bool s_vertexScoresComputed = ComputeVertexScores();
|
||||
|
||||
// inline float FindVertexCacheScore(uint cachePosition, uint maxSizeVertexCache)
|
||||
// {
|
||||
// return s_vertexCacheScores[maxSizeVertexCache][cachePosition];
|
||||
// }
|
||||
|
||||
// inline float FindVertexValenceScore(uint numActiveTris)
|
||||
// {
|
||||
// return s_vertexValenceScores[numActiveTris];
|
||||
// }
|
||||
|
||||
float FindVertexScore(uint32_t numActiveFaces, uint32_t cachePosition, uint32_t vertexCacheSize)
|
||||
{
|
||||
assert(s_vertexScoresComputed); (void)s_vertexScoresComputed;
|
||||
|
||||
if ( numActiveFaces == 0 )
|
||||
{
|
||||
// No tri needs this vertex!
|
||||
return -1.0f;
|
||||
}
|
||||
|
||||
float score = 0.f;
|
||||
if (cachePosition < vertexCacheSize)
|
||||
{
|
||||
score += s_vertexCacheScores[vertexCacheSize][cachePosition];
|
||||
}
|
||||
|
||||
if (numActiveFaces < kMaxPrecomputedVertexValenceScores)
|
||||
{
|
||||
score += s_vertexValenceScores[numActiveFaces];
|
||||
}
|
||||
else
|
||||
{
|
||||
score += ComputeVertexValenceScore(numActiveFaces);
|
||||
}
|
||||
|
||||
return score;
|
||||
}
|
||||
|
||||
struct OptimizeVertexData
|
||||
{
|
||||
float score;
|
||||
uint32_t activeFaceListStart;
|
||||
uint32_t activeFaceListSize;
|
||||
uint16_t cachePos0;
|
||||
uint16_t cachePos1;
|
||||
OptimizeVertexData() : score(0.f), activeFaceListStart(0), activeFaceListSize(0), cachePos0(0), cachePos1(0) { }
|
||||
};
|
||||
}
|
||||
|
||||
template<class IndexT>
|
||||
void OptimizeFacesImpl(const IndexT* indexList, uint32_t indexCount, uint32_t vertexCount, IndexT vertexBaseIndex, IndexT* newIndexList, uint16_t lruCacheSize)
|
||||
{
|
||||
std::vector< OptimizeVertexData > vertexDataList;
|
||||
vertexDataList.resize(vertexCount);
|
||||
|
||||
// compute face count per vertex
|
||||
for (uint32_t i=0; i<indexCount; ++i)
|
||||
{
|
||||
IndexT index = indexList[i] - vertexBaseIndex;
|
||||
assert((index >= 0) && (index < vertexCount));
|
||||
OptimizeVertexData& vertexData = vertexDataList[index];
|
||||
vertexData.activeFaceListSize++;
|
||||
}
|
||||
|
||||
std::vector<uint32_t> activeFaceList;
|
||||
|
||||
const IndexT kEvictedCacheIndex = std::numeric_limits<uint16_t>::max();
|
||||
|
||||
{
|
||||
// allocate face list per vertex
|
||||
uint32_t curActiveFaceListPos = 0;
|
||||
for (uint32_t i=0; i<vertexCount; ++i)
|
||||
{
|
||||
OptimizeVertexData& vertexData = vertexDataList[i];
|
||||
vertexData.cachePos0 = kEvictedCacheIndex;
|
||||
vertexData.cachePos1 = kEvictedCacheIndex;
|
||||
vertexData.activeFaceListStart = curActiveFaceListPos;
|
||||
curActiveFaceListPos += vertexData.activeFaceListSize;
|
||||
vertexData.score = FindVertexScore(vertexData.activeFaceListSize, vertexData.cachePos0, lruCacheSize);
|
||||
vertexData.activeFaceListSize = 0;
|
||||
}
|
||||
activeFaceList.resize(curActiveFaceListPos);
|
||||
}
|
||||
|
||||
// fill out face list per vertex
|
||||
for (uint32_t i=0; i<indexCount; i+=3)
|
||||
{
|
||||
for (uint32_t j=0; j<3; ++j)
|
||||
{
|
||||
IndexT index = indexList[i+j] - vertexBaseIndex;
|
||||
OptimizeVertexData& vertexData = vertexDataList[index];
|
||||
activeFaceList[vertexData.activeFaceListStart + vertexData.activeFaceListSize] = i;
|
||||
vertexData.activeFaceListSize++;
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<uint8_t> processedFaceList;
|
||||
processedFaceList.resize(indexCount);
|
||||
|
||||
IndexT vertexCacheBuffer[(kMaxVertexCacheSize+3)*2];
|
||||
IndexT* cache0 = vertexCacheBuffer;
|
||||
IndexT* cache1 = vertexCacheBuffer+(kMaxVertexCacheSize+3);
|
||||
IndexT entriesInCache0 = 0;
|
||||
|
||||
uint32_t bestFace = 0;
|
||||
float bestScore = -1.f;
|
||||
|
||||
const float maxValenceScore = FindVertexScore(1, kEvictedCacheIndex, lruCacheSize) * 3.f;
|
||||
|
||||
for (uint32_t i = 0; i < indexCount; i += 3)
|
||||
{
|
||||
if (bestScore < 0.f)
|
||||
{
|
||||
// no verts in the cache are used by any unprocessed faces so
|
||||
// search all unprocessed faces for a new starting point
|
||||
for (uint32_t j = 0; j < indexCount; j += 3)
|
||||
{
|
||||
if (processedFaceList[j] == 0)
|
||||
{
|
||||
uint32_t face = j;
|
||||
float faceScore = 0.f;
|
||||
for (uint32_t k=0; k<3; ++k)
|
||||
{
|
||||
IndexT index = indexList[face+k] - vertexBaseIndex;
|
||||
OptimizeVertexData& vertexData = vertexDataList[index];
|
||||
assert(vertexData.activeFaceListSize > 0);
|
||||
assert(vertexData.cachePos0 >= lruCacheSize);
|
||||
faceScore += vertexData.score;
|
||||
}
|
||||
|
||||
if (faceScore > bestScore)
|
||||
{
|
||||
bestScore = faceScore;
|
||||
bestFace = face;
|
||||
|
||||
assert(bestScore <= maxValenceScore);
|
||||
if (bestScore >= maxValenceScore)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
assert(bestScore >= 0.f);
|
||||
}
|
||||
|
||||
processedFaceList[bestFace] = 1;
|
||||
uint16_t entriesInCache1 = 0;
|
||||
|
||||
// add bestFace to LRU cache and to newIndexList
|
||||
for (uint32_t v = 0; v < 3; ++v)
|
||||
{
|
||||
IndexT index = indexList[bestFace+v] - vertexBaseIndex;
|
||||
newIndexList[i+v] = index + vertexBaseIndex;
|
||||
|
||||
OptimizeVertexData& vertexData = vertexDataList[index];
|
||||
|
||||
if (vertexData.cachePos1 >= entriesInCache1)
|
||||
{
|
||||
vertexData.cachePos1 = entriesInCache1;
|
||||
cache1[entriesInCache1++] = index;
|
||||
|
||||
if (vertexData.activeFaceListSize == 1)
|
||||
{
|
||||
--vertexData.activeFaceListSize;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
assert(vertexData.activeFaceListSize > 0);
|
||||
uint32_t* begin = &activeFaceList[vertexData.activeFaceListStart];
|
||||
uint32_t* end = &(activeFaceList[vertexData.activeFaceListStart + vertexData.activeFaceListSize - 1]) + 1;
|
||||
uint32_t* it = std::find(begin, end, bestFace);
|
||||
assert(it != end);
|
||||
std::swap(*it, *(end-1));
|
||||
--vertexData.activeFaceListSize;
|
||||
vertexData.score = FindVertexScore(vertexData.activeFaceListSize, vertexData.cachePos1, lruCacheSize);
|
||||
|
||||
}
|
||||
|
||||
// move the rest of the old verts in the cache down and compute their new scores
|
||||
for (uint32_t c0 = 0; c0 < entriesInCache0; ++c0)
|
||||
{
|
||||
IndexT index = cache0[c0];
|
||||
OptimizeVertexData& vertexData = vertexDataList[index];
|
||||
|
||||
if (vertexData.cachePos1 >= entriesInCache1)
|
||||
{
|
||||
vertexData.cachePos1 = entriesInCache1;
|
||||
cache1[entriesInCache1++] = index;
|
||||
vertexData.score = FindVertexScore(vertexData.activeFaceListSize, vertexData.cachePos1, lruCacheSize);
|
||||
}
|
||||
}
|
||||
|
||||
// find the best scoring triangle in the current cache (including up to 3 that were just evicted)
|
||||
bestScore = -1.f;
|
||||
for (uint32_t c1 = 0; c1 < entriesInCache1; ++c1)
|
||||
{
|
||||
IndexT index = cache1[c1];
|
||||
OptimizeVertexData& vertexData = vertexDataList[index];
|
||||
vertexData.cachePos0 = vertexData.cachePos1;
|
||||
vertexData.cachePos1 = kEvictedCacheIndex;
|
||||
for (uint32_t j=0; j<vertexData.activeFaceListSize; ++j)
|
||||
{
|
||||
uint32_t face = activeFaceList[vertexData.activeFaceListStart+j];
|
||||
float faceScore = 0.f;
|
||||
for (uint32_t v=0; v<3; v++)
|
||||
{
|
||||
IndexT faceIndex = indexList[face+v] - vertexBaseIndex;
|
||||
OptimizeVertexData& faceVertexData = vertexDataList[faceIndex];
|
||||
faceScore += faceVertexData.score;
|
||||
}
|
||||
if (faceScore > bestScore)
|
||||
{
|
||||
bestScore = faceScore;
|
||||
bestFace = face;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
std::swap(cache0, cache1);
|
||||
entriesInCache0 = std::min(entriesInCache1, lruCacheSize);
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace Forsyth
|
|
@ -1,48 +0,0 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// This is an implementation of Tom Forsyth's "Linear-Speed Vertex Cache
|
||||
// Optimization" algorithm as described here:
|
||||
// http://home.comcast.net/~tom_forsyth/papers/fast_vert_cache_opt.html
|
||||
//
|
||||
// This code was authored and released into the public domain by
|
||||
// Adrian Stone (stone@gameangst.com).
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
// SHALL ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE FOR ANY DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
|
||||
// IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#ifndef __FORSYTH_TRIANGLE_REORDER__
|
||||
#define __FORSYTH_TRIANGLE_REORDER__
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
namespace Forsyth
|
||||
{
|
||||
//-----------------------------------------------------------------------------
|
||||
// OptimizeFaces
|
||||
//-----------------------------------------------------------------------------
|
||||
// Parameters:
|
||||
// indexList
|
||||
// input index list
|
||||
// indexCount
|
||||
// the number of indices in the list
|
||||
// vertexCount
|
||||
// the largest index value in indexList
|
||||
// vertexBaseIndex
|
||||
// starting vertex index subtracted from each index in indexList to
|
||||
// allow safe operation on multiple objects in a single index buffer
|
||||
// newIndexList
|
||||
// a pointer to a preallocated buffer the same size as indexList to
|
||||
// hold the optimized index list
|
||||
// lruCacheSize
|
||||
// the size of the simulated post-transform cache (max:64)
|
||||
//-----------------------------------------------------------------------------
|
||||
void OptimizeFaces(const uint16_t* indexList, uint32_t indexCount, uint32_t vertexCount, uint16_t vertexBaseIndex, uint16_t* newIndexList, uint16_t lruCacheSize);
|
||||
void OptimizeFaces(const uint32_t* indexList, uint32_t indexCount, uint32_t vertexCount, uint32_t vertexBaseIndex, uint32_t* newIndexList, uint16_t lruCacheSize);
|
||||
|
||||
} // namespace Forsyth
|
||||
|
||||
#endif // __FORSYTH_TRIANGLE_REORDER__
|
|
@ -1,169 +0,0 @@
|
|||
The FreeType Project LICENSE
|
||||
----------------------------
|
||||
|
||||
2006-Jan-27
|
||||
|
||||
Copyright 1996-2002, 2006 by
|
||||
David Turner, Robert Wilhelm, and Werner Lemberg
|
||||
|
||||
|
||||
|
||||
Introduction
|
||||
============
|
||||
|
||||
The FreeType Project is distributed in several archive packages;
|
||||
some of them may contain, in addition to the FreeType font engine,
|
||||
various tools and contributions which rely on, or relate to, the
|
||||
FreeType Project.
|
||||
|
||||
This license applies to all files found in such packages, and
|
||||
which do not fall under their own explicit license. The license
|
||||
affects thus the FreeType font engine, the test programs,
|
||||
documentation and makefiles, at the very least.
|
||||
|
||||
This license was inspired by the BSD, Artistic, and IJG
|
||||
(Independent JPEG Group) licenses, which all encourage inclusion
|
||||
and use of free software in commercial and freeware products
|
||||
alike. As a consequence, its main points are that:
|
||||
|
||||
o We don't promise that this software works. However, we will be
|
||||
interested in any kind of bug reports. (`as is' distribution)
|
||||
|
||||
o You can use this software for whatever you want, in parts or
|
||||
full form, without having to pay us. (`royalty-free' usage)
|
||||
|
||||
o You may not pretend that you wrote this software. If you use
|
||||
it, or only parts of it, in a program, you must acknowledge
|
||||
somewhere in your documentation that you have used the
|
||||
FreeType code. (`credits')
|
||||
|
||||
We specifically permit and encourage the inclusion of this
|
||||
software, with or without modifications, in commercial products.
|
||||
We disclaim all warranties covering The FreeType Project and
|
||||
assume no liability related to The FreeType Project.
|
||||
|
||||
|
||||
Finally, many people asked us for a preferred form for a
|
||||
credit/disclaimer to use in compliance with this license. We thus
|
||||
encourage you to use the following text:
|
||||
|
||||
"""
|
||||
Portions of this software are copyright © <year> The FreeType
|
||||
Project (www.freetype.org). All rights reserved.
|
||||
"""
|
||||
|
||||
Please replace <year> with the value from the FreeType version you
|
||||
actually use.
|
||||
|
||||
|
||||
Legal Terms
|
||||
===========
|
||||
|
||||
0. Definitions
|
||||
--------------
|
||||
|
||||
Throughout this license, the terms `package', `FreeType Project',
|
||||
and `FreeType archive' refer to the set of files originally
|
||||
distributed by the authors (David Turner, Robert Wilhelm, and
|
||||
Werner Lemberg) as the `FreeType Project', be they named as alpha,
|
||||
beta or final release.
|
||||
|
||||
`You' refers to the licensee, or person using the project, where
|
||||
`using' is a generic term including compiling the project's source
|
||||
code as well as linking it to form a `program' or `executable'.
|
||||
This program is referred to as `a program using the FreeType
|
||||
engine'.
|
||||
|
||||
This license applies to all files distributed in the original
|
||||
FreeType Project, including all source code, binaries and
|
||||
documentation, unless otherwise stated in the file in its
|
||||
original, unmodified form as distributed in the original archive.
|
||||
If you are unsure whether or not a particular file is covered by
|
||||
this license, you must contact us to verify this.
|
||||
|
||||
The FreeType Project is copyright (C) 1996-2000 by David Turner,
|
||||
Robert Wilhelm, and Werner Lemberg. All rights reserved except as
|
||||
specified below.
|
||||
|
||||
1. No Warranty
|
||||
--------------
|
||||
|
||||
THE FREETYPE PROJECT IS PROVIDED `AS IS' WITHOUT WARRANTY OF ANY
|
||||
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. IN NO EVENT WILL ANY OF THE AUTHORS OR COPYRIGHT HOLDERS
|
||||
BE LIABLE FOR ANY DAMAGES CAUSED BY THE USE OR THE INABILITY TO
|
||||
USE, OF THE FREETYPE PROJECT.
|
||||
|
||||
2. Redistribution
|
||||
-----------------
|
||||
|
||||
This license grants a worldwide, royalty-free, perpetual and
|
||||
irrevocable right and license to use, execute, perform, compile,
|
||||
display, copy, create derivative works of, distribute and
|
||||
sublicense the FreeType Project (in both source and object code
|
||||
forms) and derivative works thereof for any purpose; and to
|
||||
authorize others to exercise some or all of the rights granted
|
||||
herein, subject to the following conditions:
|
||||
|
||||
o Redistribution of source code must retain this license file
|
||||
(`FTL.TXT') unaltered; any additions, deletions or changes to
|
||||
the original files must be clearly indicated in accompanying
|
||||
documentation. The copyright notices of the unaltered,
|
||||
original files must be preserved in all copies of source
|
||||
files.
|
||||
|
||||
o Redistribution in binary form must provide a disclaimer that
|
||||
states that the software is based in part of the work of the
|
||||
FreeType Team, in the distribution documentation. We also
|
||||
encourage you to put an URL to the FreeType web page in your
|
||||
documentation, though this isn't mandatory.
|
||||
|
||||
These conditions apply to any software derived from or based on
|
||||
the FreeType Project, not just the unmodified files. If you use
|
||||
our work, you must acknowledge us. However, no fee need be paid
|
||||
to us.
|
||||
|
||||
3. Advertising
|
||||
--------------
|
||||
|
||||
Neither the FreeType authors and contributors nor you shall use
|
||||
the name of the other for commercial, advertising, or promotional
|
||||
purposes without specific prior written permission.
|
||||
|
||||
We suggest, but do not require, that you use one or more of the
|
||||
following phrases to refer to this software in your documentation
|
||||
or advertising materials: `FreeType Project', `FreeType Engine',
|
||||
`FreeType library', or `FreeType Distribution'.
|
||||
|
||||
As you have not signed this license, you are not required to
|
||||
accept it. However, as the FreeType Project is copyrighted
|
||||
material, only this license, or another one contracted with the
|
||||
authors, grants you the right to use, distribute, and modify it.
|
||||
Therefore, by using, distributing, or modifying the FreeType
|
||||
Project, you indicate that you understand and accept all the terms
|
||||
of this license.
|
||||
|
||||
4. Contacts
|
||||
-----------
|
||||
|
||||
There are two mailing lists related to FreeType:
|
||||
|
||||
o freetype@nongnu.org
|
||||
|
||||
Discusses general use and applications of FreeType, as well as
|
||||
future and wanted additions to the library and distribution.
|
||||
If you are looking for support, start in this list if you
|
||||
haven't found anything to help you in the documentation.
|
||||
|
||||
o freetype-devel@nongnu.org
|
||||
|
||||
Discusses bugs, as well as engine internals, design issues,
|
||||
specific licenses, porting, etc.
|
||||
|
||||
Our home page can be found at
|
||||
|
||||
http://www.freetype.org
|
||||
|
||||
|
||||
--- end of FTL.TXT ---
|
|
@ -1,5 +0,0 @@
|
|||
The Freetype code is copyright 2013 The FreeType Project.
|
||||
All rights reserved. (www.freetype.org).
|
||||
Distributed under the FreeType License: see FTL.TXT.
|
||||
|
||||
freetype.h is an amalagmation of Freetype 2.4.11 made by Jeremie Roy in march 2013.
|
File diff suppressed because it is too large
Load Diff
|
@ -1,4 +0,0 @@
|
|||
*.dsp -crlf
|
||||
*.dsw -crlf
|
||||
*.sln -crlf
|
||||
*.vcproj -crlf
|
|
@ -1,78 +0,0 @@
|
|||
node_modules
|
||||
*.a
|
||||
*.dll
|
||||
*.exe
|
||||
*.ilk
|
||||
*.sdf
|
||||
*.opensdf
|
||||
*.la
|
||||
*.lo
|
||||
*.log
|
||||
*.o
|
||||
*.obj
|
||||
*.os
|
||||
*.pc
|
||||
*.pdb
|
||||
*.pyc
|
||||
*.pyo
|
||||
*.so
|
||||
*.so.*
|
||||
*.sw[a-z]
|
||||
*.tar
|
||||
*.tar.bz2
|
||||
*.tar.gz
|
||||
*.trs
|
||||
*.zip
|
||||
*~
|
||||
depend
|
||||
depend.bak
|
||||
bin/ltmain.sh
|
||||
lib
|
||||
lib64
|
||||
configure
|
||||
configure.lineno
|
||||
autom4te.cache
|
||||
aclocal.m4
|
||||
config.log
|
||||
config.status
|
||||
cscope*
|
||||
.scon*
|
||||
config.py
|
||||
build
|
||||
libtool
|
||||
manifest.txt
|
||||
.dir-locals.el
|
||||
.deps/
|
||||
.dirstamp
|
||||
.libs/
|
||||
Makefile
|
||||
Makefile.in
|
||||
|
||||
ipch
|
||||
|
||||
*.pbxuser
|
||||
*.perspectivev3
|
||||
*.mode1v3
|
||||
.svn
|
||||
*.ncb
|
||||
*.user
|
||||
*.suo
|
||||
*.dSYM
|
||||
xcuserdata
|
||||
*.xcworkspace
|
||||
|
||||
cmake_install.cmake
|
||||
Makefile
|
||||
CMakeFiles/
|
||||
CMakeCache.txt
|
||||
.project
|
||||
.cproject
|
||||
glsl_main
|
||||
glsl_test
|
||||
glslopt
|
||||
glsl_compiler
|
||||
.settings/
|
||||
.pydevproject
|
||||
|
||||
build
|
||||
metalTemp.metal
|
|
@ -1,2 +0,0 @@
|
|||
projects
|
||||
tests
|
|
@ -1,51 +0,0 @@
|
|||
cmake_minimum_required(VERSION 2.8)
|
||||
|
||||
include_directories(include)
|
||||
include_directories(src/mesa)
|
||||
include_directories(src/mapi)
|
||||
include_directories(src/glsl)
|
||||
include_directories(src)
|
||||
|
||||
option (DEBUG "Enable debugging" FALSE)
|
||||
|
||||
if(${DEBUG} MATCHES "on")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -O0")
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -O0")
|
||||
else()
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Os -DNDEBUG")
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Os -DNDEBUG")
|
||||
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -s")
|
||||
endif()
|
||||
|
||||
file(GLOB glcpp-library_sources src/glsl/glcpp/*.c src/util/*.c)
|
||||
#file(GLOB glcpp-library_sources_remove src/glsl/glcpp/glcpp.c)
|
||||
#list(REMOVE_ITEM glcpp-library_sources ${glcpp-library_sources_remove})
|
||||
add_library(glcpp-library ${glcpp-library_sources})
|
||||
|
||||
file(GLOB mesa_sources src/mesa/program/*.c src/mesa/main/*.c)
|
||||
add_library(mesa ${mesa_sources})
|
||||
|
||||
file(GLOB glsl_sources src/glsl/*.cpp src/glsl/*.c)
|
||||
file(GLOB glsl_sources_remove src/glsl/main.cpp src/glsl/builtin_stubs.cpp)
|
||||
list(REMOVE_ITEM glsl_sources ${glsl_sources_remove})
|
||||
add_library(glsl_optimizer ${glsl_sources})
|
||||
target_link_libraries(glsl_optimizer glcpp-library mesa)
|
||||
|
||||
add_executable(glsl_compiler src/glsl/main.cpp)
|
||||
target_link_libraries(glsl_compiler glsl_optimizer)
|
||||
|
||||
file(GLOB glsl_test_sources tests/*.cpp)
|
||||
add_executable(glsl_test ${glsl_test_sources})
|
||||
target_link_libraries(glsl_test glsl_optimizer)
|
||||
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
|
||||
# OSX-specific build requirements
|
||||
find_library(OpenGL_LIBRARY OpenGL )
|
||||
target_link_libraries(glsl_test ${OpenGL_LIBRARY})
|
||||
endif(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
|
||||
|
||||
file(GLOB glslopt_sources contrib/glslopt/*.cpp)
|
||||
add_executable(glslopt ${glslopt_sources})
|
||||
target_link_libraries(glslopt glsl_optimizer)
|
||||
|
||||
#add_executable(glcpp src/glsl/glcpp/glcpp.c)
|
||||
#target_link_libraries(glcpp glsl_optimizer)
|
|
@ -1,238 +0,0 @@
|
|||
GLSL optimizer Change Log
|
||||
=========================
|
||||
|
||||
|
||||
2016 10
|
||||
-------
|
||||
|
||||
* Metal/GLES: Fixed bad optimization (all code removed) when framebuffer fetch extension is used, but
|
||||
fragment shader does not actually read the incoming color value.
|
||||
* Fixed translation of texelSize().
|
||||
* Fixed translation of texelFetch().
|
||||
|
||||
|
||||
2016 09
|
||||
-------
|
||||
|
||||
* Metal: Fixed constant precision propagation in some cases.
|
||||
* Metal: Fixed shadowmap sampling when reference Z value is outside of 0..1 range (now clamps to match GLES specs).
|
||||
|
||||
|
||||
2016 06
|
||||
-------
|
||||
|
||||
Fixed:
|
||||
|
||||
* Fixed Metal translation in some cases having wrong precision on constants or constant arrays.
|
||||
|
||||
|
||||
2016 05
|
||||
-------
|
||||
|
||||
Fixed:
|
||||
|
||||
* Fixed Metal translation in some cases having wrong precision on struct members.
|
||||
* Fixed Metal translation in some cases emitting struct declarations vs. constant initializers in wrong order.
|
||||
|
||||
|
||||
2016 03
|
||||
-------
|
||||
|
||||
Fixed:
|
||||
|
||||
* Fixed translation performance regression in loop analysis (regressed in 2015 06 fixes).
|
||||
|
||||
|
||||
2015 08
|
||||
-------
|
||||
|
||||
Changes:
|
||||
|
||||
* 2D shadow and 2D array uniforms got their own glslopt_basic_type entries.
|
||||
|
||||
Fixes:
|
||||
|
||||
* Fixed translation of 2D texture arrays (GLSL with EXT_texture_array, GLES3 and Metal).
|
||||
|
||||
|
||||
2015 06
|
||||
-------
|
||||
|
||||
Fixes:
|
||||
|
||||
* Fixed some cases of different precision matrix assignments being miscompiled on Metal.
|
||||
* Fixed yet more issues with translation of weird loops.
|
||||
* Fixed translation of matrix+scalar, matrix-scalar, matrix/scalar operations on Metal.
|
||||
|
||||
|
||||
2015 05
|
||||
-------
|
||||
|
||||
Fixes:
|
||||
|
||||
* Fixes some cases of highp/mediump sampler sampling resulting in resulting temporaries wrongly being lowp.
|
||||
|
||||
|
||||
2015 04
|
||||
-------
|
||||
|
||||
Goodies:
|
||||
|
||||
* GLES2: support EXT_draw_instanced / gl_InstanceIDEXT.
|
||||
* Support gl_VertexID in GLSL < 1.30 when EXT_gpu_shader4 is used.
|
||||
|
||||
Fixes:
|
||||
|
||||
* Metal: fixed some bugs with translation of weird loops.
|
||||
|
||||
|
||||
2015 02
|
||||
-------
|
||||
|
||||
Tweaks:
|
||||
|
||||
* Texture LOD sampling functions on GLES2.0 now produce a wrapper call, that does approximation
|
||||
(mip bias) on devices that don't support GL_EXT_shader_texture_lod.
|
||||
* Undefined precision integers on GLES now default to highp.
|
||||
|
||||
|
||||
2015 01
|
||||
-------
|
||||
|
||||
Fixes:
|
||||
|
||||
* Float literals are printed with 7 significant digits now.
|
||||
* Metal: GLSL mod() is properly translated into Metal's fmod().
|
||||
* Metal: Fixed some cases of reciprocal (1/x) printing missing half precision cast.
|
||||
* GLES3: textureOffset with a mipmap bias is printed correctly now.
|
||||
* Fixed a bug with loop inductor detection if the inductor was used before the loop for some things.
|
||||
* Fixed printing of int/float bitcast operations.
|
||||
* Improved precision determination of some constructs.
|
||||
|
||||
|
||||
2014 10
|
||||
-------
|
||||
|
||||
Goodies:
|
||||
|
||||
* Support for translating GLSL shaders into Apple Metal shading language.
|
||||
Exactly same process; GLSL in (preferably ES3 variant), optimization passes, Metal out.
|
||||
All uniforms currently will be put into one constant buffer.
|
||||
Pass kGlslTargetMetal target to get Metal.
|
||||
* Shader reflection API. See glslopt_shader_get_* functions. Binding indices
|
||||
are only automatically assigned on Metal now; on GL/ES targets the reflection API is only
|
||||
useful to get list of inputs/uniforms, their names and types.
|
||||
* Improved dead code elimation: some cases of swizzled/masked assignments where same variable was on both sides
|
||||
were not eliminated if that variable was totally unused later.
|
||||
* Merged with upstream Mesa, comes with new optimizations (min/max pruning, tree rebalancing, vector_insert lowering).
|
||||
|
||||
Fixes:
|
||||
|
||||
* sampler3D declarations were missing precision qualifier on GLES3.0.
|
||||
|
||||
|
||||
2014 09
|
||||
-------
|
||||
|
||||
Goodies:
|
||||
|
||||
* Supports GL_EXT_draw_buffers in ES2.0, for MRT.
|
||||
|
||||
|
||||
2014 08
|
||||
-------
|
||||
|
||||
Goodies:
|
||||
|
||||
* Supports GL_EXT_shader_framebuffer_fetch now, in both ES2.0 & 3.0.
|
||||
|
||||
Fixes:
|
||||
|
||||
* Fixed printing of infinities & NaNs.
|
||||
* Fixed vectorization pass in some cases going wrong on texture lookups.
|
||||
|
||||
|
||||
2014 06
|
||||
-------
|
||||
|
||||
Goodies:
|
||||
|
||||
* Optimization: split vectors with only some used components into scalars.
|
||||
|
||||
Fixes:
|
||||
|
||||
* Fixed more issues with for-loop printing.
|
||||
* Fixed printing of unsigned integer swizzled & constants.
|
||||
|
||||
2014 03
|
||||
-------
|
||||
|
||||
Fixes:
|
||||
|
||||
* Fixed missing precision qualifier in some ES shaders (mostly due to expansion of ternary ?: check).
|
||||
|
||||
2014 02
|
||||
-------
|
||||
|
||||
Fixes:
|
||||
|
||||
* Fixed vectorize pass introduced last month going wrong with dot products.
|
||||
|
||||
2014 01
|
||||
-------
|
||||
|
||||
Goodies:
|
||||
|
||||
* Better optimization: vectorize assignments to individual vector channels.
|
||||
* More OpenGL ES 2.0 conformant printing of complex for-loops (loop inductions printed
|
||||
as += or ++; loop initializers inside loop body).
|
||||
|
||||
Fixes:
|
||||
|
||||
* Fixed array assignments sometimes appearing in pre-GLSL1.20 versions, especially with
|
||||
complex loops that couldn't be unrolled.
|
||||
* Fixed output of textureOffset and texelFetch.
|
||||
* Fixed error messages on MRT outputs on GL & GLES3 (now supports 4 MRTs).
|
||||
|
||||
2013 12
|
||||
-------
|
||||
|
||||
Goodies:
|
||||
|
||||
* Optimized performance; was spending half of the time in stupid string code.
|
||||
* Added glslopt_shader_get_stats to get *very* approximate shader complexity stats.
|
||||
* Nicer printing of complicated for-loops.
|
||||
|
||||
Fixes:
|
||||
|
||||
* Fixed printing of struct initializers.
|
||||
|
||||
|
||||
2013 11
|
||||
-------
|
||||
|
||||
Goodies:
|
||||
|
||||
* Better optimizations: CSE; `A+(-B) => A-B`; `!A || !B => !(A && B)`.
|
||||
* Merged with upstream Mesa.
|
||||
|
||||
Fixes:
|
||||
|
||||
* Fixed location qualifiers, ES3.0 version printing, samplerCubeShadow sampling operations.
|
||||
|
||||
|
||||
2013 10
|
||||
-------
|
||||
|
||||
Goodies:
|
||||
|
||||
* Initial OpenGL ES 3.0 support
|
||||
* API to query shader input names; glslopt_shader_get_input_count and glslopt_shader_get_input_name
|
||||
|
||||
Changes:
|
||||
|
||||
* Xcode project files updated to Xcode 5
|
||||
|
||||
Fixes:
|
||||
|
||||
* VS2013 fixes
|
|
@ -1,102 +0,0 @@
|
|||
GLSL optimizer
|
||||
==============
|
||||
|
||||
A C++ library that takes GLSL shaders, does some GPU-independent optimizations on them
|
||||
and outputs GLSL or Metal source back. Optimizations are function inlining, dead code removal, copy propagation,
|
||||
constant folding, constant propagation, arithmetic optimizations and so on.
|
||||
|
||||
Apparently quite a few mobile platforms are pretty bad at optimizing shaders; and
|
||||
unfortunately they *also* lack offline shader compilers. So using a GLSL optimizer offline
|
||||
before can make the shader run much faster on a platform like that. See performance numbers
|
||||
in [this blog post](http://aras-p.info/blog/2010/09/29/glsl-optimizer/).
|
||||
|
||||
Even for drivers that have decent shader optimization, GLSL optimizer could be useful to just strip away
|
||||
dead code, make shaders smaller and do uniform/input reflection offline.
|
||||
|
||||
Almost all actual code is [Mesa 3D's GLSL](http://cgit.freedesktop.org/mesa/mesa/log/)
|
||||
compiler; all this library does is spits out optimized GLSL or Metal back, and adds GLES type precision
|
||||
handling to the optimizer.
|
||||
|
||||
This GLSL optimizer is made for [Unity's](http://unity3d.com/) purposes and is built-in
|
||||
starting with Unity 3.0.
|
||||
|
||||
GLSL Optimizer is licensed according to the terms of the MIT license.
|
||||
|
||||
See [change log here](Changelog.md).
|
||||
|
||||
|
||||
Usage
|
||||
-----
|
||||
|
||||
Visual Studio 2010 (Windows, x86/x64) and Xcode 5+ (Mac, i386) project files for a static
|
||||
library are provided in `projects/vs2010/glsl_optimizer.sln` and `projects/xcode5/glsl_optimizer_lib`
|
||||
respectively.
|
||||
|
||||
> Note: only the VS and Xcode project files are maintained and should work at any time.
|
||||
> There's also a cmake and gyp build system for Linux et al., and some stuff in contrib folder -
|
||||
> all that may or might not work.
|
||||
|
||||
For Linux you can use cmake. Just type "cmake . && make" in the root directory.
|
||||
This will build the optimizer library and some executable binaries.
|
||||
|
||||
Interface for the library is `src/glsl/glsl_optimizer.h`. General usage is:
|
||||
|
||||
ctx = glslopt_initialize(targetVersion);
|
||||
for (lots of shaders) {
|
||||
shader = glslopt_optimize (ctx, shaderType, shaderSource, options);
|
||||
if (glslopt_get_status (shader)) {
|
||||
newSource = glslopt_get_output (shader);
|
||||
} else {
|
||||
errorLog = glslopt_get_log (shader);
|
||||
}
|
||||
glslopt_shader_delete (shader);
|
||||
}
|
||||
glslopt_cleanup (ctx);
|
||||
|
||||
|
||||
Tests
|
||||
-----
|
||||
|
||||
There's a testing suite for catching regressions, see `tests` folder. In VS, build
|
||||
and run `glsl_optimizer_tests` project; in Xcode use `projects/xcode5/glsl_optimizer_tests`
|
||||
project. The test executable requires path to the `tests` folder as an argument.
|
||||
|
||||
Each test comes as three text files; input, expected IR dump and expected optimized
|
||||
GLSL dump. GLES3 tests are also converted into Metal.
|
||||
|
||||
If you're making changes to the project and want pull requests accepted easier, I'd
|
||||
appreciate if there would be no test suite regressions. If you are implementing a
|
||||
feature, it would be cool to add tests to cover it as well!
|
||||
|
||||
|
||||
Notes
|
||||
-----
|
||||
|
||||
* GLSL versions 1.10 and 1.20 are supported. 1.10 is the default, use #version 120 to specify
|
||||
1.20. Higher GLSL versions might work, but aren't tested now.
|
||||
* GLSL ES versions 1.00 and 3.00 are supported.
|
||||
|
||||
Status and Future
|
||||
-----------------
|
||||
|
||||
**Note**: As of mid-2016, the project is unlikely to have any significant developments. At Unity we are largely moving to a different
|
||||
shader compilation pipeline, with glsl-optimizer mostly not used. So from my side there won't be significant work done on it :(
|
||||
|
||||
|
||||
Dev Notes
|
||||
---------
|
||||
|
||||
Pulling Mesa upstream:
|
||||
|
||||
git fetch upstream
|
||||
git merge upstream/master
|
||||
sh removeDeletedByUs.sh
|
||||
# inspect files, git rm unneeded ones, fix conflicts etc.
|
||||
# git commit
|
||||
|
||||
Rebuilding flex/bison parsers:
|
||||
|
||||
* When .y/.l files are changed, the parsers are *not* rebuilt automatically,
|
||||
* Run ./generateParsers.sh to do that. You'll need bison & flex (on Mac, do "Install Command Line Tools" from Xcode)
|
||||
* I use bison 2.3 and flex 2.5.35 (in OS X 10.8/10.9)
|
||||
|
|
@ -1,14 +0,0 @@
|
|||
#! /bin/sh
|
||||
|
||||
srcdir=`dirname "$0"`
|
||||
test -z "$srcdir" && srcdir=.
|
||||
|
||||
ORIGDIR=`pwd`
|
||||
cd "$srcdir"
|
||||
|
||||
autoreconf -v --install || exit 1
|
||||
cd $ORIGDIR || exit $?
|
||||
|
||||
if test -z "$NOCONFIGURE"; then
|
||||
"$srcdir"/configure "$@"
|
||||
fi
|
|
@ -1,28 +0,0 @@
|
|||
{
|
||||
'includes': [
|
||||
'target_defaults.gypi',
|
||||
],
|
||||
'targets': [
|
||||
{
|
||||
"include_dirs" : [
|
||||
"<!(node -e \"require('nan')\")"
|
||||
],
|
||||
'target_name': 'glslOptimizer',
|
||||
'dependencies': [
|
||||
'src/glsl_optimizer_lib.gyp:*',
|
||||
],
|
||||
'sources': [
|
||||
'src/node/binding.cpp',
|
||||
'src/node/shader.h',
|
||||
'src/node/shader.cpp',
|
||||
'src/node/compiler.h',
|
||||
'src/node/compiler.cpp'
|
||||
],
|
||||
'conditions': [
|
||||
['OS=="win"', {
|
||||
'msvs_disabled_warnings': [4506],
|
||||
}],
|
||||
],
|
||||
}
|
||||
]
|
||||
}
|
|
@ -1,90 +0,0 @@
|
|||
../../../../src/mesa/program/hash_table.c
|
||||
../../../../src/mesa/program/hash_table.h
|
||||
../../../../src/mesa/program/symbol_table.c
|
||||
../../../../src/mesa/program/symbol_table.h
|
||||
../../../../src/talloc/talloc.c
|
||||
../../../../src/talloc/talloc.h
|
||||
../../../../src/glsl/ast.h
|
||||
../../../../src/glsl/ast_expr.cpp
|
||||
../../../../src/glsl/ast_function.cpp
|
||||
../../../../src/glsl/ast_to_hir.cpp
|
||||
../../../../src/glsl/ast_type.cpp
|
||||
../../../../src/glsl/builtin_function.cpp
|
||||
../../../../src/glsl/builtin_types.h
|
||||
../../../../src/glsl/builtin_variables.h
|
||||
../../../../src/glsl/glsl_lexer.cpp
|
||||
../../../../src/glsl/glsl_lexer.lpp
|
||||
../../../../src/glsl/glsl_optimizer.cpp
|
||||
../../../../src/glsl/glsl_optimizer.h
|
||||
# ../../../../src/glsl/glsl_optimizer_main.cpp
|
||||
../../../../src/glsl/glsl_parser.cpp
|
||||
../../../../src/glsl/glsl_parser.h
|
||||
../../../../src/glsl/glsl_parser.ypp
|
||||
../../../../src/glsl/glsl_parser_extras.cpp
|
||||
../../../../src/glsl/glsl_parser_extras.h
|
||||
../../../../src/glsl/glsl_symbol_table.h
|
||||
../../../../src/glsl/glsl_types.cpp
|
||||
../../../../src/glsl/glsl_types.h
|
||||
../../../../src/glsl/hir_field_selection.cpp
|
||||
../../../../src/glsl/ir.cpp
|
||||
../../../../src/glsl/ir.h
|
||||
../../../../src/glsl/ir_algebraic.cpp
|
||||
../../../../src/glsl/ir_basic_block.cpp
|
||||
../../../../src/glsl/ir_basic_block.h
|
||||
../../../../src/glsl/ir_clone.cpp
|
||||
../../../../src/glsl/ir_constant_expression.cpp
|
||||
../../../../src/glsl/ir_constant_folding.cpp
|
||||
../../../../src/glsl/ir_constant_propagation.cpp
|
||||
../../../../src/glsl/ir_constant_variable.cpp
|
||||
../../../../src/glsl/ir_copy_propagation.cpp
|
||||
../../../../src/glsl/ir_dead_code.cpp
|
||||
../../../../src/glsl/ir_dead_code_local.cpp
|
||||
../../../../src/glsl/ir_dead_functions.cpp
|
||||
../../../../src/glsl/ir_div_to_mul_rcp.cpp
|
||||
../../../../src/glsl/ir_expression_flattening.cpp
|
||||
../../../../src/glsl/ir_expression_flattening.h
|
||||
../../../../src/glsl/ir_function.cpp
|
||||
../../../../src/glsl/ir_function_can_inline.cpp
|
||||
../../../../src/glsl/ir_function_inlining.cpp
|
||||
../../../../src/glsl/ir_function_inlining.h
|
||||
../../../../src/glsl/ir_hierarchical_visitor.cpp
|
||||
../../../../src/glsl/ir_hierarchical_visitor.h
|
||||
../../../../src/glsl/ir_hv_accept.cpp
|
||||
../../../../src/glsl/ir_if_return.cpp
|
||||
../../../../src/glsl/ir_if_simplification.cpp
|
||||
../../../../src/glsl/ir_if_to_cond_assign.cpp
|
||||
../../../../src/glsl/ir_import_prototypes.cpp
|
||||
../../../../src/glsl/ir_mat_op_to_vec.cpp
|
||||
../../../../src/glsl/ir_mod_to_fract.cpp
|
||||
../../../../src/glsl/ir_noop_swizzle.cpp
|
||||
../../../../src/glsl/ir_optimization.h
|
||||
../../../../src/glsl/ir_print_glsl_visitor.cpp
|
||||
../../../../src/glsl/ir_print_glsl_visitor.h
|
||||
../../../../src/glsl/ir_print_visitor.cpp
|
||||
../../../../src/glsl/ir_print_visitor.h
|
||||
../../../../src/glsl/ir_reader.cpp
|
||||
../../../../src/glsl/ir_reader.h
|
||||
../../../../src/glsl/ir_rvalue_visitor.cpp
|
||||
../../../../src/glsl/ir_rvalue_visitor.h
|
||||
../../../../src/glsl/ir_structure_splitting.cpp
|
||||
../../../../src/glsl/ir_sub_to_add_neg.cpp
|
||||
../../../../src/glsl/ir_swizzle_swizzle.cpp
|
||||
../../../../src/glsl/ir_tree_grafting.cpp
|
||||
../../../../src/glsl/ir_unused_structs.cpp
|
||||
../../../../src/glsl/ir_unused_structs.h
|
||||
../../../../src/glsl/ir_validate.cpp
|
||||
../../../../src/glsl/ir_variable.cpp
|
||||
../../../../src/glsl/ir_variable_refcount.cpp
|
||||
../../../../src/glsl/ir_variable_refcount.h
|
||||
../../../../src/glsl/ir_vec_index_to_cond_assign.cpp
|
||||
../../../../src/glsl/ir_vec_index_to_swizzle.cpp
|
||||
../../../../src/glsl/ir_visitor.h
|
||||
../../../../src/glsl/link_functions.cpp
|
||||
../../../../src/glsl/linker.cpp
|
||||
../../../../src/glsl/linker.h
|
||||
../../../../src/glsl/list.h
|
||||
# ../../../../src/glsl/main.cpp
|
||||
../../../../src/glsl/program.h
|
||||
../../../../src/glsl/s_expression.cpp
|
||||
../../../../src/glsl/s_expression.h
|
||||
../../../../src/glsl/msvc/msvccompat.h
|
|
@ -1,9 +0,0 @@
|
|||
[General]
|
||||
Type = StaticLibrary
|
||||
SourceFiles = SourceFiles
|
||||
Platform = Tool
|
||||
|
||||
[Project]
|
||||
IncludePaths=../../../../src/talloc;../../../../include;../../../../src/mesa;../../../../src/mapi;../../../../src/glsl/msvc;../../../../src/glsl
|
||||
Defines=snprintf=_snprintf;NOMINMAX;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE
|
||||
DisabledVcWarnings=4291;4996;4800;4099;4244;4018;4245
|
|
@ -1,829 +0,0 @@
|
|||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="8.00"
|
||||
Name="glsloptlib"
|
||||
ProjectGUID="{793576AD-FB15-5AA1-F2F5-488372B23341}"
|
||||
Keyword="Win32Proj"
|
||||
>
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"
|
||||
/>
|
||||
</Platforms>
|
||||
<ToolFiles>
|
||||
</ToolFiles>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory="$(ProjectDir)$(ConfigurationName)"
|
||||
IntermediateDirectory="$(ProjectDir)$(ConfigurationName)"
|
||||
ConfigurationType="4"
|
||||
UseOfMFC="0"
|
||||
CharacterSet="2"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalOptions=""
|
||||
AdditionalIncludeDirectories=";../../../../src/talloc;../../../../include;../../../../src/mesa;../../../../src/mapi;../../../../src/glsl/msvc;../../../../src/glsl;../../../../../../../Shared;../../../../../../../Tools/Shared;../../../../../freetype-2.1.10/include;../../../../../Lua/include;../../../../../FreeImage;../../../../../../Include;../../../../.."
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;snprintf=_snprintf;NOMINMAX;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;AURORA_TOOL;AURORA_DEBUGG"
|
||||
StringPooling="false"
|
||||
MinimalRebuild="false"
|
||||
ExceptionHandling="2"
|
||||
BasicRuntimeChecks="3"
|
||||
SmallerTypeCheck="true"
|
||||
RuntimeLibrary="3"
|
||||
StructMemberAlignment="3"
|
||||
BufferSecurityCheck="true"
|
||||
EnableFunctionLevelLinking="true"
|
||||
EnableEnhancedInstructionSet="0"
|
||||
FloatingPointExceptions="false"
|
||||
DisableLanguageExtensions="false"
|
||||
DefaultCharIsUnsigned="true"
|
||||
TreatWChar_tAsBuiltInType="true"
|
||||
ForceConformanceInForLoopScope="true"
|
||||
RuntimeTypeInfo="true"
|
||||
OpenMP="false"
|
||||
UsePrecompiledHeader="0"
|
||||
PrecompiledHeaderThrough="PreCompiled.h"
|
||||
WarningLevel="4"
|
||||
Detect64BitPortabilityProblems="true"
|
||||
DebugInformationFormat="4"
|
||||
CallingConvention="0"
|
||||
CompileAs="0"
|
||||
DisableSpecificWarnings="4512;4127;4996;4291;4291;4996;4800;4099;4244;4018;4245"
|
||||
UseFullPaths="false"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLibrarianTool"
|
||||
LinkLibraryDependencies="false"
|
||||
AdditionalDependencies=" "
|
||||
AdditionalLibraryDirectories="../../../../../freetype-2.1.10/lib;../../../../../Lua/lib;../../../../../FreeImage;../../../../../../Lib "
|
||||
OutputFile="$(OutDir)\$(ProjectName).lib"
|
||||
SuppressStartupBanner="true"
|
||||
AdditionalOptions="/IGNORE:4221 /IGNORE:4006"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
Description=""
|
||||
CommandLine=""
|
||||
ExcludedFromBuild="false"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory="$(ProjectDir)$(ConfigurationName)"
|
||||
IntermediateDirectory="$(ProjectDir)$(ConfigurationName)"
|
||||
ConfigurationType="4"
|
||||
CharacterSet="2"
|
||||
UseOfMFC="0"
|
||||
WholeProgramOptimization="0"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="3"
|
||||
AdditionalOptions=""
|
||||
InlineFunctionExpansion="2"
|
||||
EnableIntrinsicFunctions="true"
|
||||
FavorSizeOrSpeed="2"
|
||||
OmitFramePointers="false"
|
||||
WholeProgramOptimization="false"
|
||||
AdditionalIncludeDirectories=";../../../../src/talloc;../../../../include;../../../../src/mesa;../../../../src/mapi;../../../../src/glsl/msvc;../../../../src/glsl;../../../../../../../Shared;../../../../../../../Tools/Shared;../../../../../freetype-2.1.10/include;../../../../../Lua/include;../../../../../FreeImage;../../../../../../Include;../../../../.."
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;snprintf=_snprintf;NOMINMAX;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;AURORA_TOOL;AURORA_RELEASE"
|
||||
StringPooling="false"
|
||||
MinimalRebuild="false"
|
||||
ExceptionHandling="2"
|
||||
BasicRuntimeChecks="0"
|
||||
SmallerTypeCheck="false"
|
||||
RuntimeLibrary="2"
|
||||
StructMemberAlignment="3"
|
||||
BufferSecurityCheck="false"
|
||||
EnableFunctionLevelLinking="true"
|
||||
EnableEnhancedInstructionSet="2"
|
||||
FloatingPointExceptions="false"
|
||||
DisableLanguageExtensions="false"
|
||||
DefaultCharIsUnsigned="true"
|
||||
TreatWChar_tAsBuiltInType="true"
|
||||
ForceConformanceInForLoopScope="true"
|
||||
RuntimeTypeInfo="true"
|
||||
OpenMP="false"
|
||||
UsePrecompiledHeader="0"
|
||||
PrecompiledHeaderThrough="PreCompiled.h"
|
||||
AssemblerOutput="0"
|
||||
WarningLevel="4"
|
||||
Detect64BitPortabilityProblems="true"
|
||||
DebugInformationFormat="3"
|
||||
CallingConvention="0"
|
||||
CompileAs="0"
|
||||
DisableSpecificWarnings="4512;4127;4996;4291;4291;4996;4800;4099;4244;4018;4245"
|
||||
UseFullPaths="false"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLibrarianTool"
|
||||
LinkLibraryDependencies="false"
|
||||
AdditionalDependencies=" "
|
||||
AdditionalLibraryDirectories="../../../../../freetype-2.1.10/lib;../../../../../Lua/lib;../../../../../FreeImage;../../../../../../Lib "
|
||||
OutputFile="$(OutDir)\$(ProjectName).lib"
|
||||
SuppressStartupBanner="true"
|
||||
AdditionalOptions="/IGNORE:4221 /IGNORE:4006"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
Description=""
|
||||
CommandLine=""
|
||||
ExcludedFromBuild="false"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Profile|Win32"
|
||||
OutputDirectory="$(ProjectDir)$(ConfigurationName)"
|
||||
IntermediateDirectory="$(ProjectDir)$(ConfigurationName)"
|
||||
ConfigurationType="4"
|
||||
CharacterSet="2"
|
||||
UseOfMFC="0"
|
||||
WholeProgramOptimization="0"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="3"
|
||||
AdditionalOptions=""
|
||||
InlineFunctionExpansion="2"
|
||||
EnableIntrinsicFunctions="true"
|
||||
FavorSizeOrSpeed="2"
|
||||
OmitFramePointers="false"
|
||||
WholeProgramOptimization="false"
|
||||
AdditionalIncludeDirectories=";../../../../src/talloc;../../../../include;../../../../src/mesa;../../../../src/mapi;../../../../src/glsl/msvc;../../../../src/glsl;../../../../../../../Shared;../../../../../../../Tools/Shared;../../../../../freetype-2.1.10/include;../../../../../Lua/include;../../../../../FreeImage;../../../../../../Include;../../../../.."
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;snprintf=_snprintf;NOMINMAX;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;AURORA_TOOL;AURORA_PROFILE"
|
||||
StringPooling="false"
|
||||
MinimalRebuild="false"
|
||||
ExceptionHandling="2"
|
||||
BasicRuntimeChecks="0"
|
||||
SmallerTypeCheck="false"
|
||||
RuntimeLibrary="2"
|
||||
StructMemberAlignment="3"
|
||||
BufferSecurityCheck="false"
|
||||
EnableFunctionLevelLinking="false"
|
||||
EnableEnhancedInstructionSet="2"
|
||||
FloatingPointExceptions="false"
|
||||
DisableLanguageExtensions="false"
|
||||
DefaultCharIsUnsigned="true"
|
||||
TreatWChar_tAsBuiltInType="true"
|
||||
ForceConformanceInForLoopScope="true"
|
||||
RuntimeTypeInfo="true"
|
||||
OpenMP="false"
|
||||
UsePrecompiledHeader="0"
|
||||
PrecompiledHeaderThrough="PreCompiled.h"
|
||||
AssemblerOutput="0"
|
||||
WarningLevel="4"
|
||||
Detect64BitPortabilityProblems="true"
|
||||
DebugInformationFormat="3"
|
||||
CallingConvention="0"
|
||||
CompileAs="0"
|
||||
DisableSpecificWarnings="4512;4127;4996;4291;4291;4996;4800;4099;4244;4018;4245"
|
||||
UseFullPaths="false"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLibrarianTool"
|
||||
LinkLibraryDependencies="false"
|
||||
AdditionalDependencies=" "
|
||||
AdditionalLibraryDirectories="../../../../../freetype-2.1.10/lib;../../../../../Lua/lib;../../../../../FreeImage;../../../../../../Lib "
|
||||
OutputFile="$(OutDir)\$(ProjectName).lib"
|
||||
SuppressStartupBanner="true"
|
||||
AdditionalOptions="/IGNORE:4221 /IGNORE:4006"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
Description=""
|
||||
CommandLine=""
|
||||
ExcludedFromBuild="false"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Final|Win32"
|
||||
OutputDirectory="$(ProjectDir)$(ConfigurationName)"
|
||||
IntermediateDirectory="$(ProjectDir)$(ConfigurationName)"
|
||||
ConfigurationType="4"
|
||||
CharacterSet="2"
|
||||
UseOfMFC="0"
|
||||
WholeProgramOptimization="1"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="3"
|
||||
AdditionalOptions=""
|
||||
InlineFunctionExpansion="2"
|
||||
EnableIntrinsicFunctions="true"
|
||||
FavorSizeOrSpeed="2"
|
||||
OmitFramePointers="false"
|
||||
WholeProgramOptimization="true"
|
||||
AdditionalIncludeDirectories=";../../../../src/talloc;../../../../include;../../../../src/mesa;../../../../src/mapi;../../../../src/glsl/msvc;../../../../src/glsl;../../../../../../../Shared;../../../../../../../Tools/Shared;../../../../../freetype-2.1.10/include;../../../../../Lua/include;../../../../../FreeImage;../../../../../../Include;../../../../.."
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;snprintf=_snprintf;NOMINMAX;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;AURORA_TOOL;AURORA_FINAL;AURORA_RETAIL"
|
||||
StringPooling="false"
|
||||
MinimalRebuild="false"
|
||||
ExceptionHandling="2"
|
||||
BasicRuntimeChecks="0"
|
||||
SmallerTypeCheck="false"
|
||||
RuntimeLibrary="2"
|
||||
StructMemberAlignment="3"
|
||||
BufferSecurityCheck="false"
|
||||
EnableFunctionLevelLinking="false"
|
||||
EnableEnhancedInstructionSet="2"
|
||||
FloatingPointExceptions="false"
|
||||
DisableLanguageExtensions="false"
|
||||
DefaultCharIsUnsigned="true"
|
||||
TreatWChar_tAsBuiltInType="true"
|
||||
ForceConformanceInForLoopScope="true"
|
||||
RuntimeTypeInfo="true"
|
||||
OpenMP="false"
|
||||
UsePrecompiledHeader="0"
|
||||
PrecompiledHeaderThrough="PreCompiled.h"
|
||||
AssemblerOutput="0"
|
||||
WarningLevel="4"
|
||||
Detect64BitPortabilityProblems="true"
|
||||
DebugInformationFormat="3"
|
||||
CallingConvention="0"
|
||||
CompileAs="0"
|
||||
DisableSpecificWarnings="4512;4127;4996;4291;4291;4996;4800;4099;4244;4018;4245"
|
||||
UseFullPaths="false"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLibrarianTool"
|
||||
LinkLibraryDependencies="false"
|
||||
AdditionalDependencies=" "
|
||||
AdditionalLibraryDirectories="../../../../../freetype-2.1.10/lib;../../../../../Lua/lib;../../../../../FreeImage;../../../../../../Lib "
|
||||
OutputFile="$(OutDir)\$(ProjectName).lib"
|
||||
SuppressStartupBanner="true"
|
||||
AdditionalOptions="/IGNORE:4221 /IGNORE:4006"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManifestTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCAppVerifierTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
Description=""
|
||||
CommandLine=""
|
||||
ExcludedFromBuild="false"
|
||||
/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="src"
|
||||
>
|
||||
<Filter
|
||||
Name="mesa"
|
||||
>
|
||||
<Filter
|
||||
Name="program"
|
||||
>
|
||||
<File
|
||||
RelativePath="..\..\..\..\src\mesa\program\hash_table.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\..\src\mesa\program\hash_table.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\..\src\mesa\program\symbol_table.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\..\src\mesa\program\symbol_table.h"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="talloc"
|
||||
>
|
||||
<File
|
||||
RelativePath="..\..\..\..\src\talloc\talloc.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\..\src\talloc\talloc.h"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="glsl"
|
||||
>
|
||||
<File
|
||||
RelativePath="..\..\..\..\src\glsl\ast.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\..\src\glsl\ast_expr.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\..\src\glsl\ast_function.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\..\src\glsl\ast_to_hir.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\..\src\glsl\ast_type.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\..\src\glsl\builtin_function.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\..\src\glsl\builtin_types.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\..\src\glsl\builtin_variables.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\..\src\glsl\glsl_lexer.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\..\src\glsl\glsl_lexer.lpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\..\src\glsl\glsl_optimizer.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\..\src\glsl\glsl_optimizer.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\..\src\glsl\glsl_parser.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\..\src\glsl\glsl_parser.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\..\src\glsl\glsl_parser.ypp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\..\src\glsl\glsl_parser_extras.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\..\src\glsl\glsl_parser_extras.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\..\src\glsl\glsl_symbol_table.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\..\src\glsl\glsl_types.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\..\src\glsl\glsl_types.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\..\src\glsl\hir_field_selection.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\..\src\glsl\ir.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\..\src\glsl\ir.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\..\src\glsl\ir_algebraic.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\..\src\glsl\ir_basic_block.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\..\src\glsl\ir_basic_block.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\..\src\glsl\ir_clone.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\..\src\glsl\ir_constant_expression.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\..\src\glsl\ir_constant_folding.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\..\src\glsl\ir_constant_propagation.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\..\src\glsl\ir_constant_variable.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\..\src\glsl\ir_copy_propagation.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\..\src\glsl\ir_dead_code.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\..\src\glsl\ir_dead_code_local.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\..\src\glsl\ir_dead_functions.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\..\src\glsl\ir_div_to_mul_rcp.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\..\src\glsl\ir_expression_flattening.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\..\src\glsl\ir_expression_flattening.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\..\src\glsl\ir_function.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\..\src\glsl\ir_function_can_inline.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\..\src\glsl\ir_function_inlining.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\..\src\glsl\ir_function_inlining.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\..\src\glsl\ir_hierarchical_visitor.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\..\src\glsl\ir_hierarchical_visitor.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\..\src\glsl\ir_hv_accept.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\..\src\glsl\ir_if_return.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\..\src\glsl\ir_if_simplification.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\..\src\glsl\ir_if_to_cond_assign.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\..\src\glsl\ir_import_prototypes.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\..\src\glsl\ir_mat_op_to_vec.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\..\src\glsl\ir_mod_to_fract.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\..\src\glsl\ir_noop_swizzle.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\..\src\glsl\ir_optimization.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\..\src\glsl\ir_print_glsl_visitor.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\..\src\glsl\ir_print_glsl_visitor.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\..\src\glsl\ir_print_visitor.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\..\src\glsl\ir_print_visitor.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\..\src\glsl\ir_reader.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\..\src\glsl\ir_reader.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\..\src\glsl\ir_rvalue_visitor.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\..\src\glsl\ir_rvalue_visitor.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\..\src\glsl\ir_structure_splitting.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\..\src\glsl\ir_sub_to_add_neg.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\..\src\glsl\ir_swizzle_swizzle.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\..\src\glsl\ir_tree_grafting.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\..\src\glsl\ir_unused_structs.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\..\src\glsl\ir_unused_structs.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\..\src\glsl\ir_validate.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\..\src\glsl\ir_variable.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\..\src\glsl\ir_variable_refcount.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\..\src\glsl\ir_variable_refcount.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\..\src\glsl\ir_vec_index_to_cond_assign.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\..\src\glsl\ir_vec_index_to_swizzle.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\..\src\glsl\ir_visitor.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\..\src\glsl\link_functions.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\..\src\glsl\linker.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\..\src\glsl\linker.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\..\src\glsl\list.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\..\src\glsl\program.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\..\src\glsl\s_expression.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\..\src\glsl\s_expression.h"
|
||||
>
|
||||
</File>
|
||||
<Filter
|
||||
Name="msvc"
|
||||
>
|
||||
<File
|
||||
RelativePath="..\..\..\..\src\glsl\msvc\msvccompat.h"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
</Filter>
|
||||
</Filter>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
|
@ -1,5 +0,0 @@
|
|||
#! /bin/sh
|
||||
flex --nounistd -osrc/glsl/glcpp/glcpp-lex.c src/glsl/glcpp/glcpp-lex.l
|
||||
flex --nounistd -osrc/glsl/glsl_lexer.cpp src/glsl/glsl_lexer.ll
|
||||
bison -v -o "src/glsl/glcpp/glcpp-parse.c" -p "glcpp_parser_" --defines=src/glsl/glcpp/glcpp-parse.h src/glsl/glcpp/glcpp-parse.y
|
||||
bison -v -o "src/glsl/glsl_parser.cpp" -p "_mesa_glsl_" --defines=src/glsl/glsl_parser.h src/glsl/glsl_parser.yy
|
|
@ -1,305 +0,0 @@
|
|||
// ISO C9x compliant inttypes.h for Microsoft Visual Studio
|
||||
// Based on ISO/IEC 9899:TC2 Committee draft (May 6, 2005) WG14/N1124
|
||||
//
|
||||
// Copyright (c) 2006 Alexander Chemeris
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are met:
|
||||
//
|
||||
// 1. Redistributions of source code must retain the above copyright notice,
|
||||
// this list of conditions and the following disclaimer.
|
||||
//
|
||||
// 2. Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the distribution.
|
||||
//
|
||||
// 3. The name of the author may be used to endorse or promote products
|
||||
// derived from this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
|
||||
// EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
// OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _MSC_VER // [
|
||||
#error "Use this header only with Microsoft Visual C++ compilers!"
|
||||
#endif // _MSC_VER ]
|
||||
|
||||
#ifndef _MSC_INTTYPES_H_ // [
|
||||
#define _MSC_INTTYPES_H_
|
||||
|
||||
#if _MSC_VER > 1000
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#include "stdint.h"
|
||||
|
||||
// 7.8 Format conversion of integer types
|
||||
|
||||
typedef struct {
|
||||
intmax_t quot;
|
||||
intmax_t rem;
|
||||
} imaxdiv_t;
|
||||
|
||||
// 7.8.1 Macros for format specifiers
|
||||
|
||||
#if !defined(__cplusplus) || defined(__STDC_FORMAT_MACROS) // [ See footnote 185 at page 198
|
||||
|
||||
// The fprintf macros for signed integers are:
|
||||
#define PRId8 "d"
|
||||
#define PRIi8 "i"
|
||||
#define PRIdLEAST8 "d"
|
||||
#define PRIiLEAST8 "i"
|
||||
#define PRIdFAST8 "d"
|
||||
#define PRIiFAST8 "i"
|
||||
|
||||
#define PRId16 "hd"
|
||||
#define PRIi16 "hi"
|
||||
#define PRIdLEAST16 "hd"
|
||||
#define PRIiLEAST16 "hi"
|
||||
#define PRIdFAST16 "hd"
|
||||
#define PRIiFAST16 "hi"
|
||||
|
||||
#define PRId32 "I32d"
|
||||
#define PRIi32 "I32i"
|
||||
#define PRIdLEAST32 "I32d"
|
||||
#define PRIiLEAST32 "I32i"
|
||||
#define PRIdFAST32 "I32d"
|
||||
#define PRIiFAST32 "I32i"
|
||||
|
||||
#define PRId64 "I64d"
|
||||
#define PRIi64 "I64i"
|
||||
#define PRIdLEAST64 "I64d"
|
||||
#define PRIiLEAST64 "I64i"
|
||||
#define PRIdFAST64 "I64d"
|
||||
#define PRIiFAST64 "I64i"
|
||||
|
||||
#define PRIdMAX "I64d"
|
||||
#define PRIiMAX "I64i"
|
||||
|
||||
#define PRIdPTR "Id"
|
||||
#define PRIiPTR "Ii"
|
||||
|
||||
// The fprintf macros for unsigned integers are:
|
||||
#define PRIo8 "o"
|
||||
#define PRIu8 "u"
|
||||
#define PRIx8 "x"
|
||||
#define PRIX8 "X"
|
||||
#define PRIoLEAST8 "o"
|
||||
#define PRIuLEAST8 "u"
|
||||
#define PRIxLEAST8 "x"
|
||||
#define PRIXLEAST8 "X"
|
||||
#define PRIoFAST8 "o"
|
||||
#define PRIuFAST8 "u"
|
||||
#define PRIxFAST8 "x"
|
||||
#define PRIXFAST8 "X"
|
||||
|
||||
#define PRIo16 "ho"
|
||||
#define PRIu16 "hu"
|
||||
#define PRIx16 "hx"
|
||||
#define PRIX16 "hX"
|
||||
#define PRIoLEAST16 "ho"
|
||||
#define PRIuLEAST16 "hu"
|
||||
#define PRIxLEAST16 "hx"
|
||||
#define PRIXLEAST16 "hX"
|
||||
#define PRIoFAST16 "ho"
|
||||
#define PRIuFAST16 "hu"
|
||||
#define PRIxFAST16 "hx"
|
||||
#define PRIXFAST16 "hX"
|
||||
|
||||
#define PRIo32 "I32o"
|
||||
#define PRIu32 "I32u"
|
||||
#define PRIx32 "I32x"
|
||||
#define PRIX32 "I32X"
|
||||
#define PRIoLEAST32 "I32o"
|
||||
#define PRIuLEAST32 "I32u"
|
||||
#define PRIxLEAST32 "I32x"
|
||||
#define PRIXLEAST32 "I32X"
|
||||
#define PRIoFAST32 "I32o"
|
||||
#define PRIuFAST32 "I32u"
|
||||
#define PRIxFAST32 "I32x"
|
||||
#define PRIXFAST32 "I32X"
|
||||
|
||||
#define PRIo64 "I64o"
|
||||
#define PRIu64 "I64u"
|
||||
#define PRIx64 "I64x"
|
||||
#define PRIX64 "I64X"
|
||||
#define PRIoLEAST64 "I64o"
|
||||
#define PRIuLEAST64 "I64u"
|
||||
#define PRIxLEAST64 "I64x"
|
||||
#define PRIXLEAST64 "I64X"
|
||||
#define PRIoFAST64 "I64o"
|
||||
#define PRIuFAST64 "I64u"
|
||||
#define PRIxFAST64 "I64x"
|
||||
#define PRIXFAST64 "I64X"
|
||||
|
||||
#define PRIoMAX "I64o"
|
||||
#define PRIuMAX "I64u"
|
||||
#define PRIxMAX "I64x"
|
||||
#define PRIXMAX "I64X"
|
||||
|
||||
#define PRIoPTR "Io"
|
||||
#define PRIuPTR "Iu"
|
||||
#define PRIxPTR "Ix"
|
||||
#define PRIXPTR "IX"
|
||||
|
||||
// The fscanf macros for signed integers are:
|
||||
#define SCNd8 "d"
|
||||
#define SCNi8 "i"
|
||||
#define SCNdLEAST8 "d"
|
||||
#define SCNiLEAST8 "i"
|
||||
#define SCNdFAST8 "d"
|
||||
#define SCNiFAST8 "i"
|
||||
|
||||
#define SCNd16 "hd"
|
||||
#define SCNi16 "hi"
|
||||
#define SCNdLEAST16 "hd"
|
||||
#define SCNiLEAST16 "hi"
|
||||
#define SCNdFAST16 "hd"
|
||||
#define SCNiFAST16 "hi"
|
||||
|
||||
#define SCNd32 "ld"
|
||||
#define SCNi32 "li"
|
||||
#define SCNdLEAST32 "ld"
|
||||
#define SCNiLEAST32 "li"
|
||||
#define SCNdFAST32 "ld"
|
||||
#define SCNiFAST32 "li"
|
||||
|
||||
#define SCNd64 "I64d"
|
||||
#define SCNi64 "I64i"
|
||||
#define SCNdLEAST64 "I64d"
|
||||
#define SCNiLEAST64 "I64i"
|
||||
#define SCNdFAST64 "I64d"
|
||||
#define SCNiFAST64 "I64i"
|
||||
|
||||
#define SCNdMAX "I64d"
|
||||
#define SCNiMAX "I64i"
|
||||
|
||||
#ifdef _WIN64 // [
|
||||
# define SCNdPTR "I64d"
|
||||
# define SCNiPTR "I64i"
|
||||
#else // _WIN64 ][
|
||||
# define SCNdPTR "ld"
|
||||
# define SCNiPTR "li"
|
||||
#endif // _WIN64 ]
|
||||
|
||||
// The fscanf macros for unsigned integers are:
|
||||
#define SCNo8 "o"
|
||||
#define SCNu8 "u"
|
||||
#define SCNx8 "x"
|
||||
#define SCNX8 "X"
|
||||
#define SCNoLEAST8 "o"
|
||||
#define SCNuLEAST8 "u"
|
||||
#define SCNxLEAST8 "x"
|
||||
#define SCNXLEAST8 "X"
|
||||
#define SCNoFAST8 "o"
|
||||
#define SCNuFAST8 "u"
|
||||
#define SCNxFAST8 "x"
|
||||
#define SCNXFAST8 "X"
|
||||
|
||||
#define SCNo16 "ho"
|
||||
#define SCNu16 "hu"
|
||||
#define SCNx16 "hx"
|
||||
#define SCNX16 "hX"
|
||||
#define SCNoLEAST16 "ho"
|
||||
#define SCNuLEAST16 "hu"
|
||||
#define SCNxLEAST16 "hx"
|
||||
#define SCNXLEAST16 "hX"
|
||||
#define SCNoFAST16 "ho"
|
||||
#define SCNuFAST16 "hu"
|
||||
#define SCNxFAST16 "hx"
|
||||
#define SCNXFAST16 "hX"
|
||||
|
||||
#define SCNo32 "lo"
|
||||
#define SCNu32 "lu"
|
||||
#define SCNx32 "lx"
|
||||
#define SCNX32 "lX"
|
||||
#define SCNoLEAST32 "lo"
|
||||
#define SCNuLEAST32 "lu"
|
||||
#define SCNxLEAST32 "lx"
|
||||
#define SCNXLEAST32 "lX"
|
||||
#define SCNoFAST32 "lo"
|
||||
#define SCNuFAST32 "lu"
|
||||
#define SCNxFAST32 "lx"
|
||||
#define SCNXFAST32 "lX"
|
||||
|
||||
#define SCNo64 "I64o"
|
||||
#define SCNu64 "I64u"
|
||||
#define SCNx64 "I64x"
|
||||
#define SCNX64 "I64X"
|
||||
#define SCNoLEAST64 "I64o"
|
||||
#define SCNuLEAST64 "I64u"
|
||||
#define SCNxLEAST64 "I64x"
|
||||
#define SCNXLEAST64 "I64X"
|
||||
#define SCNoFAST64 "I64o"
|
||||
#define SCNuFAST64 "I64u"
|
||||
#define SCNxFAST64 "I64x"
|
||||
#define SCNXFAST64 "I64X"
|
||||
|
||||
#define SCNoMAX "I64o"
|
||||
#define SCNuMAX "I64u"
|
||||
#define SCNxMAX "I64x"
|
||||
#define SCNXMAX "I64X"
|
||||
|
||||
#ifdef _WIN64 // [
|
||||
# define SCNoPTR "I64o"
|
||||
# define SCNuPTR "I64u"
|
||||
# define SCNxPTR "I64x"
|
||||
# define SCNXPTR "I64X"
|
||||
#else // _WIN64 ][
|
||||
# define SCNoPTR "lo"
|
||||
# define SCNuPTR "lu"
|
||||
# define SCNxPTR "lx"
|
||||
# define SCNXPTR "lX"
|
||||
#endif // _WIN64 ]
|
||||
|
||||
#endif // __STDC_FORMAT_MACROS ]
|
||||
|
||||
// 7.8.2 Functions for greatest-width integer types
|
||||
|
||||
// 7.8.2.1 The imaxabs function
|
||||
#define imaxabs _abs64
|
||||
|
||||
// 7.8.2.2 The imaxdiv function
|
||||
|
||||
// This is modified version of div() function from Microsoft's div.c found
|
||||
// in %MSVC.NET%\crt\src\div.c
|
||||
#ifdef STATIC_IMAXDIV // [
|
||||
static
|
||||
#else // STATIC_IMAXDIV ][
|
||||
_inline
|
||||
#endif // STATIC_IMAXDIV ]
|
||||
imaxdiv_t __cdecl imaxdiv(intmax_t numer, intmax_t denom)
|
||||
{
|
||||
imaxdiv_t result;
|
||||
|
||||
result.quot = numer / denom;
|
||||
result.rem = numer % denom;
|
||||
|
||||
if (numer < 0 && result.rem > 0) {
|
||||
// did division wrong; must fix up
|
||||
++result.quot;
|
||||
result.rem -= denom;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
// 7.8.2.3 The strtoimax and strtoumax functions
|
||||
#define strtoimax _strtoi64
|
||||
#define strtoumax _strtoui64
|
||||
|
||||
// 7.8.2.4 The wcstoimax and wcstoumax functions
|
||||
#define wcstoimax _wcstoi64
|
||||
#define wcstoumax _wcstoui64
|
||||
|
||||
|
||||
#endif // _MSC_INTTYPES_H_ ]
|
|
@ -1,47 +0,0 @@
|
|||
/**************************************************************************
|
||||
*
|
||||
* Copyright 2007-2010 VMware, Inc.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sub license, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
|
||||
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
||||
* USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the
|
||||
* next paragraph) shall be included in all copies or substantial portions
|
||||
* of the Software.
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
#ifndef _STDBOOL_H_
|
||||
#define _STDBOOL_H_
|
||||
|
||||
#ifndef __cplusplus
|
||||
|
||||
#define false 0
|
||||
#define true 1
|
||||
#define bool _Bool
|
||||
|
||||
/* For compilers that don't have the builtin _Bool type. */
|
||||
#if ((defined(_MSC_VER) && _MSC_VER < 1800) || \
|
||||
(defined __GNUC__&& __STDC_VERSION__ < 199901L && __GNUC__ < 3)) && !defined(_lint)
|
||||
typedef unsigned char _Bool;
|
||||
#endif
|
||||
|
||||
#endif /* !__cplusplus */
|
||||
|
||||
#define __bool_true_false_are_defined 1
|
||||
|
||||
#endif /* !_STDBOOL_H_ */
|
|
@ -1,247 +0,0 @@
|
|||
// ISO C9x compliant stdint.h for Microsoft Visual Studio
|
||||
// Based on ISO/IEC 9899:TC2 Committee draft (May 6, 2005) WG14/N1124
|
||||
//
|
||||
// Copyright (c) 2006-2008 Alexander Chemeris
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are met:
|
||||
//
|
||||
// 1. Redistributions of source code must retain the above copyright notice,
|
||||
// this list of conditions and the following disclaimer.
|
||||
//
|
||||
// 2. Redistributions in binary form must reproduce the above copyright
|
||||
// notice, this list of conditions and the following disclaimer in the
|
||||
// documentation and/or other materials provided with the distribution.
|
||||
//
|
||||
// 3. The name of the author may be used to endorse or promote products
|
||||
// derived from this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
|
||||
// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
|
||||
// EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
// OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _MSC_VER // [
|
||||
#error "Use this header only with Microsoft Visual C++ compilers!"
|
||||
#endif // _MSC_VER ]
|
||||
|
||||
#ifndef _MSC_STDINT_H_ // [
|
||||
#define _MSC_STDINT_H_
|
||||
|
||||
#if _MSC_VER > 1000
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#include <limits.h>
|
||||
|
||||
// For Visual Studio 6 in C++ mode and for many Visual Studio versions when
|
||||
// compiling for ARM we should wrap <wchar.h> include with 'extern "C++" {}'
|
||||
// or compiler give many errors like this:
|
||||
// error C2733: second C linkage of overloaded function 'wmemchr' not allowed
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
# include <wchar.h>
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
// Define _W64 macros to mark types changing their size, like intptr_t.
|
||||
#ifndef _W64
|
||||
# if !defined(__midl) && (defined(_X86_) || defined(_M_IX86)) && _MSC_VER >= 1300
|
||||
# define _W64 __w64
|
||||
# else
|
||||
# define _W64
|
||||
# endif
|
||||
#endif
|
||||
|
||||
|
||||
// 7.18.1 Integer types
|
||||
|
||||
// 7.18.1.1 Exact-width integer types
|
||||
|
||||
// Visual Studio 6 and Embedded Visual C++ 4 doesn't
|
||||
// realize that, e.g. char has the same size as __int8
|
||||
// so we give up on __intX for them.
|
||||
#if (_MSC_VER < 1300)
|
||||
typedef signed char int8_t;
|
||||
typedef signed short int16_t;
|
||||
typedef signed int int32_t;
|
||||
typedef unsigned char uint8_t;
|
||||
typedef unsigned short uint16_t;
|
||||
typedef unsigned int uint32_t;
|
||||
#else
|
||||
typedef signed __int8 int8_t;
|
||||
typedef signed __int16 int16_t;
|
||||
typedef signed __int32 int32_t;
|
||||
typedef unsigned __int8 uint8_t;
|
||||
typedef unsigned __int16 uint16_t;
|
||||
typedef unsigned __int32 uint32_t;
|
||||
#endif
|
||||
typedef signed __int64 int64_t;
|
||||
typedef unsigned __int64 uint64_t;
|
||||
|
||||
|
||||
// 7.18.1.2 Minimum-width integer types
|
||||
typedef int8_t int_least8_t;
|
||||
typedef int16_t int_least16_t;
|
||||
typedef int32_t int_least32_t;
|
||||
typedef int64_t int_least64_t;
|
||||
typedef uint8_t uint_least8_t;
|
||||
typedef uint16_t uint_least16_t;
|
||||
typedef uint32_t uint_least32_t;
|
||||
typedef uint64_t uint_least64_t;
|
||||
|
||||
// 7.18.1.3 Fastest minimum-width integer types
|
||||
typedef int8_t int_fast8_t;
|
||||
typedef int16_t int_fast16_t;
|
||||
typedef int32_t int_fast32_t;
|
||||
typedef int64_t int_fast64_t;
|
||||
typedef uint8_t uint_fast8_t;
|
||||
typedef uint16_t uint_fast16_t;
|
||||
typedef uint32_t uint_fast32_t;
|
||||
typedef uint64_t uint_fast64_t;
|
||||
|
||||
// 7.18.1.4 Integer types capable of holding object pointers
|
||||
#ifdef _WIN64 // [
|
||||
typedef signed __int64 intptr_t;
|
||||
typedef unsigned __int64 uintptr_t;
|
||||
#else // _WIN64 ][
|
||||
typedef _W64 signed int intptr_t;
|
||||
typedef _W64 unsigned int uintptr_t;
|
||||
#endif // _WIN64 ]
|
||||
|
||||
// 7.18.1.5 Greatest-width integer types
|
||||
typedef int64_t intmax_t;
|
||||
typedef uint64_t uintmax_t;
|
||||
|
||||
|
||||
// 7.18.2 Limits of specified-width integer types
|
||||
|
||||
#if !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS) // [ See footnote 220 at page 257 and footnote 221 at page 259
|
||||
|
||||
// 7.18.2.1 Limits of exact-width integer types
|
||||
#define INT8_MIN ((int8_t)_I8_MIN)
|
||||
#define INT8_MAX _I8_MAX
|
||||
#define INT16_MIN ((int16_t)_I16_MIN)
|
||||
#define INT16_MAX _I16_MAX
|
||||
#define INT32_MIN ((int32_t)_I32_MIN)
|
||||
#define INT32_MAX _I32_MAX
|
||||
#define INT64_MIN ((int64_t)_I64_MIN)
|
||||
#define INT64_MAX _I64_MAX
|
||||
#define UINT8_MAX _UI8_MAX
|
||||
#define UINT16_MAX _UI16_MAX
|
||||
#define UINT32_MAX _UI32_MAX
|
||||
#define UINT64_MAX _UI64_MAX
|
||||
|
||||
// 7.18.2.2 Limits of minimum-width integer types
|
||||
#define INT_LEAST8_MIN INT8_MIN
|
||||
#define INT_LEAST8_MAX INT8_MAX
|
||||
#define INT_LEAST16_MIN INT16_MIN
|
||||
#define INT_LEAST16_MAX INT16_MAX
|
||||
#define INT_LEAST32_MIN INT32_MIN
|
||||
#define INT_LEAST32_MAX INT32_MAX
|
||||
#define INT_LEAST64_MIN INT64_MIN
|
||||
#define INT_LEAST64_MAX INT64_MAX
|
||||
#define UINT_LEAST8_MAX UINT8_MAX
|
||||
#define UINT_LEAST16_MAX UINT16_MAX
|
||||
#define UINT_LEAST32_MAX UINT32_MAX
|
||||
#define UINT_LEAST64_MAX UINT64_MAX
|
||||
|
||||
// 7.18.2.3 Limits of fastest minimum-width integer types
|
||||
#define INT_FAST8_MIN INT8_MIN
|
||||
#define INT_FAST8_MAX INT8_MAX
|
||||
#define INT_FAST16_MIN INT16_MIN
|
||||
#define INT_FAST16_MAX INT16_MAX
|
||||
#define INT_FAST32_MIN INT32_MIN
|
||||
#define INT_FAST32_MAX INT32_MAX
|
||||
#define INT_FAST64_MIN INT64_MIN
|
||||
#define INT_FAST64_MAX INT64_MAX
|
||||
#define UINT_FAST8_MAX UINT8_MAX
|
||||
#define UINT_FAST16_MAX UINT16_MAX
|
||||
#define UINT_FAST32_MAX UINT32_MAX
|
||||
#define UINT_FAST64_MAX UINT64_MAX
|
||||
|
||||
// 7.18.2.4 Limits of integer types capable of holding object pointers
|
||||
#ifdef _WIN64 // [
|
||||
# define INTPTR_MIN INT64_MIN
|
||||
# define INTPTR_MAX INT64_MAX
|
||||
# define UINTPTR_MAX UINT64_MAX
|
||||
#else // _WIN64 ][
|
||||
# define INTPTR_MIN INT32_MIN
|
||||
# define INTPTR_MAX INT32_MAX
|
||||
# define UINTPTR_MAX UINT32_MAX
|
||||
#endif // _WIN64 ]
|
||||
|
||||
// 7.18.2.5 Limits of greatest-width integer types
|
||||
#define INTMAX_MIN INT64_MIN
|
||||
#define INTMAX_MAX INT64_MAX
|
||||
#define UINTMAX_MAX UINT64_MAX
|
||||
|
||||
// 7.18.3 Limits of other integer types
|
||||
|
||||
#ifdef _WIN64 // [
|
||||
# define PTRDIFF_MIN _I64_MIN
|
||||
# define PTRDIFF_MAX _I64_MAX
|
||||
#else // _WIN64 ][
|
||||
# define PTRDIFF_MIN _I32_MIN
|
||||
# define PTRDIFF_MAX _I32_MAX
|
||||
#endif // _WIN64 ]
|
||||
|
||||
#define SIG_ATOMIC_MIN INT_MIN
|
||||
#define SIG_ATOMIC_MAX INT_MAX
|
||||
|
||||
#ifndef SIZE_MAX // [
|
||||
# ifdef _WIN64 // [
|
||||
# define SIZE_MAX _UI64_MAX
|
||||
# else // _WIN64 ][
|
||||
# define SIZE_MAX _UI32_MAX
|
||||
# endif // _WIN64 ]
|
||||
#endif // SIZE_MAX ]
|
||||
|
||||
// WCHAR_MIN and WCHAR_MAX are also defined in <wchar.h>
|
||||
#ifndef WCHAR_MIN // [
|
||||
# define WCHAR_MIN 0
|
||||
#endif // WCHAR_MIN ]
|
||||
#ifndef WCHAR_MAX // [
|
||||
# define WCHAR_MAX _UI16_MAX
|
||||
#endif // WCHAR_MAX ]
|
||||
|
||||
#define WINT_MIN 0
|
||||
#define WINT_MAX _UI16_MAX
|
||||
|
||||
#endif // __STDC_LIMIT_MACROS ]
|
||||
|
||||
|
||||
// 7.18.4 Limits of other integer types
|
||||
|
||||
#if !defined(__cplusplus) || defined(__STDC_CONSTANT_MACROS) // [ See footnote 224 at page 260
|
||||
|
||||
// 7.18.4.1 Macros for minimum-width integer constants
|
||||
|
||||
#define INT8_C(val) val##i8
|
||||
#define INT16_C(val) val##i16
|
||||
#define INT32_C(val) val##i32
|
||||
#define INT64_C(val) val##i64
|
||||
|
||||
#define UINT8_C(val) val##ui8
|
||||
#define UINT16_C(val) val##ui16
|
||||
#define UINT32_C(val) val##ui32
|
||||
#define UINT64_C(val) val##ui64
|
||||
|
||||
// 7.18.4.2 Macros for greatest-width integer constants
|
||||
#define INTMAX_C INT64_C
|
||||
#define UINTMAX_C UINT64_C
|
||||
|
||||
#endif // __STDC_CONSTANT_MACROS ]
|
||||
|
||||
|
||||
#endif // _MSC_STDINT_H_ ]
|
|
@ -1,180 +0,0 @@
|
|||
/**************************************************************************
|
||||
*
|
||||
* Copyright 2007-2013 VMware, Inc.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sub license, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the
|
||||
* next paragraph) shall be included in all copies or substantial portions
|
||||
* of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
|
||||
* IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
|
||||
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
#ifndef _C99_COMPAT_H_
|
||||
#define _C99_COMPAT_H_
|
||||
|
||||
|
||||
/*
|
||||
* MSVC hacks.
|
||||
*/
|
||||
#if defined(_MSC_VER)
|
||||
|
||||
// BK - STFU!
|
||||
# pragma warning(disable:4244) // warning C4244: 'function' : conversion from 'intmax_t' to 'int', possible loss of data
|
||||
# pragma warning(disable:4267) // warning C4267: '=' : conversion from 'size_t' to 'unsigned int', possible loss of data
|
||||
# pragma warning(disable:4351) // warning C4351: new behavior: elements of array '`anonymous-namespace'::per_vertex_accumulator::fields' will be default initialized
|
||||
# pragma warning(disable:4345) // warning C4345: behavior change: an object of POD type constructed with an initializer of the form () will be default-initialized
|
||||
# pragma warning(disable:4715) // warning C4715: 'write_mask_to_swizzle' : not all control paths return a value
|
||||
# pragma warning(disable:4800) // warning C4800: 'unsigned int' : forcing value to bool 'true' or 'false' (performance warning)
|
||||
# pragma warning(disable:4456) // warning C4456: declaration of 'deref_var' hides previous local declaration
|
||||
# pragma warning(disable:4457) // warning C4457: declaration of 'idx' hides function parameter
|
||||
# pragma warning(disable:4458) // warning C4458: declaration of 'type' hides class member
|
||||
# pragma warning(disable:4018) // warning C4018: '<': signed / unsigned mismatch
|
||||
# pragma warning(disable:4805) // warning C4805: '|=': unsafe mix of type 'GLboolean' and type 'bool' in operation
|
||||
|
||||
/*
|
||||
* Visual Studio 2012 will complain if we define the `inline` keyword, but
|
||||
* actually it only supports the keyword on C++.
|
||||
*
|
||||
* To avoid this the _ALLOW_KEYWORD_MACROS must be set.
|
||||
*/
|
||||
# if (_MSC_VER >= 1700) && !defined(_ALLOW_KEYWORD_MACROS)
|
||||
# define _ALLOW_KEYWORD_MACROS
|
||||
# endif
|
||||
|
||||
/*
|
||||
* XXX: MSVC has a `__restrict` keyword, but it also has a
|
||||
* `__declspec(restrict)` modifier, so it is impossible to define a
|
||||
* `restrict` macro without interfering with the latter. Furthermore the
|
||||
* MSVC standard library uses __declspec(restrict) under the _CRTRESTRICT
|
||||
* macro. For now resolve this issue by redefining _CRTRESTRICT, but going
|
||||
* forward we should probably should stop using restrict, especially
|
||||
* considering that our code does not obbey strict aliasing rules any way.
|
||||
*/
|
||||
# include <crtdefs.h>
|
||||
# undef _CRTRESTRICT
|
||||
# define _CRTRESTRICT
|
||||
#else
|
||||
// BK - STFU!
|
||||
# pragma GCC diagnostic ignored "-Wunknown-pragmas" // for clang to disable GCC pragmas
|
||||
# pragma GCC diagnostic ignored "-Wpragmas" // for GCC to disable clang pragmas
|
||||
# pragma GCC diagnostic ignored "-Wformat-extra-args"
|
||||
# pragma GCC diagnostic ignored "-Wignored-qualifiers"
|
||||
# pragma GCC diagnostic ignored "-Wmissing-field-initializers"
|
||||
# pragma GCC diagnostic ignored "-Wreorder"
|
||||
# pragma GCC diagnostic ignored "-Woverloaded-virtual"
|
||||
# pragma GCC diagnostic ignored "-Wsign-compare"
|
||||
# pragma GCC diagnostic ignored "-Wunneeded-internal-declaration"
|
||||
# pragma GCC diagnostic ignored "-Wunused-parameter"
|
||||
# pragma GCC diagnostic ignored "-Wunused-private-field"
|
||||
# pragma GCC diagnostic ignored "-Wunused-variable"
|
||||
# pragma GCC diagnostic ignored "-Wdelete-non-virtual-dtor"
|
||||
|
||||
# if !defined(__clang__)
|
||||
# pragma GCC diagnostic ignored "-Wformat="
|
||||
# pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
|
||||
# endif
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* C99 inline keyword
|
||||
*/
|
||||
#ifndef inline
|
||||
# ifdef __cplusplus
|
||||
/* C++ supports inline keyword */
|
||||
# elif defined(__GNUC__)
|
||||
# define inline __inline__
|
||||
# elif defined(_MSC_VER)
|
||||
# define inline __inline
|
||||
# elif defined(__ICL)
|
||||
# define inline __inline
|
||||
# elif defined(__INTEL_COMPILER)
|
||||
/* Intel compiler supports inline keyword */
|
||||
# elif defined(__WATCOMC__) && (__WATCOMC__ >= 1100)
|
||||
# define inline __inline
|
||||
# elif defined(__SUNPRO_C) && defined(__C99FEATURES__)
|
||||
/* C99 supports inline keyword */
|
||||
# elif defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)
|
||||
/* C99 supports inline keyword */
|
||||
# else
|
||||
# define inline
|
||||
# endif
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* C99 restrict keyword
|
||||
*
|
||||
* See also:
|
||||
* - http://cellperformance.beyond3d.com/articles/2006/05/demystifying-the-restrict-keyword.html
|
||||
*/
|
||||
#ifndef restrict
|
||||
# if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)
|
||||
/* C99 */
|
||||
# elif defined(__SUNPRO_C) && defined(__C99FEATURES__)
|
||||
/* C99 */
|
||||
# elif defined(__GNUC__)
|
||||
# define restrict __restrict__
|
||||
# elif defined(_MSC_VER)
|
||||
# define restrict __restrict
|
||||
# else
|
||||
# define restrict /* */
|
||||
# endif
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* C99 __func__ macro
|
||||
*/
|
||||
#ifndef __func__
|
||||
# if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) && !defined(_MSC_VER)
|
||||
/* C99 */
|
||||
# elif defined(__SUNPRO_C) && defined(__C99FEATURES__)
|
||||
/* C99 */
|
||||
# elif defined(__GNUC__)
|
||||
# if __GNUC__ >= 2
|
||||
# define __func__ __FUNCTION__
|
||||
# else
|
||||
# define __func__ "<unknown>"
|
||||
# endif
|
||||
# elif defined(_MSC_VER)
|
||||
# if _MSC_VER >= 1300
|
||||
# define __func__ __FUNCTION__
|
||||
# else
|
||||
# define __func__ "<unknown>"
|
||||
# endif
|
||||
# else
|
||||
# define __func__ "<unknown>"
|
||||
# endif
|
||||
#endif
|
||||
|
||||
|
||||
/* Simple test case for debugging */
|
||||
#if 0
|
||||
static inline const char *
|
||||
test_c99_compat_h(const void * restrict a,
|
||||
const void * restrict b)
|
||||
{
|
||||
return __func__;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#endif /* _C99_COMPAT_H_ */
|
|
@ -1,21 +0,0 @@
|
|||
GLSL Optimizer is licensed according to the terms of the MIT license:
|
||||
|
||||
Copyright (C) 1999-2007 Brian Paul All Rights Reserved.
|
||||
Copyright (C) 2010-2013 Unity Technologies All Rights Reserved.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a
|
||||
copy of this software and associated documentation files (the "Software"),
|
||||
to deal in the Software without restriction, including without limitation
|
||||
the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
and/or sell copies of the Software, and to permit persons to whom the
|
||||
Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included
|
||||
in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
||||
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
@ -1,38 +0,0 @@
|
|||
{
|
||||
"name": "glsl-optimizer",
|
||||
"version": "0.1.0",
|
||||
"description": "GLSL optimizer",
|
||||
"main": "build/Release/glslOptimizer.node",
|
||||
"scripts": {
|
||||
"install": "node-gyp rebuild"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/aras-p/glsl-optimizer.git"
|
||||
},
|
||||
"keywords": [
|
||||
"glsl",
|
||||
"webgl",
|
||||
"shader",
|
||||
"optimize",
|
||||
"optimizer",
|
||||
"opengl",
|
||||
"essl",
|
||||
"es",
|
||||
"opengles"
|
||||
],
|
||||
"readmeFilename": "README.md",
|
||||
"author": "Aras Pranckevičius",
|
||||
"license": "MIT",
|
||||
"gypfile": true,
|
||||
"bugs": {
|
||||
"url": "https://github.com/aras-p/glsl-optimizer/issues"
|
||||
},
|
||||
"homepage": "https://github.com/aras-p/glsl-optimizer",
|
||||
"directories": {
|
||||
"test": "tests"
|
||||
},
|
||||
"dependencies": {
|
||||
"nan": "~1.2.0"
|
||||
}
|
||||
}
|
|
@ -1,36 +0,0 @@
|
|||
|
||||
Microsoft Visual Studio Solution File, Format Version 11.00
|
||||
# Visual Studio 2010
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "glsl_optimizer_lib", "glsl_optimizer_lib.vcxproj", "{B475A403-9D9B-410D-8A93-BA49FC4DD811}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "glsl_optimizer_tests", "glsl_optimizer_tests.vcxproj", "{BB382242-6EBB-445F-989C-B9BA61D17965}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Win32 = Debug|Win32
|
||||
Debug|x64 = Debug|x64
|
||||
Release|Win32 = Release|Win32
|
||||
Release|x64 = Release|x64
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{B475A403-9D9B-410D-8A93-BA49FC4DD811}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{B475A403-9D9B-410D-8A93-BA49FC4DD811}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{B475A403-9D9B-410D-8A93-BA49FC4DD811}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{B475A403-9D9B-410D-8A93-BA49FC4DD811}.Debug|x64.Build.0 = Debug|x64
|
||||
{B475A403-9D9B-410D-8A93-BA49FC4DD811}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{B475A403-9D9B-410D-8A93-BA49FC4DD811}.Release|Win32.Build.0 = Release|Win32
|
||||
{B475A403-9D9B-410D-8A93-BA49FC4DD811}.Release|x64.ActiveCfg = Release|x64
|
||||
{B475A403-9D9B-410D-8A93-BA49FC4DD811}.Release|x64.Build.0 = Release|x64
|
||||
{BB382242-6EBB-445F-989C-B9BA61D17965}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{BB382242-6EBB-445F-989C-B9BA61D17965}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{BB382242-6EBB-445F-989C-B9BA61D17965}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{BB382242-6EBB-445F-989C-B9BA61D17965}.Debug|x64.Build.0 = Debug|x64
|
||||
{BB382242-6EBB-445F-989C-B9BA61D17965}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{BB382242-6EBB-445F-989C-B9BA61D17965}.Release|Win32.Build.0 = Release|Win32
|
||||
{BB382242-6EBB-445F-989C-B9BA61D17965}.Release|x64.ActiveCfg = Release|x64
|
||||
{BB382242-6EBB-445F-989C-B9BA61D17965}.Release|x64.Build.0 = Release|x64
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
|
@ -1,372 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{B475A403-9D9B-410D-8A93-BA49FC4DD811}</ProjectGuid>
|
||||
<RootNamespace>glsl_optimizer_lib</RootNamespace>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<WholeProgramOptimization>false</WholeProgramOptimization>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<WholeProgramOptimization>false</WholeProgramOptimization>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup>
|
||||
<_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">build/$(ProjectName)\$(Configuration)\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">build/$(ProjectName)\$(Configuration)\</IntDir>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">build/$(ProjectName)/$(Platform)/$(Configuration)\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">build/$(ProjectName)/$(Platform)/$(Configuration)\</IntDir>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">build/$(Platform)\$(Configuration)\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">build/$(Platform)\$(Configuration)\</IntDir>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">build/$(ProjectName)/$(Platform)/$(Configuration)\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">build/$(ProjectName)/$(Platform)/$(Configuration)\</IntDir>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>../../src/mesa;../../src;../../include/c99;../../include;../../src/glsl;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_LIB;NOMINMAX;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;__STDC_VERSION__=199901L;__STDC__;strdup=_strdup;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MinimalRebuild>false</MinimalRebuild>
|
||||
<ExceptionHandling>
|
||||
</ExceptionHandling>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
<RuntimeTypeInfo>false</RuntimeTypeInfo>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
|
||||
<DisableSpecificWarnings>4996;%(DisableSpecificWarnings)</DisableSpecificWarnings>
|
||||
<ForcedIncludeFiles>%(ForcedIncludeFiles)</ForcedIncludeFiles>
|
||||
</ClCompile>
|
||||
<Lib>
|
||||
<OutputFile>$(OutDir)$(ProjectName)-win32.lib</OutputFile>
|
||||
</Lib>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<Midl>
|
||||
<TargetEnvironment>X64</TargetEnvironment>
|
||||
</Midl>
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>../../src/mesa;../../src;../../include/c99;../../include;../../src/glsl;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_LIB;NOMINMAX;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;__STDC_VERSION__=199901L;__STDC__;strdup=_strdup;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MinimalRebuild>false</MinimalRebuild>
|
||||
<ExceptionHandling>
|
||||
</ExceptionHandling>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
<RuntimeTypeInfo>false</RuntimeTypeInfo>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
<DisableSpecificWarnings>4996;%(DisableSpecificWarnings)</DisableSpecificWarnings>
|
||||
<ForcedIncludeFiles>%(ForcedIncludeFiles)</ForcedIncludeFiles>
|
||||
</ClCompile>
|
||||
<Lib>
|
||||
<OutputFile>$(OutDir)$(ProjectName)-x64.lib</OutputFile>
|
||||
</Lib>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<AdditionalIncludeDirectories>../../src/mesa;../../src;../../include/c99;../../include;../../src/glsl;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_LIB;NOMINMAX;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;__STDC_VERSION__=199901L;__STDC__;strdup=_strdup;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ExceptionHandling>
|
||||
</ExceptionHandling>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<RuntimeTypeInfo>false</RuntimeTypeInfo>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>OldStyle</DebugInformationFormat>
|
||||
<DisableSpecificWarnings>4996;%(DisableSpecificWarnings)</DisableSpecificWarnings>
|
||||
<ForcedIncludeFiles>%(ForcedIncludeFiles)</ForcedIncludeFiles>
|
||||
</ClCompile>
|
||||
<Lib>
|
||||
<OutputFile>$(OutDir)$(ProjectName)-win32.lib</OutputFile>
|
||||
</Lib>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<Midl>
|
||||
<TargetEnvironment>X64</TargetEnvironment>
|
||||
</Midl>
|
||||
<ClCompile>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<AdditionalIncludeDirectories>../../src/mesa;../../src;../../include/c99;../../include;../../src/glsl;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_LIB;NOMINMAX;_CRT_SECURE_NO_WARNINGS;_CRT_SECURE_NO_DEPRECATE;__STDC_VERSION__=199901L;__STDC__;strdup=_strdup;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ExceptionHandling>
|
||||
</ExceptionHandling>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<RuntimeTypeInfo>false</RuntimeTypeInfo>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>OldStyle</DebugInformationFormat>
|
||||
<DisableSpecificWarnings>4996;%(DisableSpecificWarnings)</DisableSpecificWarnings>
|
||||
<ForcedIncludeFiles>%(ForcedIncludeFiles)</ForcedIncludeFiles>
|
||||
</ClCompile>
|
||||
<Lib>
|
||||
<OutputFile>$(OutDir)$(ProjectName)-x64.lib</OutputFile>
|
||||
</Lib>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\..\src\glsl\ast.h" />
|
||||
<ClInclude Include="..\..\src\glsl\builtin_type_macros.h" />
|
||||
<ClInclude Include="..\..\src\glsl\glsl_optimizer.h" />
|
||||
<ClInclude Include="..\..\src\glsl\glsl_parser.h" />
|
||||
<ClInclude Include="..\..\src\glsl\glsl_parser_extras.h" />
|
||||
<ClInclude Include="..\..\src\glsl\glsl_symbol_table.h" />
|
||||
<ClInclude Include="..\..\src\glsl\glsl_types.h" />
|
||||
<ClInclude Include="..\..\src\glsl\ir.h" />
|
||||
<ClInclude Include="..\..\src\glsl\ir_basic_block.h" />
|
||||
<ClInclude Include="..\..\src\glsl\ir_builder.h" />
|
||||
<ClInclude Include="..\..\src\glsl\ir_expression_flattening.h" />
|
||||
<ClInclude Include="..\..\src\glsl\ir_function_inlining.h" />
|
||||
<ClInclude Include="..\..\src\glsl\ir_hierarchical_visitor.h" />
|
||||
<ClInclude Include="..\..\src\glsl\ir_optimization.h" />
|
||||
<ClInclude Include="..\..\src\glsl\ir_print_glsl_visitor.h" />
|
||||
<ClInclude Include="..\..\src\glsl\ir_print_metal_visitor.h" />
|
||||
<ClInclude Include="..\..\src\glsl\ir_print_visitor.h" />
|
||||
<ClInclude Include="..\..\src\glsl\ir_rvalue_visitor.h" />
|
||||
<ClInclude Include="..\..\src\glsl\ir_stats.h" />
|
||||
<ClInclude Include="..\..\src\glsl\ir_uniform.h" />
|
||||
<ClInclude Include="..\..\src\glsl\ir_unused_structs.h" />
|
||||
<ClInclude Include="..\..\src\glsl\ir_variable_refcount.h" />
|
||||
<ClInclude Include="..\..\src\glsl\ir_visitor.h" />
|
||||
<ClInclude Include="..\..\src\glsl\linker.h" />
|
||||
<ClInclude Include="..\..\src\glsl\link_uniform_block_active_visitor.h" />
|
||||
<ClInclude Include="..\..\src\glsl\link_varyings.h" />
|
||||
<ClInclude Include="..\..\src\glsl\list.h" />
|
||||
<ClInclude Include="..\..\src\glsl\loop_analysis.h" />
|
||||
<ClInclude Include="..\..\src\glsl\program.h" />
|
||||
<ClInclude Include="..\..\src\glsl\s_expression.h" />
|
||||
<ClInclude Include="..\..\src\glsl\standalone_scaffolding.h" />
|
||||
<ClInclude Include="..\..\src\glsl\strtod.h" />
|
||||
<ClInclude Include="..\..\src\glsl\glcpp\glcpp-parse.h" />
|
||||
<ClInclude Include="..\..\src\glsl\glcpp\glcpp.h" />
|
||||
<ClInclude Include="..\..\src\mesa\program\hash_table.h" />
|
||||
<ClInclude Include="..\..\src\mesa\program\prog_instruction.h" />
|
||||
<ClInclude Include="..\..\src\mesa\program\prog_parameter.h" />
|
||||
<ClInclude Include="..\..\src\mesa\program\prog_statevars.h" />
|
||||
<ClInclude Include="..\..\src\mesa\program\symbol_table.h" />
|
||||
<ClInclude Include="..\..\src\mesa\main\compiler.h" />
|
||||
<ClInclude Include="..\..\src\mesa\main\config.h" />
|
||||
<ClInclude Include="..\..\src\mesa\main\context.h" />
|
||||
<ClInclude Include="..\..\src\mesa\main\core.h" />
|
||||
<ClInclude Include="..\..\src\mesa\main\dd.h" />
|
||||
<ClInclude Include="..\..\src\mesa\main\glheader.h" />
|
||||
<ClInclude Include="..\..\src\mesa\main\glminimal.h" />
|
||||
<ClInclude Include="..\..\src\mesa\main\imports.h" />
|
||||
<ClInclude Include="..\..\src\mesa\main\macros.h" />
|
||||
<ClInclude Include="..\..\src\mesa\main\mtypes.h" />
|
||||
<ClInclude Include="..\..\src\mesa\main\simple_list.h" />
|
||||
<ClInclude Include="..\..\src\util\hash_table.h" />
|
||||
<ClInclude Include="..\..\src\util\ralloc.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\..\src\glsl\ast_array_index.cpp" />
|
||||
<ClCompile Include="..\..\src\glsl\ast_expr.cpp" />
|
||||
<ClCompile Include="..\..\src\glsl\ast_function.cpp" />
|
||||
<ClCompile Include="..\..\src\glsl\ast_to_hir.cpp" />
|
||||
<ClCompile Include="..\..\src\glsl\ast_type.cpp" />
|
||||
<ClCompile Include="..\..\src\glsl\builtin_functions.cpp" />
|
||||
<ClCompile Include="..\..\src\glsl\builtin_types.cpp" />
|
||||
<ClCompile Include="..\..\src\glsl\builtin_variables.cpp" />
|
||||
<ClCompile Include="..\..\src\glsl\glsl_lexer.cpp" />
|
||||
<ClCompile Include="..\..\src\glsl\glsl_optimizer.cpp" />
|
||||
<ClCompile Include="..\..\src\glsl\glsl_parser.cpp" />
|
||||
<ClCompile Include="..\..\src\glsl\glsl_parser_extras.cpp" />
|
||||
<ClCompile Include="..\..\src\glsl\glsl_symbol_table.cpp" />
|
||||
<ClCompile Include="..\..\src\glsl\glsl_types.cpp" />
|
||||
<ClCompile Include="..\..\src\glsl\hir_field_selection.cpp" />
|
||||
<ClCompile Include="..\..\src\glsl\ir.cpp" />
|
||||
<ClCompile Include="..\..\src\glsl\ir_basic_block.cpp" />
|
||||
<ClCompile Include="..\..\src\glsl\ir_builder.cpp" />
|
||||
<ClCompile Include="..\..\src\glsl\ir_clone.cpp" />
|
||||
<ClCompile Include="..\..\src\glsl\ir_constant_expression.cpp" />
|
||||
<ClCompile Include="..\..\src\glsl\ir_equals.cpp" />
|
||||
<ClCompile Include="..\..\src\glsl\ir_expression_flattening.cpp" />
|
||||
<ClCompile Include="..\..\src\glsl\ir_function.cpp" />
|
||||
<ClCompile Include="..\..\src\glsl\ir_function_can_inline.cpp" />
|
||||
<ClCompile Include="..\..\src\glsl\ir_function_detect_recursion.cpp" />
|
||||
<ClCompile Include="..\..\src\glsl\ir_hierarchical_visitor.cpp" />
|
||||
<ClCompile Include="..\..\src\glsl\ir_hv_accept.cpp" />
|
||||
<ClCompile Include="..\..\src\glsl\ir_import_prototypes.cpp" />
|
||||
<ClCompile Include="..\..\src\glsl\ir_print_glsl_visitor.cpp" />
|
||||
<ClCompile Include="..\..\src\glsl\ir_print_metal_visitor.cpp" />
|
||||
<ClCompile Include="..\..\src\glsl\ir_print_visitor.cpp" />
|
||||
<ClCompile Include="..\..\src\glsl\ir_rvalue_visitor.cpp" />
|
||||
<ClCompile Include="..\..\src\glsl\ir_stats.cpp" />
|
||||
<ClCompile Include="..\..\src\glsl\ir_unused_structs.cpp" />
|
||||
<ClCompile Include="..\..\src\glsl\ir_validate.cpp" />
|
||||
<ClCompile Include="..\..\src\glsl\ir_variable_refcount.cpp" />
|
||||
<ClCompile Include="..\..\src\glsl\link_atomics.cpp" />
|
||||
<ClCompile Include="..\..\src\glsl\link_functions.cpp" />
|
||||
<ClCompile Include="..\..\src\glsl\link_interface_blocks.cpp" />
|
||||
<ClCompile Include="..\..\src\glsl\link_uniform_blocks.cpp" />
|
||||
<ClCompile Include="..\..\src\glsl\link_uniform_block_active_visitor.cpp" />
|
||||
<ClCompile Include="..\..\src\glsl\link_uniform_initializers.cpp" />
|
||||
<ClCompile Include="..\..\src\glsl\link_uniforms.cpp" />
|
||||
<ClCompile Include="..\..\src\glsl\linker.cpp" />
|
||||
<ClCompile Include="..\..\src\glsl\link_varyings.cpp" />
|
||||
<ClCompile Include="..\..\src\glsl\loop_analysis.cpp" />
|
||||
<ClCompile Include="..\..\src\glsl\loop_controls.cpp" />
|
||||
<ClCompile Include="..\..\src\glsl\loop_unroll.cpp" />
|
||||
<ClCompile Include="..\..\src\glsl\lower_clip_distance.cpp" />
|
||||
<ClCompile Include="..\..\src\glsl\lower_discard.cpp" />
|
||||
<ClCompile Include="..\..\src\glsl\lower_discard_flow.cpp" />
|
||||
<ClCompile Include="..\..\src\glsl\lower_if_to_cond_assign.cpp" />
|
||||
<ClCompile Include="..\..\src\glsl\lower_instructions.cpp" />
|
||||
<ClCompile Include="..\..\src\glsl\lower_jumps.cpp" />
|
||||
<ClCompile Include="..\..\src\glsl\lower_mat_op_to_vec.cpp" />
|
||||
<ClCompile Include="..\..\src\glsl\lower_named_interface_blocks.cpp" />
|
||||
<ClCompile Include="..\..\src\glsl\lower_noise.cpp" />
|
||||
<ClCompile Include="..\..\src\glsl\lower_offset_array.cpp" />
|
||||
<ClCompile Include="..\..\src\glsl\lower_output_reads.cpp" />
|
||||
<ClCompile Include="..\..\src\glsl\lower_packed_varyings.cpp" />
|
||||
<ClCompile Include="..\..\src\glsl\lower_packing_builtins.cpp" />
|
||||
<ClCompile Include="..\..\src\glsl\lower_ubo_reference.cpp" />
|
||||
<ClCompile Include="..\..\src\glsl\lower_variable_index_to_cond_assign.cpp" />
|
||||
<ClCompile Include="..\..\src\glsl\lower_vector_insert.cpp" />
|
||||
<ClCompile Include="..\..\src\glsl\lower_vec_index_to_cond_assign.cpp" />
|
||||
<ClCompile Include="..\..\src\glsl\lower_vec_index_to_swizzle.cpp" />
|
||||
<ClCompile Include="..\..\src\glsl\lower_vector.cpp" />
|
||||
<ClCompile Include="..\..\src\glsl\lower_vertex_id.cpp" />
|
||||
<ClCompile Include="..\..\src\glsl\main.cpp">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\glsl\opt_algebraic.cpp" />
|
||||
<ClCompile Include="..\..\src\glsl\opt_array_splitting.cpp" />
|
||||
<ClCompile Include="..\..\src\glsl\opt_constant_folding.cpp" />
|
||||
<ClCompile Include="..\..\src\glsl\opt_constant_propagation.cpp" />
|
||||
<ClCompile Include="..\..\src\glsl\opt_constant_variable.cpp" />
|
||||
<ClCompile Include="..\..\src\glsl\opt_copy_propagation.cpp" />
|
||||
<ClCompile Include="..\..\src\glsl\opt_copy_propagation_elements.cpp" />
|
||||
<ClCompile Include="..\..\src\glsl\opt_cse.cpp" />
|
||||
<ClCompile Include="..\..\src\glsl\opt_dead_builtin_variables.cpp" />
|
||||
<ClCompile Include="..\..\src\glsl\opt_dead_builtin_varyings.cpp" />
|
||||
<ClCompile Include="..\..\src\glsl\opt_dead_code.cpp" />
|
||||
<ClCompile Include="..\..\src\glsl\opt_dead_code_local.cpp" />
|
||||
<ClCompile Include="..\..\src\glsl\opt_dead_functions.cpp" />
|
||||
<ClCompile Include="..\..\src\glsl\opt_flatten_nested_if_blocks.cpp" />
|
||||
<ClCompile Include="..\..\src\glsl\opt_flip_matrices.cpp" />
|
||||
<ClCompile Include="..\..\src\glsl\opt_function_inlining.cpp" />
|
||||
<ClCompile Include="..\..\src\glsl\opt_if_simplification.cpp" />
|
||||
<ClCompile Include="..\..\src\glsl\opt_minmax.cpp" />
|
||||
<ClCompile Include="..\..\src\glsl\opt_noop_swizzle.cpp" />
|
||||
<ClCompile Include="..\..\src\glsl\opt_rebalance_tree.cpp" />
|
||||
<ClCompile Include="..\..\src\glsl\opt_redundant_jumps.cpp" />
|
||||
<ClCompile Include="..\..\src\glsl\opt_structure_splitting.cpp" />
|
||||
<ClCompile Include="..\..\src\glsl\opt_swizzle_swizzle.cpp" />
|
||||
<ClCompile Include="..\..\src\glsl\opt_tree_grafting.cpp" />
|
||||
<ClCompile Include="..\..\src\glsl\opt_vectorize.cpp" />
|
||||
<ClCompile Include="..\..\src\glsl\s_expression.cpp" />
|
||||
<ClCompile Include="..\..\src\glsl\standalone_scaffolding.cpp" />
|
||||
<ClCompile Include="..\..\src\glsl\strtod.c" />
|
||||
<ClCompile Include="..\..\src\glsl\glcpp\glcpp-lex.c" />
|
||||
<ClCompile Include="..\..\src\glsl\glcpp\glcpp-parse.c" />
|
||||
<ClCompile Include="..\..\src\glsl\glcpp\glcpp.c">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\glsl\glcpp\pp.c" />
|
||||
<ClCompile Include="..\..\src\mesa\main\imports.c" />
|
||||
<ClCompile Include="..\..\src\mesa\program\prog_hash_table.c" />
|
||||
<ClCompile Include="..\..\src\mesa\program\symbol_table.c" />
|
||||
<ClCompile Include="..\..\src\util\hash_table.c" />
|
||||
<ClCompile Include="..\..\src\util\ralloc.c" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<CustomBuildStep Include="..\..\src\glsl\glsl_lexer.lpp">
|
||||
<FileType>Document</FileType>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
||||
</CustomBuildStep>
|
||||
<CustomBuildStep Include="..\..\src\glsl\glsl_parser.ypp">
|
||||
<FileType>Document</FileType>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
||||
</CustomBuildStep>
|
||||
<CustomBuildStep Include="..\..\src\glsl\glcpp\glcpp-lex.l">
|
||||
<FileType>Document</FileType>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
||||
</CustomBuildStep>
|
||||
<CustomBuildStep Include="..\..\src\glsl\glcpp\glcpp-parse.y">
|
||||
<FileType>Document</FileType>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
||||
</CustomBuildStep>
|
||||
<None Include="..\..\README.md" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
|
@ -1,518 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="src">
|
||||
<UniqueIdentifier>{95543dab-5f63-41a8-8860-7e1659edc0b2}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="src\glsl">
|
||||
<UniqueIdentifier>{c4cf23cb-22b9-4496-9cf7-8b25dc1e405f}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="src\glsl\glcpp">
|
||||
<UniqueIdentifier>{7ec0058a-15c6-427d-9fce-27af39000e81}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="src\mesa">
|
||||
<UniqueIdentifier>{28f43e08-dfe8-424d-886c-db6e2ee33957}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="src\mesa\program">
|
||||
<UniqueIdentifier>{fd238409-ea7e-4bbe-8566-d5b8e7330242}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="src\mesa\main">
|
||||
<UniqueIdentifier>{b58605f3-8f5a-4800-838c-a0a04d1bdc96}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\..\src\glsl\ast.h">
|
||||
<Filter>src\glsl</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\glsl\glsl_optimizer.h">
|
||||
<Filter>src\glsl</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\glsl\glsl_parser.h">
|
||||
<Filter>src\glsl</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\glsl\glsl_parser_extras.h">
|
||||
<Filter>src\glsl</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\glsl\glsl_symbol_table.h">
|
||||
<Filter>src\glsl</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\glsl\glsl_types.h">
|
||||
<Filter>src\glsl</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\glsl\ir.h">
|
||||
<Filter>src\glsl</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\glsl\ir_basic_block.h">
|
||||
<Filter>src\glsl</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\glsl\ir_expression_flattening.h">
|
||||
<Filter>src\glsl</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\glsl\ir_function_inlining.h">
|
||||
<Filter>src\glsl</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\glsl\ir_hierarchical_visitor.h">
|
||||
<Filter>src\glsl</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\glsl\ir_optimization.h">
|
||||
<Filter>src\glsl</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\glsl\ir_print_glsl_visitor.h">
|
||||
<Filter>src\glsl</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\glsl\ir_print_metal_visitor.h">
|
||||
<Filter>src\glsl</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\glsl\ir_print_visitor.h">
|
||||
<Filter>src\glsl</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\glsl\ir_rvalue_visitor.h">
|
||||
<Filter>src\glsl</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\glsl\ir_unused_structs.h">
|
||||
<Filter>src\glsl</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\glsl\ir_variable_refcount.h">
|
||||
<Filter>src\glsl</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\glsl\ir_visitor.h">
|
||||
<Filter>src\glsl</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\glsl\linker.h">
|
||||
<Filter>src\glsl</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\glsl\list.h">
|
||||
<Filter>src\glsl</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\glsl\loop_analysis.h">
|
||||
<Filter>src\glsl</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\glsl\program.h">
|
||||
<Filter>src\glsl</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\glsl\s_expression.h">
|
||||
<Filter>src\glsl</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\glsl\standalone_scaffolding.h">
|
||||
<Filter>src\glsl</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\glsl\strtod.h">
|
||||
<Filter>src\glsl</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\glsl\glcpp\glcpp-parse.h">
|
||||
<Filter>src\glsl\glcpp</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\glsl\glcpp\glcpp.h">
|
||||
<Filter>src\glsl\glcpp</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\mesa\program\prog_instruction.h">
|
||||
<Filter>src\mesa\program</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\mesa\program\prog_parameter.h">
|
||||
<Filter>src\mesa\program</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\mesa\program\prog_statevars.h">
|
||||
<Filter>src\mesa\program</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\mesa\program\symbol_table.h">
|
||||
<Filter>src\mesa\program</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\mesa\main\compiler.h">
|
||||
<Filter>src\mesa\main</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\mesa\main\config.h">
|
||||
<Filter>src\mesa\main</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\mesa\main\context.h">
|
||||
<Filter>src\mesa\main</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\mesa\main\core.h">
|
||||
<Filter>src\mesa\main</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\mesa\main\dd.h">
|
||||
<Filter>src\mesa\main</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\mesa\main\glheader.h">
|
||||
<Filter>src\mesa\main</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\mesa\main\glminimal.h">
|
||||
<Filter>src\mesa\main</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\mesa\main\imports.h">
|
||||
<Filter>src\mesa\main</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\mesa\main\macros.h">
|
||||
<Filter>src\mesa\main</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\mesa\main\mtypes.h">
|
||||
<Filter>src\mesa\main</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\mesa\main\simple_list.h">
|
||||
<Filter>src\mesa\main</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\glsl\ir_uniform.h">
|
||||
<Filter>src\glsl</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\mesa\program\hash_table.h">
|
||||
<Filter>src\mesa\program</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\glsl\link_uniform_block_active_visitor.h">
|
||||
<Filter>src\glsl</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\glsl\link_varyings.h">
|
||||
<Filter>src\glsl</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\glsl\ir_builder.h">
|
||||
<Filter>src\glsl</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\glsl\builtin_type_macros.h">
|
||||
<Filter>src\glsl</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\glsl\ir_stats.h">
|
||||
<Filter>src\glsl</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\util\hash_table.h">
|
||||
<Filter>src\util</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\src\util\ralloc.h">
|
||||
<Filter>src\util</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\..\src\glsl\ast_expr.cpp">
|
||||
<Filter>src\glsl</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\glsl\ast_function.cpp">
|
||||
<Filter>src\glsl</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\glsl\ast_to_hir.cpp">
|
||||
<Filter>src\glsl</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\glsl\ast_type.cpp">
|
||||
<Filter>src\glsl</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\glsl\builtin_functions.cpp">
|
||||
<Filter>src\glsl</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\glsl\builtin_variables.cpp">
|
||||
<Filter>src\glsl</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\glsl\glsl_lexer.cpp">
|
||||
<Filter>src\glsl</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\glsl\glsl_optimizer.cpp">
|
||||
<Filter>src\glsl</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\glsl\glsl_parser.cpp">
|
||||
<Filter>src\glsl</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\glsl\glsl_parser_extras.cpp">
|
||||
<Filter>src\glsl</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\glsl\glsl_symbol_table.cpp">
|
||||
<Filter>src\glsl</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\glsl\glsl_types.cpp">
|
||||
<Filter>src\glsl</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\glsl\hir_field_selection.cpp">
|
||||
<Filter>src\glsl</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\glsl\ir.cpp">
|
||||
<Filter>src\glsl</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\glsl\ir_basic_block.cpp">
|
||||
<Filter>src\glsl</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\glsl\ir_clone.cpp">
|
||||
<Filter>src\glsl</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\glsl\ir_constant_expression.cpp">
|
||||
<Filter>src\glsl</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\glsl\ir_equals.cpp">
|
||||
<Filter>src\glsl</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\glsl\ir_expression_flattening.cpp">
|
||||
<Filter>src\glsl</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\glsl\ir_function.cpp">
|
||||
<Filter>src\glsl</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\glsl\ir_function_can_inline.cpp">
|
||||
<Filter>src\glsl</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\glsl\ir_function_detect_recursion.cpp">
|
||||
<Filter>src\glsl</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\glsl\ir_hierarchical_visitor.cpp">
|
||||
<Filter>src\glsl</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\glsl\ir_hv_accept.cpp">
|
||||
<Filter>src\glsl</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\glsl\ir_import_prototypes.cpp">
|
||||
<Filter>src\glsl</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\glsl\ir_print_glsl_visitor.cpp">
|
||||
<Filter>src\glsl</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\glsl\ir_print_metal_visitor.cpp">
|
||||
<Filter>src\glsl</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\glsl\ir_print_visitor.cpp">
|
||||
<Filter>src\glsl</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\glsl\ir_rvalue_visitor.cpp">
|
||||
<Filter>src\glsl</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\glsl\ir_unused_structs.cpp">
|
||||
<Filter>src\glsl</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\glsl\ir_validate.cpp">
|
||||
<Filter>src\glsl</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\glsl\ir_variable_refcount.cpp">
|
||||
<Filter>src\glsl</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\glsl\link_atomics.cpp">
|
||||
<Filter>src\glsl</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\glsl\link_functions.cpp">
|
||||
<Filter>src\glsl</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\glsl\link_uniform_initializers.cpp">
|
||||
<Filter>src\glsl</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\glsl\link_uniforms.cpp">
|
||||
<Filter>src\glsl</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\glsl\linker.cpp">
|
||||
<Filter>src\glsl</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\glsl\loop_analysis.cpp">
|
||||
<Filter>src\glsl</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\glsl\loop_controls.cpp">
|
||||
<Filter>src\glsl</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\glsl\loop_unroll.cpp">
|
||||
<Filter>src\glsl</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\glsl\lower_clip_distance.cpp">
|
||||
<Filter>src\glsl</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\glsl\lower_discard.cpp">
|
||||
<Filter>src\glsl</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\glsl\lower_discard_flow.cpp">
|
||||
<Filter>src\glsl</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\glsl\lower_if_to_cond_assign.cpp">
|
||||
<Filter>src\glsl</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\glsl\lower_instructions.cpp">
|
||||
<Filter>src\glsl</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\glsl\lower_jumps.cpp">
|
||||
<Filter>src\glsl</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\glsl\lower_mat_op_to_vec.cpp">
|
||||
<Filter>src\glsl</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\glsl\lower_noise.cpp">
|
||||
<Filter>src\glsl</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\glsl\lower_variable_index_to_cond_assign.cpp">
|
||||
<Filter>src\glsl</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\glsl\lower_vec_index_to_cond_assign.cpp">
|
||||
<Filter>src\glsl</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\glsl\lower_vec_index_to_swizzle.cpp">
|
||||
<Filter>src\glsl</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\glsl\lower_vector.cpp">
|
||||
<Filter>src\glsl</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\glsl\main.cpp">
|
||||
<Filter>src\glsl</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\glsl\opt_algebraic.cpp">
|
||||
<Filter>src\glsl</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\glsl\opt_array_splitting.cpp">
|
||||
<Filter>src\glsl</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\glsl\opt_constant_folding.cpp">
|
||||
<Filter>src\glsl</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\glsl\opt_constant_propagation.cpp">
|
||||
<Filter>src\glsl</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\glsl\opt_constant_variable.cpp">
|
||||
<Filter>src\glsl</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\glsl\opt_copy_propagation.cpp">
|
||||
<Filter>src\glsl</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\glsl\opt_copy_propagation_elements.cpp">
|
||||
<Filter>src\glsl</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\glsl\opt_cse.cpp">
|
||||
<Filter>src\glsl</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\glsl\opt_dead_code.cpp">
|
||||
<Filter>src\glsl</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\glsl\opt_dead_code_local.cpp">
|
||||
<Filter>src\glsl</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\glsl\opt_dead_functions.cpp">
|
||||
<Filter>src\glsl</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\glsl\opt_function_inlining.cpp">
|
||||
<Filter>src\glsl</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\glsl\opt_if_simplification.cpp">
|
||||
<Filter>src\glsl</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\glsl\opt_noop_swizzle.cpp">
|
||||
<Filter>src\glsl</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\glsl\opt_redundant_jumps.cpp">
|
||||
<Filter>src\glsl</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\glsl\opt_structure_splitting.cpp">
|
||||
<Filter>src\glsl</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\glsl\opt_swizzle_swizzle.cpp">
|
||||
<Filter>src\glsl</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\glsl\opt_tree_grafting.cpp">
|
||||
<Filter>src\glsl</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\glsl\opt_vectorize.cpp">
|
||||
<Filter>src\glsl</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\glsl\s_expression.cpp">
|
||||
<Filter>src\glsl</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\glsl\standalone_scaffolding.cpp">
|
||||
<Filter>src\glsl</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\glsl\strtod.c">
|
||||
<Filter>src\glsl</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\glsl\glcpp\glcpp-lex.c">
|
||||
<Filter>src\glsl\glcpp</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\glsl\glcpp\glcpp-parse.c">
|
||||
<Filter>src\glsl\glcpp</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\glsl\glcpp\glcpp.c">
|
||||
<Filter>src\glsl\glcpp</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\glsl\glcpp\pp.c">
|
||||
<Filter>src\glsl\glcpp</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\mesa\program\symbol_table.c">
|
||||
<Filter>src\mesa\program</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\mesa\main\imports.c">
|
||||
<Filter>src\mesa\main</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\mesa\program\prog_hash_table.c">
|
||||
<Filter>src\mesa\program</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\glsl\ast_array_index.cpp">
|
||||
<Filter>src\glsl</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\glsl\link_uniform_block_active_visitor.cpp">
|
||||
<Filter>src\glsl</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\glsl\link_uniform_blocks.cpp">
|
||||
<Filter>src\glsl</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\glsl\link_varyings.cpp">
|
||||
<Filter>src\glsl</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\glsl\opt_flatten_nested_if_blocks.cpp">
|
||||
<Filter>src\glsl</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\glsl\ir_builder.cpp">
|
||||
<Filter>src\glsl</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\glsl\lower_packed_varyings.cpp">
|
||||
<Filter>src\glsl</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\glsl\lower_packing_builtins.cpp">
|
||||
<Filter>src\glsl</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\glsl\link_interface_blocks.cpp">
|
||||
<Filter>src\glsl</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\glsl\lower_named_interface_blocks.cpp">
|
||||
<Filter>src\glsl</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\glsl\lower_offset_array.cpp">
|
||||
<Filter>src\glsl</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\glsl\lower_output_reads.cpp">
|
||||
<Filter>src\glsl</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\glsl\lower_ubo_reference.cpp">
|
||||
<Filter>src\glsl</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\glsl\lower_vector_insert.cpp">
|
||||
<Filter>src\glsl</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\glsl\lower_vertex_id.cpp">
|
||||
<Filter>src\glsl</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\glsl\builtin_types.cpp">
|
||||
<Filter>src\glsl</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\glsl\opt_dead_builtin_variables.cpp">
|
||||
<Filter>src\glsl</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\glsl\opt_minmax.cpp">
|
||||
<Filter>src\glsl</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\glsl\opt_rebalance_tree.cpp">
|
||||
<Filter>src\glsl</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\glsl\opt_dead_builtin_varyings.cpp">
|
||||
<Filter>src\glsl</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\glsl\opt_flip_matrices.cpp">
|
||||
<Filter>src\glsl</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\glsl\ir_stats.cpp">
|
||||
<Filter>src\glsl</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\util\hash_table.c">
|
||||
<Filter>src\util</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\src\util\ralloc.c">
|
||||
<Filter>src\util</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="..\..\README.md" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<CustomBuildStep Include="..\..\src\glsl\glsl_lexer.lpp">
|
||||
<Filter>src\glsl</Filter>
|
||||
</CustomBuildStep>
|
||||
<CustomBuildStep Include="..\..\src\glsl\glsl_parser.ypp">
|
||||
<Filter>src\glsl</Filter>
|
||||
</CustomBuildStep>
|
||||
<CustomBuildStep Include="..\..\src\glsl\glcpp\glcpp-lex.l">
|
||||
<Filter>src\glsl\glcpp</Filter>
|
||||
</CustomBuildStep>
|
||||
<CustomBuildStep Include="..\..\src\glsl\glcpp\glcpp-parse.y">
|
||||
<Filter>src\glsl\glcpp</Filter>
|
||||
</CustomBuildStep>
|
||||
</ItemGroup>
|
||||
</Project>
|
|
@ -1,186 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{BB382242-6EBB-445F-989C-B9BA61D17965}</ProjectGuid>
|
||||
<RootNamespace>glsl_optimizer_tests</RootNamespace>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<WholeProgramOptimization>false</WholeProgramOptimization>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<WholeProgramOptimization>false</WholeProgramOptimization>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup>
|
||||
<_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">build/$(ProjectName)/$(Configuration)\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">build/$(ProjectName)/$(Configuration)\</IntDir>
|
||||
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental>
|
||||
<GenerateManifest Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">false</GenerateManifest>
|
||||
<EmbedManifest Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">false</EmbedManifest>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">build/$(ProjectName)/$(Platform)/$(Configuration)\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">build/$(ProjectName)/$(Platform)/$(Configuration)\</IntDir>
|
||||
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</LinkIncremental>
|
||||
<GenerateManifest Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</GenerateManifest>
|
||||
<EmbedManifest Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</EmbedManifest>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">build/$(ProjectName)/$(Configuration)\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">build/$(ProjectName)/$(Configuration)\</IntDir>
|
||||
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
|
||||
<GenerateManifest Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</GenerateManifest>
|
||||
<EmbedManifest Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</EmbedManifest>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">build/$(ProjectName)/$(Platform)/$(Configuration)\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">build/$(ProjectName)/$(Platform)/$(Configuration)\</IntDir>
|
||||
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</LinkIncremental>
|
||||
<GenerateManifest Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</GenerateManifest>
|
||||
<EmbedManifest Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</EmbedManifest>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MinimalRebuild>false</MinimalRebuild>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>opengl32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<TargetMachine>MachineX86</TargetMachine>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<Midl>
|
||||
<TargetEnvironment>X64</TargetEnvironment>
|
||||
</Midl>
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MinimalRebuild>false</MinimalRebuild>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>opengl32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<TargetMachine>MachineX64</TargetMachine>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>opengl32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<TargetMachine>MachineX86</TargetMachine>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<Midl>
|
||||
<TargetEnvironment>X64</TargetEnvironment>
|
||||
</Midl>
|
||||
<ClCompile>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<AdditionalIncludeDirectories>%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>opengl32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<TargetMachine>MachineX64</TargetMachine>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="glsl_optimizer_lib.vcxproj">
|
||||
<Project>{b475a403-9d9b-410d-8a93-ba49fc4dd811}</Project>
|
||||
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\..\tests\glsl_optimizer_tests.cpp" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
|
@ -1,882 +0,0 @@
|
|||
// !$*UTF8*$!
|
||||
{
|
||||
archiveVersion = 1;
|
||||
classes = {
|
||||
};
|
||||
objectVersion = 46;
|
||||
objects = {
|
||||
|
||||
/* Begin PBXBuildFile section */
|
||||
2B38545F1293BE5000F3E692 /* lower_if_to_cond_assign.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2B3854481293BE5000F3E692 /* lower_if_to_cond_assign.cpp */; };
|
||||
2B3854601293BE5000F3E692 /* lower_jumps.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2B3854491293BE5000F3E692 /* lower_jumps.cpp */; };
|
||||
2B3854611293BE5000F3E692 /* lower_mat_op_to_vec.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2B38544A1293BE5000F3E692 /* lower_mat_op_to_vec.cpp */; };
|
||||
2B3854641293BE5000F3E692 /* lower_vec_index_to_cond_assign.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2B38544D1293BE5000F3E692 /* lower_vec_index_to_cond_assign.cpp */; };
|
||||
2B3854651293BE5000F3E692 /* lower_vec_index_to_swizzle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2B38544E1293BE5000F3E692 /* lower_vec_index_to_swizzle.cpp */; };
|
||||
2B3854661293BE5000F3E692 /* opt_algebraic.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2B38544F1293BE5000F3E692 /* opt_algebraic.cpp */; };
|
||||
2B3854671293BE5000F3E692 /* opt_constant_folding.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2B3854501293BE5000F3E692 /* opt_constant_folding.cpp */; };
|
||||
2B3854681293BE5000F3E692 /* opt_constant_propagation.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2B3854511293BE5000F3E692 /* opt_constant_propagation.cpp */; };
|
||||
2B3854691293BE5000F3E692 /* opt_constant_variable.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2B3854521293BE5000F3E692 /* opt_constant_variable.cpp */; };
|
||||
2B38546A1293BE5000F3E692 /* opt_copy_propagation.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2B3854531293BE5000F3E692 /* opt_copy_propagation.cpp */; };
|
||||
2B38546B1293BE5000F3E692 /* opt_dead_code_local.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2B3854541293BE5000F3E692 /* opt_dead_code_local.cpp */; };
|
||||
2B38546C1293BE5000F3E692 /* opt_dead_code.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2B3854551293BE5000F3E692 /* opt_dead_code.cpp */; };
|
||||
2B38546D1293BE5000F3E692 /* opt_dead_functions.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2B3854561293BE5000F3E692 /* opt_dead_functions.cpp */; };
|
||||
2B38546E1293BE5000F3E692 /* opt_function_inlining.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2B3854571293BE5000F3E692 /* opt_function_inlining.cpp */; };
|
||||
2B38546F1293BE5000F3E692 /* opt_if_simplification.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2B3854581293BE5000F3E692 /* opt_if_simplification.cpp */; };
|
||||
2B3854701293BE5000F3E692 /* opt_noop_swizzle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2B3854591293BE5000F3E692 /* opt_noop_swizzle.cpp */; };
|
||||
2B3854711293BE5000F3E692 /* opt_structure_splitting.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2B38545A1293BE5000F3E692 /* opt_structure_splitting.cpp */; };
|
||||
2B3854721293BE5000F3E692 /* opt_swizzle_swizzle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2B38545B1293BE5000F3E692 /* opt_swizzle_swizzle.cpp */; };
|
||||
2B3854731293BE5000F3E692 /* opt_tree_grafting.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2B38545C1293BE5000F3E692 /* opt_tree_grafting.cpp */; };
|
||||
2B39E41519E959F9001C6A17 /* hash_table.c in Sources */ = {isa = PBXBuildFile; fileRef = 2B39E41019E959F9001C6A17 /* hash_table.c */; };
|
||||
2B39E41619E959F9001C6A17 /* hash_table.h in Headers */ = {isa = PBXBuildFile; fileRef = 2B39E41119E959F9001C6A17 /* hash_table.h */; };
|
||||
2B39E41719E959F9001C6A17 /* macros.h in Headers */ = {isa = PBXBuildFile; fileRef = 2B39E41219E959F9001C6A17 /* macros.h */; };
|
||||
2B39E41819E959F9001C6A17 /* ralloc.c in Sources */ = {isa = PBXBuildFile; fileRef = 2B39E41319E959F9001C6A17 /* ralloc.c */; };
|
||||
2B39E41919E959F9001C6A17 /* ralloc.h in Headers */ = {isa = PBXBuildFile; fileRef = 2B39E41419E959F9001C6A17 /* ralloc.h */; };
|
||||
2B39E41F19E95FA7001C6A17 /* lower_offset_array.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2B39E41A19E95FA7001C6A17 /* lower_offset_array.cpp */; };
|
||||
2B39E42019E95FA7001C6A17 /* lower_vertex_id.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2B39E41B19E95FA7001C6A17 /* lower_vertex_id.cpp */; };
|
||||
2B39E42119E95FA7001C6A17 /* opt_dead_builtin_variables.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2B39E41C19E95FA7001C6A17 /* opt_dead_builtin_variables.cpp */; };
|
||||
2B39E42219E95FA7001C6A17 /* opt_minmax.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2B39E41D19E95FA7001C6A17 /* opt_minmax.cpp */; };
|
||||
2B39E42319E95FA7001C6A17 /* opt_rebalance_tree.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2B39E41E19E95FA7001C6A17 /* opt_rebalance_tree.cpp */; };
|
||||
2B3A6B9015FA043D000DCBE1 /* link_uniforms.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2B3A6B8E15FA043D000DCBE1 /* link_uniforms.cpp */; };
|
||||
2B3A6B9715FA0468000DCBE1 /* link_uniform_initializers.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2B3A6B9515FA0468000DCBE1 /* link_uniform_initializers.cpp */; };
|
||||
2B3A6BA815FA0494000DCBE1 /* lower_clip_distance.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2B3A6B9C15FA0494000DCBE1 /* lower_clip_distance.cpp */; };
|
||||
2B3A6BA915FA0494000DCBE1 /* lower_discard_flow.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2B3A6B9D15FA0494000DCBE1 /* lower_discard_flow.cpp */; };
|
||||
2B3A6BAA15FA0494000DCBE1 /* lower_output_reads.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2B3A6B9E15FA0494000DCBE1 /* lower_output_reads.cpp */; };
|
||||
2B3A6BAC15FA0494000DCBE1 /* lower_ubo_reference.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2B3A6BA015FA0494000DCBE1 /* lower_ubo_reference.cpp */; };
|
||||
2B3A6BAD15FA0494000DCBE1 /* opt_array_splitting.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2B3A6BA115FA0494000DCBE1 /* opt_array_splitting.cpp */; };
|
||||
2B3A6BDA15FA08E1000DCBE1 /* ir_builder.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2B3A6BD715FA08E1000DCBE1 /* ir_builder.cpp */; };
|
||||
2B3A6BDB15FA08E1000DCBE1 /* ir_builder.h in Headers */ = {isa = PBXBuildFile; fileRef = 2B3A6BD815FA08E1000DCBE1 /* ir_builder.h */; };
|
||||
2B47DA011209C87B00937F2C /* prog_hash_table.c in Sources */ = {isa = PBXBuildFile; fileRef = 2B47D9FD1209C87B00937F2C /* prog_hash_table.c */; };
|
||||
2B47DA021209C87B00937F2C /* hash_table.h in Headers */ = {isa = PBXBuildFile; fileRef = 2B47D9FE1209C87B00937F2C /* hash_table.h */; };
|
||||
2B47DA031209C87B00937F2C /* symbol_table.c in Sources */ = {isa = PBXBuildFile; fileRef = 2B47D9FF1209C87B00937F2C /* symbol_table.c */; };
|
||||
2B47DA041209C87B00937F2C /* symbol_table.h in Headers */ = {isa = PBXBuildFile; fileRef = 2B47DA001209C87B00937F2C /* symbol_table.h */; };
|
||||
2B62491112191339003F6EEE /* ir_rvalue_visitor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2B62490D12191339003F6EEE /* ir_rvalue_visitor.cpp */; };
|
||||
2B62491212191339003F6EEE /* ir_rvalue_visitor.h in Headers */ = {isa = PBXBuildFile; fileRef = 2B62490E12191339003F6EEE /* ir_rvalue_visitor.h */; };
|
||||
2B655A7313E0322E00B5278F /* ir_function_detect_recursion.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2B655A7113E0322E00B5278F /* ir_function_detect_recursion.cpp */; };
|
||||
2B655A7913E0324F00B5278F /* standalone_scaffolding.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2B655A7613E0324F00B5278F /* standalone_scaffolding.cpp */; };
|
||||
2B655A7A13E0324F00B5278F /* standalone_scaffolding.h in Headers */ = {isa = PBXBuildFile; fileRef = 2B655A7713E0324F00B5278F /* standalone_scaffolding.h */; };
|
||||
2B6A99F41223B1670059FBED /* glcpp-lex.c in Sources */ = {isa = PBXBuildFile; fileRef = 2B6A99EC1223B1670059FBED /* glcpp-lex.c */; };
|
||||
2B6A99F61223B1670059FBED /* glcpp-parse.c in Sources */ = {isa = PBXBuildFile; fileRef = 2B6A99EE1223B1670059FBED /* glcpp-parse.c */; };
|
||||
2B6A99F71223B1670059FBED /* glcpp-parse.h in Headers */ = {isa = PBXBuildFile; fileRef = 2B6A99EF1223B1670059FBED /* glcpp-parse.h */; };
|
||||
2B6A99FA1223B1670059FBED /* glcpp.h in Headers */ = {isa = PBXBuildFile; fileRef = 2B6A99F21223B1670059FBED /* glcpp.h */; };
|
||||
2B6A99FB1223B1670059FBED /* pp.c in Sources */ = {isa = PBXBuildFile; fileRef = 2B6A99F31223B1670059FBED /* pp.c */; };
|
||||
2B6AC7B9161EC99C0094FD86 /* prog_instruction.h in Headers */ = {isa = PBXBuildFile; fileRef = 2B6AC7B5161EC99C0094FD86 /* prog_instruction.h */; };
|
||||
2B6AC7BA161EC99C0094FD86 /* prog_parameter.h in Headers */ = {isa = PBXBuildFile; fileRef = 2B6AC7B6161EC99C0094FD86 /* prog_parameter.h */; };
|
||||
2B6AC7BB161EC99C0094FD86 /* prog_statevars.h in Headers */ = {isa = PBXBuildFile; fileRef = 2B6AC7B7161EC99C0094FD86 /* prog_statevars.h */; };
|
||||
2B6AC7BD161EC9D40094FD86 /* ir_uniform.h in Headers */ = {isa = PBXBuildFile; fileRef = 2B6AC7BC161EC9D40094FD86 /* ir_uniform.h */; };
|
||||
2B6AC8AD161ED9080094FD86 /* glminimal.h in Headers */ = {isa = PBXBuildFile; fileRef = 2B6AC8AC161ED9080094FD86 /* glminimal.h */; };
|
||||
2B78C91D1858B052007F5D2A /* ir_equals.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2B78C91C1858B052007F5D2A /* ir_equals.cpp */; };
|
||||
2B8979DE182C0C4700718F8A /* builtin_functions.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2B8979DD182C0C4700718F8A /* builtin_functions.cpp */; };
|
||||
2B8979E0182C195C00718F8A /* opt_cse.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2B8979DF182C195C00718F8A /* opt_cse.cpp */; };
|
||||
2B8979E2182CB62900718F8A /* link_atomics.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2B8979E1182CB62900718F8A /* link_atomics.cpp */; };
|
||||
2B92A05E15F9FF4700CFED4A /* builtin_variables.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2B92A05C15F9FF4700CFED4A /* builtin_variables.cpp */; };
|
||||
2B9F0A3D189664F3002FF617 /* opt_vectorize.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2B9F0A3C189664F3002FF617 /* opt_vectorize.cpp */; };
|
||||
2BA55A9C1207FEA6002DC82D /* ast_expr.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2BA55A511207FEA6002DC82D /* ast_expr.cpp */; };
|
||||
2BA55A9D1207FEA6002DC82D /* ast_function.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2BA55A521207FEA6002DC82D /* ast_function.cpp */; };
|
||||
2BA55A9E1207FEA6002DC82D /* ast_to_hir.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2BA55A531207FEA6002DC82D /* ast_to_hir.cpp */; };
|
||||
2BA55A9F1207FEA6002DC82D /* ast_type.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2BA55A541207FEA6002DC82D /* ast_type.cpp */; };
|
||||
2BA55AA01207FEA6002DC82D /* ast.h in Headers */ = {isa = PBXBuildFile; fileRef = 2BA55A551207FEA6002DC82D /* ast.h */; };
|
||||
2BA55AA41207FEA6002DC82D /* glsl_lexer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2BA55A591207FEA6002DC82D /* glsl_lexer.cpp */; };
|
||||
2BA55AA61207FEA6002DC82D /* glsl_optimizer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2BA55A5B1207FEA6002DC82D /* glsl_optimizer.cpp */; };
|
||||
2BA55AA71207FEA6002DC82D /* glsl_optimizer.h in Headers */ = {isa = PBXBuildFile; fileRef = 2BA55A5C1207FEA6002DC82D /* glsl_optimizer.h */; };
|
||||
2BA55AA81207FEA6002DC82D /* glsl_parser_extras.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2BA55A5D1207FEA6002DC82D /* glsl_parser_extras.cpp */; };
|
||||
2BA55AA91207FEA6002DC82D /* glsl_parser_extras.h in Headers */ = {isa = PBXBuildFile; fileRef = 2BA55A5E1207FEA6002DC82D /* glsl_parser_extras.h */; };
|
||||
2BA55AAA1207FEA6002DC82D /* glsl_parser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2BA55A5F1207FEA6002DC82D /* glsl_parser.cpp */; };
|
||||
2BA55AAB1207FEA6002DC82D /* glsl_parser.h in Headers */ = {isa = PBXBuildFile; fileRef = 2BA55A601207FEA6002DC82D /* glsl_parser.h */; };
|
||||
2BA55AAD1207FEA6002DC82D /* glsl_symbol_table.h in Headers */ = {isa = PBXBuildFile; fileRef = 2BA55A621207FEA6002DC82D /* glsl_symbol_table.h */; };
|
||||
2BA55AAE1207FEA6002DC82D /* glsl_types.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2BA55A631207FEA6002DC82D /* glsl_types.cpp */; };
|
||||
2BA55AAF1207FEA6002DC82D /* glsl_types.h in Headers */ = {isa = PBXBuildFile; fileRef = 2BA55A641207FEA6002DC82D /* glsl_types.h */; };
|
||||
2BA55AB01207FEA6002DC82D /* hir_field_selection.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2BA55A651207FEA6002DC82D /* hir_field_selection.cpp */; };
|
||||
2BA55AB21207FEA6002DC82D /* ir_basic_block.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2BA55A671207FEA6002DC82D /* ir_basic_block.cpp */; };
|
||||
2BA55AB31207FEA6002DC82D /* ir_basic_block.h in Headers */ = {isa = PBXBuildFile; fileRef = 2BA55A681207FEA6002DC82D /* ir_basic_block.h */; };
|
||||
2BA55AB41207FEA6002DC82D /* ir_clone.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2BA55A691207FEA6002DC82D /* ir_clone.cpp */; };
|
||||
2BA55AB51207FEA6002DC82D /* ir_constant_expression.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2BA55A6A1207FEA6002DC82D /* ir_constant_expression.cpp */; };
|
||||
2BA55ABC1207FEA6002DC82D /* ir_expression_flattening.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2BA55A711207FEA6002DC82D /* ir_expression_flattening.cpp */; };
|
||||
2BA55ABD1207FEA6002DC82D /* ir_expression_flattening.h in Headers */ = {isa = PBXBuildFile; fileRef = 2BA55A721207FEA6002DC82D /* ir_expression_flattening.h */; };
|
||||
2BA55ABE1207FEA6002DC82D /* ir_function_can_inline.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2BA55A731207FEA6002DC82D /* ir_function_can_inline.cpp */; };
|
||||
2BA55AC01207FEA6002DC82D /* ir_function_inlining.h in Headers */ = {isa = PBXBuildFile; fileRef = 2BA55A751207FEA6002DC82D /* ir_function_inlining.h */; };
|
||||
2BA55AC11207FEA6002DC82D /* ir_function.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2BA55A761207FEA6002DC82D /* ir_function.cpp */; };
|
||||
2BA55AC21207FEA6002DC82D /* ir_hierarchical_visitor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2BA55A771207FEA6002DC82D /* ir_hierarchical_visitor.cpp */; };
|
||||
2BA55AC31207FEA6002DC82D /* ir_hierarchical_visitor.h in Headers */ = {isa = PBXBuildFile; fileRef = 2BA55A781207FEA6002DC82D /* ir_hierarchical_visitor.h */; };
|
||||
2BA55AC41207FEA6002DC82D /* ir_hv_accept.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2BA55A791207FEA6002DC82D /* ir_hv_accept.cpp */; };
|
||||
2BA55AC81207FEA6002DC82D /* ir_import_prototypes.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2BA55A7D1207FEA6002DC82D /* ir_import_prototypes.cpp */; };
|
||||
2BA55ACB1207FEA6002DC82D /* ir_optimization.h in Headers */ = {isa = PBXBuildFile; fileRef = 2BA55A801207FEA6002DC82D /* ir_optimization.h */; };
|
||||
2BA55ACC1207FEA6002DC82D /* ir_print_glsl_visitor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2BA55A811207FEA6002DC82D /* ir_print_glsl_visitor.cpp */; };
|
||||
2BA55ACD1207FEA6002DC82D /* ir_print_glsl_visitor.h in Headers */ = {isa = PBXBuildFile; fileRef = 2BA55A821207FEA6002DC82D /* ir_print_glsl_visitor.h */; };
|
||||
2BA55ACE1207FEA6002DC82D /* ir_print_visitor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2BA55A831207FEA6002DC82D /* ir_print_visitor.cpp */; };
|
||||
2BA55ACF1207FEA6002DC82D /* ir_print_visitor.h in Headers */ = {isa = PBXBuildFile; fileRef = 2BA55A841207FEA6002DC82D /* ir_print_visitor.h */; };
|
||||
2BA55AD51207FEA6002DC82D /* ir_unused_structs.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2BA55A8A1207FEA6002DC82D /* ir_unused_structs.cpp */; };
|
||||
2BA55AD61207FEA6002DC82D /* ir_unused_structs.h in Headers */ = {isa = PBXBuildFile; fileRef = 2BA55A8B1207FEA6002DC82D /* ir_unused_structs.h */; };
|
||||
2BA55AD71207FEA6002DC82D /* ir_validate.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2BA55A8C1207FEA6002DC82D /* ir_validate.cpp */; };
|
||||
2BA55AD81207FEA6002DC82D /* ir_variable_refcount.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2BA55A8D1207FEA6002DC82D /* ir_variable_refcount.cpp */; };
|
||||
2BA55AD91207FEA6002DC82D /* ir_variable_refcount.h in Headers */ = {isa = PBXBuildFile; fileRef = 2BA55A8E1207FEA6002DC82D /* ir_variable_refcount.h */; };
|
||||
2BA55ADD1207FEA6002DC82D /* ir_visitor.h in Headers */ = {isa = PBXBuildFile; fileRef = 2BA55A921207FEA6002DC82D /* ir_visitor.h */; };
|
||||
2BA55ADE1207FEA6002DC82D /* ir.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2BA55A931207FEA6002DC82D /* ir.cpp */; };
|
||||
2BA55ADF1207FEA6002DC82D /* ir.h in Headers */ = {isa = PBXBuildFile; fileRef = 2BA55A941207FEA6002DC82D /* ir.h */; };
|
||||
2BA55AE01207FEA6002DC82D /* link_functions.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2BA55A951207FEA6002DC82D /* link_functions.cpp */; };
|
||||
2BA55AE11207FEA6002DC82D /* linker.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2BA55A961207FEA6002DC82D /* linker.cpp */; };
|
||||
2BA55AE21207FEA6002DC82D /* linker.h in Headers */ = {isa = PBXBuildFile; fileRef = 2BA55A971207FEA6002DC82D /* linker.h */; };
|
||||
2BA55AE31207FEA6002DC82D /* list.h in Headers */ = {isa = PBXBuildFile; fileRef = 2BA55A981207FEA6002DC82D /* list.h */; };
|
||||
2BA55AE41207FEA6002DC82D /* program.h in Headers */ = {isa = PBXBuildFile; fileRef = 2BA55A991207FEA6002DC82D /* program.h */; };
|
||||
2BA55AE51207FEA6002DC82D /* s_expression.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2BA55A9A1207FEA6002DC82D /* s_expression.cpp */; };
|
||||
2BA55AE61207FEA6002DC82D /* s_expression.h in Headers */ = {isa = PBXBuildFile; fileRef = 2BA55A9B1207FEA6002DC82D /* s_expression.h */; };
|
||||
2BA7E13F17D0AEB200D5C475 /* builtin_type_macros.h in Headers */ = {isa = PBXBuildFile; fileRef = 2BA7E13817D0AEB200D5C475 /* builtin_type_macros.h */; };
|
||||
2BA7E14017D0AEB200D5C475 /* builtin_types.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2BA7E13917D0AEB200D5C475 /* builtin_types.cpp */; };
|
||||
2BA7E14217D0AEB200D5C475 /* link_interface_blocks.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2BA7E13A17D0AEB200D5C475 /* link_interface_blocks.cpp */; };
|
||||
2BA7E14417D0AEB200D5C475 /* lower_named_interface_blocks.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2BA7E13B17D0AEB200D5C475 /* lower_named_interface_blocks.cpp */; };
|
||||
2BA7E14617D0AEB200D5C475 /* lower_vector_insert.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2BA7E13C17D0AEB200D5C475 /* lower_vector_insert.cpp */; };
|
||||
2BA7E14817D0AEB200D5C475 /* opt_dead_builtin_varyings.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2BA7E13D17D0AEB200D5C475 /* opt_dead_builtin_varyings.cpp */; };
|
||||
2BA7E14A17D0AEB200D5C475 /* opt_flip_matrices.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2BA7E13E17D0AEB200D5C475 /* opt_flip_matrices.cpp */; };
|
||||
2BB2F5B012B8F1580052C6B0 /* lower_discard.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2BB2F5AA12B8F1580052C6B0 /* lower_discard.cpp */; };
|
||||
2BB2F5B112B8F1580052C6B0 /* lower_instructions.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2BB2F5AB12B8F1580052C6B0 /* lower_instructions.cpp */; };
|
||||
2BB2F5B212B8F1580052C6B0 /* lower_vector.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2BB2F5AC12B8F1580052C6B0 /* lower_vector.cpp */; };
|
||||
2BB2F5B412B8F1580052C6B0 /* strtod.c in Sources */ = {isa = PBXBuildFile; fileRef = 2BB2F5AE12B8F1580052C6B0 /* strtod.c */; };
|
||||
2BB2F5B512B8F1580052C6B0 /* strtod.h in Headers */ = {isa = PBXBuildFile; fileRef = 2BB2F5AF12B8F1580052C6B0 /* strtod.h */; };
|
||||
2BB725A9135094BE0057D8B5 /* compiler.h in Headers */ = {isa = PBXBuildFile; fileRef = 2BB7259B135094BE0057D8B5 /* compiler.h */; };
|
||||
2BB725AA135094BE0057D8B5 /* config.h in Headers */ = {isa = PBXBuildFile; fileRef = 2BB7259C135094BE0057D8B5 /* config.h */; };
|
||||
2BB725AB135094BE0057D8B5 /* context.h in Headers */ = {isa = PBXBuildFile; fileRef = 2BB7259D135094BE0057D8B5 /* context.h */; };
|
||||
2BB725AC135094BE0057D8B5 /* core.h in Headers */ = {isa = PBXBuildFile; fileRef = 2BB7259E135094BE0057D8B5 /* core.h */; };
|
||||
2BB725AD135094BE0057D8B5 /* dd.h in Headers */ = {isa = PBXBuildFile; fileRef = 2BB7259F135094BE0057D8B5 /* dd.h */; };
|
||||
2BB725AF135094BE0057D8B5 /* glheader.h in Headers */ = {isa = PBXBuildFile; fileRef = 2BB725A1135094BE0057D8B5 /* glheader.h */; };
|
||||
2BB725B0135094BE0057D8B5 /* imports.h in Headers */ = {isa = PBXBuildFile; fileRef = 2BB725A2135094BE0057D8B5 /* imports.h */; };
|
||||
2BB725B1135094BE0057D8B5 /* macros.h in Headers */ = {isa = PBXBuildFile; fileRef = 2BB725A3135094BE0057D8B5 /* macros.h */; };
|
||||
2BB725B3135094BE0057D8B5 /* mtypes.h in Headers */ = {isa = PBXBuildFile; fileRef = 2BB725A5135094BE0057D8B5 /* mtypes.h */; };
|
||||
2BB725B5135094BE0057D8B5 /* simple_list.h in Headers */ = {isa = PBXBuildFile; fileRef = 2BB725A7135094BE0057D8B5 /* simple_list.h */; };
|
||||
2BBA49281254706A00D42573 /* glsl_symbol_table.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2BBA491F1254706A00D42573 /* glsl_symbol_table.cpp */; };
|
||||
2BBA492A1254706A00D42573 /* loop_analysis.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2BBA49211254706A00D42573 /* loop_analysis.cpp */; };
|
||||
2BBA492B1254706A00D42573 /* loop_analysis.h in Headers */ = {isa = PBXBuildFile; fileRef = 2BBA49221254706A00D42573 /* loop_analysis.h */; };
|
||||
2BBA492C1254706A00D42573 /* loop_controls.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2BBA49231254706A00D42573 /* loop_controls.cpp */; };
|
||||
2BBA492D1254706A00D42573 /* loop_unroll.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2BBA49241254706A00D42573 /* loop_unroll.cpp */; };
|
||||
2BBA492E1254706A00D42573 /* lower_noise.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2BBA49251254706A00D42573 /* lower_noise.cpp */; };
|
||||
2BBA492F1254706A00D42573 /* lower_variable_index_to_cond_assign.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2BBA49261254706A00D42573 /* lower_variable_index_to_cond_assign.cpp */; };
|
||||
2BBA49301254706A00D42573 /* opt_redundant_jumps.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2BBA49271254706A00D42573 /* opt_redundant_jumps.cpp */; };
|
||||
2BBD9DAD1719694100515007 /* ast_array_index.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2BBD9DA91719693E00515007 /* ast_array_index.cpp */; };
|
||||
2BBD9DAF1719694100515007 /* link_uniform_block_active_visitor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2BBD9DAA1719693F00515007 /* link_uniform_block_active_visitor.cpp */; };
|
||||
2BBD9DB11719694100515007 /* link_uniform_block_active_visitor.h in Headers */ = {isa = PBXBuildFile; fileRef = 2BBD9DAB1719694000515007 /* link_uniform_block_active_visitor.h */; };
|
||||
2BBD9DB21719694100515007 /* link_uniform_blocks.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2BBD9DAC1719694100515007 /* link_uniform_blocks.cpp */; };
|
||||
2BBD9DB91719698C00515007 /* link_varyings.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2BBD9DB41719698800515007 /* link_varyings.cpp */; };
|
||||
2BBD9DBB1719698C00515007 /* link_varyings.h in Headers */ = {isa = PBXBuildFile; fileRef = 2BBD9DB51719698900515007 /* link_varyings.h */; };
|
||||
2BBD9DBC1719698C00515007 /* lower_packed_varyings.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2BBD9DB61719698900515007 /* lower_packed_varyings.cpp */; };
|
||||
2BBD9DBE1719698C00515007 /* lower_packing_builtins.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2BBD9DB71719698A00515007 /* lower_packing_builtins.cpp */; };
|
||||
2BBD9DC01719698C00515007 /* opt_flatten_nested_if_blocks.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2BBD9DB81719698B00515007 /* opt_flatten_nested_if_blocks.cpp */; };
|
||||
2BBD9DC817196A3B00515007 /* imports.c in Sources */ = {isa = PBXBuildFile; fileRef = 2BBD9DC717196A3B00515007 /* imports.c */; };
|
||||
2BCF3A8D19ADE1E50057C395 /* ir_print_metal_visitor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2BCF3A8B19ADE1E50057C395 /* ir_print_metal_visitor.cpp */; };
|
||||
2BCF3A8E19ADE1E50057C395 /* ir_print_metal_visitor.h in Headers */ = {isa = PBXBuildFile; fileRef = 2BCF3A8C19ADE1E50057C395 /* ir_print_metal_visitor.h */; };
|
||||
2BDCB95D184E182B0075CE6F /* ir_stats.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2BDCB95B184E182B0075CE6F /* ir_stats.cpp */; };
|
||||
2BDCB95E184E182B0075CE6F /* ir_stats.h in Headers */ = {isa = PBXBuildFile; fileRef = 2BDCB95C184E182B0075CE6F /* ir_stats.h */; };
|
||||
2BEC22EA1356E98300B5E301 /* opt_copy_propagation_elements.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2BEC22CB1356E94E00B5E301 /* opt_copy_propagation_elements.cpp */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
2B3854481293BE5000F3E692 /* lower_if_to_cond_assign.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = lower_if_to_cond_assign.cpp; path = ../../src/glsl/lower_if_to_cond_assign.cpp; sourceTree = SOURCE_ROOT; };
|
||||
2B3854491293BE5000F3E692 /* lower_jumps.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = lower_jumps.cpp; path = ../../src/glsl/lower_jumps.cpp; sourceTree = SOURCE_ROOT; };
|
||||
2B38544A1293BE5000F3E692 /* lower_mat_op_to_vec.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = lower_mat_op_to_vec.cpp; path = ../../src/glsl/lower_mat_op_to_vec.cpp; sourceTree = SOURCE_ROOT; };
|
||||
2B38544D1293BE5000F3E692 /* lower_vec_index_to_cond_assign.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = lower_vec_index_to_cond_assign.cpp; path = ../../src/glsl/lower_vec_index_to_cond_assign.cpp; sourceTree = SOURCE_ROOT; };
|
||||
2B38544E1293BE5000F3E692 /* lower_vec_index_to_swizzle.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = lower_vec_index_to_swizzle.cpp; path = ../../src/glsl/lower_vec_index_to_swizzle.cpp; sourceTree = SOURCE_ROOT; };
|
||||
2B38544F1293BE5000F3E692 /* opt_algebraic.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = opt_algebraic.cpp; path = ../../src/glsl/opt_algebraic.cpp; sourceTree = SOURCE_ROOT; };
|
||||
2B3854501293BE5000F3E692 /* opt_constant_folding.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = opt_constant_folding.cpp; path = ../../src/glsl/opt_constant_folding.cpp; sourceTree = SOURCE_ROOT; };
|
||||
2B3854511293BE5000F3E692 /* opt_constant_propagation.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = opt_constant_propagation.cpp; path = ../../src/glsl/opt_constant_propagation.cpp; sourceTree = SOURCE_ROOT; };
|
||||
2B3854521293BE5000F3E692 /* opt_constant_variable.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = opt_constant_variable.cpp; path = ../../src/glsl/opt_constant_variable.cpp; sourceTree = SOURCE_ROOT; };
|
||||
2B3854531293BE5000F3E692 /* opt_copy_propagation.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = opt_copy_propagation.cpp; path = ../../src/glsl/opt_copy_propagation.cpp; sourceTree = SOURCE_ROOT; };
|
||||
2B3854541293BE5000F3E692 /* opt_dead_code_local.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = opt_dead_code_local.cpp; path = ../../src/glsl/opt_dead_code_local.cpp; sourceTree = SOURCE_ROOT; };
|
||||
2B3854551293BE5000F3E692 /* opt_dead_code.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = opt_dead_code.cpp; path = ../../src/glsl/opt_dead_code.cpp; sourceTree = SOURCE_ROOT; };
|
||||
2B3854561293BE5000F3E692 /* opt_dead_functions.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = opt_dead_functions.cpp; path = ../../src/glsl/opt_dead_functions.cpp; sourceTree = SOURCE_ROOT; };
|
||||
2B3854571293BE5000F3E692 /* opt_function_inlining.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = opt_function_inlining.cpp; path = ../../src/glsl/opt_function_inlining.cpp; sourceTree = SOURCE_ROOT; };
|
||||
2B3854581293BE5000F3E692 /* opt_if_simplification.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = opt_if_simplification.cpp; path = ../../src/glsl/opt_if_simplification.cpp; sourceTree = SOURCE_ROOT; };
|
||||
2B3854591293BE5000F3E692 /* opt_noop_swizzle.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = opt_noop_swizzle.cpp; path = ../../src/glsl/opt_noop_swizzle.cpp; sourceTree = SOURCE_ROOT; };
|
||||
2B38545A1293BE5000F3E692 /* opt_structure_splitting.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = opt_structure_splitting.cpp; path = ../../src/glsl/opt_structure_splitting.cpp; sourceTree = SOURCE_ROOT; };
|
||||
2B38545B1293BE5000F3E692 /* opt_swizzle_swizzle.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = opt_swizzle_swizzle.cpp; path = ../../src/glsl/opt_swizzle_swizzle.cpp; sourceTree = SOURCE_ROOT; };
|
||||
2B38545C1293BE5000F3E692 /* opt_tree_grafting.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = opt_tree_grafting.cpp; path = ../../src/glsl/opt_tree_grafting.cpp; sourceTree = SOURCE_ROOT; };
|
||||
2B39E41019E959F9001C6A17 /* hash_table.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = hash_table.c; path = ../../src/util/hash_table.c; sourceTree = "<group>"; };
|
||||
2B39E41119E959F9001C6A17 /* hash_table.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = hash_table.h; path = ../../src/util/hash_table.h; sourceTree = "<group>"; };
|
||||
2B39E41219E959F9001C6A17 /* macros.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = macros.h; path = ../../src/util/macros.h; sourceTree = "<group>"; };
|
||||
2B39E41319E959F9001C6A17 /* ralloc.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = ralloc.c; path = ../../src/util/ralloc.c; sourceTree = "<group>"; };
|
||||
2B39E41419E959F9001C6A17 /* ralloc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ralloc.h; path = ../../src/util/ralloc.h; sourceTree = "<group>"; };
|
||||
2B39E41A19E95FA7001C6A17 /* lower_offset_array.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = lower_offset_array.cpp; path = ../../src/glsl/lower_offset_array.cpp; sourceTree = "<group>"; };
|
||||
2B39E41B19E95FA7001C6A17 /* lower_vertex_id.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = lower_vertex_id.cpp; path = ../../src/glsl/lower_vertex_id.cpp; sourceTree = "<group>"; };
|
||||
2B39E41C19E95FA7001C6A17 /* opt_dead_builtin_variables.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = opt_dead_builtin_variables.cpp; path = ../../src/glsl/opt_dead_builtin_variables.cpp; sourceTree = "<group>"; };
|
||||
2B39E41D19E95FA7001C6A17 /* opt_minmax.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = opt_minmax.cpp; path = ../../src/glsl/opt_minmax.cpp; sourceTree = "<group>"; };
|
||||
2B39E41E19E95FA7001C6A17 /* opt_rebalance_tree.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = opt_rebalance_tree.cpp; path = ../../src/glsl/opt_rebalance_tree.cpp; sourceTree = "<group>"; };
|
||||
2B3A6B8E15FA043D000DCBE1 /* link_uniforms.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = link_uniforms.cpp; path = ../../src/glsl/link_uniforms.cpp; sourceTree = SOURCE_ROOT; };
|
||||
2B3A6B9515FA0468000DCBE1 /* link_uniform_initializers.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = link_uniform_initializers.cpp; path = ../../src/glsl/link_uniform_initializers.cpp; sourceTree = SOURCE_ROOT; };
|
||||
2B3A6B9C15FA0494000DCBE1 /* lower_clip_distance.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = lower_clip_distance.cpp; path = ../../src/glsl/lower_clip_distance.cpp; sourceTree = SOURCE_ROOT; };
|
||||
2B3A6B9D15FA0494000DCBE1 /* lower_discard_flow.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = lower_discard_flow.cpp; path = ../../src/glsl/lower_discard_flow.cpp; sourceTree = SOURCE_ROOT; };
|
||||
2B3A6B9E15FA0494000DCBE1 /* lower_output_reads.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = lower_output_reads.cpp; path = ../../src/glsl/lower_output_reads.cpp; sourceTree = SOURCE_ROOT; };
|
||||
2B3A6BA015FA0494000DCBE1 /* lower_ubo_reference.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = lower_ubo_reference.cpp; path = ../../src/glsl/lower_ubo_reference.cpp; sourceTree = SOURCE_ROOT; };
|
||||
2B3A6BA115FA0494000DCBE1 /* opt_array_splitting.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = opt_array_splitting.cpp; path = ../../src/glsl/opt_array_splitting.cpp; sourceTree = SOURCE_ROOT; };
|
||||
2B3A6BD715FA08E1000DCBE1 /* ir_builder.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ir_builder.cpp; path = ../../src/glsl/ir_builder.cpp; sourceTree = SOURCE_ROOT; };
|
||||
2B3A6BD815FA08E1000DCBE1 /* ir_builder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ir_builder.h; path = ../../src/glsl/ir_builder.h; sourceTree = SOURCE_ROOT; };
|
||||
2B47D9FD1209C87B00937F2C /* prog_hash_table.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = prog_hash_table.c; path = ../../src/mesa/program/prog_hash_table.c; sourceTree = SOURCE_ROOT; };
|
||||
2B47D9FE1209C87B00937F2C /* hash_table.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = hash_table.h; path = ../../src/mesa/program/hash_table.h; sourceTree = SOURCE_ROOT; };
|
||||
2B47D9FF1209C87B00937F2C /* symbol_table.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = symbol_table.c; path = ../../src/mesa/program/symbol_table.c; sourceTree = SOURCE_ROOT; };
|
||||
2B47DA001209C87B00937F2C /* symbol_table.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = symbol_table.h; path = ../../src/mesa/program/symbol_table.h; sourceTree = SOURCE_ROOT; };
|
||||
2B62490D12191339003F6EEE /* ir_rvalue_visitor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ir_rvalue_visitor.cpp; path = ../../src/glsl/ir_rvalue_visitor.cpp; sourceTree = SOURCE_ROOT; };
|
||||
2B62490E12191339003F6EEE /* ir_rvalue_visitor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ir_rvalue_visitor.h; path = ../../src/glsl/ir_rvalue_visitor.h; sourceTree = SOURCE_ROOT; };
|
||||
2B655A7113E0322E00B5278F /* ir_function_detect_recursion.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ir_function_detect_recursion.cpp; path = ../../src/glsl/ir_function_detect_recursion.cpp; sourceTree = SOURCE_ROOT; };
|
||||
2B655A7613E0324F00B5278F /* standalone_scaffolding.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = standalone_scaffolding.cpp; path = ../../src/glsl/standalone_scaffolding.cpp; sourceTree = SOURCE_ROOT; };
|
||||
2B655A7713E0324F00B5278F /* standalone_scaffolding.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = standalone_scaffolding.h; path = ../../src/glsl/standalone_scaffolding.h; sourceTree = SOURCE_ROOT; };
|
||||
2B6A99EC1223B1670059FBED /* glcpp-lex.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "glcpp-lex.c"; path = "../../src/glsl/glcpp/glcpp-lex.c"; sourceTree = SOURCE_ROOT; };
|
||||
2B6A99ED1223B1670059FBED /* glcpp-lex.l */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.lex; name = "glcpp-lex.l"; path = "../../src/glsl/glcpp/glcpp-lex.l"; sourceTree = SOURCE_ROOT; };
|
||||
2B6A99EE1223B1670059FBED /* glcpp-parse.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "glcpp-parse.c"; path = "../../src/glsl/glcpp/glcpp-parse.c"; sourceTree = SOURCE_ROOT; };
|
||||
2B6A99EF1223B1670059FBED /* glcpp-parse.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "glcpp-parse.h"; path = "../../src/glsl/glcpp/glcpp-parse.h"; sourceTree = SOURCE_ROOT; };
|
||||
2B6A99F01223B1670059FBED /* glcpp-parse.y */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.yacc; name = "glcpp-parse.y"; path = "../../src/glsl/glcpp/glcpp-parse.y"; sourceTree = SOURCE_ROOT; };
|
||||
2B6A99F21223B1670059FBED /* glcpp.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = glcpp.h; path = ../../src/glsl/glcpp/glcpp.h; sourceTree = SOURCE_ROOT; };
|
||||
2B6A99F31223B1670059FBED /* pp.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = pp.c; path = ../../src/glsl/glcpp/pp.c; sourceTree = SOURCE_ROOT; };
|
||||
2B6AC7B5161EC99C0094FD86 /* prog_instruction.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = prog_instruction.h; path = ../../src/mesa/program/prog_instruction.h; sourceTree = SOURCE_ROOT; };
|
||||
2B6AC7B6161EC99C0094FD86 /* prog_parameter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = prog_parameter.h; path = ../../src/mesa/program/prog_parameter.h; sourceTree = SOURCE_ROOT; };
|
||||
2B6AC7B7161EC99C0094FD86 /* prog_statevars.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = prog_statevars.h; path = ../../src/mesa/program/prog_statevars.h; sourceTree = SOURCE_ROOT; };
|
||||
2B6AC7BC161EC9D40094FD86 /* ir_uniform.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ir_uniform.h; path = ../../src/glsl/ir_uniform.h; sourceTree = SOURCE_ROOT; };
|
||||
2B6AC8AC161ED9080094FD86 /* glminimal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = glminimal.h; path = ../../src/mesa/main/glminimal.h; sourceTree = SOURCE_ROOT; };
|
||||
2B78C91C1858B052007F5D2A /* ir_equals.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ir_equals.cpp; path = ../../src/glsl/ir_equals.cpp; sourceTree = "<group>"; };
|
||||
2B8979DD182C0C4700718F8A /* builtin_functions.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = builtin_functions.cpp; path = ../../src/glsl/builtin_functions.cpp; sourceTree = "<group>"; };
|
||||
2B8979DF182C195C00718F8A /* opt_cse.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = opt_cse.cpp; path = ../../src/glsl/opt_cse.cpp; sourceTree = "<group>"; };
|
||||
2B8979E1182CB62900718F8A /* link_atomics.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = link_atomics.cpp; path = ../../src/glsl/link_atomics.cpp; sourceTree = "<group>"; };
|
||||
2B92A05C15F9FF4700CFED4A /* builtin_variables.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = builtin_variables.cpp; path = ../../src/glsl/builtin_variables.cpp; sourceTree = SOURCE_ROOT; };
|
||||
2B9F0A3C189664F3002FF617 /* opt_vectorize.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = opt_vectorize.cpp; path = ../../src/glsl/opt_vectorize.cpp; sourceTree = "<group>"; };
|
||||
2BA0808A1352EBFB00A1C074 /* main.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = main.cpp; path = ../../src/glsl/main.cpp; sourceTree = SOURCE_ROOT; };
|
||||
2BA55A511207FEA6002DC82D /* ast_expr.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ast_expr.cpp; path = ../../src/glsl/ast_expr.cpp; sourceTree = SOURCE_ROOT; };
|
||||
2BA55A521207FEA6002DC82D /* ast_function.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ast_function.cpp; path = ../../src/glsl/ast_function.cpp; sourceTree = SOURCE_ROOT; };
|
||||
2BA55A531207FEA6002DC82D /* ast_to_hir.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ast_to_hir.cpp; path = ../../src/glsl/ast_to_hir.cpp; sourceTree = SOURCE_ROOT; };
|
||||
2BA55A541207FEA6002DC82D /* ast_type.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ast_type.cpp; path = ../../src/glsl/ast_type.cpp; sourceTree = SOURCE_ROOT; };
|
||||
2BA55A551207FEA6002DC82D /* ast.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ast.h; path = ../../src/glsl/ast.h; sourceTree = SOURCE_ROOT; };
|
||||
2BA55A591207FEA6002DC82D /* glsl_lexer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = glsl_lexer.cpp; path = ../../src/glsl/glsl_lexer.cpp; sourceTree = SOURCE_ROOT; };
|
||||
2BA55A5A1207FEA6002DC82D /* glsl_lexer.ll */ = {isa = PBXFileReference; explicitFileType = sourcecode.lex; fileEncoding = 4; name = glsl_lexer.ll; path = ../../src/glsl/glsl_lexer.ll; sourceTree = SOURCE_ROOT; };
|
||||
2BA55A5B1207FEA6002DC82D /* glsl_optimizer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = glsl_optimizer.cpp; path = ../../src/glsl/glsl_optimizer.cpp; sourceTree = SOURCE_ROOT; };
|
||||
2BA55A5C1207FEA6002DC82D /* glsl_optimizer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = glsl_optimizer.h; path = ../../src/glsl/glsl_optimizer.h; sourceTree = SOURCE_ROOT; };
|
||||
2BA55A5D1207FEA6002DC82D /* glsl_parser_extras.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = glsl_parser_extras.cpp; path = ../../src/glsl/glsl_parser_extras.cpp; sourceTree = SOURCE_ROOT; };
|
||||
2BA55A5E1207FEA6002DC82D /* glsl_parser_extras.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = glsl_parser_extras.h; path = ../../src/glsl/glsl_parser_extras.h; sourceTree = SOURCE_ROOT; };
|
||||
2BA55A5F1207FEA6002DC82D /* glsl_parser.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = glsl_parser.cpp; path = ../../src/glsl/glsl_parser.cpp; sourceTree = SOURCE_ROOT; };
|
||||
2BA55A601207FEA6002DC82D /* glsl_parser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = glsl_parser.h; path = ../../src/glsl/glsl_parser.h; sourceTree = SOURCE_ROOT; };
|
||||
2BA55A611207FEA6002DC82D /* glsl_parser.yy */ = {isa = PBXFileReference; explicitFileType = sourcecode.yacc; fileEncoding = 4; name = glsl_parser.yy; path = ../../src/glsl/glsl_parser.yy; sourceTree = SOURCE_ROOT; };
|
||||
2BA55A621207FEA6002DC82D /* glsl_symbol_table.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = glsl_symbol_table.h; path = ../../src/glsl/glsl_symbol_table.h; sourceTree = SOURCE_ROOT; };
|
||||
2BA55A631207FEA6002DC82D /* glsl_types.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = glsl_types.cpp; path = ../../src/glsl/glsl_types.cpp; sourceTree = SOURCE_ROOT; };
|
||||
2BA55A641207FEA6002DC82D /* glsl_types.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = glsl_types.h; path = ../../src/glsl/glsl_types.h; sourceTree = SOURCE_ROOT; };
|
||||
2BA55A651207FEA6002DC82D /* hir_field_selection.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = hir_field_selection.cpp; path = ../../src/glsl/hir_field_selection.cpp; sourceTree = SOURCE_ROOT; };
|
||||
2BA55A671207FEA6002DC82D /* ir_basic_block.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ir_basic_block.cpp; path = ../../src/glsl/ir_basic_block.cpp; sourceTree = SOURCE_ROOT; };
|
||||
2BA55A681207FEA6002DC82D /* ir_basic_block.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ir_basic_block.h; path = ../../src/glsl/ir_basic_block.h; sourceTree = SOURCE_ROOT; };
|
||||
2BA55A691207FEA6002DC82D /* ir_clone.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ir_clone.cpp; path = ../../src/glsl/ir_clone.cpp; sourceTree = SOURCE_ROOT; };
|
||||
2BA55A6A1207FEA6002DC82D /* ir_constant_expression.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ir_constant_expression.cpp; path = ../../src/glsl/ir_constant_expression.cpp; sourceTree = SOURCE_ROOT; };
|
||||
2BA55A711207FEA6002DC82D /* ir_expression_flattening.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ir_expression_flattening.cpp; path = ../../src/glsl/ir_expression_flattening.cpp; sourceTree = SOURCE_ROOT; };
|
||||
2BA55A721207FEA6002DC82D /* ir_expression_flattening.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ir_expression_flattening.h; path = ../../src/glsl/ir_expression_flattening.h; sourceTree = SOURCE_ROOT; };
|
||||
2BA55A731207FEA6002DC82D /* ir_function_can_inline.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ir_function_can_inline.cpp; path = ../../src/glsl/ir_function_can_inline.cpp; sourceTree = SOURCE_ROOT; };
|
||||
2BA55A751207FEA6002DC82D /* ir_function_inlining.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ir_function_inlining.h; path = ../../src/glsl/ir_function_inlining.h; sourceTree = SOURCE_ROOT; };
|
||||
2BA55A761207FEA6002DC82D /* ir_function.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ir_function.cpp; path = ../../src/glsl/ir_function.cpp; sourceTree = SOURCE_ROOT; };
|
||||
2BA55A771207FEA6002DC82D /* ir_hierarchical_visitor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ir_hierarchical_visitor.cpp; path = ../../src/glsl/ir_hierarchical_visitor.cpp; sourceTree = SOURCE_ROOT; };
|
||||
2BA55A781207FEA6002DC82D /* ir_hierarchical_visitor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ir_hierarchical_visitor.h; path = ../../src/glsl/ir_hierarchical_visitor.h; sourceTree = SOURCE_ROOT; };
|
||||
2BA55A791207FEA6002DC82D /* ir_hv_accept.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ir_hv_accept.cpp; path = ../../src/glsl/ir_hv_accept.cpp; sourceTree = SOURCE_ROOT; };
|
||||
2BA55A7D1207FEA6002DC82D /* ir_import_prototypes.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ir_import_prototypes.cpp; path = ../../src/glsl/ir_import_prototypes.cpp; sourceTree = SOURCE_ROOT; };
|
||||
2BA55A801207FEA6002DC82D /* ir_optimization.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ir_optimization.h; path = ../../src/glsl/ir_optimization.h; sourceTree = SOURCE_ROOT; };
|
||||
2BA55A811207FEA6002DC82D /* ir_print_glsl_visitor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ir_print_glsl_visitor.cpp; path = ../../src/glsl/ir_print_glsl_visitor.cpp; sourceTree = SOURCE_ROOT; };
|
||||
2BA55A821207FEA6002DC82D /* ir_print_glsl_visitor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ir_print_glsl_visitor.h; path = ../../src/glsl/ir_print_glsl_visitor.h; sourceTree = SOURCE_ROOT; };
|
||||
2BA55A831207FEA6002DC82D /* ir_print_visitor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ir_print_visitor.cpp; path = ../../src/glsl/ir_print_visitor.cpp; sourceTree = SOURCE_ROOT; };
|
||||
2BA55A841207FEA6002DC82D /* ir_print_visitor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ir_print_visitor.h; path = ../../src/glsl/ir_print_visitor.h; sourceTree = SOURCE_ROOT; };
|
||||
2BA55A8A1207FEA6002DC82D /* ir_unused_structs.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ir_unused_structs.cpp; path = ../../src/glsl/ir_unused_structs.cpp; sourceTree = SOURCE_ROOT; };
|
||||
2BA55A8B1207FEA6002DC82D /* ir_unused_structs.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ir_unused_structs.h; path = ../../src/glsl/ir_unused_structs.h; sourceTree = SOURCE_ROOT; };
|
||||
2BA55A8C1207FEA6002DC82D /* ir_validate.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ir_validate.cpp; path = ../../src/glsl/ir_validate.cpp; sourceTree = SOURCE_ROOT; };
|
||||
2BA55A8D1207FEA6002DC82D /* ir_variable_refcount.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ir_variable_refcount.cpp; path = ../../src/glsl/ir_variable_refcount.cpp; sourceTree = SOURCE_ROOT; };
|
||||
2BA55A8E1207FEA6002DC82D /* ir_variable_refcount.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ir_variable_refcount.h; path = ../../src/glsl/ir_variable_refcount.h; sourceTree = SOURCE_ROOT; };
|
||||
2BA55A921207FEA6002DC82D /* ir_visitor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ir_visitor.h; path = ../../src/glsl/ir_visitor.h; sourceTree = SOURCE_ROOT; };
|
||||
2BA55A931207FEA6002DC82D /* ir.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ir.cpp; path = ../../src/glsl/ir.cpp; sourceTree = SOURCE_ROOT; };
|
||||
2BA55A941207FEA6002DC82D /* ir.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ir.h; path = ../../src/glsl/ir.h; sourceTree = SOURCE_ROOT; };
|
||||
2BA55A951207FEA6002DC82D /* link_functions.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = link_functions.cpp; path = ../../src/glsl/link_functions.cpp; sourceTree = SOURCE_ROOT; };
|
||||
2BA55A961207FEA6002DC82D /* linker.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = linker.cpp; path = ../../src/glsl/linker.cpp; sourceTree = SOURCE_ROOT; };
|
||||
2BA55A971207FEA6002DC82D /* linker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = linker.h; path = ../../src/glsl/linker.h; sourceTree = SOURCE_ROOT; };
|
||||
2BA55A981207FEA6002DC82D /* list.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = list.h; path = ../../src/glsl/list.h; sourceTree = SOURCE_ROOT; };
|
||||
2BA55A991207FEA6002DC82D /* program.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = program.h; path = ../../src/glsl/program.h; sourceTree = SOURCE_ROOT; };
|
||||
2BA55A9A1207FEA6002DC82D /* s_expression.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = s_expression.cpp; path = ../../src/glsl/s_expression.cpp; sourceTree = SOURCE_ROOT; };
|
||||
2BA55A9B1207FEA6002DC82D /* s_expression.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = s_expression.h; path = ../../src/glsl/s_expression.h; sourceTree = SOURCE_ROOT; };
|
||||
2BA7E13817D0AEB200D5C475 /* builtin_type_macros.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = builtin_type_macros.h; path = ../../src/glsl/builtin_type_macros.h; sourceTree = "<group>"; };
|
||||
2BA7E13917D0AEB200D5C475 /* builtin_types.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = builtin_types.cpp; path = ../../src/glsl/builtin_types.cpp; sourceTree = "<group>"; };
|
||||
2BA7E13A17D0AEB200D5C475 /* link_interface_blocks.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = link_interface_blocks.cpp; path = ../../src/glsl/link_interface_blocks.cpp; sourceTree = "<group>"; };
|
||||
2BA7E13B17D0AEB200D5C475 /* lower_named_interface_blocks.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = lower_named_interface_blocks.cpp; path = ../../src/glsl/lower_named_interface_blocks.cpp; sourceTree = "<group>"; };
|
||||
2BA7E13C17D0AEB200D5C475 /* lower_vector_insert.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = lower_vector_insert.cpp; path = ../../src/glsl/lower_vector_insert.cpp; sourceTree = "<group>"; };
|
||||
2BA7E13D17D0AEB200D5C475 /* opt_dead_builtin_varyings.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = opt_dead_builtin_varyings.cpp; path = ../../src/glsl/opt_dead_builtin_varyings.cpp; sourceTree = "<group>"; };
|
||||
2BA7E13E17D0AEB200D5C475 /* opt_flip_matrices.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = opt_flip_matrices.cpp; path = ../../src/glsl/opt_flip_matrices.cpp; sourceTree = "<group>"; };
|
||||
2BB2F5AA12B8F1580052C6B0 /* lower_discard.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = lower_discard.cpp; path = ../../src/glsl/lower_discard.cpp; sourceTree = SOURCE_ROOT; };
|
||||
2BB2F5AB12B8F1580052C6B0 /* lower_instructions.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = lower_instructions.cpp; path = ../../src/glsl/lower_instructions.cpp; sourceTree = SOURCE_ROOT; };
|
||||
2BB2F5AC12B8F1580052C6B0 /* lower_vector.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = lower_vector.cpp; path = ../../src/glsl/lower_vector.cpp; sourceTree = SOURCE_ROOT; };
|
||||
2BB2F5AE12B8F1580052C6B0 /* strtod.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = strtod.c; path = ../../src/glsl/strtod.c; sourceTree = SOURCE_ROOT; };
|
||||
2BB2F5AF12B8F1580052C6B0 /* strtod.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = strtod.h; path = ../../src/glsl/strtod.h; sourceTree = SOURCE_ROOT; };
|
||||
2BB7259B135094BE0057D8B5 /* compiler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = compiler.h; path = ../../src/mesa/main/compiler.h; sourceTree = SOURCE_ROOT; };
|
||||
2BB7259C135094BE0057D8B5 /* config.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = config.h; path = ../../src/mesa/main/config.h; sourceTree = SOURCE_ROOT; };
|
||||
2BB7259D135094BE0057D8B5 /* context.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = context.h; path = ../../src/mesa/main/context.h; sourceTree = SOURCE_ROOT; };
|
||||
2BB7259E135094BE0057D8B5 /* core.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = core.h; path = ../../src/mesa/main/core.h; sourceTree = SOURCE_ROOT; };
|
||||
2BB7259F135094BE0057D8B5 /* dd.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = dd.h; path = ../../src/mesa/main/dd.h; sourceTree = SOURCE_ROOT; };
|
||||
2BB725A1135094BE0057D8B5 /* glheader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = glheader.h; path = ../../src/mesa/main/glheader.h; sourceTree = SOURCE_ROOT; };
|
||||
2BB725A2135094BE0057D8B5 /* imports.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = imports.h; path = ../../src/mesa/main/imports.h; sourceTree = SOURCE_ROOT; };
|
||||
2BB725A3135094BE0057D8B5 /* macros.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = macros.h; path = ../../src/mesa/main/macros.h; sourceTree = SOURCE_ROOT; };
|
||||
2BB725A5135094BE0057D8B5 /* mtypes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = mtypes.h; path = ../../src/mesa/main/mtypes.h; sourceTree = SOURCE_ROOT; };
|
||||
2BB725A7135094BE0057D8B5 /* simple_list.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = simple_list.h; path = ../../src/mesa/main/simple_list.h; sourceTree = SOURCE_ROOT; };
|
||||
2BBA491F1254706A00D42573 /* glsl_symbol_table.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = glsl_symbol_table.cpp; path = ../../src/glsl/glsl_symbol_table.cpp; sourceTree = SOURCE_ROOT; };
|
||||
2BBA49211254706A00D42573 /* loop_analysis.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = loop_analysis.cpp; path = ../../src/glsl/loop_analysis.cpp; sourceTree = SOURCE_ROOT; };
|
||||
2BBA49221254706A00D42573 /* loop_analysis.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = loop_analysis.h; path = ../../src/glsl/loop_analysis.h; sourceTree = SOURCE_ROOT; };
|
||||
2BBA49231254706A00D42573 /* loop_controls.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = loop_controls.cpp; path = ../../src/glsl/loop_controls.cpp; sourceTree = SOURCE_ROOT; };
|
||||
2BBA49241254706A00D42573 /* loop_unroll.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = loop_unroll.cpp; path = ../../src/glsl/loop_unroll.cpp; sourceTree = SOURCE_ROOT; };
|
||||
2BBA49251254706A00D42573 /* lower_noise.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = lower_noise.cpp; path = ../../src/glsl/lower_noise.cpp; sourceTree = SOURCE_ROOT; };
|
||||
2BBA49261254706A00D42573 /* lower_variable_index_to_cond_assign.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = lower_variable_index_to_cond_assign.cpp; path = ../../src/glsl/lower_variable_index_to_cond_assign.cpp; sourceTree = SOURCE_ROOT; };
|
||||
2BBA49271254706A00D42573 /* opt_redundant_jumps.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = opt_redundant_jumps.cpp; path = ../../src/glsl/opt_redundant_jumps.cpp; sourceTree = SOURCE_ROOT; };
|
||||
2BBD9DA717193BEA00515007 /* README.md */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = README.md; path = ../../README.md; sourceTree = "<group>"; };
|
||||
2BBD9DA91719693E00515007 /* ast_array_index.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ast_array_index.cpp; path = ../../src/glsl/ast_array_index.cpp; sourceTree = "<group>"; };
|
||||
2BBD9DAA1719693F00515007 /* link_uniform_block_active_visitor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = link_uniform_block_active_visitor.cpp; path = ../../src/glsl/link_uniform_block_active_visitor.cpp; sourceTree = "<group>"; };
|
||||
2BBD9DAB1719694000515007 /* link_uniform_block_active_visitor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = link_uniform_block_active_visitor.h; path = ../../src/glsl/link_uniform_block_active_visitor.h; sourceTree = "<group>"; };
|
||||
2BBD9DAC1719694100515007 /* link_uniform_blocks.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = link_uniform_blocks.cpp; path = ../../src/glsl/link_uniform_blocks.cpp; sourceTree = "<group>"; };
|
||||
2BBD9DB41719698800515007 /* link_varyings.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = link_varyings.cpp; path = ../../src/glsl/link_varyings.cpp; sourceTree = "<group>"; };
|
||||
2BBD9DB51719698900515007 /* link_varyings.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = link_varyings.h; path = ../../src/glsl/link_varyings.h; sourceTree = "<group>"; };
|
||||
2BBD9DB61719698900515007 /* lower_packed_varyings.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = lower_packed_varyings.cpp; path = ../../src/glsl/lower_packed_varyings.cpp; sourceTree = "<group>"; };
|
||||
2BBD9DB71719698A00515007 /* lower_packing_builtins.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = lower_packing_builtins.cpp; path = ../../src/glsl/lower_packing_builtins.cpp; sourceTree = "<group>"; };
|
||||
2BBD9DB81719698B00515007 /* opt_flatten_nested_if_blocks.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = opt_flatten_nested_if_blocks.cpp; path = ../../src/glsl/opt_flatten_nested_if_blocks.cpp; sourceTree = "<group>"; };
|
||||
2BBD9DC717196A3B00515007 /* imports.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = imports.c; path = ../../src/mesa/main/imports.c; sourceTree = "<group>"; };
|
||||
2BCF3A8B19ADE1E50057C395 /* ir_print_metal_visitor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ir_print_metal_visitor.cpp; path = ../../src/glsl/ir_print_metal_visitor.cpp; sourceTree = "<group>"; };
|
||||
2BCF3A8C19ADE1E50057C395 /* ir_print_metal_visitor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ir_print_metal_visitor.h; path = ../../src/glsl/ir_print_metal_visitor.h; sourceTree = "<group>"; };
|
||||
2BDCB95B184E182B0075CE6F /* ir_stats.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ir_stats.cpp; path = ../../src/glsl/ir_stats.cpp; sourceTree = "<group>"; };
|
||||
2BDCB95C184E182B0075CE6F /* ir_stats.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ir_stats.h; path = ../../src/glsl/ir_stats.h; sourceTree = "<group>"; };
|
||||
2BEC22CB1356E94E00B5E301 /* opt_copy_propagation_elements.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = opt_copy_propagation_elements.cpp; path = ../../src/glsl/opt_copy_propagation_elements.cpp; sourceTree = SOURCE_ROOT; };
|
||||
D2AAC046055464E500DB518D /* libglsl_optimizer.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libglsl_optimizer.a; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
D289987405E68DCB004EDB86 /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXFrameworksBuildPhase section */
|
||||
|
||||
/* Begin PBXGroup section */
|
||||
08FB7794FE84155DC02AAC07 /* mesaglsl2 */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
2BBD9DA717193BEA00515007 /* README.md */,
|
||||
08FB7795FE84155DC02AAC07 /* Source */,
|
||||
1AB674ADFE9D54B511CA2CBB /* Products */,
|
||||
);
|
||||
name = mesaglsl2;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
08FB7795FE84155DC02AAC07 /* Source */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
2B39E40F19E959E0001C6A17 /* util */,
|
||||
2BB7259A135094A60057D8B5 /* mesa */,
|
||||
2B47D9FC1209C85400937F2C /* program */,
|
||||
2BA55A501207FE41002DC82D /* glsl */,
|
||||
);
|
||||
name = Source;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
1AB674ADFE9D54B511CA2CBB /* Products */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
D2AAC046055464E500DB518D /* libglsl_optimizer.a */,
|
||||
);
|
||||
name = Products;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
2B39E40F19E959E0001C6A17 /* util */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
2B39E41019E959F9001C6A17 /* hash_table.c */,
|
||||
2B39E41119E959F9001C6A17 /* hash_table.h */,
|
||||
2B39E41219E959F9001C6A17 /* macros.h */,
|
||||
2B39E41319E959F9001C6A17 /* ralloc.c */,
|
||||
2B39E41419E959F9001C6A17 /* ralloc.h */,
|
||||
);
|
||||
name = util;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
2B47D9FC1209C85400937F2C /* program */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
2B6AC7B5161EC99C0094FD86 /* prog_instruction.h */,
|
||||
2B6AC7B6161EC99C0094FD86 /* prog_parameter.h */,
|
||||
2B6AC7B7161EC99C0094FD86 /* prog_statevars.h */,
|
||||
2B47D9FD1209C87B00937F2C /* prog_hash_table.c */,
|
||||
2B47D9FE1209C87B00937F2C /* hash_table.h */,
|
||||
2B47D9FF1209C87B00937F2C /* symbol_table.c */,
|
||||
2B47DA001209C87B00937F2C /* symbol_table.h */,
|
||||
);
|
||||
name = program;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
2B6A99EB1223B1460059FBED /* glcpp */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
2B6A99EC1223B1670059FBED /* glcpp-lex.c */,
|
||||
2B6A99ED1223B1670059FBED /* glcpp-lex.l */,
|
||||
2B6A99EE1223B1670059FBED /* glcpp-parse.c */,
|
||||
2B6A99EF1223B1670059FBED /* glcpp-parse.h */,
|
||||
2B6A99F01223B1670059FBED /* glcpp-parse.y */,
|
||||
2B6A99F21223B1670059FBED /* glcpp.h */,
|
||||
2B6A99F31223B1670059FBED /* pp.c */,
|
||||
);
|
||||
name = glcpp;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
2BA55A501207FE41002DC82D /* glsl */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
2BA55A551207FEA6002DC82D /* ast.h */,
|
||||
2BBD9DA91719693E00515007 /* ast_array_index.cpp */,
|
||||
2BA55A511207FEA6002DC82D /* ast_expr.cpp */,
|
||||
2BA55A521207FEA6002DC82D /* ast_function.cpp */,
|
||||
2BA55A531207FEA6002DC82D /* ast_to_hir.cpp */,
|
||||
2BA55A541207FEA6002DC82D /* ast_type.cpp */,
|
||||
2B8979DD182C0C4700718F8A /* builtin_functions.cpp */,
|
||||
2BA7E13817D0AEB200D5C475 /* builtin_type_macros.h */,
|
||||
2BA7E13917D0AEB200D5C475 /* builtin_types.cpp */,
|
||||
2B92A05C15F9FF4700CFED4A /* builtin_variables.cpp */,
|
||||
2B6A99EB1223B1460059FBED /* glcpp */,
|
||||
2BA55A591207FEA6002DC82D /* glsl_lexer.cpp */,
|
||||
2BA55A5A1207FEA6002DC82D /* glsl_lexer.ll */,
|
||||
2BA55A5B1207FEA6002DC82D /* glsl_optimizer.cpp */,
|
||||
2BA55A5C1207FEA6002DC82D /* glsl_optimizer.h */,
|
||||
2BA55A5F1207FEA6002DC82D /* glsl_parser.cpp */,
|
||||
2BA55A601207FEA6002DC82D /* glsl_parser.h */,
|
||||
2BA55A611207FEA6002DC82D /* glsl_parser.yy */,
|
||||
2BA55A5D1207FEA6002DC82D /* glsl_parser_extras.cpp */,
|
||||
2BA55A5E1207FEA6002DC82D /* glsl_parser_extras.h */,
|
||||
2BBA491F1254706A00D42573 /* glsl_symbol_table.cpp */,
|
||||
2BA55A621207FEA6002DC82D /* glsl_symbol_table.h */,
|
||||
2BA55A631207FEA6002DC82D /* glsl_types.cpp */,
|
||||
2BA55A641207FEA6002DC82D /* glsl_types.h */,
|
||||
2BA55A651207FEA6002DC82D /* hir_field_selection.cpp */,
|
||||
2BA55A931207FEA6002DC82D /* ir.cpp */,
|
||||
2BA55A941207FEA6002DC82D /* ir.h */,
|
||||
2BA55A671207FEA6002DC82D /* ir_basic_block.cpp */,
|
||||
2BA55A681207FEA6002DC82D /* ir_basic_block.h */,
|
||||
2B3A6BD715FA08E1000DCBE1 /* ir_builder.cpp */,
|
||||
2B3A6BD815FA08E1000DCBE1 /* ir_builder.h */,
|
||||
2BA55A691207FEA6002DC82D /* ir_clone.cpp */,
|
||||
2BA55A6A1207FEA6002DC82D /* ir_constant_expression.cpp */,
|
||||
2BA55A711207FEA6002DC82D /* ir_expression_flattening.cpp */,
|
||||
2BA55A721207FEA6002DC82D /* ir_expression_flattening.h */,
|
||||
2B78C91C1858B052007F5D2A /* ir_equals.cpp */,
|
||||
2BA55A761207FEA6002DC82D /* ir_function.cpp */,
|
||||
2BA55A731207FEA6002DC82D /* ir_function_can_inline.cpp */,
|
||||
2B655A7113E0322E00B5278F /* ir_function_detect_recursion.cpp */,
|
||||
2BA55A751207FEA6002DC82D /* ir_function_inlining.h */,
|
||||
2BA55A771207FEA6002DC82D /* ir_hierarchical_visitor.cpp */,
|
||||
2BA55A781207FEA6002DC82D /* ir_hierarchical_visitor.h */,
|
||||
2BA55A791207FEA6002DC82D /* ir_hv_accept.cpp */,
|
||||
2BA55A7D1207FEA6002DC82D /* ir_import_prototypes.cpp */,
|
||||
2BA55A801207FEA6002DC82D /* ir_optimization.h */,
|
||||
2BA55A811207FEA6002DC82D /* ir_print_glsl_visitor.cpp */,
|
||||
2BA55A821207FEA6002DC82D /* ir_print_glsl_visitor.h */,
|
||||
2BCF3A8B19ADE1E50057C395 /* ir_print_metal_visitor.cpp */,
|
||||
2BCF3A8C19ADE1E50057C395 /* ir_print_metal_visitor.h */,
|
||||
2BA55A831207FEA6002DC82D /* ir_print_visitor.cpp */,
|
||||
2BA55A841207FEA6002DC82D /* ir_print_visitor.h */,
|
||||
2B62490D12191339003F6EEE /* ir_rvalue_visitor.cpp */,
|
||||
2B62490E12191339003F6EEE /* ir_rvalue_visitor.h */,
|
||||
2BDCB95B184E182B0075CE6F /* ir_stats.cpp */,
|
||||
2BDCB95C184E182B0075CE6F /* ir_stats.h */,
|
||||
2B6AC7BC161EC9D40094FD86 /* ir_uniform.h */,
|
||||
2BA55A8A1207FEA6002DC82D /* ir_unused_structs.cpp */,
|
||||
2BA55A8B1207FEA6002DC82D /* ir_unused_structs.h */,
|
||||
2BA55A8C1207FEA6002DC82D /* ir_validate.cpp */,
|
||||
2BA55A8D1207FEA6002DC82D /* ir_variable_refcount.cpp */,
|
||||
2BA55A8E1207FEA6002DC82D /* ir_variable_refcount.h */,
|
||||
2BA55A921207FEA6002DC82D /* ir_visitor.h */,
|
||||
2B8979E1182CB62900718F8A /* link_atomics.cpp */,
|
||||
2BA55A951207FEA6002DC82D /* link_functions.cpp */,
|
||||
2BA7E13A17D0AEB200D5C475 /* link_interface_blocks.cpp */,
|
||||
2BBD9DAA1719693F00515007 /* link_uniform_block_active_visitor.cpp */,
|
||||
2BBD9DAB1719694000515007 /* link_uniform_block_active_visitor.h */,
|
||||
2BBD9DAC1719694100515007 /* link_uniform_blocks.cpp */,
|
||||
2B3A6B9515FA0468000DCBE1 /* link_uniform_initializers.cpp */,
|
||||
2B3A6B8E15FA043D000DCBE1 /* link_uniforms.cpp */,
|
||||
2BBD9DB41719698800515007 /* link_varyings.cpp */,
|
||||
2BBD9DB51719698900515007 /* link_varyings.h */,
|
||||
2BA55A961207FEA6002DC82D /* linker.cpp */,
|
||||
2BA55A971207FEA6002DC82D /* linker.h */,
|
||||
2BA55A981207FEA6002DC82D /* list.h */,
|
||||
2BBA49211254706A00D42573 /* loop_analysis.cpp */,
|
||||
2BBA49221254706A00D42573 /* loop_analysis.h */,
|
||||
2BBA49231254706A00D42573 /* loop_controls.cpp */,
|
||||
2BBA49241254706A00D42573 /* loop_unroll.cpp */,
|
||||
2B3A6B9C15FA0494000DCBE1 /* lower_clip_distance.cpp */,
|
||||
2BB2F5AA12B8F1580052C6B0 /* lower_discard.cpp */,
|
||||
2B3A6B9D15FA0494000DCBE1 /* lower_discard_flow.cpp */,
|
||||
2B3854481293BE5000F3E692 /* lower_if_to_cond_assign.cpp */,
|
||||
2BB2F5AB12B8F1580052C6B0 /* lower_instructions.cpp */,
|
||||
2B3854491293BE5000F3E692 /* lower_jumps.cpp */,
|
||||
2B38544A1293BE5000F3E692 /* lower_mat_op_to_vec.cpp */,
|
||||
2BA7E13B17D0AEB200D5C475 /* lower_named_interface_blocks.cpp */,
|
||||
2BBA49251254706A00D42573 /* lower_noise.cpp */,
|
||||
2B39E41A19E95FA7001C6A17 /* lower_offset_array.cpp */,
|
||||
2B3A6B9E15FA0494000DCBE1 /* lower_output_reads.cpp */,
|
||||
2BBD9DB61719698900515007 /* lower_packed_varyings.cpp */,
|
||||
2BBD9DB71719698A00515007 /* lower_packing_builtins.cpp */,
|
||||
2B3A6BA015FA0494000DCBE1 /* lower_ubo_reference.cpp */,
|
||||
2BBA49261254706A00D42573 /* lower_variable_index_to_cond_assign.cpp */,
|
||||
2B38544D1293BE5000F3E692 /* lower_vec_index_to_cond_assign.cpp */,
|
||||
2B38544E1293BE5000F3E692 /* lower_vec_index_to_swizzle.cpp */,
|
||||
2BB2F5AC12B8F1580052C6B0 /* lower_vector.cpp */,
|
||||
2BA7E13C17D0AEB200D5C475 /* lower_vector_insert.cpp */,
|
||||
2B39E41B19E95FA7001C6A17 /* lower_vertex_id.cpp */,
|
||||
2BA0808A1352EBFB00A1C074 /* main.cpp */,
|
||||
2B38544F1293BE5000F3E692 /* opt_algebraic.cpp */,
|
||||
2B3A6BA115FA0494000DCBE1 /* opt_array_splitting.cpp */,
|
||||
2B3854501293BE5000F3E692 /* opt_constant_folding.cpp */,
|
||||
2B3854511293BE5000F3E692 /* opt_constant_propagation.cpp */,
|
||||
2B3854521293BE5000F3E692 /* opt_constant_variable.cpp */,
|
||||
2B3854531293BE5000F3E692 /* opt_copy_propagation.cpp */,
|
||||
2BEC22CB1356E94E00B5E301 /* opt_copy_propagation_elements.cpp */,
|
||||
2B8979DF182C195C00718F8A /* opt_cse.cpp */,
|
||||
2B39E41C19E95FA7001C6A17 /* opt_dead_builtin_variables.cpp */,
|
||||
2BA7E13D17D0AEB200D5C475 /* opt_dead_builtin_varyings.cpp */,
|
||||
2B3854551293BE5000F3E692 /* opt_dead_code.cpp */,
|
||||
2B3854541293BE5000F3E692 /* opt_dead_code_local.cpp */,
|
||||
2B3854561293BE5000F3E692 /* opt_dead_functions.cpp */,
|
||||
2BBD9DB81719698B00515007 /* opt_flatten_nested_if_blocks.cpp */,
|
||||
2BA7E13E17D0AEB200D5C475 /* opt_flip_matrices.cpp */,
|
||||
2B3854571293BE5000F3E692 /* opt_function_inlining.cpp */,
|
||||
2B3854581293BE5000F3E692 /* opt_if_simplification.cpp */,
|
||||
2B39E41D19E95FA7001C6A17 /* opt_minmax.cpp */,
|
||||
2B3854591293BE5000F3E692 /* opt_noop_swizzle.cpp */,
|
||||
2B39E41E19E95FA7001C6A17 /* opt_rebalance_tree.cpp */,
|
||||
2BBA49271254706A00D42573 /* opt_redundant_jumps.cpp */,
|
||||
2B38545A1293BE5000F3E692 /* opt_structure_splitting.cpp */,
|
||||
2B38545B1293BE5000F3E692 /* opt_swizzle_swizzle.cpp */,
|
||||
2B38545C1293BE5000F3E692 /* opt_tree_grafting.cpp */,
|
||||
2B9F0A3C189664F3002FF617 /* opt_vectorize.cpp */,
|
||||
2BA55A991207FEA6002DC82D /* program.h */,
|
||||
2BA55A9A1207FEA6002DC82D /* s_expression.cpp */,
|
||||
2BA55A9B1207FEA6002DC82D /* s_expression.h */,
|
||||
2B655A7613E0324F00B5278F /* standalone_scaffolding.cpp */,
|
||||
2B655A7713E0324F00B5278F /* standalone_scaffolding.h */,
|
||||
2BB2F5AE12B8F1580052C6B0 /* strtod.c */,
|
||||
2BB2F5AF12B8F1580052C6B0 /* strtod.h */,
|
||||
);
|
||||
name = glsl;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
2BB7259A135094A60057D8B5 /* mesa */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
2BBD9DC717196A3B00515007 /* imports.c */,
|
||||
2BB7259B135094BE0057D8B5 /* compiler.h */,
|
||||
2BB7259C135094BE0057D8B5 /* config.h */,
|
||||
2BB7259D135094BE0057D8B5 /* context.h */,
|
||||
2BB7259E135094BE0057D8B5 /* core.h */,
|
||||
2BB7259F135094BE0057D8B5 /* dd.h */,
|
||||
2BB725A1135094BE0057D8B5 /* glheader.h */,
|
||||
2B6AC8AC161ED9080094FD86 /* glminimal.h */,
|
||||
2BB725A2135094BE0057D8B5 /* imports.h */,
|
||||
2BB725A3135094BE0057D8B5 /* macros.h */,
|
||||
2BB725A5135094BE0057D8B5 /* mtypes.h */,
|
||||
2BB725A7135094BE0057D8B5 /* simple_list.h */,
|
||||
);
|
||||
name = mesa;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXGroup section */
|
||||
|
||||
/* Begin PBXHeadersBuildPhase section */
|
||||
D2AAC043055464E500DB518D /* Headers */ = {
|
||||
isa = PBXHeadersBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
2BA55AA01207FEA6002DC82D /* ast.h in Headers */,
|
||||
2BA55AA71207FEA6002DC82D /* glsl_optimizer.h in Headers */,
|
||||
2BA55AA91207FEA6002DC82D /* glsl_parser_extras.h in Headers */,
|
||||
2B39E41619E959F9001C6A17 /* hash_table.h in Headers */,
|
||||
2BA55AAB1207FEA6002DC82D /* glsl_parser.h in Headers */,
|
||||
2BA55AAD1207FEA6002DC82D /* glsl_symbol_table.h in Headers */,
|
||||
2BA55AAF1207FEA6002DC82D /* glsl_types.h in Headers */,
|
||||
2BA55AB31207FEA6002DC82D /* ir_basic_block.h in Headers */,
|
||||
2BA55ABD1207FEA6002DC82D /* ir_expression_flattening.h in Headers */,
|
||||
2BA55AC01207FEA6002DC82D /* ir_function_inlining.h in Headers */,
|
||||
2BA55AC31207FEA6002DC82D /* ir_hierarchical_visitor.h in Headers */,
|
||||
2BA55ACB1207FEA6002DC82D /* ir_optimization.h in Headers */,
|
||||
2BA55ACD1207FEA6002DC82D /* ir_print_glsl_visitor.h in Headers */,
|
||||
2B39E41919E959F9001C6A17 /* ralloc.h in Headers */,
|
||||
2BA55ACF1207FEA6002DC82D /* ir_print_visitor.h in Headers */,
|
||||
2BA55AD61207FEA6002DC82D /* ir_unused_structs.h in Headers */,
|
||||
2BCF3A8E19ADE1E50057C395 /* ir_print_metal_visitor.h in Headers */,
|
||||
2BA55AD91207FEA6002DC82D /* ir_variable_refcount.h in Headers */,
|
||||
2BA55ADD1207FEA6002DC82D /* ir_visitor.h in Headers */,
|
||||
2BA55ADF1207FEA6002DC82D /* ir.h in Headers */,
|
||||
2BA55AE21207FEA6002DC82D /* linker.h in Headers */,
|
||||
2BA55AE31207FEA6002DC82D /* list.h in Headers */,
|
||||
2BA55AE41207FEA6002DC82D /* program.h in Headers */,
|
||||
2BA55AE61207FEA6002DC82D /* s_expression.h in Headers */,
|
||||
2B39E41719E959F9001C6A17 /* macros.h in Headers */,
|
||||
2B47DA021209C87B00937F2C /* hash_table.h in Headers */,
|
||||
2B47DA041209C87B00937F2C /* symbol_table.h in Headers */,
|
||||
2B62491212191339003F6EEE /* ir_rvalue_visitor.h in Headers */,
|
||||
2B6A99F71223B1670059FBED /* glcpp-parse.h in Headers */,
|
||||
2B6A99FA1223B1670059FBED /* glcpp.h in Headers */,
|
||||
2BBA492B1254706A00D42573 /* loop_analysis.h in Headers */,
|
||||
2BB2F5B512B8F1580052C6B0 /* strtod.h in Headers */,
|
||||
2BB725A9135094BE0057D8B5 /* compiler.h in Headers */,
|
||||
2BB725AA135094BE0057D8B5 /* config.h in Headers */,
|
||||
2BB725AB135094BE0057D8B5 /* context.h in Headers */,
|
||||
2BB725AC135094BE0057D8B5 /* core.h in Headers */,
|
||||
2BB725AD135094BE0057D8B5 /* dd.h in Headers */,
|
||||
2BB725AF135094BE0057D8B5 /* glheader.h in Headers */,
|
||||
2BB725B0135094BE0057D8B5 /* imports.h in Headers */,
|
||||
2BB725B1135094BE0057D8B5 /* macros.h in Headers */,
|
||||
2BB725B3135094BE0057D8B5 /* mtypes.h in Headers */,
|
||||
2BA7E13F17D0AEB200D5C475 /* builtin_type_macros.h in Headers */,
|
||||
2BDCB95E184E182B0075CE6F /* ir_stats.h in Headers */,
|
||||
2BB725B5135094BE0057D8B5 /* simple_list.h in Headers */,
|
||||
2B655A7A13E0324F00B5278F /* standalone_scaffolding.h in Headers */,
|
||||
2B3A6BDB15FA08E1000DCBE1 /* ir_builder.h in Headers */,
|
||||
2B6AC7B9161EC99C0094FD86 /* prog_instruction.h in Headers */,
|
||||
2B6AC7BA161EC99C0094FD86 /* prog_parameter.h in Headers */,
|
||||
2B6AC7BB161EC99C0094FD86 /* prog_statevars.h in Headers */,
|
||||
2B6AC7BD161EC9D40094FD86 /* ir_uniform.h in Headers */,
|
||||
2B6AC8AD161ED9080094FD86 /* glminimal.h in Headers */,
|
||||
2BBD9DB11719694100515007 /* link_uniform_block_active_visitor.h in Headers */,
|
||||
2BBD9DBB1719698C00515007 /* link_varyings.h in Headers */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXHeadersBuildPhase section */
|
||||
|
||||
/* Begin PBXNativeTarget section */
|
||||
D2AAC045055464E500DB518D /* glsl_optimizer */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = 1DEB91EB08733DB70010E9CD /* Build configuration list for PBXNativeTarget "glsl_optimizer" */;
|
||||
buildPhases = (
|
||||
D2AAC043055464E500DB518D /* Headers */,
|
||||
D2AAC044055464E500DB518D /* Sources */,
|
||||
D289987405E68DCB004EDB86 /* Frameworks */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
);
|
||||
name = glsl_optimizer;
|
||||
productName = mesaglsl2;
|
||||
productReference = D2AAC046055464E500DB518D /* libglsl_optimizer.a */;
|
||||
productType = "com.apple.product-type.library.static";
|
||||
};
|
||||
/* End PBXNativeTarget section */
|
||||
|
||||
/* Begin PBXProject section */
|
||||
08FB7793FE84155DC02AAC07 /* Project object */ = {
|
||||
isa = PBXProject;
|
||||
attributes = {
|
||||
LastUpgradeCheck = 0500;
|
||||
};
|
||||
buildConfigurationList = 1DEB91EF08733DB70010E9CD /* Build configuration list for PBXProject "glsl_optimizer_lib" */;
|
||||
compatibilityVersion = "Xcode 3.2";
|
||||
developmentRegion = English;
|
||||
hasScannedForEncodings = 1;
|
||||
knownRegions = (
|
||||
English,
|
||||
Japanese,
|
||||
French,
|
||||
German,
|
||||
);
|
||||
mainGroup = 08FB7794FE84155DC02AAC07 /* mesaglsl2 */;
|
||||
projectDirPath = "";
|
||||
projectRoot = "";
|
||||
targets = (
|
||||
D2AAC045055464E500DB518D /* glsl_optimizer */,
|
||||
);
|
||||
};
|
||||
/* End PBXProject section */
|
||||
|
||||
/* Begin PBXSourcesBuildPhase section */
|
||||
D2AAC044055464E500DB518D /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
2BA55A9C1207FEA6002DC82D /* ast_expr.cpp in Sources */,
|
||||
2BA55A9D1207FEA6002DC82D /* ast_function.cpp in Sources */,
|
||||
2BA55A9E1207FEA6002DC82D /* ast_to_hir.cpp in Sources */,
|
||||
2BA7E14417D0AEB200D5C475 /* lower_named_interface_blocks.cpp in Sources */,
|
||||
2BA55A9F1207FEA6002DC82D /* ast_type.cpp in Sources */,
|
||||
2BA55AA41207FEA6002DC82D /* glsl_lexer.cpp in Sources */,
|
||||
2BDCB95D184E182B0075CE6F /* ir_stats.cpp in Sources */,
|
||||
2BA55AA61207FEA6002DC82D /* glsl_optimizer.cpp in Sources */,
|
||||
2B39E41F19E95FA7001C6A17 /* lower_offset_array.cpp in Sources */,
|
||||
2BA55AA81207FEA6002DC82D /* glsl_parser_extras.cpp in Sources */,
|
||||
2BA55AAA1207FEA6002DC82D /* glsl_parser.cpp in Sources */,
|
||||
2BA55AAE1207FEA6002DC82D /* glsl_types.cpp in Sources */,
|
||||
2BA55AB01207FEA6002DC82D /* hir_field_selection.cpp in Sources */,
|
||||
2BCF3A8D19ADE1E50057C395 /* ir_print_metal_visitor.cpp in Sources */,
|
||||
2BA55AB21207FEA6002DC82D /* ir_basic_block.cpp in Sources */,
|
||||
2BA55AB41207FEA6002DC82D /* ir_clone.cpp in Sources */,
|
||||
2BA55AB51207FEA6002DC82D /* ir_constant_expression.cpp in Sources */,
|
||||
2BA55ABC1207FEA6002DC82D /* ir_expression_flattening.cpp in Sources */,
|
||||
2BA55ABE1207FEA6002DC82D /* ir_function_can_inline.cpp in Sources */,
|
||||
2BA55AC11207FEA6002DC82D /* ir_function.cpp in Sources */,
|
||||
2BA55AC21207FEA6002DC82D /* ir_hierarchical_visitor.cpp in Sources */,
|
||||
2BA55AC41207FEA6002DC82D /* ir_hv_accept.cpp in Sources */,
|
||||
2BA55AC81207FEA6002DC82D /* ir_import_prototypes.cpp in Sources */,
|
||||
2BA55ACC1207FEA6002DC82D /* ir_print_glsl_visitor.cpp in Sources */,
|
||||
2BA55ACE1207FEA6002DC82D /* ir_print_visitor.cpp in Sources */,
|
||||
2BA7E14617D0AEB200D5C475 /* lower_vector_insert.cpp in Sources */,
|
||||
2BA55AD51207FEA6002DC82D /* ir_unused_structs.cpp in Sources */,
|
||||
2BA55AD71207FEA6002DC82D /* ir_validate.cpp in Sources */,
|
||||
2BA7E14817D0AEB200D5C475 /* opt_dead_builtin_varyings.cpp in Sources */,
|
||||
2BA55AD81207FEA6002DC82D /* ir_variable_refcount.cpp in Sources */,
|
||||
2BA55ADE1207FEA6002DC82D /* ir.cpp in Sources */,
|
||||
2BA55AE01207FEA6002DC82D /* link_functions.cpp in Sources */,
|
||||
2BA55AE11207FEA6002DC82D /* linker.cpp in Sources */,
|
||||
2BA55AE51207FEA6002DC82D /* s_expression.cpp in Sources */,
|
||||
2B47DA011209C87B00937F2C /* prog_hash_table.c in Sources */,
|
||||
2B47DA031209C87B00937F2C /* symbol_table.c in Sources */,
|
||||
2B62491112191339003F6EEE /* ir_rvalue_visitor.cpp in Sources */,
|
||||
2B6A99F41223B1670059FBED /* glcpp-lex.c in Sources */,
|
||||
2B78C91D1858B052007F5D2A /* ir_equals.cpp in Sources */,
|
||||
2B6A99F61223B1670059FBED /* glcpp-parse.c in Sources */,
|
||||
2B6A99FB1223B1670059FBED /* pp.c in Sources */,
|
||||
2BBA49281254706A00D42573 /* glsl_symbol_table.cpp in Sources */,
|
||||
2BBA492A1254706A00D42573 /* loop_analysis.cpp in Sources */,
|
||||
2BBA492C1254706A00D42573 /* loop_controls.cpp in Sources */,
|
||||
2BBA492D1254706A00D42573 /* loop_unroll.cpp in Sources */,
|
||||
2B9F0A3D189664F3002FF617 /* opt_vectorize.cpp in Sources */,
|
||||
2BBA492E1254706A00D42573 /* lower_noise.cpp in Sources */,
|
||||
2BBA492F1254706A00D42573 /* lower_variable_index_to_cond_assign.cpp in Sources */,
|
||||
2BBA49301254706A00D42573 /* opt_redundant_jumps.cpp in Sources */,
|
||||
2B38545F1293BE5000F3E692 /* lower_if_to_cond_assign.cpp in Sources */,
|
||||
2B3854601293BE5000F3E692 /* lower_jumps.cpp in Sources */,
|
||||
2B39E42319E95FA7001C6A17 /* opt_rebalance_tree.cpp in Sources */,
|
||||
2B3854611293BE5000F3E692 /* lower_mat_op_to_vec.cpp in Sources */,
|
||||
2B3854641293BE5000F3E692 /* lower_vec_index_to_cond_assign.cpp in Sources */,
|
||||
2B3854651293BE5000F3E692 /* lower_vec_index_to_swizzle.cpp in Sources */,
|
||||
2B3854661293BE5000F3E692 /* opt_algebraic.cpp in Sources */,
|
||||
2B3854671293BE5000F3E692 /* opt_constant_folding.cpp in Sources */,
|
||||
2B3854681293BE5000F3E692 /* opt_constant_propagation.cpp in Sources */,
|
||||
2B3854691293BE5000F3E692 /* opt_constant_variable.cpp in Sources */,
|
||||
2B38546A1293BE5000F3E692 /* opt_copy_propagation.cpp in Sources */,
|
||||
2B39E42019E95FA7001C6A17 /* lower_vertex_id.cpp in Sources */,
|
||||
2B38546B1293BE5000F3E692 /* opt_dead_code_local.cpp in Sources */,
|
||||
2B8979E2182CB62900718F8A /* link_atomics.cpp in Sources */,
|
||||
2B38546C1293BE5000F3E692 /* opt_dead_code.cpp in Sources */,
|
||||
2B38546D1293BE5000F3E692 /* opt_dead_functions.cpp in Sources */,
|
||||
2B38546E1293BE5000F3E692 /* opt_function_inlining.cpp in Sources */,
|
||||
2B38546F1293BE5000F3E692 /* opt_if_simplification.cpp in Sources */,
|
||||
2B3854701293BE5000F3E692 /* opt_noop_swizzle.cpp in Sources */,
|
||||
2B3854711293BE5000F3E692 /* opt_structure_splitting.cpp in Sources */,
|
||||
2B3854721293BE5000F3E692 /* opt_swizzle_swizzle.cpp in Sources */,
|
||||
2B3854731293BE5000F3E692 /* opt_tree_grafting.cpp in Sources */,
|
||||
2B8979DE182C0C4700718F8A /* builtin_functions.cpp in Sources */,
|
||||
2BB2F5B012B8F1580052C6B0 /* lower_discard.cpp in Sources */,
|
||||
2BB2F5B112B8F1580052C6B0 /* lower_instructions.cpp in Sources */,
|
||||
2BB2F5B212B8F1580052C6B0 /* lower_vector.cpp in Sources */,
|
||||
2B39E42219E95FA7001C6A17 /* opt_minmax.cpp in Sources */,
|
||||
2BB2F5B412B8F1580052C6B0 /* strtod.c in Sources */,
|
||||
2BA7E14017D0AEB200D5C475 /* builtin_types.cpp in Sources */,
|
||||
2BEC22EA1356E98300B5E301 /* opt_copy_propagation_elements.cpp in Sources */,
|
||||
2B8979E0182C195C00718F8A /* opt_cse.cpp in Sources */,
|
||||
2B655A7313E0322E00B5278F /* ir_function_detect_recursion.cpp in Sources */,
|
||||
2B39E42119E95FA7001C6A17 /* opt_dead_builtin_variables.cpp in Sources */,
|
||||
2B655A7913E0324F00B5278F /* standalone_scaffolding.cpp in Sources */,
|
||||
2BA7E14A17D0AEB200D5C475 /* opt_flip_matrices.cpp in Sources */,
|
||||
2BA7E14217D0AEB200D5C475 /* link_interface_blocks.cpp in Sources */,
|
||||
2B92A05E15F9FF4700CFED4A /* builtin_variables.cpp in Sources */,
|
||||
2B3A6B9015FA043D000DCBE1 /* link_uniforms.cpp in Sources */,
|
||||
2B3A6B9715FA0468000DCBE1 /* link_uniform_initializers.cpp in Sources */,
|
||||
2B3A6BA815FA0494000DCBE1 /* lower_clip_distance.cpp in Sources */,
|
||||
2B39E41819E959F9001C6A17 /* ralloc.c in Sources */,
|
||||
2B3A6BA915FA0494000DCBE1 /* lower_discard_flow.cpp in Sources */,
|
||||
2B3A6BAA15FA0494000DCBE1 /* lower_output_reads.cpp in Sources */,
|
||||
2B3A6BAC15FA0494000DCBE1 /* lower_ubo_reference.cpp in Sources */,
|
||||
2B3A6BAD15FA0494000DCBE1 /* opt_array_splitting.cpp in Sources */,
|
||||
2B3A6BDA15FA08E1000DCBE1 /* ir_builder.cpp in Sources */,
|
||||
2B39E41519E959F9001C6A17 /* hash_table.c in Sources */,
|
||||
2BBD9DAD1719694100515007 /* ast_array_index.cpp in Sources */,
|
||||
2BBD9DAF1719694100515007 /* link_uniform_block_active_visitor.cpp in Sources */,
|
||||
2BBD9DB21719694100515007 /* link_uniform_blocks.cpp in Sources */,
|
||||
2BBD9DB91719698C00515007 /* link_varyings.cpp in Sources */,
|
||||
2BBD9DBC1719698C00515007 /* lower_packed_varyings.cpp in Sources */,
|
||||
2BBD9DBE1719698C00515007 /* lower_packing_builtins.cpp in Sources */,
|
||||
2BBD9DC01719698C00515007 /* opt_flatten_nested_if_blocks.cpp in Sources */,
|
||||
2BBD9DC817196A3B00515007 /* imports.c in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXSourcesBuildPhase section */
|
||||
|
||||
/* Begin XCBuildConfiguration section */
|
||||
1DEB91EC08733DB70010E9CD /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
COMBINE_HIDPI_IMAGES = YES;
|
||||
COPY_PHASE_STRIP = NO;
|
||||
GCC_DYNAMIC_NO_PIC = NO;
|
||||
GCC_MODEL_TUNING = G5;
|
||||
GCC_OPTIMIZATION_LEVEL = 0;
|
||||
INSTALL_PATH = /usr/local/lib;
|
||||
PRODUCT_NAME = glsl_optimizer;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
1DEB91ED08733DB70010E9CD /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
COMBINE_HIDPI_IMAGES = YES;
|
||||
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||
GCC_MODEL_TUNING = G5;
|
||||
INSTALL_PATH = /usr/local/lib;
|
||||
PRODUCT_NAME = glsl_optimizer;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
1DEB91F008733DB70010E9CD /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
GCC_C_LANGUAGE_STANDARD = gnu99;
|
||||
GCC_OPTIMIZATION_LEVEL = 0;
|
||||
GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = YES;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
HEADER_SEARCH_PATHS = (
|
||||
../../include,
|
||||
../../src/mesa,
|
||||
../../src,
|
||||
);
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.6;
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
1DEB91F108733DB70010E9CD /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
GCC_C_LANGUAGE_STANDARD = gnu99;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
HEADER_SEARCH_PATHS = (
|
||||
../../include,
|
||||
../../src/mesa,
|
||||
../../src,
|
||||
);
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.6;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
/* End XCBuildConfiguration section */
|
||||
|
||||
/* Begin XCConfigurationList section */
|
||||
1DEB91EB08733DB70010E9CD /* Build configuration list for PBXNativeTarget "glsl_optimizer" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
1DEB91EC08733DB70010E9CD /* Debug */,
|
||||
1DEB91ED08733DB70010E9CD /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
1DEB91EF08733DB70010E9CD /* Build configuration list for PBXProject "glsl_optimizer_lib" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
1DEB91F008733DB70010E9CD /* Debug */,
|
||||
1DEB91F108733DB70010E9CD /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
/* End XCConfigurationList section */
|
||||
};
|
||||
rootObject = 08FB7793FE84155DC02AAC07 /* Project object */;
|
||||
}
|
|
@ -1,272 +0,0 @@
|
|||
// !$*UTF8*$!
|
||||
{
|
||||
archiveVersion = 1;
|
||||
classes = {
|
||||
};
|
||||
objectVersion = 46;
|
||||
objects = {
|
||||
|
||||
/* Begin PBXBuildFile section */
|
||||
2B47D9AB1209C6AC00937F2C /* glsl_optimizer_tests.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2B47D9AA1209C6AC00937F2C /* glsl_optimizer_tests.cpp */; };
|
||||
2B88BF721821AEBD007FEFD9 /* OpenGL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2B88BF711821AEBD007FEFD9 /* OpenGL.framework */; };
|
||||
2BBD9DA217193ABA00515007 /* libglsl_optimizer.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 2BE167B6171937F4006A0537 /* libglsl_optimizer.a */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXContainerItemProxy section */
|
||||
2BE167B5171937F4006A0537 /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = 2B47D9C51209C72F00937F2C /* glsl_optimizer_lib.xcodeproj */;
|
||||
proxyType = 2;
|
||||
remoteGlobalIDString = D2AAC046055464E500DB518D;
|
||||
remoteInfo = glsl_optimizer;
|
||||
};
|
||||
2BE167B7171937F4006A0537 /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = 2B47D9C51209C72F00937F2C /* glsl_optimizer_lib.xcodeproj */;
|
||||
proxyType = 2;
|
||||
remoteGlobalIDString = 2BA0803D1352EB9300A1C074;
|
||||
remoteInfo = builtin_compiler;
|
||||
};
|
||||
2BE167B91719383D006A0537 /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = 2B47D9C51209C72F00937F2C /* glsl_optimizer_lib.xcodeproj */;
|
||||
proxyType = 1;
|
||||
remoteGlobalIDString = D2AAC045055464E500DB518D;
|
||||
remoteInfo = glsl_optimizer;
|
||||
};
|
||||
/* End PBXContainerItemProxy section */
|
||||
|
||||
/* Begin PBXCopyFilesBuildPhase section */
|
||||
8DD76FAF0486AB0100D96B5E /* CopyFiles */ = {
|
||||
isa = PBXCopyFilesBuildPhase;
|
||||
buildActionMask = 8;
|
||||
dstPath = /usr/share/man/man1/;
|
||||
dstSubfolderSpec = 0;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 1;
|
||||
};
|
||||
/* End PBXCopyFilesBuildPhase section */
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
2B47D9AA1209C6AC00937F2C /* glsl_optimizer_tests.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = glsl_optimizer_tests.cpp; path = ../../tests/glsl_optimizer_tests.cpp; sourceTree = "<group>"; };
|
||||
2B47D9C51209C72F00937F2C /* glsl_optimizer_lib.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; path = glsl_optimizer_lib.xcodeproj; sourceTree = SOURCE_ROOT; };
|
||||
2B88BF711821AEBD007FEFD9 /* OpenGL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGL.framework; path = System/Library/Frameworks/OpenGL.framework; sourceTree = SDKROOT; };
|
||||
8DD76FB20486AB0100D96B5E /* glsl_optimizer_tests */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = glsl_optimizer_tests; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
8DD76FAD0486AB0100D96B5E /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
2BBD9DA217193ABA00515007 /* libglsl_optimizer.a in Frameworks */,
|
||||
2B88BF721821AEBD007FEFD9 /* OpenGL.framework in Frameworks */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXFrameworksBuildPhase section */
|
||||
|
||||
/* Begin PBXGroup section */
|
||||
08FB7794FE84155DC02AAC07 /* glsl_optimizer_tests */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
08FB7795FE84155DC02AAC07 /* Source */,
|
||||
1AB674ADFE9D54B511CA2CBB /* Products */,
|
||||
2B88BF711821AEBD007FEFD9 /* OpenGL.framework */,
|
||||
2B47D9C51209C72F00937F2C /* glsl_optimizer_lib.xcodeproj */,
|
||||
);
|
||||
name = glsl_optimizer_tests;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
08FB7795FE84155DC02AAC07 /* Source */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
2B47D9AA1209C6AC00937F2C /* glsl_optimizer_tests.cpp */,
|
||||
);
|
||||
name = Source;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
1AB674ADFE9D54B511CA2CBB /* Products */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
8DD76FB20486AB0100D96B5E /* glsl_optimizer_tests */,
|
||||
);
|
||||
name = Products;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
2BE167B1171937F4006A0537 /* Products */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
2BE167B6171937F4006A0537 /* libglsl_optimizer.a */,
|
||||
2BE167B8171937F4006A0537 /* builtincompiler */,
|
||||
);
|
||||
name = Products;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXGroup section */
|
||||
|
||||
/* Begin PBXNativeTarget section */
|
||||
8DD76FA90486AB0100D96B5E /* glsl_optimizer_tests */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = 1DEB928508733DD80010E9CD /* Build configuration list for PBXNativeTarget "glsl_optimizer_tests" */;
|
||||
buildPhases = (
|
||||
8DD76FAB0486AB0100D96B5E /* Sources */,
|
||||
8DD76FAD0486AB0100D96B5E /* Frameworks */,
|
||||
8DD76FAF0486AB0100D96B5E /* CopyFiles */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
2BE167BA1719383D006A0537 /* PBXTargetDependency */,
|
||||
);
|
||||
name = glsl_optimizer_tests;
|
||||
productInstallPath = "$(HOME)/bin";
|
||||
productName = glsl_optimizer_tests;
|
||||
productReference = 8DD76FB20486AB0100D96B5E /* glsl_optimizer_tests */;
|
||||
productType = "com.apple.product-type.tool";
|
||||
};
|
||||
/* End PBXNativeTarget section */
|
||||
|
||||
/* Begin PBXProject section */
|
||||
08FB7793FE84155DC02AAC07 /* Project object */ = {
|
||||
isa = PBXProject;
|
||||
attributes = {
|
||||
LastUpgradeCheck = 0500;
|
||||
};
|
||||
buildConfigurationList = 1DEB928908733DD80010E9CD /* Build configuration list for PBXProject "glsl_optimizer_tests" */;
|
||||
compatibilityVersion = "Xcode 3.2";
|
||||
developmentRegion = English;
|
||||
hasScannedForEncodings = 1;
|
||||
knownRegions = (
|
||||
English,
|
||||
Japanese,
|
||||
French,
|
||||
German,
|
||||
);
|
||||
mainGroup = 08FB7794FE84155DC02AAC07 /* glsl_optimizer_tests */;
|
||||
projectDirPath = "";
|
||||
projectReferences = (
|
||||
{
|
||||
ProductGroup = 2BE167B1171937F4006A0537 /* Products */;
|
||||
ProjectRef = 2B47D9C51209C72F00937F2C /* glsl_optimizer_lib.xcodeproj */;
|
||||
},
|
||||
);
|
||||
projectRoot = "";
|
||||
targets = (
|
||||
8DD76FA90486AB0100D96B5E /* glsl_optimizer_tests */,
|
||||
);
|
||||
};
|
||||
/* End PBXProject section */
|
||||
|
||||
/* Begin PBXReferenceProxy section */
|
||||
2BE167B6171937F4006A0537 /* libglsl_optimizer.a */ = {
|
||||
isa = PBXReferenceProxy;
|
||||
fileType = archive.ar;
|
||||
path = libglsl_optimizer.a;
|
||||
remoteRef = 2BE167B5171937F4006A0537 /* PBXContainerItemProxy */;
|
||||
sourceTree = BUILT_PRODUCTS_DIR;
|
||||
};
|
||||
2BE167B8171937F4006A0537 /* builtincompiler */ = {
|
||||
isa = PBXReferenceProxy;
|
||||
fileType = "compiled.mach-o.executable";
|
||||
path = builtincompiler;
|
||||
remoteRef = 2BE167B7171937F4006A0537 /* PBXContainerItemProxy */;
|
||||
sourceTree = BUILT_PRODUCTS_DIR;
|
||||
};
|
||||
/* End PBXReferenceProxy section */
|
||||
|
||||
/* Begin PBXSourcesBuildPhase section */
|
||||
8DD76FAB0486AB0100D96B5E /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
2B47D9AB1209C6AC00937F2C /* glsl_optimizer_tests.cpp in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXSourcesBuildPhase section */
|
||||
|
||||
/* Begin PBXTargetDependency section */
|
||||
2BE167BA1719383D006A0537 /* PBXTargetDependency */ = {
|
||||
isa = PBXTargetDependency;
|
||||
name = glsl_optimizer;
|
||||
targetProxy = 2BE167B91719383D006A0537 /* PBXContainerItemProxy */;
|
||||
};
|
||||
/* End PBXTargetDependency section */
|
||||
|
||||
/* Begin XCBuildConfiguration section */
|
||||
1DEB928608733DD80010E9CD /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
COPY_PHASE_STRIP = NO;
|
||||
GCC_DYNAMIC_NO_PIC = NO;
|
||||
GCC_MODEL_TUNING = G5;
|
||||
GCC_OPTIMIZATION_LEVEL = 0;
|
||||
INSTALL_PATH = /usr/local/bin;
|
||||
PRODUCT_NAME = glsl_optimizer_tests;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
1DEB928708733DD80010E9CD /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||
GCC_MODEL_TUNING = G5;
|
||||
INSTALL_PATH = /usr/local/bin;
|
||||
PRODUCT_NAME = glsl_optimizer_tests;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
1DEB928A08733DD80010E9CD /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
GCC_C_LANGUAGE_STANDARD = gnu99;
|
||||
GCC_OPTIMIZATION_LEVEL = 0;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.6;
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
1DEB928B08733DD80010E9CD /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
GCC_C_LANGUAGE_STANDARD = gnu99;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES;
|
||||
GCC_WARN_HIDDEN_VIRTUAL_FUNCTIONS = YES;
|
||||
GCC_WARN_SHADOW = YES;
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.6;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
/* End XCBuildConfiguration section */
|
||||
|
||||
/* Begin XCConfigurationList section */
|
||||
1DEB928508733DD80010E9CD /* Build configuration list for PBXNativeTarget "glsl_optimizer_tests" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
1DEB928608733DD80010E9CD /* Debug */,
|
||||
1DEB928708733DD80010E9CD /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
1DEB928908733DD80010E9CD /* Build configuration list for PBXProject "glsl_optimizer_tests" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
1DEB928A08733DD80010E9CD /* Debug */,
|
||||
1DEB928B08733DD80010E9CD /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
/* End XCConfigurationList section */
|
||||
};
|
||||
rootObject = 08FB7793FE84155DC02AAC07 /* Project object */;
|
||||
}
|
|
@ -1,15 +0,0 @@
|
|||
#! /bin/sh
|
||||
git rm -rf bin
|
||||
git rm -rf docs
|
||||
git rm -rf m4
|
||||
git rm -rf src/egl
|
||||
git rm -rf src/glsl/glcpp/tests
|
||||
git rm -rf src/loader
|
||||
git rm -rf src/mapi
|
||||
git rm -rf src/mesa/drivers
|
||||
git rm -rf src/mesa/main/tests
|
||||
git rm -rf src/mesa/state_tracker
|
||||
git rm -rf src/gallium
|
||||
git rm -rf src/glx
|
||||
git rm -rf src/gtest
|
||||
git rm -rf $(git status --porcelain | awk '/^DU/ {print $NF}')
|
|
@ -1,15 +0,0 @@
|
|||
Import('*')
|
||||
|
||||
if not env['msvc']:
|
||||
Return()
|
||||
|
||||
env = env.Clone()
|
||||
|
||||
env.Prepend(CPPPATH = ['.'])
|
||||
|
||||
getopt = env.ConvenienceLibrary(
|
||||
target = 'getopt',
|
||||
source = ['getopt_long.c'],
|
||||
)
|
||||
|
||||
Export('getopt')
|
|
@ -1,82 +0,0 @@
|
|||
/* $OpenBSD: getopt.h,v 1.2 2008/06/26 05:42:04 ray Exp $ */
|
||||
/* $NetBSD: getopt.h,v 1.4 2000/07/07 10:43:54 ad Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2000 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to The NetBSD Foundation
|
||||
* by Dieter Baron and Thomas Klausner.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
|
||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
|
||||
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef _GETOPT_H_
|
||||
#define _GETOPT_H_
|
||||
|
||||
/*
|
||||
* GNU-like getopt_long() and 4.4BSD getsubopt()/optreset extensions
|
||||
*/
|
||||
#define no_argument 0
|
||||
#define required_argument 1
|
||||
#define optional_argument 2
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct option {
|
||||
/* name of long option */
|
||||
const char *name;
|
||||
/*
|
||||
* one of no_argument, required_argument, and optional_argument:
|
||||
* whether option takes an argument
|
||||
*/
|
||||
int has_arg;
|
||||
/* if not NULL, set *flag to val when option found */
|
||||
int *flag;
|
||||
/* if flag not NULL, value to set *flag to; else return value */
|
||||
int val;
|
||||
};
|
||||
|
||||
int getopt_long(int, char * const *, const char *,
|
||||
const struct option *, int *);
|
||||
int getopt_long_only(int, char * const *, const char *,
|
||||
const struct option *, int *);
|
||||
#ifndef _GETOPT_DEFINED_
|
||||
#define _GETOPT_DEFINED_
|
||||
int getopt(int, char * const *, const char *);
|
||||
int getsubopt(char **, char * const *, char **);
|
||||
|
||||
extern char *optarg; /* getopt(3) external variables */
|
||||
extern int opterr;
|
||||
extern int optind;
|
||||
extern int optopt;
|
||||
extern int optreset;
|
||||
extern char *suboptarg; /* getsubopt(3) external variable */
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* !_GETOPT_H_ */
|
|
@ -1,511 +0,0 @@
|
|||
/* $OpenBSD: getopt_long.c,v 1.24 2010/07/22 19:31:53 blambert Exp $ */
|
||||
/* $NetBSD: getopt_long.c,v 1.15 2002/01/31 22:43:40 tv Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2002 Todd C. Miller <Todd.Miller@courtesan.com>
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice appear in all copies.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*
|
||||
* Sponsored in part by the Defense Advanced Research Projects
|
||||
* Agency (DARPA) and Air Force Research Laboratory, Air Force
|
||||
* Materiel Command, USAF, under agreement number F39502-99-1-0512.
|
||||
*/
|
||||
/*-
|
||||
* Copyright (c) 2000 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to The NetBSD Foundation
|
||||
* by Dieter Baron and Thomas Klausner.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
|
||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
|
||||
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <errno.h>
|
||||
#include <getopt.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
int opterr = 1; /* if error message should be printed */
|
||||
int optind = 1; /* index into parent argv vector */
|
||||
int optopt = '?'; /* character checked for validity */
|
||||
int optreset; /* reset getopt */
|
||||
char *optarg; /* argument associated with option */
|
||||
|
||||
#define PRINT_ERROR ((opterr) && (*options != ':'))
|
||||
|
||||
#define FLAG_PERMUTE 0x01 /* permute non-options to the end of argv */
|
||||
#define FLAG_ALLARGS 0x02 /* treat non-options as args to option "-1" */
|
||||
#define FLAG_LONGONLY 0x04 /* operate as getopt_long_only */
|
||||
|
||||
/* return values */
|
||||
#define BADCH (int)'?'
|
||||
#define BADARG ((*options == ':') ? (int)':' : (int)'?')
|
||||
#define INORDER (int)1
|
||||
|
||||
#define EMSG ""
|
||||
|
||||
static int getopt_internal(int, char * const *, const char *,
|
||||
const struct option *, int *, int);
|
||||
static int parse_long_options(char * const *, const char *,
|
||||
const struct option *, int *, int);
|
||||
static int gcd(int, int);
|
||||
static void permute_args(int, int, int, char * const *);
|
||||
|
||||
static char *place = EMSG; /* option letter processing */
|
||||
|
||||
/* XXX: set optreset to 1 rather than these two */
|
||||
static int nonopt_start = -1; /* first non option argument (for permute) */
|
||||
static int nonopt_end = -1; /* first option after non options (for permute) */
|
||||
|
||||
/* Error messages */
|
||||
static const char recargchar[] = "option requires an argument -- %c";
|
||||
static const char recargstring[] = "option requires an argument -- %s";
|
||||
static const char ambig[] = "ambiguous option -- %.*s";
|
||||
static const char noarg[] = "option doesn't take an argument -- %.*s";
|
||||
static const char illoptchar[] = "unknown option -- %c";
|
||||
static const char illoptstring[] = "unknown option -- %s";
|
||||
|
||||
/*
|
||||
* Compute the greatest common divisor of a and b.
|
||||
*/
|
||||
static int
|
||||
gcd(int a, int b)
|
||||
{
|
||||
int c;
|
||||
|
||||
c = a % b;
|
||||
while (c != 0) {
|
||||
a = b;
|
||||
b = c;
|
||||
c = a % b;
|
||||
}
|
||||
|
||||
return (b);
|
||||
}
|
||||
|
||||
/*
|
||||
* Exchange the block from nonopt_start to nonopt_end with the block
|
||||
* from nonopt_end to opt_end (keeping the same order of arguments
|
||||
* in each block).
|
||||
*/
|
||||
static void
|
||||
permute_args(int panonopt_start, int panonopt_end, int opt_end,
|
||||
char * const *nargv)
|
||||
{
|
||||
int cstart, cyclelen, i, j, ncycle, nnonopts, nopts, pos;
|
||||
char *swap;
|
||||
|
||||
/*
|
||||
* compute lengths of blocks and number and size of cycles
|
||||
*/
|
||||
nnonopts = panonopt_end - panonopt_start;
|
||||
nopts = opt_end - panonopt_end;
|
||||
ncycle = gcd(nnonopts, nopts);
|
||||
cyclelen = (opt_end - panonopt_start) / ncycle;
|
||||
|
||||
for (i = 0; i < ncycle; i++) {
|
||||
cstart = panonopt_end+i;
|
||||
pos = cstart;
|
||||
for (j = 0; j < cyclelen; j++) {
|
||||
if (pos >= panonopt_end)
|
||||
pos -= nnonopts;
|
||||
else
|
||||
pos += nopts;
|
||||
swap = nargv[pos];
|
||||
/* LINTED const cast */
|
||||
((char **) nargv)[pos] = nargv[cstart];
|
||||
/* LINTED const cast */
|
||||
((char **)nargv)[cstart] = swap;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* parse_long_options --
|
||||
* Parse long options in argc/argv argument vector.
|
||||
* Returns -1 if short_too is set and the option does not match long_options.
|
||||
*/
|
||||
static int
|
||||
parse_long_options(char * const *nargv, const char *options,
|
||||
const struct option *long_options, int *idx, int short_too)
|
||||
{
|
||||
char *current_argv, *has_equal;
|
||||
size_t current_argv_len;
|
||||
int i, match;
|
||||
|
||||
current_argv = place;
|
||||
match = -1;
|
||||
|
||||
optind++;
|
||||
|
||||
if ((has_equal = strchr(current_argv, '=')) != NULL) {
|
||||
/* argument found (--option=arg) */
|
||||
current_argv_len = has_equal - current_argv;
|
||||
has_equal++;
|
||||
} else
|
||||
current_argv_len = strlen(current_argv);
|
||||
|
||||
for (i = 0; long_options[i].name; i++) {
|
||||
/* find matching long option */
|
||||
if (strncmp(current_argv, long_options[i].name,
|
||||
current_argv_len))
|
||||
continue;
|
||||
|
||||
if (strlen(long_options[i].name) == current_argv_len) {
|
||||
/* exact match */
|
||||
match = i;
|
||||
break;
|
||||
}
|
||||
/*
|
||||
* If this is a known short option, don't allow
|
||||
* a partial match of a single character.
|
||||
*/
|
||||
if (short_too && current_argv_len == 1)
|
||||
continue;
|
||||
|
||||
if (match == -1) /* partial match */
|
||||
match = i;
|
||||
else {
|
||||
/* ambiguous abbreviation */
|
||||
if (PRINT_ERROR)
|
||||
fprintf(stderr, ambig, (int)current_argv_len,
|
||||
current_argv);
|
||||
optopt = 0;
|
||||
return (BADCH);
|
||||
}
|
||||
}
|
||||
if (match != -1) { /* option found */
|
||||
if (long_options[match].has_arg == no_argument
|
||||
&& has_equal) {
|
||||
if (PRINT_ERROR)
|
||||
fprintf(stderr, noarg, (int)current_argv_len,
|
||||
current_argv);
|
||||
/*
|
||||
* XXX: GNU sets optopt to val regardless of flag
|
||||
*/
|
||||
if (long_options[match].flag == NULL)
|
||||
optopt = long_options[match].val;
|
||||
else
|
||||
optopt = 0;
|
||||
return (BADARG);
|
||||
}
|
||||
if (long_options[match].has_arg == required_argument ||
|
||||
long_options[match].has_arg == optional_argument) {
|
||||
if (has_equal)
|
||||
optarg = has_equal;
|
||||
else if (long_options[match].has_arg ==
|
||||
required_argument) {
|
||||
/*
|
||||
* optional argument doesn't use next nargv
|
||||
*/
|
||||
optarg = nargv[optind++];
|
||||
}
|
||||
}
|
||||
if ((long_options[match].has_arg == required_argument)
|
||||
&& (optarg == NULL)) {
|
||||
/*
|
||||
* Missing argument; leading ':' indicates no error
|
||||
* should be generated.
|
||||
*/
|
||||
if (PRINT_ERROR)
|
||||
fprintf(stderr, recargstring,
|
||||
current_argv);
|
||||
/*
|
||||
* XXX: GNU sets optopt to val regardless of flag
|
||||
*/
|
||||
if (long_options[match].flag == NULL)
|
||||
optopt = long_options[match].val;
|
||||
else
|
||||
optopt = 0;
|
||||
--optind;
|
||||
return (BADARG);
|
||||
}
|
||||
} else { /* unknown option */
|
||||
if (short_too) {
|
||||
--optind;
|
||||
return (-1);
|
||||
}
|
||||
if (PRINT_ERROR)
|
||||
fprintf(stderr, illoptstring, current_argv);
|
||||
optopt = 0;
|
||||
return (BADCH);
|
||||
}
|
||||
if (idx)
|
||||
*idx = match;
|
||||
if (long_options[match].flag) {
|
||||
*long_options[match].flag = long_options[match].val;
|
||||
return (0);
|
||||
} else
|
||||
return (long_options[match].val);
|
||||
}
|
||||
|
||||
/*
|
||||
* getopt_internal --
|
||||
* Parse argc/argv argument vector. Called by user level routines.
|
||||
*/
|
||||
static int
|
||||
getopt_internal(int nargc, char * const *nargv, const char *options,
|
||||
const struct option *long_options, int *idx, int flags)
|
||||
{
|
||||
char *oli; /* option letter list index */
|
||||
int optchar, short_too;
|
||||
static int posixly_correct = -1;
|
||||
|
||||
if (options == NULL)
|
||||
return (-1);
|
||||
|
||||
/*
|
||||
* Disable GNU extensions if POSIXLY_CORRECT is set or options
|
||||
* string begins with a '+'.
|
||||
*/
|
||||
if (posixly_correct == -1)
|
||||
posixly_correct = (getenv("POSIXLY_CORRECT") != NULL);
|
||||
if (posixly_correct || *options == '+')
|
||||
flags &= ~FLAG_PERMUTE;
|
||||
else if (*options == '-')
|
||||
flags |= FLAG_ALLARGS;
|
||||
if (*options == '+' || *options == '-')
|
||||
options++;
|
||||
|
||||
/*
|
||||
* XXX Some GNU programs (like cvs) set optind to 0 instead of
|
||||
* XXX using optreset. Work around this braindamage.
|
||||
*/
|
||||
if (optind == 0)
|
||||
optind = optreset = 1;
|
||||
|
||||
optarg = NULL;
|
||||
if (optreset)
|
||||
nonopt_start = nonopt_end = -1;
|
||||
start:
|
||||
if (optreset || !*place) { /* update scanning pointer */
|
||||
optreset = 0;
|
||||
if (optind >= nargc) { /* end of argument vector */
|
||||
place = EMSG;
|
||||
if (nonopt_end != -1) {
|
||||
/* do permutation, if we have to */
|
||||
permute_args(nonopt_start, nonopt_end,
|
||||
optind, nargv);
|
||||
optind -= nonopt_end - nonopt_start;
|
||||
}
|
||||
else if (nonopt_start != -1) {
|
||||
/*
|
||||
* If we skipped non-options, set optind
|
||||
* to the first of them.
|
||||
*/
|
||||
optind = nonopt_start;
|
||||
}
|
||||
nonopt_start = nonopt_end = -1;
|
||||
return (-1);
|
||||
}
|
||||
if (*(place = nargv[optind]) != '-' ||
|
||||
(place[1] == '\0' && strchr(options, '-') == NULL)) {
|
||||
place = EMSG; /* found non-option */
|
||||
if (flags & FLAG_ALLARGS) {
|
||||
/*
|
||||
* GNU extension:
|
||||
* return non-option as argument to option 1
|
||||
*/
|
||||
optarg = nargv[optind++];
|
||||
return (INORDER);
|
||||
}
|
||||
if (!(flags & FLAG_PERMUTE)) {
|
||||
/*
|
||||
* If no permutation wanted, stop parsing
|
||||
* at first non-option.
|
||||
*/
|
||||
return (-1);
|
||||
}
|
||||
/* do permutation */
|
||||
if (nonopt_start == -1)
|
||||
nonopt_start = optind;
|
||||
else if (nonopt_end != -1) {
|
||||
permute_args(nonopt_start, nonopt_end,
|
||||
optind, nargv);
|
||||
nonopt_start = optind -
|
||||
(nonopt_end - nonopt_start);
|
||||
nonopt_end = -1;
|
||||
}
|
||||
optind++;
|
||||
/* process next argument */
|
||||
goto start;
|
||||
}
|
||||
if (nonopt_start != -1 && nonopt_end == -1)
|
||||
nonopt_end = optind;
|
||||
|
||||
/*
|
||||
* If we have "-" do nothing, if "--" we are done.
|
||||
*/
|
||||
if (place[1] != '\0' && *++place == '-' && place[1] == '\0') {
|
||||
optind++;
|
||||
place = EMSG;
|
||||
/*
|
||||
* We found an option (--), so if we skipped
|
||||
* non-options, we have to permute.
|
||||
*/
|
||||
if (nonopt_end != -1) {
|
||||
permute_args(nonopt_start, nonopt_end,
|
||||
optind, nargv);
|
||||
optind -= nonopt_end - nonopt_start;
|
||||
}
|
||||
nonopt_start = nonopt_end = -1;
|
||||
return (-1);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Check long options if:
|
||||
* 1) we were passed some
|
||||
* 2) the arg is not just "-"
|
||||
* 3) either the arg starts with -- we are getopt_long_only()
|
||||
*/
|
||||
if (long_options != NULL && place != nargv[optind] &&
|
||||
(*place == '-' || (flags & FLAG_LONGONLY))) {
|
||||
short_too = 0;
|
||||
if (*place == '-')
|
||||
place++; /* --foo long option */
|
||||
else if (*place != ':' && strchr(options, *place) != NULL)
|
||||
short_too = 1; /* could be short option too */
|
||||
|
||||
optchar = parse_long_options(nargv, options, long_options,
|
||||
idx, short_too);
|
||||
if (optchar != -1) {
|
||||
place = EMSG;
|
||||
return (optchar);
|
||||
}
|
||||
}
|
||||
|
||||
if ((optchar = (int)*place++) == (int)':' ||
|
||||
(optchar == (int)'-' && *place != '\0') ||
|
||||
(oli = strchr(options, optchar)) == NULL) {
|
||||
/*
|
||||
* If the user specified "-" and '-' isn't listed in
|
||||
* options, return -1 (non-option) as per POSIX.
|
||||
* Otherwise, it is an unknown option character (or ':').
|
||||
*/
|
||||
if (optchar == (int)'-' && *place == '\0')
|
||||
return (-1);
|
||||
if (!*place)
|
||||
++optind;
|
||||
if (PRINT_ERROR)
|
||||
fprintf(stderr, illoptchar, optchar);
|
||||
optopt = optchar;
|
||||
return (BADCH);
|
||||
}
|
||||
if (long_options != NULL && optchar == 'W' && oli[1] == ';') {
|
||||
/* -W long-option */
|
||||
if (*place) /* no space */
|
||||
/* NOTHING */;
|
||||
else if (++optind >= nargc) { /* no arg */
|
||||
place = EMSG;
|
||||
if (PRINT_ERROR)
|
||||
fprintf(stderr, recargchar, optchar);
|
||||
optopt = optchar;
|
||||
return (BADARG);
|
||||
} else /* white space */
|
||||
place = nargv[optind];
|
||||
optchar = parse_long_options(nargv, options, long_options,
|
||||
idx, 0);
|
||||
place = EMSG;
|
||||
return (optchar);
|
||||
}
|
||||
if (*++oli != ':') { /* doesn't take argument */
|
||||
if (!*place)
|
||||
++optind;
|
||||
} else { /* takes (optional) argument */
|
||||
optarg = NULL;
|
||||
if (*place) /* no white space */
|
||||
optarg = place;
|
||||
else if (oli[1] != ':') { /* arg not optional */
|
||||
if (++optind >= nargc) { /* no arg */
|
||||
place = EMSG;
|
||||
if (PRINT_ERROR)
|
||||
fprintf(stderr, recargchar, optchar);
|
||||
optopt = optchar;
|
||||
return (BADARG);
|
||||
} else
|
||||
optarg = nargv[optind];
|
||||
}
|
||||
place = EMSG;
|
||||
++optind;
|
||||
}
|
||||
/* dump back option letter */
|
||||
return (optchar);
|
||||
}
|
||||
|
||||
/*
|
||||
* getopt --
|
||||
* Parse argc/argv argument vector.
|
||||
*
|
||||
* [eventually this will replace the BSD getopt]
|
||||
*/
|
||||
int
|
||||
getopt(int nargc, char * const *nargv, const char *options)
|
||||
{
|
||||
|
||||
/*
|
||||
* We don't pass FLAG_PERMUTE to getopt_internal() since
|
||||
* the BSD getopt(3) (unlike GNU) has never done this.
|
||||
*
|
||||
* Furthermore, since many privileged programs call getopt()
|
||||
* before dropping privileges it makes sense to keep things
|
||||
* as simple (and bug-free) as possible.
|
||||
*/
|
||||
return (getopt_internal(nargc, nargv, options, NULL, NULL, 0));
|
||||
}
|
||||
|
||||
/*
|
||||
* getopt_long --
|
||||
* Parse argc/argv argument vector.
|
||||
*/
|
||||
int
|
||||
getopt_long(int nargc, char * const *nargv, const char *options,
|
||||
const struct option *long_options, int *idx)
|
||||
{
|
||||
|
||||
return (getopt_internal(nargc, nargv, options, long_options, idx,
|
||||
FLAG_PERMUTE));
|
||||
}
|
||||
|
||||
/*
|
||||
* getopt_long_only --
|
||||
* Parse argc/argv argument vector.
|
||||
*/
|
||||
int
|
||||
getopt_long_only(int nargc, char * const *nargv, const char *options,
|
||||
const struct option *long_options, int *idx)
|
||||
{
|
||||
|
||||
return (getopt_internal(nargc, nargv, options, long_options, idx,
|
||||
FLAG_PERMUTE|FLAG_LONGONLY));
|
||||
}
|
|
@ -1,8 +0,0 @@
|
|||
glsl_compiler
|
||||
glsl_parser.output
|
||||
builtincompiler
|
||||
glsl_test
|
||||
subtest-cr/
|
||||
subtest-lf/
|
||||
subtest-cr-lf/
|
||||
subtest-lf-cr/
|
|
@ -1,228 +0,0 @@
|
|||
Welcome to Mesa's GLSL compiler. A brief overview of how things flow:
|
||||
|
||||
1) lex and yacc-based preprocessor takes the incoming shader string
|
||||
and produces a new string containing the preprocessed shader. This
|
||||
takes care of things like #if, #ifdef, #define, and preprocessor macro
|
||||
invocations. Note that #version, #extension, and some others are
|
||||
passed straight through. See glcpp/*
|
||||
|
||||
2) lex and yacc-based parser takes the preprocessed string and
|
||||
generates the AST (abstract syntax tree). Almost no checking is
|
||||
performed in this stage. See glsl_lexer.lpp and glsl_parser.ypp.
|
||||
|
||||
3) The AST is converted to "HIR". This is the intermediate
|
||||
representation of the compiler. Constructors are generated, function
|
||||
calls are resolved to particular function signatures, and all the
|
||||
semantic checking is performed. See ast_*.cpp for the conversion, and
|
||||
ir.h for the IR structures.
|
||||
|
||||
4) The driver (Mesa, or main.cpp for the standalone binary) performs
|
||||
optimizations. These include copy propagation, dead code elimination,
|
||||
constant folding, and others. Generally the driver will call
|
||||
optimizations in a loop, as each may open up opportunities for other
|
||||
optimizations to do additional work. See most files called ir_*.cpp
|
||||
|
||||
5) linking is performed. This does checking to ensure that the
|
||||
outputs of the vertex shader match the inputs of the fragment shader,
|
||||
and assigns locations to uniforms, attributes, and varyings. See
|
||||
linker.cpp.
|
||||
|
||||
6) The driver may perform additional optimization at this point, as
|
||||
for example dead code elimination previously couldn't remove functions
|
||||
or global variable usage when we didn't know what other code would be
|
||||
linked in.
|
||||
|
||||
7) The driver performs code generation out of the IR, taking a linked
|
||||
shader program and producing a compiled program for each stage. See
|
||||
ir_to_mesa.cpp for Mesa IR code generation.
|
||||
|
||||
FAQ:
|
||||
|
||||
Q: What is HIR versus IR versus LIR?
|
||||
|
||||
A: The idea behind the naming was that ast_to_hir would produce a
|
||||
high-level IR ("HIR"), with things like matrix operations, structure
|
||||
assignments, etc., present. A series of lowering passes would occur
|
||||
that do things like break matrix multiplication into a series of dot
|
||||
products/MADs, make structure assignment be a series of assignment of
|
||||
components, flatten if statements into conditional moves, and such,
|
||||
producing a low level IR ("LIR").
|
||||
|
||||
However, it now appears that each driver will have different
|
||||
requirements from a LIR. A 915-generation chipset wants all functions
|
||||
inlined, all loops unrolled, all ifs flattened, no variable array
|
||||
accesses, and matrix multiplication broken down. The Mesa IR backend
|
||||
for swrast would like matrices and structure assignment broken down,
|
||||
but it can support function calls and dynamic branching. A 965 vertex
|
||||
shader IR backend could potentially even handle some matrix operations
|
||||
without breaking them down, but the 965 fragment shader IR backend
|
||||
would want to break to have (almost) all operations down channel-wise
|
||||
and perform optimization on that. As a result, there's no single
|
||||
low-level IR that will make everyone happy. So that usage has fallen
|
||||
out of favor, and each driver will perform a series of lowering passes
|
||||
to take the HIR down to whatever restrictions it wants to impose
|
||||
before doing codegen.
|
||||
|
||||
Q: How is the IR structured?
|
||||
|
||||
A: The best way to get started seeing it would be to run the
|
||||
standalone compiler against a shader:
|
||||
|
||||
./glsl_compiler --dump-lir \
|
||||
~/src/piglit/tests/shaders/glsl-orangebook-ch06-bump.frag
|
||||
|
||||
So for example one of the ir_instructions in main() contains:
|
||||
|
||||
(assign (constant bool (1)) (var_ref litColor) (expression vec3 * (var_ref Surf
|
||||
aceColor) (var_ref __retval) ) )
|
||||
|
||||
Or more visually:
|
||||
(assign)
|
||||
/ | \
|
||||
(var_ref) (expression *) (constant bool 1)
|
||||
/ / \
|
||||
(litColor) (var_ref) (var_ref)
|
||||
/ \
|
||||
(SurfaceColor) (__retval)
|
||||
|
||||
which came from:
|
||||
|
||||
litColor = SurfaceColor * max(dot(normDelta, LightDir), 0.0);
|
||||
|
||||
(the max call is not represented in this expression tree, as it was a
|
||||
function call that got inlined but not brought into this expression
|
||||
tree)
|
||||
|
||||
Each of those nodes is a subclass of ir_instruction. A particular
|
||||
ir_instruction instance may only appear once in the whole IR tree with
|
||||
the exception of ir_variables, which appear once as variable
|
||||
declarations:
|
||||
|
||||
(declare () vec3 normDelta)
|
||||
|
||||
and multiple times as the targets of variable dereferences:
|
||||
...
|
||||
(assign (constant bool (1)) (var_ref __retval) (expression float dot
|
||||
(var_ref normDelta) (var_ref LightDir) ) )
|
||||
...
|
||||
(assign (constant bool (1)) (var_ref __retval) (expression vec3 -
|
||||
(var_ref LightDir) (expression vec3 * (constant float (2.000000))
|
||||
(expression vec3 * (expression float dot (var_ref normDelta) (var_ref
|
||||
LightDir) ) (var_ref normDelta) ) ) ) )
|
||||
...
|
||||
|
||||
Each node has a type. Expressions may involve several different types:
|
||||
(declare (uniform ) mat4 gl_ModelViewMatrix)
|
||||
((assign (constant bool (1)) (var_ref constructor_tmp) (expression
|
||||
vec4 * (var_ref gl_ModelViewMatrix) (var_ref gl_Vertex) ) )
|
||||
|
||||
An expression tree can be arbitrarily deep, and the compiler tries to
|
||||
keep them structured like that so that things like algebraic
|
||||
optimizations ((color * 1.0 == color) and ((mat1 * mat2) * vec == mat1
|
||||
* (mat2 * vec))) or recognizing operation patterns for code generation
|
||||
(vec1 * vec2 + vec3 == mad(vec1, vec2, vec3)) are easier. This comes
|
||||
at the expense of additional trickery in implementing some
|
||||
optimizations like CSE where one must navigate an expression tree.
|
||||
|
||||
Q: Why no SSA representation?
|
||||
|
||||
A: Converting an IR tree to SSA form makes dead code elmimination,
|
||||
common subexpression elimination, and many other optimizations much
|
||||
easier. However, in our primarily vector-based language, there's some
|
||||
major questions as to how it would work. Do we do SSA on the scalar
|
||||
or vector level? If we do it at the vector level, we're going to end
|
||||
up with many different versions of the variable when encountering code
|
||||
like:
|
||||
|
||||
(assign (constant bool (1)) (swiz x (var_ref __retval) ) (var_ref a) )
|
||||
(assign (constant bool (1)) (swiz y (var_ref __retval) ) (var_ref b) )
|
||||
(assign (constant bool (1)) (swiz z (var_ref __retval) ) (var_ref c) )
|
||||
|
||||
If every masked update of a component relies on the previous value of
|
||||
the variable, then we're probably going to be quite limited in our
|
||||
dead code elimination wins, and recognizing common expressions may
|
||||
just not happen. On the other hand, if we operate channel-wise, then
|
||||
we'll be prone to optimizing the operation on one of the channels at
|
||||
the expense of making its instruction flow different from the other
|
||||
channels, and a vector-based GPU would end up with worse code than if
|
||||
we didn't optimize operations on that channel!
|
||||
|
||||
Once again, it appears that our optimization requirements are driven
|
||||
significantly by the target architecture. For now, targeting the Mesa
|
||||
IR backend, SSA does not appear to be that important to producing
|
||||
excellent code, but we do expect to do some SSA-based optimizations
|
||||
for the 965 fragment shader backend when that is developed.
|
||||
|
||||
Q: How should I expand instructions that take multiple backend instructions?
|
||||
|
||||
Sometimes you'll have to do the expansion in your code generation --
|
||||
see, for example, ir_to_mesa.cpp's handling of ir_unop_sqrt. However,
|
||||
in many cases you'll want to do a pass over the IR to convert
|
||||
non-native instructions to a series of native instructions. For
|
||||
example, for the Mesa backend we have ir_div_to_mul_rcp.cpp because
|
||||
Mesa IR (and many hardware backends) only have a reciprocal
|
||||
instruction, not a divide. Implementing non-native instructions this
|
||||
way gives the chance for constant folding to occur, so (a / 2.0)
|
||||
becomes (a * 0.5) after codegen instead of (a * (1.0 / 2.0))
|
||||
|
||||
Q: How shoud I handle my special hardware instructions with respect to IR?
|
||||
|
||||
Our current theory is that if multiple targets have an instruction for
|
||||
some operation, then we should probably be able to represent that in
|
||||
the IR. Generally this is in the form of an ir_{bin,un}op expression
|
||||
type. For example, we initially implemented fract() using (a -
|
||||
floor(a)), but both 945 and 965 have instructions to give that result,
|
||||
and it would also simplify the implementation of mod(), so
|
||||
ir_unop_fract was added. The following areas need updating to add a
|
||||
new expression type:
|
||||
|
||||
ir.h (new enum)
|
||||
ir.cpp:operator_strs (used for ir_reader)
|
||||
ir_constant_expression.cpp (you probably want to be able to constant fold)
|
||||
ir_validate.cpp (check users have the right types)
|
||||
|
||||
You may also need to update the backends if they will see the new expr type:
|
||||
|
||||
../mesa/shaders/ir_to_mesa.cpp
|
||||
|
||||
You can then use the new expression from builtins (if all backends
|
||||
would rather see it), or scan the IR and convert to use your new
|
||||
expression type (see ir_mod_to_fract, for example).
|
||||
|
||||
Q: How is memory management handled in the compiler?
|
||||
|
||||
The hierarchical memory allocator "talloc" developed for the Samba
|
||||
project is used, so that things like optimization passes don't have to
|
||||
worry about their garbage collection so much. It has a few nice
|
||||
features, including low performance overhead and good debugging
|
||||
support that's trivially available.
|
||||
|
||||
Generally, each stage of the compile creates a talloc context and
|
||||
allocates its memory out of that or children of it. At the end of the
|
||||
stage, the pieces still live are stolen to a new context and the old
|
||||
one freed, or the whole context is kept for use by the next stage.
|
||||
|
||||
For IR transformations, a temporary context is used, then at the end
|
||||
of all transformations, reparent_ir reparents all live nodes under the
|
||||
shader's IR list, and the old context full of dead nodes is freed.
|
||||
When developing a single IR transformation pass, this means that you
|
||||
want to allocate instruction nodes out of the temporary context, so if
|
||||
it becomes dead it doesn't live on as the child of a live node. At
|
||||
the moment, optimization passes aren't passed that temporary context,
|
||||
so they find it by calling talloc_parent() on a nearby IR node. The
|
||||
talloc_parent() call is expensive, so many passes will cache the
|
||||
result of the first talloc_parent(). Cleaning up all the optimization
|
||||
passes to take a context argument and not call talloc_parent() is left
|
||||
as an exercise.
|
||||
|
||||
Q: What is the file naming convention in this directory?
|
||||
|
||||
Initially, there really wasn't one. We have since adopted one:
|
||||
|
||||
- Files that implement code lowering passes should be named lower_*
|
||||
(e.g., lower_noise.cpp).
|
||||
- Files that implement optimization passes should be named opt_*.
|
||||
- Files that implement a class that is used throught the code should
|
||||
take the name of that class (e.g., ir_hierarchical_visitor.cpp).
|
||||
- Files that contain code not fitting in one of the previous
|
||||
categories should have a sensible name (e.g., glsl_parser.ypp).
|
|
@ -1,112 +0,0 @@
|
|||
import common
|
||||
|
||||
Import('*')
|
||||
|
||||
from sys import executable as python_cmd
|
||||
|
||||
env = env.Clone()
|
||||
|
||||
env.Prepend(CPPPATH = [
|
||||
'#include',
|
||||
'#src',
|
||||
'#src/mapi',
|
||||
'#src/mesa',
|
||||
'#src/glsl',
|
||||
'#src/glsl/glcpp',
|
||||
])
|
||||
|
||||
env.Prepend(LIBS = [mesautil])
|
||||
|
||||
# Make glcpp-parse.h and glsl_parser.h reachable from the include path.
|
||||
env.Append(CPPPATH = [Dir('.').abspath, Dir('glcpp').abspath])
|
||||
|
||||
env.Append(YACCFLAGS = '-d -p "glcpp_parser_"')
|
||||
|
||||
parser_env = env.Clone()
|
||||
parser_env.Append(YACCFLAGS = [
|
||||
'--defines=%s' % File('glsl_parser.h').abspath,
|
||||
'-p', '_mesa_glsl_',
|
||||
])
|
||||
|
||||
# without this line scons will expect "glsl_parser.hpp" instead of
|
||||
# "glsl_parser.h", causing glsl_parser.cpp to be regenerated every time
|
||||
parser_env['YACCHXXFILESUFFIX'] = '.h'
|
||||
|
||||
glcpp_lexer = env.CFile('glcpp/glcpp-lex.c', 'glcpp/glcpp-lex.l')
|
||||
glcpp_parser = env.CFile('glcpp/glcpp-parse.c', 'glcpp/glcpp-parse.y')
|
||||
glsl_lexer = parser_env.CXXFile('glsl_lexer.cpp', 'glsl_lexer.ll')
|
||||
glsl_parser = parser_env.CXXFile('glsl_parser.cpp', 'glsl_parser.yy')
|
||||
|
||||
# common generated sources
|
||||
glsl_sources = [
|
||||
glcpp_lexer,
|
||||
glcpp_parser[0],
|
||||
glsl_lexer,
|
||||
glsl_parser[0],
|
||||
]
|
||||
|
||||
# parse Makefile.sources
|
||||
source_lists = env.ParseSourceList('Makefile.sources')
|
||||
|
||||
# add non-generated sources
|
||||
for l in ('LIBGLCPP_FILES', 'LIBGLSL_FILES'):
|
||||
glsl_sources += source_lists[l]
|
||||
|
||||
if env['msvc']:
|
||||
env.Prepend(CPPPATH = ['#/src/getopt'])
|
||||
env.PrependUnique(LIBS = [getopt])
|
||||
|
||||
# Copy these files to avoid generation object files into src/mesa/program
|
||||
env.Prepend(CPPPATH = ['#src/mesa/main'])
|
||||
env.Command('imports.c', '#src/mesa/main/imports.c', Copy('$TARGET', '$SOURCE'))
|
||||
# Copy these files to avoid generation object files into src/mesa/program
|
||||
env.Prepend(CPPPATH = ['#src/mesa/program'])
|
||||
env.Command('prog_hash_table.c', '#src/mesa/program/prog_hash_table.c', Copy('$TARGET', '$SOURCE'))
|
||||
env.Command('symbol_table.c', '#src/mesa/program/symbol_table.c', Copy('$TARGET', '$SOURCE'))
|
||||
|
||||
compiler_objs = env.StaticObject(source_lists['GLSL_COMPILER_CXX_FILES'])
|
||||
|
||||
mesa_objs = env.StaticObject([
|
||||
'imports.c',
|
||||
'prog_hash_table.c',
|
||||
'symbol_table.c',
|
||||
])
|
||||
|
||||
compiler_objs += mesa_objs
|
||||
|
||||
glsl = env.ConvenienceLibrary(
|
||||
target = 'glsl',
|
||||
source = glsl_sources,
|
||||
)
|
||||
|
||||
# SCons builtin dependency scanner doesn't detect that glsl_lexer.ll depends on
|
||||
# glsl_parser.h
|
||||
env.Depends(glsl, glsl_parser)
|
||||
|
||||
Export('glsl')
|
||||
|
||||
# Skip building these programs as they will cause SCons error "Two environments
|
||||
# with different actions were specified for the same target"
|
||||
if env['crosscompile'] or env['embedded']:
|
||||
Return()
|
||||
|
||||
env = env.Clone()
|
||||
|
||||
if env['platform'] == 'windows':
|
||||
env.PrependUnique(LIBS = [
|
||||
'user32',
|
||||
])
|
||||
|
||||
env.Prepend(LIBS = [glsl])
|
||||
|
||||
glsl_compiler = env.Program(
|
||||
target = 'glsl_compiler',
|
||||
source = compiler_objs,
|
||||
)
|
||||
env.Alias('glsl_compiler', glsl_compiler)
|
||||
|
||||
glcpp = env.Program(
|
||||
target = 'glcpp/glcpp',
|
||||
source = ['glcpp/glcpp.c', 'tests/common.c'] + mesa_objs,
|
||||
)
|
||||
env.Alias('glcpp', glcpp)
|
|
@ -1,12 +0,0 @@
|
|||
- Detect code paths in non-void functions that don't reach a return statement
|
||||
|
||||
- Improve handling of constants and their initializers. Constant initializers
|
||||
should never generate any code. This is trival for scalar constants. It is
|
||||
also trivial for arrays, matrices, and vectors that are accessed with
|
||||
constant index values. For others it is more complicated. Perhaps these
|
||||
cases should be silently converted to uniforms?
|
||||
|
||||
- Track source locations throughout the IR. There are currently several
|
||||
places where we cannot emit line numbers for errors (and currently emit 0:0)
|
||||
because we've "lost" the line number information. This is particularly
|
||||
noticeable at link time.
|
File diff suppressed because it is too large
Load Diff
|
@ -1,268 +0,0 @@
|
|||
/*
|
||||
* Copyright © 2010 Intel Corporation
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the next
|
||||
* paragraph) shall be included in all copies or substantial portions of the
|
||||
* Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "ast.h"
|
||||
#include "glsl_types.h"
|
||||
#include "ir.h"
|
||||
|
||||
void
|
||||
ast_array_specifier::print(void) const
|
||||
{
|
||||
if (this->is_unsized_array) {
|
||||
printf("[ ] ");
|
||||
}
|
||||
|
||||
foreach_list_typed (ast_node, array_dimension, link, &this->array_dimensions) {
|
||||
printf("[ ");
|
||||
array_dimension->print();
|
||||
printf("] ");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* If \c ir is a reference to an array for which we are tracking the max array
|
||||
* element accessed, track that the given element has been accessed.
|
||||
* Otherwise do nothing.
|
||||
*
|
||||
* This function also checks whether the array is a built-in array whose
|
||||
* maximum size is too small to accommodate the given index, and if so uses
|
||||
* loc and state to report the error.
|
||||
*/
|
||||
static void
|
||||
update_max_array_access(ir_rvalue *ir, unsigned idx, YYLTYPE *loc,
|
||||
struct _mesa_glsl_parse_state *state)
|
||||
{
|
||||
if (ir_dereference_variable *deref_var = ir->as_dereference_variable()) {
|
||||
ir_variable *var = deref_var->var;
|
||||
if (idx > var->data.max_array_access) {
|
||||
var->data.max_array_access = idx;
|
||||
|
||||
/* Check whether this access will, as a side effect, implicitly cause
|
||||
* the size of a built-in array to be too large.
|
||||
*/
|
||||
check_builtin_array_max_size(var->name, idx+1, *loc, state);
|
||||
}
|
||||
} else if (ir_dereference_record *deref_record =
|
||||
ir->as_dereference_record()) {
|
||||
/* There are two possibilities we need to consider:
|
||||
*
|
||||
* - Accessing an element of an array that is a member of a named
|
||||
* interface block (e.g. ifc.foo[i])
|
||||
*
|
||||
* - Accessing an element of an array that is a member of a named
|
||||
* interface block array (e.g. ifc[j].foo[i]).
|
||||
*/
|
||||
ir_dereference_variable *deref_var =
|
||||
deref_record->record->as_dereference_variable();
|
||||
if (deref_var == NULL) {
|
||||
if (ir_dereference_array *deref_array =
|
||||
deref_record->record->as_dereference_array()) {
|
||||
deref_var = deref_array->array->as_dereference_variable();
|
||||
}
|
||||
}
|
||||
|
||||
if (deref_var != NULL) {
|
||||
if (deref_var->var->is_interface_instance()) {
|
||||
const glsl_type *interface_type =
|
||||
deref_var->var->get_interface_type();
|
||||
unsigned field_index =
|
||||
deref_record->record->type->field_index(deref_record->field);
|
||||
assert(field_index < interface_type->length);
|
||||
|
||||
unsigned *const max_ifc_array_access =
|
||||
deref_var->var->get_max_ifc_array_access();
|
||||
|
||||
assert(max_ifc_array_access != NULL);
|
||||
|
||||
if (idx > max_ifc_array_access[field_index]) {
|
||||
max_ifc_array_access[field_index] = idx;
|
||||
|
||||
/* Check whether this access will, as a side effect, implicitly
|
||||
* cause the size of a built-in array to be too large.
|
||||
*/
|
||||
check_builtin_array_max_size(deref_record->field, idx+1, *loc,
|
||||
state);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
ir_rvalue *
|
||||
_mesa_ast_array_index_to_hir(void *mem_ctx,
|
||||
struct _mesa_glsl_parse_state *state,
|
||||
ir_rvalue *array, ir_rvalue *idx,
|
||||
YYLTYPE &loc, YYLTYPE &idx_loc)
|
||||
{
|
||||
if (!array->type->is_error()
|
||||
&& !array->type->is_array()
|
||||
&& !array->type->is_matrix()
|
||||
&& !array->type->is_vector()) {
|
||||
_mesa_glsl_error(& idx_loc, state,
|
||||
"cannot dereference non-array / non-matrix / "
|
||||
"non-vector");
|
||||
}
|
||||
|
||||
if (!idx->type->is_error()) {
|
||||
if (!idx->type->is_integer()) {
|
||||
_mesa_glsl_error(& idx_loc, state, "array index must be integer type");
|
||||
} else if (!idx->type->is_scalar()) {
|
||||
_mesa_glsl_error(& idx_loc, state, "array index must be scalar");
|
||||
}
|
||||
}
|
||||
|
||||
/* If the array index is a constant expression and the array has a
|
||||
* declared size, ensure that the access is in-bounds. If the array
|
||||
* index is not a constant expression, ensure that the array has a
|
||||
* declared size.
|
||||
*/
|
||||
ir_constant *const const_index = idx->constant_expression_value();
|
||||
if (const_index != NULL && idx->type->is_integer()) {
|
||||
const int idx = const_index->value.i[0];
|
||||
const char *type_name = "error";
|
||||
unsigned bound = 0;
|
||||
|
||||
/* From page 24 (page 30 of the PDF) of the GLSL 1.50 spec:
|
||||
*
|
||||
* "It is illegal to declare an array with a size, and then
|
||||
* later (in the same shader) index the same array with an
|
||||
* integral constant expression greater than or equal to the
|
||||
* declared size. It is also illegal to index an array with a
|
||||
* negative constant expression."
|
||||
*/
|
||||
if (array->type->is_matrix()) {
|
||||
if (array->type->row_type()->vector_elements <= (unsigned)idx) {
|
||||
type_name = "matrix";
|
||||
bound = array->type->row_type()->vector_elements;
|
||||
}
|
||||
} else if (array->type->is_vector()) {
|
||||
if (array->type->vector_elements <= (unsigned)idx) {
|
||||
type_name = "vector";
|
||||
bound = array->type->vector_elements;
|
||||
}
|
||||
} else {
|
||||
/* glsl_type::array_size() returns -1 for non-array types. This means
|
||||
* that we don't need to verify that the type is an array before
|
||||
* doing the bounds checking.
|
||||
*/
|
||||
if ((array->type->array_size() > 0)
|
||||
&& (array->type->array_size() <= idx)) {
|
||||
type_name = "array";
|
||||
bound = array->type->array_size();
|
||||
}
|
||||
}
|
||||
|
||||
if (bound > 0) {
|
||||
_mesa_glsl_error(& loc, state, "%s index must be < %u",
|
||||
type_name, bound);
|
||||
} else if (idx < 0) {
|
||||
_mesa_glsl_error(& loc, state, "%s index must be >= 0",
|
||||
type_name);
|
||||
}
|
||||
|
||||
if (array->type->is_array())
|
||||
update_max_array_access(array, idx, &loc, state);
|
||||
} else if (const_index == NULL && array->type->is_array()) {
|
||||
if (array->type->is_unsized_array()) {
|
||||
_mesa_glsl_error(&loc, state, "unsized array index must be constant");
|
||||
} else if (array->type->fields.array->is_interface()
|
||||
&& array->variable_referenced()->data.mode == ir_var_uniform
|
||||
&& !state->is_version(400, 0) && !state->ARB_gpu_shader5_enable) {
|
||||
/* Page 46 in section 4.3.7 of the OpenGL ES 3.00 spec says:
|
||||
*
|
||||
* "All indexes used to index a uniform block array must be
|
||||
* constant integral expressions."
|
||||
*/
|
||||
_mesa_glsl_error(&loc, state,
|
||||
"uniform block array index must be constant");
|
||||
} else {
|
||||
/* whole_variable_referenced can return NULL if the array is a
|
||||
* member of a structure. In this case it is safe to not update
|
||||
* the max_array_access field because it is never used for fields
|
||||
* of structures.
|
||||
*/
|
||||
ir_variable *v = array->whole_variable_referenced();
|
||||
if (v != NULL)
|
||||
v->data.max_array_access = array->type->array_size() - 1;
|
||||
}
|
||||
|
||||
/* From page 23 (29 of the PDF) of the GLSL 1.30 spec:
|
||||
*
|
||||
* "Samplers aggregated into arrays within a shader (using square
|
||||
* brackets [ ]) can only be indexed with integral constant
|
||||
* expressions [...]."
|
||||
*
|
||||
* This restriction was added in GLSL 1.30. Shaders using earlier
|
||||
* version of the language should not be rejected by the compiler
|
||||
* front-end for using this construct. This allows useful things such
|
||||
* as using a loop counter as the index to an array of samplers. If the
|
||||
* loop in unrolled, the code should compile correctly. Instead, emit a
|
||||
* warning.
|
||||
*
|
||||
* In GLSL 4.00 / ARB_gpu_shader5, this requirement is relaxed again to allow
|
||||
* indexing with dynamically uniform expressions. Note that these are not
|
||||
* required to be uniforms or expressions based on them, but merely that the
|
||||
* values must not diverge between shader invocations run together. If the
|
||||
* values *do* diverge, then the behavior of the operation requiring a
|
||||
* dynamically uniform expression is undefined.
|
||||
*/
|
||||
if (array->type->element_type()->is_sampler()) {
|
||||
if (!state->is_version(130, 100)) {
|
||||
if (state->es_shader) {
|
||||
_mesa_glsl_warning(&loc, state,
|
||||
"sampler arrays indexed with non-constant "
|
||||
"expressions is optional in %s",
|
||||
state->get_version_string());
|
||||
} else {
|
||||
_mesa_glsl_warning(&loc, state,
|
||||
"sampler arrays indexed with non-constant "
|
||||
"expressions will be forbidden in GLSL 1.30 "
|
||||
"and later");
|
||||
}
|
||||
} else if (!state->is_version(400, 0) && !state->ARB_gpu_shader5_enable) {
|
||||
_mesa_glsl_error(&loc, state,
|
||||
"sampler arrays indexed with non-constant "
|
||||
"expressions is forbidden in GLSL 1.30 and "
|
||||
"later");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* After performing all of the error checking, generate the IR for the
|
||||
* expression.
|
||||
*/
|
||||
if (array->type->is_array()
|
||||
|| array->type->is_matrix()) {
|
||||
return new(mem_ctx) ir_dereference_array(array, idx);
|
||||
} else if (array->type->is_vector()) {
|
||||
return new(mem_ctx) ir_expression(ir_binop_vector_extract, array, idx);
|
||||
} else if (array->type->is_error()) {
|
||||
return array;
|
||||
} else {
|
||||
ir_rvalue *result = new(mem_ctx) ir_dereference_array(array, idx);
|
||||
result->type = glsl_type::error_type;
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
|
@ -1,95 +0,0 @@
|
|||
/*
|
||||
* Copyright © 2010 Intel Corporation
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the next
|
||||
* paragraph) shall be included in all copies or substantial portions of the
|
||||
* Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
#include <assert.h>
|
||||
#include "ast.h"
|
||||
|
||||
const char *
|
||||
ast_expression::operator_string(enum ast_operators op)
|
||||
{
|
||||
static const char *const operators[] = {
|
||||
"=",
|
||||
"+",
|
||||
"-",
|
||||
"+",
|
||||
"-",
|
||||
"*",
|
||||
"/",
|
||||
"%",
|
||||
"<<",
|
||||
">>",
|
||||
"<",
|
||||
">",
|
||||
"<=",
|
||||
">=",
|
||||
"==",
|
||||
"!=",
|
||||
"&",
|
||||
"^",
|
||||
"|",
|
||||
"~",
|
||||
"&&",
|
||||
"^^",
|
||||
"||",
|
||||
"!",
|
||||
|
||||
"*=",
|
||||
"/=",
|
||||
"%=",
|
||||
"+=",
|
||||
"-=",
|
||||
"<<=",
|
||||
">>=",
|
||||
"&=",
|
||||
"^=",
|
||||
"|=",
|
||||
|
||||
"?:",
|
||||
|
||||
"++",
|
||||
"--",
|
||||
"++",
|
||||
"--",
|
||||
".",
|
||||
};
|
||||
|
||||
assert((unsigned int)op < sizeof(operators) / sizeof(operators[0]));
|
||||
|
||||
return operators[op];
|
||||
}
|
||||
|
||||
|
||||
ast_expression_bin::ast_expression_bin(int oper, ast_expression *ex0,
|
||||
ast_expression *ex1) :
|
||||
ast_expression(oper, ex0, ex1, NULL)
|
||||
{
|
||||
assert((oper >= ast_plus) && (oper <= ast_logic_not));
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
ast_expression_bin::print(void) const
|
||||
{
|
||||
subexpressions[0]->print();
|
||||
printf("%s ", operator_string(oper));
|
||||
subexpressions[1]->print();
|
||||
}
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -1,363 +0,0 @@
|
|||
/*
|
||||
* Copyright © 2010 Intel Corporation
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the next
|
||||
* paragraph) shall be included in all copies or substantial portions of the
|
||||
* Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "ast.h"
|
||||
|
||||
void
|
||||
ast_type_specifier::print(void) const
|
||||
{
|
||||
if (structure) {
|
||||
structure->print();
|
||||
} else {
|
||||
printf("%s ", type_name);
|
||||
}
|
||||
|
||||
if (array_specifier) {
|
||||
array_specifier->print();
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
ast_fully_specified_type::has_qualifiers() const
|
||||
{
|
||||
return this->qualifier.flags.i != 0;
|
||||
}
|
||||
|
||||
bool ast_type_qualifier::has_interpolation() const
|
||||
{
|
||||
return this->flags.q.smooth
|
||||
|| this->flags.q.flat
|
||||
|| this->flags.q.noperspective;
|
||||
}
|
||||
|
||||
bool
|
||||
ast_type_qualifier::has_layout() const
|
||||
{
|
||||
return this->flags.q.origin_upper_left
|
||||
|| this->flags.q.pixel_center_integer
|
||||
|| this->flags.q.depth_any
|
||||
|| this->flags.q.depth_greater
|
||||
|| this->flags.q.depth_less
|
||||
|| this->flags.q.depth_unchanged
|
||||
|| this->flags.q.std140
|
||||
|| this->flags.q.shared
|
||||
|| this->flags.q.column_major
|
||||
|| this->flags.q.row_major
|
||||
|| this->flags.q.packed
|
||||
|| this->flags.q.explicit_location
|
||||
|| this->flags.q.explicit_index
|
||||
|| this->flags.q.explicit_binding
|
||||
|| this->flags.q.explicit_offset;
|
||||
}
|
||||
|
||||
bool
|
||||
ast_type_qualifier::has_storage() const
|
||||
{
|
||||
return this->flags.q.constant
|
||||
|| this->flags.q.attribute
|
||||
|| this->flags.q.varying
|
||||
|| this->flags.q.in
|
||||
|| this->flags.q.out
|
||||
|| this->flags.q.uniform;
|
||||
}
|
||||
|
||||
bool
|
||||
ast_type_qualifier::has_auxiliary_storage() const
|
||||
{
|
||||
return this->flags.q.centroid
|
||||
|| this->flags.q.sample;
|
||||
}
|
||||
|
||||
const char*
|
||||
ast_type_qualifier::interpolation_string() const
|
||||
{
|
||||
if (this->flags.q.smooth)
|
||||
return "smooth";
|
||||
else if (this->flags.q.flat)
|
||||
return "flat";
|
||||
else if (this->flags.q.noperspective)
|
||||
return "noperspective";
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bool
|
||||
ast_type_qualifier::merge_qualifier(YYLTYPE *loc,
|
||||
_mesa_glsl_parse_state *state,
|
||||
ast_type_qualifier q)
|
||||
{
|
||||
ast_type_qualifier ubo_mat_mask;
|
||||
ubo_mat_mask.flags.i = 0;
|
||||
ubo_mat_mask.flags.q.row_major = 1;
|
||||
ubo_mat_mask.flags.q.column_major = 1;
|
||||
|
||||
ast_type_qualifier ubo_layout_mask;
|
||||
ubo_layout_mask.flags.i = 0;
|
||||
ubo_layout_mask.flags.q.std140 = 1;
|
||||
ubo_layout_mask.flags.q.packed = 1;
|
||||
ubo_layout_mask.flags.q.shared = 1;
|
||||
|
||||
ast_type_qualifier ubo_binding_mask;
|
||||
ubo_binding_mask.flags.i = 0;
|
||||
ubo_binding_mask.flags.q.explicit_binding = 1;
|
||||
ubo_binding_mask.flags.q.explicit_offset = 1;
|
||||
|
||||
ast_type_qualifier stream_layout_mask;
|
||||
stream_layout_mask.flags.i = 0;
|
||||
stream_layout_mask.flags.q.stream = 1;
|
||||
|
||||
/* Uniform block layout qualifiers get to overwrite each
|
||||
* other (rightmost having priority), while all other
|
||||
* qualifiers currently don't allow duplicates.
|
||||
*/
|
||||
ast_type_qualifier allowed_duplicates_mask;
|
||||
allowed_duplicates_mask.flags.i =
|
||||
ubo_mat_mask.flags.i |
|
||||
ubo_layout_mask.flags.i |
|
||||
ubo_binding_mask.flags.i;
|
||||
|
||||
/* Geometry shaders can have several layout qualifiers
|
||||
* assigning different stream values.
|
||||
*/
|
||||
if (state->stage == MESA_SHADER_GEOMETRY)
|
||||
allowed_duplicates_mask.flags.i |=
|
||||
stream_layout_mask.flags.i;
|
||||
|
||||
if ((this->flags.i & q.flags.i & ~allowed_duplicates_mask.flags.i) != 0) {
|
||||
_mesa_glsl_error(loc, state,
|
||||
"duplicate layout qualifiers used");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (q.flags.q.prim_type) {
|
||||
if (this->flags.q.prim_type && this->prim_type != q.prim_type) {
|
||||
_mesa_glsl_error(loc, state,
|
||||
"conflicting primitive type qualifiers used");
|
||||
return false;
|
||||
}
|
||||
this->prim_type = q.prim_type;
|
||||
}
|
||||
|
||||
if (q.flags.q.max_vertices) {
|
||||
if (this->flags.q.max_vertices && this->max_vertices != q.max_vertices) {
|
||||
_mesa_glsl_error(loc, state,
|
||||
"geometry shader set conflicting max_vertices "
|
||||
"(%d and %d)", this->max_vertices, q.max_vertices);
|
||||
return false;
|
||||
}
|
||||
this->max_vertices = q.max_vertices;
|
||||
}
|
||||
|
||||
if (q.flags.q.invocations) {
|
||||
if (this->flags.q.invocations && this->invocations != q.invocations) {
|
||||
_mesa_glsl_error(loc, state,
|
||||
"geometry shader set conflicting invocations "
|
||||
"(%d and %d)", this->invocations, q.invocations);
|
||||
return false;
|
||||
}
|
||||
this->invocations = q.invocations;
|
||||
}
|
||||
|
||||
if (state->stage == MESA_SHADER_GEOMETRY &&
|
||||
state->has_explicit_attrib_stream()) {
|
||||
if (q.flags.q.stream && q.stream >= state->ctx->Const.MaxVertexStreams) {
|
||||
_mesa_glsl_error(loc, state,
|
||||
"`stream' value is larger than MAX_VERTEX_STREAMS - 1 "
|
||||
"(%d > %d)",
|
||||
q.stream, state->ctx->Const.MaxVertexStreams - 1);
|
||||
}
|
||||
if (this->flags.q.explicit_stream &&
|
||||
this->stream >= state->ctx->Const.MaxVertexStreams) {
|
||||
_mesa_glsl_error(loc, state,
|
||||
"`stream' value is larger than MAX_VERTEX_STREAMS - 1 "
|
||||
"(%d > %d)",
|
||||
this->stream, state->ctx->Const.MaxVertexStreams - 1);
|
||||
}
|
||||
|
||||
if (!this->flags.q.explicit_stream) {
|
||||
if (q.flags.q.stream) {
|
||||
this->flags.q.stream = 1;
|
||||
this->stream = q.stream;
|
||||
} else if (!this->flags.q.stream && this->flags.q.out) {
|
||||
/* Assign default global stream value */
|
||||
this->flags.q.stream = 1;
|
||||
this->stream = state->out_qualifier->stream;
|
||||
}
|
||||
} else {
|
||||
if (q.flags.q.explicit_stream) {
|
||||
_mesa_glsl_error(loc, state,
|
||||
"duplicate layout `stream' qualifier");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ((q.flags.i & ubo_mat_mask.flags.i) != 0)
|
||||
this->flags.i &= ~ubo_mat_mask.flags.i;
|
||||
if ((q.flags.i & ubo_layout_mask.flags.i) != 0)
|
||||
this->flags.i &= ~ubo_layout_mask.flags.i;
|
||||
|
||||
for (int i = 0; i < 3; i++) {
|
||||
if (q.flags.q.local_size & (1 << i)) {
|
||||
if ((this->flags.q.local_size & (1 << i)) &&
|
||||
this->local_size[i] != q.local_size[i]) {
|
||||
_mesa_glsl_error(loc, state,
|
||||
"compute shader set conflicting values for "
|
||||
"local_size_%c (%d and %d)", 'x' + i,
|
||||
this->local_size[i], q.local_size[i]);
|
||||
return false;
|
||||
}
|
||||
this->local_size[i] = q.local_size[i];
|
||||
}
|
||||
}
|
||||
|
||||
this->flags.i |= q.flags.i;
|
||||
|
||||
if (q.flags.q.explicit_location)
|
||||
this->location = q.location;
|
||||
|
||||
if (q.flags.q.explicit_index)
|
||||
this->index = q.index;
|
||||
|
||||
if (q.flags.q.explicit_binding)
|
||||
this->binding = q.binding;
|
||||
|
||||
if (q.flags.q.explicit_offset)
|
||||
this->offset = q.offset;
|
||||
|
||||
if (q.precision != ast_precision_none)
|
||||
this->precision = q.precision;
|
||||
|
||||
if (q.flags.q.explicit_image_format) {
|
||||
this->image_format = q.image_format;
|
||||
this->image_base_type = q.image_base_type;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
ast_type_qualifier::merge_in_qualifier(YYLTYPE *loc,
|
||||
_mesa_glsl_parse_state *state,
|
||||
ast_type_qualifier q,
|
||||
ast_node* &node)
|
||||
{
|
||||
void *mem_ctx = state;
|
||||
bool create_gs_ast = false;
|
||||
bool create_cs_ast = false;
|
||||
ast_type_qualifier valid_in_mask;
|
||||
valid_in_mask.flags.i = 0;
|
||||
|
||||
switch (state->stage) {
|
||||
case MESA_SHADER_GEOMETRY:
|
||||
if (q.flags.q.prim_type) {
|
||||
/* Make sure this is a valid input primitive type. */
|
||||
switch (q.prim_type) {
|
||||
case GL_POINTS:
|
||||
case GL_LINES:
|
||||
case GL_LINES_ADJACENCY:
|
||||
case GL_TRIANGLES:
|
||||
case GL_TRIANGLES_ADJACENCY:
|
||||
break;
|
||||
default:
|
||||
_mesa_glsl_error(loc, state,
|
||||
"invalid geometry shader input primitive type");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
create_gs_ast |=
|
||||
q.flags.q.prim_type &&
|
||||
!state->in_qualifier->flags.q.prim_type;
|
||||
|
||||
valid_in_mask.flags.q.prim_type = 1;
|
||||
valid_in_mask.flags.q.invocations = 1;
|
||||
break;
|
||||
case MESA_SHADER_FRAGMENT:
|
||||
if (q.flags.q.early_fragment_tests) {
|
||||
state->early_fragment_tests = true;
|
||||
} else {
|
||||
_mesa_glsl_error(loc, state, "invalid input layout qualifier");
|
||||
}
|
||||
break;
|
||||
case MESA_SHADER_COMPUTE:
|
||||
create_cs_ast |=
|
||||
q.flags.q.local_size != 0 &&
|
||||
state->in_qualifier->flags.q.local_size == 0;
|
||||
|
||||
valid_in_mask.flags.q.local_size = 7;
|
||||
break;
|
||||
default:
|
||||
_mesa_glsl_error(loc, state,
|
||||
"input layout qualifiers only valid in "
|
||||
"geometry, fragment and compute shaders");
|
||||
break;
|
||||
}
|
||||
|
||||
/* Generate an error when invalid input layout qualifiers are used. */
|
||||
if ((q.flags.i & ~valid_in_mask.flags.i) != 0) {
|
||||
_mesa_glsl_error(loc, state,
|
||||
"invalid input layout qualifiers used");
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Input layout qualifiers can be specified multiple
|
||||
* times in separate declarations, as long as they match.
|
||||
*/
|
||||
if (this->flags.q.prim_type) {
|
||||
if (q.flags.q.prim_type &&
|
||||
this->prim_type != q.prim_type) {
|
||||
_mesa_glsl_error(loc, state,
|
||||
"conflicting input primitive types specified");
|
||||
}
|
||||
} else if (q.flags.q.prim_type) {
|
||||
state->in_qualifier->flags.q.prim_type = 1;
|
||||
state->in_qualifier->prim_type = q.prim_type;
|
||||
}
|
||||
|
||||
if (this->flags.q.invocations &&
|
||||
q.flags.q.invocations &&
|
||||
this->invocations != q.invocations) {
|
||||
_mesa_glsl_error(loc, state,
|
||||
"conflicting invocations counts specified");
|
||||
return false;
|
||||
} else if (q.flags.q.invocations) {
|
||||
this->flags.q.invocations = 1;
|
||||
this->invocations = q.invocations;
|
||||
}
|
||||
|
||||
if (create_gs_ast) {
|
||||
node = new(mem_ctx) ast_gs_input_layout(*loc, q.prim_type);
|
||||
} else if (create_cs_ast) {
|
||||
/* Infer a local_size of 1 for every unspecified dimension */
|
||||
unsigned local_size[3];
|
||||
for (int i = 0; i < 3; i++) {
|
||||
if (q.flags.q.local_size & (1 << i))
|
||||
local_size[i] = q.local_size[i];
|
||||
else
|
||||
local_size[i] = 1;
|
||||
}
|
||||
node = new(mem_ctx) ast_cs_input_layout(*loc, local_size);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
File diff suppressed because it is too large
Load Diff
|
@ -1,156 +0,0 @@
|
|||
/*
|
||||
* Copyright © 2013 Intel Corporation
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the next
|
||||
* paragraph) shall be included in all copies or substantial portions of the
|
||||
* Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file builtin_type_macros.h
|
||||
*
|
||||
* This contains definitions for all GLSL built-in types, regardless of what
|
||||
* language version or extension might provide them.
|
||||
*/
|
||||
|
||||
#include "glsl_types.h"
|
||||
|
||||
DECL_TYPE(error, GL_INVALID_ENUM, GLSL_TYPE_ERROR, 0, 0)
|
||||
DECL_TYPE(void, GL_INVALID_ENUM, GLSL_TYPE_VOID, 0, 0)
|
||||
|
||||
DECL_TYPE(bool, GL_BOOL, GLSL_TYPE_BOOL, 1, 1)
|
||||
DECL_TYPE(bvec2, GL_BOOL_VEC2, GLSL_TYPE_BOOL, 2, 1)
|
||||
DECL_TYPE(bvec3, GL_BOOL_VEC3, GLSL_TYPE_BOOL, 3, 1)
|
||||
DECL_TYPE(bvec4, GL_BOOL_VEC4, GLSL_TYPE_BOOL, 4, 1)
|
||||
|
||||
DECL_TYPE(int, GL_INT, GLSL_TYPE_INT, 1, 1)
|
||||
DECL_TYPE(ivec2, GL_INT_VEC2, GLSL_TYPE_INT, 2, 1)
|
||||
DECL_TYPE(ivec3, GL_INT_VEC3, GLSL_TYPE_INT, 3, 1)
|
||||
DECL_TYPE(ivec4, GL_INT_VEC4, GLSL_TYPE_INT, 4, 1)
|
||||
|
||||
DECL_TYPE(uint, GL_UNSIGNED_INT, GLSL_TYPE_UINT, 1, 1)
|
||||
DECL_TYPE(uvec2, GL_UNSIGNED_INT_VEC2, GLSL_TYPE_UINT, 2, 1)
|
||||
DECL_TYPE(uvec3, GL_UNSIGNED_INT_VEC3, GLSL_TYPE_UINT, 3, 1)
|
||||
DECL_TYPE(uvec4, GL_UNSIGNED_INT_VEC4, GLSL_TYPE_UINT, 4, 1)
|
||||
|
||||
DECL_TYPE(float, GL_FLOAT, GLSL_TYPE_FLOAT, 1, 1)
|
||||
DECL_TYPE(vec2, GL_FLOAT_VEC2, GLSL_TYPE_FLOAT, 2, 1)
|
||||
DECL_TYPE(vec3, GL_FLOAT_VEC3, GLSL_TYPE_FLOAT, 3, 1)
|
||||
DECL_TYPE(vec4, GL_FLOAT_VEC4, GLSL_TYPE_FLOAT, 4, 1)
|
||||
|
||||
DECL_TYPE(mat2, GL_FLOAT_MAT2, GLSL_TYPE_FLOAT, 2, 2)
|
||||
DECL_TYPE(mat3, GL_FLOAT_MAT3, GLSL_TYPE_FLOAT, 3, 3)
|
||||
DECL_TYPE(mat4, GL_FLOAT_MAT4, GLSL_TYPE_FLOAT, 4, 4)
|
||||
|
||||
DECL_TYPE(mat2x3, GL_FLOAT_MAT2x3, GLSL_TYPE_FLOAT, 3, 2)
|
||||
DECL_TYPE(mat2x4, GL_FLOAT_MAT2x4, GLSL_TYPE_FLOAT, 4, 2)
|
||||
DECL_TYPE(mat3x2, GL_FLOAT_MAT3x2, GLSL_TYPE_FLOAT, 2, 3)
|
||||
DECL_TYPE(mat3x4, GL_FLOAT_MAT3x4, GLSL_TYPE_FLOAT, 4, 3)
|
||||
DECL_TYPE(mat4x2, GL_FLOAT_MAT4x2, GLSL_TYPE_FLOAT, 2, 4)
|
||||
DECL_TYPE(mat4x3, GL_FLOAT_MAT4x3, GLSL_TYPE_FLOAT, 3, 4)
|
||||
|
||||
DECL_TYPE(sampler1D, GL_SAMPLER_1D, GLSL_TYPE_SAMPLER, GLSL_SAMPLER_DIM_1D, 0, 0, GLSL_TYPE_FLOAT)
|
||||
DECL_TYPE(sampler2D, GL_SAMPLER_2D, GLSL_TYPE_SAMPLER, GLSL_SAMPLER_DIM_2D, 0, 0, GLSL_TYPE_FLOAT)
|
||||
DECL_TYPE(sampler3D, GL_SAMPLER_3D, GLSL_TYPE_SAMPLER, GLSL_SAMPLER_DIM_3D, 0, 0, GLSL_TYPE_FLOAT)
|
||||
DECL_TYPE(samplerCube, GL_SAMPLER_CUBE, GLSL_TYPE_SAMPLER, GLSL_SAMPLER_DIM_CUBE, 0, 0, GLSL_TYPE_FLOAT)
|
||||
DECL_TYPE(sampler1DArray, GL_SAMPLER_1D_ARRAY, GLSL_TYPE_SAMPLER, GLSL_SAMPLER_DIM_1D, 0, 1, GLSL_TYPE_FLOAT)
|
||||
DECL_TYPE(sampler2DArray, GL_SAMPLER_2D_ARRAY, GLSL_TYPE_SAMPLER, GLSL_SAMPLER_DIM_2D, 0, 1, GLSL_TYPE_FLOAT)
|
||||
DECL_TYPE(samplerCubeArray, GL_SAMPLER_CUBE_MAP_ARRAY, GLSL_TYPE_SAMPLER, GLSL_SAMPLER_DIM_CUBE, 0, 1, GLSL_TYPE_FLOAT)
|
||||
DECL_TYPE(sampler2DRect, GL_SAMPLER_2D_RECT, GLSL_TYPE_SAMPLER, GLSL_SAMPLER_DIM_RECT, 0, 0, GLSL_TYPE_FLOAT)
|
||||
DECL_TYPE(samplerBuffer, GL_SAMPLER_BUFFER, GLSL_TYPE_SAMPLER, GLSL_SAMPLER_DIM_BUF, 0, 0, GLSL_TYPE_FLOAT)
|
||||
DECL_TYPE(sampler2DMS, GL_SAMPLER_2D_MULTISAMPLE, GLSL_TYPE_SAMPLER, GLSL_SAMPLER_DIM_MS, 0, 0, GLSL_TYPE_FLOAT)
|
||||
DECL_TYPE(sampler2DMSArray, GL_SAMPLER_2D_MULTISAMPLE_ARRAY, GLSL_TYPE_SAMPLER, GLSL_SAMPLER_DIM_MS, 0, 1, GLSL_TYPE_FLOAT)
|
||||
|
||||
DECL_TYPE(isampler1D, GL_INT_SAMPLER_1D, GLSL_TYPE_SAMPLER, GLSL_SAMPLER_DIM_1D, 0, 0, GLSL_TYPE_INT)
|
||||
DECL_TYPE(isampler2D, GL_INT_SAMPLER_2D, GLSL_TYPE_SAMPLER, GLSL_SAMPLER_DIM_2D, 0, 0, GLSL_TYPE_INT)
|
||||
DECL_TYPE(isampler3D, GL_INT_SAMPLER_3D, GLSL_TYPE_SAMPLER, GLSL_SAMPLER_DIM_3D, 0, 0, GLSL_TYPE_INT)
|
||||
DECL_TYPE(isamplerCube, GL_INT_SAMPLER_CUBE, GLSL_TYPE_SAMPLER, GLSL_SAMPLER_DIM_CUBE, 0, 0, GLSL_TYPE_INT)
|
||||
DECL_TYPE(isampler1DArray, GL_INT_SAMPLER_1D_ARRAY, GLSL_TYPE_SAMPLER, GLSL_SAMPLER_DIM_1D, 0, 1, GLSL_TYPE_INT)
|
||||
DECL_TYPE(isampler2DArray, GL_INT_SAMPLER_2D_ARRAY, GLSL_TYPE_SAMPLER, GLSL_SAMPLER_DIM_2D, 0, 1, GLSL_TYPE_INT)
|
||||
DECL_TYPE(isamplerCubeArray, GL_INT_SAMPLER_CUBE_MAP_ARRAY, GLSL_TYPE_SAMPLER, GLSL_SAMPLER_DIM_CUBE, 0, 1, GLSL_TYPE_INT)
|
||||
DECL_TYPE(isampler2DRect, GL_INT_SAMPLER_2D_RECT, GLSL_TYPE_SAMPLER, GLSL_SAMPLER_DIM_RECT, 0, 0, GLSL_TYPE_INT)
|
||||
DECL_TYPE(isamplerBuffer, GL_INT_SAMPLER_BUFFER, GLSL_TYPE_SAMPLER, GLSL_SAMPLER_DIM_BUF, 0, 0, GLSL_TYPE_INT)
|
||||
DECL_TYPE(isampler2DMS, GL_INT_SAMPLER_2D_MULTISAMPLE, GLSL_TYPE_SAMPLER, GLSL_SAMPLER_DIM_MS, 0, 0, GLSL_TYPE_INT)
|
||||
DECL_TYPE(isampler2DMSArray, GL_INT_SAMPLER_2D_MULTISAMPLE_ARRAY, GLSL_TYPE_SAMPLER, GLSL_SAMPLER_DIM_MS, 0, 1, GLSL_TYPE_INT)
|
||||
|
||||
DECL_TYPE(usampler1D, GL_UNSIGNED_INT_SAMPLER_1D, GLSL_TYPE_SAMPLER, GLSL_SAMPLER_DIM_1D, 0, 0, GLSL_TYPE_UINT)
|
||||
DECL_TYPE(usampler2D, GL_UNSIGNED_INT_SAMPLER_2D, GLSL_TYPE_SAMPLER, GLSL_SAMPLER_DIM_2D, 0, 0, GLSL_TYPE_UINT)
|
||||
DECL_TYPE(usampler3D, GL_UNSIGNED_INT_SAMPLER_3D, GLSL_TYPE_SAMPLER, GLSL_SAMPLER_DIM_3D, 0, 0, GLSL_TYPE_UINT)
|
||||
DECL_TYPE(usamplerCube, GL_UNSIGNED_INT_SAMPLER_CUBE, GLSL_TYPE_SAMPLER, GLSL_SAMPLER_DIM_CUBE, 0, 0, GLSL_TYPE_UINT)
|
||||
DECL_TYPE(usampler1DArray, GL_UNSIGNED_INT_SAMPLER_1D_ARRAY, GLSL_TYPE_SAMPLER, GLSL_SAMPLER_DIM_1D, 0, 1, GLSL_TYPE_UINT)
|
||||
DECL_TYPE(usampler2DArray, GL_UNSIGNED_INT_SAMPLER_2D_ARRAY, GLSL_TYPE_SAMPLER, GLSL_SAMPLER_DIM_2D, 0, 1, GLSL_TYPE_UINT)
|
||||
DECL_TYPE(usamplerCubeArray, GL_UNSIGNED_INT_SAMPLER_CUBE_MAP_ARRAY, GLSL_TYPE_SAMPLER, GLSL_SAMPLER_DIM_CUBE, 0, 1, GLSL_TYPE_UINT)
|
||||
DECL_TYPE(usampler2DRect, GL_UNSIGNED_INT_SAMPLER_2D_RECT, GLSL_TYPE_SAMPLER, GLSL_SAMPLER_DIM_RECT, 0, 0, GLSL_TYPE_UINT)
|
||||
DECL_TYPE(usamplerBuffer, GL_UNSIGNED_INT_SAMPLER_BUFFER, GLSL_TYPE_SAMPLER, GLSL_SAMPLER_DIM_BUF, 0, 0, GLSL_TYPE_UINT)
|
||||
DECL_TYPE(usampler2DMS, GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE, GLSL_TYPE_SAMPLER, GLSL_SAMPLER_DIM_MS, 0, 0, GLSL_TYPE_UINT)
|
||||
DECL_TYPE(usampler2DMSArray, GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE_ARRAY, GLSL_TYPE_SAMPLER, GLSL_SAMPLER_DIM_MS, 0, 1, GLSL_TYPE_UINT)
|
||||
|
||||
DECL_TYPE(sampler1DShadow, GL_SAMPLER_1D_SHADOW, GLSL_TYPE_SAMPLER, GLSL_SAMPLER_DIM_1D, 1, 0, GLSL_TYPE_FLOAT)
|
||||
DECL_TYPE(sampler2DShadow, GL_SAMPLER_2D_SHADOW, GLSL_TYPE_SAMPLER, GLSL_SAMPLER_DIM_2D, 1, 0, GLSL_TYPE_FLOAT)
|
||||
DECL_TYPE(samplerCubeShadow, GL_SAMPLER_CUBE_SHADOW, GLSL_TYPE_SAMPLER, GLSL_SAMPLER_DIM_CUBE, 1, 0, GLSL_TYPE_FLOAT)
|
||||
DECL_TYPE(sampler1DArrayShadow, GL_SAMPLER_1D_ARRAY_SHADOW, GLSL_TYPE_SAMPLER, GLSL_SAMPLER_DIM_1D, 1, 1, GLSL_TYPE_FLOAT)
|
||||
DECL_TYPE(sampler2DArrayShadow, GL_SAMPLER_2D_ARRAY_SHADOW, GLSL_TYPE_SAMPLER, GLSL_SAMPLER_DIM_2D, 1, 1, GLSL_TYPE_FLOAT)
|
||||
DECL_TYPE(samplerCubeArrayShadow, GL_SAMPLER_CUBE_MAP_ARRAY_SHADOW, GLSL_TYPE_SAMPLER, GLSL_SAMPLER_DIM_CUBE, 1, 1, GLSL_TYPE_FLOAT)
|
||||
DECL_TYPE(sampler2DRectShadow, GL_SAMPLER_2D_RECT_SHADOW, GLSL_TYPE_SAMPLER, GLSL_SAMPLER_DIM_RECT, 1, 0, GLSL_TYPE_FLOAT)
|
||||
|
||||
DECL_TYPE(samplerExternalOES, GL_SAMPLER_EXTERNAL_OES, GLSL_TYPE_SAMPLER, GLSL_SAMPLER_DIM_EXTERNAL, 0, 0, GLSL_TYPE_FLOAT)
|
||||
|
||||
DECL_TYPE(image1D, GL_IMAGE_1D, GLSL_TYPE_IMAGE, GLSL_SAMPLER_DIM_1D, 0, 0, GLSL_TYPE_FLOAT);
|
||||
DECL_TYPE(image2D, GL_IMAGE_2D, GLSL_TYPE_IMAGE, GLSL_SAMPLER_DIM_2D, 0, 0, GLSL_TYPE_FLOAT);
|
||||
DECL_TYPE(image3D, GL_IMAGE_3D, GLSL_TYPE_IMAGE, GLSL_SAMPLER_DIM_3D, 0, 0, GLSL_TYPE_FLOAT);
|
||||
DECL_TYPE(image2DRect, GL_IMAGE_2D_RECT, GLSL_TYPE_IMAGE, GLSL_SAMPLER_DIM_RECT, 0, 0, GLSL_TYPE_FLOAT);
|
||||
DECL_TYPE(imageCube, GL_IMAGE_CUBE, GLSL_TYPE_IMAGE, GLSL_SAMPLER_DIM_CUBE, 0, 0, GLSL_TYPE_FLOAT);
|
||||
DECL_TYPE(imageBuffer, GL_IMAGE_BUFFER, GLSL_TYPE_IMAGE, GLSL_SAMPLER_DIM_BUF, 0, 0, GLSL_TYPE_FLOAT);
|
||||
DECL_TYPE(image1DArray, GL_IMAGE_1D_ARRAY, GLSL_TYPE_IMAGE, GLSL_SAMPLER_DIM_1D, 0, 1, GLSL_TYPE_FLOAT);
|
||||
DECL_TYPE(image2DArray, GL_IMAGE_2D_ARRAY, GLSL_TYPE_IMAGE, GLSL_SAMPLER_DIM_2D, 0, 1, GLSL_TYPE_FLOAT);
|
||||
DECL_TYPE(imageCubeArray, GL_IMAGE_CUBE_MAP_ARRAY, GLSL_TYPE_IMAGE, GLSL_SAMPLER_DIM_CUBE, 0, 1, GLSL_TYPE_FLOAT);
|
||||
DECL_TYPE(image2DMS, GL_IMAGE_2D_MULTISAMPLE, GLSL_TYPE_IMAGE, GLSL_SAMPLER_DIM_MS, 0, 0, GLSL_TYPE_FLOAT);
|
||||
DECL_TYPE(image2DMSArray, GL_IMAGE_2D_MULTISAMPLE_ARRAY, GLSL_TYPE_IMAGE, GLSL_SAMPLER_DIM_MS, 0, 1, GLSL_TYPE_FLOAT);
|
||||
DECL_TYPE(iimage1D, GL_INT_IMAGE_1D, GLSL_TYPE_IMAGE, GLSL_SAMPLER_DIM_1D, 0, 0, GLSL_TYPE_INT);
|
||||
DECL_TYPE(iimage2D, GL_INT_IMAGE_2D, GLSL_TYPE_IMAGE, GLSL_SAMPLER_DIM_2D, 0, 0, GLSL_TYPE_INT);
|
||||
DECL_TYPE(iimage3D, GL_INT_IMAGE_3D, GLSL_TYPE_IMAGE, GLSL_SAMPLER_DIM_3D, 0, 0, GLSL_TYPE_INT);
|
||||
DECL_TYPE(iimage2DRect, GL_INT_IMAGE_2D_RECT, GLSL_TYPE_IMAGE, GLSL_SAMPLER_DIM_RECT, 0, 0, GLSL_TYPE_INT);
|
||||
DECL_TYPE(iimageCube, GL_INT_IMAGE_CUBE, GLSL_TYPE_IMAGE, GLSL_SAMPLER_DIM_CUBE, 0, 0, GLSL_TYPE_INT);
|
||||
DECL_TYPE(iimageBuffer, GL_INT_IMAGE_BUFFER, GLSL_TYPE_IMAGE, GLSL_SAMPLER_DIM_BUF, 0, 0, GLSL_TYPE_INT);
|
||||
DECL_TYPE(iimage1DArray, GL_INT_IMAGE_1D_ARRAY, GLSL_TYPE_IMAGE, GLSL_SAMPLER_DIM_1D, 0, 1, GLSL_TYPE_INT);
|
||||
DECL_TYPE(iimage2DArray, GL_INT_IMAGE_2D_ARRAY, GLSL_TYPE_IMAGE, GLSL_SAMPLER_DIM_2D, 0, 1, GLSL_TYPE_INT);
|
||||
DECL_TYPE(iimageCubeArray, GL_INT_IMAGE_CUBE_MAP_ARRAY, GLSL_TYPE_IMAGE, GLSL_SAMPLER_DIM_CUBE, 0, 1, GLSL_TYPE_INT);
|
||||
DECL_TYPE(iimage2DMS, GL_INT_IMAGE_2D_MULTISAMPLE, GLSL_TYPE_IMAGE, GLSL_SAMPLER_DIM_MS, 0, 0, GLSL_TYPE_INT);
|
||||
DECL_TYPE(iimage2DMSArray, GL_INT_IMAGE_2D_MULTISAMPLE_ARRAY, GLSL_TYPE_IMAGE, GLSL_SAMPLER_DIM_MS, 0, 1, GLSL_TYPE_INT);
|
||||
DECL_TYPE(uimage1D, GL_UNSIGNED_INT_IMAGE_1D, GLSL_TYPE_IMAGE, GLSL_SAMPLER_DIM_1D, 0, 0, GLSL_TYPE_UINT);
|
||||
DECL_TYPE(uimage2D, GL_UNSIGNED_INT_IMAGE_2D, GLSL_TYPE_IMAGE, GLSL_SAMPLER_DIM_2D, 0, 0, GLSL_TYPE_UINT);
|
||||
DECL_TYPE(uimage3D, GL_UNSIGNED_INT_IMAGE_3D, GLSL_TYPE_IMAGE, GLSL_SAMPLER_DIM_3D, 0, 0, GLSL_TYPE_UINT);
|
||||
DECL_TYPE(uimage2DRect, GL_UNSIGNED_INT_IMAGE_2D_RECT, GLSL_TYPE_IMAGE, GLSL_SAMPLER_DIM_RECT, 0, 0, GLSL_TYPE_UINT);
|
||||
DECL_TYPE(uimageCube, GL_UNSIGNED_INT_IMAGE_CUBE, GLSL_TYPE_IMAGE, GLSL_SAMPLER_DIM_CUBE, 0, 0, GLSL_TYPE_UINT);
|
||||
DECL_TYPE(uimageBuffer, GL_UNSIGNED_INT_IMAGE_BUFFER, GLSL_TYPE_IMAGE, GLSL_SAMPLER_DIM_BUF, 0, 0, GLSL_TYPE_UINT);
|
||||
DECL_TYPE(uimage1DArray, GL_UNSIGNED_INT_IMAGE_1D_ARRAY, GLSL_TYPE_IMAGE, GLSL_SAMPLER_DIM_1D, 0, 1, GLSL_TYPE_UINT);
|
||||
DECL_TYPE(uimage2DArray, GL_UNSIGNED_INT_IMAGE_2D_ARRAY, GLSL_TYPE_IMAGE, GLSL_SAMPLER_DIM_2D, 0, 1, GLSL_TYPE_UINT);
|
||||
DECL_TYPE(uimageCubeArray, GL_UNSIGNED_INT_IMAGE_CUBE_MAP_ARRAY, GLSL_TYPE_IMAGE, GLSL_SAMPLER_DIM_CUBE, 0, 1, GLSL_TYPE_UINT);
|
||||
DECL_TYPE(uimage2DMS, GL_UNSIGNED_INT_IMAGE_2D_MULTISAMPLE, GLSL_TYPE_IMAGE, GLSL_SAMPLER_DIM_MS, 0, 0, GLSL_TYPE_UINT);
|
||||
DECL_TYPE(uimage2DMSArray, GL_UNSIGNED_INT_IMAGE_2D_MULTISAMPLE_ARRAY, GLSL_TYPE_IMAGE, GLSL_SAMPLER_DIM_MS, 0, 1, GLSL_TYPE_UINT);
|
||||
|
||||
DECL_TYPE(atomic_uint, GL_UNSIGNED_INT_ATOMIC_COUNTER, GLSL_TYPE_ATOMIC_UINT, 1, 1)
|
||||
|
||||
STRUCT_TYPE(gl_DepthRangeParameters)
|
||||
STRUCT_TYPE(gl_PointParameters)
|
||||
STRUCT_TYPE(gl_MaterialParameters)
|
||||
STRUCT_TYPE(gl_LightSourceParameters)
|
||||
STRUCT_TYPE(gl_LightModelParameters)
|
||||
STRUCT_TYPE(gl_LightModelProducts)
|
||||
STRUCT_TYPE(gl_LightProducts)
|
||||
STRUCT_TYPE(gl_FogParameters)
|
|
@ -1,369 +0,0 @@
|
|||
/*
|
||||
* Copyright © 2013 Intel Corporation
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the next
|
||||
* paragraph) shall be included in all copies or substantial portions of the
|
||||
* Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file builtin_types.cpp
|
||||
*
|
||||
* The glsl_type class has static members to represent all the built-in types
|
||||
* (such as the glsl_type::_float_type flyweight) as well as convenience pointer
|
||||
* accessors (such as glsl_type::float_type). Those global variables are
|
||||
* declared and initialized in this file.
|
||||
*
|
||||
* This also contains _mesa_glsl_initialize_types(), a function which populates
|
||||
* a symbol table with the available built-in types for a particular language
|
||||
* version and set of enabled extensions.
|
||||
*/
|
||||
|
||||
#include "glsl_types.h"
|
||||
#include "glsl_parser_extras.h"
|
||||
#include "util/macros.h"
|
||||
|
||||
/**
|
||||
* Declarations of type flyweights (glsl_type::_foo_type) and
|
||||
* convenience pointers (glsl_type::foo_type).
|
||||
* @{
|
||||
*/
|
||||
#define DECL_TYPE(NAME, ...) \
|
||||
const glsl_type glsl_type::_##NAME##_type = glsl_type(__VA_ARGS__, #NAME); \
|
||||
const glsl_type *const glsl_type::NAME##_type = &glsl_type::_##NAME##_type;
|
||||
|
||||
#define STRUCT_TYPE(NAME) \
|
||||
const glsl_type glsl_type::_struct_##NAME##_type = \
|
||||
glsl_type(NAME##_fields, ARRAY_SIZE(NAME##_fields), #NAME); \
|
||||
const glsl_type *const glsl_type::struct_##NAME##_type = \
|
||||
&glsl_type::_struct_##NAME##_type;
|
||||
|
||||
static const struct glsl_struct_field gl_DepthRangeParameters_fields[] = {
|
||||
{ glsl_type::float_type, "near", glsl_precision_high, -1, 0, 0, 0, GLSL_MATRIX_LAYOUT_INHERITED, 0 },
|
||||
{ glsl_type::float_type, "far", glsl_precision_high, -1, 0, 0, 0, GLSL_MATRIX_LAYOUT_INHERITED, 0 },
|
||||
{ glsl_type::float_type, "diff", glsl_precision_high, -1, 0, 0, 0, GLSL_MATRIX_LAYOUT_INHERITED, 0 },
|
||||
};
|
||||
|
||||
static const struct glsl_struct_field gl_PointParameters_fields[] = {
|
||||
{ glsl_type::float_type, "size", glsl_precision_undefined, -1, 0, 0, 0, GLSL_MATRIX_LAYOUT_INHERITED, 0 },
|
||||
{ glsl_type::float_type, "sizeMin", glsl_precision_undefined, -1, 0, 0, 0, GLSL_MATRIX_LAYOUT_INHERITED, 0 },
|
||||
{ glsl_type::float_type, "sizeMax", glsl_precision_undefined, -1, 0, 0, 0, GLSL_MATRIX_LAYOUT_INHERITED, 0 },
|
||||
{ glsl_type::float_type, "fadeThresholdSize", glsl_precision_undefined, -1, 0, 0, 0, GLSL_MATRIX_LAYOUT_INHERITED, 0 },
|
||||
{ glsl_type::float_type, "distanceConstantAttenuation", glsl_precision_undefined, -1, 0, 0, 0, GLSL_MATRIX_LAYOUT_INHERITED, 0 },
|
||||
{ glsl_type::float_type, "distanceLinearAttenuation", glsl_precision_undefined, -1, 0, 0, 0, GLSL_MATRIX_LAYOUT_INHERITED, 0 },
|
||||
{ glsl_type::float_type, "distanceQuadraticAttenuation", glsl_precision_undefined, -1, 0, 0, 0, GLSL_MATRIX_LAYOUT_INHERITED, 0 },
|
||||
};
|
||||
|
||||
static const struct glsl_struct_field gl_MaterialParameters_fields[] = {
|
||||
{ glsl_type::vec4_type, "emission", glsl_precision_undefined, -1, 0, 0, 0, GLSL_MATRIX_LAYOUT_INHERITED, 0 },
|
||||
{ glsl_type::vec4_type, "ambient", glsl_precision_undefined, -1, 0, 0, 0, GLSL_MATRIX_LAYOUT_INHERITED, 0 },
|
||||
{ glsl_type::vec4_type, "diffuse", glsl_precision_undefined, -1, 0, 0, 0, GLSL_MATRIX_LAYOUT_INHERITED, 0 },
|
||||
{ glsl_type::vec4_type, "specular", glsl_precision_undefined, -1, 0, 0, 0, GLSL_MATRIX_LAYOUT_INHERITED, 0 },
|
||||
{ glsl_type::float_type, "shininess", glsl_precision_undefined, -1, 0, 0, 0, GLSL_MATRIX_LAYOUT_INHERITED, 0 },
|
||||
};
|
||||
|
||||
static const struct glsl_struct_field gl_LightSourceParameters_fields[] = {
|
||||
{ glsl_type::vec4_type, "ambient", glsl_precision_undefined, -1, 0, 0, 0, GLSL_MATRIX_LAYOUT_INHERITED, 0 },
|
||||
{ glsl_type::vec4_type, "diffuse", glsl_precision_undefined, -1, 0, 0, 0, GLSL_MATRIX_LAYOUT_INHERITED, 0 },
|
||||
{ glsl_type::vec4_type, "specular", glsl_precision_undefined, -1, 0, 0, 0, GLSL_MATRIX_LAYOUT_INHERITED, 0 },
|
||||
{ glsl_type::vec4_type, "position", glsl_precision_undefined, -1, 0, 0, 0, GLSL_MATRIX_LAYOUT_INHERITED, 0 },
|
||||
{ glsl_type::vec4_type, "halfVector", glsl_precision_undefined, -1, 0, 0, 0, GLSL_MATRIX_LAYOUT_INHERITED, 0 },
|
||||
{ glsl_type::vec3_type, "spotDirection", glsl_precision_undefined, -1, 0, 0, 0, GLSL_MATRIX_LAYOUT_INHERITED, 0 },
|
||||
{ glsl_type::float_type, "spotExponent", glsl_precision_undefined, -1, 0, 0, 0, GLSL_MATRIX_LAYOUT_INHERITED, 0 },
|
||||
{ glsl_type::float_type, "spotCutoff", glsl_precision_undefined, -1, 0, 0, 0, GLSL_MATRIX_LAYOUT_INHERITED, 0 },
|
||||
{ glsl_type::float_type, "spotCosCutoff", glsl_precision_undefined, -1, 0, 0, 0, GLSL_MATRIX_LAYOUT_INHERITED, 0 },
|
||||
{ glsl_type::float_type, "constantAttenuation", glsl_precision_undefined, -1, 0, 0, 0, GLSL_MATRIX_LAYOUT_INHERITED, 0 },
|
||||
{ glsl_type::float_type, "linearAttenuation", glsl_precision_undefined, -1, 0, 0, 0, GLSL_MATRIX_LAYOUT_INHERITED, 0 },
|
||||
{ glsl_type::float_type, "quadraticAttenuation", glsl_precision_undefined, -1, 0, 0, 0, GLSL_MATRIX_LAYOUT_INHERITED, 0 },
|
||||
};
|
||||
|
||||
static const struct glsl_struct_field gl_LightModelParameters_fields[] = {
|
||||
{ glsl_type::vec4_type, "ambient", glsl_precision_undefined, -1, 0, 0, 0, GLSL_MATRIX_LAYOUT_INHERITED, 0 },
|
||||
};
|
||||
|
||||
static const struct glsl_struct_field gl_LightModelProducts_fields[] = {
|
||||
{ glsl_type::vec4_type, "sceneColor", glsl_precision_undefined, -1, 0, 0, 0, GLSL_MATRIX_LAYOUT_INHERITED, 0 },
|
||||
};
|
||||
|
||||
static const struct glsl_struct_field gl_LightProducts_fields[] = {
|
||||
{ glsl_type::vec4_type, "ambient", glsl_precision_undefined, -1, 0, 0, 0, GLSL_MATRIX_LAYOUT_INHERITED, 0 },
|
||||
{ glsl_type::vec4_type, "diffuse", glsl_precision_undefined, -1, 0, 0, 0, GLSL_MATRIX_LAYOUT_INHERITED, 0 },
|
||||
{ glsl_type::vec4_type, "specular", glsl_precision_undefined, -1, 0, 0, 0, GLSL_MATRIX_LAYOUT_INHERITED, 0 },
|
||||
};
|
||||
|
||||
static const struct glsl_struct_field gl_FogParameters_fields[] = {
|
||||
{ glsl_type::vec4_type, "color", glsl_precision_undefined, -1, 0, 0, 0, GLSL_MATRIX_LAYOUT_INHERITED, 0 },
|
||||
{ glsl_type::float_type, "density", glsl_precision_undefined, -1, 0, 0, 0, GLSL_MATRIX_LAYOUT_INHERITED, 0 },
|
||||
{ glsl_type::float_type, "start", glsl_precision_undefined, -1, 0, 0, 0, GLSL_MATRIX_LAYOUT_INHERITED, 0 },
|
||||
{ glsl_type::float_type, "end", glsl_precision_undefined, -1, 0, 0, 0, GLSL_MATRIX_LAYOUT_INHERITED, 0 },
|
||||
{ glsl_type::float_type, "scale", glsl_precision_undefined, -1, 0, 0, 0, GLSL_MATRIX_LAYOUT_INHERITED, 0 },
|
||||
};
|
||||
|
||||
#include "builtin_type_macros.h"
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* Code to populate a symbol table with the built-in types available in a
|
||||
* particular shading language version. The table below contains tags every
|
||||
* type with the GLSL/GLSL ES versions where it was introduced.
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
#define T(TYPE, MIN_GL, MIN_ES) \
|
||||
{ glsl_type::TYPE##_type, MIN_GL, MIN_ES },
|
||||
|
||||
const static struct builtin_type_versions {
|
||||
const glsl_type *const type;
|
||||
int min_gl;
|
||||
int min_es;
|
||||
} builtin_type_versions[] = {
|
||||
T(void, 110, 100)
|
||||
T(bool, 110, 100)
|
||||
T(bvec2, 110, 100)
|
||||
T(bvec3, 110, 100)
|
||||
T(bvec4, 110, 100)
|
||||
T(int, 110, 100)
|
||||
T(ivec2, 110, 100)
|
||||
T(ivec3, 110, 100)
|
||||
T(ivec4, 110, 100)
|
||||
T(uint, 130, 300)
|
||||
T(uvec2, 130, 300)
|
||||
T(uvec3, 130, 300)
|
||||
T(uvec4, 130, 300)
|
||||
T(float, 110, 100)
|
||||
T(vec2, 110, 100)
|
||||
T(vec3, 110, 100)
|
||||
T(vec4, 110, 100)
|
||||
T(mat2, 110, 100)
|
||||
T(mat3, 110, 100)
|
||||
T(mat4, 110, 100)
|
||||
T(mat2x3, 120, 300)
|
||||
T(mat2x4, 120, 300)
|
||||
T(mat3x2, 120, 300)
|
||||
T(mat3x4, 120, 300)
|
||||
T(mat4x2, 120, 300)
|
||||
T(mat4x3, 120, 300)
|
||||
|
||||
T(sampler1D, 110, 999)
|
||||
T(sampler2D, 110, 100)
|
||||
T(sampler3D, 110, 300)
|
||||
T(samplerCube, 110, 100)
|
||||
T(sampler1DArray, 130, 999)
|
||||
T(sampler2DArray, 130, 300)
|
||||
T(samplerCubeArray, 400, 999)
|
||||
T(sampler2DRect, 140, 999)
|
||||
T(samplerBuffer, 140, 999)
|
||||
T(sampler2DMS, 150, 999)
|
||||
T(sampler2DMSArray, 150, 999)
|
||||
|
||||
T(isampler1D, 130, 999)
|
||||
T(isampler2D, 130, 300)
|
||||
T(isampler3D, 130, 300)
|
||||
T(isamplerCube, 130, 300)
|
||||
T(isampler1DArray, 130, 999)
|
||||
T(isampler2DArray, 130, 300)
|
||||
T(isamplerCubeArray, 400, 999)
|
||||
T(isampler2DRect, 140, 999)
|
||||
T(isamplerBuffer, 140, 999)
|
||||
T(isampler2DMS, 150, 999)
|
||||
T(isampler2DMSArray, 150, 999)
|
||||
|
||||
T(usampler1D, 130, 999)
|
||||
T(usampler2D, 130, 300)
|
||||
T(usampler3D, 130, 300)
|
||||
T(usamplerCube, 130, 300)
|
||||
T(usampler1DArray, 130, 999)
|
||||
T(usampler2DArray, 130, 300)
|
||||
T(usamplerCubeArray, 400, 999)
|
||||
T(usampler2DRect, 140, 999)
|
||||
T(usamplerBuffer, 140, 999)
|
||||
T(usampler2DMS, 150, 999)
|
||||
T(usampler2DMSArray, 150, 999)
|
||||
|
||||
T(sampler1DShadow, 110, 999)
|
||||
T(sampler2DShadow, 110, 300)
|
||||
T(samplerCubeShadow, 130, 300)
|
||||
T(sampler1DArrayShadow, 130, 999)
|
||||
T(sampler2DArrayShadow, 130, 300)
|
||||
T(samplerCubeArrayShadow, 400, 999)
|
||||
T(sampler2DRectShadow, 140, 999)
|
||||
|
||||
T(struct_gl_DepthRangeParameters, 110, 100)
|
||||
|
||||
T(image1D, 420, 999)
|
||||
T(image2D, 420, 999)
|
||||
T(image3D, 420, 999)
|
||||
T(image2DRect, 420, 999)
|
||||
T(imageCube, 420, 999)
|
||||
T(imageBuffer, 420, 999)
|
||||
T(image1DArray, 420, 999)
|
||||
T(image2DArray, 420, 999)
|
||||
T(imageCubeArray, 420, 999)
|
||||
T(image2DMS, 420, 999)
|
||||
T(image2DMSArray, 420, 999)
|
||||
T(iimage1D, 420, 999)
|
||||
T(iimage2D, 420, 999)
|
||||
T(iimage3D, 420, 999)
|
||||
T(iimage2DRect, 420, 999)
|
||||
T(iimageCube, 420, 999)
|
||||
T(iimageBuffer, 420, 999)
|
||||
T(iimage1DArray, 420, 999)
|
||||
T(iimage2DArray, 420, 999)
|
||||
T(iimageCubeArray, 420, 999)
|
||||
T(iimage2DMS, 420, 999)
|
||||
T(iimage2DMSArray, 420, 999)
|
||||
T(uimage1D, 420, 999)
|
||||
T(uimage2D, 420, 999)
|
||||
T(uimage3D, 420, 999)
|
||||
T(uimage2DRect, 420, 999)
|
||||
T(uimageCube, 420, 999)
|
||||
T(uimageBuffer, 420, 999)
|
||||
T(uimage1DArray, 420, 999)
|
||||
T(uimage2DArray, 420, 999)
|
||||
T(uimageCubeArray, 420, 999)
|
||||
T(uimage2DMS, 420, 999)
|
||||
T(uimage2DMSArray, 420, 999)
|
||||
|
||||
T(atomic_uint, 420, 999)
|
||||
};
|
||||
|
||||
static const glsl_type *const deprecated_types[] = {
|
||||
glsl_type::struct_gl_PointParameters_type,
|
||||
glsl_type::struct_gl_MaterialParameters_type,
|
||||
glsl_type::struct_gl_LightSourceParameters_type,
|
||||
glsl_type::struct_gl_LightModelParameters_type,
|
||||
glsl_type::struct_gl_LightModelProducts_type,
|
||||
glsl_type::struct_gl_LightProducts_type,
|
||||
glsl_type::struct_gl_FogParameters_type,
|
||||
};
|
||||
|
||||
static inline void
|
||||
add_type(glsl_symbol_table *symbols, const glsl_type *const type)
|
||||
{
|
||||
symbols->add_type(type->name, type);
|
||||
}
|
||||
|
||||
/**
|
||||
* Populate the symbol table with available built-in types.
|
||||
*/
|
||||
void
|
||||
_mesa_glsl_initialize_types(struct _mesa_glsl_parse_state *state)
|
||||
{
|
||||
struct glsl_symbol_table *symbols = state->symbols;
|
||||
|
||||
for (unsigned i = 0; i < ARRAY_SIZE(builtin_type_versions); i++) {
|
||||
const struct builtin_type_versions *const t = &builtin_type_versions[i];
|
||||
if (state->is_version(t->min_gl, t->min_es)) {
|
||||
add_type(symbols, t->type);
|
||||
}
|
||||
}
|
||||
|
||||
/* Add deprecated structure types. While these were deprecated in 1.30,
|
||||
* they're still present. We've removed them in 1.40+ (OpenGL 3.1+).
|
||||
*/
|
||||
if (!state->es_shader && state->language_version < 140) {
|
||||
for (unsigned i = 0; i < ARRAY_SIZE(deprecated_types); i++) {
|
||||
add_type(symbols, deprecated_types[i]);
|
||||
}
|
||||
}
|
||||
|
||||
/* Add types for enabled extensions. They may have already been added
|
||||
* by the version-based loop, but attempting to add them a second time
|
||||
* is harmless.
|
||||
*/
|
||||
if (state->ARB_texture_cube_map_array_enable) {
|
||||
add_type(symbols, glsl_type::samplerCubeArray_type);
|
||||
add_type(symbols, glsl_type::samplerCubeArrayShadow_type);
|
||||
add_type(symbols, glsl_type::isamplerCubeArray_type);
|
||||
add_type(symbols, glsl_type::usamplerCubeArray_type);
|
||||
}
|
||||
|
||||
if (state->ARB_texture_multisample_enable) {
|
||||
add_type(symbols, glsl_type::sampler2DMS_type);
|
||||
add_type(symbols, glsl_type::isampler2DMS_type);
|
||||
add_type(symbols, glsl_type::usampler2DMS_type);
|
||||
add_type(symbols, glsl_type::sampler2DMSArray_type);
|
||||
add_type(symbols, glsl_type::isampler2DMSArray_type);
|
||||
add_type(symbols, glsl_type::usampler2DMSArray_type);
|
||||
}
|
||||
|
||||
if (state->ARB_texture_rectangle_enable) {
|
||||
add_type(symbols, glsl_type::sampler2DRect_type);
|
||||
add_type(symbols, glsl_type::sampler2DRectShadow_type);
|
||||
}
|
||||
|
||||
if (state->EXT_texture_array_enable) {
|
||||
add_type(symbols, glsl_type::sampler1DArray_type);
|
||||
add_type(symbols, glsl_type::sampler2DArray_type);
|
||||
add_type(symbols, glsl_type::sampler1DArrayShadow_type);
|
||||
add_type(symbols, glsl_type::sampler2DArrayShadow_type);
|
||||
}
|
||||
|
||||
if (state->OES_EGL_image_external_enable) {
|
||||
add_type(symbols, glsl_type::samplerExternalOES_type);
|
||||
}
|
||||
|
||||
if (state->EXT_shadow_samplers_enable) {
|
||||
add_type(symbols, glsl_type::sampler2DShadow_type);
|
||||
}
|
||||
|
||||
if (state->OES_texture_3D_enable) {
|
||||
add_type(symbols, glsl_type::sampler3D_type);
|
||||
}
|
||||
|
||||
if (state->ARB_shader_image_load_store_enable) {
|
||||
add_type(symbols, glsl_type::image1D_type);
|
||||
add_type(symbols, glsl_type::image2D_type);
|
||||
add_type(symbols, glsl_type::image3D_type);
|
||||
add_type(symbols, glsl_type::image2DRect_type);
|
||||
add_type(symbols, glsl_type::imageCube_type);
|
||||
add_type(symbols, glsl_type::imageBuffer_type);
|
||||
add_type(symbols, glsl_type::image1DArray_type);
|
||||
add_type(symbols, glsl_type::image2DArray_type);
|
||||
add_type(symbols, glsl_type::imageCubeArray_type);
|
||||
add_type(symbols, glsl_type::image2DMS_type);
|
||||
add_type(symbols, glsl_type::image2DMSArray_type);
|
||||
add_type(symbols, glsl_type::iimage1D_type);
|
||||
add_type(symbols, glsl_type::iimage2D_type);
|
||||
add_type(symbols, glsl_type::iimage3D_type);
|
||||
add_type(symbols, glsl_type::iimage2DRect_type);
|
||||
add_type(symbols, glsl_type::iimageCube_type);
|
||||
add_type(symbols, glsl_type::iimageBuffer_type);
|
||||
add_type(symbols, glsl_type::iimage1DArray_type);
|
||||
add_type(symbols, glsl_type::iimage2DArray_type);
|
||||
add_type(symbols, glsl_type::iimageCubeArray_type);
|
||||
add_type(symbols, glsl_type::iimage2DMS_type);
|
||||
add_type(symbols, glsl_type::iimage2DMSArray_type);
|
||||
add_type(symbols, glsl_type::uimage1D_type);
|
||||
add_type(symbols, glsl_type::uimage2D_type);
|
||||
add_type(symbols, glsl_type::uimage3D_type);
|
||||
add_type(symbols, glsl_type::uimage2DRect_type);
|
||||
add_type(symbols, glsl_type::uimageCube_type);
|
||||
add_type(symbols, glsl_type::uimageBuffer_type);
|
||||
add_type(symbols, glsl_type::uimage1DArray_type);
|
||||
add_type(symbols, glsl_type::uimage2DArray_type);
|
||||
add_type(symbols, glsl_type::uimageCubeArray_type);
|
||||
add_type(symbols, glsl_type::uimage2DMS_type);
|
||||
add_type(symbols, glsl_type::uimage2DMSArray_type);
|
||||
}
|
||||
|
||||
if (state->ARB_shader_atomic_counters_enable) {
|
||||
add_type(symbols, glsl_type::atomic_uint_type);
|
||||
}
|
||||
}
|
||||
/** @} */
|
File diff suppressed because it is too large
Load Diff
|
@ -1,10 +0,0 @@
|
|||
glcpp
|
||||
glcpp-parse.output
|
||||
|
||||
*.o
|
||||
*.lo
|
||||
*.la
|
||||
.libs
|
||||
*~
|
||||
|
||||
tests/*.out
|
|
@ -1,30 +0,0 @@
|
|||
glcpp -- GLSL "C" preprocessor
|
||||
|
||||
This is a simple preprocessor designed to provide the preprocessing
|
||||
needs of the GLSL language. The requirements for this preprocessor are
|
||||
specified in the GLSL 1.30 specification availble from:
|
||||
|
||||
http://www.opengl.org/registry/doc/GLSLangSpec.Full.1.30.10.pdf
|
||||
|
||||
This specification is not precise on some semantics, (for example,
|
||||
#define and #if), defining these merely "as is standard for C++
|
||||
preprocessors". To fill in these details, I've been using a draft of
|
||||
the C99 standard as available from:
|
||||
|
||||
http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1256.pdf
|
||||
|
||||
Any downstream compiler accepting output from glcpp should be prepared
|
||||
to encounter and deal with the following preprocessor macros:
|
||||
|
||||
#line
|
||||
#pragma
|
||||
#extension
|
||||
|
||||
All other macros will be handled according to the GLSL specification
|
||||
and will not appear in the output.
|
||||
|
||||
Known limitations
|
||||
-----------------
|
||||
A file that ends with a function-like macro name as the last
|
||||
non-whitespace token will result in a parse error, (where it should be
|
||||
passed through as is).
|
File diff suppressed because it is too large
Load Diff
|
@ -1,578 +0,0 @@
|
|||
%{
|
||||
/*
|
||||
* Copyright © 2010 Intel Corporation
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the next
|
||||
* paragraph) shall be included in all copies or substantial portions of the
|
||||
* Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#include "glcpp.h"
|
||||
#include "glcpp-parse.h"
|
||||
|
||||
/* Flex annoyingly generates some functions without making them
|
||||
* static. Let's declare them here. */
|
||||
int glcpp_get_column (yyscan_t yyscanner);
|
||||
void glcpp_set_column (int column_no , yyscan_t yyscanner);
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#define YY_NO_UNISTD_H
|
||||
#pragma warning(disable: 4267) // warning C4267: '=' : conversion from 'size_t' to 'int', possible loss of data
|
||||
#endif
|
||||
|
||||
#define YY_NO_INPUT
|
||||
|
||||
#define YY_USER_ACTION \
|
||||
do { \
|
||||
if (parser->has_new_line_number) \
|
||||
yylineno = parser->new_line_number; \
|
||||
if (parser->has_new_source_number) \
|
||||
yylloc->source = parser->new_source_number; \
|
||||
yylloc->first_column = yycolumn + 1; \
|
||||
yylloc->first_line = yylloc->last_line = yylineno; \
|
||||
yycolumn += yyleng; \
|
||||
yylloc->last_column = yycolumn + 1; \
|
||||
parser->has_new_line_number = 0; \
|
||||
parser->has_new_source_number = 0; \
|
||||
} while(0);
|
||||
|
||||
#define YY_USER_INIT \
|
||||
do { \
|
||||
yylineno = 1; \
|
||||
yycolumn = 0; \
|
||||
yylloc->source = 0; \
|
||||
} while(0)
|
||||
|
||||
/* It's ugly to have macros that have return statements inside of
|
||||
* them, but flex-based lexer generation is all built around the
|
||||
* return statement.
|
||||
*
|
||||
* To mitigate the ugliness, we defer as much of the logic as possible
|
||||
* to an actual function, not a macro (see
|
||||
* glcpplex_update_state_per_token) and we make the word RETURN
|
||||
* prominent in all of the macros which may return.
|
||||
*
|
||||
* The most-commonly-used macro is RETURN_TOKEN which will perform all
|
||||
* necessary state updates based on the provided token,, then
|
||||
* conditionally return the token. It will not return a token if the
|
||||
* parser is currently skipping tokens, (such as within #if
|
||||
* 0...#else).
|
||||
*
|
||||
* The RETURN_TOKEN_NEVER_SKIP macro is a lower-level variant that
|
||||
* makes the token returning unconditional. This is needed for things
|
||||
* like #if and the tokens of its condition, (since these must be
|
||||
* evaluated by the parser even when otherwise skipping).
|
||||
*
|
||||
* Finally, RETURN_STRING_TOKEN is a simple convenience wrapper on top
|
||||
* of RETURN_TOKEN that performs a string copy of yytext before the
|
||||
* return.
|
||||
*/
|
||||
#define RETURN_TOKEN_NEVER_SKIP(token) \
|
||||
do { \
|
||||
if (glcpp_lex_update_state_per_token (parser, token)) \
|
||||
return token; \
|
||||
} while (0)
|
||||
|
||||
#define RETURN_TOKEN(token) \
|
||||
do { \
|
||||
if (! parser->skipping) { \
|
||||
RETURN_TOKEN_NEVER_SKIP(token); \
|
||||
} \
|
||||
} while(0)
|
||||
|
||||
#define RETURN_STRING_TOKEN(token) \
|
||||
do { \
|
||||
if (! parser->skipping) { \
|
||||
yylval->str = ralloc_strdup (yyextra, yytext); \
|
||||
RETURN_TOKEN_NEVER_SKIP (token); \
|
||||
} \
|
||||
} while(0)
|
||||
|
||||
|
||||
/* Update all state necessary for each token being returned.
|
||||
*
|
||||
* Here we'll be tracking newlines and spaces so that the lexer can
|
||||
* alter its behavior as necessary, (for example, '#' has special
|
||||
* significance if it is the first non-whitespace, non-comment token
|
||||
* in a line, but does not otherwise).
|
||||
*
|
||||
* NOTE: If this function returns FALSE, then no token should be
|
||||
* returned at all. This is used to suprress duplicate SPACE tokens.
|
||||
*/
|
||||
static int
|
||||
glcpp_lex_update_state_per_token (glcpp_parser_t *parser, int token)
|
||||
{
|
||||
/* After the first non-space token in a line, we won't
|
||||
* allow any '#' to introduce a directive. */
|
||||
if (token == NEWLINE) {
|
||||
parser->first_non_space_token_this_line = 1;
|
||||
} else if (token != SPACE) {
|
||||
parser->first_non_space_token_this_line = 0;
|
||||
}
|
||||
|
||||
/* Track newlines just to know whether a newline needs
|
||||
* to be inserted if end-of-file comes early. */
|
||||
if (token == NEWLINE) {
|
||||
parser->last_token_was_newline = 1;
|
||||
} else {
|
||||
parser->last_token_was_newline = 0;
|
||||
}
|
||||
|
||||
/* Track spaces to avoid emitting multiple SPACE
|
||||
* tokens in a row. */
|
||||
if (token == SPACE) {
|
||||
if (! parser->last_token_was_space) {
|
||||
parser->last_token_was_space = 1;
|
||||
return 1;
|
||||
} else {
|
||||
parser->last_token_was_space = 1;
|
||||
return 0;
|
||||
}
|
||||
} else {
|
||||
parser->last_token_was_space = 0;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
%}
|
||||
|
||||
%option bison-bridge bison-locations reentrant noyywrap
|
||||
%option extra-type="glcpp_parser_t *"
|
||||
%option prefix="glcpp_"
|
||||
%option stack
|
||||
%option never-interactive
|
||||
%option warn nodefault
|
||||
|
||||
/* Note: When adding any start conditions to this list, you must also
|
||||
* update the "Internal compiler error" catch-all rule near the end of
|
||||
* this file. */
|
||||
|
||||
%x COMMENT DEFINE DONE HASH NEWLINE_CATCHUP UNREACHABLE
|
||||
|
||||
SPACE [[:space:]]
|
||||
NONSPACE [^[:space:]]
|
||||
HSPACE [ \t]
|
||||
HASH #
|
||||
NEWLINE (\r\n|\n\r|\r|\n)
|
||||
IDENTIFIER [_a-zA-Z][_a-zA-Z0-9]*
|
||||
PP_NUMBER [.]?[0-9]([._a-zA-Z0-9]|[eEpP][-+])*
|
||||
PUNCTUATION [][(){}.&*~!/%<>^|;,=+-]
|
||||
|
||||
/* The OTHER class is simply a catch-all for things that the CPP
|
||||
parser just doesn't care about. Since flex regular expressions that
|
||||
match longer strings take priority over those matching shorter
|
||||
strings, we have to be careful to avoid OTHER matching and hiding
|
||||
something that CPP does care about. So we simply exclude all
|
||||
characters that appear in any other expressions. */
|
||||
|
||||
OTHER [^][_#[:space:]#a-zA-Z0-9(){}.&*~!/%<>^|;,=+-]
|
||||
|
||||
DIGITS [0-9][0-9]*
|
||||
DECIMAL_INTEGER [1-9][0-9]*[uU]?
|
||||
OCTAL_INTEGER 0[0-7]*[uU]?
|
||||
HEXADECIMAL_INTEGER 0[xX][0-9a-fA-F]+[uU]?
|
||||
|
||||
%%
|
||||
|
||||
glcpp_parser_t *parser = yyextra;
|
||||
|
||||
/* When we lex a multi-line comment, we replace it (as
|
||||
* specified) with a single space. But if the comment spanned
|
||||
* multiple lines, then subsequent parsing stages will not
|
||||
* count correct line numbers. To avoid this problem we keep
|
||||
* track of all newlines that were commented out by a
|
||||
* multi-line comment, and we emit a NEWLINE token for each at
|
||||
* the next legal opportunity, (which is when the lexer would
|
||||
* be emitting a NEWLINE token anyway).
|
||||
*/
|
||||
if (YY_START == NEWLINE_CATCHUP) {
|
||||
if (parser->commented_newlines)
|
||||
parser->commented_newlines--;
|
||||
if (parser->commented_newlines == 0)
|
||||
BEGIN INITIAL;
|
||||
RETURN_TOKEN_NEVER_SKIP (NEWLINE);
|
||||
}
|
||||
|
||||
/* Set up the parser->skipping bit here before doing any lexing.
|
||||
*
|
||||
* This bit controls whether tokens are skipped, (as implemented by
|
||||
* RETURN_TOKEN), such as between "#if 0" and "#endif".
|
||||
*
|
||||
* The parser maintains a skip_stack indicating whether we should be
|
||||
* skipping, (and nested levels of #if/#ifdef/#ifndef/#endif) will
|
||||
* push and pop items from the stack.
|
||||
*
|
||||
* Here are the rules for determining whether we are skipping:
|
||||
*
|
||||
* 1. If the skip stack is NULL, we are outside of all #if blocks
|
||||
* and we are not skipping.
|
||||
*
|
||||
* 2. If the skip stack is non-NULL, the type of the top node in
|
||||
* the stack determines whether to skip. A type of
|
||||
* SKIP_NO_SKIP is used for blocks wheere we are emitting
|
||||
* tokens, (such as between #if 1 and #endif, or after the
|
||||
* #else of an #if 0, etc.).
|
||||
*
|
||||
* 3. The lexing_directive bit overrides the skip stack. This bit
|
||||
* is set when we are actively lexing the expression for a
|
||||
* pre-processor condition, (such as #if, #elif, or #else). In
|
||||
* this case, even if otherwise skipping, we need to emit the
|
||||
* tokens for this condition so that the parser can evaluate
|
||||
* the expression. (For, #else, there's no expression, but we
|
||||
* emit tokens so the parser can generate a nice error message
|
||||
* if there are any tokens here).
|
||||
*/
|
||||
if (parser->skip_stack &&
|
||||
parser->skip_stack->type != SKIP_NO_SKIP &&
|
||||
! parser->lexing_directive)
|
||||
{
|
||||
parser->skipping = 1;
|
||||
} else {
|
||||
parser->skipping = 0;
|
||||
}
|
||||
|
||||
/* Single-line comments */
|
||||
<INITIAL,DEFINE,HASH>"//"[^\r\n]* {
|
||||
}
|
||||
|
||||
/* Multi-line comments */
|
||||
<INITIAL,DEFINE,HASH>"/*" { yy_push_state(COMMENT, yyscanner); }
|
||||
<COMMENT>[^*\r\n]*
|
||||
<COMMENT>[^*\r\n]*{NEWLINE} { yylineno++; yycolumn = 0; parser->commented_newlines++; }
|
||||
<COMMENT>"*"+[^*/\r\n]*
|
||||
<COMMENT>"*"+[^*/\r\n]*{NEWLINE} { yylineno++; yycolumn = 0; parser->commented_newlines++; }
|
||||
<COMMENT>"*"+"/" {
|
||||
yy_pop_state(yyscanner);
|
||||
/* In the <HASH> start condition, we don't want any SPACE token. */
|
||||
if (yyextra->space_tokens && YY_START != HASH)
|
||||
RETURN_TOKEN (SPACE);
|
||||
}
|
||||
|
||||
{HASH} {
|
||||
|
||||
/* If the '#' is the first non-whitespace, non-comment token on this
|
||||
* line, then it introduces a directive, switch to the <HASH> start
|
||||
* condition.
|
||||
*
|
||||
* Otherwise, this is just punctuation, so return the HASH_TOKEN
|
||||
* token. */
|
||||
if (parser->first_non_space_token_this_line) {
|
||||
BEGIN HASH;
|
||||
}
|
||||
|
||||
RETURN_TOKEN_NEVER_SKIP (HASH_TOKEN);
|
||||
}
|
||||
|
||||
<HASH>version{HSPACE}+ {
|
||||
BEGIN INITIAL;
|
||||
yyextra->space_tokens = 0;
|
||||
RETURN_STRING_TOKEN (VERSION_TOKEN);
|
||||
}
|
||||
|
||||
/* Swallow empty #pragma directives, (to avoid confusing the
|
||||
* downstream compiler).
|
||||
*
|
||||
* Note: We use a simple regular expression for the lookahead
|
||||
* here. Specifically, we cannot use the complete {NEWLINE} expression
|
||||
* since it uses alternation and we've found that there's a flex bug
|
||||
* where using alternation in the lookahead portion of a pattern
|
||||
* triggers a buffer overrun. */
|
||||
<HASH>pragma{HSPACE}*/[\r\n] {
|
||||
BEGIN INITIAL;
|
||||
}
|
||||
|
||||
/* glcpp doesn't handle #extension, #version, or #pragma directives.
|
||||
* Simply pass them through to the main compiler's lexer/parser. */
|
||||
<HASH>(extension|pragma)[^\r\n]* {
|
||||
BEGIN INITIAL;
|
||||
RETURN_STRING_TOKEN (PRAGMA);
|
||||
}
|
||||
|
||||
<HASH>line{HSPACE}+ {
|
||||
BEGIN INITIAL;
|
||||
RETURN_TOKEN (LINE);
|
||||
}
|
||||
|
||||
<HASH>{NEWLINE} {
|
||||
BEGIN INITIAL;
|
||||
RETURN_TOKEN_NEVER_SKIP (NEWLINE);
|
||||
}
|
||||
|
||||
/* For the pre-processor directives, we return these tokens
|
||||
* even when we are otherwise skipping. */
|
||||
<HASH>ifdef {
|
||||
BEGIN INITIAL;
|
||||
yyextra->lexing_directive = 1;
|
||||
yyextra->space_tokens = 0;
|
||||
RETURN_TOKEN_NEVER_SKIP (IFDEF);
|
||||
}
|
||||
|
||||
<HASH>ifndef {
|
||||
BEGIN INITIAL;
|
||||
yyextra->lexing_directive = 1;
|
||||
yyextra->space_tokens = 0;
|
||||
RETURN_TOKEN_NEVER_SKIP (IFNDEF);
|
||||
}
|
||||
|
||||
<HASH>if/[^_a-zA-Z0-9] {
|
||||
BEGIN INITIAL;
|
||||
yyextra->lexing_directive = 1;
|
||||
yyextra->space_tokens = 0;
|
||||
RETURN_TOKEN_NEVER_SKIP (IF);
|
||||
}
|
||||
|
||||
<HASH>elif/[^_a-zA-Z0-9] {
|
||||
BEGIN INITIAL;
|
||||
yyextra->lexing_directive = 1;
|
||||
yyextra->space_tokens = 0;
|
||||
RETURN_TOKEN_NEVER_SKIP (ELIF);
|
||||
}
|
||||
|
||||
<HASH>else {
|
||||
BEGIN INITIAL;
|
||||
yyextra->space_tokens = 0;
|
||||
RETURN_TOKEN_NEVER_SKIP (ELSE);
|
||||
}
|
||||
|
||||
<HASH>endif {
|
||||
BEGIN INITIAL;
|
||||
yyextra->space_tokens = 0;
|
||||
RETURN_TOKEN_NEVER_SKIP (ENDIF);
|
||||
}
|
||||
|
||||
<HASH>error[^\r\n]* {
|
||||
BEGIN INITIAL;
|
||||
RETURN_STRING_TOKEN (ERROR_TOKEN);
|
||||
}
|
||||
|
||||
/* After we see a "#define" we enter the <DEFINE> start state
|
||||
* for the lexer. Within <DEFINE> we are looking for the first
|
||||
* identifier and specifically checking whether the identifier
|
||||
* is followed by a '(' or not, (to lex either a
|
||||
* FUNC_IDENTIFIER or an OBJ_IDENITIFIER token).
|
||||
*
|
||||
* While in the <DEFINE> state we also need to explicitly
|
||||
* handle a few other things that may appear before the
|
||||
* identifier:
|
||||
*
|
||||
* * Comments, (handled above with the main support for
|
||||
* comments).
|
||||
*
|
||||
* * Whitespace (simply ignored)
|
||||
*
|
||||
* * Anything else, (not an identifier, not a comment,
|
||||
* and not whitespace). This will generate an error.
|
||||
*/
|
||||
<HASH>define{HSPACE}* {
|
||||
if (! parser->skipping) {
|
||||
BEGIN DEFINE;
|
||||
yyextra->space_tokens = 0;
|
||||
RETURN_TOKEN (DEFINE_TOKEN);
|
||||
}
|
||||
}
|
||||
|
||||
<HASH>undef {
|
||||
BEGIN INITIAL;
|
||||
yyextra->space_tokens = 0;
|
||||
RETURN_TOKEN (UNDEF);
|
||||
}
|
||||
|
||||
<HASH>{HSPACE}+ {
|
||||
/* Nothing to do here. Importantly, don't leave the <HASH>
|
||||
* start condition, since it's legal to have space between the
|
||||
* '#' and the directive.. */
|
||||
}
|
||||
|
||||
/* This will catch any non-directive garbage after a HASH */
|
||||
<HASH>{NONSPACE} {
|
||||
BEGIN INITIAL;
|
||||
RETURN_TOKEN (GARBAGE);
|
||||
}
|
||||
|
||||
/* An identifier immediately followed by '(' */
|
||||
<DEFINE>{IDENTIFIER}/"(" {
|
||||
BEGIN INITIAL;
|
||||
RETURN_STRING_TOKEN (FUNC_IDENTIFIER);
|
||||
}
|
||||
|
||||
/* An identifier not immediately followed by '(' */
|
||||
<DEFINE>{IDENTIFIER} {
|
||||
BEGIN INITIAL;
|
||||
RETURN_STRING_TOKEN (OBJ_IDENTIFIER);
|
||||
}
|
||||
|
||||
/* Whitespace */
|
||||
<DEFINE>{HSPACE}+ {
|
||||
/* Just ignore it. Nothing to do here. */
|
||||
}
|
||||
|
||||
/* '/' not followed by '*', so not a comment. This is an error. */
|
||||
<DEFINE>[/][^*]{NONSPACE}* {
|
||||
BEGIN INITIAL;
|
||||
glcpp_error(yylloc, yyextra, "#define followed by a non-identifier: %s", yytext);
|
||||
RETURN_STRING_TOKEN (INTEGER_STRING);
|
||||
}
|
||||
|
||||
/* A character that can't start an identifier, comment, or
|
||||
* space. This is an error. */
|
||||
<DEFINE>[^_a-zA-Z/[:space:]]{NONSPACE}* {
|
||||
BEGIN INITIAL;
|
||||
glcpp_error(yylloc, yyextra, "#define followed by a non-identifier: %s", yytext);
|
||||
RETURN_STRING_TOKEN (INTEGER_STRING);
|
||||
}
|
||||
|
||||
{DECIMAL_INTEGER} {
|
||||
RETURN_STRING_TOKEN (INTEGER_STRING);
|
||||
}
|
||||
|
||||
{OCTAL_INTEGER} {
|
||||
RETURN_STRING_TOKEN (INTEGER_STRING);
|
||||
}
|
||||
|
||||
{HEXADECIMAL_INTEGER} {
|
||||
RETURN_STRING_TOKEN (INTEGER_STRING);
|
||||
}
|
||||
|
||||
"<<" {
|
||||
RETURN_TOKEN (LEFT_SHIFT);
|
||||
}
|
||||
|
||||
">>" {
|
||||
RETURN_TOKEN (RIGHT_SHIFT);
|
||||
}
|
||||
|
||||
"<=" {
|
||||
RETURN_TOKEN (LESS_OR_EQUAL);
|
||||
}
|
||||
|
||||
">=" {
|
||||
RETURN_TOKEN (GREATER_OR_EQUAL);
|
||||
}
|
||||
|
||||
"==" {
|
||||
RETURN_TOKEN (EQUAL);
|
||||
}
|
||||
|
||||
"!=" {
|
||||
RETURN_TOKEN (NOT_EQUAL);
|
||||
}
|
||||
|
||||
"&&" {
|
||||
RETURN_TOKEN (AND);
|
||||
}
|
||||
|
||||
"||" {
|
||||
RETURN_TOKEN (OR);
|
||||
}
|
||||
|
||||
"++" {
|
||||
RETURN_TOKEN (PLUS_PLUS);
|
||||
}
|
||||
|
||||
"--" {
|
||||
RETURN_TOKEN (MINUS_MINUS);
|
||||
}
|
||||
|
||||
"##" {
|
||||
if (! parser->skipping) {
|
||||
if (parser->is_gles)
|
||||
glcpp_error(yylloc, yyextra, "Token pasting (##) is illegal in GLES");
|
||||
RETURN_TOKEN (PASTE);
|
||||
}
|
||||
}
|
||||
|
||||
"defined" {
|
||||
RETURN_TOKEN (DEFINED);
|
||||
}
|
||||
|
||||
{IDENTIFIER} {
|
||||
RETURN_STRING_TOKEN (IDENTIFIER);
|
||||
}
|
||||
|
||||
{PP_NUMBER} {
|
||||
RETURN_STRING_TOKEN (OTHER);
|
||||
}
|
||||
|
||||
{PUNCTUATION} {
|
||||
RETURN_TOKEN (yytext[0]);
|
||||
}
|
||||
|
||||
{OTHER}+ {
|
||||
RETURN_STRING_TOKEN (OTHER);
|
||||
}
|
||||
|
||||
{HSPACE} {
|
||||
if (yyextra->space_tokens) {
|
||||
RETURN_TOKEN (SPACE);
|
||||
}
|
||||
}
|
||||
|
||||
/* We preserve all newlines, even between #if 0..#endif, so no
|
||||
skipping.. */
|
||||
<*>{NEWLINE} {
|
||||
if (parser->commented_newlines) {
|
||||
BEGIN NEWLINE_CATCHUP;
|
||||
} else {
|
||||
BEGIN INITIAL;
|
||||
}
|
||||
yyextra->space_tokens = 1;
|
||||
yyextra->lexing_directive = 0;
|
||||
yylineno++;
|
||||
yycolumn = 0;
|
||||
RETURN_TOKEN_NEVER_SKIP (NEWLINE);
|
||||
}
|
||||
|
||||
<INITIAL,COMMENT,DEFINE,HASH><<EOF>> {
|
||||
if (YY_START == COMMENT)
|
||||
glcpp_error(yylloc, yyextra, "Unterminated comment");
|
||||
BEGIN DONE; /* Don't keep matching this rule forever. */
|
||||
yyextra->lexing_directive = 0;
|
||||
if (! parser->last_token_was_newline)
|
||||
RETURN_TOKEN (NEWLINE);
|
||||
}
|
||||
|
||||
/* This is a catch-all to avoid the annoying default flex action which
|
||||
* matches any character and prints it. If any input ever matches this
|
||||
* rule, then we have made a mistake above and need to fix one or more
|
||||
* of the preceding patterns to match that input. */
|
||||
|
||||
<*>. {
|
||||
glcpp_error(yylloc, yyextra, "Internal compiler error: Unexpected character: %s", yytext);
|
||||
|
||||
/* We don't actually use the UNREACHABLE start condition. We
|
||||
only have this block here so that we can pretend to call some
|
||||
generated functions, (to avoid "defined but not used"
|
||||
warnings. */
|
||||
if (YY_START == UNREACHABLE) {
|
||||
unput('.');
|
||||
yy_top_state(yyextra);
|
||||
}
|
||||
}
|
||||
|
||||
%%
|
||||
|
||||
void
|
||||
glcpp_lex_set_source_string(glcpp_parser_t *parser, const char *shader)
|
||||
{
|
||||
yy_scan_string(shader, parser->scanner);
|
||||
}
|
File diff suppressed because it is too large
Load Diff
|
@ -1,110 +0,0 @@
|
|||
/* A Bison parser, made by GNU Bison 3.0.2. */
|
||||
|
||||
/* Bison interface for Yacc-like parsers in C
|
||||
|
||||
Copyright (C) 1984, 1989-1990, 2000-2013 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
/* As a special exception, you may create a larger work that contains
|
||||
part or all of the Bison parser skeleton and distribute that work
|
||||
under terms of your choice, so long as that work isn't itself a
|
||||
parser generator using the skeleton or a modified version thereof
|
||||
as a parser skeleton. Alternatively, if you modify or redistribute
|
||||
the parser skeleton itself, you may (at your option) remove this
|
||||
special exception, which will cause the skeleton and the resulting
|
||||
Bison output files to be licensed under the GNU General Public
|
||||
License without this special exception.
|
||||
|
||||
This special exception was added by the Free Software Foundation in
|
||||
version 2.2 of Bison. */
|
||||
|
||||
#ifndef YY_GLCPP_PARSER_SRC_GLSL_GLCPP_GLCPP_PARSE_H_INCLUDED
|
||||
# define YY_GLCPP_PARSER_SRC_GLSL_GLCPP_GLCPP_PARSE_H_INCLUDED
|
||||
/* Debug traces. */
|
||||
#ifndef YYDEBUG
|
||||
# define YYDEBUG 1
|
||||
#endif
|
||||
#if YYDEBUG
|
||||
extern int glcpp_parser_debug;
|
||||
#endif
|
||||
|
||||
/* Token type. */
|
||||
#ifndef YYTOKENTYPE
|
||||
# define YYTOKENTYPE
|
||||
enum yytokentype
|
||||
{
|
||||
DEFINED = 258,
|
||||
ELIF_EXPANDED = 259,
|
||||
HASH_TOKEN = 260,
|
||||
DEFINE_TOKEN = 261,
|
||||
FUNC_IDENTIFIER = 262,
|
||||
OBJ_IDENTIFIER = 263,
|
||||
ELIF = 264,
|
||||
ELSE = 265,
|
||||
ENDIF = 266,
|
||||
ERROR_TOKEN = 267,
|
||||
IF = 268,
|
||||
IFDEF = 269,
|
||||
IFNDEF = 270,
|
||||
LINE = 271,
|
||||
PRAGMA = 272,
|
||||
UNDEF = 273,
|
||||
VERSION_TOKEN = 274,
|
||||
GARBAGE = 275,
|
||||
IDENTIFIER = 276,
|
||||
IF_EXPANDED = 277,
|
||||
INTEGER = 278,
|
||||
INTEGER_STRING = 279,
|
||||
LINE_EXPANDED = 280,
|
||||
NEWLINE = 281,
|
||||
OTHER = 282,
|
||||
PLACEHOLDER = 283,
|
||||
SPACE = 284,
|
||||
PLUS_PLUS = 285,
|
||||
MINUS_MINUS = 286,
|
||||
PASTE = 287,
|
||||
OR = 288,
|
||||
AND = 289,
|
||||
EQUAL = 290,
|
||||
NOT_EQUAL = 291,
|
||||
LESS_OR_EQUAL = 292,
|
||||
GREATER_OR_EQUAL = 293,
|
||||
LEFT_SHIFT = 294,
|
||||
RIGHT_SHIFT = 295,
|
||||
UNARY = 296
|
||||
};
|
||||
#endif
|
||||
|
||||
/* Value type. */
|
||||
|
||||
/* Location type. */
|
||||
#if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED
|
||||
typedef struct YYLTYPE YYLTYPE;
|
||||
struct YYLTYPE
|
||||
{
|
||||
int first_line;
|
||||
int first_column;
|
||||
int last_line;
|
||||
int last_column;
|
||||
};
|
||||
# define YYLTYPE_IS_DECLARED 1
|
||||
# define YYLTYPE_IS_TRIVIAL 1
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
int glcpp_parser_parse (glcpp_parser_t *parser);
|
||||
|
||||
#endif /* !YY_GLCPP_PARSER_SRC_GLSL_GLCPP_GLCPP_PARSE_H_INCLUDED */
|
File diff suppressed because it is too large
Load Diff
|
@ -1,253 +0,0 @@
|
|||
/*
|
||||
* Copyright © 2010 Intel Corporation
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the next
|
||||
* paragraph) shall be included in all copies or substantial portions of the
|
||||
* Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef GLCPP_H
|
||||
#define GLCPP_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#include "main/mtypes.h"
|
||||
|
||||
#include "util/ralloc.h"
|
||||
|
||||
#include "program/hash_table.h"
|
||||
|
||||
#define yyscan_t void*
|
||||
|
||||
/* Some data types used for parser values. */
|
||||
|
||||
typedef struct expression_value {
|
||||
intmax_t value;
|
||||
char *undefined_macro;
|
||||
} expression_value_t;
|
||||
|
||||
|
||||
typedef struct string_node {
|
||||
const char *str;
|
||||
struct string_node *next;
|
||||
} string_node_t;
|
||||
|
||||
typedef struct string_list {
|
||||
string_node_t *head;
|
||||
string_node_t *tail;
|
||||
} string_list_t;
|
||||
|
||||
typedef struct token token_t;
|
||||
typedef struct token_list token_list_t;
|
||||
|
||||
typedef union YYSTYPE
|
||||
{
|
||||
// Could be int, but results in some bugs with parsing of #version directives
|
||||
// in Apple LLVM Compiler 4.2 when building for 32 bit.
|
||||
intmax_t ival;
|
||||
expression_value_t expression_value;
|
||||
char *str;
|
||||
string_list_t *string_list;
|
||||
token_t *token;
|
||||
token_list_t *token_list;
|
||||
} YYSTYPE;
|
||||
|
||||
# define YYSTYPE_IS_TRIVIAL 1
|
||||
# define YYSTYPE_IS_DECLARED 1
|
||||
|
||||
typedef struct YYLTYPE {
|
||||
int first_line;
|
||||
int first_column;
|
||||
int last_line;
|
||||
int last_column;
|
||||
unsigned source;
|
||||
} YYLTYPE;
|
||||
# define YYLTYPE_IS_DECLARED 1
|
||||
# define YYLTYPE_IS_TRIVIAL 1
|
||||
|
||||
# define YYLLOC_DEFAULT(Current, Rhs, N) \
|
||||
do { \
|
||||
if (N) \
|
||||
{ \
|
||||
(Current).first_line = YYRHSLOC(Rhs, 1).first_line; \
|
||||
(Current).first_column = YYRHSLOC(Rhs, 1).first_column; \
|
||||
(Current).last_line = YYRHSLOC(Rhs, N).last_line; \
|
||||
(Current).last_column = YYRHSLOC(Rhs, N).last_column; \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
(Current).first_line = (Current).last_line = \
|
||||
YYRHSLOC(Rhs, 0).last_line; \
|
||||
(Current).first_column = (Current).last_column = \
|
||||
YYRHSLOC(Rhs, 0).last_column; \
|
||||
} \
|
||||
(Current).source = 0; \
|
||||
} while (0)
|
||||
|
||||
struct token {
|
||||
int type;
|
||||
YYSTYPE value;
|
||||
YYLTYPE location;
|
||||
};
|
||||
|
||||
typedef struct token_node {
|
||||
token_t *token;
|
||||
struct token_node *next;
|
||||
} token_node_t;
|
||||
|
||||
struct token_list {
|
||||
token_node_t *head;
|
||||
token_node_t *tail;
|
||||
token_node_t *non_space_tail;
|
||||
};
|
||||
|
||||
typedef struct argument_node {
|
||||
token_list_t *argument;
|
||||
struct argument_node *next;
|
||||
} argument_node_t;
|
||||
|
||||
typedef struct argument_list {
|
||||
argument_node_t *head;
|
||||
argument_node_t *tail;
|
||||
} argument_list_t;
|
||||
|
||||
typedef struct glcpp_parser glcpp_parser_t;
|
||||
|
||||
typedef enum {
|
||||
TOKEN_CLASS_IDENTIFIER,
|
||||
TOKEN_CLASS_IDENTIFIER_FINALIZED,
|
||||
TOKEN_CLASS_FUNC_MACRO,
|
||||
TOKEN_CLASS_OBJ_MACRO
|
||||
} token_class_t;
|
||||
|
||||
token_class_t
|
||||
glcpp_parser_classify_token (glcpp_parser_t *parser,
|
||||
const char *identifier,
|
||||
int *parameter_index);
|
||||
|
||||
typedef struct {
|
||||
int is_function;
|
||||
string_list_t *parameters;
|
||||
const char *identifier;
|
||||
token_list_t *replacements;
|
||||
} macro_t;
|
||||
|
||||
typedef struct expansion_node {
|
||||
macro_t *macro;
|
||||
token_node_t *replacements;
|
||||
struct expansion_node *next;
|
||||
} expansion_node_t;
|
||||
|
||||
typedef enum skip_type {
|
||||
SKIP_NO_SKIP,
|
||||
SKIP_TO_ELSE,
|
||||
SKIP_TO_ENDIF
|
||||
} skip_type_t;
|
||||
|
||||
typedef struct skip_node {
|
||||
skip_type_t type;
|
||||
bool has_else;
|
||||
YYLTYPE loc; /* location of the initial #if/#elif/... */
|
||||
struct skip_node *next;
|
||||
} skip_node_t;
|
||||
|
||||
typedef struct active_list {
|
||||
const char *identifier;
|
||||
token_node_t *marker;
|
||||
struct active_list *next;
|
||||
} active_list_t;
|
||||
|
||||
struct glcpp_parser {
|
||||
yyscan_t scanner;
|
||||
struct hash_table *defines;
|
||||
active_list_t *active;
|
||||
int lexing_directive;
|
||||
int space_tokens;
|
||||
int last_token_was_newline;
|
||||
int last_token_was_space;
|
||||
int first_non_space_token_this_line;
|
||||
int newline_as_space;
|
||||
int in_control_line;
|
||||
int paren_count;
|
||||
int commented_newlines;
|
||||
skip_node_t *skip_stack;
|
||||
int skipping;
|
||||
token_list_t *lex_from_list;
|
||||
token_node_t *lex_from_node;
|
||||
char *output;
|
||||
char *info_log;
|
||||
size_t output_length;
|
||||
size_t info_log_length;
|
||||
int error;
|
||||
const struct gl_extensions *extensions;
|
||||
gl_api api;
|
||||
bool version_resolved;
|
||||
bool has_new_line_number;
|
||||
int new_line_number;
|
||||
bool has_new_source_number;
|
||||
int new_source_number;
|
||||
bool is_gles;
|
||||
};
|
||||
|
||||
struct gl_extensions;
|
||||
|
||||
glcpp_parser_t *
|
||||
glcpp_parser_create (const struct gl_extensions *extensions, gl_api api);
|
||||
|
||||
int
|
||||
glcpp_parser_parse (glcpp_parser_t *parser);
|
||||
|
||||
void
|
||||
glcpp_parser_destroy (glcpp_parser_t *parser);
|
||||
|
||||
void
|
||||
glcpp_parser_resolve_implicit_version(glcpp_parser_t *parser);
|
||||
|
||||
int
|
||||
glcpp_preprocess(void *ralloc_ctx, const char **shader, char **info_log,
|
||||
const struct gl_extensions *extensions, struct gl_context *g_ctx);
|
||||
|
||||
/* Functions for writing to the info log */
|
||||
|
||||
void
|
||||
glcpp_error (YYLTYPE *locp, glcpp_parser_t *parser, const char *fmt, ...);
|
||||
|
||||
void
|
||||
glcpp_warning (YYLTYPE *locp, glcpp_parser_t *parser, const char *fmt, ...);
|
||||
|
||||
/* Generated by glcpp-lex.l to glcpp-lex.c */
|
||||
|
||||
int
|
||||
glcpp_lex_init_extra (glcpp_parser_t *parser, yyscan_t* scanner);
|
||||
|
||||
void
|
||||
glcpp_lex_set_source_string(glcpp_parser_t *parser, const char *shader);
|
||||
|
||||
int
|
||||
glcpp_lex (YYSTYPE *lvalp, YYLTYPE *llocp, yyscan_t scanner);
|
||||
|
||||
int
|
||||
glcpp_lex_destroy (yyscan_t scanner);
|
||||
|
||||
/* Generated by glcpp-parse.y to glcpp-parse.c */
|
||||
|
||||
int
|
||||
yyparse (glcpp_parser_t *parser);
|
||||
|
||||
#endif
|
|
@ -1,242 +0,0 @@
|
|||
/*
|
||||
* Copyright © 2010 Intel Corporation
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the next
|
||||
* paragraph) shall be included in all copies or substantial portions of the
|
||||
* Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <assert.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include "glcpp.h"
|
||||
#include "main/core.h" /* for isblank() on MSVC */
|
||||
|
||||
void
|
||||
glcpp_error (YYLTYPE *locp, glcpp_parser_t *parser, const char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
|
||||
parser->error = 1;
|
||||
ralloc_asprintf_rewrite_tail(&parser->info_log,
|
||||
&parser->info_log_length,
|
||||
"%u:%u(%u): "
|
||||
"preprocessor error: ",
|
||||
locp->source,
|
||||
locp->first_line,
|
||||
locp->first_column);
|
||||
va_start(ap, fmt);
|
||||
ralloc_vasprintf_rewrite_tail(&parser->info_log,
|
||||
&parser->info_log_length,
|
||||
fmt, ap);
|
||||
va_end(ap);
|
||||
ralloc_asprintf_rewrite_tail(&parser->info_log,
|
||||
&parser->info_log_length, "\n");
|
||||
}
|
||||
|
||||
void
|
||||
glcpp_warning (YYLTYPE *locp, glcpp_parser_t *parser, const char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
|
||||
ralloc_asprintf_rewrite_tail(&parser->info_log,
|
||||
&parser->info_log_length,
|
||||
"%u:%u(%u): "
|
||||
"preprocessor warning: ",
|
||||
locp->source,
|
||||
locp->first_line,
|
||||
locp->first_column);
|
||||
va_start(ap, fmt);
|
||||
ralloc_vasprintf_rewrite_tail(&parser->info_log,
|
||||
&parser->info_log_length,
|
||||
fmt, ap);
|
||||
va_end(ap);
|
||||
ralloc_asprintf_rewrite_tail(&parser->info_log,
|
||||
&parser->info_log_length, "\n");
|
||||
}
|
||||
|
||||
/* Given str, (that's expected to start with a newline terminator of some
|
||||
* sort), return a pointer to the first character in str after the newline.
|
||||
*
|
||||
* A newline terminator can be any of the following sequences:
|
||||
*
|
||||
* "\r\n"
|
||||
* "\n\r"
|
||||
* "\n"
|
||||
* "\r"
|
||||
*
|
||||
* And the longest such sequence will be skipped.
|
||||
*/
|
||||
static const char *
|
||||
skip_newline (const char *str)
|
||||
{
|
||||
const char *ret = str;
|
||||
|
||||
if (ret == NULL)
|
||||
return ret;
|
||||
|
||||
if (*ret == '\0')
|
||||
return ret;
|
||||
|
||||
if (*ret == '\r') {
|
||||
ret++;
|
||||
if (*ret && *ret == '\n')
|
||||
ret++;
|
||||
} else if (*ret == '\n') {
|
||||
ret++;
|
||||
if (*ret && *ret == '\r')
|
||||
ret++;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Remove any line continuation characters in the shader, (whether in
|
||||
* preprocessing directives or in GLSL code).
|
||||
*/
|
||||
static char *
|
||||
remove_line_continuations(glcpp_parser_t *ctx, const char *shader)
|
||||
{
|
||||
char *clean = ralloc_strdup(ctx, "");
|
||||
const char *backslash, *newline, *search_start;
|
||||
const char *cr, *lf;
|
||||
char newline_separator[3];
|
||||
int collapsed_newlines = 0;
|
||||
|
||||
search_start = shader;
|
||||
|
||||
/* Determine what flavor of newlines this shader is using. GLSL
|
||||
* provides for 4 different possible ways to separate lines, (using
|
||||
* one or two characters):
|
||||
*
|
||||
* "\n" (line-feed, like Linux, Unix, and new Mac OS)
|
||||
* "\r" (carriage-return, like old Mac files)
|
||||
* "\r\n" (carriage-return + line-feed, like DOS files)
|
||||
* "\n\r" (line-feed + carriage-return, like nothing, really)
|
||||
*
|
||||
* This code explicitly supports a shader that uses a mixture of
|
||||
* newline terminators and will properly handle line continuation
|
||||
* backslashes followed by any of the above.
|
||||
*
|
||||
* But, since we must also insert additional newlines in the output
|
||||
* (for any collapsed lines) we attempt to maintain consistency by
|
||||
* examining the first encountered newline terminator, and using the
|
||||
* same terminator for any newlines we insert.
|
||||
*/
|
||||
cr = strchr(search_start, '\r');
|
||||
lf = strchr(search_start, '\n');
|
||||
|
||||
newline_separator[0] = '\n';
|
||||
newline_separator[1] = '\0';
|
||||
newline_separator[2] = '\0';
|
||||
|
||||
if (cr == NULL) {
|
||||
/* Nothing to do. */
|
||||
} else if (lf == NULL) {
|
||||
newline_separator[0] = '\r';
|
||||
} else if (lf == cr + 1) {
|
||||
newline_separator[0] = '\r';
|
||||
newline_separator[1] = '\n';
|
||||
} else if (cr == lf + 1) {
|
||||
newline_separator[0] = '\n';
|
||||
newline_separator[1] = '\r';
|
||||
}
|
||||
|
||||
while (true) {
|
||||
backslash = strchr(search_start, '\\');
|
||||
|
||||
/* If we have previously collapsed any line-continuations,
|
||||
* then we want to insert additional newlines at the next
|
||||
* occurrence of a newline character to avoid changing any
|
||||
* line numbers.
|
||||
*/
|
||||
if (collapsed_newlines) {
|
||||
cr = strchr (search_start, '\r');
|
||||
lf = strchr (search_start, '\n');
|
||||
if (cr && lf)
|
||||
newline = cr < lf ? cr : lf;
|
||||
else if (cr)
|
||||
newline = cr;
|
||||
else
|
||||
newline = lf;
|
||||
if (newline &&
|
||||
(backslash == NULL || newline < backslash))
|
||||
{
|
||||
ralloc_strncat(&clean, shader,
|
||||
newline - shader + 1);
|
||||
while (collapsed_newlines) {
|
||||
ralloc_strcat(&clean, newline_separator);
|
||||
collapsed_newlines--;
|
||||
}
|
||||
shader = skip_newline (newline);
|
||||
search_start = shader;
|
||||
}
|
||||
}
|
||||
|
||||
search_start = backslash + 1;
|
||||
|
||||
if (backslash == NULL)
|
||||
break;
|
||||
|
||||
/* At each line continuation, (backslash followed by a
|
||||
* newline), copy all preceding text to the output, then
|
||||
* advance the shader pointer to the character after the
|
||||
* newline.
|
||||
*/
|
||||
if (backslash[1] == '\r' || backslash[1] == '\n')
|
||||
{
|
||||
collapsed_newlines++;
|
||||
ralloc_strncat(&clean, shader, backslash - shader);
|
||||
shader = skip_newline (backslash + 1);
|
||||
search_start = shader;
|
||||
}
|
||||
}
|
||||
|
||||
ralloc_strcat(&clean, shader);
|
||||
|
||||
return clean;
|
||||
}
|
||||
|
||||
int
|
||||
glcpp_preprocess(void *ralloc_ctx, const char **shader, char **info_log,
|
||||
const struct gl_extensions *extensions, struct gl_context *gl_ctx)
|
||||
{
|
||||
int errors;
|
||||
glcpp_parser_t *parser = glcpp_parser_create (extensions, gl_ctx->API);
|
||||
|
||||
if (! gl_ctx->Const.DisableGLSLLineContinuations)
|
||||
*shader = remove_line_continuations(parser, *shader);
|
||||
|
||||
glcpp_lex_set_source_string (parser, *shader);
|
||||
|
||||
glcpp_parser_parse (parser);
|
||||
|
||||
if (parser->skip_stack)
|
||||
glcpp_error (&parser->skip_stack->loc, parser, "Unterminated #if\n");
|
||||
|
||||
glcpp_parser_resolve_implicit_version(parser);
|
||||
|
||||
ralloc_strcat(info_log, parser->info_log);
|
||||
|
||||
ralloc_steal(ralloc_ctx, parser->output);
|
||||
*shader = parser->output;
|
||||
|
||||
errors = parser->error;
|
||||
glcpp_parser_destroy (parser);
|
||||
return errors;
|
||||
}
|
File diff suppressed because it is too large
Load Diff
|
@ -1,596 +0,0 @@
|
|||
%{
|
||||
/*
|
||||
* Copyright © 2008, 2009 Intel Corporation
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the next
|
||||
* paragraph) shall be included in all copies or substantial portions of the
|
||||
* Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
#include <ctype.h>
|
||||
#include <limits.h>
|
||||
#include "strtod.h"
|
||||
#include "ast.h"
|
||||
#include "glsl_parser_extras.h"
|
||||
#include "glsl_parser.h"
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
# pragma warning(disable: 4065) // warning C4065: switch statement contains 'default' but no 'case' labels
|
||||
# pragma warning(disable: 4244) // warning C4244: '=' : conversion from 'double' to 'float', possible loss of data
|
||||
# pragma warning(disable: 4267) // warning C4267: '=' : conversion from 'size_t' to 'int', possible loss of data
|
||||
#endif // defined(_MSC_VER)
|
||||
|
||||
static int classify_identifier(struct _mesa_glsl_parse_state *, const char *);
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#define YY_NO_UNISTD_H
|
||||
#endif
|
||||
|
||||
#define YY_USER_ACTION \
|
||||
do { \
|
||||
yylloc->source = 0; \
|
||||
yylloc->first_column = yycolumn + 1; \
|
||||
yylloc->first_line = yylloc->last_line = yylineno + 1; \
|
||||
yycolumn += yyleng; \
|
||||
yylloc->last_column = yycolumn + 1; \
|
||||
} while(0);
|
||||
|
||||
#define YY_USER_INIT yylineno = 0; yycolumn = 0;
|
||||
|
||||
/* A macro for handling reserved words and keywords across language versions.
|
||||
*
|
||||
* Certain words start out as identifiers, become reserved words in
|
||||
* later language revisions, and finally become language keywords.
|
||||
* This may happen at different times in desktop GLSL and GLSL ES.
|
||||
*
|
||||
* For example, consider the following lexer rule:
|
||||
* samplerBuffer KEYWORD(130, 0, 140, 0, SAMPLERBUFFER)
|
||||
*
|
||||
* This means that "samplerBuffer" will be treated as:
|
||||
* - a keyword (SAMPLERBUFFER token) ...in GLSL >= 1.40
|
||||
* - a reserved word - error ...in GLSL >= 1.30
|
||||
* - an identifier ...in GLSL < 1.30 or GLSL ES
|
||||
*/
|
||||
#define KEYWORD(reserved_glsl, reserved_glsl_es, \
|
||||
allowed_glsl, allowed_glsl_es, token) \
|
||||
KEYWORD_WITH_ALT(reserved_glsl, reserved_glsl_es, \
|
||||
allowed_glsl, allowed_glsl_es, false, token)
|
||||
|
||||
/**
|
||||
* Like the KEYWORD macro, but the word is also treated as a keyword
|
||||
* if the given boolean expression is true.
|
||||
*/
|
||||
#define KEYWORD_WITH_ALT(reserved_glsl, reserved_glsl_es, \
|
||||
allowed_glsl, allowed_glsl_es, \
|
||||
alt_expr, token) \
|
||||
do { \
|
||||
if (yyextra->is_version(allowed_glsl, allowed_glsl_es) \
|
||||
|| (alt_expr)) { \
|
||||
return token; \
|
||||
} else if (yyextra->is_version(reserved_glsl, \
|
||||
reserved_glsl_es)) { \
|
||||
_mesa_glsl_error(yylloc, yyextra, \
|
||||
"illegal use of reserved word `%s'", yytext); \
|
||||
return ERROR_TOK; \
|
||||
} else { \
|
||||
void *mem_ctx = yyextra; \
|
||||
yylval->identifier = ralloc_strdup(mem_ctx, yytext); \
|
||||
return classify_identifier(yyextra, yytext); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
/**
|
||||
* A macro for handling keywords that have been present in GLSL since
|
||||
* its origin, but were changed into reserved words in GLSL 3.00 ES.
|
||||
*/
|
||||
#define DEPRECATED_ES_KEYWORD(token) \
|
||||
do { \
|
||||
if (yyextra->is_version(0, 300)) { \
|
||||
_mesa_glsl_error(yylloc, yyextra, \
|
||||
"illegal use of reserved word `%s'", yytext); \
|
||||
return ERROR_TOK; \
|
||||
} else { \
|
||||
return token; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
static int
|
||||
literal_integer(char *text, int len, struct _mesa_glsl_parse_state *state,
|
||||
YYSTYPE *lval, YYLTYPE *lloc, int base)
|
||||
{
|
||||
bool is_uint = (text[len - 1] == 'u' ||
|
||||
text[len - 1] == 'U');
|
||||
const char *digits = text;
|
||||
|
||||
/* Skip "0x" */
|
||||
if (base == 16)
|
||||
digits += 2;
|
||||
|
||||
#ifdef _MSC_VER
|
||||
unsigned __int64 value = _strtoui64(digits, NULL, base);
|
||||
#else
|
||||
unsigned long long value = strtoull(digits, NULL, base);
|
||||
#endif
|
||||
|
||||
lval->n = (int)value;
|
||||
|
||||
if (value > UINT_MAX) {
|
||||
/* Note that signed 0xffffffff is valid, not out of range! */
|
||||
if (state->is_version(130, 300)) {
|
||||
_mesa_glsl_error(lloc, state,
|
||||
"literal value `%s' out of range", text);
|
||||
} else {
|
||||
_mesa_glsl_warning(lloc, state,
|
||||
"literal value `%s' out of range", text);
|
||||
}
|
||||
} else if (base == 10 && !is_uint && (unsigned)value > (unsigned)INT_MAX + 1) {
|
||||
/* Tries to catch unintentionally providing a negative value.
|
||||
* Note that -2147483648 is parsed as -(2147483648), so we don't
|
||||
* want to warn for INT_MAX.
|
||||
*/
|
||||
_mesa_glsl_warning(lloc, state,
|
||||
"signed literal value `%s' is interpreted as %d",
|
||||
text, lval->n);
|
||||
}
|
||||
return is_uint ? UINTCONSTANT : INTCONSTANT;
|
||||
}
|
||||
|
||||
#define LITERAL_INTEGER(base) \
|
||||
literal_integer(yytext, yyleng, yyextra, yylval, yylloc, base)
|
||||
|
||||
%}
|
||||
|
||||
%option bison-bridge bison-locations reentrant noyywrap
|
||||
%option nounput noyy_top_state
|
||||
%option never-interactive
|
||||
%option prefix="_mesa_glsl_lexer_"
|
||||
%option extra-type="struct _mesa_glsl_parse_state *"
|
||||
%option warn nodefault
|
||||
|
||||
/* Note: When adding any start conditions to this list, you must also
|
||||
* update the "Internal compiler error" catch-all rule near the end of
|
||||
* this file. */
|
||||
%x PP PRAGMA
|
||||
|
||||
DEC_INT [1-9][0-9]*
|
||||
HEX_INT 0[xX][0-9a-fA-F]+
|
||||
OCT_INT 0[0-7]*
|
||||
INT_T ({DEC_INT}|{HEX_INT}|{OCT_INT})
|
||||
SPC [ \t]*
|
||||
SPCP [ \t]+
|
||||
HASH ^{SPC}#{SPC}
|
||||
%%
|
||||
|
||||
[ \r\t]+ ;
|
||||
|
||||
/* Preprocessor tokens. */
|
||||
^[ \t]*#[ \t]*$ ;
|
||||
^[ \t]*#[ \t]*version { BEGIN PP; return VERSION_TOK; }
|
||||
^[ \t]*#[ \t]*extension { BEGIN PP; return EXTENSION; }
|
||||
{HASH}line{SPCP}{INT_T}{SPCP}{INT_T}{SPC}$ {
|
||||
/* Eat characters until the first digit is
|
||||
* encountered
|
||||
*/
|
||||
char *ptr = yytext;
|
||||
while (!isdigit(*ptr))
|
||||
ptr++;
|
||||
|
||||
/* Subtract one from the line number because
|
||||
* yylineno is zero-based instead of
|
||||
* one-based.
|
||||
*/
|
||||
yylineno = strtol(ptr, &ptr, 0) - 1;
|
||||
yylloc->source = strtol(ptr, NULL, 0);
|
||||
}
|
||||
{HASH}line{SPCP}{INT_T}{SPC}$ {
|
||||
/* Eat characters until the first digit is
|
||||
* encountered
|
||||
*/
|
||||
char *ptr = yytext;
|
||||
while (!isdigit(*ptr))
|
||||
ptr++;
|
||||
|
||||
/* Subtract one from the line number because
|
||||
* yylineno is zero-based instead of
|
||||
* one-based.
|
||||
*/
|
||||
yylineno = strtol(ptr, &ptr, 0) - 1;
|
||||
}
|
||||
^{SPC}#{SPC}pragma{SPCP}debug{SPC}\({SPC}on{SPC}\) {
|
||||
BEGIN PP;
|
||||
return PRAGMA_DEBUG_ON;
|
||||
}
|
||||
^{SPC}#{SPC}pragma{SPCP}debug{SPC}\({SPC}off{SPC}\) {
|
||||
BEGIN PP;
|
||||
return PRAGMA_DEBUG_OFF;
|
||||
}
|
||||
^{SPC}#{SPC}pragma{SPCP}optimize{SPC}\({SPC}on{SPC}\) {
|
||||
BEGIN PP;
|
||||
return PRAGMA_OPTIMIZE_ON;
|
||||
}
|
||||
^{SPC}#{SPC}pragma{SPCP}optimize{SPC}\({SPC}off{SPC}\) {
|
||||
BEGIN PP;
|
||||
return PRAGMA_OPTIMIZE_OFF;
|
||||
}
|
||||
^{SPC}#{SPC}pragma{SPCP}STDGL{SPCP}invariant{SPC}\({SPC}all{SPC}\) {
|
||||
BEGIN PP;
|
||||
return PRAGMA_INVARIANT_ALL;
|
||||
}
|
||||
^{SPC}#{SPC}pragma{SPCP} { BEGIN PRAGMA; }
|
||||
|
||||
<PRAGMA>\n { BEGIN 0; yylineno++; yycolumn = 0; }
|
||||
<PRAGMA>. { }
|
||||
|
||||
<PP>\/\/[^\n]* { }
|
||||
<PP>[ \t\r]* { }
|
||||
<PP>: return COLON;
|
||||
<PP>[_a-zA-Z][_a-zA-Z0-9]* {
|
||||
void *mem_ctx = yyextra;
|
||||
yylval->identifier = ralloc_strdup(mem_ctx, yytext);
|
||||
return IDENTIFIER;
|
||||
}
|
||||
<PP>[1-9][0-9]* {
|
||||
yylval->n = strtol(yytext, NULL, 10);
|
||||
return INTCONSTANT;
|
||||
}
|
||||
<PP>\n { BEGIN 0; yylineno++; yycolumn = 0; return EOL; }
|
||||
<PP>. { return yytext[0]; }
|
||||
|
||||
\n { yylineno++; yycolumn = 0; }
|
||||
|
||||
attribute DEPRECATED_ES_KEYWORD(ATTRIBUTE);
|
||||
const return CONST_TOK;
|
||||
bool return BOOL_TOK;
|
||||
float return FLOAT_TOK;
|
||||
int return INT_TOK;
|
||||
uint KEYWORD(130, 300, 130, 300, UINT_TOK);
|
||||
|
||||
break return BREAK;
|
||||
continue return CONTINUE;
|
||||
do return DO;
|
||||
while return WHILE;
|
||||
else return ELSE;
|
||||
for return FOR;
|
||||
if return IF;
|
||||
discard return DISCARD;
|
||||
return return RETURN;
|
||||
|
||||
bvec2 return BVEC2;
|
||||
bvec3 return BVEC3;
|
||||
bvec4 return BVEC4;
|
||||
ivec2 return IVEC2;
|
||||
ivec3 return IVEC3;
|
||||
ivec4 return IVEC4;
|
||||
uvec2 KEYWORD(130, 300, 130, 300, UVEC2);
|
||||
uvec3 KEYWORD(130, 300, 130, 300, UVEC3);
|
||||
uvec4 KEYWORD(130, 300, 130, 300, UVEC4);
|
||||
vec2 return VEC2;
|
||||
vec3 return VEC3;
|
||||
vec4 return VEC4;
|
||||
mat2 return MAT2X2;
|
||||
mat3 return MAT3X3;
|
||||
mat4 return MAT4X4;
|
||||
mat2x2 KEYWORD(120, 300, 120, 300, MAT2X2);
|
||||
mat2x3 KEYWORD(120, 300, 120, 300, MAT2X3);
|
||||
mat2x4 KEYWORD(120, 300, 120, 300, MAT2X4);
|
||||
mat3x2 KEYWORD(120, 300, 120, 300, MAT3X2);
|
||||
mat3x3 KEYWORD(120, 300, 120, 300, MAT3X3);
|
||||
mat3x4 KEYWORD(120, 300, 120, 300, MAT3X4);
|
||||
mat4x2 KEYWORD(120, 300, 120, 300, MAT4X2);
|
||||
mat4x3 KEYWORD(120, 300, 120, 300, MAT4X3);
|
||||
mat4x4 KEYWORD(120, 300, 120, 300, MAT4X4);
|
||||
|
||||
in return IN_TOK;
|
||||
out return OUT_TOK;
|
||||
inout return INOUT_TOK;
|
||||
uniform return UNIFORM;
|
||||
varying DEPRECATED_ES_KEYWORD(VARYING);
|
||||
centroid KEYWORD(120, 300, 120, 300, CENTROID);
|
||||
invariant KEYWORD(120, 100, 120, 100, INVARIANT);
|
||||
flat KEYWORD(130, 100, 130, 300, FLAT);
|
||||
smooth KEYWORD(130, 300, 130, 300, SMOOTH);
|
||||
noperspective KEYWORD(130, 300, 130, 0, NOPERSPECTIVE);
|
||||
|
||||
sampler1D DEPRECATED_ES_KEYWORD(SAMPLER1D);
|
||||
sampler2D return SAMPLER2D;
|
||||
sampler3D return SAMPLER3D;
|
||||
samplerCube return SAMPLERCUBE;
|
||||
sampler1DArray KEYWORD(130, 300, 130, 0, SAMPLER1DARRAY);
|
||||
sampler2DArray KEYWORD(130, 300, 130, 300, SAMPLER2DARRAY);
|
||||
sampler1DShadow DEPRECATED_ES_KEYWORD(SAMPLER1DSHADOW);
|
||||
sampler2DShadow return SAMPLER2DSHADOW;
|
||||
samplerCubeShadow KEYWORD(130, 300, 130, 300, SAMPLERCUBESHADOW);
|
||||
sampler1DArrayShadow KEYWORD(130, 300, 130, 0, SAMPLER1DARRAYSHADOW);
|
||||
sampler2DArrayShadow KEYWORD(130, 300, 130, 300, SAMPLER2DARRAYSHADOW);
|
||||
isampler1D KEYWORD(130, 300, 130, 0, ISAMPLER1D);
|
||||
isampler2D KEYWORD(130, 300, 130, 300, ISAMPLER2D);
|
||||
isampler3D KEYWORD(130, 300, 130, 300, ISAMPLER3D);
|
||||
isamplerCube KEYWORD(130, 300, 130, 300, ISAMPLERCUBE);
|
||||
isampler1DArray KEYWORD(130, 300, 130, 0, ISAMPLER1DARRAY);
|
||||
isampler2DArray KEYWORD(130, 300, 130, 300, ISAMPLER2DARRAY);
|
||||
usampler1D KEYWORD(130, 300, 130, 0, USAMPLER1D);
|
||||
usampler2D KEYWORD(130, 300, 130, 300, USAMPLER2D);
|
||||
usampler3D KEYWORD(130, 300, 130, 300, USAMPLER3D);
|
||||
usamplerCube KEYWORD(130, 300, 130, 300, USAMPLERCUBE);
|
||||
usampler1DArray KEYWORD(130, 300, 130, 0, USAMPLER1DARRAY);
|
||||
usampler2DArray KEYWORD(130, 300, 130, 300, USAMPLER2DARRAY);
|
||||
|
||||
/* additional keywords in ARB_texture_multisample, included in GLSL 1.50 */
|
||||
/* these are reserved but not defined in GLSL 3.00 */
|
||||
sampler2DMS KEYWORD_WITH_ALT(150, 300, 150, 0, yyextra->ARB_texture_multisample_enable, SAMPLER2DMS);
|
||||
isampler2DMS KEYWORD_WITH_ALT(150, 300, 150, 0, yyextra->ARB_texture_multisample_enable, ISAMPLER2DMS);
|
||||
usampler2DMS KEYWORD_WITH_ALT(150, 300, 150, 0, yyextra->ARB_texture_multisample_enable, USAMPLER2DMS);
|
||||
sampler2DMSArray KEYWORD_WITH_ALT(150, 300, 150, 0, yyextra->ARB_texture_multisample_enable, SAMPLER2DMSARRAY);
|
||||
isampler2DMSArray KEYWORD_WITH_ALT(150, 300, 150, 0, yyextra->ARB_texture_multisample_enable, ISAMPLER2DMSARRAY);
|
||||
usampler2DMSArray KEYWORD_WITH_ALT(150, 300, 150, 0, yyextra->ARB_texture_multisample_enable, USAMPLER2DMSARRAY);
|
||||
|
||||
/* keywords available with ARB_texture_cube_map_array_enable extension on desktop GLSL */
|
||||
samplerCubeArray KEYWORD_WITH_ALT(400, 0, 400, 0, yyextra->ARB_texture_cube_map_array_enable, SAMPLERCUBEARRAY);
|
||||
isamplerCubeArray KEYWORD_WITH_ALT(400, 0, 400, 0, yyextra->ARB_texture_cube_map_array_enable, ISAMPLERCUBEARRAY);
|
||||
usamplerCubeArray KEYWORD_WITH_ALT(400, 0, 400, 0, yyextra->ARB_texture_cube_map_array_enable, USAMPLERCUBEARRAY);
|
||||
samplerCubeArrayShadow KEYWORD_WITH_ALT(400, 0, 400, 0, yyextra->ARB_texture_cube_map_array_enable, SAMPLERCUBEARRAYSHADOW);
|
||||
|
||||
samplerExternalOES {
|
||||
if (yyextra->OES_EGL_image_external_enable)
|
||||
return SAMPLEREXTERNALOES;
|
||||
else
|
||||
return IDENTIFIER;
|
||||
}
|
||||
|
||||
/* keywords available with ARB_gpu_shader5 */
|
||||
precise KEYWORD_WITH_ALT(400, 0, 400, 0, yyextra->ARB_gpu_shader5_enable, PRECISE);
|
||||
|
||||
/* keywords available with ARB_shader_image_load_store */
|
||||
image1D KEYWORD_WITH_ALT(130, 300, 420, 0, yyextra->ARB_shader_image_load_store_enable, IMAGE1D);
|
||||
image2D KEYWORD_WITH_ALT(130, 300, 420, 0, yyextra->ARB_shader_image_load_store_enable, IMAGE2D);
|
||||
image3D KEYWORD_WITH_ALT(130, 300, 420, 0, yyextra->ARB_shader_image_load_store_enable, IMAGE3D);
|
||||
image2DRect KEYWORD_WITH_ALT(130, 300, 420, 0, yyextra->ARB_shader_image_load_store_enable, IMAGE2DRECT);
|
||||
imageCube KEYWORD_WITH_ALT(130, 300, 420, 0, yyextra->ARB_shader_image_load_store_enable, IMAGECUBE);
|
||||
imageBuffer KEYWORD_WITH_ALT(130, 300, 420, 0, yyextra->ARB_shader_image_load_store_enable, IMAGEBUFFER);
|
||||
image1DArray KEYWORD_WITH_ALT(130, 300, 420, 0, yyextra->ARB_shader_image_load_store_enable, IMAGE1DARRAY);
|
||||
image2DArray KEYWORD_WITH_ALT(130, 300, 420, 0, yyextra->ARB_shader_image_load_store_enable, IMAGE2DARRAY);
|
||||
imageCubeArray KEYWORD_WITH_ALT(130, 300, 420, 0, yyextra->ARB_shader_image_load_store_enable, IMAGECUBEARRAY);
|
||||
image2DMS KEYWORD_WITH_ALT(130, 300, 420, 0, yyextra->ARB_shader_image_load_store_enable, IMAGE2DMS);
|
||||
image2DMSArray KEYWORD_WITH_ALT(130, 300, 420, 0, yyextra->ARB_shader_image_load_store_enable, IMAGE2DMSARRAY);
|
||||
iimage1D KEYWORD_WITH_ALT(130, 300, 420, 0, yyextra->ARB_shader_image_load_store_enable, IIMAGE1D);
|
||||
iimage2D KEYWORD_WITH_ALT(130, 300, 420, 0, yyextra->ARB_shader_image_load_store_enable, IIMAGE2D);
|
||||
iimage3D KEYWORD_WITH_ALT(130, 300, 420, 0, yyextra->ARB_shader_image_load_store_enable, IIMAGE3D);
|
||||
iimage2DRect KEYWORD_WITH_ALT(130, 300, 420, 0, yyextra->ARB_shader_image_load_store_enable, IIMAGE2DRECT);
|
||||
iimageCube KEYWORD_WITH_ALT(130, 300, 420, 0, yyextra->ARB_shader_image_load_store_enable, IIMAGECUBE);
|
||||
iimageBuffer KEYWORD_WITH_ALT(130, 300, 420, 0, yyextra->ARB_shader_image_load_store_enable, IIMAGEBUFFER);
|
||||
iimage1DArray KEYWORD_WITH_ALT(130, 300, 420, 0, yyextra->ARB_shader_image_load_store_enable, IIMAGE1DARRAY);
|
||||
iimage2DArray KEYWORD_WITH_ALT(130, 300, 420, 0, yyextra->ARB_shader_image_load_store_enable, IIMAGE2DARRAY);
|
||||
iimageCubeArray KEYWORD_WITH_ALT(130, 300, 420, 0, yyextra->ARB_shader_image_load_store_enable, IIMAGECUBEARRAY);
|
||||
iimage2DMS KEYWORD_WITH_ALT(130, 300, 420, 0, yyextra->ARB_shader_image_load_store_enable, IIMAGE2DMS);
|
||||
iimage2DMSArray KEYWORD_WITH_ALT(130, 300, 420, 0, yyextra->ARB_shader_image_load_store_enable, IIMAGE2DMSARRAY);
|
||||
uimage1D KEYWORD_WITH_ALT(130, 300, 420, 0, yyextra->ARB_shader_image_load_store_enable, UIMAGE1D);
|
||||
uimage2D KEYWORD_WITH_ALT(130, 300, 420, 0, yyextra->ARB_shader_image_load_store_enable, UIMAGE2D);
|
||||
uimage3D KEYWORD_WITH_ALT(130, 300, 420, 0, yyextra->ARB_shader_image_load_store_enable, UIMAGE3D);
|
||||
uimage2DRect KEYWORD_WITH_ALT(130, 300, 420, 0, yyextra->ARB_shader_image_load_store_enable, UIMAGE2DRECT);
|
||||
uimageCube KEYWORD_WITH_ALT(130, 300, 420, 0, yyextra->ARB_shader_image_load_store_enable, UIMAGECUBE);
|
||||
uimageBuffer KEYWORD_WITH_ALT(130, 300, 420, 0, yyextra->ARB_shader_image_load_store_enable, UIMAGEBUFFER);
|
||||
uimage1DArray KEYWORD_WITH_ALT(130, 300, 420, 0, yyextra->ARB_shader_image_load_store_enable, UIMAGE1DARRAY);
|
||||
uimage2DArray KEYWORD_WITH_ALT(130, 300, 420, 0, yyextra->ARB_shader_image_load_store_enable, UIMAGE2DARRAY);
|
||||
uimageCubeArray KEYWORD_WITH_ALT(130, 300, 420, 0, yyextra->ARB_shader_image_load_store_enable, UIMAGECUBEARRAY);
|
||||
uimage2DMS KEYWORD_WITH_ALT(130, 300, 420, 0, yyextra->ARB_shader_image_load_store_enable, UIMAGE2DMS);
|
||||
uimage2DMSArray KEYWORD_WITH_ALT(130, 300, 420, 0, yyextra->ARB_shader_image_load_store_enable, UIMAGE2DMSARRAY);
|
||||
image1DShadow KEYWORD(130, 300, 0, 0, IMAGE1DSHADOW);
|
||||
image2DShadow KEYWORD(130, 300, 0, 0, IMAGE2DSHADOW);
|
||||
image1DArrayShadow KEYWORD(130, 300, 0, 0, IMAGE1DARRAYSHADOW);
|
||||
image2DArrayShadow KEYWORD(130, 300, 0, 0, IMAGE2DARRAYSHADOW);
|
||||
|
||||
coherent KEYWORD_WITH_ALT(420, 300, 420, 0, yyextra->ARB_shader_image_load_store_enable, COHERENT);
|
||||
volatile KEYWORD_WITH_ALT(110, 100, 420, 0, yyextra->ARB_shader_image_load_store_enable, VOLATILE);
|
||||
restrict KEYWORD_WITH_ALT(420, 300, 420, 0, yyextra->ARB_shader_image_load_store_enable, RESTRICT);
|
||||
readonly KEYWORD_WITH_ALT(420, 300, 420, 0, yyextra->ARB_shader_image_load_store_enable, READONLY);
|
||||
writeonly KEYWORD_WITH_ALT(420, 300, 420, 0, yyextra->ARB_shader_image_load_store_enable, WRITEONLY);
|
||||
|
||||
atomic_uint KEYWORD_WITH_ALT(420, 300, 420, 0, yyextra->ARB_shader_atomic_counters_enable, ATOMIC_UINT);
|
||||
|
||||
struct return STRUCT;
|
||||
void return VOID_TOK;
|
||||
|
||||
layout {
|
||||
if ((yyextra->is_version(140, 300))
|
||||
|| yyextra->AMD_conservative_depth_enable
|
||||
|| yyextra->ARB_conservative_depth_enable
|
||||
|| yyextra->ARB_explicit_attrib_location_enable
|
||||
|| yyextra->ARB_explicit_uniform_location_enable
|
||||
|| yyextra->has_separate_shader_objects()
|
||||
|| yyextra->ARB_uniform_buffer_object_enable
|
||||
|| yyextra->ARB_fragment_coord_conventions_enable
|
||||
|| yyextra->ARB_shading_language_420pack_enable
|
||||
|| yyextra->ARB_compute_shader_enable) {
|
||||
return LAYOUT_TOK;
|
||||
} else {
|
||||
void *mem_ctx = yyextra;
|
||||
yylval->identifier = ralloc_strdup(mem_ctx, yytext);
|
||||
return classify_identifier(yyextra, yytext);
|
||||
}
|
||||
}
|
||||
|
||||
\+\+ return INC_OP;
|
||||
-- return DEC_OP;
|
||||
\<= return LE_OP;
|
||||
>= return GE_OP;
|
||||
== return EQ_OP;
|
||||
!= return NE_OP;
|
||||
&& return AND_OP;
|
||||
\|\| return OR_OP;
|
||||
"^^" return XOR_OP;
|
||||
"<<" return LEFT_OP;
|
||||
">>" return RIGHT_OP;
|
||||
|
||||
\*= return MUL_ASSIGN;
|
||||
\/= return DIV_ASSIGN;
|
||||
\+= return ADD_ASSIGN;
|
||||
\%= return MOD_ASSIGN;
|
||||
\<\<= return LEFT_ASSIGN;
|
||||
>>= return RIGHT_ASSIGN;
|
||||
&= return AND_ASSIGN;
|
||||
"^=" return XOR_ASSIGN;
|
||||
\|= return OR_ASSIGN;
|
||||
-= return SUB_ASSIGN;
|
||||
|
||||
[1-9][0-9]*[uU]? {
|
||||
return LITERAL_INTEGER(10);
|
||||
}
|
||||
0[xX][0-9a-fA-F]+[uU]? {
|
||||
return LITERAL_INTEGER(16);
|
||||
}
|
||||
0[0-7]*[uU]? {
|
||||
return LITERAL_INTEGER(8);
|
||||
}
|
||||
|
||||
[0-9]+\.[0-9]+([eE][+-]?[0-9]+)?[fF]? {
|
||||
yylval->real = glsl_strtof(yytext, NULL);
|
||||
return FLOATCONSTANT;
|
||||
}
|
||||
\.[0-9]+([eE][+-]?[0-9]+)?[fF]? {
|
||||
yylval->real = glsl_strtof(yytext, NULL);
|
||||
return FLOATCONSTANT;
|
||||
}
|
||||
[0-9]+\.([eE][+-]?[0-9]+)?[fF]? {
|
||||
yylval->real = glsl_strtof(yytext, NULL);
|
||||
return FLOATCONSTANT;
|
||||
}
|
||||
[0-9]+[eE][+-]?[0-9]+[fF]? {
|
||||
yylval->real = glsl_strtof(yytext, NULL);
|
||||
return FLOATCONSTANT;
|
||||
}
|
||||
[0-9]+[fF] {
|
||||
yylval->real = glsl_strtof(yytext, NULL);
|
||||
return FLOATCONSTANT;
|
||||
}
|
||||
|
||||
true {
|
||||
yylval->n = 1;
|
||||
return BOOLCONSTANT;
|
||||
}
|
||||
false {
|
||||
yylval->n = 0;
|
||||
return BOOLCONSTANT;
|
||||
}
|
||||
|
||||
|
||||
/* Reserved words in GLSL 1.10. */
|
||||
asm KEYWORD(110, 100, 0, 0, ASM);
|
||||
class KEYWORD(110, 100, 0, 0, CLASS);
|
||||
union KEYWORD(110, 100, 0, 0, UNION);
|
||||
enum KEYWORD(110, 100, 0, 0, ENUM);
|
||||
typedef KEYWORD(110, 100, 0, 0, TYPEDEF);
|
||||
template KEYWORD(110, 100, 0, 0, TEMPLATE);
|
||||
this KEYWORD(110, 100, 0, 0, THIS);
|
||||
packed KEYWORD_WITH_ALT(110, 100, 140, 300, yyextra->ARB_uniform_buffer_object_enable, PACKED_TOK);
|
||||
goto KEYWORD(110, 100, 0, 0, GOTO);
|
||||
switch KEYWORD(110, 100, 130, 300, SWITCH);
|
||||
default KEYWORD(110, 100, 130, 300, DEFAULT);
|
||||
inline KEYWORD(110, 100, 0, 0, INLINE_TOK);
|
||||
noinline KEYWORD(110, 100, 0, 0, NOINLINE);
|
||||
public KEYWORD(110, 100, 0, 0, PUBLIC_TOK);
|
||||
static KEYWORD(110, 100, 0, 0, STATIC);
|
||||
extern KEYWORD(110, 100, 0, 0, EXTERN);
|
||||
external KEYWORD(110, 100, 0, 0, EXTERNAL);
|
||||
interface KEYWORD(110, 100, 0, 0, INTERFACE);
|
||||
long KEYWORD(110, 100, 0, 0, LONG_TOK);
|
||||
short KEYWORD(110, 100, 0, 0, SHORT_TOK);
|
||||
double KEYWORD(110, 100, 400, 0, DOUBLE_TOK);
|
||||
half KEYWORD(110, 100, 0, 0, HALF);
|
||||
fixed KEYWORD(110, 100, 0, 0, FIXED_TOK);
|
||||
unsigned KEYWORD(110, 100, 0, 0, UNSIGNED);
|
||||
input KEYWORD(110, 100, 0, 0, INPUT_TOK);
|
||||
output KEYWORD(110, 100, 0, 0, OUTPUT);
|
||||
hvec2 KEYWORD(110, 100, 0, 0, HVEC2);
|
||||
hvec3 KEYWORD(110, 100, 0, 0, HVEC3);
|
||||
hvec4 KEYWORD(110, 100, 0, 0, HVEC4);
|
||||
dvec2 KEYWORD(110, 100, 400, 0, DVEC2);
|
||||
dvec3 KEYWORD(110, 100, 400, 0, DVEC3);
|
||||
dvec4 KEYWORD(110, 100, 400, 0, DVEC4);
|
||||
fvec2 KEYWORD(110, 100, 0, 0, FVEC2);
|
||||
fvec3 KEYWORD(110, 100, 0, 0, FVEC3);
|
||||
fvec4 KEYWORD(110, 100, 0, 0, FVEC4);
|
||||
sampler2DRect DEPRECATED_ES_KEYWORD(SAMPLER2DRECT);
|
||||
sampler3DRect KEYWORD(110, 100, 0, 0, SAMPLER3DRECT);
|
||||
sampler2DRectShadow DEPRECATED_ES_KEYWORD(SAMPLER2DRECTSHADOW);
|
||||
sizeof KEYWORD(110, 100, 0, 0, SIZEOF);
|
||||
cast KEYWORD(110, 100, 0, 0, CAST);
|
||||
namespace KEYWORD(110, 100, 0, 0, NAMESPACE);
|
||||
using KEYWORD(110, 100, 0, 0, USING);
|
||||
|
||||
/* Additional reserved words in GLSL 1.20. */
|
||||
lowp KEYWORD(120, 100, 130, 100, LOWP);
|
||||
mediump KEYWORD(120, 100, 130, 100, MEDIUMP);
|
||||
highp KEYWORD(120, 100, 130, 100, HIGHP);
|
||||
precision KEYWORD(120, 100, 130, 100, PRECISION);
|
||||
|
||||
/* Additional reserved words in GLSL 1.30. */
|
||||
case KEYWORD(130, 300, 130, 300, CASE);
|
||||
common KEYWORD(130, 300, 0, 0, COMMON);
|
||||
partition KEYWORD(130, 300, 0, 0, PARTITION);
|
||||
active KEYWORD(130, 300, 0, 0, ACTIVE);
|
||||
superp KEYWORD(130, 100, 0, 0, SUPERP);
|
||||
samplerBuffer KEYWORD(130, 300, 140, 0, SAMPLERBUFFER);
|
||||
filter KEYWORD(130, 300, 0, 0, FILTER);
|
||||
row_major KEYWORD_WITH_ALT(130, 0, 140, 0, yyextra->ARB_uniform_buffer_object_enable && !yyextra->es_shader, ROW_MAJOR);
|
||||
|
||||
/* Additional reserved words in GLSL 1.40 */
|
||||
isampler2DRect KEYWORD(140, 300, 140, 0, ISAMPLER2DRECT);
|
||||
usampler2DRect KEYWORD(140, 300, 140, 0, USAMPLER2DRECT);
|
||||
isamplerBuffer KEYWORD(140, 300, 140, 0, ISAMPLERBUFFER);
|
||||
usamplerBuffer KEYWORD(140, 300, 140, 0, USAMPLERBUFFER);
|
||||
|
||||
/* Additional reserved words in GLSL ES 3.00 */
|
||||
resource KEYWORD(0, 300, 0, 0, RESOURCE);
|
||||
patch KEYWORD(0, 300, 0, 0, PATCH);
|
||||
sample KEYWORD_WITH_ALT(400, 300, 400, 0, yyextra->ARB_gpu_shader5_enable, SAMPLE);
|
||||
subroutine KEYWORD(0, 300, 0, 0, SUBROUTINE);
|
||||
|
||||
|
||||
[_a-zA-Z][_a-zA-Z0-9]* {
|
||||
struct _mesa_glsl_parse_state *state = yyextra;
|
||||
void *ctx = state;
|
||||
yylval->identifier = ralloc_strdup(ctx, yytext);
|
||||
return classify_identifier(state, yytext);
|
||||
}
|
||||
|
||||
. { return yytext[0]; }
|
||||
|
||||
%%
|
||||
|
||||
int
|
||||
classify_identifier(struct _mesa_glsl_parse_state *state, const char *name)
|
||||
{
|
||||
if (state->symbols->get_variable(name) || state->symbols->get_function(name))
|
||||
return IDENTIFIER;
|
||||
else if (state->symbols->get_type(name))
|
||||
return TYPE_IDENTIFIER;
|
||||
else
|
||||
return NEW_IDENTIFIER;
|
||||
}
|
||||
|
||||
void
|
||||
_mesa_glsl_lexer_ctor(struct _mesa_glsl_parse_state *state, const char *string)
|
||||
{
|
||||
yylex_init_extra(state, & state->scanner);
|
||||
yy_scan_string(string, state->scanner);
|
||||
}
|
||||
|
||||
void
|
||||
_mesa_glsl_lexer_dtor(struct _mesa_glsl_parse_state *state)
|
||||
{
|
||||
yylex_destroy(state->scanner);
|
||||
}
|
|
@ -1,830 +0,0 @@
|
|||
#include "glsl_optimizer.h"
|
||||
#include "ast.h"
|
||||
#include "glsl_parser_extras.h"
|
||||
#include "glsl_parser.h"
|
||||
#include "ir_optimization.h"
|
||||
#include "ir_print_metal_visitor.h"
|
||||
#include "ir_print_glsl_visitor.h"
|
||||
#include "ir_print_visitor.h"
|
||||
#include "ir_stats.h"
|
||||
#include "loop_analysis.h"
|
||||
#include "program.h"
|
||||
#include "linker.h"
|
||||
#include "standalone_scaffolding.h"
|
||||
|
||||
|
||||
extern "C" struct gl_shader *
|
||||
_mesa_new_shader(struct gl_context *ctx, GLuint name, GLenum type);
|
||||
|
||||
static void DeleteShader(struct gl_context *ctx, struct gl_shader *shader)
|
||||
{
|
||||
ralloc_free(shader);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
initialize_mesa_context(struct gl_context *ctx, glslopt_target api)
|
||||
{
|
||||
gl_api mesaAPI;
|
||||
switch(api)
|
||||
{
|
||||
default:
|
||||
case kGlslTargetOpenGL:
|
||||
mesaAPI = API_OPENGL_COMPAT;
|
||||
break;
|
||||
case kGlslTargetOpenGLES20:
|
||||
mesaAPI = API_OPENGLES2;
|
||||
break;
|
||||
case kGlslTargetOpenGLES30:
|
||||
mesaAPI = API_OPENGL_CORE;
|
||||
break;
|
||||
case kGlslTargetMetal:
|
||||
mesaAPI = API_OPENGL_CORE;
|
||||
break;
|
||||
}
|
||||
initialize_context_to_defaults (ctx, mesaAPI);
|
||||
|
||||
switch(api)
|
||||
{
|
||||
default:
|
||||
case kGlslTargetOpenGL:
|
||||
ctx->Const.GLSLVersion = 150;
|
||||
break;
|
||||
case kGlslTargetOpenGLES20:
|
||||
ctx->Extensions.OES_standard_derivatives = true;
|
||||
ctx->Extensions.EXT_shadow_samplers = true;
|
||||
ctx->Extensions.EXT_frag_depth = true;
|
||||
ctx->Extensions.EXT_shader_framebuffer_fetch = true;
|
||||
break;
|
||||
case kGlslTargetOpenGLES30:
|
||||
ctx->Extensions.ARB_ES3_compatibility = true;
|
||||
ctx->Extensions.EXT_shader_framebuffer_fetch = true;
|
||||
break;
|
||||
case kGlslTargetMetal:
|
||||
ctx->Extensions.ARB_ES3_compatibility = true;
|
||||
ctx->Extensions.EXT_shader_framebuffer_fetch = true;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
// allow high amount of texcoords
|
||||
ctx->Const.MaxTextureCoordUnits = 16;
|
||||
|
||||
ctx->Const.Program[MESA_SHADER_VERTEX].MaxTextureImageUnits = 16;
|
||||
ctx->Const.Program[MESA_SHADER_FRAGMENT].MaxTextureImageUnits = 16;
|
||||
ctx->Const.Program[MESA_SHADER_GEOMETRY].MaxTextureImageUnits = 16;
|
||||
|
||||
// For GLES2.0 this would be 1, but we do support GL_EXT_draw_buffers
|
||||
ctx->Const.MaxDrawBuffers = 8;
|
||||
|
||||
ctx->Driver.NewShader = _mesa_new_shader;
|
||||
ctx->Driver.DeleteShader = DeleteShader;
|
||||
}
|
||||
|
||||
|
||||
struct glslopt_ctx {
|
||||
glslopt_ctx (glslopt_target target) {
|
||||
this->target = target;
|
||||
mem_ctx = ralloc_context (NULL);
|
||||
initialize_mesa_context (&mesa_ctx, target);
|
||||
}
|
||||
~glslopt_ctx() {
|
||||
ralloc_free (mem_ctx);
|
||||
}
|
||||
struct gl_context mesa_ctx;
|
||||
void* mem_ctx;
|
||||
glslopt_target target;
|
||||
};
|
||||
|
||||
glslopt_ctx* glslopt_initialize (glslopt_target target)
|
||||
{
|
||||
return new glslopt_ctx(target);
|
||||
}
|
||||
|
||||
void glslopt_cleanup (glslopt_ctx* ctx)
|
||||
{
|
||||
delete ctx;
|
||||
_mesa_destroy_shader_compiler();
|
||||
}
|
||||
|
||||
void glslopt_set_max_unroll_iterations (glslopt_ctx* ctx, unsigned iterations)
|
||||
{
|
||||
for (int i = 0; i < MESA_SHADER_STAGES; ++i)
|
||||
ctx->mesa_ctx.Const.ShaderCompilerOptions[i].MaxUnrollIterations = iterations;
|
||||
}
|
||||
|
||||
struct glslopt_shader_var
|
||||
{
|
||||
const char* name;
|
||||
glslopt_basic_type type;
|
||||
glslopt_precision prec;
|
||||
int vectorSize;
|
||||
int matrixSize;
|
||||
int arraySize;
|
||||
int location;
|
||||
};
|
||||
|
||||
struct glslopt_shader
|
||||
{
|
||||
static void* operator new(size_t size, void *ctx)
|
||||
{
|
||||
void *node;
|
||||
node = ralloc_size(ctx, size);
|
||||
assert(node != NULL);
|
||||
return node;
|
||||
}
|
||||
static void operator delete(void *node)
|
||||
{
|
||||
ralloc_free(node);
|
||||
}
|
||||
|
||||
glslopt_shader ()
|
||||
: rawOutput(0)
|
||||
, optimizedOutput(0)
|
||||
, status(false)
|
||||
, uniformCount(0)
|
||||
, uniformsSize(0)
|
||||
, inputCount(0)
|
||||
, textureCount(0)
|
||||
, statsMath(0)
|
||||
, statsTex(0)
|
||||
, statsFlow(0)
|
||||
{
|
||||
infoLog = "Shader not compiled yet";
|
||||
|
||||
whole_program = rzalloc (NULL, struct gl_shader_program);
|
||||
assert(whole_program != NULL);
|
||||
whole_program->InfoLog = ralloc_strdup(whole_program, "");
|
||||
|
||||
whole_program->Shaders = reralloc(whole_program, whole_program->Shaders, struct gl_shader *, whole_program->NumShaders + 1);
|
||||
assert(whole_program->Shaders != NULL);
|
||||
|
||||
shader = rzalloc(whole_program, gl_shader);
|
||||
whole_program->Shaders[whole_program->NumShaders] = shader;
|
||||
whole_program->NumShaders++;
|
||||
|
||||
whole_program->LinkStatus = true;
|
||||
}
|
||||
|
||||
~glslopt_shader()
|
||||
{
|
||||
for (unsigned i = 0; i < MESA_SHADER_STAGES; i++)
|
||||
ralloc_free(whole_program->_LinkedShaders[i]);
|
||||
for(GLuint i =0;i< whole_program->NumShaders;i++)
|
||||
ralloc_free(whole_program->Shaders[i]);
|
||||
ralloc_free(whole_program->Shaders);
|
||||
ralloc_free(whole_program->InfoLog);
|
||||
ralloc_free(whole_program);
|
||||
ralloc_free(rawOutput);
|
||||
ralloc_free(optimizedOutput);
|
||||
}
|
||||
|
||||
struct gl_shader_program* whole_program;
|
||||
struct gl_shader* shader;
|
||||
|
||||
static const int kMaxShaderUniforms = 1024;
|
||||
static const int kMaxShaderInputs = 128;
|
||||
static const int kMaxShaderTextures = 128;
|
||||
glslopt_shader_var uniforms[kMaxShaderUniforms];
|
||||
glslopt_shader_var inputs[kMaxShaderInputs];
|
||||
glslopt_shader_var textures[kMaxShaderInputs];
|
||||
int uniformCount, uniformsSize;
|
||||
int inputCount;
|
||||
int textureCount;
|
||||
int statsMath, statsTex, statsFlow;
|
||||
|
||||
char* rawOutput;
|
||||
char* optimizedOutput;
|
||||
const char* infoLog;
|
||||
bool status;
|
||||
};
|
||||
|
||||
static inline void debug_print_ir (const char* name, exec_list* ir, _mesa_glsl_parse_state* state, void* memctx)
|
||||
{
|
||||
#if 0
|
||||
printf("**** %s:\n", name);
|
||||
// _mesa_print_ir (ir, state);
|
||||
char* foobar = _mesa_print_ir_glsl(ir, state, ralloc_strdup(memctx, ""), kPrintGlslFragment);
|
||||
printf("%s\n", foobar);
|
||||
validate_ir_tree(ir);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
struct precision_ctx
|
||||
{
|
||||
exec_list* root_ir;
|
||||
bool res;
|
||||
};
|
||||
|
||||
|
||||
static void propagate_precision_deref(ir_instruction *ir, void *data)
|
||||
{
|
||||
// variable deref with undefined precision: take from variable itself
|
||||
ir_dereference_variable* der = ir->as_dereference_variable();
|
||||
if (der && der->get_precision() == glsl_precision_undefined && der->var->data.precision != glsl_precision_undefined)
|
||||
{
|
||||
der->set_precision ((glsl_precision)der->var->data.precision);
|
||||
((precision_ctx*)data)->res = true;
|
||||
}
|
||||
|
||||
// array deref with undefined precision: take from array itself
|
||||
ir_dereference_array* der_arr = ir->as_dereference_array();
|
||||
if (der_arr && der_arr->get_precision() == glsl_precision_undefined && der_arr->array->get_precision() != glsl_precision_undefined)
|
||||
{
|
||||
der_arr->set_precision (der_arr->array->get_precision());
|
||||
((precision_ctx*)data)->res = true;
|
||||
}
|
||||
|
||||
// swizzle with undefined precision: take from swizzle argument
|
||||
ir_swizzle* swz = ir->as_swizzle();
|
||||
if (swz && swz->get_precision() == glsl_precision_undefined && swz->val->get_precision() != glsl_precision_undefined)
|
||||
{
|
||||
swz->set_precision (swz->val->get_precision());
|
||||
((precision_ctx*)data)->res = true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static void propagate_precision_expr(ir_instruction *ir, void *data)
|
||||
{
|
||||
ir_expression* expr = ir->as_expression();
|
||||
if (!expr)
|
||||
return;
|
||||
if (expr->get_precision() != glsl_precision_undefined)
|
||||
return;
|
||||
|
||||
glsl_precision prec_params_max = glsl_precision_undefined;
|
||||
for (int i = 0; i < (int)expr->get_num_operands(); ++i)
|
||||
{
|
||||
ir_rvalue* op = expr->operands[i];
|
||||
if (op && op->get_precision() != glsl_precision_undefined)
|
||||
prec_params_max = higher_precision (prec_params_max, op->get_precision());
|
||||
}
|
||||
if (expr->get_precision() != prec_params_max)
|
||||
{
|
||||
expr->set_precision (prec_params_max);
|
||||
((precision_ctx*)data)->res = true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static void propagate_precision_texture(ir_instruction *ir, void *data)
|
||||
{
|
||||
ir_texture* tex = ir->as_texture();
|
||||
if (!tex)
|
||||
return;
|
||||
|
||||
glsl_precision sampler_prec = tex->sampler->get_precision();
|
||||
if (tex->get_precision() == sampler_prec || sampler_prec == glsl_precision_undefined)
|
||||
return;
|
||||
|
||||
// set precision of ir_texture node to that of the sampler itself
|
||||
tex->set_precision(sampler_prec);
|
||||
((precision_ctx*)data)->res = true;
|
||||
}
|
||||
|
||||
static void propagate_precision_texture_metal(ir_instruction* ir, void* data)
|
||||
{
|
||||
// There are no precision specifiers in Metal
|
||||
ir_texture* tex = ir->as_texture();
|
||||
if (tex)
|
||||
tex->set_precision(glsl_precision_undefined);
|
||||
}
|
||||
|
||||
struct undefined_ass_ctx
|
||||
{
|
||||
ir_variable* var;
|
||||
bool res;
|
||||
};
|
||||
|
||||
static void has_only_undefined_precision_assignments(ir_instruction *ir, void *data)
|
||||
{
|
||||
ir_assignment* ass = ir->as_assignment();
|
||||
if (!ass)
|
||||
return;
|
||||
undefined_ass_ctx* ctx = (undefined_ass_ctx*)data;
|
||||
if (ass->whole_variable_written() != ctx->var)
|
||||
return;
|
||||
glsl_precision prec = ass->rhs->get_precision();
|
||||
if (prec == glsl_precision_undefined)
|
||||
return;
|
||||
ctx->res = false;
|
||||
}
|
||||
|
||||
|
||||
static void propagate_precision_assign(ir_instruction *ir, void *data)
|
||||
{
|
||||
ir_assignment* ass = ir->as_assignment();
|
||||
if (!ass || !ass->lhs || !ass->rhs)
|
||||
return;
|
||||
|
||||
glsl_precision lp = ass->lhs->get_precision();
|
||||
glsl_precision rp = ass->rhs->get_precision();
|
||||
|
||||
// for assignments with LHS having undefined precision, take it from RHS
|
||||
if (rp != glsl_precision_undefined)
|
||||
{
|
||||
ir_variable* lhs_var = ass->lhs->variable_referenced();
|
||||
if (lp == glsl_precision_undefined)
|
||||
{
|
||||
if (lhs_var)
|
||||
lhs_var->data.precision = rp;
|
||||
ass->lhs->set_precision (rp);
|
||||
((precision_ctx*)data)->res = true;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// for assignments where LHS has precision, but RHS is a temporary variable
|
||||
// with undefined precision that's only assigned from other undefined precision
|
||||
// sources -> make the RHS variable take LHS precision
|
||||
if (lp != glsl_precision_undefined && rp == glsl_precision_undefined)
|
||||
{
|
||||
ir_dereference* deref = ass->rhs->as_dereference();
|
||||
if (deref)
|
||||
{
|
||||
ir_variable* rhs_var = deref->variable_referenced();
|
||||
if (rhs_var && rhs_var->data.mode == ir_var_temporary && rhs_var->data.precision == glsl_precision_undefined)
|
||||
{
|
||||
undefined_ass_ctx ctx;
|
||||
ctx.var = rhs_var;
|
||||
// find if we only assign to it from undefined precision sources
|
||||
ctx.res = true;
|
||||
exec_list* root_ir = ((precision_ctx*)data)->root_ir;
|
||||
foreach_in_list(ir_instruction, inst, root_ir)
|
||||
{
|
||||
visit_tree (ir, has_only_undefined_precision_assignments, &ctx);
|
||||
}
|
||||
if (ctx.res)
|
||||
{
|
||||
rhs_var->data.precision = lp;
|
||||
ass->rhs->set_precision(lp);
|
||||
((precision_ctx*)data)->res = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void propagate_precision_call(ir_instruction *ir, void *data)
|
||||
{
|
||||
ir_call* call = ir->as_call();
|
||||
if (!call)
|
||||
return;
|
||||
if (!call->return_deref)
|
||||
return;
|
||||
if (call->return_deref->get_precision() == glsl_precision_undefined /*&& call->callee->precision == glsl_precision_undefined*/)
|
||||
{
|
||||
glsl_precision prec_params_max = glsl_precision_undefined;
|
||||
foreach_two_lists(formal_node, &call->callee->parameters,
|
||||
actual_node, &call->actual_parameters) {
|
||||
ir_variable* sig_param = (ir_variable*)formal_node;
|
||||
ir_rvalue* param = (ir_rvalue*)actual_node;
|
||||
|
||||
glsl_precision p = (glsl_precision)sig_param->data.precision;
|
||||
if (p == glsl_precision_undefined)
|
||||
p = param->get_precision();
|
||||
|
||||
prec_params_max = higher_precision (prec_params_max, p);
|
||||
}
|
||||
if (call->return_deref->get_precision() != prec_params_max)
|
||||
{
|
||||
call->return_deref->set_precision (prec_params_max);
|
||||
((precision_ctx*)data)->res = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static bool propagate_precision(exec_list* list, bool metal_target)
|
||||
{
|
||||
bool anyProgress = false;
|
||||
precision_ctx ctx;
|
||||
|
||||
do {
|
||||
ctx.res = false;
|
||||
ctx.root_ir = list;
|
||||
foreach_in_list(ir_instruction, ir, list)
|
||||
{
|
||||
if (metal_target)
|
||||
visit_tree (ir, propagate_precision_texture_metal, &ctx);
|
||||
else
|
||||
visit_tree (ir, propagate_precision_texture, &ctx);
|
||||
|
||||
visit_tree (ir, propagate_precision_deref, &ctx);
|
||||
bool hadProgress = ctx.res;
|
||||
ctx.res = false;
|
||||
visit_tree (ir, propagate_precision_assign, &ctx);
|
||||
if (ctx.res)
|
||||
{
|
||||
// assignment precision propagation might have added precision
|
||||
// to some variables; need to propagate dereference precision right
|
||||
// after that too.
|
||||
visit_tree (ir, propagate_precision_deref, &ctx);
|
||||
}
|
||||
ctx.res |= hadProgress;
|
||||
visit_tree (ir, propagate_precision_call, &ctx);
|
||||
visit_tree (ir, propagate_precision_expr, &ctx);
|
||||
}
|
||||
anyProgress |= ctx.res;
|
||||
} while (ctx.res);
|
||||
anyProgress |= ctx.res;
|
||||
|
||||
// for globals that have undefined precision, set it to highp
|
||||
if (metal_target)
|
||||
{
|
||||
foreach_in_list(ir_instruction, ir, list)
|
||||
{
|
||||
ir_variable* var = ir->as_variable();
|
||||
if (var)
|
||||
{
|
||||
if (var->data.precision == glsl_precision_undefined)
|
||||
{
|
||||
var->data.precision = glsl_precision_high;
|
||||
anyProgress = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return anyProgress;
|
||||
}
|
||||
|
||||
|
||||
static void do_optimization_passes(exec_list* ir, bool linked, _mesa_glsl_parse_state* state, void* mem_ctx)
|
||||
{
|
||||
bool progress;
|
||||
// FIXME: Shouldn't need to bound the number of passes
|
||||
int passes = 0,
|
||||
kMaximumPasses = 1000;
|
||||
do {
|
||||
progress = false;
|
||||
++passes;
|
||||
bool progress2;
|
||||
debug_print_ir ("Initial", ir, state, mem_ctx);
|
||||
if (linked) {
|
||||
progress2 = do_function_inlining(ir); progress |= progress2; if (progress2) debug_print_ir ("After inlining", ir, state, mem_ctx);
|
||||
progress2 = do_dead_functions(ir); progress |= progress2; if (progress2) debug_print_ir ("After dead functions", ir, state, mem_ctx);
|
||||
progress2 = do_structure_splitting(ir); progress |= progress2; if (progress2) debug_print_ir ("After struct splitting", ir, state, mem_ctx);
|
||||
}
|
||||
progress2 = do_if_simplification(ir); progress |= progress2; if (progress2) debug_print_ir ("After if simpl", ir, state, mem_ctx);
|
||||
progress2 = opt_flatten_nested_if_blocks(ir); progress |= progress2; if (progress2) debug_print_ir ("After if flatten", ir, state, mem_ctx);
|
||||
progress2 = propagate_precision (ir, state->metal_target); progress |= progress2; if (progress2) debug_print_ir ("After prec propagation", ir, state, mem_ctx);
|
||||
progress2 = do_copy_propagation(ir); progress |= progress2; if (progress2) debug_print_ir ("After copy propagation", ir, state, mem_ctx);
|
||||
progress2 = do_copy_propagation_elements(ir); progress |= progress2; if (progress2) debug_print_ir ("After copy propagation elems", ir, state, mem_ctx);
|
||||
|
||||
if (linked)
|
||||
{
|
||||
progress2 = do_vectorize(ir); progress |= progress2; if (progress2) debug_print_ir ("After vectorize", ir, state, mem_ctx);
|
||||
}
|
||||
if (linked) {
|
||||
progress2 = do_dead_code(ir,false); progress |= progress2; if (progress2) debug_print_ir ("After dead code", ir, state, mem_ctx);
|
||||
} else {
|
||||
progress2 = do_dead_code_unlinked(ir); progress |= progress2; if (progress2) debug_print_ir ("After dead code unlinked", ir, state, mem_ctx);
|
||||
}
|
||||
progress2 = do_dead_code_local(ir); progress |= progress2; if (progress2) debug_print_ir ("After dead code local", ir, state, mem_ctx);
|
||||
progress2 = propagate_precision (ir, state->metal_target); progress |= progress2; if (progress2) debug_print_ir ("After prec propagation", ir, state, mem_ctx);
|
||||
progress2 = do_tree_grafting(ir); progress |= progress2; if (progress2) debug_print_ir ("After tree grafting", ir, state, mem_ctx);
|
||||
progress2 = do_constant_propagation(ir); progress |= progress2; if (progress2) debug_print_ir ("After const propagation", ir, state, mem_ctx);
|
||||
if (linked) {
|
||||
progress2 = do_constant_variable(ir); progress |= progress2; if (progress2) debug_print_ir ("After const variable", ir, state, mem_ctx);
|
||||
} else {
|
||||
progress2 = do_constant_variable_unlinked(ir); progress |= progress2; if (progress2) debug_print_ir ("After const variable unlinked", ir, state, mem_ctx);
|
||||
}
|
||||
progress2 = do_constant_folding(ir); progress |= progress2; if (progress2) debug_print_ir ("After const folding", ir, state, mem_ctx);
|
||||
progress2 = do_minmax_prune(ir); progress |= progress2; if (progress2) debug_print_ir ("After minmax prune", ir, state, mem_ctx);
|
||||
progress2 = do_cse(ir); progress |= progress2; if (progress2) debug_print_ir ("After CSE", ir, state, mem_ctx);
|
||||
progress2 = do_rebalance_tree(ir); progress |= progress2; if (progress2) debug_print_ir ("After rebalance tree", ir, state, mem_ctx);
|
||||
progress2 = do_algebraic(ir, state->ctx->Const.NativeIntegers, &state->ctx->Const.ShaderCompilerOptions[state->stage]); progress |= progress2; if (progress2) debug_print_ir ("After algebraic", ir, state, mem_ctx);
|
||||
progress2 = do_lower_jumps(ir); progress |= progress2; if (progress2) debug_print_ir ("After lower jumps", ir, state, mem_ctx);
|
||||
progress2 = do_vec_index_to_swizzle(ir); progress |= progress2; if (progress2) debug_print_ir ("After vec index to swizzle", ir, state, mem_ctx);
|
||||
progress2 = lower_vector_insert(ir, false); progress |= progress2; if (progress2) debug_print_ir ("After lower vector insert", ir, state, mem_ctx);
|
||||
progress2 = do_swizzle_swizzle(ir); progress |= progress2; if (progress2) debug_print_ir ("After swizzle swizzle", ir, state, mem_ctx);
|
||||
progress2 = do_noop_swizzle(ir); progress |= progress2; if (progress2) debug_print_ir ("After noop swizzle", ir, state, mem_ctx);
|
||||
progress2 = optimize_split_arrays(ir, linked, state->metal_target && state->stage == MESA_SHADER_FRAGMENT); progress |= progress2; if (progress2) debug_print_ir ("After split arrays", ir, state, mem_ctx);
|
||||
progress2 = optimize_redundant_jumps(ir); progress |= progress2; if (progress2) debug_print_ir ("After redundant jumps", ir, state, mem_ctx);
|
||||
|
||||
// do loop stuff only when linked; otherwise causes duplicate loop induction variable
|
||||
// problems (ast-in.txt test)
|
||||
if (linked)
|
||||
{
|
||||
loop_state *ls = analyze_loop_variables(ir);
|
||||
if (ls->loop_found) {
|
||||
progress2 = set_loop_controls(ir, ls); progress |= progress2; if (progress2) debug_print_ir ("After set loop", ir, state, mem_ctx);
|
||||
progress2 = unroll_loops(ir, ls, &state->ctx->Const.ShaderCompilerOptions[state->stage]); progress |= progress2; if (progress2) debug_print_ir ("After unroll", ir, state, mem_ctx);
|
||||
}
|
||||
delete ls;
|
||||
}
|
||||
} while (progress && passes < kMaximumPasses);
|
||||
|
||||
if (!state->metal_target)
|
||||
{
|
||||
// GLSL/ES does not have saturate, so lower it
|
||||
lower_instructions(ir, SAT_TO_CLAMP);
|
||||
}
|
||||
}
|
||||
|
||||
static void glsl_type_to_optimizer_desc(const glsl_type* type, glsl_precision prec, glslopt_shader_var* out)
|
||||
{
|
||||
out->arraySize = type->array_size();
|
||||
|
||||
// type; use element type when in array
|
||||
if (type->is_array())
|
||||
type = type->element_type();
|
||||
|
||||
if (type->is_float())
|
||||
out->type = kGlslTypeFloat;
|
||||
else if (type->is_integer())
|
||||
out->type = kGlslTypeInt;
|
||||
else if (type->is_boolean())
|
||||
out->type = kGlslTypeBool;
|
||||
else if (type->is_sampler())
|
||||
{
|
||||
if (type->sampler_dimensionality == GLSL_SAMPLER_DIM_2D)
|
||||
{
|
||||
if (type->sampler_shadow)
|
||||
out->type = kGlslTypeTex2DShadow;
|
||||
else if (type->sampler_array)
|
||||
out->type = kGlslTypeTex2DArray;
|
||||
else
|
||||
out->type = kGlslTypeTex2D;
|
||||
}
|
||||
else if (type->sampler_dimensionality == GLSL_SAMPLER_DIM_3D)
|
||||
out->type = kGlslTypeTex3D;
|
||||
else if (type->sampler_dimensionality == GLSL_SAMPLER_DIM_CUBE)
|
||||
out->type = kGlslTypeTexCube;
|
||||
else
|
||||
out->type = kGlslTypeOther;
|
||||
}
|
||||
else
|
||||
out->type = kGlslTypeOther;
|
||||
|
||||
// sizes
|
||||
out->vectorSize = type->vector_elements;
|
||||
out->matrixSize = type->matrix_columns;
|
||||
|
||||
// precision
|
||||
switch (prec)
|
||||
{
|
||||
case glsl_precision_high: out->prec = kGlslPrecHigh; break;
|
||||
case glsl_precision_medium: out->prec = kGlslPrecMedium; break;
|
||||
case glsl_precision_low: out->prec = kGlslPrecLow; break;
|
||||
default: out->prec = kGlslPrecHigh; break;
|
||||
}
|
||||
}
|
||||
|
||||
static void find_shader_variables(glslopt_shader* sh, exec_list* ir)
|
||||
{
|
||||
foreach_in_list(ir_instruction, node, ir)
|
||||
{
|
||||
ir_variable* const var = node->as_variable();
|
||||
if (var == NULL)
|
||||
continue;
|
||||
if (var->data.mode == ir_var_shader_in)
|
||||
{
|
||||
if (sh->inputCount >= glslopt_shader::kMaxShaderInputs)
|
||||
continue;
|
||||
|
||||
glslopt_shader_var& v = sh->inputs[sh->inputCount];
|
||||
v.name = ralloc_strdup(sh, var->name);
|
||||
glsl_type_to_optimizer_desc(var->type, (glsl_precision)var->data.precision, &v);
|
||||
v.location = var->data.explicit_location ? var->data.location : -1;
|
||||
++sh->inputCount;
|
||||
}
|
||||
if (var->data.mode == ir_var_uniform && !var->type->is_sampler())
|
||||
{
|
||||
if (sh->uniformCount >= glslopt_shader::kMaxShaderUniforms)
|
||||
continue;
|
||||
|
||||
glslopt_shader_var& v = sh->uniforms[sh->uniformCount];
|
||||
v.name = ralloc_strdup(sh, var->name);
|
||||
glsl_type_to_optimizer_desc(var->type, (glsl_precision)var->data.precision, &v);
|
||||
v.location = var->data.explicit_location ? var->data.location : -1;
|
||||
++sh->uniformCount;
|
||||
}
|
||||
if (var->data.mode == ir_var_uniform && var->type->is_sampler())
|
||||
{
|
||||
if (sh->textureCount >= glslopt_shader::kMaxShaderTextures)
|
||||
continue;
|
||||
|
||||
glslopt_shader_var& v = sh->textures[sh->textureCount];
|
||||
v.name = ralloc_strdup(sh, var->name);
|
||||
glsl_type_to_optimizer_desc(var->type, (glsl_precision)var->data.precision, &v);
|
||||
v.location = var->data.explicit_location ? var->data.location : -1;
|
||||
++sh->textureCount;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
glslopt_shader* glslopt_optimize (glslopt_ctx* ctx, glslopt_shader_type type, const char* shaderSource, unsigned options)
|
||||
{
|
||||
glslopt_shader* shader = new (ctx->mem_ctx) glslopt_shader ();
|
||||
|
||||
PrintGlslMode printMode = kPrintGlslVertex;
|
||||
switch (type) {
|
||||
case kGlslOptShaderVertex:
|
||||
shader->shader->Type = GL_VERTEX_SHADER;
|
||||
shader->shader->Stage = MESA_SHADER_VERTEX;
|
||||
printMode = kPrintGlslVertex;
|
||||
break;
|
||||
case kGlslOptShaderFragment:
|
||||
shader->shader->Type = GL_FRAGMENT_SHADER;
|
||||
shader->shader->Stage = MESA_SHADER_FRAGMENT;
|
||||
printMode = kPrintGlslFragment;
|
||||
break;
|
||||
case kGlslOptShaderCompute:
|
||||
shader->shader->Type = GL_COMPUTE_SHADER;
|
||||
shader->shader->Stage = MESA_SHADER_COMPUTE;
|
||||
printMode = kPrintGlslFragment;
|
||||
break;
|
||||
|
||||
}
|
||||
if (!shader->shader->Type)
|
||||
{
|
||||
shader->infoLog = ralloc_asprintf (shader, "Unknown shader type %d", (int)type);
|
||||
shader->status = false;
|
||||
return shader;
|
||||
}
|
||||
|
||||
_mesa_glsl_parse_state* state = new (shader) _mesa_glsl_parse_state (&ctx->mesa_ctx, shader->shader->Stage, shader);
|
||||
if (ctx->target == kGlslTargetMetal)
|
||||
state->metal_target = true;
|
||||
state->error = 0;
|
||||
|
||||
if (!(options & kGlslOptionSkipPreprocessor))
|
||||
{
|
||||
state->error = !!glcpp_preprocess (state, &shaderSource, &state->info_log, state->extensions, &ctx->mesa_ctx);
|
||||
if (state->error)
|
||||
{
|
||||
shader->status = !state->error;
|
||||
shader->infoLog = state->info_log;
|
||||
return shader;
|
||||
}
|
||||
}
|
||||
|
||||
_mesa_glsl_lexer_ctor (state, shaderSource);
|
||||
_mesa_glsl_parse (state);
|
||||
_mesa_glsl_lexer_dtor (state);
|
||||
|
||||
exec_list* ir = new (shader) exec_list();
|
||||
shader->shader->ir = ir;
|
||||
|
||||
if (!state->error && !state->translation_unit.is_empty())
|
||||
_mesa_ast_to_hir (ir, state);
|
||||
|
||||
// Un-optimized output
|
||||
if (!state->error) {
|
||||
validate_ir_tree(ir);
|
||||
if (ctx->target == kGlslTargetMetal)
|
||||
shader->rawOutput = _mesa_print_ir_metal(ir, state, ralloc_strdup(shader, ""), printMode, &shader->uniformsSize);
|
||||
else
|
||||
shader->rawOutput = _mesa_print_ir_glsl(ir, state, ralloc_strdup(shader, ""), printMode);
|
||||
}
|
||||
|
||||
// Link built-in functions
|
||||
shader->shader->symbols = state->symbols;
|
||||
shader->shader->uses_builtin_functions = state->uses_builtin_functions;
|
||||
|
||||
struct gl_shader* linked_shader = NULL;
|
||||
|
||||
if (!state->error && !ir->is_empty() && !(options & kGlslOptionNotFullShader))
|
||||
{
|
||||
linked_shader = link_intrastage_shaders(shader,
|
||||
&ctx->mesa_ctx,
|
||||
shader->whole_program,
|
||||
shader->whole_program->Shaders,
|
||||
shader->whole_program->NumShaders);
|
||||
if (!linked_shader)
|
||||
{
|
||||
shader->status = false;
|
||||
shader->infoLog = shader->whole_program->InfoLog;
|
||||
return shader;
|
||||
}
|
||||
ir = linked_shader->ir;
|
||||
|
||||
debug_print_ir ("==== After link ====", ir, state, shader);
|
||||
}
|
||||
|
||||
// Do optimization post-link
|
||||
if (!state->error && !ir->is_empty())
|
||||
{
|
||||
const bool linked = !(options & kGlslOptionNotFullShader);
|
||||
do_optimization_passes(ir, linked, state, shader);
|
||||
validate_ir_tree(ir);
|
||||
}
|
||||
|
||||
// Final optimized output
|
||||
if (!state->error)
|
||||
{
|
||||
if (ctx->target == kGlslTargetMetal)
|
||||
shader->optimizedOutput = _mesa_print_ir_metal(ir, state, ralloc_strdup(shader, ""), printMode, &shader->uniformsSize);
|
||||
else
|
||||
shader->optimizedOutput = _mesa_print_ir_glsl(ir, state, ralloc_strdup(shader, ""), printMode);
|
||||
}
|
||||
|
||||
shader->status = !state->error;
|
||||
shader->infoLog = state->info_log;
|
||||
|
||||
find_shader_variables (shader, ir);
|
||||
if (!state->error)
|
||||
calculate_shader_stats (ir, &shader->statsMath, &shader->statsTex, &shader->statsFlow);
|
||||
|
||||
ralloc_free (ir);
|
||||
ralloc_free (state);
|
||||
|
||||
if (linked_shader)
|
||||
ralloc_free(linked_shader);
|
||||
|
||||
return shader;
|
||||
}
|
||||
|
||||
void glslopt_shader_delete (glslopt_shader* shader)
|
||||
{
|
||||
delete shader;
|
||||
}
|
||||
|
||||
bool glslopt_get_status (glslopt_shader* shader)
|
||||
{
|
||||
return shader->status;
|
||||
}
|
||||
|
||||
const char* glslopt_get_output (glslopt_shader* shader)
|
||||
{
|
||||
return shader->optimizedOutput;
|
||||
}
|
||||
|
||||
const char* glslopt_get_raw_output (glslopt_shader* shader)
|
||||
{
|
||||
return shader->rawOutput;
|
||||
}
|
||||
|
||||
const char* glslopt_get_log (glslopt_shader* shader)
|
||||
{
|
||||
return shader->infoLog;
|
||||
}
|
||||
|
||||
int glslopt_shader_get_input_count (glslopt_shader* shader)
|
||||
{
|
||||
return shader->inputCount;
|
||||
}
|
||||
|
||||
int glslopt_shader_get_uniform_count (glslopt_shader* shader)
|
||||
{
|
||||
return shader->uniformCount;
|
||||
}
|
||||
|
||||
int glslopt_shader_get_uniform_total_size (glslopt_shader* shader)
|
||||
{
|
||||
return shader->uniformsSize;
|
||||
}
|
||||
|
||||
int glslopt_shader_get_texture_count (glslopt_shader* shader)
|
||||
{
|
||||
return shader->textureCount;
|
||||
}
|
||||
|
||||
void glslopt_shader_get_input_desc (glslopt_shader* shader, int index, const char** outName, glslopt_basic_type* outType, glslopt_precision* outPrec, int* outVecSize, int* outMatSize, int* outArraySize, int* outLocation)
|
||||
{
|
||||
const glslopt_shader_var& v = shader->inputs[index];
|
||||
*outName = v.name;
|
||||
*outType = v.type;
|
||||
*outPrec = v.prec;
|
||||
*outVecSize = v.vectorSize;
|
||||
*outMatSize = v.matrixSize;
|
||||
*outArraySize = v.arraySize;
|
||||
*outLocation = v.location;
|
||||
}
|
||||
|
||||
void glslopt_shader_get_uniform_desc (glslopt_shader* shader, int index, const char** outName, glslopt_basic_type* outType, glslopt_precision* outPrec, int* outVecSize, int* outMatSize, int* outArraySize, int* outLocation)
|
||||
{
|
||||
const glslopt_shader_var& v = shader->uniforms[index];
|
||||
*outName = v.name;
|
||||
*outType = v.type;
|
||||
*outPrec = v.prec;
|
||||
*outVecSize = v.vectorSize;
|
||||
*outMatSize = v.matrixSize;
|
||||
*outArraySize = v.arraySize;
|
||||
*outLocation = v.location;
|
||||
}
|
||||
|
||||
void glslopt_shader_get_texture_desc (glslopt_shader* shader, int index, const char** outName, glslopt_basic_type* outType, glslopt_precision* outPrec, int* outVecSize, int* outMatSize, int* outArraySize, int* outLocation)
|
||||
{
|
||||
const glslopt_shader_var& v = shader->textures[index];
|
||||
*outName = v.name;
|
||||
*outType = v.type;
|
||||
*outPrec = v.prec;
|
||||
*outVecSize = v.vectorSize;
|
||||
*outMatSize = v.matrixSize;
|
||||
*outArraySize = v.arraySize;
|
||||
*outLocation = v.location;
|
||||
}
|
||||
|
||||
void glslopt_shader_get_stats (glslopt_shader* shader, int* approxMath, int* approxTex, int* approxFlow)
|
||||
{
|
||||
*approxMath = shader->statsMath;
|
||||
*approxTex = shader->statsTex;
|
||||
*approxFlow = shader->statsFlow;
|
||||
}
|
|
@ -1,92 +0,0 @@
|
|||
#pragma once
|
||||
#ifndef GLSL_OPTIMIZER_H
|
||||
#define GLSL_OPTIMIZER_H
|
||||
|
||||
/*
|
||||
Main GLSL optimizer interface.
|
||||
See ../../README.md for more instructions.
|
||||
|
||||
General usage:
|
||||
|
||||
ctx = glslopt_initialize();
|
||||
for (lots of shaders) {
|
||||
shader = glslopt_optimize (ctx, shaderType, shaderSource, options);
|
||||
if (glslopt_get_status (shader)) {
|
||||
newSource = glslopt_get_output (shader);
|
||||
} else {
|
||||
errorLog = glslopt_get_log (shader);
|
||||
}
|
||||
glslopt_shader_delete (shader);
|
||||
}
|
||||
glslopt_cleanup (ctx);
|
||||
*/
|
||||
|
||||
struct glslopt_shader;
|
||||
struct glslopt_ctx;
|
||||
|
||||
enum glslopt_shader_type {
|
||||
kGlslOptShaderVertex = 0,
|
||||
kGlslOptShaderFragment,
|
||||
kGlslOptShaderCompute,
|
||||
};
|
||||
|
||||
// Options flags for glsl_optimize
|
||||
enum glslopt_options {
|
||||
kGlslOptionSkipPreprocessor = (1<<0), // Skip preprocessing shader source. Saves some time if you know you don't need it.
|
||||
kGlslOptionNotFullShader = (1<<1), // Passed shader is not the full shader source. This makes some optimizations weaker.
|
||||
};
|
||||
|
||||
// Optimizer target language
|
||||
enum glslopt_target {
|
||||
kGlslTargetOpenGL = 0,
|
||||
kGlslTargetOpenGLES20 = 1,
|
||||
kGlslTargetOpenGLES30 = 2,
|
||||
kGlslTargetMetal = 3,
|
||||
};
|
||||
|
||||
// Type info
|
||||
enum glslopt_basic_type {
|
||||
kGlslTypeFloat = 0,
|
||||
kGlslTypeInt,
|
||||
kGlslTypeBool,
|
||||
kGlslTypeTex2D,
|
||||
kGlslTypeTex3D,
|
||||
kGlslTypeTexCube,
|
||||
kGlslTypeTex2DShadow,
|
||||
kGlslTypeTex2DArray,
|
||||
kGlslTypeOther,
|
||||
kGlslTypeCount
|
||||
};
|
||||
enum glslopt_precision {
|
||||
kGlslPrecHigh = 0,
|
||||
kGlslPrecMedium,
|
||||
kGlslPrecLow,
|
||||
kGlslPrecCount
|
||||
};
|
||||
|
||||
glslopt_ctx* glslopt_initialize (glslopt_target target);
|
||||
void glslopt_cleanup (glslopt_ctx* ctx);
|
||||
|
||||
void glslopt_set_max_unroll_iterations (glslopt_ctx* ctx, unsigned iterations);
|
||||
|
||||
glslopt_shader* glslopt_optimize (glslopt_ctx* ctx, glslopt_shader_type type, const char* shaderSource, unsigned options);
|
||||
bool glslopt_get_status (glslopt_shader* shader);
|
||||
const char* glslopt_get_output (glslopt_shader* shader);
|
||||
const char* glslopt_get_raw_output (glslopt_shader* shader);
|
||||
const char* glslopt_get_log (glslopt_shader* shader);
|
||||
void glslopt_shader_delete (glslopt_shader* shader);
|
||||
|
||||
int glslopt_shader_get_input_count (glslopt_shader* shader);
|
||||
void glslopt_shader_get_input_desc (glslopt_shader* shader, int index, const char** outName, glslopt_basic_type* outType, glslopt_precision* outPrec, int* outVecSize, int* outMatSize, int* outArraySize, int* outLocation);
|
||||
int glslopt_shader_get_uniform_count (glslopt_shader* shader);
|
||||
int glslopt_shader_get_uniform_total_size (glslopt_shader* shader);
|
||||
void glslopt_shader_get_uniform_desc (glslopt_shader* shader, int index, const char** outName, glslopt_basic_type* outType, glslopt_precision* outPrec, int* outVecSize, int* outMatSize, int* outArraySize, int* outLocation);
|
||||
int glslopt_shader_get_texture_count (glslopt_shader* shader);
|
||||
void glslopt_shader_get_texture_desc (glslopt_shader* shader, int index, const char** outName, glslopt_basic_type* outType, glslopt_precision* outPrec, int* outVecSize, int* outMatSize, int* outArraySize, int* outLocation);
|
||||
|
||||
// Get *very* approximate shader stats:
|
||||
// Number of math, texture and flow control instructions.
|
||||
void glslopt_shader_get_stats (glslopt_shader* shader, int* approxMath, int* approxTex, int* approxFlow);
|
||||
|
||||
|
||||
#endif /* GLSL_OPTIMIZER_H */
|
File diff suppressed because it is too large
Load Diff
|
@ -1,347 +0,0 @@
|
|||
/* A Bison parser, made by GNU Bison 3.0.2. */
|
||||
|
||||
/* Bison interface for Yacc-like parsers in C
|
||||
|
||||
Copyright (C) 1984, 1989-1990, 2000-2013 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
/* As a special exception, you may create a larger work that contains
|
||||
part or all of the Bison parser skeleton and distribute that work
|
||||
under terms of your choice, so long as that work isn't itself a
|
||||
parser generator using the skeleton or a modified version thereof
|
||||
as a parser skeleton. Alternatively, if you modify or redistribute
|
||||
the parser skeleton itself, you may (at your option) remove this
|
||||
special exception, which will cause the skeleton and the resulting
|
||||
Bison output files to be licensed under the GNU General Public
|
||||
License without this special exception.
|
||||
|
||||
This special exception was added by the Free Software Foundation in
|
||||
version 2.2 of Bison. */
|
||||
|
||||
#ifndef YY__MESA_GLSL_SRC_GLSL_GLSL_PARSER_H_INCLUDED
|
||||
# define YY__MESA_GLSL_SRC_GLSL_GLSL_PARSER_H_INCLUDED
|
||||
/* Debug traces. */
|
||||
#ifndef YYDEBUG
|
||||
# define YYDEBUG 0
|
||||
#endif
|
||||
#if YYDEBUG
|
||||
extern int _mesa_glsl_debug;
|
||||
#endif
|
||||
|
||||
/* Token type. */
|
||||
#ifndef YYTOKENTYPE
|
||||
# define YYTOKENTYPE
|
||||
enum yytokentype
|
||||
{
|
||||
ATTRIBUTE = 258,
|
||||
CONST_TOK = 259,
|
||||
BOOL_TOK = 260,
|
||||
FLOAT_TOK = 261,
|
||||
INT_TOK = 262,
|
||||
UINT_TOK = 263,
|
||||
BREAK = 264,
|
||||
CONTINUE = 265,
|
||||
DO = 266,
|
||||
ELSE = 267,
|
||||
FOR = 268,
|
||||
IF = 269,
|
||||
DISCARD = 270,
|
||||
RETURN = 271,
|
||||
SWITCH = 272,
|
||||
CASE = 273,
|
||||
DEFAULT = 274,
|
||||
BVEC2 = 275,
|
||||
BVEC3 = 276,
|
||||
BVEC4 = 277,
|
||||
IVEC2 = 278,
|
||||
IVEC3 = 279,
|
||||
IVEC4 = 280,
|
||||
UVEC2 = 281,
|
||||
UVEC3 = 282,
|
||||
UVEC4 = 283,
|
||||
VEC2 = 284,
|
||||
VEC3 = 285,
|
||||
VEC4 = 286,
|
||||
CENTROID = 287,
|
||||
IN_TOK = 288,
|
||||
OUT_TOK = 289,
|
||||
INOUT_TOK = 290,
|
||||
UNIFORM = 291,
|
||||
VARYING = 292,
|
||||
SAMPLE = 293,
|
||||
NOPERSPECTIVE = 294,
|
||||
FLAT = 295,
|
||||
SMOOTH = 296,
|
||||
MAT2X2 = 297,
|
||||
MAT2X3 = 298,
|
||||
MAT2X4 = 299,
|
||||
MAT3X2 = 300,
|
||||
MAT3X3 = 301,
|
||||
MAT3X4 = 302,
|
||||
MAT4X2 = 303,
|
||||
MAT4X3 = 304,
|
||||
MAT4X4 = 305,
|
||||
SAMPLER1D = 306,
|
||||
SAMPLER2D = 307,
|
||||
SAMPLER3D = 308,
|
||||
SAMPLERCUBE = 309,
|
||||
SAMPLER1DSHADOW = 310,
|
||||
SAMPLER2DSHADOW = 311,
|
||||
SAMPLERCUBESHADOW = 312,
|
||||
SAMPLER1DARRAY = 313,
|
||||
SAMPLER2DARRAY = 314,
|
||||
SAMPLER1DARRAYSHADOW = 315,
|
||||
SAMPLER2DARRAYSHADOW = 316,
|
||||
SAMPLERCUBEARRAY = 317,
|
||||
SAMPLERCUBEARRAYSHADOW = 318,
|
||||
ISAMPLER1D = 319,
|
||||
ISAMPLER2D = 320,
|
||||
ISAMPLER3D = 321,
|
||||
ISAMPLERCUBE = 322,
|
||||
ISAMPLER1DARRAY = 323,
|
||||
ISAMPLER2DARRAY = 324,
|
||||
ISAMPLERCUBEARRAY = 325,
|
||||
USAMPLER1D = 326,
|
||||
USAMPLER2D = 327,
|
||||
USAMPLER3D = 328,
|
||||
USAMPLERCUBE = 329,
|
||||
USAMPLER1DARRAY = 330,
|
||||
USAMPLER2DARRAY = 331,
|
||||
USAMPLERCUBEARRAY = 332,
|
||||
SAMPLER2DRECT = 333,
|
||||
ISAMPLER2DRECT = 334,
|
||||
USAMPLER2DRECT = 335,
|
||||
SAMPLER2DRECTSHADOW = 336,
|
||||
SAMPLERBUFFER = 337,
|
||||
ISAMPLERBUFFER = 338,
|
||||
USAMPLERBUFFER = 339,
|
||||
SAMPLER2DMS = 340,
|
||||
ISAMPLER2DMS = 341,
|
||||
USAMPLER2DMS = 342,
|
||||
SAMPLER2DMSARRAY = 343,
|
||||
ISAMPLER2DMSARRAY = 344,
|
||||
USAMPLER2DMSARRAY = 345,
|
||||
SAMPLEREXTERNALOES = 346,
|
||||
IMAGE1D = 347,
|
||||
IMAGE2D = 348,
|
||||
IMAGE3D = 349,
|
||||
IMAGE2DRECT = 350,
|
||||
IMAGECUBE = 351,
|
||||
IMAGEBUFFER = 352,
|
||||
IMAGE1DARRAY = 353,
|
||||
IMAGE2DARRAY = 354,
|
||||
IMAGECUBEARRAY = 355,
|
||||
IMAGE2DMS = 356,
|
||||
IMAGE2DMSARRAY = 357,
|
||||
IIMAGE1D = 358,
|
||||
IIMAGE2D = 359,
|
||||
IIMAGE3D = 360,
|
||||
IIMAGE2DRECT = 361,
|
||||
IIMAGECUBE = 362,
|
||||
IIMAGEBUFFER = 363,
|
||||
IIMAGE1DARRAY = 364,
|
||||
IIMAGE2DARRAY = 365,
|
||||
IIMAGECUBEARRAY = 366,
|
||||
IIMAGE2DMS = 367,
|
||||
IIMAGE2DMSARRAY = 368,
|
||||
UIMAGE1D = 369,
|
||||
UIMAGE2D = 370,
|
||||
UIMAGE3D = 371,
|
||||
UIMAGE2DRECT = 372,
|
||||
UIMAGECUBE = 373,
|
||||
UIMAGEBUFFER = 374,
|
||||
UIMAGE1DARRAY = 375,
|
||||
UIMAGE2DARRAY = 376,
|
||||
UIMAGECUBEARRAY = 377,
|
||||
UIMAGE2DMS = 378,
|
||||
UIMAGE2DMSARRAY = 379,
|
||||
IMAGE1DSHADOW = 380,
|
||||
IMAGE2DSHADOW = 381,
|
||||
IMAGE1DARRAYSHADOW = 382,
|
||||
IMAGE2DARRAYSHADOW = 383,
|
||||
COHERENT = 384,
|
||||
VOLATILE = 385,
|
||||
RESTRICT = 386,
|
||||
READONLY = 387,
|
||||
WRITEONLY = 388,
|
||||
ATOMIC_UINT = 389,
|
||||
STRUCT = 390,
|
||||
VOID_TOK = 391,
|
||||
WHILE = 392,
|
||||
IDENTIFIER = 393,
|
||||
TYPE_IDENTIFIER = 394,
|
||||
NEW_IDENTIFIER = 395,
|
||||
FLOATCONSTANT = 396,
|
||||
INTCONSTANT = 397,
|
||||
UINTCONSTANT = 398,
|
||||
BOOLCONSTANT = 399,
|
||||
FIELD_SELECTION = 400,
|
||||
LEFT_OP = 401,
|
||||
RIGHT_OP = 402,
|
||||
INC_OP = 403,
|
||||
DEC_OP = 404,
|
||||
LE_OP = 405,
|
||||
GE_OP = 406,
|
||||
EQ_OP = 407,
|
||||
NE_OP = 408,
|
||||
AND_OP = 409,
|
||||
OR_OP = 410,
|
||||
XOR_OP = 411,
|
||||
MUL_ASSIGN = 412,
|
||||
DIV_ASSIGN = 413,
|
||||
ADD_ASSIGN = 414,
|
||||
MOD_ASSIGN = 415,
|
||||
LEFT_ASSIGN = 416,
|
||||
RIGHT_ASSIGN = 417,
|
||||
AND_ASSIGN = 418,
|
||||
XOR_ASSIGN = 419,
|
||||
OR_ASSIGN = 420,
|
||||
SUB_ASSIGN = 421,
|
||||
INVARIANT = 422,
|
||||
PRECISE = 423,
|
||||
LOWP = 424,
|
||||
MEDIUMP = 425,
|
||||
HIGHP = 426,
|
||||
SUPERP = 427,
|
||||
PRECISION = 428,
|
||||
VERSION_TOK = 429,
|
||||
EXTENSION = 430,
|
||||
LINE = 431,
|
||||
COLON = 432,
|
||||
EOL = 433,
|
||||
INTERFACE = 434,
|
||||
OUTPUT = 435,
|
||||
PRAGMA_DEBUG_ON = 436,
|
||||
PRAGMA_DEBUG_OFF = 437,
|
||||
PRAGMA_OPTIMIZE_ON = 438,
|
||||
PRAGMA_OPTIMIZE_OFF = 439,
|
||||
PRAGMA_INVARIANT_ALL = 440,
|
||||
LAYOUT_TOK = 441,
|
||||
ASM = 442,
|
||||
CLASS = 443,
|
||||
UNION = 444,
|
||||
ENUM = 445,
|
||||
TYPEDEF = 446,
|
||||
TEMPLATE = 447,
|
||||
THIS = 448,
|
||||
PACKED_TOK = 449,
|
||||
GOTO = 450,
|
||||
INLINE_TOK = 451,
|
||||
NOINLINE = 452,
|
||||
PUBLIC_TOK = 453,
|
||||
STATIC = 454,
|
||||
EXTERN = 455,
|
||||
EXTERNAL = 456,
|
||||
LONG_TOK = 457,
|
||||
SHORT_TOK = 458,
|
||||
DOUBLE_TOK = 459,
|
||||
HALF = 460,
|
||||
FIXED_TOK = 461,
|
||||
UNSIGNED = 462,
|
||||
INPUT_TOK = 463,
|
||||
HVEC2 = 464,
|
||||
HVEC3 = 465,
|
||||
HVEC4 = 466,
|
||||
DVEC2 = 467,
|
||||
DVEC3 = 468,
|
||||
DVEC4 = 469,
|
||||
FVEC2 = 470,
|
||||
FVEC3 = 471,
|
||||
FVEC4 = 472,
|
||||
SAMPLER3DRECT = 473,
|
||||
SIZEOF = 474,
|
||||
CAST = 475,
|
||||
NAMESPACE = 476,
|
||||
USING = 477,
|
||||
RESOURCE = 478,
|
||||
PATCH = 479,
|
||||
SUBROUTINE = 480,
|
||||
ERROR_TOK = 481,
|
||||
COMMON = 482,
|
||||
PARTITION = 483,
|
||||
ACTIVE = 484,
|
||||
FILTER = 485,
|
||||
ROW_MAJOR = 486,
|
||||
THEN = 487
|
||||
};
|
||||
#endif
|
||||
|
||||
/* Value type. */
|
||||
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
|
||||
typedef union YYSTYPE YYSTYPE;
|
||||
union YYSTYPE
|
||||
{
|
||||
#line 99 "src/glsl/glsl_parser.yy" /* yacc.c:1909 */
|
||||
|
||||
int n;
|
||||
float real;
|
||||
const char *identifier;
|
||||
|
||||
struct ast_type_qualifier type_qualifier;
|
||||
|
||||
ast_node *node;
|
||||
ast_type_specifier *type_specifier;
|
||||
ast_array_specifier *array_specifier;
|
||||
ast_fully_specified_type *fully_specified_type;
|
||||
ast_function *function;
|
||||
ast_parameter_declarator *parameter_declarator;
|
||||
ast_function_definition *function_definition;
|
||||
ast_compound_statement *compound_statement;
|
||||
ast_expression *expression;
|
||||
ast_declarator_list *declarator_list;
|
||||
ast_struct_specifier *struct_specifier;
|
||||
ast_declaration *declaration;
|
||||
ast_switch_body *switch_body;
|
||||
ast_case_label *case_label;
|
||||
ast_case_label_list *case_label_list;
|
||||
ast_case_statement *case_statement;
|
||||
ast_case_statement_list *case_statement_list;
|
||||
ast_interface_block *interface_block;
|
||||
|
||||
struct {
|
||||
ast_node *cond;
|
||||
ast_expression *rest;
|
||||
} for_rest_statement;
|
||||
|
||||
struct {
|
||||
ast_node *then_statement;
|
||||
ast_node *else_statement;
|
||||
} selection_rest_statement;
|
||||
|
||||
#line 324 "src/glsl/glsl_parser.h" /* yacc.c:1909 */
|
||||
};
|
||||
# define YYSTYPE_IS_TRIVIAL 1
|
||||
# define YYSTYPE_IS_DECLARED 1
|
||||
#endif
|
||||
|
||||
/* Location type. */
|
||||
#if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED
|
||||
typedef struct YYLTYPE YYLTYPE;
|
||||
struct YYLTYPE
|
||||
{
|
||||
int first_line;
|
||||
int first_column;
|
||||
int last_line;
|
||||
int last_column;
|
||||
};
|
||||
# define YYLTYPE_IS_DECLARED 1
|
||||
# define YYLTYPE_IS_TRIVIAL 1
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
int _mesa_glsl_parse (struct _mesa_glsl_parse_state *state);
|
||||
|
||||
#endif /* !YY__MESA_GLSL_SRC_GLSL_GLSL_PARSER_H_INCLUDED */
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -1,599 +0,0 @@
|
|||
/*
|
||||
* Copyright © 2010 Intel Corporation
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the next
|
||||
* paragraph) shall be included in all copies or substantial portions of the
|
||||
* Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#ifndef GLSL_PARSER_EXTRAS_H
|
||||
#define GLSL_PARSER_EXTRAS_H
|
||||
|
||||
/*
|
||||
* Most of the definitions here only apply to C++
|
||||
*/
|
||||
#ifdef __cplusplus
|
||||
|
||||
|
||||
#include <stdlib.h>
|
||||
#include "glsl_symbol_table.h"
|
||||
|
||||
struct gl_context;
|
||||
|
||||
struct glsl_switch_state {
|
||||
/** Temporary variables needed for switch statement. */
|
||||
ir_variable *test_var;
|
||||
ir_variable *is_fallthru_var;
|
||||
ir_variable *is_break_var;
|
||||
class ast_switch_statement *switch_nesting_ast;
|
||||
|
||||
/** Used to set condition if 'default' label should be chosen. */
|
||||
ir_variable *run_default;
|
||||
|
||||
/** Table of constant values already used in case labels */
|
||||
struct hash_table *labels_ht;
|
||||
class ast_case_label *previous_default;
|
||||
|
||||
bool is_switch_innermost; // if switch stmt is closest to break, ...
|
||||
};
|
||||
|
||||
const char *
|
||||
glsl_compute_version_string(void *mem_ctx, bool is_es, unsigned version);
|
||||
|
||||
typedef struct YYLTYPE {
|
||||
int first_line;
|
||||
int first_column;
|
||||
int last_line;
|
||||
int last_column;
|
||||
unsigned source;
|
||||
} YYLTYPE;
|
||||
# define YYLTYPE_IS_DECLARED 1
|
||||
# define YYLTYPE_IS_TRIVIAL 1
|
||||
|
||||
extern void _mesa_glsl_error(YYLTYPE *locp, _mesa_glsl_parse_state *state,
|
||||
const char *fmt, ...);
|
||||
|
||||
|
||||
struct _mesa_glsl_parse_state {
|
||||
_mesa_glsl_parse_state(struct gl_context *_ctx, gl_shader_stage stage,
|
||||
void *mem_ctx);
|
||||
|
||||
DECLARE_RALLOC_CXX_OPERATORS(_mesa_glsl_parse_state);
|
||||
|
||||
/**
|
||||
* Generate a string representing the GLSL version currently being compiled
|
||||
* (useful for error messages).
|
||||
*/
|
||||
const char *get_version_string()
|
||||
{
|
||||
return glsl_compute_version_string(this, this->es_shader,
|
||||
this->language_version);
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the current GLSL version is sufficiently high to
|
||||
* support a certain feature.
|
||||
*
|
||||
* \param required_glsl_version is the desktop GLSL version that is
|
||||
* required to support the feature, or 0 if no version of desktop GLSL
|
||||
* supports the feature.
|
||||
*
|
||||
* \param required_glsl_es_version is the GLSL ES version that is required
|
||||
* to support the feature, or 0 if no version of GLSL ES suports the
|
||||
* feature.
|
||||
*/
|
||||
bool is_version(unsigned required_glsl_version,
|
||||
unsigned required_glsl_es_version) const
|
||||
{
|
||||
unsigned required_version = this->es_shader ?
|
||||
required_glsl_es_version : required_glsl_version;
|
||||
return required_version != 0
|
||||
&& this->language_version >= required_version;
|
||||
}
|
||||
|
||||
bool check_version(unsigned required_glsl_version,
|
||||
unsigned required_glsl_es_version,
|
||||
YYLTYPE *locp, const char *fmt, ...) PRINTFLIKE(5, 6);
|
||||
|
||||
bool check_precision_qualifiers_allowed(YYLTYPE *locp)
|
||||
{
|
||||
return check_version(130, 100, locp,
|
||||
"precision qualifiers are forbidden");
|
||||
}
|
||||
|
||||
bool check_bitwise_operations_allowed(YYLTYPE *locp)
|
||||
{
|
||||
return check_version(130, 300, locp, "bit-wise operations are forbidden");
|
||||
}
|
||||
|
||||
bool check_explicit_attrib_stream_allowed(YYLTYPE *locp)
|
||||
{
|
||||
if (!this->has_explicit_attrib_stream()) {
|
||||
const char *const requirement = "GL_ARB_gpu_shader5 extension or GLSL 400";
|
||||
|
||||
_mesa_glsl_error(locp, this, "explicit stream requires %s",
|
||||
requirement);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool check_explicit_attrib_location_allowed(YYLTYPE *locp,
|
||||
const ir_variable *var)
|
||||
{
|
||||
if (!this->has_explicit_attrib_location()) {
|
||||
const char *const requirement = this->es_shader
|
||||
? "GLSL ES 300"
|
||||
: "GL_ARB_explicit_attrib_location extension or GLSL 330";
|
||||
|
||||
_mesa_glsl_error(locp, this, "%s explicit location requires %s",
|
||||
mode_string(var), requirement);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool check_separate_shader_objects_allowed(YYLTYPE *locp,
|
||||
const ir_variable *var)
|
||||
{
|
||||
if (!this->has_separate_shader_objects()) {
|
||||
const char *const requirement = this->es_shader
|
||||
? "GL_EXT_separate_shader_objects extension"
|
||||
: "GL_ARB_separate_shader_objects extension or GLSL 420";
|
||||
|
||||
_mesa_glsl_error(locp, this, "%s explicit location requires %s",
|
||||
mode_string(var), requirement);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool check_explicit_uniform_location_allowed(YYLTYPE *locp,
|
||||
const ir_variable *)
|
||||
{
|
||||
if (!this->has_explicit_attrib_location() ||
|
||||
!this->ARB_explicit_uniform_location_enable) {
|
||||
_mesa_glsl_error(locp, this,
|
||||
"uniform explicit location requires "
|
||||
"GL_ARB_explicit_uniform_location and either "
|
||||
"GL_ARB_explicit_attrib_location or GLSL 330.");
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool has_explicit_attrib_stream() const
|
||||
{
|
||||
return ARB_gpu_shader5_enable || is_version(400, 0);
|
||||
}
|
||||
|
||||
bool has_explicit_attrib_location() const
|
||||
{
|
||||
return ARB_explicit_attrib_location_enable || is_version(330, 300);
|
||||
}
|
||||
|
||||
bool has_uniform_buffer_objects() const
|
||||
{
|
||||
return ARB_uniform_buffer_object_enable || is_version(140, 300);
|
||||
}
|
||||
|
||||
bool has_separate_shader_objects() const
|
||||
{
|
||||
return ARB_separate_shader_objects_enable || is_version(410, 0)
|
||||
|| EXT_separate_shader_objects_enable;
|
||||
}
|
||||
|
||||
void process_version_directive(YYLTYPE *locp, int version,
|
||||
const char *ident);
|
||||
|
||||
struct gl_context *const ctx;
|
||||
void *scanner;
|
||||
exec_list translation_unit;
|
||||
glsl_symbol_table *symbols;
|
||||
|
||||
unsigned num_supported_versions;
|
||||
struct {
|
||||
unsigned ver;
|
||||
bool es;
|
||||
} supported_versions[12];
|
||||
|
||||
bool es_shader;
|
||||
bool metal_target;
|
||||
unsigned language_version;
|
||||
bool had_version_string;
|
||||
bool had_float_precision;
|
||||
gl_shader_stage stage;
|
||||
|
||||
/**
|
||||
* Number of nested struct_specifier levels
|
||||
*
|
||||
* Outside a struct_specifier, this is zero.
|
||||
*/
|
||||
unsigned struct_specifier_depth;
|
||||
|
||||
/**
|
||||
* Default uniform layout qualifiers tracked during parsing.
|
||||
* Currently affects uniform blocks and uniform buffer variables in
|
||||
* those blocks.
|
||||
*/
|
||||
struct ast_type_qualifier *default_uniform_qualifier;
|
||||
|
||||
/**
|
||||
* Variables to track different cases if a fragment shader redeclares
|
||||
* built-in variable gl_FragCoord.
|
||||
*
|
||||
* Note: These values are computed at ast_to_hir time rather than at parse
|
||||
* time.
|
||||
*/
|
||||
bool fs_redeclares_gl_fragcoord;
|
||||
bool fs_origin_upper_left;
|
||||
bool fs_pixel_center_integer;
|
||||
bool fs_redeclares_gl_fragcoord_with_no_layout_qualifiers;
|
||||
|
||||
/**
|
||||
* True if a geometry shader input primitive type was specified using a
|
||||
* layout directive.
|
||||
*
|
||||
* Note: this value is computed at ast_to_hir time rather than at parse
|
||||
* time.
|
||||
*/
|
||||
bool gs_input_prim_type_specified;
|
||||
|
||||
/** Input layout qualifiers from GLSL 1.50. (geometry shader controls)*/
|
||||
struct ast_type_qualifier *in_qualifier;
|
||||
|
||||
/**
|
||||
* True if a compute shader input local size was specified using a layout
|
||||
* directive.
|
||||
*
|
||||
* Note: this value is computed at ast_to_hir time rather than at parse
|
||||
* time.
|
||||
*/
|
||||
bool cs_input_local_size_specified;
|
||||
|
||||
/**
|
||||
* If cs_input_local_size_specified is true, the local size that was
|
||||
* specified. Otherwise ignored.
|
||||
*/
|
||||
unsigned cs_input_local_size[3];
|
||||
|
||||
/** Output layout qualifiers from GLSL 1.50. (geometry shader controls)*/
|
||||
struct ast_type_qualifier *out_qualifier;
|
||||
|
||||
/**
|
||||
* Printable list of GLSL versions supported by the current context
|
||||
*
|
||||
* \note
|
||||
* This string should probably be generated per-context instead of per
|
||||
* invokation of the compiler. This should be changed when the method of
|
||||
* tracking supported GLSL versions changes.
|
||||
*/
|
||||
const char *supported_version_string;
|
||||
|
||||
/**
|
||||
* Implementation defined limits that affect built-in variables, etc.
|
||||
*
|
||||
* \sa struct gl_constants (in mtypes.h)
|
||||
*/
|
||||
struct {
|
||||
/* 1.10 */
|
||||
unsigned MaxLights;
|
||||
unsigned MaxClipPlanes;
|
||||
unsigned MaxTextureUnits;
|
||||
unsigned MaxTextureCoords;
|
||||
unsigned MaxVertexAttribs;
|
||||
unsigned MaxVertexUniformComponents;
|
||||
unsigned MaxVertexTextureImageUnits;
|
||||
unsigned MaxCombinedTextureImageUnits;
|
||||
unsigned MaxTextureImageUnits;
|
||||
unsigned MaxFragmentUniformComponents;
|
||||
|
||||
/* ARB_draw_buffers */
|
||||
unsigned MaxDrawBuffers;
|
||||
|
||||
/* 3.00 ES */
|
||||
int MinProgramTexelOffset;
|
||||
int MaxProgramTexelOffset;
|
||||
|
||||
/* 1.50 */
|
||||
unsigned MaxVertexOutputComponents;
|
||||
unsigned MaxGeometryInputComponents;
|
||||
unsigned MaxGeometryOutputComponents;
|
||||
unsigned MaxFragmentInputComponents;
|
||||
unsigned MaxGeometryTextureImageUnits;
|
||||
unsigned MaxGeometryOutputVertices;
|
||||
unsigned MaxGeometryTotalOutputComponents;
|
||||
unsigned MaxGeometryUniformComponents;
|
||||
|
||||
/* ARB_shader_atomic_counters */
|
||||
unsigned MaxVertexAtomicCounters;
|
||||
unsigned MaxGeometryAtomicCounters;
|
||||
unsigned MaxFragmentAtomicCounters;
|
||||
unsigned MaxCombinedAtomicCounters;
|
||||
unsigned MaxAtomicBufferBindings;
|
||||
|
||||
/* ARB_compute_shader */
|
||||
unsigned MaxComputeWorkGroupCount[3];
|
||||
unsigned MaxComputeWorkGroupSize[3];
|
||||
|
||||
/* ARB_shader_image_load_store */
|
||||
unsigned MaxImageUnits;
|
||||
unsigned MaxCombinedImageUnitsAndFragmentOutputs;
|
||||
unsigned MaxImageSamples;
|
||||
unsigned MaxVertexImageUniforms;
|
||||
unsigned MaxGeometryImageUniforms;
|
||||
unsigned MaxFragmentImageUniforms;
|
||||
unsigned MaxCombinedImageUniforms;
|
||||
} Const;
|
||||
|
||||
/**
|
||||
* During AST to IR conversion, pointer to current IR function
|
||||
*
|
||||
* Will be \c NULL whenever the AST to IR conversion is not inside a
|
||||
* function definition.
|
||||
*/
|
||||
class ir_function_signature *current_function;
|
||||
|
||||
/**
|
||||
* During AST to IR conversion, pointer to the toplevel IR
|
||||
* instruction list being generated.
|
||||
*/
|
||||
exec_list *toplevel_ir;
|
||||
|
||||
/** Have we found a return statement in this function? */
|
||||
bool found_return;
|
||||
|
||||
/** Was there an error during compilation? */
|
||||
bool error;
|
||||
|
||||
/**
|
||||
* Are all shader inputs / outputs invariant?
|
||||
*
|
||||
* This is set when the 'STDGL invariant(all)' pragma is used.
|
||||
*/
|
||||
bool all_invariant;
|
||||
|
||||
/** Loop or switch statement containing the current instructions. */
|
||||
class ast_iteration_statement *loop_nesting_ast;
|
||||
|
||||
struct glsl_switch_state switch_state;
|
||||
|
||||
/** List of structures defined in user code. */
|
||||
const glsl_type **user_structures;
|
||||
unsigned num_user_structures;
|
||||
|
||||
char *info_log;
|
||||
|
||||
/**
|
||||
* \name Enable bits for GLSL extensions
|
||||
*/
|
||||
/*@{*/
|
||||
/* ARB extensions go here, sorted alphabetically.
|
||||
*/
|
||||
bool ARB_arrays_of_arrays_enable;
|
||||
bool ARB_arrays_of_arrays_warn;
|
||||
bool ARB_compute_shader_enable;
|
||||
bool ARB_compute_shader_warn;
|
||||
bool ARB_conservative_depth_enable;
|
||||
bool ARB_conservative_depth_warn;
|
||||
bool ARB_derivative_control_enable;
|
||||
bool ARB_derivative_control_warn;
|
||||
bool ARB_draw_buffers_enable;
|
||||
bool ARB_draw_buffers_warn;
|
||||
bool ARB_draw_instanced_enable;
|
||||
bool ARB_draw_instanced_warn;
|
||||
bool ARB_explicit_attrib_location_enable;
|
||||
bool ARB_explicit_attrib_location_warn;
|
||||
bool ARB_explicit_uniform_location_enable;
|
||||
bool ARB_explicit_uniform_location_warn;
|
||||
bool ARB_fragment_coord_conventions_enable;
|
||||
bool ARB_fragment_coord_conventions_warn;
|
||||
bool ARB_fragment_layer_viewport_enable;
|
||||
bool ARB_fragment_layer_viewport_warn;
|
||||
bool ARB_gpu_shader5_enable;
|
||||
bool ARB_gpu_shader5_warn;
|
||||
bool ARB_sample_shading_enable;
|
||||
bool ARB_sample_shading_warn;
|
||||
bool ARB_separate_shader_objects_enable;
|
||||
bool ARB_separate_shader_objects_warn;
|
||||
bool ARB_shader_atomic_counters_enable;
|
||||
bool ARB_shader_atomic_counters_warn;
|
||||
bool ARB_shader_bit_encoding_enable;
|
||||
bool ARB_shader_bit_encoding_warn;
|
||||
bool ARB_shader_image_load_store_enable;
|
||||
bool ARB_shader_image_load_store_warn;
|
||||
bool ARB_shader_stencil_export_enable;
|
||||
bool ARB_shader_stencil_export_warn;
|
||||
bool ARB_shader_texture_lod_enable;
|
||||
bool ARB_shader_texture_lod_warn;
|
||||
bool ARB_shading_language_420pack_enable;
|
||||
bool ARB_shading_language_420pack_warn;
|
||||
bool ARB_shading_language_packing_enable;
|
||||
bool ARB_shading_language_packing_warn;
|
||||
bool ARB_texture_cube_map_array_enable;
|
||||
bool ARB_texture_cube_map_array_warn;
|
||||
bool ARB_texture_gather_enable;
|
||||
bool ARB_texture_gather_warn;
|
||||
bool ARB_texture_multisample_enable;
|
||||
bool ARB_texture_multisample_warn;
|
||||
bool ARB_texture_query_levels_enable;
|
||||
bool ARB_texture_query_levels_warn;
|
||||
bool ARB_texture_query_lod_enable;
|
||||
bool ARB_texture_query_lod_warn;
|
||||
bool ARB_texture_rectangle_enable;
|
||||
bool ARB_texture_rectangle_warn;
|
||||
bool ARB_uniform_buffer_object_enable;
|
||||
bool ARB_uniform_buffer_object_warn;
|
||||
bool ARB_viewport_array_enable;
|
||||
bool ARB_viewport_array_warn;
|
||||
|
||||
/* KHR extensions go here, sorted alphabetically.
|
||||
*/
|
||||
|
||||
/* OES extensions go here, sorted alphabetically.
|
||||
*/
|
||||
bool OES_EGL_image_external_enable;
|
||||
bool OES_EGL_image_external_warn;
|
||||
bool OES_standard_derivatives_enable;
|
||||
bool OES_standard_derivatives_warn;
|
||||
bool OES_texture_3D_enable;
|
||||
bool OES_texture_3D_warn;
|
||||
|
||||
/* All other extensions go here, sorted alphabetically.
|
||||
*/
|
||||
bool AMD_conservative_depth_enable;
|
||||
bool AMD_conservative_depth_warn;
|
||||
bool AMD_shader_stencil_export_enable;
|
||||
bool AMD_shader_stencil_export_warn;
|
||||
bool AMD_shader_trinary_minmax_enable;
|
||||
bool AMD_shader_trinary_minmax_warn;
|
||||
bool AMD_vertex_shader_layer_enable;
|
||||
bool AMD_vertex_shader_layer_warn;
|
||||
bool AMD_vertex_shader_viewport_index_enable;
|
||||
bool AMD_vertex_shader_viewport_index_warn;
|
||||
bool EXT_draw_buffers_enable;
|
||||
bool EXT_draw_buffers_warn;
|
||||
bool EXT_draw_instanced_enable;
|
||||
bool EXT_draw_instanced_warn;
|
||||
bool EXT_frag_depth_enable;
|
||||
bool EXT_frag_depth_warn;
|
||||
bool EXT_gpu_shader4_enable;
|
||||
bool EXT_gpu_shader4_warn;
|
||||
bool EXT_separate_shader_objects_enable;
|
||||
bool EXT_separate_shader_objects_warn;
|
||||
bool EXT_shader_framebuffer_fetch_enable;
|
||||
bool EXT_shader_framebuffer_fetch_warn;
|
||||
bool EXT_shader_integer_mix_enable;
|
||||
bool EXT_shader_integer_mix_warn;
|
||||
bool EXT_shader_texture_lod_enable;
|
||||
bool EXT_shader_texture_lod_warn;
|
||||
bool EXT_shadow_samplers_enable;
|
||||
bool EXT_shadow_samplers_warn;
|
||||
bool EXT_texture_array_enable;
|
||||
bool EXT_texture_array_warn;
|
||||
|
||||
/*@}*/
|
||||
|
||||
/** Extensions supported by the OpenGL implementation. */
|
||||
const struct gl_extensions *extensions;
|
||||
|
||||
bool uses_builtin_functions;
|
||||
bool fs_uses_gl_fragcoord;
|
||||
|
||||
/**
|
||||
* For geometry shaders, size of the most recently seen input declaration
|
||||
* that was a sized array, or 0 if no sized input array declarations have
|
||||
* been seen.
|
||||
*
|
||||
* Unused for other shader types.
|
||||
*/
|
||||
unsigned gs_input_size;
|
||||
|
||||
bool early_fragment_tests;
|
||||
|
||||
/** Atomic counter offsets by binding */
|
||||
unsigned atomic_counter_offsets[MAX_COMBINED_ATOMIC_BUFFERS];
|
||||
|
||||
bool allow_extension_directive_midshader;
|
||||
};
|
||||
|
||||
# define YYLLOC_DEFAULT(Current, Rhs, N) \
|
||||
do { \
|
||||
if (N) \
|
||||
{ \
|
||||
(Current).first_line = YYRHSLOC(Rhs, 1).first_line; \
|
||||
(Current).first_column = YYRHSLOC(Rhs, 1).first_column; \
|
||||
(Current).last_line = YYRHSLOC(Rhs, N).last_line; \
|
||||
(Current).last_column = YYRHSLOC(Rhs, N).last_column; \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
(Current).first_line = (Current).last_line = \
|
||||
YYRHSLOC(Rhs, 0).last_line; \
|
||||
(Current).first_column = (Current).last_column = \
|
||||
YYRHSLOC(Rhs, 0).last_column; \
|
||||
} \
|
||||
(Current).source = 0; \
|
||||
} while (0)
|
||||
|
||||
/**
|
||||
* Emit a warning to the shader log
|
||||
*
|
||||
* \sa _mesa_glsl_error
|
||||
*/
|
||||
extern void _mesa_glsl_warning(const YYLTYPE *locp,
|
||||
_mesa_glsl_parse_state *state,
|
||||
const char *fmt, ...);
|
||||
|
||||
extern void _mesa_glsl_lexer_ctor(struct _mesa_glsl_parse_state *state,
|
||||
const char *string);
|
||||
|
||||
extern void _mesa_glsl_lexer_dtor(struct _mesa_glsl_parse_state *state);
|
||||
|
||||
union YYSTYPE;
|
||||
extern int _mesa_glsl_lexer_lex(union YYSTYPE *yylval, YYLTYPE *yylloc,
|
||||
void *scanner);
|
||||
|
||||
extern int _mesa_glsl_parse(struct _mesa_glsl_parse_state *);
|
||||
|
||||
/**
|
||||
* Process elements of the #extension directive
|
||||
*
|
||||
* \return
|
||||
* If \c name and \c behavior are valid, \c true is returned. Otherwise
|
||||
* \c false is returned.
|
||||
*/
|
||||
extern bool _mesa_glsl_process_extension(const char *name, YYLTYPE *name_locp,
|
||||
const char *behavior,
|
||||
YYLTYPE *behavior_locp,
|
||||
_mesa_glsl_parse_state *state);
|
||||
|
||||
#endif /* __cplusplus */
|
||||
|
||||
|
||||
/*
|
||||
* These definitions apply to C and C++
|
||||
*/
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Get the textual name of the specified shader stage (which is a
|
||||
* gl_shader_stage).
|
||||
*/
|
||||
extern const char *
|
||||
_mesa_shader_stage_to_string(unsigned stage);
|
||||
|
||||
extern int glcpp_preprocess(void *ctx, const char **shader, char **info_log,
|
||||
const struct gl_extensions *extensions, struct gl_context *gl_ctx);
|
||||
|
||||
extern void _mesa_destroy_shader_compiler(void);
|
||||
extern void _mesa_destroy_shader_compiler_caches(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#endif /* GLSL_PARSER_EXTRAS_H */
|
|
@ -1,250 +0,0 @@
|
|||
/* -*- c++ -*- */
|
||||
/*
|
||||
* Copyright © 2010 Intel Corporation
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the next
|
||||
* paragraph) shall be included in all copies or substantial portions of the
|
||||
* Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "glsl_symbol_table.h"
|
||||
|
||||
class symbol_table_entry {
|
||||
public:
|
||||
DECLARE_RALLOC_CXX_OPERATORS(symbol_table_entry);
|
||||
|
||||
bool add_interface(const glsl_type *i, enum ir_variable_mode mode)
|
||||
{
|
||||
const glsl_type **dest;
|
||||
|
||||
switch (mode) {
|
||||
case ir_var_uniform:
|
||||
dest = &ibu;
|
||||
break;
|
||||
case ir_var_shader_in:
|
||||
dest = &ibi;
|
||||
break;
|
||||
case ir_var_shader_out:
|
||||
dest = &ibo;
|
||||
break;
|
||||
default:
|
||||
assert(!"Unsupported interface variable mode!");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (*dest != NULL) {
|
||||
return false;
|
||||
} else {
|
||||
*dest = i;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
const glsl_type *get_interface(enum ir_variable_mode mode)
|
||||
{
|
||||
switch (mode) {
|
||||
case ir_var_uniform:
|
||||
return ibu;
|
||||
case ir_var_shader_in:
|
||||
return ibi;
|
||||
case ir_var_shader_out:
|
||||
return ibo;
|
||||
default:
|
||||
assert(!"Unsupported interface variable mode!");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
symbol_table_entry(ir_variable *v) :
|
||||
v(v), f(0), t(0), ibu(0), ibi(0), ibo(0), a(0) {}
|
||||
symbol_table_entry(ir_function *f) :
|
||||
v(0), f(f), t(0), ibu(0), ibi(0), ibo(0), a(0) {}
|
||||
symbol_table_entry(const glsl_type *t) :
|
||||
v(0), f(0), t(t), ibu(0), ibi(0), ibo(0), a(0) {}
|
||||
symbol_table_entry(const glsl_type *t, enum ir_variable_mode mode) :
|
||||
v(0), f(0), t(0), ibu(0), ibi(0), ibo(0), a(0)
|
||||
{
|
||||
assert(t->is_interface());
|
||||
add_interface(t, mode);
|
||||
}
|
||||
symbol_table_entry(const class ast_type_specifier *a):
|
||||
v(0), f(0), t(0), ibu(0), ibi(0), ibo(0), a(a) {}
|
||||
|
||||
ir_variable *v;
|
||||
ir_function *f;
|
||||
const glsl_type *t;
|
||||
const glsl_type *ibu;
|
||||
const glsl_type *ibi;
|
||||
const glsl_type *ibo;
|
||||
const class ast_type_specifier *a;
|
||||
};
|
||||
|
||||
glsl_symbol_table::glsl_symbol_table()
|
||||
{
|
||||
this->separate_function_namespace = false;
|
||||
this->table = _mesa_symbol_table_ctor();
|
||||
this->mem_ctx = ralloc_context(NULL);
|
||||
}
|
||||
|
||||
glsl_symbol_table::~glsl_symbol_table()
|
||||
{
|
||||
_mesa_symbol_table_dtor(table);
|
||||
ralloc_free(mem_ctx);
|
||||
}
|
||||
|
||||
void glsl_symbol_table::push_scope()
|
||||
{
|
||||
_mesa_symbol_table_push_scope(table);
|
||||
}
|
||||
|
||||
void glsl_symbol_table::pop_scope()
|
||||
{
|
||||
_mesa_symbol_table_pop_scope(table);
|
||||
}
|
||||
|
||||
bool glsl_symbol_table::name_declared_this_scope(const char *name)
|
||||
{
|
||||
return _mesa_symbol_table_symbol_scope(table, -1, name) == 0;
|
||||
}
|
||||
|
||||
bool glsl_symbol_table::add_variable(ir_variable *v)
|
||||
{
|
||||
assert(v->data.mode != ir_var_temporary);
|
||||
|
||||
if (this->separate_function_namespace) {
|
||||
/* In 1.10, functions and variables have separate namespaces. */
|
||||
symbol_table_entry *existing = get_entry(v->name);
|
||||
if (name_declared_this_scope(v->name)) {
|
||||
/* If there's already an existing function (not a constructor!) in
|
||||
* the current scope, just update the existing entry to include 'v'.
|
||||
*/
|
||||
if (existing->v == NULL && existing->t == NULL) {
|
||||
existing->v = v;
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
/* If not declared at this scope, add a new entry. But if an existing
|
||||
* entry includes a function, propagate that to this block - otherwise
|
||||
* the new variable declaration would shadow the function.
|
||||
*/
|
||||
symbol_table_entry *entry = new(mem_ctx) symbol_table_entry(v);
|
||||
if (existing != NULL)
|
||||
entry->f = existing->f;
|
||||
int added = _mesa_symbol_table_add_symbol(table, -1, v->name, entry);
|
||||
assert(added == 0);
|
||||
(void)added;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/* 1.20+ rules: */
|
||||
symbol_table_entry *entry = new(mem_ctx) symbol_table_entry(v);
|
||||
return _mesa_symbol_table_add_symbol(table, -1, v->name, entry) == 0;
|
||||
}
|
||||
|
||||
bool glsl_symbol_table::add_type(const char *name, const glsl_type *t)
|
||||
{
|
||||
symbol_table_entry *entry = new(mem_ctx) symbol_table_entry(t);
|
||||
return _mesa_symbol_table_add_symbol(table, -1, name, entry) == 0;
|
||||
}
|
||||
|
||||
bool glsl_symbol_table::add_interface(const char *name, const glsl_type *i,
|
||||
enum ir_variable_mode mode)
|
||||
{
|
||||
assert(i->is_interface());
|
||||
symbol_table_entry *entry = get_entry(name);
|
||||
if (entry == NULL) {
|
||||
symbol_table_entry *entry =
|
||||
new(mem_ctx) symbol_table_entry(i, mode);
|
||||
bool add_interface_symbol_result =
|
||||
_mesa_symbol_table_add_symbol(table, -1, name, entry) == 0;
|
||||
assert(add_interface_symbol_result);
|
||||
return add_interface_symbol_result;
|
||||
} else {
|
||||
return entry->add_interface(i, mode);
|
||||
}
|
||||
}
|
||||
|
||||
bool glsl_symbol_table::add_function(ir_function *f)
|
||||
{
|
||||
if (this->separate_function_namespace && name_declared_this_scope(f->name)) {
|
||||
/* In 1.10, functions and variables have separate namespaces. */
|
||||
symbol_table_entry *existing = get_entry(f->name);
|
||||
if ((existing->f == NULL) && (existing->t == NULL)) {
|
||||
existing->f = f;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
symbol_table_entry *entry = new(mem_ctx) symbol_table_entry(f);
|
||||
return _mesa_symbol_table_add_symbol(table, -1, f->name, entry) == 0;
|
||||
}
|
||||
|
||||
void glsl_symbol_table::add_global_function(ir_function *f)
|
||||
{
|
||||
symbol_table_entry *entry = new(mem_ctx) symbol_table_entry(f);
|
||||
int added = _mesa_symbol_table_add_global_symbol(table, -1, f->name, entry);
|
||||
assert(added == 0);
|
||||
(void)added;
|
||||
}
|
||||
|
||||
ir_variable *glsl_symbol_table::get_variable(const char *name)
|
||||
{
|
||||
symbol_table_entry *entry = get_entry(name);
|
||||
return entry != NULL ? entry->v : NULL;
|
||||
}
|
||||
|
||||
const glsl_type *glsl_symbol_table::get_type(const char *name)
|
||||
{
|
||||
symbol_table_entry *entry = get_entry(name);
|
||||
return entry != NULL ? entry->t : NULL;
|
||||
}
|
||||
|
||||
const glsl_type *glsl_symbol_table::get_interface(const char *name,
|
||||
enum ir_variable_mode mode)
|
||||
{
|
||||
symbol_table_entry *entry = get_entry(name);
|
||||
return entry != NULL ? entry->get_interface(mode) : NULL;
|
||||
}
|
||||
|
||||
ir_function *glsl_symbol_table::get_function(const char *name)
|
||||
{
|
||||
symbol_table_entry *entry = get_entry(name);
|
||||
return entry != NULL ? entry->f : NULL;
|
||||
}
|
||||
|
||||
symbol_table_entry *glsl_symbol_table::get_entry(const char *name)
|
||||
{
|
||||
return (symbol_table_entry *)
|
||||
_mesa_symbol_table_find_symbol(table, -1, name);
|
||||
}
|
||||
|
||||
void
|
||||
glsl_symbol_table::disable_variable(const char *name)
|
||||
{
|
||||
/* Ideally we would remove the variable's entry from the symbol table, but
|
||||
* that would be difficult. Fortunately, since this is only used for
|
||||
* built-in variables, it won't be possible for the shader to re-introduce
|
||||
* the variable later, so all we really need to do is to make sure that
|
||||
* further attempts to access it using get_variable() will return NULL.
|
||||
*/
|
||||
symbol_table_entry *entry = get_entry(name);
|
||||
if (entry != NULL) {
|
||||
entry->v = NULL;
|
||||
}
|
||||
}
|
|
@ -1,108 +0,0 @@
|
|||
/* -*- c++ -*- */
|
||||
/*
|
||||
* Copyright © 2010 Intel Corporation
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the next
|
||||
* paragraph) shall be included in all copies or substantial portions of the
|
||||
* Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#ifndef GLSL_SYMBOL_TABLE
|
||||
#define GLSL_SYMBOL_TABLE
|
||||
|
||||
#include <new>
|
||||
|
||||
extern "C" {
|
||||
#include "program/symbol_table.h"
|
||||
}
|
||||
#include "ir.h"
|
||||
|
||||
class symbol_table_entry;
|
||||
struct glsl_type;
|
||||
|
||||
/**
|
||||
* Facade class for _mesa_symbol_table
|
||||
*
|
||||
* Wraps the existing \c _mesa_symbol_table data structure to enforce some
|
||||
* type safe and some symbol table invariants.
|
||||
*/
|
||||
struct glsl_symbol_table {
|
||||
DECLARE_RALLOC_CXX_OPERATORS(glsl_symbol_table)
|
||||
|
||||
glsl_symbol_table();
|
||||
~glsl_symbol_table();
|
||||
|
||||
/* In 1.10, functions and variables have separate namespaces. */
|
||||
bool separate_function_namespace;
|
||||
|
||||
void push_scope();
|
||||
void pop_scope();
|
||||
|
||||
/**
|
||||
* Determine whether a name was declared at the current scope
|
||||
*/
|
||||
bool name_declared_this_scope(const char *name);
|
||||
|
||||
/**
|
||||
* \name Methods to add symbols to the table
|
||||
*
|
||||
* There is some temptation to rename all these functions to \c add_symbol
|
||||
* or similar. However, this breaks symmetry with the getter functions and
|
||||
* reduces the clarity of the intention of code that uses these methods.
|
||||
*/
|
||||
/*@{*/
|
||||
bool add_variable(ir_variable *v);
|
||||
bool add_type(const char *name, const glsl_type *t);
|
||||
bool add_function(ir_function *f);
|
||||
bool add_interface(const char *name, const glsl_type *i,
|
||||
enum ir_variable_mode mode);
|
||||
/*@}*/
|
||||
|
||||
/**
|
||||
* Add an function at global scope without checking for scoping conflicts.
|
||||
*/
|
||||
void add_global_function(ir_function *f);
|
||||
|
||||
/**
|
||||
* \name Methods to get symbols from the table
|
||||
*/
|
||||
/*@{*/
|
||||
ir_variable *get_variable(const char *name);
|
||||
const glsl_type *get_type(const char *name);
|
||||
ir_function *get_function(const char *name);
|
||||
const glsl_type *get_interface(const char *name,
|
||||
enum ir_variable_mode mode);
|
||||
/*@}*/
|
||||
|
||||
/**
|
||||
* Disable a previously-added variable so that it no longer appears to be
|
||||
* in the symbol table. This is necessary when gl_PerVertex is redeclared,
|
||||
* to ensure that previously-available built-in variables are no longer
|
||||
* available.
|
||||
*/
|
||||
void disable_variable(const char *name);
|
||||
|
||||
private:
|
||||
symbol_table_entry *get_entry(const char *name);
|
||||
|
||||
struct _mesa_symbol_table *table;
|
||||
void *mem_ctx;
|
||||
};
|
||||
|
||||
#endif /* GLSL_SYMBOL_TABLE */
|
File diff suppressed because it is too large
Load Diff
|
@ -1,752 +0,0 @@
|
|||
/* -*- c++ -*- */
|
||||
/*
|
||||
* Copyright © 2009 Intel Corporation
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the next
|
||||
* paragraph) shall be included in all copies or substantial portions of the
|
||||
* Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#ifndef GLSL_TYPES_H
|
||||
#define GLSL_TYPES_H
|
||||
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
#include "c99_compat.h"
|
||||
#include "main/mtypes.h" /* for gl_texture_index, C++'s enum rules are broken */
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct _mesa_glsl_parse_state;
|
||||
struct glsl_symbol_table;
|
||||
|
||||
extern void
|
||||
_mesa_glsl_initialize_types(struct _mesa_glsl_parse_state *state);
|
||||
|
||||
extern void
|
||||
_mesa_glsl_release_types(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
enum glsl_base_type {
|
||||
GLSL_TYPE_UINT = 0,
|
||||
GLSL_TYPE_INT,
|
||||
GLSL_TYPE_FLOAT,
|
||||
GLSL_TYPE_BOOL,
|
||||
GLSL_TYPE_SAMPLER,
|
||||
GLSL_TYPE_IMAGE,
|
||||
GLSL_TYPE_ATOMIC_UINT,
|
||||
GLSL_TYPE_STRUCT,
|
||||
GLSL_TYPE_INTERFACE,
|
||||
GLSL_TYPE_ARRAY,
|
||||
GLSL_TYPE_VOID,
|
||||
GLSL_TYPE_ERROR
|
||||
};
|
||||
|
||||
enum glsl_sampler_dim {
|
||||
GLSL_SAMPLER_DIM_1D = 0,
|
||||
GLSL_SAMPLER_DIM_2D,
|
||||
GLSL_SAMPLER_DIM_3D,
|
||||
GLSL_SAMPLER_DIM_CUBE,
|
||||
GLSL_SAMPLER_DIM_RECT,
|
||||
GLSL_SAMPLER_DIM_BUF,
|
||||
GLSL_SAMPLER_DIM_EXTERNAL,
|
||||
GLSL_SAMPLER_DIM_MS
|
||||
};
|
||||
|
||||
enum glsl_interface_packing {
|
||||
GLSL_INTERFACE_PACKING_STD140,
|
||||
GLSL_INTERFACE_PACKING_SHARED,
|
||||
GLSL_INTERFACE_PACKING_PACKED
|
||||
};
|
||||
|
||||
enum glsl_precision {
|
||||
glsl_precision_high = 0,
|
||||
glsl_precision_medium,
|
||||
glsl_precision_low,
|
||||
glsl_precision_undefined,
|
||||
};
|
||||
|
||||
enum glsl_matrix_layout {
|
||||
/**
|
||||
* The layout of the matrix is inherited from the object containing the
|
||||
* matrix (the top level structure or the uniform block).
|
||||
*/
|
||||
GLSL_MATRIX_LAYOUT_INHERITED,
|
||||
|
||||
/**
|
||||
* Explicit column-major layout
|
||||
*
|
||||
* If a uniform block doesn't have an explicit layout set, it will default
|
||||
* to this layout.
|
||||
*/
|
||||
GLSL_MATRIX_LAYOUT_COLUMN_MAJOR,
|
||||
|
||||
/**
|
||||
* Row-major layout
|
||||
*/
|
||||
GLSL_MATRIX_LAYOUT_ROW_MAJOR
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
#include "../mesa/main/glminimal.h"
|
||||
#include "util/ralloc.h"
|
||||
|
||||
struct glsl_type {
|
||||
GLenum gl_type;
|
||||
glsl_base_type base_type;
|
||||
|
||||
unsigned sampler_dimensionality:3; /**< \see glsl_sampler_dim */
|
||||
unsigned sampler_shadow:1;
|
||||
unsigned sampler_array:1;
|
||||
unsigned sampler_type:2; /**< Type of data returned using this
|
||||
* sampler or image. Only \c
|
||||
* GLSL_TYPE_FLOAT, \c GLSL_TYPE_INT,
|
||||
* and \c GLSL_TYPE_UINT are valid.
|
||||
*/
|
||||
unsigned interface_packing:2;
|
||||
|
||||
/* Callers of this ralloc-based new need not call delete. It's
|
||||
* easier to just ralloc_free 'mem_ctx' (or any of its ancestors). */
|
||||
static void* operator new(size_t size)
|
||||
{
|
||||
if (glsl_type::mem_ctx == NULL) {
|
||||
glsl_type::mem_ctx = ralloc_context(NULL);
|
||||
assert(glsl_type::mem_ctx != NULL);
|
||||
}
|
||||
|
||||
void *type;
|
||||
|
||||
type = ralloc_size(glsl_type::mem_ctx, size);
|
||||
assert(type != NULL);
|
||||
|
||||
return type;
|
||||
}
|
||||
|
||||
/* If the user *does* call delete, that's OK, we will just
|
||||
* ralloc_free in that case. */
|
||||
static void operator delete(void *type)
|
||||
{
|
||||
ralloc_free(type);
|
||||
}
|
||||
|
||||
/**
|
||||
* \name Vector and matrix element counts
|
||||
*
|
||||
* For scalars, each of these values will be 1. For non-numeric types
|
||||
* these will be 0.
|
||||
*/
|
||||
/*@{*/
|
||||
unsigned vector_elements:3; /**< 1, 2, 3, or 4 vector elements. */
|
||||
unsigned matrix_columns:3; /**< 1, 2, 3, or 4 matrix columns. */
|
||||
/*@}*/
|
||||
|
||||
/**
|
||||
* Name of the data type
|
||||
*
|
||||
* Will never be \c NULL.
|
||||
*/
|
||||
const char *name;
|
||||
|
||||
/**
|
||||
* For \c GLSL_TYPE_ARRAY, this is the length of the array. For
|
||||
* \c GLSL_TYPE_STRUCT or \c GLSL_TYPE_INTERFACE, it is the number of
|
||||
* elements in the structure and the number of values pointed to by
|
||||
* \c fields.structure (below).
|
||||
*/
|
||||
unsigned length;
|
||||
|
||||
/**
|
||||
* Subtype of composite data types.
|
||||
*/
|
||||
union {
|
||||
const struct glsl_type *array; /**< Type of array elements. */
|
||||
const struct glsl_type *parameters; /**< Parameters to function. */
|
||||
struct glsl_struct_field *structure; /**< List of struct fields. */
|
||||
} fields;
|
||||
|
||||
/**
|
||||
* \name Pointers to various public type singletons
|
||||
*/
|
||||
/*@{*/
|
||||
#undef DECL_TYPE
|
||||
#define DECL_TYPE(NAME, ...) \
|
||||
static const glsl_type *const NAME##_type;
|
||||
#undef STRUCT_TYPE
|
||||
#define STRUCT_TYPE(NAME) \
|
||||
static const glsl_type *const struct_##NAME##_type;
|
||||
#include "builtin_type_macros.h"
|
||||
/*@}*/
|
||||
|
||||
/**
|
||||
* Convenience accessors for vector types (shorter than get_instance()).
|
||||
* @{
|
||||
*/
|
||||
static const glsl_type *vec(unsigned components);
|
||||
static const glsl_type *ivec(unsigned components);
|
||||
static const glsl_type *uvec(unsigned components);
|
||||
static const glsl_type *bvec(unsigned components);
|
||||
/**@}*/
|
||||
|
||||
/**
|
||||
* For numeric and boolean derived types returns the basic scalar type
|
||||
*
|
||||
* If the type is a numeric or boolean scalar, vector, or matrix type,
|
||||
* this function gets the scalar type of the individual components. For
|
||||
* all other types, including arrays of numeric or boolean types, the
|
||||
* error type is returned.
|
||||
*/
|
||||
const glsl_type *get_base_type() const;
|
||||
|
||||
/**
|
||||
* Get the basic scalar type which this type aggregates.
|
||||
*
|
||||
* If the type is a numeric or boolean scalar, vector, or matrix, or an
|
||||
* array of any of those, this function gets the scalar type of the
|
||||
* individual components. For structs and arrays of structs, this function
|
||||
* returns the struct type. For samplers and arrays of samplers, this
|
||||
* function returns the sampler type.
|
||||
*/
|
||||
const glsl_type *get_scalar_type() const;
|
||||
|
||||
/**
|
||||
* Query the type of elements in an array
|
||||
*
|
||||
* \return
|
||||
* Pointer to the type of elements in the array for array types, or \c NULL
|
||||
* for non-array types.
|
||||
*/
|
||||
const glsl_type *element_type() const
|
||||
{
|
||||
return is_array() ? fields.array : NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the instance of a built-in scalar, vector, or matrix type
|
||||
*/
|
||||
static const glsl_type *get_instance(unsigned base_type, unsigned rows,
|
||||
unsigned columns);
|
||||
|
||||
/**
|
||||
* Get the instance of an array type
|
||||
*/
|
||||
static const glsl_type *get_array_instance(const glsl_type *base,
|
||||
unsigned elements);
|
||||
|
||||
/**
|
||||
* Get the instance of a record type
|
||||
*/
|
||||
static const glsl_type *get_record_instance(const glsl_struct_field *fields,
|
||||
unsigned num_fields,
|
||||
const char *name);
|
||||
|
||||
/**
|
||||
* Get the instance of an interface block type
|
||||
*/
|
||||
static const glsl_type *get_interface_instance(const glsl_struct_field *fields,
|
||||
unsigned num_fields,
|
||||
enum glsl_interface_packing packing,
|
||||
const char *block_name);
|
||||
|
||||
/**
|
||||
* Query the total number of scalars that make up a scalar, vector or matrix
|
||||
*/
|
||||
unsigned components() const
|
||||
{
|
||||
return vector_elements * matrix_columns;
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculate the number of components slots required to hold this type
|
||||
*
|
||||
* This is used to determine how many uniform or varying locations a type
|
||||
* might occupy.
|
||||
*/
|
||||
unsigned component_slots() const;
|
||||
|
||||
/**
|
||||
* Calculate the number of unique values from glGetUniformLocation for the
|
||||
* elements of the type.
|
||||
*
|
||||
* This is used to allocate slots in the UniformRemapTable, the amount of
|
||||
* locations may not match with actual used storage space by the driver.
|
||||
*/
|
||||
unsigned uniform_locations() const;
|
||||
|
||||
/**
|
||||
* Calculate the number of attribute slots required to hold this type
|
||||
*
|
||||
* This implements the language rules of GLSL 1.50 for counting the number
|
||||
* of slots used by a vertex attribute. It also determines the number of
|
||||
* varying slots the type will use up in the absence of varying packing
|
||||
* (and thus, it can be used to measure the number of varying slots used by
|
||||
* the varyings that are generated by lower_packed_varyings).
|
||||
*/
|
||||
unsigned count_attribute_slots() const;
|
||||
|
||||
|
||||
/**
|
||||
* Alignment in bytes of the start of this type in a std140 uniform
|
||||
* block.
|
||||
*/
|
||||
unsigned std140_base_alignment(bool row_major) const;
|
||||
|
||||
/** Size in bytes of this type in a std140 uniform block.
|
||||
*
|
||||
* Note that this is not GL_UNIFORM_SIZE (which is the number of
|
||||
* elements in the array)
|
||||
*/
|
||||
unsigned std140_size(bool row_major) const;
|
||||
|
||||
/**
|
||||
* \brief Can this type be implicitly converted to another?
|
||||
*
|
||||
* \return True if the types are identical or if this type can be converted
|
||||
* to \c desired according to Section 4.1.10 of the GLSL spec.
|
||||
*
|
||||
* \verbatim
|
||||
* From page 25 (31 of the pdf) of the GLSL 1.50 spec, Section 4.1.10
|
||||
* Implicit Conversions:
|
||||
*
|
||||
* In some situations, an expression and its type will be implicitly
|
||||
* converted to a different type. The following table shows all allowed
|
||||
* implicit conversions:
|
||||
*
|
||||
* Type of expression | Can be implicitly converted to
|
||||
* --------------------------------------------------
|
||||
* int float
|
||||
* uint
|
||||
*
|
||||
* ivec2 vec2
|
||||
* uvec2
|
||||
*
|
||||
* ivec3 vec3
|
||||
* uvec3
|
||||
*
|
||||
* ivec4 vec4
|
||||
* uvec4
|
||||
*
|
||||
* There are no implicit array or structure conversions. For example,
|
||||
* an array of int cannot be implicitly converted to an array of float.
|
||||
* There are no implicit conversions between signed and unsigned
|
||||
* integers.
|
||||
* \endverbatim
|
||||
*/
|
||||
bool can_implicitly_convert_to(const glsl_type *desired,
|
||||
_mesa_glsl_parse_state *state) const;
|
||||
|
||||
/**
|
||||
* Query whether or not a type is a scalar (non-vector and non-matrix).
|
||||
*/
|
||||
bool is_scalar() const
|
||||
{
|
||||
return (vector_elements == 1)
|
||||
&& (base_type >= GLSL_TYPE_UINT)
|
||||
&& (base_type <= GLSL_TYPE_BOOL);
|
||||
}
|
||||
|
||||
/**
|
||||
* Query whether or not a type is a vector
|
||||
*/
|
||||
bool is_vector() const
|
||||
{
|
||||
return (vector_elements > 1)
|
||||
&& (matrix_columns == 1)
|
||||
&& (base_type >= GLSL_TYPE_UINT)
|
||||
&& (base_type <= GLSL_TYPE_BOOL);
|
||||
}
|
||||
|
||||
/**
|
||||
* Query whether or not a type is a matrix
|
||||
*/
|
||||
bool is_matrix() const
|
||||
{
|
||||
/* GLSL only has float matrices. */
|
||||
return (matrix_columns > 1) && (base_type == GLSL_TYPE_FLOAT);
|
||||
}
|
||||
|
||||
/**
|
||||
* Query whether or not a type is a non-array numeric type
|
||||
*/
|
||||
bool is_numeric() const
|
||||
{
|
||||
return (base_type >= GLSL_TYPE_UINT) && (base_type <= GLSL_TYPE_FLOAT);
|
||||
}
|
||||
|
||||
/**
|
||||
* Query whether or not a type is an integral type
|
||||
*/
|
||||
bool is_integer() const
|
||||
{
|
||||
return (base_type == GLSL_TYPE_UINT) || (base_type == GLSL_TYPE_INT);
|
||||
}
|
||||
|
||||
/**
|
||||
* Query whether or not type is an integral type, or for struct and array
|
||||
* types, contains an integral type.
|
||||
*/
|
||||
bool contains_integer() const;
|
||||
|
||||
/**
|
||||
* Query whether or not a type is a float type
|
||||
*/
|
||||
bool is_float() const
|
||||
{
|
||||
return base_type == GLSL_TYPE_FLOAT;
|
||||
}
|
||||
|
||||
/**
|
||||
* Query whether or not a type is a non-array boolean type
|
||||
*/
|
||||
bool is_boolean() const
|
||||
{
|
||||
return base_type == GLSL_TYPE_BOOL;
|
||||
}
|
||||
|
||||
/**
|
||||
* Query whether or not a type is a sampler
|
||||
*/
|
||||
bool is_sampler() const
|
||||
{
|
||||
return base_type == GLSL_TYPE_SAMPLER;
|
||||
}
|
||||
|
||||
/**
|
||||
* Query whether or not type is a sampler, or for struct and array
|
||||
* types, contains a sampler.
|
||||
*/
|
||||
bool contains_sampler() const;
|
||||
|
||||
/**
|
||||
* Get the Mesa texture target index for a sampler type.
|
||||
*/
|
||||
gl_texture_index sampler_index() const;
|
||||
|
||||
/**
|
||||
* Query whether or not type is an image, or for struct and array
|
||||
* types, contains an image.
|
||||
*/
|
||||
bool contains_image() const;
|
||||
|
||||
/**
|
||||
* Query whether or not a type is an image
|
||||
*/
|
||||
bool is_image() const
|
||||
{
|
||||
return base_type == GLSL_TYPE_IMAGE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Query whether or not a type is an array
|
||||
*/
|
||||
bool is_array() const
|
||||
{
|
||||
return base_type == GLSL_TYPE_ARRAY;
|
||||
}
|
||||
|
||||
/**
|
||||
* Query whether or not a type is a record
|
||||
*/
|
||||
bool is_record() const
|
||||
{
|
||||
return base_type == GLSL_TYPE_STRUCT;
|
||||
}
|
||||
|
||||
/**
|
||||
* Query whether or not a type is an interface
|
||||
*/
|
||||
bool is_interface() const
|
||||
{
|
||||
return base_type == GLSL_TYPE_INTERFACE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Query whether or not a type is the void type singleton.
|
||||
*/
|
||||
bool is_void() const
|
||||
{
|
||||
return base_type == GLSL_TYPE_VOID;
|
||||
}
|
||||
|
||||
/**
|
||||
* Query whether or not a type is the error type singleton.
|
||||
*/
|
||||
bool is_error() const
|
||||
{
|
||||
return base_type == GLSL_TYPE_ERROR;
|
||||
}
|
||||
|
||||
/**
|
||||
* Query if a type is unnamed/anonymous (named by the parser)
|
||||
*/
|
||||
bool is_anonymous() const
|
||||
{
|
||||
return !strncmp(name, "#anon", 5);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the type stripped of any arrays
|
||||
*
|
||||
* \return
|
||||
* Pointer to the type of elements of the first non-array type for array
|
||||
* types, or pointer to itself for non-array types.
|
||||
*/
|
||||
const glsl_type *without_array() const
|
||||
{
|
||||
return this->is_array() ? this->fields.array : this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the amount of atomic counter storage required for a type.
|
||||
*/
|
||||
unsigned atomic_size() const
|
||||
{
|
||||
if (base_type == GLSL_TYPE_ATOMIC_UINT)
|
||||
return ATOMIC_COUNTER_SIZE;
|
||||
else if (is_array())
|
||||
return length * element_type()->atomic_size();
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return whether a type contains any atomic counters.
|
||||
*/
|
||||
bool contains_atomic() const
|
||||
{
|
||||
return atomic_size() > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return whether a type contains any opaque types.
|
||||
*/
|
||||
bool contains_opaque() const;
|
||||
|
||||
/**
|
||||
* Query the full type of a matrix row
|
||||
*
|
||||
* \return
|
||||
* If the type is not a matrix, \c glsl_type::error_type is returned.
|
||||
* Otherwise a type matching the rows of the matrix is returned.
|
||||
*/
|
||||
const glsl_type *row_type() const
|
||||
{
|
||||
return is_matrix()
|
||||
? get_instance(base_type, matrix_columns, 1)
|
||||
: error_type;
|
||||
}
|
||||
|
||||
/**
|
||||
* Query the full type of a matrix column
|
||||
*
|
||||
* \return
|
||||
* If the type is not a matrix, \c glsl_type::error_type is returned.
|
||||
* Otherwise a type matching the columns of the matrix is returned.
|
||||
*/
|
||||
const glsl_type *column_type() const
|
||||
{
|
||||
return is_matrix()
|
||||
? get_instance(base_type, vector_elements, 1)
|
||||
: error_type;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the type of a structure field
|
||||
*
|
||||
* \return
|
||||
* Pointer to the type of the named field. If the type is not a structure
|
||||
* or the named field does not exist, \c glsl_type::error_type is returned.
|
||||
*/
|
||||
const glsl_type *field_type(const char *name) const;
|
||||
|
||||
glsl_precision field_precision(const char *name) const;
|
||||
|
||||
|
||||
/**
|
||||
* Get the location of a filed within a record type
|
||||
*/
|
||||
int field_index(const char *name) const;
|
||||
|
||||
/**
|
||||
* Query the number of elements in an array type
|
||||
*
|
||||
* \return
|
||||
* The number of elements in the array for array types or -1 for non-array
|
||||
* types. If the number of elements in the array has not yet been declared,
|
||||
* zero is returned.
|
||||
*/
|
||||
int array_size() const
|
||||
{
|
||||
return is_array() ? length : -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Query whether the array size for all dimensions has been declared.
|
||||
*/
|
||||
bool is_unsized_array() const
|
||||
{
|
||||
return is_array() && length == 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the number of coordinate components needed for this
|
||||
* sampler or image type.
|
||||
*
|
||||
* This is based purely on the sampler's dimensionality. For example, this
|
||||
* returns 1 for sampler1D, and 3 for sampler2DArray.
|
||||
*
|
||||
* Note that this is often different than actual coordinate type used in
|
||||
* a texturing built-in function, since those pack additional values (such
|
||||
* as the shadow comparitor or projector) into the coordinate type.
|
||||
*/
|
||||
int coordinate_components() const;
|
||||
|
||||
/**
|
||||
* Compare a record type against another record type.
|
||||
*
|
||||
* This is useful for matching record types declared across shader stages.
|
||||
*/
|
||||
bool record_compare(const glsl_type *b) const;
|
||||
|
||||
private:
|
||||
/**
|
||||
* ralloc context for all glsl_type allocations
|
||||
*
|
||||
* Set on the first call to \c glsl_type::new.
|
||||
*/
|
||||
static void *mem_ctx;
|
||||
|
||||
void init_ralloc_type_ctx(void);
|
||||
|
||||
/** Constructor for vector and matrix types */
|
||||
glsl_type(GLenum gl_type,
|
||||
glsl_base_type base_type, unsigned vector_elements,
|
||||
unsigned matrix_columns, const char *name);
|
||||
|
||||
/** Constructor for sampler or image types */
|
||||
glsl_type(GLenum gl_type, glsl_base_type base_type,
|
||||
enum glsl_sampler_dim dim, bool shadow, bool array,
|
||||
unsigned type, const char *name);
|
||||
|
||||
/** Constructor for record types */
|
||||
glsl_type(const glsl_struct_field *fields, unsigned num_fields,
|
||||
const char *name);
|
||||
|
||||
/** Constructor for interface types */
|
||||
glsl_type(const glsl_struct_field *fields, unsigned num_fields,
|
||||
enum glsl_interface_packing packing, const char *name);
|
||||
|
||||
/** Constructor for array types */
|
||||
glsl_type(const glsl_type *array, unsigned length);
|
||||
|
||||
/** Hash table containing the known array types. */
|
||||
static struct hash_table *array_types;
|
||||
|
||||
/** Hash table containing the known record types. */
|
||||
static struct hash_table *record_types;
|
||||
|
||||
/** Hash table containing the known interface types. */
|
||||
static struct hash_table *interface_types;
|
||||
|
||||
static int record_key_compare(const void *a, const void *b);
|
||||
static unsigned record_key_hash(const void *key);
|
||||
|
||||
/**
|
||||
* \name Built-in type flyweights
|
||||
*/
|
||||
/*@{*/
|
||||
#undef DECL_TYPE
|
||||
#define DECL_TYPE(NAME, ...) static const glsl_type _##NAME##_type;
|
||||
#undef STRUCT_TYPE
|
||||
#define STRUCT_TYPE(NAME) static const glsl_type _struct_##NAME##_type;
|
||||
#include "builtin_type_macros.h"
|
||||
/*@}*/
|
||||
|
||||
/**
|
||||
* \name Friend functions.
|
||||
*
|
||||
* These functions are friends because they must have C linkage and the
|
||||
* need to call various private methods or access various private static
|
||||
* data.
|
||||
*/
|
||||
/*@{*/
|
||||
friend void _mesa_glsl_initialize_types(struct _mesa_glsl_parse_state *);
|
||||
friend void _mesa_glsl_release_types(void);
|
||||
/*@}*/
|
||||
};
|
||||
|
||||
struct glsl_struct_field {
|
||||
const struct glsl_type *type;
|
||||
const char *name;
|
||||
glsl_precision precision;
|
||||
|
||||
/**
|
||||
* For interface blocks, gl_varying_slot corresponding to the input/output
|
||||
* if this is a built-in input/output (i.e. a member of the built-in
|
||||
* gl_PerVertex interface block); -1 otherwise.
|
||||
*
|
||||
* Ignored for structs.
|
||||
*/
|
||||
int location;
|
||||
|
||||
/**
|
||||
* For interface blocks, the interpolation mode (as in
|
||||
* ir_variable::interpolation). 0 otherwise.
|
||||
*/
|
||||
unsigned interpolation:2;
|
||||
|
||||
/**
|
||||
* For interface blocks, 1 if this variable uses centroid interpolation (as
|
||||
* in ir_variable::centroid). 0 otherwise.
|
||||
*/
|
||||
unsigned centroid:1;
|
||||
|
||||
/**
|
||||
* For interface blocks, 1 if this variable uses sample interpolation (as
|
||||
* in ir_variable::sample). 0 otherwise.
|
||||
*/
|
||||
unsigned sample:1;
|
||||
|
||||
/**
|
||||
* Layout of the matrix. Uses glsl_matrix_layout values.
|
||||
*/
|
||||
unsigned matrix_layout:2;
|
||||
|
||||
/**
|
||||
* For interface blocks, it has a value if this variable uses multiple vertex
|
||||
* streams (as in ir_variable::stream). -1 otherwise.
|
||||
*/
|
||||
int stream;
|
||||
};
|
||||
|
||||
static inline unsigned int
|
||||
glsl_align(unsigned int a, unsigned int align)
|
||||
{
|
||||
return (a + align - 1) / align * align;
|
||||
}
|
||||
|
||||
#undef DECL_TYPE
|
||||
#undef STRUCT_TYPE
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* GLSL_TYPES_H */
|
|
@ -1,121 +0,0 @@
|
|||
/*
|
||||
* Copyright © 2010 Intel Corporation
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the next
|
||||
* paragraph) shall be included in all copies or substantial portions of the
|
||||
* Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "ir.h"
|
||||
#include "glsl_parser_extras.h"
|
||||
#include "ast.h"
|
||||
#include "glsl_types.h"
|
||||
|
||||
ir_rvalue *
|
||||
_mesa_ast_field_selection_to_hir(const ast_expression *expr,
|
||||
exec_list *instructions,
|
||||
struct _mesa_glsl_parse_state *state)
|
||||
{
|
||||
void *ctx = state;
|
||||
ir_rvalue *result = NULL;
|
||||
ir_rvalue *op;
|
||||
|
||||
op = expr->subexpressions[0]->hir(instructions, state);
|
||||
|
||||
/* There are two kinds of field selection. There is the selection of a
|
||||
* specific field from a structure, and there is the selection of a
|
||||
* swizzle / mask from a vector. Which is which is determined entirely
|
||||
* by the base type of the thing to which the field selection operator is
|
||||
* being applied.
|
||||
*/
|
||||
YYLTYPE loc = expr->get_location();
|
||||
if (op->type->is_error()) {
|
||||
/* silently propagate the error */
|
||||
} else if (op->type->base_type == GLSL_TYPE_STRUCT
|
||||
|| op->type->base_type == GLSL_TYPE_INTERFACE) {
|
||||
result = new(ctx) ir_dereference_record(op,
|
||||
expr->primary_expression.identifier);
|
||||
|
||||
if (result->type->is_error()) {
|
||||
_mesa_glsl_error(& loc, state, "cannot access field `%s' of "
|
||||
"structure",
|
||||
expr->primary_expression.identifier);
|
||||
}
|
||||
} else if (expr->subexpressions[1] != NULL) {
|
||||
/* Handle "method calls" in GLSL 1.20 - namely, array.length() */
|
||||
state->check_version(120, 300, &loc, "methods not supported");
|
||||
|
||||
ast_expression *call = expr->subexpressions[1];
|
||||
assert(call->oper == ast_function_call);
|
||||
|
||||
const char *method;
|
||||
method = call->subexpressions[0]->primary_expression.identifier;
|
||||
|
||||
if (strcmp(method, "length") == 0) {
|
||||
if (!call->expressions.is_empty())
|
||||
_mesa_glsl_error(&loc, state, "length method takes no arguments");
|
||||
|
||||
if (op->type->is_array()) {
|
||||
if (op->type->is_unsized_array())
|
||||
_mesa_glsl_error(&loc, state, "length called on unsized array");
|
||||
|
||||
result = new(ctx) ir_constant(op->type->array_size());
|
||||
} else if (op->type->is_vector()) {
|
||||
if (state->ARB_shading_language_420pack_enable) {
|
||||
/* .length() returns int. */
|
||||
result = new(ctx) ir_constant((int) op->type->vector_elements);
|
||||
} else {
|
||||
_mesa_glsl_error(&loc, state, "length method on matrix only available"
|
||||
"with ARB_shading_language_420pack");
|
||||
}
|
||||
} else if (op->type->is_matrix()) {
|
||||
if (state->ARB_shading_language_420pack_enable) {
|
||||
/* .length() returns int. */
|
||||
result = new(ctx) ir_constant((int) op->type->matrix_columns);
|
||||
} else {
|
||||
_mesa_glsl_error(&loc, state, "length method on matrix only available"
|
||||
"with ARB_shading_language_420pack");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
_mesa_glsl_error(&loc, state, "unknown method: `%s'", method);
|
||||
}
|
||||
} else if (op->type->is_vector() ||
|
||||
(state->ARB_shading_language_420pack_enable &&
|
||||
op->type->is_scalar())) {
|
||||
ir_swizzle *swiz = ir_swizzle::create(op,
|
||||
expr->primary_expression.identifier,
|
||||
op->type->vector_elements);
|
||||
if (swiz != NULL) {
|
||||
result = swiz;
|
||||
} else {
|
||||
/* FINISHME: Logging of error messages should be moved into
|
||||
* FINISHME: ir_swizzle::create. This allows the generation of more
|
||||
* FINISHME: specific error messages.
|
||||
*/
|
||||
_mesa_glsl_error(& loc, state, "invalid swizzle / mask `%s'",
|
||||
expr->primary_expression.identifier);
|
||||
}
|
||||
} else {
|
||||
_mesa_glsl_error(& loc, state, "cannot access field `%s' of "
|
||||
"non-structure / non-vector",
|
||||
expr->primary_expression.identifier);
|
||||
}
|
||||
|
||||
return result ? result : ir_rvalue::error_value(ctx);
|
||||
}
|
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue