Compare commits
117 Commits
master
...
simple_mat
Author | SHA1 | Date |
---|---|---|
Martin Felis | c7cbe4ac21 | |
Martin Felis | 69c56269de | |
Martin Felis | 3e6b89f22c | |
Martin Felis | 0a88592462 | |
Martin Felis | f3715f3a87 | |
Martin Felis | c1b39036db | |
Martin Felis | bb6a5c239d | |
Martin Felis | 09a1b24b42 | |
Martin Felis | 6d7bd06c2c | |
Martin Felis | ea7e3113f4 | |
Martin Felis | 1dc77c2131 | |
Martin Felis | eb67c1deaf | |
Martin Felis | f04a33d54b | |
Martin Felis | 293b41d1eb | |
Martin Felis | 0f15059ab5 | |
Martin Felis | e1f5b0fa0f | |
Martin Felis | 60acd12d94 | |
Martin Felis | 4e1687d80b | |
Martin Felis | 88898dedfc | |
Martin Felis | f820897417 | |
Martin Felis | 2bd2a99f29 | |
Martin Felis | 09db06fbfd | |
Martin Felis | 9588ee0674 | |
Martin Felis | 36dad56871 | |
Martin Felis | 48a4725b51 | |
Martin Felis | 03a3b856d7 | |
Martin Felis | 54d67cdeac | |
Martin Felis | 8694cddcdf | |
Martin Felis | 9f36525b49 | |
Martin Felis | 0fd0b8409e | |
Martin Felis | ce1a6ce9a4 | |
Martin Felis | e9ba7f77cc | |
Martin Felis | e76f5f1976 | |
Martin Felis | b0808864b5 | |
Martin Felis | aa4925b6c8 | |
Martin Felis | 1f003e3ed7 | |
Martin Felis | af7387175c | |
Martin Felis | 0fceeca4de | |
Martin Felis | 3b327af022 | |
Martin Felis | f5504efea7 | |
Martin Felis | 45e0dd9a9a | |
Martin Felis | cf7a71111d | |
Martin Felis | 0950a04022 | |
Martin Felis | 75677a5b70 | |
Martin Felis | 24516b592e | |
Martin Felis | 894377d440 | |
Martin Felis | 33a2e1d8cb | |
Martin Felis | 3d2cdf368a | |
Martin Felis | 40f91d4666 | |
Martin Felis | 796886b717 | |
Martin Felis | 37ffc2da1e | |
Martin Felis | 39d2bb68f8 | |
Martin Felis | 532a0fa9f2 | |
Martin Felis | eb189326b1 | |
Martin Felis | 07fbfb3c8c | |
Martin Felis | 5a0d1a91e9 | |
Martin Felis | 711b6ab7fe | |
Martin Felis | ed18691b1a | |
Martin Felis | a51c1936f2 | |
Martin Felis | 8b2dc08ec3 | |
Martin Felis | 077db8b04e | |
Martin Felis | fc58ba5513 | |
Martin Felis | 3c5e281900 | |
Martin Felis | f27a354226 | |
Martin Felis | cb13324846 | |
Martin Felis | ef4479ba71 | |
Martin Felis | 0810224356 | |
Martin Felis | fb3e1e7432 | |
Martin Felis | 8de75c7c47 | |
Martin Felis | cf024f4f72 | |
Martin Felis | 499eba60b7 | |
Martin Felis | c1a82427c0 | |
Martin Felis | e9c7a66d42 | |
Martin Felis | 69471bba84 | |
Martin Felis | d6ac057ce9 | |
Martin Felis | 5cacee03c1 | |
Martin Felis | 85c0b2cf42 | |
Martin Felis | 14dd2ac35e | |
Martin Felis | 2348929800 | |
Martin Felis | 2550bb5407 | |
Martin Felis | e2671e8de4 | |
Martin Felis | c86f535571 | |
Martin Felis | 76985c878f | |
Martin Felis | 076f051d48 | |
Martin Felis | 454ea72a85 | |
Martin Felis | 207094b0c8 | |
Martin Felis | d5fe4d366f | |
Martin Felis | 39fe10ffc7 | |
Martin Felis | 9c56d3f061 | |
Martin Felis | ea2b5d1e13 | |
Martin Felis | 540e0d6db8 | |
Martin Felis | 7bf244be37 | |
Martin Felis | cf59f6b6ae | |
Martin Felis | 48c8cde66b | |
Martin Felis | 7ac6e36c1f | |
Martin Felis | b5f3370570 | |
Martin Felis | 8d718eb71f | |
Martin Felis | ad4d671344 | |
Martin Felis | b15e2f8421 | |
Martin Felis | 469fbffb8e | |
Martin Felis | 18255b8b29 | |
Martin Felis | 0922f482f8 | |
Martin Felis | dc1ee2e33c | |
Martin Felis | bf5c1a5528 | |
Martin Felis | 412eab5dff | |
Martin Felis | f716a228f4 | |
Martin Felis | aca4af5f6a | |
Martin Felis | 7deddf3397 | |
Martin Felis | 663c4dc535 | |
Martin Felis | a3f3346f3e | |
Martin Felis | a47adeaa20 | |
Martin Felis | 45efe57988 | |
Martin Felis | ff99c25eac | |
Martin Felis | 9ec3d00f5b | |
Martin Felis | 73f432c266 | |
Martin Felis | a3d5bfcce5 | |
Martin Felis | 455f59c4e1 |
|
@ -1,6 +1,7 @@
|
|||
.*.swp
|
||||
|
||||
build/*
|
||||
cmake-build-*/**
|
||||
tags
|
||||
|
||||
3rdparty/glfw/docs/**
|
||||
|
|
|
@ -1,22 +0,0 @@
|
|||
shallow_clone: true
|
||||
|
||||
os:
|
||||
- Visual Studio 2015
|
||||
|
||||
environment:
|
||||
matrix:
|
||||
- TOOLSET: vs2010
|
||||
- TOOLSET: vs2012
|
||||
- TOOLSET: vs2013
|
||||
- TOOLSET: vs2015
|
||||
|
||||
configuration:
|
||||
- Debug
|
||||
- Release
|
||||
|
||||
install:
|
||||
- git clone https://github.com/bkaradzic/bx ..\bx
|
||||
- ..\bx\tools\bin\windows\genie --with-tools %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,22 +0,0 @@
|
|||
language: cpp
|
||||
matrix:
|
||||
include:
|
||||
- compiler: gcc
|
||||
os: linux
|
||||
- compiler: clang
|
||||
os: osx
|
||||
|
||||
before_script:
|
||||
git clone https://github.com/bkaradzic/bx ../bx
|
||||
|
||||
script:
|
||||
make build
|
||||
|
||||
branches:
|
||||
only:
|
||||
- master
|
||||
|
||||
notifications:
|
||||
email: false
|
||||
|
||||
osx_image: xcode7.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,34 +0,0 @@
|
|||
https://github.com/OpenGLInsights/OpenGLInsightsCode/blob/master/Chapter%2012%202D%20Shape%20Rendering%20by%20Distance%20Fields/LICENSE.txt
|
||||
|
||||
The C code and the GLSL code for the OpenGL demo is public
|
||||
domain code. The distance transform code in the console
|
||||
application to create distance field textures, located in
|
||||
the file "edtaa3func.c", is MIT licensed, and free to use
|
||||
under the following conditions.
|
||||
|
||||
https://github.com/OpenGLInsights/OpenGLInsightsCode/issues/6#issuecomment-67829157
|
||||
|
||||
----
|
||||
|
||||
Copyright (C) 2011 by Stefan Gustavson
|
||||
(stefan.gustavson@liu.se)
|
||||
|
||||
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.
|
||||
|
||||
----
|
|
@ -1,580 +0,0 @@
|
|||
/*
|
||||
* edtaa3()
|
||||
*
|
||||
* Sweep-and-update Euclidean distance transform of an
|
||||
* image. Positive pixels are treated as object pixels,
|
||||
* zero or negative pixels are treated as background.
|
||||
* An attempt is made to treat antialiased edges correctly.
|
||||
* The input image must have pixels in the range [0,1],
|
||||
* and the antialiased image should be a box-filter
|
||||
* sampling of the ideal, crisp edge.
|
||||
* If the antialias region is more than 1 pixel wide,
|
||||
* the result from this transform will be inaccurate.
|
||||
*
|
||||
* By Stefan Gustavson (stefan.gustavson@gmail.com).
|
||||
*
|
||||
* Originally written in 1994, based on a verbal
|
||||
* description of Per-Erik Danielsson's SSED8 algorithm
|
||||
* as presented in the PhD dissertation of Ingemar
|
||||
* Ragnemalm. This is Per-Erik Danielsson's scanline
|
||||
* scheme from 1979 - I only implemented it in C.
|
||||
*
|
||||
* Updated in 2004 to treat border pixels correctly,
|
||||
* and cleaned up the code to improve readability.
|
||||
*
|
||||
* Updated in 2009 to handle anti-aliased edges,
|
||||
* as published in the article "Anti-aliased Euclidean
|
||||
* distance transform" by Stefan Gustavson and Robin Strand,
|
||||
* Pattern Recognition Letters 32 (2011) 252–257.
|
||||
*
|
||||
* Updated in 2011 to avoid a corner case causing an
|
||||
* infinite loop for some input data.
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
|
||||
Copyright (C) 2011 by Stefan Gustavson
|
||||
|
||||
(stefan.gustavson@liu.se)
|
||||
|
||||
This code is distributed under the permissive "MIT license":
|
||||
|
||||
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 <math.h>
|
||||
|
||||
/*
|
||||
* Compute the local gradient at edge pixels using convolution filters.
|
||||
* The gradient is computed only at edge pixels. At other places in the
|
||||
* image, it is never used, and it's mostly zero anyway.
|
||||
*/
|
||||
void computegradient(double *img, int w, int h, double *gx, double *gy)
|
||||
{
|
||||
int i,j,k;
|
||||
double glength;
|
||||
#define SQRT2 1.4142136
|
||||
for(i = 1; i < h-1; i++) { // Avoid edges where the kernels would spill over
|
||||
for(j = 1; j < w-1; j++) {
|
||||
k = i*w + j;
|
||||
if((img[k]>0.0) && (img[k]<1.0)) { // Compute gradient for edge pixels only
|
||||
gx[k] = -img[k-w-1] - SQRT2*img[k-1] - img[k+w-1] + img[k-w+1] + SQRT2*img[k+1] + img[k+w+1];
|
||||
gy[k] = -img[k-w-1] - SQRT2*img[k-w] - img[k-w+1] + img[k+w-1] + SQRT2*img[k+w] + img[k+w+1];
|
||||
glength = gx[k]*gx[k] + gy[k]*gy[k];
|
||||
if(glength > 0.0) { // Avoid division by zero
|
||||
glength = sqrt(glength);
|
||||
gx[k]=gx[k]/glength;
|
||||
gy[k]=gy[k]/glength;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// TODO: Compute reasonable values for gx, gy also around the image edges.
|
||||
// (These are zero now, which reduces the accuracy for a 1-pixel wide region
|
||||
// around the image edge.) 2x2 kernels would be suitable for this.
|
||||
}
|
||||
|
||||
/*
|
||||
* A somewhat tricky function to approximate the distance to an edge in a
|
||||
* certain pixel, with consideration to either the local gradient (gx,gy)
|
||||
* or the direction to the pixel (dx,dy) and the pixel greyscale value a.
|
||||
* The latter alternative, using (dx,dy), is the metric used by edtaa2().
|
||||
* Using a local estimate of the edge gradient (gx,gy) yields much better
|
||||
* accuracy at and near edges, and reduces the error even at distant pixels
|
||||
* provided that the gradient direction is accurately estimated.
|
||||
*/
|
||||
double edgedf(double gx, double gy, double a)
|
||||
{
|
||||
double df, glength, temp, a1;
|
||||
|
||||
if ((gx == 0) || (gy == 0)) { // Either A) gu or gv are zero, or B) both
|
||||
df = 0.5-a; // Linear approximation is A) correct or B) a fair guess
|
||||
} else {
|
||||
glength = sqrt(gx*gx + gy*gy);
|
||||
if(glength>0) {
|
||||
gx = gx/glength;
|
||||
gy = gy/glength;
|
||||
}
|
||||
/* Everything is symmetric wrt sign and transposition,
|
||||
* so move to first octant (gx>=0, gy>=0, gx>=gy) to
|
||||
* avoid handling all possible edge directions.
|
||||
*/
|
||||
gx = fabs(gx);
|
||||
gy = fabs(gy);
|
||||
if(gx<gy) {
|
||||
temp = gx;
|
||||
gx = gy;
|
||||
gy = temp;
|
||||
}
|
||||
a1 = 0.5*gy/gx;
|
||||
if (a < a1) { // 0 <= a < a1
|
||||
df = 0.5*(gx + gy) - sqrt(2.0*gx*gy*a);
|
||||
} else if (a < (1.0-a1)) { // a1 <= a <= 1-a1
|
||||
df = (0.5-a)*gx;
|
||||
} else { // 1-a1 < a <= 1
|
||||
df = -0.5*(gx + gy) + sqrt(2.0*gx*gy*(1.0-a));
|
||||
}
|
||||
}
|
||||
return df;
|
||||
}
|
||||
|
||||
double distaa3(double *img, double *gximg, double *gyimg, int w, int c, int xc, int yc, int xi, int yi)
|
||||
{
|
||||
double di, df, dx, dy, gx, gy, a;
|
||||
int closest;
|
||||
|
||||
closest = c-xc-yc*w; // Index to the edge pixel pointed to from c
|
||||
a = img[closest]; // Grayscale value at the edge pixel
|
||||
gx = gximg[closest]; // X gradient component at the edge pixel
|
||||
gy = gyimg[closest]; // Y gradient component at the edge pixel
|
||||
|
||||
if(a > 1.0) a = 1.0;
|
||||
if(a < 0.0) a = 0.0; // Clip grayscale values outside the range [0,1]
|
||||
if(a == 0.0) return 1000000.0; // Not an object pixel, return "very far" ("don't know yet")
|
||||
|
||||
dx = (double)xi;
|
||||
dy = (double)yi;
|
||||
di = sqrt(dx*dx + dy*dy); // Length of integer vector, like a traditional EDT
|
||||
if(di==0) { // Use local gradient only at edges
|
||||
// Estimate based on local gradient only
|
||||
df = edgedf(gx, gy, a);
|
||||
} else {
|
||||
// Estimate gradient based on direction to edge (accurate for large di)
|
||||
df = edgedf(dx, dy, a);
|
||||
}
|
||||
return di + df; // Same metric as edtaa2, except at edges (where di=0)
|
||||
}
|
||||
|
||||
// Shorthand macro: add ubiquitous parameters img, gx, gy and w and call distaa3()
|
||||
#define DISTAA(c,xc,yc,xi,yi) (distaa3(img, gx, gy, w, c, xc, yc, xi, yi))
|
||||
|
||||
void edtaa3(double *img, double *gx, double *gy, int w, int h, short *distx, short *disty, double *dist)
|
||||
{
|
||||
int x, y, i, c;
|
||||
int offset_u, offset_ur, offset_r, offset_rd,
|
||||
offset_d, offset_dl, offset_l, offset_lu;
|
||||
double olddist, newdist;
|
||||
int cdistx, cdisty, newdistx, newdisty;
|
||||
int changed;
|
||||
double epsilon = 1e-3; // Safeguard against errors due to limited precision
|
||||
|
||||
/* Initialize index offsets for the current image width */
|
||||
offset_u = -w;
|
||||
offset_ur = -w+1;
|
||||
offset_r = 1;
|
||||
offset_rd = w+1;
|
||||
offset_d = w;
|
||||
offset_dl = w-1;
|
||||
offset_l = -1;
|
||||
offset_lu = -w-1;
|
||||
|
||||
/* Initialize the distance images */
|
||||
for(i=0; i<w*h; i++) {
|
||||
distx[i] = 0; // At first, all pixels point to
|
||||
disty[i] = 0; // themselves as the closest known.
|
||||
if(img[i] <= 0.0)
|
||||
{
|
||||
dist[i]= 1000000.0; // Big value, means "not set yet"
|
||||
}
|
||||
else if (img[i]<1.0) {
|
||||
dist[i] = edgedf(gx[i], gy[i], img[i]); // Gradient-assisted estimate
|
||||
}
|
||||
else {
|
||||
dist[i]= 0.0; // Inside the object
|
||||
}
|
||||
}
|
||||
|
||||
/* Perform the transformation */
|
||||
do
|
||||
{
|
||||
changed = 0;
|
||||
|
||||
/* Scan rows, except first row */
|
||||
for(y=1; y<h; y++)
|
||||
{
|
||||
|
||||
/* move index to leftmost pixel of current row */
|
||||
i = y*w;
|
||||
|
||||
/* scan right, propagate distances from above & left */
|
||||
|
||||
/* Leftmost pixel is special, has no left neighbors */
|
||||
olddist = dist[i];
|
||||
if(olddist > 0) // If non-zero distance or not set yet
|
||||
{
|
||||
c = i + offset_u; // Index of candidate for testing
|
||||
cdistx = distx[c];
|
||||
cdisty = disty[c];
|
||||
newdistx = cdistx;
|
||||
newdisty = cdisty+1;
|
||||
newdist = DISTAA(c, cdistx, cdisty, newdistx, newdisty);
|
||||
if(newdist < olddist-epsilon)
|
||||
{
|
||||
distx[i]=newdistx;
|
||||
disty[i]=newdisty;
|
||||
dist[i]=newdist;
|
||||
olddist=newdist;
|
||||
changed = 1;
|
||||
}
|
||||
|
||||
c = i+offset_ur;
|
||||
cdistx = distx[c];
|
||||
cdisty = disty[c];
|
||||
newdistx = cdistx-1;
|
||||
newdisty = cdisty+1;
|
||||
newdist = DISTAA(c, cdistx, cdisty, newdistx, newdisty);
|
||||
if(newdist < olddist-epsilon)
|
||||
{
|
||||
distx[i]=newdistx;
|
||||
disty[i]=newdisty;
|
||||
dist[i]=newdist;
|
||||
changed = 1;
|
||||
}
|
||||
}
|
||||
i++;
|
||||
|
||||
/* Middle pixels have all neighbors */
|
||||
for(x=1; x<w-1; x++, i++)
|
||||
{
|
||||
olddist = dist[i];
|
||||
if(olddist <= 0) continue; // No need to update further
|
||||
|
||||
c = i+offset_l;
|
||||
cdistx = distx[c];
|
||||
cdisty = disty[c];
|
||||
newdistx = cdistx+1;
|
||||
newdisty = cdisty;
|
||||
newdist = DISTAA(c, cdistx, cdisty, newdistx, newdisty);
|
||||
if(newdist < olddist-epsilon)
|
||||
{
|
||||
distx[i]=newdistx;
|
||||
disty[i]=newdisty;
|
||||
dist[i]=newdist;
|
||||
olddist=newdist;
|
||||
changed = 1;
|
||||
}
|
||||
|
||||
c = i+offset_lu;
|
||||
cdistx = distx[c];
|
||||
cdisty = disty[c];
|
||||
newdistx = cdistx+1;
|
||||
newdisty = cdisty+1;
|
||||
newdist = DISTAA(c, cdistx, cdisty, newdistx, newdisty);
|
||||
if(newdist < olddist-epsilon)
|
||||
{
|
||||
distx[i]=newdistx;
|
||||
disty[i]=newdisty;
|
||||
dist[i]=newdist;
|
||||
olddist=newdist;
|
||||
changed = 1;
|
||||
}
|
||||
|
||||
c = i+offset_u;
|
||||
cdistx = distx[c];
|
||||
cdisty = disty[c];
|
||||
newdistx = cdistx;
|
||||
newdisty = cdisty+1;
|
||||
newdist = DISTAA(c, cdistx, cdisty, newdistx, newdisty);
|
||||
if(newdist < olddist-epsilon)
|
||||
{
|
||||
distx[i]=newdistx;
|
||||
disty[i]=newdisty;
|
||||
dist[i]=newdist;
|
||||
olddist=newdist;
|
||||
changed = 1;
|
||||
}
|
||||
|
||||
c = i+offset_ur;
|
||||
cdistx = distx[c];
|
||||
cdisty = disty[c];
|
||||
newdistx = cdistx-1;
|
||||
newdisty = cdisty+1;
|
||||
newdist = DISTAA(c, cdistx, cdisty, newdistx, newdisty);
|
||||
if(newdist < olddist-epsilon)
|
||||
{
|
||||
distx[i]=newdistx;
|
||||
disty[i]=newdisty;
|
||||
dist[i]=newdist;
|
||||
changed = 1;
|
||||
}
|
||||
}
|
||||
|
||||
/* Rightmost pixel of row is special, has no right neighbors */
|
||||
olddist = dist[i];
|
||||
if(olddist > 0) // If not already zero distance
|
||||
{
|
||||
c = i+offset_l;
|
||||
cdistx = distx[c];
|
||||
cdisty = disty[c];
|
||||
newdistx = cdistx+1;
|
||||
newdisty = cdisty;
|
||||
newdist = DISTAA(c, cdistx, cdisty, newdistx, newdisty);
|
||||
if(newdist < olddist-epsilon)
|
||||
{
|
||||
distx[i]=newdistx;
|
||||
disty[i]=newdisty;
|
||||
dist[i]=newdist;
|
||||
olddist=newdist;
|
||||
changed = 1;
|
||||
}
|
||||
|
||||
c = i+offset_lu;
|
||||
cdistx = distx[c];
|
||||
cdisty = disty[c];
|
||||
newdistx = cdistx+1;
|
||||
newdisty = cdisty+1;
|
||||
newdist = DISTAA(c, cdistx, cdisty, newdistx, newdisty);
|
||||
if(newdist < olddist-epsilon)
|
||||
{
|
||||
distx[i]=newdistx;
|
||||
disty[i]=newdisty;
|
||||
dist[i]=newdist;
|
||||
olddist=newdist;
|
||||
changed = 1;
|
||||
}
|
||||
|
||||
c = i+offset_u;
|
||||
cdistx = distx[c];
|
||||
cdisty = disty[c];
|
||||
newdistx = cdistx;
|
||||
newdisty = cdisty+1;
|
||||
newdist = DISTAA(c, cdistx, cdisty, newdistx, newdisty);
|
||||
if(newdist < olddist-epsilon)
|
||||
{
|
||||
distx[i]=newdistx;
|
||||
disty[i]=newdisty;
|
||||
dist[i]=newdist;
|
||||
changed = 1;
|
||||
}
|
||||
}
|
||||
|
||||
/* Move index to second rightmost pixel of current row. */
|
||||
/* Rightmost pixel is skipped, it has no right neighbor. */
|
||||
i = y*w + w-2;
|
||||
|
||||
/* scan left, propagate distance from right */
|
||||
for(x=w-2; x>=0; x--, i--)
|
||||
{
|
||||
olddist = dist[i];
|
||||
if(olddist <= 0) continue; // Already zero distance
|
||||
|
||||
c = i+offset_r;
|
||||
cdistx = distx[c];
|
||||
cdisty = disty[c];
|
||||
newdistx = cdistx-1;
|
||||
newdisty = cdisty;
|
||||
newdist = DISTAA(c, cdistx, cdisty, newdistx, newdisty);
|
||||
if(newdist < olddist-epsilon)
|
||||
{
|
||||
distx[i]=newdistx;
|
||||
disty[i]=newdisty;
|
||||
dist[i]=newdist;
|
||||
changed = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Scan rows in reverse order, except last row */
|
||||
for(y=h-2; y>=0; y--)
|
||||
{
|
||||
/* move index to rightmost pixel of current row */
|
||||
i = y*w + w-1;
|
||||
|
||||
/* Scan left, propagate distances from below & right */
|
||||
|
||||
/* Rightmost pixel is special, has no right neighbors */
|
||||
olddist = dist[i];
|
||||
if(olddist > 0) // If not already zero distance
|
||||
{
|
||||
c = i+offset_d;
|
||||
cdistx = distx[c];
|
||||
cdisty = disty[c];
|
||||
newdistx = cdistx;
|
||||
newdisty = cdisty-1;
|
||||
newdist = DISTAA(c, cdistx, cdisty, newdistx, newdisty);
|
||||
if(newdist < olddist-epsilon)
|
||||
{
|
||||
distx[i]=newdistx;
|
||||
disty[i]=newdisty;
|
||||
dist[i]=newdist;
|
||||
olddist=newdist;
|
||||
changed = 1;
|
||||
}
|
||||
|
||||
c = i+offset_dl;
|
||||
cdistx = distx[c];
|
||||
cdisty = disty[c];
|
||||
newdistx = cdistx+1;
|
||||
newdisty = cdisty-1;
|
||||
newdist = DISTAA(c, cdistx, cdisty, newdistx, newdisty);
|
||||
if(newdist < olddist-epsilon)
|
||||
{
|
||||
distx[i]=newdistx;
|
||||
disty[i]=newdisty;
|
||||
dist[i]=newdist;
|
||||
changed = 1;
|
||||
}
|
||||
}
|
||||
i--;
|
||||
|
||||
/* Middle pixels have all neighbors */
|
||||
for(x=w-2; x>0; x--, i--)
|
||||
{
|
||||
olddist = dist[i];
|
||||
if(olddist <= 0) continue; // Already zero distance
|
||||
|
||||
c = i+offset_r;
|
||||
cdistx = distx[c];
|
||||
cdisty = disty[c];
|
||||
newdistx = cdistx-1;
|
||||
newdisty = cdisty;
|
||||
newdist = DISTAA(c, cdistx, cdisty, newdistx, newdisty);
|
||||
if(newdist < olddist-epsilon)
|
||||
{
|
||||
distx[i]=newdistx;
|
||||
disty[i]=newdisty;
|
||||
dist[i]=newdist;
|
||||
olddist=newdist;
|
||||
changed = 1;
|
||||
}
|
||||
|
||||
c = i+offset_rd;
|
||||
cdistx = distx[c];
|
||||
cdisty = disty[c];
|
||||
newdistx = cdistx-1;
|
||||
newdisty = cdisty-1;
|
||||
newdist = DISTAA(c, cdistx, cdisty, newdistx, newdisty);
|
||||
if(newdist < olddist-epsilon)
|
||||
{
|
||||
distx[i]=newdistx;
|
||||
disty[i]=newdisty;
|
||||
dist[i]=newdist;
|
||||
olddist=newdist;
|
||||
changed = 1;
|
||||
}
|
||||
|
||||
c = i+offset_d;
|
||||
cdistx = distx[c];
|
||||
cdisty = disty[c];
|
||||
newdistx = cdistx;
|
||||
newdisty = cdisty-1;
|
||||
newdist = DISTAA(c, cdistx, cdisty, newdistx, newdisty);
|
||||
if(newdist < olddist-epsilon)
|
||||
{
|
||||
distx[i]=newdistx;
|
||||
disty[i]=newdisty;
|
||||
dist[i]=newdist;
|
||||
olddist=newdist;
|
||||
changed = 1;
|
||||
}
|
||||
|
||||
c = i+offset_dl;
|
||||
cdistx = distx[c];
|
||||
cdisty = disty[c];
|
||||
newdistx = cdistx+1;
|
||||
newdisty = cdisty-1;
|
||||
newdist = DISTAA(c, cdistx, cdisty, newdistx, newdisty);
|
||||
if(newdist < olddist-epsilon)
|
||||
{
|
||||
distx[i]=newdistx;
|
||||
disty[i]=newdisty;
|
||||
dist[i]=newdist;
|
||||
changed = 1;
|
||||
}
|
||||
}
|
||||
/* Leftmost pixel is special, has no left neighbors */
|
||||
olddist = dist[i];
|
||||
if(olddist > 0) // If not already zero distance
|
||||
{
|
||||
c = i+offset_r;
|
||||
cdistx = distx[c];
|
||||
cdisty = disty[c];
|
||||
newdistx = cdistx-1;
|
||||
newdisty = cdisty;
|
||||
newdist = DISTAA(c, cdistx, cdisty, newdistx, newdisty);
|
||||
if(newdist < olddist-epsilon)
|
||||
{
|
||||
distx[i]=newdistx;
|
||||
disty[i]=newdisty;
|
||||
dist[i]=newdist;
|
||||
olddist=newdist;
|
||||
changed = 1;
|
||||
}
|
||||
|
||||
c = i+offset_rd;
|
||||
cdistx = distx[c];
|
||||
cdisty = disty[c];
|
||||
newdistx = cdistx-1;
|
||||
newdisty = cdisty-1;
|
||||
newdist = DISTAA(c, cdistx, cdisty, newdistx, newdisty);
|
||||
if(newdist < olddist-epsilon)
|
||||
{
|
||||
distx[i]=newdistx;
|
||||
disty[i]=newdisty;
|
||||
dist[i]=newdist;
|
||||
olddist=newdist;
|
||||
changed = 1;
|
||||
}
|
||||
|
||||
c = i+offset_d;
|
||||
cdistx = distx[c];
|
||||
cdisty = disty[c];
|
||||
newdistx = cdistx;
|
||||
newdisty = cdisty-1;
|
||||
newdist = DISTAA(c, cdistx, cdisty, newdistx, newdisty);
|
||||
if(newdist < olddist-epsilon)
|
||||
{
|
||||
distx[i]=newdistx;
|
||||
disty[i]=newdisty;
|
||||
dist[i]=newdist;
|
||||
changed = 1;
|
||||
}
|
||||
}
|
||||
|
||||
/* Move index to second leftmost pixel of current row. */
|
||||
/* Leftmost pixel is skipped, it has no left neighbor. */
|
||||
i = y*w + 1;
|
||||
for(x=1; x<w; x++, i++)
|
||||
{
|
||||
/* scan right, propagate distance from left */
|
||||
olddist = dist[i];
|
||||
if(olddist <= 0) continue; // Already zero distance
|
||||
|
||||
c = i+offset_l;
|
||||
cdistx = distx[c];
|
||||
cdisty = disty[c];
|
||||
newdistx = cdistx+1;
|
||||
newdisty = cdisty;
|
||||
newdist = DISTAA(c, cdistx, cdisty, newdistx, newdisty);
|
||||
if(newdist < olddist-epsilon)
|
||||
{
|
||||
distx[i]=newdistx;
|
||||
disty[i]=newdisty;
|
||||
dist[i]=newdist;
|
||||
changed = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
while(changed); // Sweep until no more updates are made
|
||||
|
||||
/* The transformation is completed. */
|
||||
|
||||
}
|
|
@ -1,7 +0,0 @@
|
|||
#ifndef EDTAA3_H_HEADER_GUARD
|
||||
#define EDTAA3_H_HEADER_GUARD
|
||||
|
||||
extern void computegradient(double *img, int w, int h, double *gx, double *gy);
|
||||
extern void edtaa3(double *img, double *gx, double *gy, int w, int h, short *distx, short *disty, double *dist);
|
||||
|
||||
#endif // EDTAA3_H_HEADER_GUARD
|
|
@ -1,161 +0,0 @@
|
|||
Apache License
|
||||
|
||||
Version 2.0, January 2004
|
||||
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction, and
|
||||
distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by the
|
||||
copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all other
|
||||
entities that control, are controlled by, or are under common control with
|
||||
that entity. For the purposes of this definition, "control" means (i) the
|
||||
power, direct or indirect, to cause the direction or management of such
|
||||
entity, whether by contract or otherwise, or (ii) ownership of fifty
|
||||
percent (50%) or more of the outstanding shares, or (iii) beneficial
|
||||
ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity exercising
|
||||
permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical transformation
|
||||
or translation of a Source form, including but not limited to compiled
|
||||
object code, generated documentation, and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or Object
|
||||
form, made available under the License, as indicated by a copyright
|
||||
notice that is included in or attached to the work (an example is
|
||||
provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including the original
|
||||
version of the Work and any modifications or additions to that Work or
|
||||
Derivative Works thereof, that is intentionally submitted to Licensor
|
||||
for inclusion in the Work by the copyright owner or by an individual or
|
||||
Legal Entity authorized to submit on behalf of the copyright owner. For
|
||||
the purposes of this definition, "submitted" means any form of electronic,
|
||||
verbal, or written communication sent to the Licensor or its
|
||||
representatives, including but not limited to communication on electronic
|
||||
mailing lists, source code control systems, and issue tracking systems that
|
||||
are managed by, or on behalf of, the Licensor for the purpose of discussing
|
||||
and improving the Work, but excluding communication that is conspicuously
|
||||
marked or otherwise designated in writing by the copyright owner as "Not
|
||||
a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity on
|
||||
behalf of whom a Contribution has been received by Licensor and subsequently
|
||||
incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of this
|
||||
License, each Contributor hereby grants to You a perpetual, worldwide,
|
||||
non-exclusive, no-charge, royalty-free, irrevocable copyright license to
|
||||
reproduce, prepare Derivative Works of, publicly display, publicly perform,
|
||||
sublicense, and distribute the Work and such Derivative Works in Source or
|
||||
Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of this
|
||||
License, each Contributor hereby grants to You a perpetual, worldwide,
|
||||
non-exclusive, no-charge, royalty-free, irrevocable (except as stated in
|
||||
this section) patent license to make, have made, use, offer to sell, sell,
|
||||
import, and otherwise transfer the Work, where such license applies only to
|
||||
those patent claims licensable by such Contributor that are necessarily
|
||||
infringed by their Contribution(s) alone or by combination of their
|
||||
Contribution(s) with the Work to which such Contribution(s) was submitted.
|
||||
If You institute patent litigation against any entity (including a cross-claim
|
||||
or counterclaim in a lawsuit) alleging that the Work or a Contribution
|
||||
incorporated within the Work constitutes direct or contributory patent
|
||||
infringement, then any patent licenses granted to You under this License
|
||||
for that Work shall terminate as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the Work or
|
||||
Derivative Works thereof in any medium, with or without modifications, and
|
||||
in Source or Object form, provided that You meet the following conditions:
|
||||
|
||||
You must give any other recipients of the Work or Derivative Works a copy of
|
||||
this License; and
|
||||
You must cause any modified files to carry prominent notices stating that
|
||||
You changed the files; and
|
||||
You must retain, in the Source form of any Derivative Works that You
|
||||
distribute, all copyright, patent, trademark, and attribution notices
|
||||
from the Source form of the Work, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works; and
|
||||
If the Work includes a "NOTICE" text file as part of its distribution,
|
||||
then any Derivative Works that You distribute must include a readable
|
||||
copy of the attribution notices contained within such NOTICE file, excluding
|
||||
those notices that do not pertain to any part of the Derivative Works, in
|
||||
at least one of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or documentation, if
|
||||
provided along with the Derivative Works; or, within a display generated by
|
||||
the Derivative Works, if and wherever such third-party notices normally
|
||||
appear. The contents of the NOTICE file are for informational purposes
|
||||
only and do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside or as
|
||||
an addendum to the NOTICE text from the Work, provided that such additional
|
||||
attribution notices cannot be construed as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and may provide
|
||||
additional or different license terms and conditions for use, reproduction, or
|
||||
distribution of Your modifications, or for any such Derivative Works as a
|
||||
whole, provided Your use, reproduction, and distribution of the Work otherwise
|
||||
complies with the conditions stated in this License.
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise, any
|
||||
Contribution intentionally submitted for inclusion in the Work by You to the
|
||||
Licensor shall be under the terms and conditions of this License, without any
|
||||
additional terms or conditions. Notwithstanding the above, nothing herein
|
||||
shall supersede or modify the terms of any separate license agreement you
|
||||
may have executed with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade names,
|
||||
trademarks, service marks, or product names of the Licensor, except as
|
||||
required for reasonable and customary use in describing the origin of the
|
||||
Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or agreed to
|
||||
in writing, Licensor provides the Work (and each Contributor provides its
|
||||
Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
|
||||
ANY KIND, either express or implied, including, without limitation, any
|
||||
warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining
|
||||
the appropriateness of using or redistributing the Work and assume any risks
|
||||
associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory, whether in
|
||||
tort (including negligence), contract, or otherwise, unless required by
|
||||
applicable law (such as deliberate and grossly negligent acts) or agreed to
|
||||
in writing, shall any Contributor be liable to You for damages, including
|
||||
any direct, indirect, special, incidental, or consequential damages of any
|
||||
character arising as a result of this License or out of the use or inability
|
||||
to use the Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all other
|
||||
commercial damages or losses), even if such Contributor has been advised
|
||||
of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing the
|
||||
Work or Derivative Works thereof, You may choose to offer, and charge a
|
||||
fee for, acceptance of support, warranty, indemnity, or other liability
|
||||
obligations and/or rights consistent with this License. However, in accepting
|
||||
such obligations, You may act only on Your own behalf and on Your sole
|
||||
responsibility, not on behalf of any other Contributor, and only if You
|
||||
agree to indemnify, defend, and hold each Contributor harmless for any
|
||||
liability incurred by, or claims asserted against, such Contributor by
|
||||
reason of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
|
@ -1,686 +0,0 @@
|
|||
// Copyright 2009 Google Inc.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// This is a fork of the AOSP project ETC1 codec. The original code can be found
|
||||
// at the following web site:
|
||||
// https://android.googlesource.com/platform/frameworks/native/+/master/opengl/include/ETC1/
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "etc1.h"
|
||||
|
||||
#include <cstring>
|
||||
|
||||
/* From http://www.khronos.org/registry/gles/extensions/OES/OES_compressed_ETC1_RGB8_texture.txt
|
||||
|
||||
The number of bits that represent a 4x4 texel block is 64 bits if
|
||||
<internalformat> is given by ETC1_RGB8_OES.
|
||||
|
||||
The data for a block is a number of bytes,
|
||||
|
||||
{q0, q1, q2, q3, q4, q5, q6, q7}
|
||||
|
||||
where byte q0 is located at the lowest memory address and q7 at
|
||||
the highest. The 64 bits specifying the block is then represented
|
||||
by the following 64 bit integer:
|
||||
|
||||
int64bit = 256*(256*(256*(256*(256*(256*(256*q0+q1)+q2)+q3)+q4)+q5)+q6)+q7;
|
||||
|
||||
ETC1_RGB8_OES:
|
||||
|
||||
a) bit layout in bits 63 through 32 if diffbit = 0
|
||||
|
||||
63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48
|
||||
-----------------------------------------------
|
||||
| base col1 | base col2 | base col1 | base col2 |
|
||||
| R1 (4bits)| R2 (4bits)| G1 (4bits)| G2 (4bits)|
|
||||
-----------------------------------------------
|
||||
|
||||
47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32
|
||||
---------------------------------------------------
|
||||
| base col1 | base col2 | table | table |diff|flip|
|
||||
| B1 (4bits)| B2 (4bits)| cw 1 | cw 2 |bit |bit |
|
||||
---------------------------------------------------
|
||||
|
||||
|
||||
b) bit layout in bits 63 through 32 if diffbit = 1
|
||||
|
||||
63 62 61 60 59 58 57 56 55 54 53 52 51 50 49 48
|
||||
-----------------------------------------------
|
||||
| base col1 | dcol 2 | base col1 | dcol 2 |
|
||||
| R1' (5 bits) | dR2 | G1' (5 bits) | dG2 |
|
||||
-----------------------------------------------
|
||||
|
||||
47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32
|
||||
---------------------------------------------------
|
||||
| base col 1 | dcol 2 | table | table |diff|flip|
|
||||
| B1' (5 bits) | dB2 | cw 1 | cw 2 |bit |bit |
|
||||
---------------------------------------------------
|
||||
|
||||
|
||||
c) bit layout in bits 31 through 0 (in both cases)
|
||||
|
||||
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16
|
||||
-----------------------------------------------
|
||||
| most significant pixel index bits |
|
||||
| p| o| n| m| l| k| j| i| h| g| f| e| d| c| b| a|
|
||||
-----------------------------------------------
|
||||
|
||||
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
|
||||
--------------------------------------------------
|
||||
| least significant pixel index bits |
|
||||
| p| o| n| m| l| k| j| i| h| g| f| e| d| c | b | a |
|
||||
--------------------------------------------------
|
||||
|
||||
|
||||
Add table 3.17.2: Intensity modifier sets for ETC1 compressed textures:
|
||||
|
||||
table codeword modifier table
|
||||
------------------ ----------------------
|
||||
0 -8 -2 2 8
|
||||
1 -17 -5 5 17
|
||||
2 -29 -9 9 29
|
||||
3 -42 -13 13 42
|
||||
4 -60 -18 18 60
|
||||
5 -80 -24 24 80
|
||||
6 -106 -33 33 106
|
||||
7 -183 -47 47 183
|
||||
|
||||
|
||||
Add table 3.17.3 Mapping from pixel index values to modifier values for
|
||||
ETC1 compressed textures:
|
||||
|
||||
pixel index value
|
||||
---------------
|
||||
msb lsb resulting modifier value
|
||||
----- ----- -------------------------
|
||||
1 1 -b (large negative value)
|
||||
1 0 -a (small negative value)
|
||||
0 0 a (small positive value)
|
||||
0 1 b (large positive value)
|
||||
|
||||
|
||||
*/
|
||||
|
||||
static const int kModifierTable[] = {
|
||||
/* 0 */2, 8, -2, -8,
|
||||
/* 1 */5, 17, -5, -17,
|
||||
/* 2 */9, 29, -9, -29,
|
||||
/* 3 */13, 42, -13, -42,
|
||||
/* 4 */18, 60, -18, -60,
|
||||
/* 5 */24, 80, -24, -80,
|
||||
/* 6 */33, 106, -33, -106,
|
||||
/* 7 */47, 183, -47, -183 };
|
||||
|
||||
static const int kLookup[8] = { 0, 1, 2, 3, -4, -3, -2, -1 };
|
||||
|
||||
static inline etc1_byte clamp(int x) {
|
||||
return (etc1_byte) (x >= 0 ? (x < 255 ? x : 255) : 0);
|
||||
}
|
||||
|
||||
static
|
||||
inline int convert4To8(int b) {
|
||||
int c = b & 0xf;
|
||||
return (c << 4) | c;
|
||||
}
|
||||
|
||||
static
|
||||
inline int convert5To8(int b) {
|
||||
int c = b & 0x1f;
|
||||
return (c << 3) | (c >> 2);
|
||||
}
|
||||
|
||||
static
|
||||
inline int convert6To8(int b) {
|
||||
int c = b & 0x3f;
|
||||
return (c << 2) | (c >> 4);
|
||||
}
|
||||
|
||||
static
|
||||
inline int divideBy255(int d) {
|
||||
return (d + 128 + (d >> 8)) >> 8;
|
||||
}
|
||||
|
||||
static
|
||||
inline int convert8To4(int b) {
|
||||
int c = b & 0xff;
|
||||
return divideBy255(c * 15);
|
||||
}
|
||||
|
||||
static
|
||||
inline int convert8To5(int b) {
|
||||
int c = b & 0xff;
|
||||
return divideBy255(c * 31);
|
||||
}
|
||||
|
||||
static
|
||||
inline int convertDiff(int base, int diff) {
|
||||
return convert5To8((0x1f & base) + kLookup[0x7 & diff]);
|
||||
}
|
||||
|
||||
static
|
||||
void decode_subblock(etc1_byte* pOut, int r, int g, int b, const int* table,
|
||||
etc1_uint32 low, bool second, bool flipped) {
|
||||
int baseX = 0;
|
||||
int baseY = 0;
|
||||
if (second) {
|
||||
if (flipped) {
|
||||
baseY = 2;
|
||||
} else {
|
||||
baseX = 2;
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < 8; i++) {
|
||||
int x, y;
|
||||
if (flipped) {
|
||||
x = baseX + (i >> 1);
|
||||
y = baseY + (i & 1);
|
||||
} else {
|
||||
x = baseX + (i >> 2);
|
||||
y = baseY + (i & 3);
|
||||
}
|
||||
int k = y + (x * 4);
|
||||
int offset = ((low >> k) & 1) | ((low >> (k + 15)) & 2);
|
||||
int delta = table[offset];
|
||||
etc1_byte* q = pOut + 3 * (x + 4 * y);
|
||||
*q++ = clamp(r + delta);
|
||||
*q++ = clamp(g + delta);
|
||||
*q++ = clamp(b + delta);
|
||||
}
|
||||
}
|
||||
|
||||
// Input is an ETC1 compressed version of the data.
|
||||
// Output is a 4 x 4 square of 3-byte pixels in form R, G, B
|
||||
|
||||
void etc1_decode_block(const etc1_byte* pIn, etc1_byte* pOut) {
|
||||
etc1_uint32 high = (pIn[0] << 24) | (pIn[1] << 16) | (pIn[2] << 8) | pIn[3];
|
||||
etc1_uint32 low = (pIn[4] << 24) | (pIn[5] << 16) | (pIn[6] << 8) | pIn[7];
|
||||
int r1, r2, g1, g2, b1, b2;
|
||||
if (high & 2) {
|
||||
// differential
|
||||
int rBase = high >> 27;
|
||||
int gBase = high >> 19;
|
||||
int bBase = high >> 11;
|
||||
r1 = convert5To8(rBase);
|
||||
r2 = convertDiff(rBase, high >> 24);
|
||||
g1 = convert5To8(gBase);
|
||||
g2 = convertDiff(gBase, high >> 16);
|
||||
b1 = convert5To8(bBase);
|
||||
b2 = convertDiff(bBase, high >> 8);
|
||||
} else {
|
||||
// not differential
|
||||
r1 = convert4To8(high >> 28);
|
||||
r2 = convert4To8(high >> 24);
|
||||
g1 = convert4To8(high >> 20);
|
||||
g2 = convert4To8(high >> 16);
|
||||
b1 = convert4To8(high >> 12);
|
||||
b2 = convert4To8(high >> 8);
|
||||
}
|
||||
int tableIndexA = 7 & (high >> 5);
|
||||
int tableIndexB = 7 & (high >> 2);
|
||||
const int* tableA = kModifierTable + tableIndexA * 4;
|
||||
const int* tableB = kModifierTable + tableIndexB * 4;
|
||||
bool flipped = (high & 1) != 0;
|
||||
decode_subblock(pOut, r1, g1, b1, tableA, low, false, flipped);
|
||||
decode_subblock(pOut, r2, g2, b2, tableB, low, true, flipped);
|
||||
}
|
||||
|
||||
typedef struct {
|
||||
etc1_uint32 high;
|
||||
etc1_uint32 low;
|
||||
etc1_uint32 score; // Lower is more accurate
|
||||
} etc_compressed;
|
||||
|
||||
static
|
||||
inline void take_best(etc_compressed* a, const etc_compressed* b) {
|
||||
if (a->score > b->score) {
|
||||
*a = *b;
|
||||
}
|
||||
}
|
||||
|
||||
static
|
||||
void etc_average_colors_subblock(const etc1_byte* pIn, etc1_uint32 inMask,
|
||||
etc1_byte* pColors, bool flipped, bool second) {
|
||||
int r = 0;
|
||||
int g = 0;
|
||||
int b = 0;
|
||||
|
||||
if (flipped) {
|
||||
int by = 0;
|
||||
if (second) {
|
||||
by = 2;
|
||||
}
|
||||
for (int y = 0; y < 2; y++) {
|
||||
int yy = by + y;
|
||||
for (int x = 0; x < 4; x++) {
|
||||
int i = x + 4 * yy;
|
||||
if (inMask & (1 << i)) {
|
||||
const etc1_byte* p = pIn + i * 3;
|
||||
r += *(p++);
|
||||
g += *(p++);
|
||||
b += *(p++);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
int bx = 0;
|
||||
if (second) {
|
||||
bx = 2;
|
||||
}
|
||||
for (int y = 0; y < 4; y++) {
|
||||
for (int x = 0; x < 2; x++) {
|
||||
int xx = bx + x;
|
||||
int i = xx + 4 * y;
|
||||
if (inMask & (1 << i)) {
|
||||
const etc1_byte* p = pIn + i * 3;
|
||||
r += *(p++);
|
||||
g += *(p++);
|
||||
b += *(p++);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
pColors[0] = (etc1_byte)((r + 4) >> 3);
|
||||
pColors[1] = (etc1_byte)((g + 4) >> 3);
|
||||
pColors[2] = (etc1_byte)((b + 4) >> 3);
|
||||
}
|
||||
|
||||
static
|
||||
inline int square(int x) {
|
||||
return x * x;
|
||||
}
|
||||
|
||||
static etc1_uint32 chooseModifier(const etc1_byte* pBaseColors,
|
||||
const etc1_byte* pIn, etc1_uint32 *pLow, int bitIndex,
|
||||
const int* pModifierTable) {
|
||||
etc1_uint32 bestScore = ~0;
|
||||
int bestIndex = 0;
|
||||
int pixelR = pIn[0];
|
||||
int pixelG = pIn[1];
|
||||
int pixelB = pIn[2];
|
||||
int r = pBaseColors[0];
|
||||
int g = pBaseColors[1];
|
||||
int b = pBaseColors[2];
|
||||
for (int i = 0; i < 4; i++) {
|
||||
int modifier = pModifierTable[i];
|
||||
int decodedG = clamp(g + modifier);
|
||||
etc1_uint32 score = (etc1_uint32) (6 * square(decodedG - pixelG));
|
||||
if (score >= bestScore) {
|
||||
continue;
|
||||
}
|
||||
int decodedR = clamp(r + modifier);
|
||||
score += (etc1_uint32) (3 * square(decodedR - pixelR));
|
||||
if (score >= bestScore) {
|
||||
continue;
|
||||
}
|
||||
int decodedB = clamp(b + modifier);
|
||||
score += (etc1_uint32) square(decodedB - pixelB);
|
||||
if (score < bestScore) {
|
||||
bestScore = score;
|
||||
bestIndex = i;
|
||||
}
|
||||
}
|
||||
etc1_uint32 lowMask = (((bestIndex >> 1) << 16) | (bestIndex & 1))
|
||||
<< bitIndex;
|
||||
*pLow |= lowMask;
|
||||
return bestScore;
|
||||
}
|
||||
|
||||
static
|
||||
void etc_encode_subblock_helper(const etc1_byte* pIn, etc1_uint32 inMask,
|
||||
etc_compressed* pCompressed, bool flipped, bool second,
|
||||
const etc1_byte* pBaseColors, const int* pModifierTable) {
|
||||
int score = pCompressed->score;
|
||||
if (flipped) {
|
||||
int by = 0;
|
||||
if (second) {
|
||||
by = 2;
|
||||
}
|
||||
for (int y = 0; y < 2; y++) {
|
||||
int yy = by + y;
|
||||
for (int x = 0; x < 4; x++) {
|
||||
int i = x + 4 * yy;
|
||||
if (inMask & (1 << i)) {
|
||||
score += chooseModifier(pBaseColors, pIn + i * 3,
|
||||
&pCompressed->low, yy + x * 4, pModifierTable);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
int bx = 0;
|
||||
if (second) {
|
||||
bx = 2;
|
||||
}
|
||||
for (int y = 0; y < 4; y++) {
|
||||
for (int x = 0; x < 2; x++) {
|
||||
int xx = bx + x;
|
||||
int i = xx + 4 * y;
|
||||
if (inMask & (1 << i)) {
|
||||
score += chooseModifier(pBaseColors, pIn + i * 3,
|
||||
&pCompressed->low, y + xx * 4, pModifierTable);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
pCompressed->score = score;
|
||||
}
|
||||
|
||||
static bool inRange4bitSigned(int color) {
|
||||
return color >= -4 && color <= 3;
|
||||
}
|
||||
|
||||
static void etc_encodeBaseColors(etc1_byte* pBaseColors,
|
||||
const etc1_byte* pColors, etc_compressed* pCompressed) {
|
||||
int r1, g1, b1, r2, g2, b2; // 8 bit base colors for sub-blocks
|
||||
bool differential;
|
||||
{
|
||||
int r51 = convert8To5(pColors[0]);
|
||||
int g51 = convert8To5(pColors[1]);
|
||||
int b51 = convert8To5(pColors[2]);
|
||||
int r52 = convert8To5(pColors[3]);
|
||||
int g52 = convert8To5(pColors[4]);
|
||||
int b52 = convert8To5(pColors[5]);
|
||||
|
||||
r1 = convert5To8(r51);
|
||||
g1 = convert5To8(g51);
|
||||
b1 = convert5To8(b51);
|
||||
|
||||
int dr = r52 - r51;
|
||||
int dg = g52 - g51;
|
||||
int db = b52 - b51;
|
||||
|
||||
differential = inRange4bitSigned(dr) && inRange4bitSigned(dg)
|
||||
&& inRange4bitSigned(db);
|
||||
if (differential) {
|
||||
r2 = convert5To8(r51 + dr);
|
||||
g2 = convert5To8(g51 + dg);
|
||||
b2 = convert5To8(b51 + db);
|
||||
pCompressed->high |= (r51 << 27) | ((7 & dr) << 24) | (g51 << 19)
|
||||
| ((7 & dg) << 16) | (b51 << 11) | ((7 & db) << 8) | 2;
|
||||
}
|
||||
}
|
||||
|
||||
if (!differential) {
|
||||
int r41 = convert8To4(pColors[0]);
|
||||
int g41 = convert8To4(pColors[1]);
|
||||
int b41 = convert8To4(pColors[2]);
|
||||
int r42 = convert8To4(pColors[3]);
|
||||
int g42 = convert8To4(pColors[4]);
|
||||
int b42 = convert8To4(pColors[5]);
|
||||
r1 = convert4To8(r41);
|
||||
g1 = convert4To8(g41);
|
||||
b1 = convert4To8(b41);
|
||||
r2 = convert4To8(r42);
|
||||
g2 = convert4To8(g42);
|
||||
b2 = convert4To8(b42);
|
||||
pCompressed->high |= (r41 << 28) | (r42 << 24) | (g41 << 20) | (g42
|
||||
<< 16) | (b41 << 12) | (b42 << 8);
|
||||
}
|
||||
pBaseColors[0] = r1;
|
||||
pBaseColors[1] = g1;
|
||||
pBaseColors[2] = b1;
|
||||
pBaseColors[3] = r2;
|
||||
pBaseColors[4] = g2;
|
||||
pBaseColors[5] = b2;
|
||||
}
|
||||
|
||||
static
|
||||
void etc_encode_block_helper(const etc1_byte* pIn, etc1_uint32 inMask,
|
||||
const etc1_byte* pColors, etc_compressed* pCompressed, bool flipped) {
|
||||
pCompressed->score = ~0;
|
||||
pCompressed->high = (flipped ? 1 : 0);
|
||||
pCompressed->low = 0;
|
||||
|
||||
etc1_byte pBaseColors[6];
|
||||
|
||||
etc_encodeBaseColors(pBaseColors, pColors, pCompressed);
|
||||
|
||||
int originalHigh = pCompressed->high;
|
||||
|
||||
const int* pModifierTable = kModifierTable;
|
||||
for (int i = 0; i < 8; i++, pModifierTable += 4) {
|
||||
etc_compressed temp;
|
||||
temp.score = 0;
|
||||
temp.high = originalHigh | (i << 5);
|
||||
temp.low = 0;
|
||||
etc_encode_subblock_helper(pIn, inMask, &temp, flipped, false,
|
||||
pBaseColors, pModifierTable);
|
||||
take_best(pCompressed, &temp);
|
||||
}
|
||||
pModifierTable = kModifierTable;
|
||||
etc_compressed firstHalf = *pCompressed;
|
||||
for (int i = 0; i < 8; i++, pModifierTable += 4) {
|
||||
etc_compressed temp;
|
||||
temp.score = firstHalf.score;
|
||||
temp.high = firstHalf.high | (i << 2);
|
||||
temp.low = firstHalf.low;
|
||||
etc_encode_subblock_helper(pIn, inMask, &temp, flipped, true,
|
||||
pBaseColors + 3, pModifierTable);
|
||||
if (i == 0) {
|
||||
*pCompressed = temp;
|
||||
} else {
|
||||
take_best(pCompressed, &temp);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void writeBigEndian(etc1_byte* pOut, etc1_uint32 d) {
|
||||
pOut[0] = (etc1_byte)(d >> 24);
|
||||
pOut[1] = (etc1_byte)(d >> 16);
|
||||
pOut[2] = (etc1_byte)(d >> 8);
|
||||
pOut[3] = (etc1_byte) d;
|
||||
}
|
||||
|
||||
// Input is a 4 x 4 square of 3-byte pixels in form R, G, B
|
||||
// inmask is a 16-bit mask where bit (1 << (x + y * 4)) tells whether the corresponding (x,y)
|
||||
// pixel is valid or not. Invalid pixel color values are ignored when compressing.
|
||||
// Output is an ETC1 compressed version of the data.
|
||||
|
||||
void etc1_encode_block(const etc1_byte* pIn, etc1_uint32 inMask,
|
||||
etc1_byte* pOut) {
|
||||
etc1_byte colors[6];
|
||||
etc1_byte flippedColors[6];
|
||||
etc_average_colors_subblock(pIn, inMask, colors, false, false);
|
||||
etc_average_colors_subblock(pIn, inMask, colors + 3, false, true);
|
||||
etc_average_colors_subblock(pIn, inMask, flippedColors, true, false);
|
||||
etc_average_colors_subblock(pIn, inMask, flippedColors + 3, true, true);
|
||||
|
||||
etc_compressed a, b;
|
||||
etc_encode_block_helper(pIn, inMask, colors, &a, false);
|
||||
etc_encode_block_helper(pIn, inMask, flippedColors, &b, true);
|
||||
take_best(&a, &b);
|
||||
writeBigEndian(pOut, a.high);
|
||||
writeBigEndian(pOut + 4, a.low);
|
||||
}
|
||||
|
||||
// Return the size of the encoded image data (does not include size of PKM header).
|
||||
|
||||
etc1_uint32 etc1_get_encoded_data_size(etc1_uint32 width, etc1_uint32 height) {
|
||||
return (((width + 3) & ~3) * ((height + 3) & ~3)) >> 1;
|
||||
}
|
||||
|
||||
// Encode an entire image.
|
||||
// pIn - pointer to the image data. Formatted such that the Red component of
|
||||
// pixel (x,y) is at pIn + pixelSize * x + stride * y + redOffset;
|
||||
// pOut - pointer to encoded data. Must be large enough to store entire encoded image.
|
||||
|
||||
int etc1_encode_image(const etc1_byte* pIn, etc1_uint32 width, etc1_uint32 height,
|
||||
etc1_uint32 pixelSize, etc1_uint32 stride, etc1_byte* pOut) {
|
||||
if (pixelSize < 2 || pixelSize > 4) {
|
||||
return -1;
|
||||
}
|
||||
static const unsigned short kYMask[] = { 0x0, 0xf, 0xff, 0xfff, 0xffff };
|
||||
static const unsigned short kXMask[] = { 0x0, 0x1111, 0x3333, 0x7777,
|
||||
0xffff };
|
||||
etc1_byte block[ETC1_DECODED_BLOCK_SIZE];
|
||||
etc1_byte encoded[ETC1_ENCODED_BLOCK_SIZE];
|
||||
|
||||
etc1_uint32 encodedWidth = (width + 3) & ~3;
|
||||
etc1_uint32 encodedHeight = (height + 3) & ~3;
|
||||
|
||||
for (etc1_uint32 y = 0; y < encodedHeight; y += 4) {
|
||||
etc1_uint32 yEnd = height - y;
|
||||
if (yEnd > 4) {
|
||||
yEnd = 4;
|
||||
}
|
||||
int ymask = kYMask[yEnd];
|
||||
for (etc1_uint32 x = 0; x < encodedWidth; x += 4) {
|
||||
etc1_uint32 xEnd = width - x;
|
||||
if (xEnd > 4) {
|
||||
xEnd = 4;
|
||||
}
|
||||
int mask = ymask & kXMask[xEnd];
|
||||
for (etc1_uint32 cy = 0; cy < yEnd; cy++) {
|
||||
etc1_byte* q = block + (cy * 4) * 3;
|
||||
const etc1_byte* p = pIn + pixelSize * x + stride * (y + cy);
|
||||
if (pixelSize >= 3) {
|
||||
for (etc1_uint32 cx = 0; cx < xEnd; cx++) {
|
||||
memcpy(q, p, 3);
|
||||
q += 3;
|
||||
p += pixelSize;
|
||||
}
|
||||
} else {
|
||||
for (etc1_uint32 cx = 0; cx < xEnd; cx++) {
|
||||
int pixel = (p[1] << 8) | p[0];
|
||||
*q++ = convert5To8(pixel >> 11);
|
||||
*q++ = convert6To8(pixel >> 5);
|
||||
*q++ = convert5To8(pixel);
|
||||
p += pixelSize;
|
||||
}
|
||||
}
|
||||
}
|
||||
etc1_encode_block(block, mask, encoded);
|
||||
memcpy(pOut, encoded, sizeof(encoded));
|
||||
pOut += sizeof(encoded);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Decode an entire image.
|
||||
// pIn - pointer to encoded data.
|
||||
// pOut - pointer to the image data. Will be written such that the Red component of
|
||||
// pixel (x,y) is at pIn + pixelSize * x + stride * y + redOffset. Must be
|
||||
// large enough to store entire image.
|
||||
|
||||
|
||||
int etc1_decode_image(const etc1_byte* pIn, etc1_byte* pOut,
|
||||
etc1_uint32 width, etc1_uint32 height,
|
||||
etc1_uint32 pixelSize, etc1_uint32 stride) {
|
||||
if (pixelSize < 2 || pixelSize > 4) {
|
||||
return -1;
|
||||
}
|
||||
etc1_byte block[ETC1_DECODED_BLOCK_SIZE];
|
||||
|
||||
etc1_uint32 encodedWidth = (width + 3) & ~3;
|
||||
etc1_uint32 encodedHeight = (height + 3) & ~3;
|
||||
|
||||
for (etc1_uint32 y = 0; y < encodedHeight; y += 4) {
|
||||
etc1_uint32 yEnd = height - y;
|
||||
if (yEnd > 4) {
|
||||
yEnd = 4;
|
||||
}
|
||||
for (etc1_uint32 x = 0; x < encodedWidth; x += 4) {
|
||||
etc1_uint32 xEnd = width - x;
|
||||
if (xEnd > 4) {
|
||||
xEnd = 4;
|
||||
}
|
||||
etc1_decode_block(pIn, block);
|
||||
pIn += ETC1_ENCODED_BLOCK_SIZE;
|
||||
for (etc1_uint32 cy = 0; cy < yEnd; cy++) {
|
||||
const etc1_byte* q = block + (cy * 4) * 3;
|
||||
etc1_byte* p = pOut + pixelSize * x + stride * (y + cy);
|
||||
if (pixelSize >= 3) {
|
||||
for (etc1_uint32 cx = 0; cx < xEnd; cx++) {
|
||||
memcpy(p, q, 3);
|
||||
q += 3;
|
||||
p += pixelSize;
|
||||
}
|
||||
} else {
|
||||
for (etc1_uint32 cx = 0; cx < xEnd; cx++) {
|
||||
etc1_byte r = *q++;
|
||||
etc1_byte g = *q++;
|
||||
etc1_byte b = *q++;
|
||||
etc1_uint32 pixel = ((r >> 3) << 11) | ((g >> 2) << 5) | (b >> 3);
|
||||
*p++ = (etc1_byte) pixel;
|
||||
*p++ = (etc1_byte) (pixel >> 8);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const char kMagic[] = { 'P', 'K', 'M', ' ', '1', '0' };
|
||||
|
||||
static const etc1_uint32 ETC1_PKM_FORMAT_OFFSET = 6;
|
||||
static const etc1_uint32 ETC1_PKM_ENCODED_WIDTH_OFFSET = 8;
|
||||
static const etc1_uint32 ETC1_PKM_ENCODED_HEIGHT_OFFSET = 10;
|
||||
static const etc1_uint32 ETC1_PKM_WIDTH_OFFSET = 12;
|
||||
static const etc1_uint32 ETC1_PKM_HEIGHT_OFFSET = 14;
|
||||
|
||||
static const etc1_uint32 ETC1_RGB_NO_MIPMAPS = 0;
|
||||
|
||||
static void writeBEUint16(etc1_byte* pOut, etc1_uint32 data) {
|
||||
pOut[0] = (etc1_byte) (data >> 8);
|
||||
pOut[1] = (etc1_byte) data;
|
||||
}
|
||||
|
||||
static etc1_uint32 readBEUint16(const etc1_byte* pIn) {
|
||||
return (pIn[0] << 8) | pIn[1];
|
||||
}
|
||||
|
||||
// Format a PKM header
|
||||
|
||||
void etc1_pkm_format_header(etc1_byte* pHeader, etc1_uint32 width, etc1_uint32 height) {
|
||||
memcpy(pHeader, kMagic, sizeof(kMagic));
|
||||
etc1_uint32 encodedWidth = (width + 3) & ~3;
|
||||
etc1_uint32 encodedHeight = (height + 3) & ~3;
|
||||
writeBEUint16(pHeader + ETC1_PKM_FORMAT_OFFSET, ETC1_RGB_NO_MIPMAPS);
|
||||
writeBEUint16(pHeader + ETC1_PKM_ENCODED_WIDTH_OFFSET, encodedWidth);
|
||||
writeBEUint16(pHeader + ETC1_PKM_ENCODED_HEIGHT_OFFSET, encodedHeight);
|
||||
writeBEUint16(pHeader + ETC1_PKM_WIDTH_OFFSET, width);
|
||||
writeBEUint16(pHeader + ETC1_PKM_HEIGHT_OFFSET, height);
|
||||
}
|
||||
|
||||
// Check if a PKM header is correctly formatted.
|
||||
|
||||
etc1_bool etc1_pkm_is_valid(const etc1_byte* pHeader) {
|
||||
if (memcmp(pHeader, kMagic, sizeof(kMagic))) {
|
||||
return false;
|
||||
}
|
||||
etc1_uint32 format = readBEUint16(pHeader + ETC1_PKM_FORMAT_OFFSET);
|
||||
etc1_uint32 encodedWidth = readBEUint16(pHeader + ETC1_PKM_ENCODED_WIDTH_OFFSET);
|
||||
etc1_uint32 encodedHeight = readBEUint16(pHeader + ETC1_PKM_ENCODED_HEIGHT_OFFSET);
|
||||
etc1_uint32 width = readBEUint16(pHeader + ETC1_PKM_WIDTH_OFFSET);
|
||||
etc1_uint32 height = readBEUint16(pHeader + ETC1_PKM_HEIGHT_OFFSET);
|
||||
return format == ETC1_RGB_NO_MIPMAPS &&
|
||||
encodedWidth >= width && encodedWidth - width < 4 &&
|
||||
encodedHeight >= height && encodedHeight - height < 4;
|
||||
}
|
||||
|
||||
// Read the image width from a PKM header
|
||||
|
||||
etc1_uint32 etc1_pkm_get_width(const etc1_byte* pHeader) {
|
||||
return readBEUint16(pHeader + ETC1_PKM_WIDTH_OFFSET);
|
||||
}
|
||||
|
||||
// Read the image height from a PKM header
|
||||
|
||||
etc1_uint32 etc1_pkm_get_height(const etc1_byte* pHeader){
|
||||
return readBEUint16(pHeader + ETC1_PKM_HEIGHT_OFFSET);
|
||||
}
|
|
@ -1,114 +0,0 @@
|
|||
// Copyright 2009 Google Inc.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// This is a fork of the AOSP project ETC1 codec. The original code can be found
|
||||
// at the following web site:
|
||||
// https://android.googlesource.com/platform/frameworks/native/+/master/opengl/libs/ETC1/
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef __etc1_h__
|
||||
#define __etc1_h__
|
||||
|
||||
#define ETC1_ENCODED_BLOCK_SIZE 8
|
||||
#define ETC1_DECODED_BLOCK_SIZE 48
|
||||
|
||||
#ifndef ETC1_RGB8_OES
|
||||
#define ETC1_RGB8_OES 0x8D64
|
||||
#endif
|
||||
|
||||
typedef unsigned char etc1_byte;
|
||||
typedef int etc1_bool;
|
||||
typedef unsigned int etc1_uint32;
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
// Encode a block of pixels.
|
||||
//
|
||||
// pIn is a pointer to a ETC_DECODED_BLOCK_SIZE array of bytes that represent a
|
||||
// 4 x 4 square of 3-byte pixels in form R, G, B. Byte (3 * (x + 4 * y) is the R
|
||||
// value of pixel (x, y).
|
||||
//
|
||||
// validPixelMask is a 16-bit mask where bit (1 << (x + y * 4)) indicates whether
|
||||
// the corresponding (x,y) pixel is valid. Invalid pixel color values are ignored when compressing.
|
||||
//
|
||||
// pOut is an ETC1 compressed version of the data.
|
||||
|
||||
void etc1_encode_block(const etc1_byte* pIn, etc1_uint32 validPixelMask, etc1_byte* pOut);
|
||||
|
||||
// Decode a block of pixels.
|
||||
//
|
||||
// pIn is an ETC1 compressed version of the data.
|
||||
//
|
||||
// pOut is a pointer to a ETC_DECODED_BLOCK_SIZE array of bytes that represent a
|
||||
// 4 x 4 square of 3-byte pixels in form R, G, B. Byte (3 * (x + 4 * y) is the R
|
||||
// value of pixel (x, y).
|
||||
|
||||
void etc1_decode_block(const etc1_byte* pIn, etc1_byte* pOut);
|
||||
|
||||
// Return the size of the encoded image data (does not include size of PKM header).
|
||||
|
||||
etc1_uint32 etc1_get_encoded_data_size(etc1_uint32 width, etc1_uint32 height);
|
||||
|
||||
// Encode an entire image.
|
||||
// pIn - pointer to the image data. Formatted such that
|
||||
// pixel (x,y) is at pIn + pixelSize * x + stride * y;
|
||||
// pOut - pointer to encoded data. Must be large enough to store entire encoded image.
|
||||
// pixelSize can be 2 or 3. 2 is an GL_UNSIGNED_SHORT_5_6_5 image, 3 is a GL_BYTE RGB image.
|
||||
// returns non-zero if there is an error.
|
||||
|
||||
int etc1_encode_image(const etc1_byte* pIn, etc1_uint32 width, etc1_uint32 height,
|
||||
etc1_uint32 pixelSize, etc1_uint32 stride, etc1_byte* pOut);
|
||||
|
||||
// Decode an entire image.
|
||||
// pIn - pointer to encoded data.
|
||||
// pOut - pointer to the image data. Will be written such that
|
||||
// pixel (x,y) is at pIn + pixelSize * x + stride * y. Must be
|
||||
// large enough to store entire image.
|
||||
// pixelSize can be 2 or 3. 2 is an GL_UNSIGNED_SHORT_5_6_5 image, 3 is a GL_BYTE RGB image.
|
||||
// returns non-zero if there is an error.
|
||||
|
||||
int etc1_decode_image(const etc1_byte* pIn, etc1_byte* pOut,
|
||||
etc1_uint32 width, etc1_uint32 height,
|
||||
etc1_uint32 pixelSize, etc1_uint32 stride);
|
||||
|
||||
// Size of a PKM header, in bytes.
|
||||
|
||||
#define ETC_PKM_HEADER_SIZE 16
|
||||
|
||||
// Format a PKM header
|
||||
|
||||
void etc1_pkm_format_header(etc1_byte* pHeader, etc1_uint32 width, etc1_uint32 height);
|
||||
|
||||
// Check if a PKM header is correctly formatted.
|
||||
|
||||
etc1_bool etc1_pkm_is_valid(const etc1_byte* pHeader);
|
||||
|
||||
// Read the image width from a PKM header
|
||||
|
||||
etc1_uint32 etc1_pkm_get_width(const etc1_byte* pHeader);
|
||||
|
||||
// Read the image height from a PKM header
|
||||
|
||||
etc1_uint32 etc1_pkm_get_height(const etc1_byte* pHeader);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
|
@ -1,24 +0,0 @@
|
|||
Copyright (c) 2013, Bartosz Taudul <wolf.pld@gmail.com>
|
||||
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 <organization> nor the
|
||||
names of its 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 <COPYRIGHT HOLDER> 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,90 +0,0 @@
|
|||
#ifndef __DARKRL__MATH_HPP__
|
||||
#define __DARKRL__MATH_HPP__
|
||||
|
||||
#include <algorithm>
|
||||
#include <math.h>
|
||||
|
||||
#include "Types.hpp"
|
||||
|
||||
template<typename T>
|
||||
inline T AlignPOT( T val )
|
||||
{
|
||||
if( val == 0 ) return 1;
|
||||
val--;
|
||||
for( unsigned int i=1; i<sizeof( T ) * 8; i <<= 1 )
|
||||
{
|
||||
val |= val >> i;
|
||||
}
|
||||
return val + 1;
|
||||
}
|
||||
|
||||
inline int CountSetBits( uint32 val )
|
||||
{
|
||||
val -= ( val >> 1 ) & 0x55555555;
|
||||
val = ( ( val >> 2 ) & 0x33333333 ) + ( val & 0x33333333 );
|
||||
val = ( ( val >> 4 ) + val ) & 0x0f0f0f0f;
|
||||
val += val >> 8;
|
||||
val += val >> 16;
|
||||
return val & 0x0000003f;
|
||||
}
|
||||
|
||||
inline int CountLeadingZeros( uint32 val )
|
||||
{
|
||||
val |= val >> 1;
|
||||
val |= val >> 2;
|
||||
val |= val >> 4;
|
||||
val |= val >> 8;
|
||||
val |= val >> 16;
|
||||
return 32 - CountSetBits( val );
|
||||
}
|
||||
|
||||
inline float sRGB2linear( float v )
|
||||
{
|
||||
const float a = 0.055f;
|
||||
if( v <= 0.04045f )
|
||||
{
|
||||
return v / 12.92f;
|
||||
}
|
||||
else
|
||||
{
|
||||
return powf( ( v + a ) / ( 1 + a ), 2.4f );
|
||||
}
|
||||
}
|
||||
|
||||
inline float linear2sRGB( float v )
|
||||
{
|
||||
const float a = 0.055f;
|
||||
if( v <= 0.0031308f )
|
||||
{
|
||||
return 12.92f * v;
|
||||
}
|
||||
else
|
||||
{
|
||||
return ( 1 + a ) * pow( v, 1/2.4f ) - a;
|
||||
}
|
||||
}
|
||||
|
||||
template<class T>
|
||||
inline T SmoothStep( T x )
|
||||
{
|
||||
return x*x*(3-2*x);
|
||||
}
|
||||
|
||||
inline uint8 clampu8( int32 val )
|
||||
{
|
||||
return std::min( std::max( 0, val ), 255 );
|
||||
}
|
||||
|
||||
template<class T>
|
||||
inline T sq( T val )
|
||||
{
|
||||
return val * val;
|
||||
}
|
||||
|
||||
static inline int mul8bit( int a, int b )
|
||||
{
|
||||
int t = a*b + 128;
|
||||
return ( t + ( t >> 8 ) ) >> 8;
|
||||
}
|
||||
|
||||
#endif
|
|
@ -1,51 +0,0 @@
|
|||
#ifndef __PROCESSCOMMON_HPP__
|
||||
#define __PROCESSCOMMON_HPP__
|
||||
|
||||
#include <assert.h>
|
||||
#include <stddef.h>
|
||||
|
||||
#include "Types.hpp"
|
||||
|
||||
template<class T>
|
||||
static size_t GetLeastError( const T* err, size_t num )
|
||||
{
|
||||
size_t idx = 0;
|
||||
for( size_t i=1; i<num; i++ )
|
||||
{
|
||||
if( err[i] < err[idx] )
|
||||
{
|
||||
idx = i;
|
||||
}
|
||||
}
|
||||
return idx;
|
||||
}
|
||||
|
||||
static uint64 FixByteOrder( uint64 d )
|
||||
{
|
||||
return ( ( d & 0x00000000FFFFFFFF ) ) |
|
||||
( ( d & 0xFF00000000000000 ) >> 24 ) |
|
||||
( ( d & 0x000000FF00000000 ) << 24 ) |
|
||||
( ( d & 0x00FF000000000000 ) >> 8 ) |
|
||||
( ( d & 0x0000FF0000000000 ) << 8 );
|
||||
}
|
||||
|
||||
template<class T, class S>
|
||||
static uint64 EncodeSelectors( uint64 d, const T terr[2][8], const S tsel[16][8], const uint32* id )
|
||||
{
|
||||
size_t tidx[2];
|
||||
tidx[0] = GetLeastError( terr[0], 8 );
|
||||
tidx[1] = GetLeastError( terr[1], 8 );
|
||||
|
||||
d |= tidx[0] << 26;
|
||||
d |= tidx[1] << 29;
|
||||
for( int i=0; i<16; i++ )
|
||||
{
|
||||
uint64 t = tsel[i][tidx[id[i]%2]];
|
||||
d |= ( t & 0x1 ) << ( i + 32 );
|
||||
d |= ( t & 0x2 ) << ( i + 47 );
|
||||
}
|
||||
|
||||
return d;
|
||||
}
|
||||
|
||||
#endif
|
|
@ -1,719 +0,0 @@
|
|||
#include <string.h>
|
||||
|
||||
#include "Math.hpp"
|
||||
#include "ProcessCommon.hpp"
|
||||
#include "ProcessRGB.hpp"
|
||||
#include "Tables.hpp"
|
||||
#include "Types.hpp"
|
||||
#include "Vector.hpp"
|
||||
|
||||
#include <bx/endian.h>
|
||||
|
||||
#ifdef __SSE4_1__
|
||||
# ifdef _MSC_VER
|
||||
# include <intrin.h>
|
||||
# include <Windows.h>
|
||||
# else
|
||||
# include <x86intrin.h>
|
||||
# endif
|
||||
#endif
|
||||
|
||||
namespace
|
||||
{
|
||||
|
||||
typedef uint16 v4i[4];
|
||||
|
||||
void Average( const uint8* data, v4i* a )
|
||||
{
|
||||
#ifdef __SSE4_1__
|
||||
__m128i d0 = _mm_loadu_si128(((__m128i*)data) + 0);
|
||||
__m128i d1 = _mm_loadu_si128(((__m128i*)data) + 1);
|
||||
__m128i d2 = _mm_loadu_si128(((__m128i*)data) + 2);
|
||||
__m128i d3 = _mm_loadu_si128(((__m128i*)data) + 3);
|
||||
|
||||
__m128i d0l = _mm_unpacklo_epi8(d0, _mm_setzero_si128());
|
||||
__m128i d0h = _mm_unpackhi_epi8(d0, _mm_setzero_si128());
|
||||
__m128i d1l = _mm_unpacklo_epi8(d1, _mm_setzero_si128());
|
||||
__m128i d1h = _mm_unpackhi_epi8(d1, _mm_setzero_si128());
|
||||
__m128i d2l = _mm_unpacklo_epi8(d2, _mm_setzero_si128());
|
||||
__m128i d2h = _mm_unpackhi_epi8(d2, _mm_setzero_si128());
|
||||
__m128i d3l = _mm_unpacklo_epi8(d3, _mm_setzero_si128());
|
||||
__m128i d3h = _mm_unpackhi_epi8(d3, _mm_setzero_si128());
|
||||
|
||||
__m128i sum0 = _mm_add_epi16(d0l, d1l);
|
||||
__m128i sum1 = _mm_add_epi16(d0h, d1h);
|
||||
__m128i sum2 = _mm_add_epi16(d2l, d3l);
|
||||
__m128i sum3 = _mm_add_epi16(d2h, d3h);
|
||||
|
||||
__m128i sum0l = _mm_unpacklo_epi16(sum0, _mm_setzero_si128());
|
||||
__m128i sum0h = _mm_unpackhi_epi16(sum0, _mm_setzero_si128());
|
||||
__m128i sum1l = _mm_unpacklo_epi16(sum1, _mm_setzero_si128());
|
||||
__m128i sum1h = _mm_unpackhi_epi16(sum1, _mm_setzero_si128());
|
||||
__m128i sum2l = _mm_unpacklo_epi16(sum2, _mm_setzero_si128());
|
||||
__m128i sum2h = _mm_unpackhi_epi16(sum2, _mm_setzero_si128());
|
||||
__m128i sum3l = _mm_unpacklo_epi16(sum3, _mm_setzero_si128());
|
||||
__m128i sum3h = _mm_unpackhi_epi16(sum3, _mm_setzero_si128());
|
||||
|
||||
__m128i b0 = _mm_add_epi32(sum0l, sum0h);
|
||||
__m128i b1 = _mm_add_epi32(sum1l, sum1h);
|
||||
__m128i b2 = _mm_add_epi32(sum2l, sum2h);
|
||||
__m128i b3 = _mm_add_epi32(sum3l, sum3h);
|
||||
|
||||
__m128i a0 = _mm_srli_epi32(_mm_add_epi32(_mm_add_epi32(b2, b3), _mm_set1_epi32(4)), 3);
|
||||
__m128i a1 = _mm_srli_epi32(_mm_add_epi32(_mm_add_epi32(b0, b1), _mm_set1_epi32(4)), 3);
|
||||
__m128i a2 = _mm_srli_epi32(_mm_add_epi32(_mm_add_epi32(b1, b3), _mm_set1_epi32(4)), 3);
|
||||
__m128i a3 = _mm_srli_epi32(_mm_add_epi32(_mm_add_epi32(b0, b2), _mm_set1_epi32(4)), 3);
|
||||
|
||||
_mm_storeu_si128((__m128i*)&a[0], _mm_packus_epi32(_mm_shuffle_epi32(a0, _MM_SHUFFLE(3, 0, 1, 2)), _mm_shuffle_epi32(a1, _MM_SHUFFLE(3, 0, 1, 2))));
|
||||
_mm_storeu_si128((__m128i*)&a[2], _mm_packus_epi32(_mm_shuffle_epi32(a2, _MM_SHUFFLE(3, 0, 1, 2)), _mm_shuffle_epi32(a3, _MM_SHUFFLE(3, 0, 1, 2))));
|
||||
#else
|
||||
uint32 r[4];
|
||||
uint32 g[4];
|
||||
uint32 b[4];
|
||||
|
||||
memset(r, 0, sizeof(r));
|
||||
memset(g, 0, sizeof(g));
|
||||
memset(b, 0, sizeof(b));
|
||||
|
||||
for( int j=0; j<4; j++ )
|
||||
{
|
||||
for( int i=0; i<4; i++ )
|
||||
{
|
||||
int index = (j & 2) + (i >> 1);
|
||||
b[index] += *data++;
|
||||
g[index] += *data++;
|
||||
r[index] += *data++;
|
||||
data++;
|
||||
}
|
||||
}
|
||||
|
||||
a[0][0] = uint16( (r[2] + r[3] + 4) / 8 );
|
||||
a[0][1] = uint16( (g[2] + g[3] + 4) / 8 );
|
||||
a[0][2] = uint16( (b[2] + b[3] + 4) / 8 );
|
||||
a[0][3] = 0;
|
||||
a[1][0] = uint16( (r[0] + r[1] + 4) / 8 );
|
||||
a[1][1] = uint16( (g[0] + g[1] + 4) / 8 );
|
||||
a[1][2] = uint16( (b[0] + b[1] + 4) / 8 );
|
||||
a[1][3] = 0;
|
||||
a[2][0] = uint16( (r[1] + r[3] + 4) / 8 );
|
||||
a[2][1] = uint16( (g[1] + g[3] + 4) / 8 );
|
||||
a[2][2] = uint16( (b[1] + b[3] + 4) / 8 );
|
||||
a[2][3] = 0;
|
||||
a[3][0] = uint16( (r[0] + r[2] + 4) / 8 );
|
||||
a[3][1] = uint16( (g[0] + g[2] + 4) / 8 );
|
||||
a[3][2] = uint16( (b[0] + b[2] + 4) / 8 );
|
||||
a[3][3] = 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
void CalcErrorBlock( const uint8* data, uint err[4][4] )
|
||||
{
|
||||
#ifdef __SSE4_1__
|
||||
__m128i d0 = _mm_loadu_si128(((__m128i*)data) + 0);
|
||||
__m128i d1 = _mm_loadu_si128(((__m128i*)data) + 1);
|
||||
__m128i d2 = _mm_loadu_si128(((__m128i*)data) + 2);
|
||||
__m128i d3 = _mm_loadu_si128(((__m128i*)data) + 3);
|
||||
|
||||
__m128i dm0 = _mm_and_si128(d0, _mm_set1_epi32(0x00FFFFFF));
|
||||
__m128i dm1 = _mm_and_si128(d1, _mm_set1_epi32(0x00FFFFFF));
|
||||
__m128i dm2 = _mm_and_si128(d2, _mm_set1_epi32(0x00FFFFFF));
|
||||
__m128i dm3 = _mm_and_si128(d3, _mm_set1_epi32(0x00FFFFFF));
|
||||
|
||||
__m128i d0l = _mm_unpacklo_epi8(dm0, _mm_setzero_si128());
|
||||
__m128i d0h = _mm_unpackhi_epi8(dm0, _mm_setzero_si128());
|
||||
__m128i d1l = _mm_unpacklo_epi8(dm1, _mm_setzero_si128());
|
||||
__m128i d1h = _mm_unpackhi_epi8(dm1, _mm_setzero_si128());
|
||||
__m128i d2l = _mm_unpacklo_epi8(dm2, _mm_setzero_si128());
|
||||
__m128i d2h = _mm_unpackhi_epi8(dm2, _mm_setzero_si128());
|
||||
__m128i d3l = _mm_unpacklo_epi8(dm3, _mm_setzero_si128());
|
||||
__m128i d3h = _mm_unpackhi_epi8(dm3, _mm_setzero_si128());
|
||||
|
||||
__m128i sum0 = _mm_add_epi16(d0l, d1l);
|
||||
__m128i sum1 = _mm_add_epi16(d0h, d1h);
|
||||
__m128i sum2 = _mm_add_epi16(d2l, d3l);
|
||||
__m128i sum3 = _mm_add_epi16(d2h, d3h);
|
||||
|
||||
__m128i sum0l = _mm_unpacklo_epi16(sum0, _mm_setzero_si128());
|
||||
__m128i sum0h = _mm_unpackhi_epi16(sum0, _mm_setzero_si128());
|
||||
__m128i sum1l = _mm_unpacklo_epi16(sum1, _mm_setzero_si128());
|
||||
__m128i sum1h = _mm_unpackhi_epi16(sum1, _mm_setzero_si128());
|
||||
__m128i sum2l = _mm_unpacklo_epi16(sum2, _mm_setzero_si128());
|
||||
__m128i sum2h = _mm_unpackhi_epi16(sum2, _mm_setzero_si128());
|
||||
__m128i sum3l = _mm_unpacklo_epi16(sum3, _mm_setzero_si128());
|
||||
__m128i sum3h = _mm_unpackhi_epi16(sum3, _mm_setzero_si128());
|
||||
|
||||
__m128i b0 = _mm_add_epi32(sum0l, sum0h);
|
||||
__m128i b1 = _mm_add_epi32(sum1l, sum1h);
|
||||
__m128i b2 = _mm_add_epi32(sum2l, sum2h);
|
||||
__m128i b3 = _mm_add_epi32(sum3l, sum3h);
|
||||
|
||||
__m128i a0 = _mm_add_epi32(b2, b3);
|
||||
__m128i a1 = _mm_add_epi32(b0, b1);
|
||||
__m128i a2 = _mm_add_epi32(b1, b3);
|
||||
__m128i a3 = _mm_add_epi32(b0, b2);
|
||||
|
||||
_mm_storeu_si128((__m128i*)&err[0], a0);
|
||||
_mm_storeu_si128((__m128i*)&err[1], a1);
|
||||
_mm_storeu_si128((__m128i*)&err[2], a2);
|
||||
_mm_storeu_si128((__m128i*)&err[3], a3);
|
||||
#else
|
||||
uint terr[4][4];
|
||||
|
||||
memset(terr, 0, 16 * sizeof(uint));
|
||||
|
||||
for( int j=0; j<4; j++ )
|
||||
{
|
||||
for( int i=0; i<4; i++ )
|
||||
{
|
||||
int index = (j & 2) + (i >> 1);
|
||||
uint d = *data++;
|
||||
terr[index][0] += d;
|
||||
d = *data++;
|
||||
terr[index][1] += d;
|
||||
d = *data++;
|
||||
terr[index][2] += d;
|
||||
data++;
|
||||
}
|
||||
}
|
||||
|
||||
for( int i=0; i<3; i++ )
|
||||
{
|
||||
err[0][i] = terr[2][i] + terr[3][i];
|
||||
err[1][i] = terr[0][i] + terr[1][i];
|
||||
err[2][i] = terr[1][i] + terr[3][i];
|
||||
err[3][i] = terr[0][i] + terr[2][i];
|
||||
}
|
||||
for( int i=0; i<4; i++ )
|
||||
{
|
||||
err[i][3] = 0;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
uint CalcError( const uint block[4], const v4i& average )
|
||||
{
|
||||
uint err = 0x3FFFFFFF; // Big value to prevent negative values, but small enough to prevent overflow
|
||||
err -= block[0] * 2 * average[2];
|
||||
err -= block[1] * 2 * average[1];
|
||||
err -= block[2] * 2 * average[0];
|
||||
err += 8 * ( sq( average[0] ) + sq( average[1] ) + sq( average[2] ) );
|
||||
return err;
|
||||
}
|
||||
|
||||
void ProcessAverages( v4i* a )
|
||||
{
|
||||
#ifdef __SSE4_1__
|
||||
for( int i=0; i<2; i++ )
|
||||
{
|
||||
__m128i d = _mm_loadu_si128((__m128i*)a[i*2]);
|
||||
|
||||
__m128i t = _mm_add_epi16(_mm_mullo_epi16(d, _mm_set1_epi16(31)), _mm_set1_epi16(128));
|
||||
|
||||
__m128i c = _mm_srli_epi16(_mm_add_epi16(t, _mm_srli_epi16(t, 8)), 8);
|
||||
|
||||
__m128i c1 = _mm_shuffle_epi32(c, _MM_SHUFFLE(3, 2, 3, 2));
|
||||
__m128i diff = _mm_sub_epi16(c, c1);
|
||||
diff = _mm_max_epi16(diff, _mm_set1_epi16(-4));
|
||||
diff = _mm_min_epi16(diff, _mm_set1_epi16(3));
|
||||
|
||||
__m128i co = _mm_add_epi16(c1, diff);
|
||||
|
||||
c = _mm_blend_epi16(co, c, 0xF0);
|
||||
|
||||
__m128i a0 = _mm_or_si128(_mm_slli_epi16(c, 3), _mm_srli_epi16(c, 2));
|
||||
|
||||
_mm_storeu_si128((__m128i*)a[4+i*2], a0);
|
||||
}
|
||||
|
||||
for( int i=0; i<2; i++ )
|
||||
{
|
||||
__m128i d = _mm_loadu_si128((__m128i*)a[i*2]);
|
||||
|
||||
__m128i t0 = _mm_add_epi16(_mm_mullo_epi16(d, _mm_set1_epi16(15)), _mm_set1_epi16(128));
|
||||
__m128i t1 = _mm_srli_epi16(_mm_add_epi16(t0, _mm_srli_epi16(t0, 8)), 8);
|
||||
|
||||
__m128i t2 = _mm_or_si128(t1, _mm_slli_epi16(t1, 4));
|
||||
|
||||
_mm_storeu_si128((__m128i*)a[i*2], t2);
|
||||
}
|
||||
#else
|
||||
for( int i=0; i<2; i++ )
|
||||
{
|
||||
for( int j=0; j<3; j++ )
|
||||
{
|
||||
int32 c1 = mul8bit( a[i*2+1][j], 31 );
|
||||
int32 c2 = mul8bit( a[i*2][j], 31 );
|
||||
|
||||
int32 diff = c2 - c1;
|
||||
if( diff > 3 ) diff = 3;
|
||||
else if( diff < -4 ) diff = -4;
|
||||
|
||||
int32 co = c1 + diff;
|
||||
|
||||
a[5+i*2][j] = ( c1 << 3 ) | ( c1 >> 2 );
|
||||
a[4+i*2][j] = ( co << 3 ) | ( co >> 2 );
|
||||
}
|
||||
}
|
||||
|
||||
for( int i=0; i<4; i++ )
|
||||
{
|
||||
a[i][0] = g_avg2[mul8bit( a[i][0], 15 )];
|
||||
a[i][1] = g_avg2[mul8bit( a[i][1], 15 )];
|
||||
a[i][2] = g_avg2[mul8bit( a[i][2], 15 )];
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void EncodeAverages( uint64& _d, const v4i* a, size_t idx )
|
||||
{
|
||||
uint64 d = _d;
|
||||
d |= ( idx << 24 );
|
||||
size_t base = idx << 1;
|
||||
|
||||
if( ( idx & 0x2 ) == 0 )
|
||||
{
|
||||
for( int i=0; i<3; i++ )
|
||||
{
|
||||
d |= uint64( a[base+0][i] >> 4 ) << ( i*8 );
|
||||
d |= uint64( a[base+1][i] >> 4 ) << ( i*8 + 4 );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for( int i=0; i<3; i++ )
|
||||
{
|
||||
d |= uint64( a[base+1][i] & 0xF8 ) << ( i*8 );
|
||||
int32 c = ( ( a[base+0][i] & 0xF8 ) - ( a[base+1][i] & 0xF8 ) ) >> 3;
|
||||
c &= ~0xFFFFFFF8;
|
||||
d |= ((uint64)c) << ( i*8 );
|
||||
}
|
||||
}
|
||||
_d = d;
|
||||
}
|
||||
|
||||
uint64 CheckSolid( const uint8* src )
|
||||
{
|
||||
#ifdef __SSE4_1__
|
||||
__m128i d0 = _mm_loadu_si128(((__m128i*)src) + 0);
|
||||
__m128i d1 = _mm_loadu_si128(((__m128i*)src) + 1);
|
||||
__m128i d2 = _mm_loadu_si128(((__m128i*)src) + 2);
|
||||
__m128i d3 = _mm_loadu_si128(((__m128i*)src) + 3);
|
||||
|
||||
__m128i c = _mm_shuffle_epi32(d0, _MM_SHUFFLE(0, 0, 0, 0));
|
||||
|
||||
__m128i c0 = _mm_cmpeq_epi8(d0, c);
|
||||
__m128i c1 = _mm_cmpeq_epi8(d1, c);
|
||||
__m128i c2 = _mm_cmpeq_epi8(d2, c);
|
||||
__m128i c3 = _mm_cmpeq_epi8(d3, c);
|
||||
|
||||
__m128i m0 = _mm_and_si128(c0, c1);
|
||||
__m128i m1 = _mm_and_si128(c2, c3);
|
||||
__m128i m = _mm_and_si128(m0, m1);
|
||||
|
||||
if (!_mm_testc_si128(m, _mm_set1_epi32(-1)))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
#else
|
||||
const uint8* ptr = src + 4;
|
||||
for( int i=1; i<16; i++ )
|
||||
{
|
||||
if( memcmp( src, ptr, 4 ) != 0 )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
ptr += 4;
|
||||
}
|
||||
#endif
|
||||
return 0x02000000 |
|
||||
( uint( src[0] & 0xF8 ) << 16 ) |
|
||||
( uint( src[1] & 0xF8 ) << 8 ) |
|
||||
( uint( src[2] & 0xF8 ) );
|
||||
}
|
||||
|
||||
void PrepareAverages( v4i a[8], const uint8* src, uint err[4] )
|
||||
{
|
||||
Average( src, a );
|
||||
ProcessAverages( a );
|
||||
|
||||
uint errblock[4][4];
|
||||
CalcErrorBlock( src, errblock );
|
||||
|
||||
for( int i=0; i<4; i++ )
|
||||
{
|
||||
err[i/2] += CalcError( errblock[i], a[i] );
|
||||
err[2+i/2] += CalcError( errblock[i], a[i+4] );
|
||||
}
|
||||
}
|
||||
|
||||
void FindBestFit( uint64 terr[2][8], uint16 tsel[16][8], v4i a[8], const uint32* id, const uint8* data )
|
||||
{
|
||||
for( size_t i=0; i<16; i++ )
|
||||
{
|
||||
uint16* sel = tsel[i];
|
||||
uint bid = id[i];
|
||||
uint64* ter = terr[bid%2];
|
||||
|
||||
uint8 b = *data++;
|
||||
uint8 g = *data++;
|
||||
uint8 r = *data++;
|
||||
data++;
|
||||
|
||||
int dr = a[bid][0] - r;
|
||||
int dg = a[bid][1] - g;
|
||||
int db = a[bid][2] - b;
|
||||
|
||||
#ifdef __SSE4_1__
|
||||
// Reference implementation
|
||||
|
||||
__m128i pix = _mm_set1_epi32(dr * 77 + dg * 151 + db * 28);
|
||||
// Taking the absolute value is way faster. The values are only used to sort, so the result will be the same.
|
||||
__m128i error0 = _mm_abs_epi32(_mm_add_epi32(pix, g_table256_SIMD[0]));
|
||||
__m128i error1 = _mm_abs_epi32(_mm_add_epi32(pix, g_table256_SIMD[1]));
|
||||
__m128i error2 = _mm_abs_epi32(_mm_sub_epi32(pix, g_table256_SIMD[0]));
|
||||
__m128i error3 = _mm_abs_epi32(_mm_sub_epi32(pix, g_table256_SIMD[1]));
|
||||
|
||||
__m128i index0 = _mm_and_si128(_mm_cmplt_epi32(error1, error0), _mm_set1_epi32(1));
|
||||
__m128i minError0 = _mm_min_epi32(error0, error1);
|
||||
|
||||
__m128i index1 = _mm_sub_epi32(_mm_set1_epi32(2), _mm_cmplt_epi32(error3, error2));
|
||||
__m128i minError1 = _mm_min_epi32(error2, error3);
|
||||
|
||||
__m128i minIndex0 = _mm_blendv_epi8(index0, index1, _mm_cmplt_epi32(minError1, minError0));
|
||||
__m128i minError = _mm_min_epi32(minError0, minError1);
|
||||
|
||||
// Squaring the minimum error to produce correct values when adding
|
||||
__m128i minErrorLow = _mm_shuffle_epi32(minError, _MM_SHUFFLE(1, 1, 0, 0));
|
||||
__m128i squareErrorLow = _mm_mul_epi32(minErrorLow, minErrorLow);
|
||||
squareErrorLow = _mm_add_epi64(squareErrorLow, _mm_loadu_si128(((__m128i*)ter) + 0));
|
||||
_mm_storeu_si128(((__m128i*)ter) + 0, squareErrorLow);
|
||||
__m128i minErrorHigh = _mm_shuffle_epi32(minError, _MM_SHUFFLE(3, 3, 2, 2));
|
||||
__m128i squareErrorHigh = _mm_mul_epi32(minErrorHigh, minErrorHigh);
|
||||
squareErrorHigh = _mm_add_epi64(squareErrorHigh, _mm_loadu_si128(((__m128i*)ter) + 1));
|
||||
_mm_storeu_si128(((__m128i*)ter) + 1, squareErrorHigh);
|
||||
|
||||
// Taking the absolute value is way faster. The values are only used to sort, so the result will be the same.
|
||||
error0 = _mm_abs_epi32(_mm_add_epi32(pix, g_table256_SIMD[2]));
|
||||
error1 = _mm_abs_epi32(_mm_add_epi32(pix, g_table256_SIMD[3]));
|
||||
error2 = _mm_abs_epi32(_mm_sub_epi32(pix, g_table256_SIMD[2]));
|
||||
error3 = _mm_abs_epi32(_mm_sub_epi32(pix, g_table256_SIMD[3]));
|
||||
|
||||
index0 = _mm_and_si128(_mm_cmplt_epi32(error1, error0), _mm_set1_epi32(1));
|
||||
minError0 = _mm_min_epi32(error0, error1);
|
||||
|
||||
index1 = _mm_sub_epi32(_mm_set1_epi32(2), _mm_cmplt_epi32(error3, error2));
|
||||
minError1 = _mm_min_epi32(error2, error3);
|
||||
|
||||
__m128i minIndex1 = _mm_blendv_epi8(index0, index1, _mm_cmplt_epi32(minError1, minError0));
|
||||
minError = _mm_min_epi32(minError0, minError1);
|
||||
|
||||
// Squaring the minimum error to produce correct values when adding
|
||||
minErrorLow = _mm_shuffle_epi32(minError, _MM_SHUFFLE(1, 1, 0, 0));
|
||||
squareErrorLow = _mm_mul_epi32(minErrorLow, minErrorLow);
|
||||
squareErrorLow = _mm_add_epi64(squareErrorLow, _mm_loadu_si128(((__m128i*)ter) + 2));
|
||||
_mm_storeu_si128(((__m128i*)ter) + 2, squareErrorLow);
|
||||
minErrorHigh = _mm_shuffle_epi32(minError, _MM_SHUFFLE(3, 3, 2, 2));
|
||||
squareErrorHigh = _mm_mul_epi32(minErrorHigh, minErrorHigh);
|
||||
squareErrorHigh = _mm_add_epi64(squareErrorHigh, _mm_loadu_si128(((__m128i*)ter) + 3));
|
||||
_mm_storeu_si128(((__m128i*)ter) + 3, squareErrorHigh);
|
||||
__m128i minIndex = _mm_packs_epi32(minIndex0, minIndex1);
|
||||
_mm_storeu_si128((__m128i*)sel, minIndex);
|
||||
#else
|
||||
int pix = dr * 77 + dg * 151 + db * 28;
|
||||
|
||||
for( int t=0; t<8; t++ )
|
||||
{
|
||||
const int64* tab = g_table256[t];
|
||||
uint idx = 0;
|
||||
uint64 err = sq( tab[0] + pix );
|
||||
for( int j=1; j<4; j++ )
|
||||
{
|
||||
uint64 local = sq( tab[j] + pix );
|
||||
if( local < err )
|
||||
{
|
||||
err = local;
|
||||
idx = j;
|
||||
}
|
||||
}
|
||||
*sel++ = idx;
|
||||
*ter++ += err;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef __SSE4_1__
|
||||
// Non-reference implementation, but faster. Produces same results as the AVX2 version
|
||||
void FindBestFit( uint32 terr[2][8], uint16 tsel[16][8], v4i a[8], const uint32* id, const uint8* data )
|
||||
{
|
||||
for( size_t i=0; i<16; i++ )
|
||||
{
|
||||
uint16* sel = tsel[i];
|
||||
uint bid = id[i];
|
||||
uint32* ter = terr[bid%2];
|
||||
|
||||
uint8 b = *data++;
|
||||
uint8 g = *data++;
|
||||
uint8 r = *data++;
|
||||
data++;
|
||||
|
||||
int dr = a[bid][0] - r;
|
||||
int dg = a[bid][1] - g;
|
||||
int db = a[bid][2] - b;
|
||||
|
||||
// The scaling values are divided by two and rounded, to allow the differences to be in the range of signed int16
|
||||
// This produces slightly different results, but is significant faster
|
||||
__m128i pixel = _mm_set1_epi16(dr * 38 + dg * 76 + db * 14);
|
||||
__m128i pix = _mm_abs_epi16(pixel);
|
||||
|
||||
// Taking the absolute value is way faster. The values are only used to sort, so the result will be the same.
|
||||
// Since the selector table is symmetrical, we need to calculate the difference only for half of the entries.
|
||||
__m128i error0 = _mm_abs_epi16(_mm_sub_epi16(pix, g_table128_SIMD[0]));
|
||||
__m128i error1 = _mm_abs_epi16(_mm_sub_epi16(pix, g_table128_SIMD[1]));
|
||||
|
||||
__m128i index = _mm_and_si128(_mm_cmplt_epi16(error1, error0), _mm_set1_epi16(1));
|
||||
__m128i minError = _mm_min_epi16(error0, error1);
|
||||
|
||||
// Exploiting symmetry of the selector table and use the sign bit
|
||||
// This produces slightly different results, but is needed to produce same results as AVX2 implementation
|
||||
__m128i indexBit = _mm_andnot_si128(_mm_srli_epi16(pixel, 15), _mm_set1_epi8(-1));
|
||||
__m128i minIndex = _mm_or_si128(index, _mm_add_epi16(indexBit, indexBit));
|
||||
|
||||
// Squaring the minimum error to produce correct values when adding
|
||||
__m128i squareErrorLo = _mm_mullo_epi16(minError, minError);
|
||||
__m128i squareErrorHi = _mm_mulhi_epi16(minError, minError);
|
||||
|
||||
__m128i squareErrorLow = _mm_unpacklo_epi16(squareErrorLo, squareErrorHi);
|
||||
__m128i squareErrorHigh = _mm_unpackhi_epi16(squareErrorLo, squareErrorHi);
|
||||
|
||||
squareErrorLow = _mm_add_epi32(squareErrorLow, _mm_loadu_si128(((__m128i*)ter) + 0));
|
||||
_mm_storeu_si128(((__m128i*)ter) + 0, squareErrorLow);
|
||||
squareErrorHigh = _mm_add_epi32(squareErrorHigh, _mm_loadu_si128(((__m128i*)ter) + 1));
|
||||
_mm_storeu_si128(((__m128i*)ter) + 1, squareErrorHigh);
|
||||
|
||||
_mm_storeu_si128((__m128i*)sel, minIndex);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
uint8_t convert6(float f)
|
||||
{
|
||||
int i = (std::min(std::max(static_cast<int>(f), 0), 1023) - 15) >> 1;
|
||||
return (i + 11 - ((i + 11) >> 7) - ((i + 4) >> 7)) >> 3;
|
||||
}
|
||||
|
||||
uint8_t convert7(float f)
|
||||
{
|
||||
int i = (std::min(std::max(static_cast<int>(f), 0), 1023) - 15) >> 1;
|
||||
return (i + 9 - ((i + 9) >> 8) - ((i + 6) >> 8)) >> 2;
|
||||
}
|
||||
|
||||
std::pair<uint64, uint64> Planar(const uint8* src)
|
||||
{
|
||||
int32 r = 0;
|
||||
int32 g = 0;
|
||||
int32 b = 0;
|
||||
|
||||
for (int i = 0; i < 16; ++i)
|
||||
{
|
||||
b += src[i * 4 + 0];
|
||||
g += src[i * 4 + 1];
|
||||
r += src[i * 4 + 2];
|
||||
}
|
||||
|
||||
int32 difRyz = 0;
|
||||
int32 difGyz = 0;
|
||||
int32 difByz = 0;
|
||||
int32 difRxz = 0;
|
||||
int32 difGxz = 0;
|
||||
int32 difBxz = 0;
|
||||
|
||||
const int32 scaling[] = { -255, -85, 85, 255 };
|
||||
|
||||
for (int i = 0; i < 16; ++i)
|
||||
{
|
||||
int32 difB = (static_cast<int>(src[i * 4 + 0]) << 4) - b;
|
||||
int32 difG = (static_cast<int>(src[i * 4 + 1]) << 4) - g;
|
||||
int32 difR = (static_cast<int>(src[i * 4 + 2]) << 4) - r;
|
||||
|
||||
difRyz += difR * scaling[i % 4];
|
||||
difGyz += difG * scaling[i % 4];
|
||||
difByz += difB * scaling[i % 4];
|
||||
|
||||
difRxz += difR * scaling[i / 4];
|
||||
difGxz += difG * scaling[i / 4];
|
||||
difBxz += difB * scaling[i / 4];
|
||||
}
|
||||
|
||||
const float scale = -4.0f / ((255 * 255 * 8.0f + 85 * 85 * 8.0f) * 16.0f);
|
||||
|
||||
float aR = difRxz * scale;
|
||||
float aG = difGxz * scale;
|
||||
float aB = difBxz * scale;
|
||||
|
||||
float bR = difRyz * scale;
|
||||
float bG = difGyz * scale;
|
||||
float bB = difByz * scale;
|
||||
|
||||
float dR = r * (4.0f / 16.0f);
|
||||
float dG = g * (4.0f / 16.0f);
|
||||
float dB = b * (4.0f / 16.0f);
|
||||
|
||||
// calculating the three colors RGBO, RGBH, and RGBV. RGB = df - af * x - bf * y;
|
||||
float cofR = (aR * 255.0f + (bR * 255.0f + dR));
|
||||
float cofG = (aG * 255.0f + (bG * 255.0f + dG));
|
||||
float cofB = (aB * 255.0f + (bB * 255.0f + dB));
|
||||
float chfR = (aR * -425.0f + (bR * 255.0f + dR));
|
||||
float chfG = (aG * -425.0f + (bG * 255.0f + dG));
|
||||
float chfB = (aB * -425.0f + (bB * 255.0f + dB));
|
||||
float cvfR = (aR * 255.0f + (bR * -425.0f + dR));
|
||||
float cvfG = (aG * 255.0f + (bG * -425.0f + dG));
|
||||
float cvfB = (aB * 255.0f + (bB * -425.0f + dB));
|
||||
|
||||
// convert to r6g7b6
|
||||
int32 coR = convert6(cofR);
|
||||
int32 coG = convert7(cofG);
|
||||
int32 coB = convert6(cofB);
|
||||
int32 chR = convert6(chfR);
|
||||
int32 chG = convert7(chfG);
|
||||
int32 chB = convert6(chfB);
|
||||
int32 cvR = convert6(cvfR);
|
||||
int32 cvG = convert7(cvfG);
|
||||
int32 cvB = convert6(cvfB);
|
||||
|
||||
// Error calculation
|
||||
int32 ro0 = coR;
|
||||
int32 go0 = coG;
|
||||
int32 bo0 = coB;
|
||||
int32 ro1 = (ro0 >> 4) | (ro0 << 2);
|
||||
int32 go1 = (go0 >> 6) | (go0 << 1);
|
||||
int32 bo1 = (bo0 >> 4) | (bo0 << 2);
|
||||
int32 ro2 = (ro1 << 2) + 2;
|
||||
int32 go2 = (go1 << 2) + 2;
|
||||
int32 bo2 = (bo1 << 2) + 2;
|
||||
|
||||
int32 rh0 = chR;
|
||||
int32 gh0 = chG;
|
||||
int32 bh0 = chB;
|
||||
int32 rh1 = (rh0 >> 4) | (rh0 << 2);
|
||||
int32 gh1 = (gh0 >> 6) | (gh0 << 1);
|
||||
int32 bh1 = (bh0 >> 4) | (bh0 << 2);
|
||||
|
||||
int32 rh2 = rh1 - ro1;
|
||||
int32 gh2 = gh1 - go1;
|
||||
int32 bh2 = bh1 - bo1;
|
||||
|
||||
int32 rv0 = cvR;
|
||||
int32 gv0 = cvG;
|
||||
int32 bv0 = cvB;
|
||||
int32 rv1 = (rv0 >> 4) | (rv0 << 2);
|
||||
int32 gv1 = (gv0 >> 6) | (gv0 << 1);
|
||||
int32 bv1 = (bv0 >> 4) | (bv0 << 2);
|
||||
|
||||
int32 rv2 = rv1 - ro1;
|
||||
int32 gv2 = gv1 - go1;
|
||||
int32 bv2 = bv1 - bo1;
|
||||
|
||||
uint64 error = 0;
|
||||
|
||||
for (int i = 0; i < 16; ++i)
|
||||
{
|
||||
int32 cR = clampu8((rh2 * (i / 4) + rv2 * (i % 4) + ro2) >> 2);
|
||||
int32 cG = clampu8((gh2 * (i / 4) + gv2 * (i % 4) + go2) >> 2);
|
||||
int32 cB = clampu8((bh2 * (i / 4) + bv2 * (i % 4) + bo2) >> 2);
|
||||
|
||||
int32 difB = static_cast<int>(src[i * 4 + 0]) - cB;
|
||||
int32 difG = static_cast<int>(src[i * 4 + 1]) - cG;
|
||||
int32 difR = static_cast<int>(src[i * 4 + 2]) - cR;
|
||||
|
||||
int32 dif = difR * 38 + difG * 76 + difB * 14;
|
||||
|
||||
error += dif * dif;
|
||||
}
|
||||
|
||||
/**/
|
||||
uint32 rgbv = cvB | (cvG << 6) | (cvR << 13);
|
||||
uint32 rgbh = chB | (chG << 6) | (chR << 13);
|
||||
uint32 hi = rgbv | ((rgbh & 0x1FFF) << 19);
|
||||
uint32 lo = (chR & 0x1) | 0x2 | ((chR << 1) & 0x7C);
|
||||
lo |= ((coB & 0x07) << 7) | ((coB & 0x18) << 8) | ((coB & 0x20) << 11);
|
||||
lo |= ((coG & 0x3F) << 17) | ((coG & 0x40) << 18);
|
||||
lo |= coR << 25;
|
||||
|
||||
const int32 idx = (coR & 0x20) | ((coG & 0x20) >> 1) | ((coB & 0x1E) >> 1);
|
||||
|
||||
lo |= g_flags[idx];
|
||||
|
||||
uint64 result = static_cast<uint32>(bx::endianSwap(lo));
|
||||
result |= static_cast<uint64>(static_cast<uint32>(bx::endianSwap(hi))) << 32;
|
||||
|
||||
return std::make_pair(result, error);
|
||||
}
|
||||
|
||||
template<class T, class S>
|
||||
uint64 EncodeSelectors( uint64 d, const T terr[2][8], const S tsel[16][8], const uint32* id, const uint64 value, const uint64 error)
|
||||
{
|
||||
size_t tidx[2];
|
||||
tidx[0] = GetLeastError( terr[0], 8 );
|
||||
tidx[1] = GetLeastError( terr[1], 8 );
|
||||
|
||||
if ((terr[0][tidx[0]] + terr[1][tidx[1]]) >= error)
|
||||
{
|
||||
return value;
|
||||
}
|
||||
|
||||
d |= tidx[0] << 26;
|
||||
d |= tidx[1] << 29;
|
||||
for( int i=0; i<16; i++ )
|
||||
{
|
||||
uint64 t = tsel[i][tidx[id[i]%2]];
|
||||
d |= ( t & 0x1 ) << ( i + 32 );
|
||||
d |= ( t & 0x2 ) << ( i + 47 );
|
||||
}
|
||||
|
||||
return FixByteOrder(d);
|
||||
}
|
||||
}
|
||||
|
||||
uint64 ProcessRGB( const uint8* src )
|
||||
{
|
||||
uint64 d = CheckSolid( src );
|
||||
if( d != 0 ) return d;
|
||||
|
||||
v4i a[8];
|
||||
uint err[4] = {};
|
||||
PrepareAverages( a, src, err );
|
||||
size_t idx = GetLeastError( err, 4 );
|
||||
EncodeAverages( d, a, idx );
|
||||
|
||||
#if defined __SSE4_1__ && !defined REFERENCE_IMPLEMENTATION
|
||||
uint32 terr[2][8] = {};
|
||||
#else
|
||||
uint64 terr[2][8] = {};
|
||||
#endif
|
||||
uint16 tsel[16][8];
|
||||
const uint32* id = g_id[idx];
|
||||
FindBestFit( terr, tsel, a, id, src );
|
||||
|
||||
return FixByteOrder( EncodeSelectors( d, terr, tsel, id ) );
|
||||
}
|
||||
|
||||
uint64 ProcessRGB_ETC2( const uint8* src )
|
||||
{
|
||||
std::pair<uint64, uint64> result = Planar( src );
|
||||
|
||||
uint64 d = 0;
|
||||
|
||||
v4i a[8];
|
||||
uint err[4] = {};
|
||||
PrepareAverages( a, src, err );
|
||||
size_t idx = GetLeastError( err, 4 );
|
||||
EncodeAverages( d, a, idx );
|
||||
|
||||
uint64 terr[2][8] = {};
|
||||
uint16 tsel[16][8];
|
||||
const uint32* id = g_id[idx];
|
||||
FindBestFit( terr, tsel, a, id, src );
|
||||
|
||||
return EncodeSelectors( d, terr, tsel, id, result.first, result.second );
|
||||
}
|
|
@ -1,9 +0,0 @@
|
|||
#ifndef __PROCESSRGB_HPP__
|
||||
#define __PROCESSRGB_HPP__
|
||||
|
||||
#include "Types.hpp"
|
||||
|
||||
uint64 ProcessRGB( const uint8* src );
|
||||
uint64 ProcessRGB_ETC2( const uint8* src );
|
||||
|
||||
#endif
|
|
@ -1,109 +0,0 @@
|
|||
#include "Tables.hpp"
|
||||
|
||||
const int32 g_table[8][4] = {
|
||||
{ 2, 8, -2, -8 },
|
||||
{ 5, 17, -5, -17 },
|
||||
{ 9, 29, -9, -29 },
|
||||
{ 13, 42, -13, -42 },
|
||||
{ 18, 60, -18, -60 },
|
||||
{ 24, 80, -24, -80 },
|
||||
{ 33, 106, -33, -106 },
|
||||
{ 47, 183, -47, -183 }
|
||||
};
|
||||
|
||||
const int64 g_table256[8][4] = {
|
||||
{ 2*256, 8*256, -2*256, -8*256 },
|
||||
{ 5*256, 17*256, -5*256, -17*256 },
|
||||
{ 9*256, 29*256, -9*256, -29*256 },
|
||||
{ 13*256, 42*256, -13*256, -42*256 },
|
||||
{ 18*256, 60*256, -18*256, -60*256 },
|
||||
{ 24*256, 80*256, -24*256, -80*256 },
|
||||
{ 33*256, 106*256, -33*256, -106*256 },
|
||||
{ 47*256, 183*256, -47*256, -183*256 }
|
||||
};
|
||||
|
||||
const uint32 g_id[4][16] = {
|
||||
{ 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0 },
|
||||
{ 3, 3, 2, 2, 3, 3, 2, 2, 3, 3, 2, 2, 3, 3, 2, 2 },
|
||||
{ 5, 5, 5, 5, 5, 5, 5, 5, 4, 4, 4, 4, 4, 4, 4, 4 },
|
||||
{ 7, 7, 6, 6, 7, 7, 6, 6, 7, 7, 6, 6, 7, 7, 6, 6 }
|
||||
};
|
||||
|
||||
const uint32 g_avg2[16] = {
|
||||
0x00,
|
||||
0x11,
|
||||
0x22,
|
||||
0x33,
|
||||
0x44,
|
||||
0x55,
|
||||
0x66,
|
||||
0x77,
|
||||
0x88,
|
||||
0x99,
|
||||
0xAA,
|
||||
0xBB,
|
||||
0xCC,
|
||||
0xDD,
|
||||
0xEE,
|
||||
0xFF
|
||||
};
|
||||
|
||||
const uint32 g_flags[64] = {
|
||||
0x80800402, 0x80800402, 0x80800402, 0x80800402,
|
||||
0x80800402, 0x80800402, 0x80800402, 0x8080E002,
|
||||
0x80800402, 0x80800402, 0x8080E002, 0x8080E002,
|
||||
0x80800402, 0x8080E002, 0x8080E002, 0x8080E002,
|
||||
0x80000402, 0x80000402, 0x80000402, 0x80000402,
|
||||
0x80000402, 0x80000402, 0x80000402, 0x8000E002,
|
||||
0x80000402, 0x80000402, 0x8000E002, 0x8000E002,
|
||||
0x80000402, 0x8000E002, 0x8000E002, 0x8000E002,
|
||||
0x00800402, 0x00800402, 0x00800402, 0x00800402,
|
||||
0x00800402, 0x00800402, 0x00800402, 0x0080E002,
|
||||
0x00800402, 0x00800402, 0x0080E002, 0x0080E002,
|
||||
0x00800402, 0x0080E002, 0x0080E002, 0x0080E002,
|
||||
0x00000402, 0x00000402, 0x00000402, 0x00000402,
|
||||
0x00000402, 0x00000402, 0x00000402, 0x0000E002,
|
||||
0x00000402, 0x00000402, 0x0000E002, 0x0000E002,
|
||||
0x00000402, 0x0000E002, 0x0000E002, 0x0000E002
|
||||
};
|
||||
|
||||
#ifdef __SSE4_1__
|
||||
const uint8 g_flags_AVX2[64] =
|
||||
{
|
||||
0x63, 0x63, 0x63, 0x63,
|
||||
0x63, 0x63, 0x63, 0x7D,
|
||||
0x63, 0x63, 0x7D, 0x7D,
|
||||
0x63, 0x7D, 0x7D, 0x7D,
|
||||
0x43, 0x43, 0x43, 0x43,
|
||||
0x43, 0x43, 0x43, 0x5D,
|
||||
0x43, 0x43, 0x5D, 0x5D,
|
||||
0x43, 0x5D, 0x5D, 0x5D,
|
||||
0x23, 0x23, 0x23, 0x23,
|
||||
0x23, 0x23, 0x23, 0x3D,
|
||||
0x23, 0x23, 0x3D, 0x3D,
|
||||
0x23, 0x3D, 0x3D, 0x3D,
|
||||
0x03, 0x03, 0x03, 0x03,
|
||||
0x03, 0x03, 0x03, 0x1D,
|
||||
0x03, 0x03, 0x1D, 0x1D,
|
||||
0x03, 0x1D, 0x1D, 0x1D,
|
||||
};
|
||||
|
||||
const __m128i g_table_SIMD[2] =
|
||||
{
|
||||
_mm_setr_epi16( 2, 5, 9, 13, 18, 24, 33, 47),
|
||||
_mm_setr_epi16( 8, 17, 29, 42, 60, 80, 106, 183)
|
||||
};
|
||||
const __m128i g_table128_SIMD[2] =
|
||||
{
|
||||
_mm_setr_epi16( 2*128, 5*128, 9*128, 13*128, 18*128, 24*128, 33*128, 47*128),
|
||||
_mm_setr_epi16( 8*128, 17*128, 29*128, 42*128, 60*128, 80*128, 106*128, 183*128)
|
||||
};
|
||||
const __m128i g_table256_SIMD[4] =
|
||||
{
|
||||
_mm_setr_epi32( 2*256, 5*256, 9*256, 13*256),
|
||||
_mm_setr_epi32( 8*256, 17*256, 29*256, 42*256),
|
||||
_mm_setr_epi32( 18*256, 24*256, 33*256, 47*256),
|
||||
_mm_setr_epi32( 60*256, 80*256, 106*256, 183*256)
|
||||
};
|
||||
#endif
|
||||
|
|
@ -1,25 +0,0 @@
|
|||
#ifndef __TABLES_HPP__
|
||||
#define __TABLES_HPP__
|
||||
|
||||
#include "Types.hpp"
|
||||
#ifdef __SSE4_1__
|
||||
#include <smmintrin.h>
|
||||
#endif
|
||||
|
||||
extern const int32 g_table[8][4];
|
||||
extern const int64 g_table256[8][4];
|
||||
|
||||
extern const uint32 g_id[4][16];
|
||||
|
||||
extern const uint32 g_avg2[16];
|
||||
|
||||
extern const uint32 g_flags[64];
|
||||
|
||||
#ifdef __SSE4_1__
|
||||
extern const uint8 g_flags_AVX2[64];
|
||||
extern const __m128i g_table_SIMD[2];
|
||||
extern const __m128i g_table128_SIMD[2];
|
||||
extern const __m128i g_table256_SIMD[4];
|
||||
#endif
|
||||
|
||||
#endif
|
|
@ -1,17 +0,0 @@
|
|||
#ifndef __DARKRL__TYPES_HPP__
|
||||
#define __DARKRL__TYPES_HPP__
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
typedef int8_t int8;
|
||||
typedef uint8_t uint8;
|
||||
typedef int16_t int16;
|
||||
typedef uint16_t uint16;
|
||||
typedef int32_t int32;
|
||||
typedef uint32_t uint32;
|
||||
typedef int64_t int64;
|
||||
typedef uint64_t uint64;
|
||||
|
||||
typedef unsigned int uint;
|
||||
|
||||
#endif
|
|
@ -1,222 +0,0 @@
|
|||
#ifndef __DARKRL__VECTOR_HPP__
|
||||
#define __DARKRL__VECTOR_HPP__
|
||||
|
||||
#include <assert.h>
|
||||
#include <algorithm>
|
||||
#include <math.h>
|
||||
|
||||
#include "Math.hpp"
|
||||
#include "Types.hpp"
|
||||
|
||||
template<class T>
|
||||
struct Vector2
|
||||
{
|
||||
Vector2() : x( 0 ), y( 0 ) {}
|
||||
Vector2( T v ) : x( v ), y( v ) {}
|
||||
Vector2( T _x, T _y ) : x( _x ), y( _y ) {}
|
||||
|
||||
bool operator==( const Vector2<T>& rhs ) const { return x == rhs.x && y == rhs.y; }
|
||||
bool operator!=( const Vector2<T>& rhs ) const { return !( *this == rhs ); }
|
||||
|
||||
Vector2<T>& operator+=( const Vector2<T>& rhs )
|
||||
{
|
||||
x += rhs.x;
|
||||
y += rhs.y;
|
||||
return *this;
|
||||
}
|
||||
Vector2<T>& operator-=( const Vector2<T>& rhs )
|
||||
{
|
||||
x -= rhs.x;
|
||||
y -= rhs.y;
|
||||
return *this;
|
||||
}
|
||||
Vector2<T>& operator*=( const Vector2<T>& rhs )
|
||||
{
|
||||
x *= rhs.x;
|
||||
y *= rhs.y;
|
||||
return *this;
|
||||
}
|
||||
|
||||
T x, y;
|
||||
};
|
||||
|
||||
template<class T>
|
||||
Vector2<T> operator+( const Vector2<T>& lhs, const Vector2<T>& rhs )
|
||||
{
|
||||
return Vector2<T>( lhs.x + rhs.x, lhs.y + rhs.y );
|
||||
}
|
||||
|
||||
template<class T>
|
||||
Vector2<T> operator-( const Vector2<T>& lhs, const Vector2<T>& rhs )
|
||||
{
|
||||
return Vector2<T>( lhs.x - rhs.x, lhs.y - rhs.y );
|
||||
}
|
||||
|
||||
template<class T>
|
||||
Vector2<T> operator*( const Vector2<T>& lhs, const float& rhs )
|
||||
{
|
||||
return Vector2<T>( lhs.x * rhs, lhs.y * rhs );
|
||||
}
|
||||
|
||||
template<class T>
|
||||
Vector2<T> operator/( const Vector2<T>& lhs, const T& rhs )
|
||||
{
|
||||
return Vector2<T>( lhs.x / rhs, lhs.y / rhs );
|
||||
}
|
||||
|
||||
|
||||
typedef Vector2<int32> v2i;
|
||||
typedef Vector2<float> v2f;
|
||||
|
||||
|
||||
template<class T>
|
||||
struct Vector3
|
||||
{
|
||||
Vector3() : x( 0 ), y( 0 ), z( 0 ) {}
|
||||
Vector3( T v ) : x( v ), y( v ), z( v ) {}
|
||||
Vector3( T _x, T _y, T _z ) : x( _x ), y( _y ), z( _z ) {}
|
||||
template<class Y>
|
||||
Vector3( const Vector3<Y>& v ) : x( T( v.x ) ), y( T( v.y ) ), z( T( v.z ) ) {}
|
||||
|
||||
T Luminance() const { return T( x * 0.3f + y * 0.59f + z * 0.11f ); }
|
||||
void Clamp()
|
||||
{
|
||||
x = std::min( T(1), std::max( T(0), x ) );
|
||||
y = std::min( T(1), std::max( T(0), y ) );
|
||||
z = std::min( T(1), std::max( T(0), z ) );
|
||||
}
|
||||
|
||||
bool operator==( const Vector3<T>& rhs ) const { return x == rhs.x && y == rhs.y && z == rhs.z; }
|
||||
bool operator!=( const Vector2<T>& rhs ) const { return !( *this == rhs ); }
|
||||
|
||||
T& operator[]( uint idx ) { assert( idx < 3 ); return ((T*)this)[idx]; }
|
||||
const T& operator[]( uint idx ) const { assert( idx < 3 ); return ((T*)this)[idx]; }
|
||||
|
||||
Vector3<T> operator+=( const Vector3<T>& rhs )
|
||||
{
|
||||
x += rhs.x;
|
||||
y += rhs.y;
|
||||
z += rhs.z;
|
||||
return *this;
|
||||
}
|
||||
|
||||
Vector3<T> operator*=( const Vector3<T>& rhs )
|
||||
{
|
||||
x *= rhs.x;
|
||||
y *= rhs.y;
|
||||
z *= rhs.z;
|
||||
return *this;
|
||||
}
|
||||
|
||||
Vector3<T> operator*=( const float& rhs )
|
||||
{
|
||||
x *= rhs;
|
||||
y *= rhs;
|
||||
z *= rhs;
|
||||
return *this;
|
||||
}
|
||||
|
||||
T x, y, z;
|
||||
T padding;
|
||||
};
|
||||
|
||||
template<class T>
|
||||
Vector3<T> operator+( const Vector3<T>& lhs, const Vector3<T>& rhs )
|
||||
{
|
||||
return Vector3<T>( lhs.x + rhs.x, lhs.y + rhs.y, lhs.z + rhs.z );
|
||||
}
|
||||
|
||||
template<class T>
|
||||
Vector3<T> operator-( const Vector3<T>& lhs, const Vector3<T>& rhs )
|
||||
{
|
||||
return Vector3<T>( lhs.x - rhs.x, lhs.y - rhs.y, lhs.z - rhs.z );
|
||||
}
|
||||
|
||||
template<class T>
|
||||
Vector3<T> operator*( const Vector3<T>& lhs, const Vector3<T>& rhs )
|
||||
{
|
||||
return Vector3<T>( lhs.x * rhs.x, lhs.y * rhs.y, lhs.z * rhs.z );
|
||||
}
|
||||
|
||||
template<class T>
|
||||
Vector3<T> operator*( const Vector3<T>& lhs, const float& rhs )
|
||||
{
|
||||
return Vector3<T>( T( lhs.x * rhs ), T( lhs.y * rhs ), T( lhs.z * rhs ) );
|
||||
}
|
||||
|
||||
template<class T>
|
||||
Vector3<T> operator/( const Vector3<T>& lhs, const T& rhs )
|
||||
{
|
||||
return Vector3<T>( lhs.x / rhs, lhs.y / rhs, lhs.z / rhs );
|
||||
}
|
||||
|
||||
template<class T>
|
||||
bool operator<( const Vector3<T>& lhs, const Vector3<T>& rhs )
|
||||
{
|
||||
return lhs.Luminance() < rhs.Luminance();
|
||||
}
|
||||
|
||||
typedef Vector3<int32> v3i;
|
||||
typedef Vector3<float> v3f;
|
||||
typedef Vector3<uint8> v3b;
|
||||
|
||||
|
||||
static inline v3b v3f_to_v3b( const v3f& v )
|
||||
{
|
||||
return v3b( uint8( std::min( 1.f, v.x ) * 255 ), uint8( std::min( 1.f, v.y ) * 255 ), uint8( std::min( 1.f, v.z ) * 255 ) );
|
||||
}
|
||||
|
||||
template<class T>
|
||||
Vector3<T> Mix( const Vector3<T>& v1, const Vector3<T>& v2, float amount )
|
||||
{
|
||||
return v1 + ( v2 - v1 ) * amount;
|
||||
}
|
||||
|
||||
template<>
|
||||
inline v3b Mix( const v3b& v1, const v3b& v2, float amount )
|
||||
{
|
||||
return v3b( v3f( v1 ) + ( v3f( v2 ) - v3f( v1 ) ) * amount );
|
||||
}
|
||||
|
||||
template<class T>
|
||||
Vector3<T> Desaturate( const Vector3<T>& v )
|
||||
{
|
||||
T l = v.Luminance();
|
||||
return Vector3<T>( l, l, l );
|
||||
}
|
||||
|
||||
template<class T>
|
||||
Vector3<T> Desaturate( const Vector3<T>& v, float mul )
|
||||
{
|
||||
T l = T( v.Luminance() * mul );
|
||||
return Vector3<T>( l, l, l );
|
||||
}
|
||||
|
||||
template<class T>
|
||||
Vector3<T> pow( const Vector3<T>& base, float exponent )
|
||||
{
|
||||
return Vector3<T>(
|
||||
pow( base.x, exponent ),
|
||||
pow( base.y, exponent ),
|
||||
pow( base.z, exponent ) );
|
||||
}
|
||||
|
||||
template<class T>
|
||||
Vector3<T> sRGB2linear( const Vector3<T>& v )
|
||||
{
|
||||
return Vector3<T>(
|
||||
sRGB2linear( v.x ),
|
||||
sRGB2linear( v.y ),
|
||||
sRGB2linear( v.z ) );
|
||||
}
|
||||
|
||||
template<class T>
|
||||
Vector3<T> linear2sRGB( const Vector3<T>& v )
|
||||
{
|
||||
return Vector3<T>(
|
||||
linear2sRGB( v.x ),
|
||||
linear2sRGB( v.y ),
|
||||
linear2sRGB( v.z ) );
|
||||
}
|
||||
|
||||
#endif
|
|
@ -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,593 +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 */
|
||||
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);
|
||||
|
||||
if (global->errors > 0 && !global->eflag)
|
||||
return(IO_ERROR);
|
||||
return(IO_NORMAL); /* 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 deldefines(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,413 +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 deldefines(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,350 +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 <assert.h>
|
||||
#include <math.h>
|
||||
#include <vector>
|
||||
#include <limits>
|
||||
#include <algorithm>
|
||||
|
||||
namespace Forsyth
|
||||
{
|
||||
typedef unsigned int uint;
|
||||
typedef unsigned short uint16;
|
||||
typedef unsigned char byte;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// OptimizeFaces
|
||||
//-----------------------------------------------------------------------------
|
||||
// Parameters:
|
||||
// indexList
|
||||
// input index list
|
||||
// indexCount
|
||||
// the number of indices in the list
|
||||
// vertexCount
|
||||
// the largest index value in indexList
|
||||
// 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* indexList, uint indexCount, uint vertexCount, uint16* newIndexList, uint16 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(uint 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 uint 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 (uint 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(uint numActiveFaces, uint cachePosition, uint 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;
|
||||
uint activeFaceListStart;
|
||||
uint activeFaceListSize;
|
||||
uint16 cachePos0;
|
||||
uint16 cachePos1;
|
||||
OptimizeVertexData() : score(0.f), activeFaceListStart(0), activeFaceListSize(0), cachePos0(0), cachePos1(0) { }
|
||||
};
|
||||
}
|
||||
|
||||
void OptimizeFaces(const uint16* indexList, uint indexCount, uint vertexCount, uint16* newIndexList, uint16 lruCacheSize)
|
||||
{
|
||||
std::vector<OptimizeVertexData> vertexDataList;
|
||||
vertexDataList.resize(vertexCount);
|
||||
|
||||
// compute face count per vertex
|
||||
for (uint i=0; i<indexCount; ++i)
|
||||
{
|
||||
uint16 index = indexList[i];
|
||||
assert(index < vertexCount);
|
||||
OptimizeVertexData& vertexData = vertexDataList[index];
|
||||
vertexData.activeFaceListSize++;
|
||||
}
|
||||
|
||||
std::vector<uint> activeFaceList;
|
||||
|
||||
const uint16 kEvictedCacheIndex = std::numeric_limits<uint16>::max();
|
||||
|
||||
{
|
||||
// allocate face list per vertex
|
||||
uint curActiveFaceListPos = 0;
|
||||
for (uint 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 (uint i=0; i<indexCount; i+=3)
|
||||
{
|
||||
for (uint j=0; j<3; ++j)
|
||||
{
|
||||
uint16 index = indexList[i+j];
|
||||
OptimizeVertexData& vertexData = vertexDataList[index];
|
||||
activeFaceList[vertexData.activeFaceListStart + vertexData.activeFaceListSize] = i;
|
||||
vertexData.activeFaceListSize++;
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<byte> processedFaceList;
|
||||
processedFaceList.resize(indexCount);
|
||||
|
||||
uint16 vertexCacheBuffer[(kMaxVertexCacheSize+3)*2];
|
||||
uint16* cache0 = vertexCacheBuffer;
|
||||
uint16* cache1 = vertexCacheBuffer+(kMaxVertexCacheSize+3);
|
||||
uint16 entriesInCache0 = 0;
|
||||
|
||||
uint bestFace = 0;
|
||||
float bestScore = -1.f;
|
||||
|
||||
const float maxValenceScore = FindVertexScore(1, kEvictedCacheIndex, lruCacheSize) * 3.f;
|
||||
|
||||
for (uint 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 (uint j = 0; j < indexCount; j += 3)
|
||||
{
|
||||
if (processedFaceList[j] == 0)
|
||||
{
|
||||
uint face = j;
|
||||
float faceScore = 0.f;
|
||||
for (uint k=0; k<3; ++k)
|
||||
{
|
||||
uint16 index = indexList[face+k];
|
||||
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 entriesInCache1 = 0;
|
||||
|
||||
// add bestFace to LRU cache and to newIndexList
|
||||
for (uint v = 0; v < 3; ++v)
|
||||
{
|
||||
uint16 index = indexList[bestFace+v];
|
||||
newIndexList[i+v] = index;
|
||||
|
||||
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);
|
||||
uint* begin = &activeFaceList[vertexData.activeFaceListStart];
|
||||
uint* end = &(activeFaceList[vertexData.activeFaceListStart + vertexData.activeFaceListSize - 1]) + 1;
|
||||
uint* 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 (uint c0 = 0; c0 < entriesInCache0; ++c0)
|
||||
{
|
||||
uint16 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 (uint c1 = 0; c1 < entriesInCache1; ++c1)
|
||||
{
|
||||
uint16 index = cache1[c1];
|
||||
OptimizeVertexData& vertexData = vertexDataList[index];
|
||||
vertexData.cachePos0 = vertexData.cachePos1;
|
||||
vertexData.cachePos1 = kEvictedCacheIndex;
|
||||
for (uint j=0; j<vertexData.activeFaceListSize; ++j)
|
||||
{
|
||||
uint face = activeFaceList[vertexData.activeFaceListStart+j];
|
||||
float faceScore = 0.f;
|
||||
for (uint v=0; v<3; v++)
|
||||
{
|
||||
uint16 faceIndex = indexList[face+v];
|
||||
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,44 +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
|
||||
// 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* 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,175 +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="
|
||||
# pragma GCC diagnostic ignored "-Wformat-extra-args"
|
||||
# pragma GCC diagnostic ignored "-Wignored-qualifiers"
|
||||
# pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
|
||||
# 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"
|
||||
#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
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue