meta: Refactor texture format translation
[mesa.git] / src / mesa / program / ir_to_mesa.cpp
index 0089e80faa37d5c6e611e2646a9157d4b50b6e27..0ae797f1ecab41dd81eb53c43a1f61cbd3aad375 100644 (file)
@@ -532,6 +532,12 @@ type_size(const struct glsl_type *type)
             return 1;
       }
       break;
+   case GLSL_TYPE_UINT64:
+   case GLSL_TYPE_INT64:
+      if (type->vector_elements > 2)
+         return 2;
+      else
+         return 1;
    case GLSL_TYPE_ARRAY:
       assert(type->length > 0);
       return type_size(type->fields.array) * type->length;
@@ -1376,6 +1382,34 @@ ir_to_mesa_visitor::visit(ir_expression *ir)
    case ir_unop_vote_any:
    case ir_unop_vote_all:
    case ir_unop_vote_eq:
+   case ir_unop_bitcast_u642d:
+   case ir_unop_bitcast_i642d:
+   case ir_unop_bitcast_d2u64:
+   case ir_unop_bitcast_d2i64:
+   case ir_unop_i642i:
+   case ir_unop_u642i:
+   case ir_unop_i642u:
+   case ir_unop_u642u:
+   case ir_unop_i642b:
+   case ir_unop_i642f:
+   case ir_unop_u642f:
+   case ir_unop_i642d:
+   case ir_unop_u642d:
+   case ir_unop_i2i64:
+   case ir_unop_u2i64:
+   case ir_unop_b2i64:
+   case ir_unop_f2i64:
+   case ir_unop_d2i64:
+   case ir_unop_i2u64:
+   case ir_unop_u2u64:
+   case ir_unop_f2u64:
+   case ir_unop_d2u64:
+   case ir_unop_u642i64:
+   case ir_unop_i642u64:
+   case ir_unop_pack_int_2x32:
+   case ir_unop_unpack_int_2x32:
+   case ir_unop_pack_uint_2x32:
+   case ir_unop_unpack_uint_2x32:
       assert(!"not supported");
       break;
 
@@ -2522,11 +2556,19 @@ _mesa_associate_uniform_storage(struct gl_context *ctx,
         unsigned columns = 0;
         int dmul = 4 * sizeof(float);
         switch (storage->type->base_type) {
+         case GLSL_TYPE_UINT64:
+           if (storage->type->vector_elements > 2)
+               dmul *= 2;
+           /* fallthrough */
         case GLSL_TYPE_UINT:
            assert(ctx->Const.NativeIntegers);
            format = uniform_native;
            columns = 1;
            break;
+         case GLSL_TYPE_INT64:
+           if (storage->type->vector_elements > 2)
+               dmul *= 2;
+           /* fallthrough */
         case GLSL_TYPE_INT:
            format =
               (ctx->Const.NativeIntegers) ? uniform_native : uniform_int_float;
@@ -2917,9 +2959,8 @@ get_mesa_program(struct gl_context *ctx,
 
    do_set_program_inouts(shader->ir, prog, shader->Stage);
 
-   prog->SamplersUsed = shader->active_samplers;
    prog->ShadowSamplers = shader->shadow_samplers;
-   prog->ExternalSamplersUsed = gl_external_samplers(shader);
+   prog->ExternalSamplersUsed = gl_external_samplers(prog);
    _mesa_update_shader_textures_used(shader_program, prog);
 
    /* Set the gl_FragDepth layout. */