From 7b5803f3848f24ad62fc1da31ecee36e2be2d4c9 Mon Sep 17 00:00:00 2001 From: icculus Date: Sat, 22 Mar 2008 00:02:25 -0400 Subject: [PATCH] [svn] Might as well keep the tradition alive. --HG-- branch : trunk --- CMakeLists.txt | 5 +++-- d3d2glsl.c | 27 ++++++++++++++------------- d3d2glsl.h | 27 ++++++++++++++------------- 3 files changed, 31 insertions(+), 28 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 30ddf58d..83166e55 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,6 @@ -PROJECT(d3d2glsl) -ADD_EXECUTABLE(testparse testparse.c d3d2glsl.c) +CMAKE_MINIMUM_REQUIRED(VERSION 2.4) +PROJECT(MojoShader) +ADD_EXECUTABLE(testparse testparse.c mojoshader.c) # End of CMakeLists.txt ... diff --git a/d3d2glsl.c b/d3d2glsl.c index b0268630..4a2ba6ae 100644 --- a/d3d2glsl.c +++ b/d3d2glsl.c @@ -1,5 +1,6 @@ /** - * d3d2glsl; generate GLSL programs from bytecode of compiled Direct3D shaders. + * MojoShader; generate shader programs from bytecode of compiled + * Direct3D shaders. * * Please see the file LICENSE.txt in the source's root directory. * @@ -21,7 +22,7 @@ #include #include -#include "d3d2glsl.h" +#include "mojoshader.h" // This is the highest shader version we currently support. @@ -263,8 +264,8 @@ typedef struct // Context...this is state that changes as we parse through a shader... struct Context { - D3D2GLSL_malloc malloc; - D3D2GLSL_free free; + MOJOSHADER_malloc malloc; + MOJOSHADER_free free; const uint32 *tokens; uint32 tokencount; OutputList output; @@ -2272,7 +2273,7 @@ static int find_profile_id(const char *profile) static Context *build_context(const char *profile, const unsigned char *tokenbuf, const unsigned int bufsize, - D3D2GLSL_malloc m, D3D2GLSL_free f) + MOJOSHADER_malloc m, MOJOSHADER_free f) { if (m == NULL) m = internal_malloc; if (f == NULL) f = internal_free; @@ -2347,9 +2348,9 @@ static char *build_output(Context *ctx) // API entry point... -int D3D2GLSL_parse(const char *profile, const unsigned char *tokenbuf, - const unsigned int bufsize, D3D2GLSL_malloc m, - D3D2GLSL_free f) +int MOJOSHADER_parse(const char *profile, const unsigned char *tokenbuf, + const unsigned int bufsize, MOJOSHADER_malloc m, + MOJOSHADER_free f) { int rc = FAIL; @@ -2392,13 +2393,13 @@ int D3D2GLSL_parse(const char *profile, const unsigned char *tokenbuf, destroy_context(ctx); return (rc == END_OF_STREAM); -} // D3D2GLSL_parse +} // MOJOSHADER_parse -int D3D2GLSL_version(void) +int MOJOSHADER_version(void) { - return D3D2GLSL_VERSION; -} // D3D2GLSL_version + return MOJOSHADER_VERSION; +} // MOJOSHADER_version -// end of d3d2glsl.c ... +// end of mojoshader.c ... diff --git a/d3d2glsl.h b/d3d2glsl.h index 6f79c82f..901fb60c 100644 --- a/d3d2glsl.h +++ b/d3d2glsl.h @@ -1,38 +1,39 @@ /** - * d3d2glsl; generate GLSL programs from bytecode of compiled Direct3D shaders. + * MojoShader; generate shader programs from bytecode of compiled + * Direct3D shaders. * * Please see the file LICENSE.txt in the source's root directory. * * This file written by Ryan C. Gordon. */ -#ifndef __INCL_D3D2GLSL_H_ -#define __INCL_D3D2GLSL_H_ +#ifndef __INCL_MOJOSHADER_H_ +#define __INCL_MOJOSHADER_H_ #ifdef __cplusplus extern "C" { #endif /* - * const int compiled_against = D3D2GLSL_VERSION; - * const int linked_against = D3D2GLSL_version(); + * const int compiled_against = MOJOSHADER_VERSION; + * const int linked_against = MOJOSHADER_version(); */ -#define D3D2GLSL_VERSION 1 -int D3D2GLSL_version(void); +#define MOJOSHADER_VERSION 1 +int MOJOSHADER_version(void); /* * These allocators work just like the C runtime's malloc() and free() * (in fact, they use malloc() and free() internally if you don't * specify your own allocator). */ -typedef void *(*D3D2GLSL_malloc)(int bytes); -typedef void (*D3D2GLSL_free)(void *ptr); +typedef void *(*MOJOSHADER_malloc)(int bytes); +typedef void (*MOJOSHADER_free)(void *ptr); /* !!! FIXME: documentation. */ /* !!! FIXME: this needs to change to return a buffer of GLSL code. */ -int D3D2GLSL_parse(const char *profile, const unsigned char *tokenbuf, - const unsigned int bufsize, D3D2GLSL_malloc m, - D3D2GLSL_free f); +int MOJOSHADER_parse(const char *profile, const unsigned char *tokenbuf, + const unsigned int bufsize, MOJOSHADER_malloc m, + MOJOSHADER_free f); #ifdef __cplusplus } @@ -40,5 +41,5 @@ int D3D2GLSL_parse(const char *profile, const unsigned char *tokenbuf, #endif /* include-once blocker. */ -/* end of d3d2glsl.h ... */ +/* end of mojoshader.h ... */