Skip to content

Commit

Permalink
Add getError to effectShaderContext
Browse files Browse the repository at this point in the history
  • Loading branch information
flibitijibibo committed Jun 25, 2020
1 parent 00e7c6b commit 62c954f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
12 changes: 12 additions & 0 deletions mojoshader_effects.c
Expand Up @@ -686,6 +686,12 @@ static void readsmallobjects(const uint32 numsmallobjects,
object->shader.shader = effect->ctx.compileShader(mainfn, *ptr, length,
swiz, swizcount,
smap, smapcount);
if (object->shader.shader == NULL)
{
// Bail ASAP, so we can get the error to the application
errorlist_add(errors, NULL, 0, effect->ctx.getError());
return;
} // if
pd = effect->ctx.getParseData(object->shader.shader);
if (pd->error_count > 0)
{
Expand Down Expand Up @@ -816,6 +822,12 @@ static void readlargeobjects(const uint32 numlargeobjects,
object->shader.shader = effect->ctx.compileShader(mainfn, *ptr, length,
swiz, swizcount,
smap, smapcount);
if (object->shader.shader == NULL)
{
// Bail ASAP, so we can get the error to the application
errorlist_add(errors, NULL, 0, effect->ctx.getError());
return;
} // if
pd = effect->ctx.getParseData(object->shader.shader);
if (pd->error_count > 0)
{
Expand Down
2 changes: 2 additions & 0 deletions mojoshader_effects.h
Expand Up @@ -506,6 +506,7 @@ typedef void (MOJOSHADERCALL * MOJOSHADER_mapUniformBufferMemoryFunc)(
float **psf, int **psi, unsigned char **psb
);
typedef void (MOJOSHADERCALL * MOJOSHADER_unmapUniformBufferMemoryFunc)();
typedef const char* (MOJOSHADERCALL * MOJOSHADER_getErrorFunc)();

typedef struct MOJOSHADER_effectShaderContext
{
Expand All @@ -518,6 +519,7 @@ typedef struct MOJOSHADER_effectShaderContext
MOJOSHADER_getBoundShadersFunc getBoundShaders;
MOJOSHADER_mapUniformBufferMemoryFunc mapUniformBufferMemory;
MOJOSHADER_unmapUniformBufferMemoryFunc unmapUniformBufferMemory;
MOJOSHADER_getErrorFunc getError;

/* Allocator */
MOJOSHADER_malloc m;
Expand Down

0 comments on commit 62c954f

Please sign in to comment.