diff options
Diffstat (limited to 'mesalib/src/mesa/program')
-rw-r--r-- | mesalib/src/mesa/program/ir_to_mesa.cpp | 49 | ||||
-rw-r--r-- | mesalib/src/mesa/program/program.c | 32 |
2 files changed, 52 insertions, 29 deletions
diff --git a/mesalib/src/mesa/program/ir_to_mesa.cpp b/mesalib/src/mesa/program/ir_to_mesa.cpp index 0f7439b3b..cd89171da 100644 --- a/mesalib/src/mesa/program/ir_to_mesa.cpp +++ b/mesalib/src/mesa/program/ir_to_mesa.cpp @@ -623,10 +623,14 @@ type_size(const struct glsl_type *type) * at link time. */ return 1; - default: - assert(0); - return 0; + case GLSL_TYPE_VOID: + case GLSL_TYPE_ERROR: + case GLSL_TYPE_INTERFACE: + assert(!"Invalid type in type_size"); + break; } + + return 0; } /** @@ -1427,7 +1431,21 @@ ir_to_mesa_visitor::visit(ir_expression *ir) case ir_unop_fract: emit(ir, OPCODE_FRC, result_dst, op[0]); break; - + case ir_unop_pack_snorm_2x16: + case ir_unop_pack_snorm_4x8: + case ir_unop_pack_unorm_2x16: + case ir_unop_pack_unorm_4x8: + case ir_unop_pack_half_2x16: + case ir_unop_unpack_snorm_2x16: + case ir_unop_unpack_snorm_4x8: + case ir_unop_unpack_unorm_2x16: + case ir_unop_unpack_unorm_4x8: + case ir_unop_unpack_half_2x16: + case ir_unop_unpack_half_2x16_split_x: + case ir_unop_unpack_half_2x16_split_y: + case ir_binop_pack_half_2x16_split: + assert(!"not supported"); + break; case ir_binop_min: emit(ir, OPCODE_MIN, result_dst, op[0], op[1]); break; @@ -1529,21 +1547,18 @@ ir_to_mesa_visitor::visit(ir_dereference_variable *ir) var->location); this->variables.push_tail(entry); break; - case ir_var_in: - case ir_var_inout: + case ir_var_shader_in: /* The linker assigns locations for varyings and attributes, * including deprecated builtins (like gl_Color), * user-assigned generic attributes (glBindVertexLocation), * and user-defined varyings. - * - * FINISHME: We would hit this path for function arguments. Fix! */ assert(var->location != -1); entry = new(mem_ctx) variable_storage(var, PROGRAM_INPUT, var->location); break; - case ir_var_out: + case ir_var_shader_out: assert(var->location != -1); entry = new(mem_ctx) variable_storage(var, PROGRAM_OUTPUT, @@ -2378,7 +2393,8 @@ public: } private: - virtual void visit_field(const glsl_type *type, const char *name); + virtual void visit_field(const glsl_type *type, const char *name, + bool row_major); struct gl_shader_program *shader_program; struct gl_program_parameter_list *params; @@ -2386,10 +2402,13 @@ private: }; void -add_uniform_to_shader::visit_field(const glsl_type *type, const char *name) +add_uniform_to_shader::visit_field(const glsl_type *type, const char *name, + bool row_major) { unsigned int size; + (void) row_major; + if (type->is_vector() || type->is_scalar()) { size = type->vector_elements; } else { @@ -2459,7 +2478,7 @@ _mesa_generate_parameters_list_for_uniforms(struct gl_shader_program ir_variable *var = ((ir_instruction *) node)->as_variable(); if ((var == NULL) || (var->mode != ir_var_uniform) - || var->uniform_block != -1 || (strncmp(var->name, "gl_", 3) == 0)) + || var->is_in_uniform_block() || (strncmp(var->name, "gl_", 3) == 0)) continue; add.process(var); @@ -2522,7 +2541,11 @@ _mesa_associate_uniform_storage(struct gl_context *ctx, format = uniform_native; columns = 1; break; - default: + case GLSL_TYPE_ARRAY: + case GLSL_TYPE_VOID: + case GLSL_TYPE_STRUCT: + case GLSL_TYPE_ERROR: + case GLSL_TYPE_INTERFACE: assert(!"Should not get here."); break; } diff --git a/mesalib/src/mesa/program/program.c b/mesalib/src/mesa/program/program.c index 993803dd5..fb0aeb7ed 100644 --- a/mesalib/src/mesa/program/program.c +++ b/mesalib/src/mesa/program/program.c @@ -696,7 +696,7 @@ _mesa_combine_programs(struct gl_context *ctx, const GLuint newLength = lenA + lenB; GLboolean usedTemps[MAX_PROGRAM_TEMPS]; GLuint firstTemp = 0; - GLbitfield inputsB; + GLbitfield64 inputsB; GLuint i; ASSERT(progA->Target == progB->Target); @@ -724,7 +724,7 @@ _mesa_combine_programs(struct gl_context *ctx, if (newProg->Target == GL_FRAGMENT_PROGRAM_ARB) { const struct gl_fragment_program *fprogA, *fprogB; struct gl_fragment_program *newFprog; - GLbitfield progB_inputsRead = progB->InputsRead; + GLbitfield64 progB_inputsRead = progB->InputsRead; GLint progB_colorFile, progB_colorIndex; fprogA = gl_fragment_program_const(progA); @@ -840,8 +840,8 @@ _mesa_find_used_registers(const struct gl_program *prog, for (j = 0; j < n; j++) { if (inst->SrcReg[j].File == file) { - ASSERT(inst->SrcReg[j].Index < usedSize); - if(inst->SrcReg[j].Index < usedSize) + ASSERT(inst->SrcReg[j].Index < (GLint) usedSize); + if (inst->SrcReg[j].Index < (GLint) usedSize) used[inst->SrcReg[j].Index] = GL_TRUE; } } @@ -908,23 +908,23 @@ _mesa_valid_register_index(const struct gl_context *ctx, return GL_TRUE; /* XXX or maybe false? */ case PROGRAM_TEMPORARY: - return index >= 0 && index < c->MaxTemps; + return index >= 0 && index < (GLint) c->MaxTemps; case PROGRAM_ENV_PARAM: - return index >= 0 && index < c->MaxEnvParams; + return index >= 0 && index < (GLint) c->MaxEnvParams; case PROGRAM_LOCAL_PARAM: - return index >= 0 && index < c->MaxLocalParams; + return index >= 0 && index < (GLint) c->MaxLocalParams; case PROGRAM_UNIFORM: case PROGRAM_STATE_VAR: /* aka constant buffer */ - return index >= 0 && index < c->MaxUniformComponents / 4; + return index >= 0 && index < (GLint) c->MaxUniformComponents / 4; case PROGRAM_CONSTANT: /* constant buffer w/ possible relative negative addressing */ return (index > (int) c->MaxUniformComponents / -4 && - index < c->MaxUniformComponents / 4); + index < (int) c->MaxUniformComponents / 4); case PROGRAM_INPUT: if (index < 0) @@ -932,11 +932,11 @@ _mesa_valid_register_index(const struct gl_context *ctx, switch (shaderType) { case MESA_SHADER_VERTEX: - return index < VERT_ATTRIB_GENERIC0 + c->MaxAttribs; + return index < VERT_ATTRIB_GENERIC0 + (GLint) c->MaxAttribs; case MESA_SHADER_FRAGMENT: - return index < FRAG_ATTRIB_VAR0 + ctx->Const.MaxVarying; + return index < FRAG_ATTRIB_VAR0 + (GLint) ctx->Const.MaxVarying; case MESA_SHADER_GEOMETRY: - return index < GEOM_ATTRIB_VAR0 + ctx->Const.MaxVarying; + return index < GEOM_ATTRIB_VAR0 + (GLint) ctx->Const.MaxVarying; default: return GL_FALSE; } @@ -947,17 +947,17 @@ _mesa_valid_register_index(const struct gl_context *ctx, switch (shaderType) { case MESA_SHADER_VERTEX: - return index < VERT_RESULT_VAR0 + ctx->Const.MaxVarying; + return index < VERT_RESULT_VAR0 + (GLint) ctx->Const.MaxVarying; case MESA_SHADER_FRAGMENT: - return index < FRAG_RESULT_DATA0 + ctx->Const.MaxDrawBuffers; + return index < FRAG_RESULT_DATA0 + (GLint) ctx->Const.MaxDrawBuffers; case MESA_SHADER_GEOMETRY: - return index < GEOM_RESULT_VAR0 + ctx->Const.MaxVarying; + return index < GEOM_RESULT_VAR0 + (GLint) ctx->Const.MaxVarying; default: return GL_FALSE; } case PROGRAM_ADDRESS: - return index >= 0 && index < c->MaxAddressRegs; + return index >= 0 && index < (GLint) c->MaxAddressRegs; default: _mesa_problem(ctx, |