diff options
author | marha <marha@users.sourceforge.net> | 2014-01-15 21:37:10 +0100 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2014-01-15 21:37:10 +0100 |
commit | b7f01cb1f6cfd1ec301f650a073436c91ec614aa (patch) | |
tree | 1dbf32344313ad7e5884e6686251cad398a231fa /mesalib/src/mesa/program | |
parent | 7b4b94b4449aec056c4c92f5cacc2f89a292a80e (diff) | |
parent | 1b0fcca503ae9cf2d462b60770f96c794dfbb27a (diff) | |
download | vcxsrv-b7f01cb1f6cfd1ec301f650a073436c91ec614aa.tar.gz vcxsrv-b7f01cb1f6cfd1ec301f650a073436c91ec614aa.tar.bz2 vcxsrv-b7f01cb1f6cfd1ec301f650a073436c91ec614aa.zip |
Merge remote-tracking branch 'origin/released'
* origin/released:
mesa xkeyboard-config xserver git update 15 jan 2014
randrproto libfontenc mesa xserver git update 10 Jan 2014
randsrproto fontconfig libX11 git update 6 Jan 2014
Conflicts:
mesalib/src/glsl/builtin_functions.cpp
mesalib/src/glsl/ir_builder.h
xorg-server/Xext/xres.c
xorg-server/dix/dispatch.c
xorg-server/dix/dixfonts.c
xorg-server/hw/xwin/wingc.c
xorg-server/hw/xwin/winwindowswm.c
xorg-server/include/gc.h
xorg-server/os/access.c
Diffstat (limited to 'mesalib/src/mesa/program')
-rw-r--r-- | mesalib/src/mesa/program/ir_to_mesa.cpp | 64 | ||||
-rw-r--r-- | mesalib/src/mesa/program/prog_print.c | 15 | ||||
-rw-r--r-- | mesalib/src/mesa/program/program.c | 39 | ||||
-rw-r--r-- | mesalib/src/mesa/program/program.h | 26 | ||||
-rw-r--r-- | mesalib/src/mesa/program/program_parse.y | 6 | ||||
-rw-r--r-- | mesalib/src/mesa/program/sampler.cpp | 2 |
6 files changed, 73 insertions, 79 deletions
diff --git a/mesalib/src/mesa/program/ir_to_mesa.cpp b/mesalib/src/mesa/program/ir_to_mesa.cpp index beb0c093b..85d414259 100644 --- a/mesalib/src/mesa/program/ir_to_mesa.cpp +++ b/mesalib/src/mesa/program/ir_to_mesa.cpp @@ -665,8 +665,8 @@ ir_to_mesa_visitor::find_variable_storage(ir_variable *var) variable_storage *entry; - foreach_iter(exec_list_iterator, iter, this->variables) { - entry = (variable_storage *)iter.get(); + foreach_list(node, &this->variables) { + entry = (variable_storage *) node; if (entry->var == var) return entry; @@ -801,8 +801,8 @@ ir_to_mesa_visitor::visit(ir_function *ir) assert(sig); - foreach_iter(exec_list_iterator, iter, sig->body) { - ir_instruction *ir = (ir_instruction *)iter.get(); + foreach_list(node, &sig->body) { + ir_instruction *ir = (ir_instruction *) node; ir->accept(this); } @@ -1868,8 +1868,8 @@ ir_to_mesa_visitor::visit(ir_constant *ir) src_reg temp_base = get_temp(ir->type); dst_reg temp = dst_reg(temp_base); - foreach_iter(exec_list_iterator, iter, ir->components) { - ir_constant *field_value = (ir_constant *)iter.get(); + foreach_list(node, &ir->components) { + ir_constant *field_value = (ir_constant *) node; int size = type_size(field_value->type); assert(size > 0); @@ -2338,8 +2338,8 @@ set_branchtargets(ir_to_mesa_visitor *v, mesa_instructions[loop_stack[loop_stack_pos]].BranchTarget = i; break; case OPCODE_CAL: - foreach_iter(exec_list_iterator, iter, v->function_signatures) { - function_entry *entry = (function_entry *)iter.get(); + foreach_list(n, &v->function_signatures) { + function_entry *entry = (function_entry *) n; if (entry->sig_id == mesa_instructions[i].BranchTarget) { mesa_instructions[i].BranchTarget = entry->inst; @@ -2392,7 +2392,7 @@ class add_uniform_to_shader : public program_resource_visitor { public: add_uniform_to_shader(struct gl_shader_program *shader_program, struct gl_program_parameter_list *params, - gl_shader_type shader_type) + gl_shader_stage shader_type) : shader_program(shader_program), params(params), idx(-1), shader_type(shader_type) { @@ -2414,7 +2414,7 @@ private: struct gl_shader_program *shader_program; struct gl_program_parameter_list *params; int idx; - gl_shader_type shader_type; + gl_shader_stage shader_type; }; } /* anonymous namespace */ @@ -2493,8 +2493,7 @@ _mesa_generate_parameters_list_for_uniforms(struct gl_shader_program struct gl_program_parameter_list *params) { - add_uniform_to_shader add(shader_program, params, - _mesa_shader_type_to_index(sh->Type)); + add_uniform_to_shader add(shader_program, params, sh->Stage); foreach_list(node, sh->ir) { ir_variable *var = ((ir_instruction *) node)->as_variable(); @@ -2621,8 +2620,8 @@ ir_to_mesa_visitor::copy_propagate(void) int *acp_level = rzalloc_array(mem_ctx, int, this->next_temp * 4); int level = 0; - foreach_iter(exec_list_iterator, iter, this->instructions) { - ir_to_mesa_instruction *inst = (ir_to_mesa_instruction *)iter.get(); + foreach_list(node, &this->instructions) { + ir_to_mesa_instruction *inst = (ir_to_mesa_instruction *) node; assert(inst->dst.file != PROGRAM_TEMPORARY || inst->dst.index < this->next_temp); @@ -2800,25 +2799,10 @@ get_mesa_program(struct gl_context *ctx, ir_instruction **mesa_instruction_annotation; int i; struct gl_program *prog; - GLenum target; - const char *target_string = _mesa_shader_enum_to_string(shader->Type); + GLenum target = _mesa_shader_stage_to_program(shader->Stage); + const char *target_string = _mesa_shader_stage_to_string(shader->Stage); struct gl_shader_compiler_options *options = - &ctx->ShaderCompilerOptions[_mesa_shader_type_to_index(shader->Type)]; - - switch (shader->Type) { - case GL_VERTEX_SHADER: - target = GL_VERTEX_PROGRAM_ARB; - break; - case GL_FRAGMENT_SHADER: - target = GL_FRAGMENT_PROGRAM_ARB; - break; - case GL_GEOMETRY_SHADER: - target = GL_GEOMETRY_PROGRAM_NV; - break; - default: - assert(!"should not be reached"); - return NULL; - } + &ctx->ShaderCompilerOptions[shader->Stage]; validate_ir_tree(shader->ir); @@ -2841,7 +2825,7 @@ get_mesa_program(struct gl_context *ctx, prog->NumTemporaries = v.next_temp; int num_instructions = 0; - foreach_iter(exec_list_iterator, iter, v.instructions) { + foreach_list(node, &v.instructions) { num_instructions++; } @@ -2857,8 +2841,8 @@ get_mesa_program(struct gl_context *ctx, */ mesa_inst = mesa_instructions; i = 0; - foreach_iter(exec_list_iterator, iter, v.instructions) { - const ir_to_mesa_instruction *inst = (ir_to_mesa_instruction *)iter.get(); + foreach_list(node, &v.instructions) { + const ir_to_mesa_instruction *inst = (ir_to_mesa_instruction *) node; mesa_inst->Opcode = inst->op; mesa_inst->CondUpdate = inst->cond_update; @@ -2952,7 +2936,7 @@ get_mesa_program(struct gl_context *ctx, */ mesa_instructions = NULL; - do_set_program_inouts(shader->ir, prog, shader->Type); + do_set_program_inouts(shader->ir, prog, shader->Stage); prog->SamplersUsed = shader->active_samplers; prog->ShadowSamplers = shader->shadow_samplers; @@ -3000,14 +2984,14 @@ _mesa_ir_link_shader(struct gl_context *ctx, struct gl_shader_program *prog) { assert(prog->LinkStatus); - for (unsigned i = 0; i < MESA_SHADER_TYPES; i++) { + for (unsigned i = 0; i < MESA_SHADER_STAGES; i++) { if (prog->_LinkedShaders[i] == NULL) continue; bool progress; exec_list *ir = prog->_LinkedShaders[i]->ir; const struct gl_shader_compiler_options *options = - &ctx->ShaderCompilerOptions[_mesa_shader_type_to_index(prog->_LinkedShaders[i]->Type)]; + &ctx->ShaderCompilerOptions[prog->_LinkedShaders[i]->Stage]; do { progress = false; @@ -3055,7 +3039,7 @@ _mesa_ir_link_shader(struct gl_context *ctx, struct gl_shader_program *prog) validate_ir_tree(ir); } - for (unsigned i = 0; i < MESA_SHADER_TYPES; i++) { + for (unsigned i = 0; i < MESA_SHADER_STAGES; i++) { struct gl_program *linked_prog; if (prog->_LinkedShaders[i] == NULL) @@ -3064,7 +3048,7 @@ _mesa_ir_link_shader(struct gl_context *ctx, struct gl_shader_program *prog) linked_prog = get_mesa_program(ctx, prog, prog->_LinkedShaders[i]); if (linked_prog) { - _mesa_copy_linked_program_data((gl_shader_type) i, prog, linked_prog); + _mesa_copy_linked_program_data((gl_shader_stage) i, prog, linked_prog); _mesa_reference_program(ctx, &prog->_LinkedShaders[i]->Program, linked_prog); diff --git a/mesalib/src/mesa/program/prog_print.c b/mesalib/src/mesa/program/prog_print.c index fa120cc5e..9391e99ff 100644 --- a/mesalib/src/mesa/program/prog_print.c +++ b/mesalib/src/mesa/program/prog_print.c @@ -1005,16 +1005,21 @@ _mesa_print_parameter_list(const struct gl_program_parameter_list *list) void _mesa_write_shader_to_file(const struct gl_shader *shader) { - const char *type; + const char *type = "????"; char filename[100]; FILE *f; - if (shader->Type == GL_FRAGMENT_SHADER) + switch (shader->Stage) { + case MESA_SHADER_FRAGMENT: type = "frag"; - else if (shader->Type == GL_VERTEX_SHADER) + break; + case MESA_SHADER_VERTEX: type = "vert"; - else + break; + case MESA_SHADER_GEOMETRY: type = "geom"; + break; + } _mesa_snprintf(filename, sizeof(filename), "shader_%u.%s", shader->Name, type); f = fopen(filename, "w"); @@ -1061,7 +1066,7 @@ _mesa_append_uniforms_to_file(const struct gl_shader *shader) char filename[100]; FILE *f; - if (shader->Type == GL_FRAGMENT_SHADER) + if (shader->Stage == MESA_SHADER_FRAGMENT) type = "frag"; else type = "vert"; diff --git a/mesalib/src/mesa/program/program.c b/mesalib/src/mesa/program/program.c index cdf1c03fa..3c19e8c60 100644 --- a/mesalib/src/mesa/program/program.c +++ b/mesalib/src/mesa/program/program.c @@ -56,21 +56,21 @@ _mesa_init_program(struct gl_context *ctx) * If this assertion fails, we need to increase the field * size for register indexes (see INST_INDEX_BITS). */ - ASSERT(ctx->Const.VertexProgram.MaxUniformComponents / 4 + ASSERT(ctx->Const.Program[MESA_SHADER_VERTEX].MaxUniformComponents / 4 <= (1 << INST_INDEX_BITS)); - ASSERT(ctx->Const.FragmentProgram.MaxUniformComponents / 4 + ASSERT(ctx->Const.Program[MESA_SHADER_FRAGMENT].MaxUniformComponents / 4 <= (1 << INST_INDEX_BITS)); - ASSERT(ctx->Const.VertexProgram.MaxTemps <= (1 << INST_INDEX_BITS)); - ASSERT(ctx->Const.VertexProgram.MaxLocalParams <= (1 << INST_INDEX_BITS)); - ASSERT(ctx->Const.FragmentProgram.MaxTemps <= (1 << INST_INDEX_BITS)); - ASSERT(ctx->Const.FragmentProgram.MaxLocalParams <= (1 << INST_INDEX_BITS)); + ASSERT(ctx->Const.Program[MESA_SHADER_VERTEX].MaxTemps <= (1 << INST_INDEX_BITS)); + ASSERT(ctx->Const.Program[MESA_SHADER_VERTEX].MaxLocalParams <= (1 << INST_INDEX_BITS)); + ASSERT(ctx->Const.Program[MESA_SHADER_FRAGMENT].MaxTemps <= (1 << INST_INDEX_BITS)); + ASSERT(ctx->Const.Program[MESA_SHADER_FRAGMENT].MaxLocalParams <= (1 << INST_INDEX_BITS)); - ASSERT(ctx->Const.VertexProgram.MaxUniformComponents <= 4 * MAX_UNIFORMS); - ASSERT(ctx->Const.FragmentProgram.MaxUniformComponents <= 4 * MAX_UNIFORMS); + ASSERT(ctx->Const.Program[MESA_SHADER_VERTEX].MaxUniformComponents <= 4 * MAX_UNIFORMS); + ASSERT(ctx->Const.Program[MESA_SHADER_FRAGMENT].MaxUniformComponents <= 4 * MAX_UNIFORMS); - ASSERT(ctx->Const.VertexProgram.MaxAddressOffset <= (1 << INST_INDEX_BITS)); - ASSERT(ctx->Const.FragmentProgram.MaxAddressOffset <= (1 << INST_INDEX_BITS)); + ASSERT(ctx->Const.Program[MESA_SHADER_VERTEX].MaxAddressOffset <= (1 << INST_INDEX_BITS)); + ASSERT(ctx->Const.Program[MESA_SHADER_FRAGMENT].MaxAddressOffset <= (1 << INST_INDEX_BITS)); /* If this fails, increase prog_instruction::TexSrcUnit size */ STATIC_ASSERT(MAX_TEXTURE_UNITS <= (1 << 5)); @@ -891,26 +891,13 @@ _mesa_find_free_register(const GLboolean used[], */ GLboolean _mesa_valid_register_index(const struct gl_context *ctx, - gl_shader_type shaderType, + gl_shader_stage shaderType, gl_register_file file, GLint index) { const struct gl_program_constants *c; - switch (shaderType) { - case MESA_SHADER_VERTEX: - c = &ctx->Const.VertexProgram; - break; - case MESA_SHADER_FRAGMENT: - c = &ctx->Const.FragmentProgram; - break; - case MESA_SHADER_GEOMETRY: - c = &ctx->Const.GeometryProgram; - break; - default: - _mesa_problem(ctx, - "unexpected shader type in _mesa_valid_register_index()"); - return GL_FALSE; - } + assert(0 <= shaderType && shaderType < MESA_SHADER_STAGES); + c = &ctx->Const.Program[shaderType]; switch (file) { case PROGRAM_UNDEFINED: diff --git a/mesalib/src/mesa/program/program.h b/mesalib/src/mesa/program/program.h index baff47376..0e350cd6f 100644 --- a/mesalib/src/mesa/program/program.h +++ b/mesalib/src/mesa/program/program.h @@ -181,7 +181,7 @@ _mesa_find_free_register(const GLboolean used[], extern GLboolean _mesa_valid_register_index(const struct gl_context *ctx, - gl_shader_type shaderType, + gl_shader_stage shaderType, gl_register_file file, GLint index); extern void @@ -192,7 +192,7 @@ _mesa_get_min_invocations_per_fragment(struct gl_context *ctx, const struct gl_fragment_program *prog); static inline GLuint -_mesa_program_target_to_index(GLenum v) +_mesa_program_enum_to_shader_stage(GLenum v) { switch (v) { case GL_VERTEX_PROGRAM_ARB: @@ -207,6 +207,24 @@ _mesa_program_target_to_index(GLenum v) } } + +static inline GLenum +_mesa_shader_stage_to_program(gl_shader_stage stage) +{ + switch (stage) { + case MESA_SHADER_VERTEX: + return GL_VERTEX_PROGRAM_ARB; + case MESA_SHADER_FRAGMENT: + return GL_FRAGMENT_PROGRAM_ARB; + case MESA_SHADER_GEOMETRY: + return GL_GEOMETRY_PROGRAM_NV; + } + + assert(!"Unexpected shader stage in _mesa_shader_stage_to_program"); + return GL_VERTEX_PROGRAM_ARB; +} + + static inline GLenum _mesa_program_index_to_target(GLuint i) { @@ -215,8 +233,8 @@ _mesa_program_index_to_target(GLuint i) GL_GEOMETRY_PROGRAM_NV, GL_FRAGMENT_PROGRAM_ARB }; - STATIC_ASSERT(Elements(enums) == MESA_SHADER_TYPES); - if(i >= MESA_SHADER_TYPES) { + STATIC_ASSERT(Elements(enums) == MESA_SHADER_STAGES); + if(i >= MESA_SHADER_STAGES) { assert(!"Unexpected program index"); return 0; } else diff --git a/mesalib/src/mesa/program/program_parse.y b/mesalib/src/mesa/program/program_parse.y index a76db4e86..6dde69d53 100644 --- a/mesalib/src/mesa/program/program_parse.y +++ b/mesalib/src/mesa/program/program_parse.y @@ -2707,10 +2707,10 @@ _mesa_parse_arb_program(struct gl_context *ctx, GLenum target, const GLubyte *st state->st = _mesa_symbol_table_ctor(); state->limits = (target == GL_VERTEX_PROGRAM_ARB) - ? & ctx->Const.VertexProgram - : & ctx->Const.FragmentProgram; + ? & ctx->Const.Program[MESA_SHADER_VERTEX] + : & ctx->Const.Program[MESA_SHADER_FRAGMENT]; - state->MaxTextureImageUnits = ctx->Const.FragmentProgram.MaxTextureImageUnits; + state->MaxTextureImageUnits = ctx->Const.Program[MESA_SHADER_FRAGMENT].MaxTextureImageUnits; state->MaxTextureCoordUnits = ctx->Const.MaxTextureCoordUnits; state->MaxTextureUnits = ctx->Const.MaxTextureUnits; state->MaxClipPlanes = ctx->Const.MaxClipPlanes; diff --git a/mesalib/src/mesa/program/sampler.cpp b/mesalib/src/mesa/program/sampler.cpp index 9b9412730..e6532be84 100644 --- a/mesalib/src/mesa/program/sampler.cpp +++ b/mesalib/src/mesa/program/sampler.cpp @@ -111,7 +111,7 @@ _mesa_get_sampler_uniform_value(class ir_dereference *sampler, { get_sampler_name getname(sampler, shader_program); - GLuint shader = _mesa_program_target_to_index(prog->Target); + GLuint shader = _mesa_program_enum_to_shader_stage(prog->Target); sampler->accept(&getname); |