Moved some booleans to true bitfields. trunk
authorRyan C. Gordon <icculus@icculus.org>
Wed, 18 Jun 2008 01:22:34 -0400
branchtrunk
changeset 362 1aa8a74bb5a5
parent 361 9fa6652cacbd
child 363 bea8bf9e5536
Moved some booleans to true bitfields.
mojoshader.c
mojoshader_opengl.c
--- a/mojoshader.c	Wed Jun 18 01:18:26 2008 -0400
+++ b/mojoshader.c	Wed Jun 18 01:22:34 2008 -0400
@@ -320,14 +320,6 @@
 } SourceArgInfo;
 
 
-// !!! FIXME: get rid of this. use a bitfield instead.
-typedef enum
-{
-    // Specific to GLSL profile...
-    CTX_FLAGS_GLSL_LIT_OPCODE = (1 << 0),
-    CTX_FLAGS_MASK = 0xFFFFFFFF
-} ContextFlags;
-
 
 #define SCRATCH_BUFFER_SIZE 128
 #define SCRATCH_BUFFERS 32
@@ -375,11 +367,7 @@
     int instruction_count;
     uint32 instruction_controls;
     uint32 previous_opcode;
-    ContextFlags flags;
-    int predicated;
     int max_constreg;
-    int uniform_array;
-    int support_nv2;
     int loops;
     int reps;
     int cmps;
@@ -397,6 +385,10 @@
     RegisterList attributes;
     int sampler_count;
     RegisterList samplers;
+    int predicated:1;
+    int uniform_array:1;
+    int support_nv2:1;
+    int glsl_generated_lit_opcode:1;
 };
 
 
@@ -2648,10 +2640,10 @@
 {
     const char *maxp = "127.9961f"; // value from the dx9 reference.
 
-    if (ctx->flags & CTX_FLAGS_GLSL_LIT_OPCODE)
+    if (ctx->glsl_generated_lit_opcode)
         return;
 
-    ctx->flags = (ContextFlags) (ctx->flags | CTX_FLAGS_GLSL_LIT_OPCODE);
+    ctx->glsl_generated_lit_opcode = 1;
 
     push_output(ctx, &ctx->helpers);
     output_line(ctx, "const vec4 LIT(const vec4 src)");
--- a/mojoshader_opengl.c	Wed Jun 18 01:18:26 2008 -0400
+++ b/mojoshader_opengl.c	Wed Jun 18 01:22:34 2008 -0400
@@ -140,16 +140,16 @@
     char profile[16];
 
     // Extensions...
-    int have_base_opengl;
-    int have_GL_ARB_vertex_program;
-    int have_GL_ARB_fragment_program;
-    int have_GL_NV_vertex_program2_option;
-    int have_GL_NV_fragment_program2;
-    int have_GL_ARB_shader_objects;
-    int have_GL_ARB_vertex_shader;
-    int have_GL_ARB_fragment_shader;
-    int have_GL_ARB_shading_language_100;
-    int have_GL_NV_half_float;
+    int have_base_opengl:1;
+    int have_GL_ARB_vertex_program:1;
+    int have_GL_ARB_fragment_program:1;
+    int have_GL_NV_vertex_program2_option:1;
+    int have_GL_NV_fragment_program2:1;
+    int have_GL_ARB_shader_objects:1;
+    int have_GL_ARB_vertex_shader:1;
+    int have_GL_ARB_fragment_shader:1;
+    int have_GL_ARB_shading_language_100:1;
+    int have_GL_NV_half_float:1;
 
     // Entry points...
     PFNGLGETSTRINGPROC glGetString;