diff options
author | marha <marha@users.sourceforge.net> | 2012-07-31 10:17:14 +0200 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2012-07-31 10:17:14 +0200 |
commit | 83da3ad0287bc51cd16ee6911fe73dc98ebe000b (patch) | |
tree | 48d48590a0b0a3770006aeda8ec2b2a45054d1f1 /mesalib/src/mesa/program | |
parent | 00e30605ffc7ac3cf1a091ff2c1f46cfefb780d7 (diff) | |
parent | bd27b3d008b0abf9ae2edcb127302728808533e4 (diff) | |
download | vcxsrv-83da3ad0287bc51cd16ee6911fe73dc98ebe000b.tar.gz vcxsrv-83da3ad0287bc51cd16ee6911fe73dc98ebe000b.tar.bz2 vcxsrv-83da3ad0287bc51cd16ee6911fe73dc98ebe000b.zip |
Merge remote-tracking branch 'origin/released'
Diffstat (limited to 'mesalib/src/mesa/program')
-rw-r--r-- | mesalib/src/mesa/program/arbprogparse.c | 1 | ||||
-rw-r--r-- | mesalib/src/mesa/program/ir_to_mesa.cpp | 10 | ||||
-rw-r--r-- | mesalib/src/mesa/program/prog_statevars.c | 4 | ||||
-rw-r--r-- | mesalib/src/mesa/program/program.c | 31 | ||||
-rw-r--r-- | mesalib/src/mesa/program/program.h | 54 | ||||
-rw-r--r-- | mesalib/src/mesa/program/program_parse.y | 2 | ||||
-rw-r--r-- | mesalib/src/mesa/program/program_parser.h | 1 |
7 files changed, 73 insertions, 30 deletions
diff --git a/mesalib/src/mesa/program/arbprogparse.c b/mesalib/src/mesa/program/arbprogparse.c index dffc8abf7..72e51dd0f 100644 --- a/mesalib/src/mesa/program/arbprogparse.c +++ b/mesalib/src/mesa/program/arbprogparse.c @@ -120,6 +120,7 @@ _mesa_parse_arb_fragment_program(struct gl_context* ctx, GLenum target, program->PixelCenterInteger = state.option.PixelCenterInteger; program->UsesKill = state.fragment.UsesKill; + program->UsesDFdy = state.fragment.UsesDFdy; if (program->Base.Instructions) free(program->Base.Instructions); diff --git a/mesalib/src/mesa/program/ir_to_mesa.cpp b/mesalib/src/mesa/program/ir_to_mesa.cpp index 217a26455..baa317204 100644 --- a/mesalib/src/mesa/program/ir_to_mesa.cpp +++ b/mesalib/src/mesa/program/ir_to_mesa.cpp @@ -2157,8 +2157,6 @@ ir_to_mesa_visitor::visit(ir_return *ir) void ir_to_mesa_visitor::visit(ir_discard *ir) { - struct gl_fragment_program *fp = (struct gl_fragment_program *)this->prog; - if (ir->condition) { ir->condition->accept(this); this->result.negate = ~this->result.negate; @@ -2166,8 +2164,6 @@ ir_to_mesa_visitor::visit(ir_discard *ir) } else { emit(ir, OPCODE_KIL_NV); } - - fp->UsesKill = GL_TRUE; } void @@ -3119,6 +3115,12 @@ _mesa_glsl_compile_shader(struct gl_context *ctx, struct gl_shader *shader) } } + if (shader->UniformBlocks) + ralloc_free(shader->UniformBlocks); + shader->NumUniformBlocks = state->num_uniform_blocks; + shader->UniformBlocks = state->uniform_blocks; + ralloc_steal(shader, shader->UniformBlocks); + /* Retain any live IR, but trash the rest. */ reparent_ir(shader->ir, shader->ir); diff --git a/mesalib/src/mesa/program/prog_statevars.c b/mesalib/src/mesa/program/prog_statevars.c index 98ab9d003..3d1338674 100644 --- a/mesalib/src/mesa/program/prog_statevars.c +++ b/mesalib/src/mesa/program/prog_statevars.c @@ -34,6 +34,7 @@ #include "main/imports.h" #include "main/macros.h" #include "main/mtypes.h" +#include "main/fbobject.h" #include "prog_statevars.h" #include "prog_parameter.h" @@ -322,7 +323,6 @@ _mesa_fetch_state(struct gl_context *ctx, const gl_state_index state[], modifier == STATE_MATRIX_INVTRANS) { /* Be sure inverse is up to date: */ - _math_matrix_alloc_inv( (GLmatrix *) matrix ); _math_matrix_analyse( (GLmatrix*) matrix ); m = matrix->inv; } @@ -574,7 +574,7 @@ _mesa_fetch_state(struct gl_context *ctx, const gl_state_index state[], case STATE_FB_WPOS_Y_TRANSFORM: /* A driver may negate this conditional by using ZW swizzle * instead of XY (based on e.g. some other state). */ - if (ctx->DrawBuffer->Name != 0) { + if (_mesa_is_user_fbo(ctx->DrawBuffer)) { /* Identity (XY) followed by flipping Y upside down (ZW). */ value[0] = 1.0F; value[1] = 0.0F; diff --git a/mesalib/src/mesa/program/program.c b/mesalib/src/mesa/program/program.c index 582cbccf8..15337f4d8 100644 --- a/mesalib/src/mesa/program/program.c +++ b/mesalib/src/mesa/program/program.c @@ -169,22 +169,19 @@ _mesa_update_default_objects_program(struct gl_context *ctx) { #if FEATURE_NV_vertex_program || FEATURE_ARB_vertex_program _mesa_reference_vertprog(ctx, &ctx->VertexProgram.Current, - (struct gl_vertex_program *) ctx->Shared->DefaultVertexProgram); assert(ctx->VertexProgram.Current); #endif #if FEATURE_NV_fragment_program || FEATURE_ARB_fragment_program _mesa_reference_fragprog(ctx, &ctx->FragmentProgram.Current, - (struct gl_fragment_program *) ctx->Shared->DefaultFragmentProgram); assert(ctx->FragmentProgram.Current); #endif #if FEATURE_ARB_geometry_shader4 _mesa_reference_geomprog(ctx, &ctx->GeometryProgram.Current, - (struct gl_geometry_program *) - ctx->Shared->DefaultGeometryProgram); + ctx->Shared->DefaultGeometryProgram); #endif /* XXX probably move this stuff */ @@ -538,28 +535,26 @@ _mesa_clone_program(struct gl_context *ctx, const struct gl_program *prog) switch (prog->Target) { case GL_VERTEX_PROGRAM_ARB: { - const struct gl_vertex_program *vp - = (const struct gl_vertex_program *) prog; - struct gl_vertex_program *vpc = (struct gl_vertex_program *) clone; + const struct gl_vertex_program *vp = gl_vertex_program_const(prog); + struct gl_vertex_program *vpc = gl_vertex_program(clone); vpc->IsPositionInvariant = vp->IsPositionInvariant; vpc->IsNVProgram = vp->IsNVProgram; } break; case GL_FRAGMENT_PROGRAM_ARB: { - const struct gl_fragment_program *fp - = (const struct gl_fragment_program *) prog; - struct gl_fragment_program *fpc = (struct gl_fragment_program *) clone; + const struct gl_fragment_program *fp = gl_fragment_program_const(prog); + struct gl_fragment_program *fpc = gl_fragment_program(clone); fpc->UsesKill = fp->UsesKill; + fpc->UsesDFdy = fp->UsesDFdy; fpc->OriginUpperLeft = fp->OriginUpperLeft; fpc->PixelCenterInteger = fp->PixelCenterInteger; } break; case MESA_GEOMETRY_PROGRAM: { - const struct gl_geometry_program *gp - = (const struct gl_geometry_program *) prog; - struct gl_geometry_program *gpc = (struct gl_geometry_program *) clone; + const struct gl_geometry_program *gp = gl_geometry_program_const(prog); + struct gl_geometry_program *gpc = gl_geometry_program(clone); gpc->VerticesOut = gp->VerticesOut; gpc->InputType = gp->InputType; gpc->OutputType = gp->OutputType; @@ -763,15 +758,17 @@ _mesa_combine_programs(struct gl_context *ctx, usedTemps, MAX_PROGRAM_TEMPS); if (newProg->Target == GL_FRAGMENT_PROGRAM_ARB) { - struct gl_fragment_program *fprogA, *fprogB, *newFprog; + const struct gl_fragment_program *fprogA, *fprogB; + struct gl_fragment_program *newFprog; GLbitfield progB_inputsRead = progB->InputsRead; GLint progB_colorFile, progB_colorIndex; - fprogA = (struct gl_fragment_program *) progA; - fprogB = (struct gl_fragment_program *) progB; - newFprog = (struct gl_fragment_program *) newProg; + fprogA = gl_fragment_program_const(progA); + fprogB = gl_fragment_program_const(progB); + newFprog = gl_fragment_program(newProg); newFprog->UsesKill = fprogA->UsesKill || fprogB->UsesKill; + newFprog->UsesDFdy = fprogA->UsesDFdy || fprogB->UsesDFdy; /* We'll do a search and replace for instances * of progB_colorFile/progB_colorIndex below... diff --git a/mesalib/src/mesa/program/program.h b/mesalib/src/mesa/program/program.h index 9cd1780b8..c5650c519 100644 --- a/mesalib/src/mesa/program/program.h +++ b/mesalib/src/mesa/program/program.h @@ -183,13 +183,11 @@ _mesa_valid_register_index(const struct gl_context *ctx, extern void _mesa_postprocess_program(struct gl_context *ctx, struct gl_program *prog); -/* keep these in the same order as TGSI_PROCESSOR_* */ static inline GLuint _mesa_program_target_to_index(GLenum v) { - switch(v) - { + switch (v) { case GL_VERTEX_PROGRAM_ARB: return MESA_SHADER_VERTEX; case GL_FRAGMENT_PROGRAM_ARB: @@ -205,10 +203,10 @@ _mesa_program_target_to_index(GLenum v) static inline GLenum _mesa_program_index_to_target(GLuint i) { - GLenum enums[MESA_SHADER_TYPES] = { - GL_VERTEX_PROGRAM_ARB, - GL_FRAGMENT_PROGRAM_ARB, - GL_GEOMETRY_PROGRAM_NV, + static const GLenum enums[MESA_SHADER_TYPES] = { + GL_VERTEX_PROGRAM_ARB, + GL_FRAGMENT_PROGRAM_ARB, + GL_GEOMETRY_PROGRAM_NV, }; if(i >= MESA_SHADER_TYPES) return 0; @@ -216,4 +214,46 @@ _mesa_program_index_to_target(GLuint i) return enums[i]; } + +/* Cast wrappers from gl_program to gl_vertex/geometry/fragment_program */ + +static inline struct gl_fragment_program * +gl_fragment_program(struct gl_program *prog) +{ + return (struct gl_fragment_program *) prog; +} + +static inline const struct gl_fragment_program * +gl_fragment_program_const(const struct gl_program *prog) +{ + return (const struct gl_fragment_program *) prog; +} + + +static inline struct gl_vertex_program * +gl_vertex_program(struct gl_program *prog) +{ + return (struct gl_vertex_program *) prog; +} + +static inline const struct gl_vertex_program * +gl_vertex_program_const(const struct gl_program *prog) +{ + return (const struct gl_vertex_program *) prog; +} + + +static inline struct gl_geometry_program * +gl_geometry_program(struct gl_program *prog) +{ + return (struct gl_geometry_program *) prog; +} + +static inline const struct gl_geometry_program * +gl_geometry_program_const(const struct gl_program *prog) +{ + return (const struct gl_geometry_program *) prog; +} + + #endif /* PROGRAM_H */ diff --git a/mesalib/src/mesa/program/program_parse.y b/mesalib/src/mesa/program/program_parse.y index 4f958a993..54b17314a 100644 --- a/mesalib/src/mesa/program/program_parse.y +++ b/mesalib/src/mesa/program/program_parse.y @@ -382,6 +382,8 @@ ARL_instruction: ARL maskedAddrReg ',' scalarSrcReg VECTORop_instruction: VECTOR_OP maskedDstReg ',' swizzleSrcReg { + if ($1.Opcode == OPCODE_DDY) + state->fragment.UsesDFdy = 1; $$ = asm_instruction_copy_ctor(& $1, & $2, & $4, NULL, NULL); } ; diff --git a/mesalib/src/mesa/program/program_parser.h b/mesalib/src/mesa/program/program_parser.h index bc756148a..ca36bb6dc 100644 --- a/mesalib/src/mesa/program/program_parser.h +++ b/mesalib/src/mesa/program/program_parser.h @@ -214,6 +214,7 @@ struct asm_parser_state { struct { unsigned UsesKill:1; + unsigned UsesDFdy:1; } fragment; }; |