Skip to content
Permalink
Browse files
Added MOJOSHADER_maxShaderModel().
  • Loading branch information
icculus committed Nov 8, 2008
1 parent 25ffe00 commit 40be294476437b5cbdd358ac817061c0435cfa75
Showing with 25 additions and 1 deletion.
  1. +4 −1 availableprofiles.c
  2. +16 −0 mojoshader.c
  3. +5 −0 mojoshader.h
@@ -27,7 +27,10 @@ static int check_available(void)
{
int i;
for (i = 0; i < total; i++)
printf("%s\n", avail[i]);
{
printf("%s (Shader Model %d)\n", avail[i],
MOJOSHADER_maxShaderModel(avail[i]));
} // for
} // else

return 0;
@@ -7708,5 +7708,21 @@ const char *MOJOSHADER_changeset(void)
return MOJOSHADER_CHANGESET;
} // MOJOSHADER_changeset


int MOJOSHADER_maxShaderModel(const char *profile)
{
#define PROFILE_SHADER_MODEL(p,v) if (strcmp(profile, p) == 0) return v;
PROFILE_SHADER_MODEL(MOJOSHADER_PROFILE_D3D, 3);
PROFILE_SHADER_MODEL(MOJOSHADER_PROFILE_PASSTHROUGH, 3);
PROFILE_SHADER_MODEL(MOJOSHADER_PROFILE_GLSL, 3);
PROFILE_SHADER_MODEL(MOJOSHADER_PROFILE_GLSL120, 3);
PROFILE_SHADER_MODEL(MOJOSHADER_PROFILE_ARB1, 2);
PROFILE_SHADER_MODEL(MOJOSHADER_PROFILE_NV2, 2);
PROFILE_SHADER_MODEL(MOJOSHADER_PROFILE_NV3, 2);
PROFILE_SHADER_MODEL(MOJOSHADER_PROFILE_NV4, 3);
#undef PROFILE_SHADER_MODEL
return -1; // unknown profile?
} // MOJOSHADER_maxShaderModel

// end of mojoshader.c ...

@@ -417,6 +417,11 @@ typedef struct
*/
#define MOJOSHADER_PROFILE_NV4 "nv4"

/*
* Determine the highest supported Shader Model for a profile.
*/
int MOJOSHADER_maxShaderModel(const char *profile);


/*
* Parse a compiled Direct3D shader's bytecode.

0 comments on commit 40be294

Please sign in to comment.