gallium: replace INLINE with inline
[mesa.git] / src / gallium / drivers / svga / svga_tgsi.c
index 56529c6487d5662dc3135c31a5d37d5909711184..2e2ff5e467381c6be96074ce3bc5bdb83228d9b2 100644 (file)
@@ -84,7 +84,7 @@ svga_shader_expand(struct svga_shader_emitter *emit)
 }
 
 
-static INLINE boolean
+static inline boolean
 reserve(struct svga_shader_emitter *emit, unsigned nr_dwords)
 {
    if (emit->ptr - emit->buf + nr_dwords * sizeof(unsigned) >= emit->size) {
@@ -264,11 +264,11 @@ svga_remap_generic_index(int8_t remap_table[MAX_GENERIC_VARYING],
  * can be dynamically grown.  Once we've finished and know how large
  * it is, it will be copied to a hardware buffer for upload.
  */
-static struct svga_shader_result *
+static struct svga_shader_variant *
 svga_tgsi_translate(const struct svga_shader *shader,
-                    struct svga_compile_key key, unsigned unit)
+                    const struct svga_compile_key *key, unsigned unit)
 {
-   struct svga_shader_result *result = NULL;
+   struct svga_shader_variant *variant = NULL;
    struct svga_shader_emitter emit;
 
    memset(&emit, 0, sizeof(emit));
@@ -281,17 +281,17 @@ svga_tgsi_translate(const struct svga_shader *shader,
 
    emit.ptr = emit.buf;
    emit.unit = unit;
-   emit.key = key;
+   emit.key = *key;
 
    tgsi_scan_shader(shader->tokens, &emit.info);
 
    emit.imm_start = emit.info.file_max[TGSI_FILE_CONSTANT] + 1;
 
    if (unit == PIPE_SHADER_FRAGMENT)
-      emit.imm_start += key.fkey.num_unnormalized_coords;
+      emit.imm_start += key->fkey.num_unnormalized_coords;
 
    if (unit == PIPE_SHADER_VERTEX) {
-      emit.imm_start += key.vkey.need_prescale ? 2 : 0;
+      emit.imm_start += key->vkey.need_prescale ? 2 : 0;
    }
 
    emit.nr_hw_float_const =
@@ -317,15 +317,15 @@ svga_tgsi_translate(const struct svga_shader *shader,
       goto fail;
    }
 
-   result = CALLOC_STRUCT(svga_shader_result);
-   if (result == NULL)
+   variant = CALLOC_STRUCT(svga_shader_variant);
+   if (variant == NULL)
       goto fail;
 
-   result->shader = shader;
-   result->tokens = (const unsigned *) emit.buf;
-   result->nr_tokens = (emit.ptr - emit.buf) / sizeof(unsigned);
-   memcpy(&result->key, &key, sizeof key);
-   result->id = UTIL_BITMASK_INVALID_INDEX;
+   variant->shader = shader;
+   variant->tokens = (const unsigned *) emit.buf;
+   variant->nr_tokens = (emit.ptr - emit.buf) / sizeof(unsigned);
+   memcpy(&variant->key, key, sizeof(*key));
+   variant->id = UTIL_BITMASK_INVALID_INDEX;
 
    if (SVGA_DEBUG & DEBUG_TGSI) {
       debug_printf("#####################################\n");
@@ -333,21 +333,21 @@ svga_tgsi_translate(const struct svga_shader *shader,
       tgsi_dump(shader->tokens, 0);
       if (SVGA_DEBUG & DEBUG_TGSI) {
          debug_printf("Shader %u compiled below\n", shader->id);
-         svga_shader_dump(result->tokens, result->nr_tokens, FALSE);
+         svga_shader_dump(variant->tokens, variant->nr_tokens, FALSE);
       }
       debug_printf("#####################################\n");
    }
 
-   return result;
+   return variant;
 
  fail:
-   FREE(result);
+   FREE(variant);
    FREE(emit.buf);
    return NULL;
 }
 
 
-struct svga_shader_result *
+struct svga_shader_variant *
 svga_translate_fragment_program(const struct svga_fragment_shader *fs,
                                 const struct svga_fs_compile_key *fkey)
 {
@@ -360,11 +360,11 @@ svga_translate_fragment_program(const struct svga_fragment_shader *fs,
    memcpy(key.generic_remap_table, fs->generic_remap_table,
           sizeof(fs->generic_remap_table));
 
-   return svga_tgsi_translate(&fs->base, key, PIPE_SHADER_FRAGMENT);
+   return svga_tgsi_translate(&fs->base, &key, PIPE_SHADER_FRAGMENT);
 }
 
 
-struct svga_shader_result *
+struct svga_shader_variant *
 svga_translate_vertex_program(const struct svga_vertex_shader *vs,
                               const struct svga_vs_compile_key *vkey)
 {
@@ -379,13 +379,5 @@ svga_translate_vertex_program(const struct svga_vertex_shader *vs,
     */
    svga_remap_generics(vkey->fs_generic_inputs, key.generic_remap_table);
 
-   return svga_tgsi_translate(&vs->base, key, PIPE_SHADER_VERTEX);
-}
-
-
-void
-svga_destroy_shader_result(struct svga_shader_result *result)
-{
-   FREE((unsigned *) result->tokens);
-   FREE(result);
+   return svga_tgsi_translate(&vs->base, &key, PIPE_SHADER_VERTEX);
 }