Renamed "passthrough" profile to "bytecode"
authorRyan C. Gordon <icculus@icculus.org>
Sat, 06 Dec 2008 21:20:03 -0500
changeset 469 b8cfaae6c4af
parent 468 28f28973ee80
child 470 7d84d3452125
Renamed "passthrough" profile to "bytecode"
mojoshader.c
mojoshader.h
--- a/mojoshader.c	Sat Dec 06 21:19:29 2008 -0500
+++ b/mojoshader.c	Sat Dec 06 21:20:03 2008 -0500
@@ -1443,41 +1443,41 @@
 #endif  // SUPPORT_PROFILE_D3D
 
 
-#if !SUPPORT_PROFILE_PASSTHROUGH
-#define PROFILE_EMITTER_PASSTHROUGH(op)
+#if !SUPPORT_PROFILE_BYTECODE
+#define PROFILE_EMITTER_BYTECODE(op)
 #else
 #undef AT_LEAST_ONE_PROFILE
 #define AT_LEAST_ONE_PROFILE 1
-#define PROFILE_EMITTER_PASSTHROUGH(op) emit_PASSTHROUGH_##op,
-
-static void emit_PASSTHROUGH_start(Context *ctx, const char *profilestr)
+#define PROFILE_EMITTER_BYTECODE(op) emit_BYTECODE_##op,
+
+static void emit_BYTECODE_start(Context *ctx, const char *profilestr)
 {
     // just copy the whole token stream and make all other emitters no-ops.
     ctx->output_len = (ctx->tokencount * sizeof (uint32));
     ctx->output_bytes = (uint8 *) Malloc(ctx, ctx->output_len);
     if (ctx->output_bytes != NULL)
         memcpy(ctx->output_bytes, ctx->tokens, ctx->output_len);
-} // emit_PASSTHROUGH_start
-
-static void emit_PASSTHROUGH_end(Context *ctx)
+} // emit_BYTECODE_start
+
+static void emit_BYTECODE_end(Context *ctx)
 {
     // no-op in this profile.
-} // emit_PASSTHROUGH_end
-
-static void emit_PASSTHROUGH_phase(Context *ctx) {}
-static void emit_PASSTHROUGH_finalize(Context *ctx) {}
-static void emit_PASSTHROUGH_global(Context *ctx, RegisterType t, int n) {}
-static void emit_PASSTHROUGH_array(Context *ctx, int base, int size) {}
-static void emit_PASSTHROUGH_sampler(Context *ctx, int s, TextureType ttype) {}
-static void emit_PASSTHROUGH_const_array(Context *ctx, const ConstantsList *c,
+} // emit_BYTECODE_end
+
+static void emit_BYTECODE_phase(Context *ctx) {}
+static void emit_BYTECODE_finalize(Context *ctx) {}
+static void emit_BYTECODE_global(Context *ctx, RegisterType t, int n) {}
+static void emit_BYTECODE_array(Context *ctx, int base, int size) {}
+static void emit_BYTECODE_sampler(Context *ctx, int s, TextureType ttype) {}
+static void emit_BYTECODE_const_array(Context *ctx, const ConstantsList *c,
                                          int base, int size) {}
-static void emit_PASSTHROUGH_uniform(Context *ctx, RegisterType t, int n,
+static void emit_BYTECODE_uniform(Context *ctx, RegisterType t, int n,
                                      int arraybase, int arraysize) {}
-static void emit_PASSTHROUGH_attribute(Context *ctx, RegisterType t, int n,
+static void emit_BYTECODE_attribute(Context *ctx, RegisterType t, int n,
                                        MOJOSHADER_usage u, int i, int w,
                                        int f) {}
 
-static const char *get_PASSTHROUGH_varname(Context *ctx, RegisterType rt, int regnum)
+static const char *get_BYTECODE_varname(Context *ctx, RegisterType rt, int regnum)
 {
     char regnum_str[16];
     const char *regtype_str = get_D3D_register_string(ctx, rt, regnum,
@@ -1486,104 +1486,104 @@
     char *retval = get_scratch_buffer(ctx);
     snprintf(retval, SCRATCH_BUFFER_SIZE, "%s%s", regtype_str, regnum_str);
     return retval;
-} // get_PASSTHROUGH_varname
-
-static const char *get_PASSTHROUGH_const_array_varname(Context *ctx, int base, int size)
+} // get_BYTECODE_varname
+
+static const char *get_BYTECODE_const_array_varname(Context *ctx, int base, int size)
 {
     char *retval = get_scratch_buffer(ctx);
     snprintf(retval, SCRATCH_BUFFER_SIZE, "c_array_%d_%d", base, size);
     return retval;
-} // get_PASSTHROUGH_const_array_varname
-
-#define EMIT_PASSTHROUGH_OPCODE_FUNC(op) \
-    static void emit_PASSTHROUGH_##op(Context *ctx) {}
-
-EMIT_PASSTHROUGH_OPCODE_FUNC(RESERVED)
-EMIT_PASSTHROUGH_OPCODE_FUNC(NOP)
-EMIT_PASSTHROUGH_OPCODE_FUNC(MOV)
-EMIT_P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TEXM3X3)
-EMIT_PASSTHROUGH_OPCODE_FUNC(TEXDEPTH)
-EMIT_PASSTHROUGH_OPCODE_FUNC(CMP)
-EMIT_PASSTHROUGH_OPCODE_FUNC(BEM)
-EMIT_PASSTHROUGH_OPCODE_FUNC(DP2ADD)
-EMIT_PASSTHROUGH_OPCODE_FUNC(DSX)
-EMIT_PASSTHROUGH_OPCODE_FUNC(DSY)
-EMIT_PASSTHROUGH_OPCODE_FUNC(TEXLDD)
-EMIT_PASSTHROUGH_OPCODE_FUNC(TEXLDL)
-EMIT_PASSTHROUGH_OPCODE_FUNC(BREAKP)
-EMIT_PASSTHROUGH_OPCODE_FUNC(BREAKC)
-EMIT_PASSTHROUGH_OPCODE_FUNC(IFC)
-EMIT_PASSTHROUGH_OPCODE_FUNC(SETP)
-EMIT_PASSTHROUGH_OPCODE_FUNC(DEF)
-EMIT_PASSTHROUGH_OPCODE_FUNC(DEFI)
-EMIT_PASSTHROUGH_OPCODE_FUNC(DEFB)
-EMIT_PASSTHROUGH_OPCODE_FUNC(DCL)
-EMIT_PASSTHROUGH_OPCODE_FUNC(TEXCRD)
-EMIT_PASSTHROUGH_OPCODE_FUNC(TEXLD)
-
-#undef EMIT_PASSTHROUGH_OPCODE_FUNC
-
-#endif  // SUPPORT_PROFILE_PASSTHROUGH
+} // get_BYTECODE_const_array_varname
+
+#define EMIT_BYTECODE_OPCODE_FUNC(op) \
+    static void emit_BYTECODE_##op(Context *ctx) {}
+
+EMIT_BYTECODE_OPCODE_FUNC(RESERVED)
+EMIT_BYTECODE_OPCODE_FUNC(NOP)
+EMIT_BYTECODE_OPCODE_FUNC(MOV)
+EMIT_BYTECODE_OPCODE_FUNC(ADD)
+EMIT_BYTECODE_OPCODE_FUNC(SUB)
+EMIT_BYTECODE_OPCODE_FUNC(MAD)
+EMIT_BYTECODE_OPCODE_FUNC(MUL)
+EMIT_BYTECODE_OPCODE_FUNC(RCP)
+EMIT_BYTECODE_OPCODE_FUNC(RSQ)
+EMIT_BYTECODE_OPCODE_FUNC(DP3)
+EMIT_BYTECODE_OPCODE_FUNC(DP4)
+EMIT_BYTECODE_OPCODE_FUNC(MIN)
+EMIT_BYTECODE_OPCODE_FUNC(MAX)
+EMIT_BYTECODE_OPCODE_FUNC(SLT)
+EMIT_BYTECODE_OPCODE_FUNC(SGE)
+EMIT_BYTECODE_OPCODE_FUNC(EXP)
+EMIT_BYTECODE_OPCODE_FUNC(LOG)
+EMIT_BYTECODE_OPCODE_FUNC(LIT)
+EMIT_BYTECODE_OPCODE_FUNC(DST)
+EMIT_BYTECODE_OPCODE_FUNC(LRP)
+EMIT_BYTECODE_OPCODE_FUNC(FRC)
+EMIT_BYTECODE_OPCODE_FUNC(M4X4)
+EMIT_BYTECODE_OPCODE_FUNC(M4X3)
+EMIT_BYTECODE_OPCODE_FUNC(M3X4)
+EMIT_BYTECODE_OPCODE_FUNC(M3X3)
+EMIT_BYTECODE_OPCODE_FUNC(M3X2)
+EMIT_BYTECODE_OPCODE_FUNC(CALL)
+EMIT_BYTECODE_OPCODE_FUNC(CALLNZ)
+EMIT_BYTECODE_OPCODE_FUNC(LOOP)
+EMIT_BYTECODE_OPCODE_FUNC(RET)
+EMIT_BYTECODE_OPCODE_FUNC(ENDLOOP)
+EMIT_BYTECODE_OPCODE_FUNC(LABEL)
+EMIT_BYTECODE_OPCODE_FUNC(POW)
+EMIT_BYTECODE_OPCODE_FUNC(CRS)
+EMIT_BYTECODE_OPCODE_FUNC(SGN)
+EMIT_BYTECODE_OPCODE_FUNC(ABS)
+EMIT_BYTECODE_OPCODE_FUNC(NRM)
+EMIT_BYTECODE_OPCODE_FUNC(SINCOS)
+EMIT_BYTECODE_OPCODE_FUNC(REP)
+EMIT_BYTECODE_OPCODE_FUNC(ENDREP)
+EMIT_BYTECODE_OPCODE_FUNC(IF)
+EMIT_BYTECODE_OPCODE_FUNC(ELSE)
+EMIT_BYTECODE_OPCODE_FUNC(ENDIF)
+EMIT_BYTECODE_OPCODE_FUNC(BREAK)
+EMIT_BYTECODE_OPCODE_FUNC(MOVA)
+EMIT_BYTECODE_OPCODE_FUNC(TEXKILL)
+EMIT_BYTECODE_OPCODE_FUNC(TEXBEM)
+EMIT_BYTECODE_OPCODE_FUNC(TEXBEML)
+EMIT_BYTECODE_OPCODE_FUNC(TEXREG2AR)
+EMIT_BYTECODE_OPCODE_FUNC(TEXREG2GB)
+EMIT_BYTECODE_OPCODE_FUNC(TEXM3X2PAD)
+EMIT_BYTECODE_OPCODE_FUNC(TEXM3X2TEX)
+EMIT_BYTECODE_OPCODE_FUNC(TEXM3X3PAD)
+EMIT_BYTECODE_OPCODE_FUNC(TEXM3X3TEX)
+EMIT_BYTECODE_OPCODE_FUNC(TEXM3X3SPEC)
+EMIT_BYTECODE_OPCODE_FUNC(TEXM3X3VSPEC)
+EMIT_BYTECODE_OPCODE_FUNC(EXPP)
+EMIT_BYTECODE_OPCODE_FUNC(LOGP)
+EMIT_BYTECODE_OPCODE_FUNC(CND)
+EMIT_BYTECODE_OPCODE_FUNC(TEXREG2RGB)
+EMIT_BYTECODE_OPCODE_FUNC(TEXDP3TEX)
+EMIT_BYTECODE_OPCODE_FUNC(TEXM3X2DEPTH)
+EMIT_BYTECODE_OPCODE_FUNC(TEXDP3)
+EMIT_BYTECODE_OPCODE_FUNC(TEXM3X3)
+EMIT_BYTECODE_OPCODE_FUNC(TEXDEPTH)
+EMIT_BYTECODE_OPCODE_FUNC(CMP)
+EMIT_BYTECODE_OPCODE_FUNC(BEM)
+EMIT_BYTECODE_OPCODE_FUNC(DP2ADD)
+EMIT_BYTECODE_OPCODE_FUNC(DSX)
+EMIT_BYTECODE_OPCODE_FUNC(DSY)
+EMIT_BYTECODE_OPCODE_FUNC(TEXLDD)
+EMIT_BYTECODE_OPCODE_FUNC(TEXLDL)
+EMIT_BYTECODE_OPCODE_FUNC(BREAKP)
+EMIT_BYTECODE_OPCODE_FUNC(BREAKC)
+EMIT_BYTECODE_OPCODE_FUNC(IFC)
+EMIT_BYTECODE_OPCODE_FUNC(SETP)
+EMIT_BYTECODE_OPCODE_FUNC(DEF)
+EMIT_BYTECODE_OPCODE_FUNC(DEFI)
+EMIT_BYTECODE_OPCODE_FUNC(DEFB)
+EMIT_BYTECODE_OPCODE_FUNC(DCL)
+EMIT_BYTECODE_OPCODE_FUNC(TEXCRD)
+EMIT_BYTECODE_OPCODE_FUNC(TEXLD)
+
+#undef EMIT_BYTECODE_OPCODE_FUNC
+
+#endif  // SUPPORT_PROFILE_BYTECODE
 
 
 #if !SUPPORT_PROFILE_GLSL
@@ -4872,8 +4872,8 @@
 #if SUPPORT_PROFILE_D3D
     DEFINE_PROFILE(D3D)
 #endif
-#if SUPPORT_PROFILE_PASSTHROUGH
-    DEFINE_PROFILE(PASSTHROUGH)
+#if SUPPORT_PROFILE_BYTECODE
+    DEFINE_PROFILE(BYTECODE)
 #endif
 #if SUPPORT_PROFILE_GLSL
     DEFINE_PROFILE(GLSL)
@@ -4898,7 +4898,7 @@
 // The PROFILE_EMITTER_* items MUST be in the same order as profiles[]!
 #define PROFILE_EMITTERS(op) { \
      PROFILE_EMITTER_D3D(op) \
-     PROFILE_EMITTER_PASSTHROUGH(op) \
+     PROFILE_EMITTER_BYTECODE(op) \
      PROFILE_EMITTER_GLSL(op) \
      PROFILE_EMITTER_ARB1(op) \
 }
@@ -7401,7 +7401,7 @@
 {
     #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_BYTECODE, 3);
     PROFILE_SHADER_MODEL(MOJOSHADER_PROFILE_GLSL, 3);
     PROFILE_SHADER_MODEL(MOJOSHADER_PROFILE_GLSL120, 3);
     PROFILE_SHADER_MODEL(MOJOSHADER_PROFILE_ARB1, 2);
--- a/mojoshader.h	Sat Dec 06 21:19:29 2008 -0500
+++ b/mojoshader.h	Sat Dec 06 21:20:03 2008 -0500
@@ -387,7 +387,7 @@
 /*
  * Profile string for passthrough of the original bytecode, unchanged.
  */
-#define MOJOSHADER_PROFILE_PASSTHROUGH "passthrough"
+#define MOJOSHADER_PROFILE_BYTECODE "bytecode"
 
 /*
  * Profile string for GLSL: OpenGL high-level shader language output.