#include "main/mtypes.h"
#include "main/shaderobj.h"
+#include "main/uniforms.h"
#include "program/hash_table.h"
extern "C" {
#include "main/shaderapi.h"
-#include "main/uniforms.h"
#include "program/prog_instruction.h"
#include "program/prog_optimize.h"
#include "program/prog_print.h"
#include "program/sampler.h"
}
+static int swizzle_for_size(int size);
+
+namespace {
+
class src_reg;
class dst_reg;
-static int swizzle_for_size(int size);
-
/**
* This struct is a corresponding struct to Mesa prog_src_register, with
* wider fields.
src_reg *reladdr;
};
+} /* anonymous namespace */
+
src_reg::src_reg(dst_reg reg)
{
this->file = reg.file;
this->reladdr = reg.reladdr;
}
+namespace {
+
class ir_to_mesa_instruction : public exec_node {
public:
- /* Callers of this ralloc-based new need not call delete. It's
- * easier to just ralloc_free 'ctx' (or any of its ancestors). */
- static void* operator new(size_t size, void *ctx)
- {
- void *node;
-
- node = rzalloc_size(ctx, size);
- assert(node != NULL);
-
- return node;
- }
+ DECLARE_RALLOC_CXX_OPERATORS(ir_to_mesa_instruction)
enum prog_opcode op;
dst_reg dst;
void *mem_ctx;
};
+} /* anonymous namespace */
+
static src_reg undef_src = src_reg(PROGRAM_UNDEFINED, 0, NULL);
static dst_reg undef_dst = dst_reg(PROGRAM_UNDEFINED, SWIZZLE_NOOP);
* at link time.
*/
return 1;
+ case GLSL_TYPE_ATOMIC_UINT:
case GLSL_TYPE_VOID:
case GLSL_TYPE_ERROR:
case GLSL_TYPE_INTERFACE:
const ir_function_signature *sig;
exec_list empty;
- sig = ir->matching_signature(&empty);
+ sig = ir->matching_signature(NULL, &empty);
assert(sig);
case ir_binop_vector_extract:
case ir_binop_bfm:
+ case ir_triop_fma:
case ir_triop_bfi:
case ir_triop_bitfield_extract:
case ir_triop_vector_insert:
case ir_quadop_bitfield_insert:
+ case ir_binop_ldexp:
+ case ir_triop_csel:
+ case ir_binop_carry:
+ case ir_binop_borrow:
+ case ir_binop_imul_high:
assert(!"not supported");
break;
case ir_lod:
assert(!"Unexpected ir_lod opcode");
break;
+ case ir_tg4:
+ assert(!"Unexpected ir_tg4 opcode");
+ break;
+ case ir_query_levels:
+ assert(!"Unexpected ir_query_levels opcode");
+ break;
}
const glsl_type *sampler_type = ir->sampler->type;
visit_exec_list(&ir->else_instructions, this);
}
- if_inst = emit(ir->condition, OPCODE_ENDIF);
+ emit(ir->condition, OPCODE_ENDIF);
}
void
}
}
+namespace {
+
class add_uniform_to_shader : public program_resource_visitor {
public:
add_uniform_to_shader(struct gl_shader_program *shader_program,
gl_shader_type shader_type;
};
+} /* anonymous namespace */
+
void
add_uniform_to_shader::visit_field(const glsl_type *type, const char *name,
bool row_major)
format = uniform_native;
columns = 1;
break;
+ case GLSL_TYPE_ATOMIC_UINT:
case GLSL_TYPE_ARRAY:
case GLSL_TYPE_VOID:
case GLSL_TYPE_STRUCT:
linked_prog = get_mesa_program(ctx, prog, prog->_LinkedShaders[i]);
if (linked_prog) {
- if (i == MESA_SHADER_VERTEX) {
- ((struct gl_vertex_program *)linked_prog)->UsesClipDistance
- = prog->Vert.UsesClipDistance;
- }
+ _mesa_copy_linked_program_data((gl_shader_type) i, prog, linked_prog);
_mesa_reference_program(ctx, &prog->_LinkedShaders[i]->Program,
linked_prog);