Skip to content

Commit

Permalink
Added MOJOSHADER_maxShaderModel().
Browse files Browse the repository at this point in the history
  • Loading branch information
icculus committed Nov 8, 2008
1 parent 25ffe00 commit 40be294
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 1 deletion.
5 changes: 4 additions & 1 deletion availableprofiles.c
Expand Up @@ -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;
Expand Down
16 changes: 16 additions & 0 deletions mojoshader.c
Expand Up @@ -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 ...

5 changes: 5 additions & 0 deletions mojoshader.h
Expand Up @@ -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.
Expand Down

0 comments on commit 40be294

Please sign in to comment.