aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa/program
diff options
context:
space:
mode:
Diffstat (limited to 'mesalib/src/mesa/program')
-rw-r--r--mesalib/src/mesa/program/ir_to_mesa.cpp63
-rw-r--r--mesalib/src/mesa/program/prog_parameter.c3
-rw-r--r--mesalib/src/mesa/program/program.c8
-rw-r--r--mesalib/src/mesa/program/program_parse_extra.c9
4 files changed, 21 insertions, 62 deletions
diff --git a/mesalib/src/mesa/program/ir_to_mesa.cpp b/mesalib/src/mesa/program/ir_to_mesa.cpp
index c833a12f2..23d479c32 100644
--- a/mesalib/src/mesa/program/ir_to_mesa.cpp
+++ b/mesalib/src/mesa/program/ir_to_mesa.cpp
@@ -681,11 +681,11 @@ ir_to_mesa_visitor::visit(ir_variable *ir)
if (strcmp(ir->name, "gl_FragCoord") == 0) {
struct gl_fragment_program *fp = (struct gl_fragment_program *)this->prog;
- fp->OriginUpperLeft = ir->origin_upper_left;
- fp->PixelCenterInteger = ir->pixel_center_integer;
+ fp->OriginUpperLeft = ir->data.origin_upper_left;
+ fp->PixelCenterInteger = ir->data.pixel_center_integer;
}
- if (ir->mode == ir_var_uniform && strncmp(ir->name, "gl_", 3) == 0) {
+ if (ir->data.mode == ir_var_uniform && strncmp(ir->name, "gl_", 3) == 0) {
unsigned int i;
const ir_state_slot *const slots = ir->state_slots;
assert(ir->state_slots != NULL);
@@ -759,49 +759,10 @@ ir_to_mesa_visitor::visit(ir_variable *ir)
void
ir_to_mesa_visitor::visit(ir_loop *ir)
{
- ir_dereference_variable *counter = NULL;
-
- if (ir->counter != NULL)
- counter = new(mem_ctx) ir_dereference_variable(ir->counter);
-
- if (ir->from != NULL) {
- assert(ir->counter != NULL);
-
- ir_assignment *a =
- new(mem_ctx) ir_assignment(counter, ir->from, NULL);
-
- a->accept(this);
- }
-
emit(NULL, OPCODE_BGNLOOP);
- if (ir->to) {
- ir_expression *e =
- new(mem_ctx) ir_expression(ir->cmp, glsl_type::bool_type,
- counter, ir->to);
- ir_if *if_stmt = new(mem_ctx) ir_if(e);
-
- ir_loop_jump *brk =
- new(mem_ctx) ir_loop_jump(ir_loop_jump::jump_break);
-
- if_stmt->then_instructions.push_tail(brk);
-
- if_stmt->accept(this);
- }
-
visit_exec_list(&ir->body_instructions, this);
- if (ir->increment) {
- ir_expression *e =
- new(mem_ctx) ir_expression(ir_binop_add, counter->type,
- counter, ir->increment);
-
- ir_assignment *a =
- new(mem_ctx) ir_assignment(counter, e, NULL);
-
- a->accept(this);
- }
-
emit(NULL, OPCODE_ENDLOOP);
}
@@ -1567,10 +1528,10 @@ ir_to_mesa_visitor::visit(ir_dereference_variable *ir)
ir_variable *var = ir->var;
if (!entry) {
- switch (var->mode) {
+ switch (var->data.mode) {
case ir_var_uniform:
entry = new(mem_ctx) variable_storage(var, PROGRAM_UNIFORM,
- var->location);
+ var->data.location);
this->variables.push_tail(entry);
break;
case ir_var_shader_in:
@@ -1579,21 +1540,21 @@ ir_to_mesa_visitor::visit(ir_dereference_variable *ir)
* user-assigned generic attributes (glBindVertexLocation),
* and user-defined varyings.
*/
- assert(var->location != -1);
+ assert(var->data.location != -1);
entry = new(mem_ctx) variable_storage(var,
PROGRAM_INPUT,
- var->location);
+ var->data.location);
break;
case ir_var_shader_out:
- assert(var->location != -1);
+ assert(var->data.location != -1);
entry = new(mem_ctx) variable_storage(var,
PROGRAM_OUTPUT,
- var->location);
+ var->data.location);
break;
case ir_var_system_value:
entry = new(mem_ctx) variable_storage(var,
PROGRAM_SYSTEM_VALUE,
- var->location);
+ var->data.location);
break;
case ir_var_auto:
case ir_var_temporary:
@@ -2443,7 +2404,7 @@ public:
this->idx = -1;
this->program_resource_visitor::process(var);
- var->location = this->idx;
+ var->data.location = this->idx;
}
private:
@@ -2538,7 +2499,7 @@ _mesa_generate_parameters_list_for_uniforms(struct gl_shader_program
foreach_list(node, sh->ir) {
ir_variable *var = ((ir_instruction *) node)->as_variable();
- if ((var == NULL) || (var->mode != ir_var_uniform)
+ if ((var == NULL) || (var->data.mode != ir_var_uniform)
|| var->is_in_uniform_block() || (strncmp(var->name, "gl_", 3) == 0))
continue;
diff --git a/mesalib/src/mesa/program/prog_parameter.c b/mesalib/src/mesa/program/prog_parameter.c
index 4d9cf08d2..54531d255 100644
--- a/mesalib/src/mesa/program/prog_parameter.c
+++ b/mesalib/src/mesa/program/prog_parameter.c
@@ -83,8 +83,7 @@ _mesa_free_parameter_list(struct gl_program_parameter_list *paramList)
free((void *)paramList->Parameters[i].Name);
}
free(paramList->Parameters);
- if (paramList->ParameterValues)
- _mesa_align_free(paramList->ParameterValues);
+ _mesa_align_free(paramList->ParameterValues);
free(paramList);
}
diff --git a/mesalib/src/mesa/program/program.c b/mesalib/src/mesa/program/program.c
index 01f8c6f11..cdf1c03fa 100644
--- a/mesalib/src/mesa/program/program.c
+++ b/mesalib/src/mesa/program/program.c
@@ -1049,6 +1049,14 @@ _mesa_get_min_invocations_per_fragment(struct gl_context *ctx,
* has no effect."
*/
if (ctx->Multisample.Enabled) {
+ /* The ARB_gpu_shader5 specification says:
+ *
+ * "Use of the "sample" qualifier on a fragment shader input
+ * forces per-sample shading"
+ */
+ if (prog->IsSample)
+ return MAX2(ctx->DrawBuffer->Visual.samples, 1);
+
if (prog->Base.SystemValuesRead & (SYSTEM_BIT_SAMPLE_ID |
SYSTEM_BIT_SAMPLE_POS))
return MAX2(ctx->DrawBuffer->Visual.samples, 1);
diff --git a/mesalib/src/mesa/program/program_parse_extra.c b/mesalib/src/mesa/program/program_parse_extra.c
index e8e1912eb..a9e364045 100644
--- a/mesalib/src/mesa/program/program_parse_extra.c
+++ b/mesalib/src/mesa/program/program_parse_extra.c
@@ -256,15 +256,6 @@ _mesa_ARBfp_parse_option(struct asm_parser_state *state, const char *option)
return 1;
}
}
- } else if (strncmp(option, "MESA_", 5) == 0) {
- option += 5;
-
- if (strcmp(option, "texture_array") == 0) {
- if (state->ctx->Extensions.MESA_texture_array) {
- state->option.TexArray = 1;
- return 1;
- }
- }
}
return 0;