finderrors.c
author Ryan C. Gordon <icculus@icculus.org>
Mon, 21 Apr 2008 23:44:51 -0400
branchtrunk
changeset 170 9d71c08c756e
parent 169 7e9d90724cf8
child 172 f81c6cb14140
permissions -rw-r--r--
Ripped out the multithreading from finderrors.c ... Parsing 15,000 shaders takes under a second anyhow, and stupid OpenGL isn't thread safe, so you eventually bottleneck down to the main thread for the expensive part anyhow...so might as well make this code readable.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
153
4410cc03dade Added finderrors.c to revision control.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
     1
#include <stdio.h>
4410cc03dade Added finderrors.c to revision control.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
     2
#include <stdlib.h>
4410cc03dade Added finderrors.c to revision control.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
     3
#include <string.h>
4410cc03dade Added finderrors.c to revision control.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
     4
#include <stdarg.h>
4410cc03dade Added finderrors.c to revision control.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
     5
#include <sys/types.h>
4410cc03dade Added finderrors.c to revision control.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
     6
#include <dirent.h>
4410cc03dade Added finderrors.c to revision control.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
     7
#include <errno.h>
169
7e9d90724cf8 Push parsed shaders through GLSL compiler to see what breaks.
Ryan C. Gordon <icculus@icculus.org>
parents: 153
diff changeset
     8
#include <unistd.h>
153
4410cc03dade Added finderrors.c to revision control.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
     9
4410cc03dade Added finderrors.c to revision control.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    10
#include "mojoshader.h"
4410cc03dade Added finderrors.c to revision control.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    11
169
7e9d90724cf8 Push parsed shaders through GLSL compiler to see what breaks.
Ryan C. Gordon <icculus@icculus.org>
parents: 153
diff changeset
    12
#define FINDERRORS_COMPILE_SHADERS 1
7e9d90724cf8 Push parsed shaders through GLSL compiler to see what breaks.
Ryan C. Gordon <icculus@icculus.org>
parents: 153
diff changeset
    13
7e9d90724cf8 Push parsed shaders through GLSL compiler to see what breaks.
Ryan C. Gordon <icculus@icculus.org>
parents: 153
diff changeset
    14
#if FINDERRORS_COMPILE_SHADERS
7e9d90724cf8 Push parsed shaders through GLSL compiler to see what breaks.
Ryan C. Gordon <icculus@icculus.org>
parents: 153
diff changeset
    15
#include "SDL.h"
7e9d90724cf8 Push parsed shaders through GLSL compiler to see what breaks.
Ryan C. Gordon <icculus@icculus.org>
parents: 153
diff changeset
    16
#include <gl.h>
7e9d90724cf8 Push parsed shaders through GLSL compiler to see what breaks.
Ryan C. Gordon <icculus@icculus.org>
parents: 153
diff changeset
    17
#include <glext.h>
7e9d90724cf8 Push parsed shaders through GLSL compiler to see what breaks.
Ryan C. Gordon <icculus@icculus.org>
parents: 153
diff changeset
    18
#endif
7e9d90724cf8 Push parsed shaders through GLSL compiler to see what breaks.
Ryan C. Gordon <icculus@icculus.org>
parents: 153
diff changeset
    19
170
9d71c08c756e Ripped out the multithreading from finderrors.c ...
Ryan C. Gordon <icculus@icculus.org>
parents: 169
diff changeset
    20
#define report printf
169
7e9d90724cf8 Push parsed shaders through GLSL compiler to see what breaks.
Ryan C. Gordon <icculus@icculus.org>
parents: 153
diff changeset
    21
7e9d90724cf8 Push parsed shaders through GLSL compiler to see what breaks.
Ryan C. Gordon <icculus@icculus.org>
parents: 153
diff changeset
    22
static int compile_shader(const char *fname, const MOJOSHADER_parseData *pd)
7e9d90724cf8 Push parsed shaders through GLSL compiler to see what breaks.
Ryan C. Gordon <icculus@icculus.org>
parents: 153
diff changeset
    23
{
7e9d90724cf8 Push parsed shaders through GLSL compiler to see what breaks.
Ryan C. Gordon <icculus@icculus.org>
parents: 153
diff changeset
    24
    int retval = 1;
7e9d90724cf8 Push parsed shaders through GLSL compiler to see what breaks.
Ryan C. Gordon <icculus@icculus.org>
parents: 153
diff changeset
    25
7e9d90724cf8 Push parsed shaders through GLSL compiler to see what breaks.
Ryan C. Gordon <icculus@icculus.org>
parents: 153
diff changeset
    26
    #if FINDERRORS_COMPILE_SHADERS
7e9d90724cf8 Push parsed shaders through GLSL compiler to see what breaks.
Ryan C. Gordon <icculus@icculus.org>
parents: 153
diff changeset
    27
    const GLenum shader_type = (pd->shader_type == MOJOSHADER_TYPE_PIXEL) ? GL_FRAGMENT_SHADER_ARB : GL_VERTEX_SHADER_ARB;
7e9d90724cf8 Push parsed shaders through GLSL compiler to see what breaks.
Ryan C. Gordon <icculus@icculus.org>
parents: 153
diff changeset
    28
    GLint shaderlen = (GLint) pd->output_len;
7e9d90724cf8 Push parsed shaders through GLSL compiler to see what breaks.
Ryan C. Gordon <icculus@icculus.org>
parents: 153
diff changeset
    29
    GLhandleARB program = glCreateProgramObjectARB();
7e9d90724cf8 Push parsed shaders through GLSL compiler to see what breaks.
Ryan C. Gordon <icculus@icculus.org>
parents: 153
diff changeset
    30
    GLhandleARB shader = glCreateShaderObjectARB(shader_type);
7e9d90724cf8 Push parsed shaders through GLSL compiler to see what breaks.
Ryan C. Gordon <icculus@icculus.org>
parents: 153
diff changeset
    31
    GLint ok = 0;
7e9d90724cf8 Push parsed shaders through GLSL compiler to see what breaks.
Ryan C. Gordon <icculus@icculus.org>
parents: 153
diff changeset
    32
    GLcharARB err[1024];
7e9d90724cf8 Push parsed shaders through GLSL compiler to see what breaks.
Ryan C. Gordon <icculus@icculus.org>
parents: 153
diff changeset
    33
    GLsizei len = 0;
7e9d90724cf8 Push parsed shaders through GLSL compiler to see what breaks.
Ryan C. Gordon <icculus@icculus.org>
parents: 153
diff changeset
    34
7e9d90724cf8 Push parsed shaders through GLSL compiler to see what breaks.
Ryan C. Gordon <icculus@icculus.org>
parents: 153
diff changeset
    35
    retval = 0;
7e9d90724cf8 Push parsed shaders through GLSL compiler to see what breaks.
Ryan C. Gordon <icculus@icculus.org>
parents: 153
diff changeset
    36
7e9d90724cf8 Push parsed shaders through GLSL compiler to see what breaks.
Ryan C. Gordon <icculus@icculus.org>
parents: 153
diff changeset
    37
    glShaderSourceARB(shader, 1, (const GLcharARB **) &pd->output, &shaderlen);
7e9d90724cf8 Push parsed shaders through GLSL compiler to see what breaks.
Ryan C. Gordon <icculus@icculus.org>
parents: 153
diff changeset
    38
    glCompileShaderARB(shader);
7e9d90724cf8 Push parsed shaders through GLSL compiler to see what breaks.
Ryan C. Gordon <icculus@icculus.org>
parents: 153
diff changeset
    39
    glGetObjectParameterivARB(shader, GL_OBJECT_COMPILE_STATUS_ARB, &ok);
7e9d90724cf8 Push parsed shaders through GLSL compiler to see what breaks.
Ryan C. Gordon <icculus@icculus.org>
parents: 153
diff changeset
    40
    if (!ok)
7e9d90724cf8 Push parsed shaders through GLSL compiler to see what breaks.
Ryan C. Gordon <icculus@icculus.org>
parents: 153
diff changeset
    41
    {
7e9d90724cf8 Push parsed shaders through GLSL compiler to see what breaks.
Ryan C. Gordon <icculus@icculus.org>
parents: 153
diff changeset
    42
        glGetInfoLogARB(shader, sizeof (err), &len, err);
7e9d90724cf8 Push parsed shaders through GLSL compiler to see what breaks.
Ryan C. Gordon <icculus@icculus.org>
parents: 153
diff changeset
    43
        printf("FAIL: %s glsl compile: %s\n", fname, err);
7e9d90724cf8 Push parsed shaders through GLSL compiler to see what breaks.
Ryan C. Gordon <icculus@icculus.org>
parents: 153
diff changeset
    44
    } // if
7e9d90724cf8 Push parsed shaders through GLSL compiler to see what breaks.
Ryan C. Gordon <icculus@icculus.org>
parents: 153
diff changeset
    45
    else
7e9d90724cf8 Push parsed shaders through GLSL compiler to see what breaks.
Ryan C. Gordon <icculus@icculus.org>
parents: 153
diff changeset
    46
    {
7e9d90724cf8 Push parsed shaders through GLSL compiler to see what breaks.
Ryan C. Gordon <icculus@icculus.org>
parents: 153
diff changeset
    47
        glAttachObjectARB(program, shader);
7e9d90724cf8 Push parsed shaders through GLSL compiler to see what breaks.
Ryan C. Gordon <icculus@icculus.org>
parents: 153
diff changeset
    48
        glLinkProgramARB(program);
7e9d90724cf8 Push parsed shaders through GLSL compiler to see what breaks.
Ryan C. Gordon <icculus@icculus.org>
parents: 153
diff changeset
    49
        glGetObjectParameterivARB(program, GL_OBJECT_LINK_STATUS_ARB, &ok);
7e9d90724cf8 Push parsed shaders through GLSL compiler to see what breaks.
Ryan C. Gordon <icculus@icculus.org>
parents: 153
diff changeset
    50
        if (!ok)
7e9d90724cf8 Push parsed shaders through GLSL compiler to see what breaks.
Ryan C. Gordon <icculus@icculus.org>
parents: 153
diff changeset
    51
        {
7e9d90724cf8 Push parsed shaders through GLSL compiler to see what breaks.
Ryan C. Gordon <icculus@icculus.org>
parents: 153
diff changeset
    52
            glGetInfoLogARB(program, sizeof (err), &len, err);
7e9d90724cf8 Push parsed shaders through GLSL compiler to see what breaks.
Ryan C. Gordon <icculus@icculus.org>
parents: 153
diff changeset
    53
            printf("FAIL: %s glsl link: %s\n", fname, err);
7e9d90724cf8 Push parsed shaders through GLSL compiler to see what breaks.
Ryan C. Gordon <icculus@icculus.org>
parents: 153
diff changeset
    54
        } // if
7e9d90724cf8 Push parsed shaders through GLSL compiler to see what breaks.
Ryan C. Gordon <icculus@icculus.org>
parents: 153
diff changeset
    55
        else
7e9d90724cf8 Push parsed shaders through GLSL compiler to see what breaks.
Ryan C. Gordon <icculus@icculus.org>
parents: 153
diff changeset
    56
        {
7e9d90724cf8 Push parsed shaders through GLSL compiler to see what breaks.
Ryan C. Gordon <icculus@icculus.org>
parents: 153
diff changeset
    57
            retval = 1;
7e9d90724cf8 Push parsed shaders through GLSL compiler to see what breaks.
Ryan C. Gordon <icculus@icculus.org>
parents: 153
diff changeset
    58
        } // else
7e9d90724cf8 Push parsed shaders through GLSL compiler to see what breaks.
Ryan C. Gordon <icculus@icculus.org>
parents: 153
diff changeset
    59
    } // else
7e9d90724cf8 Push parsed shaders through GLSL compiler to see what breaks.
Ryan C. Gordon <icculus@icculus.org>
parents: 153
diff changeset
    60
    glDeleteObjectARB(shader);
7e9d90724cf8 Push parsed shaders through GLSL compiler to see what breaks.
Ryan C. Gordon <icculus@icculus.org>
parents: 153
diff changeset
    61
    glDeleteObjectARB(program);
7e9d90724cf8 Push parsed shaders through GLSL compiler to see what breaks.
Ryan C. Gordon <icculus@icculus.org>
parents: 153
diff changeset
    62
    #endif
7e9d90724cf8 Push parsed shaders through GLSL compiler to see what breaks.
Ryan C. Gordon <icculus@icculus.org>
parents: 153
diff changeset
    63
7e9d90724cf8 Push parsed shaders through GLSL compiler to see what breaks.
Ryan C. Gordon <icculus@icculus.org>
parents: 153
diff changeset
    64
    return retval;
7e9d90724cf8 Push parsed shaders through GLSL compiler to see what breaks.
Ryan C. Gordon <icculus@icculus.org>
parents: 153
diff changeset
    65
} // compile_shader
7e9d90724cf8 Push parsed shaders through GLSL compiler to see what breaks.
Ryan C. Gordon <icculus@icculus.org>
parents: 153
diff changeset
    66
7e9d90724cf8 Push parsed shaders through GLSL compiler to see what breaks.
Ryan C. Gordon <icculus@icculus.org>
parents: 153
diff changeset
    67
170
9d71c08c756e Ripped out the multithreading from finderrors.c ...
Ryan C. Gordon <icculus@icculus.org>
parents: 169
diff changeset
    68
static int do_dir(const char *dname, const char *profile)
153
4410cc03dade Added finderrors.c to revision control.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    69
{
4410cc03dade Added finderrors.c to revision control.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    70
    const int dirlen = strlen(dname) + 1;
4410cc03dade Added finderrors.c to revision control.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    71
    int total = 0;
4410cc03dade Added finderrors.c to revision control.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    72
    DIR *dirp = opendir(dname);
4410cc03dade Added finderrors.c to revision control.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    73
    if (dirp != NULL)
4410cc03dade Added finderrors.c to revision control.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    74
    {
4410cc03dade Added finderrors.c to revision control.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    75
        struct dirent *dent;
4410cc03dade Added finderrors.c to revision control.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    76
        while ((dent = readdir(dirp)) != NULL)
4410cc03dade Added finderrors.c to revision control.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    77
        {
4410cc03dade Added finderrors.c to revision control.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    78
            if (strstr(dent->d_name, ".bytecode") == NULL)
4410cc03dade Added finderrors.c to revision control.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    79
                continue;
4410cc03dade Added finderrors.c to revision control.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    80
4410cc03dade Added finderrors.c to revision control.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
    81
            total++;
170
9d71c08c756e Ripped out the multithreading from finderrors.c ...
Ryan C. Gordon <icculus@icculus.org>
parents: 169
diff changeset
    82
9d71c08c756e Ripped out the multithreading from finderrors.c ...
Ryan C. Gordon <icculus@icculus.org>
parents: 169
diff changeset
    83
            char *fname = (char *) alloca(strlen(dent->d_name) + dirlen);
9d71c08c756e Ripped out the multithreading from finderrors.c ...
Ryan C. Gordon <icculus@icculus.org>
parents: 169
diff changeset
    84
            sprintf(fname, "%s/%s", dname, dent->d_name);
9d71c08c756e Ripped out the multithreading from finderrors.c ...
Ryan C. Gordon <icculus@icculus.org>
parents: 169
diff changeset
    85
            FILE *io = fopen(fname, "rb");
9d71c08c756e Ripped out the multithreading from finderrors.c ...
Ryan C. Gordon <icculus@icculus.org>
parents: 169
diff changeset
    86
            if (io == NULL)
9d71c08c756e Ripped out the multithreading from finderrors.c ...
Ryan C. Gordon <icculus@icculus.org>
parents: 169
diff changeset
    87
            {
9d71c08c756e Ripped out the multithreading from finderrors.c ...
Ryan C. Gordon <icculus@icculus.org>
parents: 169
diff changeset
    88
                report("FAIL: %s fopen() failed.\n", fname);
9d71c08c756e Ripped out the multithreading from finderrors.c ...
Ryan C. Gordon <icculus@icculus.org>
parents: 169
diff changeset
    89
                continue;
9d71c08c756e Ripped out the multithreading from finderrors.c ...
Ryan C. Gordon <icculus@icculus.org>
parents: 169
diff changeset
    90
            } // if
9d71c08c756e Ripped out the multithreading from finderrors.c ...
Ryan C. Gordon <icculus@icculus.org>
parents: 169
diff changeset
    91
9d71c08c756e Ripped out the multithreading from finderrors.c ...
Ryan C. Gordon <icculus@icculus.org>
parents: 169
diff changeset
    92
            static unsigned char buf[1024 * 256];
9d71c08c756e Ripped out the multithreading from finderrors.c ...
Ryan C. Gordon <icculus@icculus.org>
parents: 169
diff changeset
    93
            int rc = fread(buf, 1, sizeof (buf), io);
9d71c08c756e Ripped out the multithreading from finderrors.c ...
Ryan C. Gordon <icculus@icculus.org>
parents: 169
diff changeset
    94
            fclose(io);
9d71c08c756e Ripped out the multithreading from finderrors.c ...
Ryan C. Gordon <icculus@icculus.org>
parents: 169
diff changeset
    95
            if (rc == -1)
9d71c08c756e Ripped out the multithreading from finderrors.c ...
Ryan C. Gordon <icculus@icculus.org>
parents: 169
diff changeset
    96
            {
9d71c08c756e Ripped out the multithreading from finderrors.c ...
Ryan C. Gordon <icculus@icculus.org>
parents: 169
diff changeset
    97
                report("FAIL: %s %s\n", fname, strerror(errno));
9d71c08c756e Ripped out the multithreading from finderrors.c ...
Ryan C. Gordon <icculus@icculus.org>
parents: 169
diff changeset
    98
                continue;
9d71c08c756e Ripped out the multithreading from finderrors.c ...
Ryan C. Gordon <icculus@icculus.org>
parents: 169
diff changeset
    99
            } // if
9d71c08c756e Ripped out the multithreading from finderrors.c ...
Ryan C. Gordon <icculus@icculus.org>
parents: 169
diff changeset
   100
9d71c08c756e Ripped out the multithreading from finderrors.c ...
Ryan C. Gordon <icculus@icculus.org>
parents: 169
diff changeset
   101
            const MOJOSHADER_parseData *pd = MOJOSHADER_parse(profile, buf, rc, 0, 0, 0);
9d71c08c756e Ripped out the multithreading from finderrors.c ...
Ryan C. Gordon <icculus@icculus.org>
parents: 169
diff changeset
   102
            if (pd->error != NULL)
9d71c08c756e Ripped out the multithreading from finderrors.c ...
Ryan C. Gordon <icculus@icculus.org>
parents: 169
diff changeset
   103
                report("FAIL: %s %s\n", fname, pd->error);
9d71c08c756e Ripped out the multithreading from finderrors.c ...
Ryan C. Gordon <icculus@icculus.org>
parents: 169
diff changeset
   104
            else
9d71c08c756e Ripped out the multithreading from finderrors.c ...
Ryan C. Gordon <icculus@icculus.org>
parents: 169
diff changeset
   105
            {
9d71c08c756e Ripped out the multithreading from finderrors.c ...
Ryan C. Gordon <icculus@icculus.org>
parents: 169
diff changeset
   106
                if (compile_shader(fname, pd))
9d71c08c756e Ripped out the multithreading from finderrors.c ...
Ryan C. Gordon <icculus@icculus.org>
parents: 169
diff changeset
   107
                    report("PASS: %s\n", fname);
9d71c08c756e Ripped out the multithreading from finderrors.c ...
Ryan C. Gordon <icculus@icculus.org>
parents: 169
diff changeset
   108
            } // else
9d71c08c756e Ripped out the multithreading from finderrors.c ...
Ryan C. Gordon <icculus@icculus.org>
parents: 169
diff changeset
   109
            MOJOSHADER_freeParseData(pd);
153
4410cc03dade Added finderrors.c to revision control.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   110
        } // while
4410cc03dade Added finderrors.c to revision control.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   111
        closedir(dirp);
4410cc03dade Added finderrors.c to revision control.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   112
    } // if
4410cc03dade Added finderrors.c to revision control.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   113
4410cc03dade Added finderrors.c to revision control.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   114
    return total;
4410cc03dade Added finderrors.c to revision control.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   115
} // do_dir
4410cc03dade Added finderrors.c to revision control.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   116
4410cc03dade Added finderrors.c to revision control.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   117
4410cc03dade Added finderrors.c to revision control.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   118
int main(int argc, char **argv)
4410cc03dade Added finderrors.c to revision control.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   119
{
4410cc03dade Added finderrors.c to revision control.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   120
    //printf("MojoShader finderrors\n");
4410cc03dade Added finderrors.c to revision control.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   121
    //printf("Compiled against version %d\n", MOJOSHADER_VERSION);
4410cc03dade Added finderrors.c to revision control.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   122
    //printf("Linked against version %d\n", MOJOSHADER_version());
4410cc03dade Added finderrors.c to revision control.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   123
    //printf("\n");
4410cc03dade Added finderrors.c to revision control.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   124
4410cc03dade Added finderrors.c to revision control.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   125
    if (argc <= 2)
4410cc03dade Added finderrors.c to revision control.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   126
        printf("\n\nUSAGE: %s <profile> [dir1] ... [dirN]\n\n", argv[0]);
4410cc03dade Added finderrors.c to revision control.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   127
    else
4410cc03dade Added finderrors.c to revision control.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   128
    {
4410cc03dade Added finderrors.c to revision control.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   129
        int total = 0;
170
9d71c08c756e Ripped out the multithreading from finderrors.c ...
Ryan C. Gordon <icculus@icculus.org>
parents: 169
diff changeset
   130
        int i;
153
4410cc03dade Added finderrors.c to revision control.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   131
169
7e9d90724cf8 Push parsed shaders through GLSL compiler to see what breaks.
Ryan C. Gordon <icculus@icculus.org>
parents: 153
diff changeset
   132
        #if FINDERRORS_COMPILE_SHADERS
7e9d90724cf8 Push parsed shaders through GLSL compiler to see what breaks.
Ryan C. Gordon <icculus@icculus.org>
parents: 153
diff changeset
   133
        SDL_Init(SDL_INIT_VIDEO);
7e9d90724cf8 Push parsed shaders through GLSL compiler to see what breaks.
Ryan C. Gordon <icculus@icculus.org>
parents: 153
diff changeset
   134
        SDL_SetVideoMode(640, 480, 0, SDL_OPENGL);
7e9d90724cf8 Push parsed shaders through GLSL compiler to see what breaks.
Ryan C. Gordon <icculus@icculus.org>
parents: 153
diff changeset
   135
        #endif
7e9d90724cf8 Push parsed shaders through GLSL compiler to see what breaks.
Ryan C. Gordon <icculus@icculus.org>
parents: 153
diff changeset
   136
170
9d71c08c756e Ripped out the multithreading from finderrors.c ...
Ryan C. Gordon <icculus@icculus.org>
parents: 169
diff changeset
   137
        const char *profile = argv[1];
153
4410cc03dade Added finderrors.c to revision control.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   138
4410cc03dade Added finderrors.c to revision control.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   139
        for (i = 2; i < argc; i++)
170
9d71c08c756e Ripped out the multithreading from finderrors.c ...
Ryan C. Gordon <icculus@icculus.org>
parents: 169
diff changeset
   140
            total += do_dir(argv[i], profile);
153
4410cc03dade Added finderrors.c to revision control.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   141
4410cc03dade Added finderrors.c to revision control.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   142
        printf("Saw %d bytecode files.\n", total);
4410cc03dade Added finderrors.c to revision control.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   143
169
7e9d90724cf8 Push parsed shaders through GLSL compiler to see what breaks.
Ryan C. Gordon <icculus@icculus.org>
parents: 153
diff changeset
   144
        #if FINDERRORS_COMPILE_SHADERS
7e9d90724cf8 Push parsed shaders through GLSL compiler to see what breaks.
Ryan C. Gordon <icculus@icculus.org>
parents: 153
diff changeset
   145
        SDL_Quit();
7e9d90724cf8 Push parsed shaders through GLSL compiler to see what breaks.
Ryan C. Gordon <icculus@icculus.org>
parents: 153
diff changeset
   146
        #endif
153
4410cc03dade Added finderrors.c to revision control.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   147
    } // else
4410cc03dade Added finderrors.c to revision control.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   148
4410cc03dade Added finderrors.c to revision control.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   149
    return 0;
4410cc03dade Added finderrors.c to revision control.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   150
} // main
4410cc03dade Added finderrors.c to revision control.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   151
4410cc03dade Added finderrors.c to revision control.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   152
// end of finderrors.c ...
4410cc03dade Added finderrors.c to revision control.
Ryan C. Gordon <icculus@icculus.org>
parents:
diff changeset
   153