aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2013-08-30 15:40:11 +0200
committermarha <marha@users.sourceforge.net>2013-08-30 15:40:11 +0200
commit22bc825e9931f718cc0564aa55915961abaffce4 (patch)
treef53ea31eb5368d3f60860d3e8911fa83a7fd851a /mesalib/src
parentac46cfda36d6dbe8d5c092124a66ffe3f2bad15f (diff)
parent5ebbc3a366287b631775ed3e17537580d380db8a (diff)
downloadvcxsrv-22bc825e9931f718cc0564aa55915961abaffce4.tar.gz
vcxsrv-22bc825e9931f718cc0564aa55915961abaffce4.tar.bz2
vcxsrv-22bc825e9931f718cc0564aa55915961abaffce4.zip
Merge remote-tracking branch 'origin/released'
* origin/released: fontconfig mesa xserver xkeyboard-config xkbcomp git update 30 aug 2013
Diffstat (limited to 'mesalib/src')
-rw-r--r--mesalib/src/glsl/ast_to_hir.cpp29
-rw-r--r--mesalib/src/glsl/ir.cpp1
-rw-r--r--mesalib/src/glsl/ir.h7
-rw-r--r--mesalib/src/glsl/ir_constant_expression.cpp11
-rw-r--r--mesalib/src/glsl/ir_print_visitor.cpp12
-rw-r--r--mesalib/src/glsl/ir_validate.cpp1
-rw-r--r--mesalib/src/mesa/main/api_validate.c51
-rw-r--r--mesalib/src/mesa/program/ir_to_mesa.cpp1
-rw-r--r--mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp1
-rw-r--r--mesalib/src/mesa/vbo/vbo_exec_array.c12
10 files changed, 96 insertions, 30 deletions
diff --git a/mesalib/src/glsl/ast_to_hir.cpp b/mesalib/src/glsl/ast_to_hir.cpp
index 192130a99..52059e4bf 100644
--- a/mesalib/src/glsl/ast_to_hir.cpp
+++ b/mesalib/src/glsl/ast_to_hir.cpp
@@ -3132,32 +3132,45 @@ ast_declarator_list::hir(exec_list *instructions,
}
- /* Precision qualifiers only apply to floating point and integer types.
+ /* Precision qualifiers apply to floating point, integer and sampler
+ * types.
*
- * From section 4.5.2 of the GLSL 1.30 spec:
+ * Section 4.5.2 (Precision Qualifiers) of the GLSL 1.30 spec says:
* "Any floating point or any integer declaration can have the type
* preceded by one of these precision qualifiers [...] Literal
* constants do not have precision qualifiers. Neither do Boolean
* variables.
*
- * In GLSL ES, sampler types are also allowed.
+ * Section 4.5 (Precision and Precision Qualifiers) of the GLSL 1.30
+ * spec also says:
*
- * From page 87 of the GLSL ES spec:
- * "RESOLUTION: Allow sampler types to take a precision qualifier."
+ * "Precision qualifiers are added for code portability with OpenGL
+ * ES, not for functionality. They have the same syntax as in OpenGL
+ * ES."
+ *
+ * Section 8 (Built-In Functions) of the GLSL ES 1.00 spec says:
+ *
+ * "uniform lowp sampler2D sampler;
+ * highp vec2 coord;
+ * ...
+ * lowp vec4 col = texture2D (sampler, coord);
+ * // texture2D returns lowp"
+ *
+ * From this, we infer that GLSL 1.30 (and later) should allow precision
+ * qualifiers on sampler types just like float and integer types.
*/
if (this->type->qualifier.precision != ast_precision_none
&& !var->type->is_float()
&& !var->type->is_integer()
&& !var->type->is_record()
- && !(var->type->is_sampler() && state->es_shader)
+ && !var->type->is_sampler()
&& !(var->type->is_array()
&& (var->type->fields.array->is_float()
|| var->type->fields.array->is_integer()))) {
_mesa_glsl_error(&loc, state,
"precision qualifiers apply only to floating point"
- "%s types", state->es_shader ? ", integer, and sampler"
- : "and integer");
+ ", integer and sampler types");
}
/* From page 17 (page 23 of the PDF) of the GLSL 1.20 spec:
diff --git a/mesalib/src/glsl/ir.cpp b/mesalib/src/glsl/ir.cpp
index 99dceacf8..c6d96d8da 100644
--- a/mesalib/src/glsl/ir.cpp
+++ b/mesalib/src/glsl/ir.cpp
@@ -515,6 +515,7 @@ static const char *const operator_strs[] = {
"bfm",
"ubo_load",
"vector_extract",
+ "fma",
"lrp",
"bfi",
"bitfield_extract",
diff --git a/mesalib/src/glsl/ir.h b/mesalib/src/glsl/ir.h
index 62e3b27ca..b45e6cbd8 100644
--- a/mesalib/src/glsl/ir.h
+++ b/mesalib/src/glsl/ir.h
@@ -1169,6 +1169,13 @@ enum ir_expression_operation {
*/
ir_last_binop = ir_binop_vector_extract,
+ /**
+ * \name Fused floating-point multiply-add, part of ARB_gpu_shader5.
+ */
+ /*@{*/
+ ir_triop_fma,
+ /*@}*/
+
ir_triop_lrp,
/**
diff --git a/mesalib/src/glsl/ir_constant_expression.cpp b/mesalib/src/glsl/ir_constant_expression.cpp
index 0a725b45b..bf019b955 100644
--- a/mesalib/src/glsl/ir_constant_expression.cpp
+++ b/mesalib/src/glsl/ir_constant_expression.cpp
@@ -1375,6 +1375,17 @@ ir_expression::constant_expression_value(struct hash_table *variable_context)
break;
}
+ case ir_triop_fma:
+ assert(op[0]->type->base_type == GLSL_TYPE_FLOAT);
+ assert(op[1]->type->base_type == GLSL_TYPE_FLOAT);
+ assert(op[2]->type->base_type == GLSL_TYPE_FLOAT);
+
+ for (unsigned c = 0; c < components; c++) {
+ data.f[c] = op[0]->value.f[c] * op[1]->value.f[c]
+ + op[2]->value.f[c];
+ }
+ break;
+
case ir_triop_lrp: {
assert(op[0]->type->base_type == GLSL_TYPE_FLOAT);
assert(op[1]->type->base_type == GLSL_TYPE_FLOAT);
diff --git a/mesalib/src/glsl/ir_print_visitor.cpp b/mesalib/src/glsl/ir_print_visitor.cpp
index 541231a33..b5183108d 100644
--- a/mesalib/src/glsl/ir_print_visitor.cpp
+++ b/mesalib/src/glsl/ir_print_visitor.cpp
@@ -406,7 +406,17 @@ void ir_print_visitor::visit(ir_constant *ir)
switch (ir->type->base_type) {
case GLSL_TYPE_UINT: printf("%u", ir->value.u[i]); break;
case GLSL_TYPE_INT: printf("%d", ir->value.i[i]); break;
- case GLSL_TYPE_FLOAT: printf("%f", ir->value.f[i]); break;
+ case GLSL_TYPE_FLOAT:
+ if (ir->value.f[i] == 0.0f)
+ /* 0.0 == -0.0, so print with %f to get the proper sign. */
+ printf("%.1f", ir->value.f[i]);
+ else if (abs(ir->value.f[i]) < 0.000001f)
+ printf("%a", ir->value.f[i]);
+ else if (abs(ir->value.f[i]) > 1000000.0f)
+ printf("%e", ir->value.f[i]);
+ else
+ printf("%f", ir->value.f[i]);
+ break;
case GLSL_TYPE_BOOL: printf("%d", ir->value.b[i]); break;
default: assert(0);
}
diff --git a/mesalib/src/glsl/ir_validate.cpp b/mesalib/src/glsl/ir_validate.cpp
index ce96f6855..37f26febe 100644
--- a/mesalib/src/glsl/ir_validate.cpp
+++ b/mesalib/src/glsl/ir_validate.cpp
@@ -522,6 +522,7 @@ ir_validate::visit_leave(ir_expression *ir)
&& ir->operands[1]->type->is_integer());
break;
+ case ir_triop_fma:
case ir_triop_lrp:
assert(ir->operands[0]->type->base_type == GLSL_TYPE_FLOAT);
assert(ir->operands[0]->type == ir->operands[1]->type);
diff --git a/mesalib/src/mesa/main/api_validate.c b/mesalib/src/mesa/main/api_validate.c
index 243bb89d1..002992186 100644
--- a/mesalib/src/mesa/main/api_validate.c
+++ b/mesalib/src/mesa/main/api_validate.c
@@ -402,9 +402,8 @@ _mesa_validate_DrawElements(struct gl_context *ctx,
return GL_FALSE;
}
- if (count <= 0) {
- if (count < 0)
- _mesa_error(ctx, GL_INVALID_VALUE, "glDrawElements(count)" );
+ if (count < 0) {
+ _mesa_error(ctx, GL_INVALID_VALUE, "glDrawElements(count)" );
return GL_FALSE;
}
@@ -436,6 +435,9 @@ _mesa_validate_DrawElements(struct gl_context *ctx,
if (!check_index_bounds(ctx, count, type, indices, basevertex))
return GL_FALSE;
+ if (count == 0)
+ return GL_FALSE;
+
return GL_TRUE;
}
@@ -456,10 +458,9 @@ _mesa_validate_MultiDrawElements(struct gl_context *ctx,
FLUSH_CURRENT(ctx, 0);
for (i = 0; i < primcount; i++) {
- if (count[i] <= 0) {
- if (count[i] < 0)
- _mesa_error(ctx, GL_INVALID_VALUE,
- "glMultiDrawElements(count)" );
+ if (count[i] < 0) {
+ _mesa_error(ctx, GL_INVALID_VALUE,
+ "glMultiDrawElements(count)" );
return GL_FALSE;
}
}
@@ -531,9 +532,8 @@ _mesa_validate_DrawRangeElements(struct gl_context *ctx, GLenum mode,
return GL_FALSE;
}
- if (count <= 0) {
- if (count < 0)
- _mesa_error(ctx, GL_INVALID_VALUE, "glDrawRangeElements(count)" );
+ if (count < 0) {
+ _mesa_error(ctx, GL_INVALID_VALUE, "glDrawRangeElements(count)" );
return GL_FALSE;
}
@@ -570,6 +570,9 @@ _mesa_validate_DrawRangeElements(struct gl_context *ctx, GLenum mode,
if (!check_index_bounds(ctx, count, type, indices, basevertex))
return GL_FALSE;
+ if (count == 0)
+ return GL_FALSE;
+
return GL_TRUE;
}
@@ -587,9 +590,8 @@ _mesa_validate_DrawArrays(struct gl_context *ctx,
= ctx->TransformFeedback.CurrentObject;
FLUSH_CURRENT(ctx, 0);
- if (count <= 0) {
- if (count < 0)
- _mesa_error(ctx, GL_INVALID_VALUE, "glDrawArrays(count)" );
+ if (count < 0) {
+ _mesa_error(ctx, GL_INVALID_VALUE, "glDrawArrays(count)" );
return GL_FALSE;
}
@@ -628,6 +630,9 @@ _mesa_validate_DrawArrays(struct gl_context *ctx,
xfb_obj->GlesRemainingPrims -= prim_count;
}
+ if (count == 0)
+ return GL_FALSE;
+
return GL_TRUE;
}
@@ -640,10 +645,9 @@ _mesa_validate_DrawArraysInstanced(struct gl_context *ctx, GLenum mode, GLint fi
= ctx->TransformFeedback.CurrentObject;
FLUSH_CURRENT(ctx, 0);
- if (count <= 0) {
- if (count < 0)
- _mesa_error(ctx, GL_INVALID_VALUE,
- "glDrawArraysInstanced(count=%d)", count);
+ if (count < 0) {
+ _mesa_error(ctx, GL_INVALID_VALUE,
+ "glDrawArraysInstanced(count=%d)", count);
return GL_FALSE;
}
@@ -696,6 +700,9 @@ _mesa_validate_DrawArraysInstanced(struct gl_context *ctx, GLenum mode, GLint fi
xfb_obj->GlesRemainingPrims -= prim_count;
}
+ if (count == 0)
+ return GL_FALSE;
+
return GL_TRUE;
}
@@ -721,10 +728,9 @@ _mesa_validate_DrawElementsInstanced(struct gl_context *ctx,
return GL_FALSE;
}
- if (count <= 0) {
- if (count < 0)
- _mesa_error(ctx, GL_INVALID_VALUE,
- "glDrawElementsInstanced(count=%d)", count);
+ if (count < 0) {
+ _mesa_error(ctx, GL_INVALID_VALUE,
+ "glDrawElementsInstanced(count=%d)", count);
return GL_FALSE;
}
@@ -761,6 +767,9 @@ _mesa_validate_DrawElementsInstanced(struct gl_context *ctx,
return GL_FALSE;
}
+ if (count == 0)
+ return GL_FALSE;
+
if (!check_index_bounds(ctx, count, type, indices, basevertex))
return GL_FALSE;
diff --git a/mesalib/src/mesa/program/ir_to_mesa.cpp b/mesalib/src/mesa/program/ir_to_mesa.cpp
index f612f41ba..340a4497f 100644
--- a/mesalib/src/mesa/program/ir_to_mesa.cpp
+++ b/mesalib/src/mesa/program/ir_to_mesa.cpp
@@ -1492,6 +1492,7 @@ ir_to_mesa_visitor::visit(ir_expression *ir)
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:
diff --git a/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
index 4e29e4500..37779d4e5 100644
--- a/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
+++ b/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
@@ -1972,6 +1972,7 @@ glsl_to_tgsi_visitor::visit(ir_expression *ir)
case ir_unop_find_msb:
case ir_unop_find_lsb:
case ir_binop_bfm:
+ case ir_triop_fma:
case ir_triop_bfi:
case ir_triop_bitfield_extract:
case ir_quadop_bitfield_insert:
diff --git a/mesalib/src/mesa/vbo/vbo_exec_array.c b/mesalib/src/mesa/vbo/vbo_exec_array.c
index bd05cd0c3..1670409d4 100644
--- a/mesalib/src/mesa/vbo/vbo_exec_array.c
+++ b/mesalib/src/mesa/vbo/vbo_exec_array.c
@@ -1334,6 +1334,16 @@ vbo_validated_multidrawelements(struct gl_context *ctx, GLenum mode,
}
}
+ /* Draw primitives individually if one count is zero, so we can easily skip
+ * that primitive.
+ */
+ for (i = 0; i < primcount; i++) {
+ if (count[i] == 0) {
+ fallback = GL_TRUE;
+ break;
+ }
+ }
+
/* If the index buffer isn't in a VBO, then treating the application's
* subranges of the index buffer as one large index buffer may lead to
* us reading unmapped memory.
@@ -1370,6 +1380,8 @@ vbo_validated_multidrawelements(struct gl_context *ctx, GLenum mode,
} else {
/* render one prim at a time */
for (i = 0; i < primcount; i++) {
+ if (count[i] == 0)
+ continue;
ib.count = count[i];
ib.type = type;
ib.obj = ctx->Array.ArrayObj->ElementArrayBufferObj;