Navigation Menu

Skip to content

Commit

Permalink
Metal: Cleaned up output a little bit.
Browse files Browse the repository at this point in the history
  • Loading branch information
icculus committed May 17, 2016
1 parent 6ef95bd commit 62ab376
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions mojoshader.c
Expand Up @@ -4482,10 +4482,6 @@ static void emit_METAL_start(Context *ctx, const char *profilestr)
ctx->mainfn = StrDup(ctx, "FragmentShader");
} // if

push_output(ctx, &ctx->globals);
output_line(ctx, "using namespace metal;");
pop_output(ctx);

set_output(ctx, &ctx->mainline);
ctx->indent++;
} // emit_METAL_start
Expand Down Expand Up @@ -4551,9 +4547,12 @@ static void output_METAL_uniform_array(Context *ctx, const RegisterType regtype,
static void emit_METAL_finalize(Context *ctx)
{
// throw some blank lines around to make source more readable.
push_output(ctx, &ctx->globals);
output_blank_line(ctx);
pop_output(ctx);
if (ctx->globals) // don't add a blank line if the section is empty.
{
push_output(ctx, &ctx->globals);
output_blank_line(ctx);
pop_output(ctx);
} // if

// If we had a relative addressing of REG_TYPE_INPUT, we need to build
// an array for it at the start of main(). GLSL doesn't let you specify
Expand All @@ -4576,6 +4575,8 @@ static void emit_METAL_finalize(Context *ctx)
INC_METAL_HEADER(texture);
#undef INC_METAL_HEADER
output_blank_line(ctx);
output_line(ctx, "using namespace metal;");
output_blank_line(ctx);
pop_output(ctx);

// Fill in the shader's mainline function signature.
Expand Down

0 comments on commit 62ab376

Please sign in to comment.