[Mesa-dev] [PATCH automake] gallium/drivers/radeon: Build it as module to fix egl_gallium.so.

2012-12-19 Thread Johannes Obermayr
Otherwise egl_gallium.so fails to load for all drivers if we build r600 and 
radeonsi together.
---
Now we should be able to merge automake branch :)
---
 src/gallium/drivers/radeon/Makefile.am |9 +
 1 Datei geändert, 9 Zeilen hinzugefügt(+)

diff --git a/src/gallium/drivers/radeon/Makefile.am 
b/src/gallium/drivers/radeon/Makefile.am
index adb5ebe..37780c0 100644
--- a/src/gallium/drivers/radeon/Makefile.am
+++ b/src/gallium/drivers/radeon/Makefile.am
@@ -1,7 +1,16 @@
 include Makefile.sources
 include $(top_srcdir)/src/gallium/Automake.inc
 
+if HAVE_GALLIUM_R600
+if HAVE_GALLIUM_RADEONSI
+lib_LTLIBRARIES = libradeon.la
+libradeon_la_LDFLAGS = -avoid-version -module
+else
 noinst_LTLIBRARIES = libradeon.la
+endif
+else
+noinst_LTLIBRARIES = libradeon.la
+endif
 
 AM_CXXFLAGS = \
$(filter-out -DDEBUG, $(LLVM_CXXFLAGS)) \
-- 
1.7.10.4

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 1/4] r600g: use r600_get_temp to get temporaries for CLIPDIST shader outputs

2012-12-19 Thread Marek Olšák
I need this to be able to use r600_get_temp in the function later.
---
 src/gallium/drivers/r600/r600_shader.c |   14 +++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/src/gallium/drivers/r600/r600_shader.c 
b/src/gallium/drivers/r600/r600_shader.c
index bcd43f1..0ffa1fa 100644
--- a/src/gallium/drivers/r600/r600_shader.c
+++ b/src/gallium/drivers/r600/r600_shader.c
@@ -1468,6 +1468,9 @@ static int r600_shader_from_tgsi(struct r600_screen 
*rscreen,
}
}
 
+   /* Reset the temporary register counter. */
+   ctx.max_driver_temp_used = 0;
+
/* Get instructions if we are using the LLVM backend. */
if (use_llvm) {
r600_bytecode_from_byte_stream(&ctx, inst_bytes, 
inst_byte_count);
@@ -1477,15 +1480,20 @@ static int r600_shader_from_tgsi(struct r600_screen 
*rscreen,
noutput = shader->noutput;
 
if (ctx.clip_vertex_write) {
+   unsigned clipdist_temp[2];
+
+   clipdist_temp[0] = r600_get_temp(&ctx);
+   clipdist_temp[1] = r600_get_temp(&ctx);
+
/* need to convert a clipvertex write into clipdistance writes 
and not export
   the clip vertex anymore */
 
memset(&shader->output[noutput], 0, 2*sizeof(struct 
r600_shader_io));
shader->output[noutput].name = TGSI_SEMANTIC_CLIPDIST;
-   shader->output[noutput].gpr = ctx.temp_reg;
+   shader->output[noutput].gpr = clipdist_temp[0];
noutput++;
shader->output[noutput].name = TGSI_SEMANTIC_CLIPDIST;
-   shader->output[noutput].gpr = ctx.temp_reg+1;
+   shader->output[noutput].gpr = clipdist_temp[1];
noutput++;
 
/* reset spi_sid for clipvertex output to avoid confusing spi */
@@ -1508,7 +1516,7 @@ static int r600_shader_from_tgsi(struct r600_screen 
*rscreen,
alu.src[1].kc_bank = R600_UCP_CONST_BUFFER;
alu.src[1].chan = j;
 
-   alu.dst.sel = ctx.temp_reg + oreg;
+   alu.dst.sel = clipdist_temp[oreg];
alu.dst.chan = j;
alu.dst.write = (j == ochan);
if (j == 3)
-- 
1.7.10.4

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 2/4] r600g: lower stream outputs with dst_offset < start_component

2012-12-19 Thread Marek Olšák
This fixes streamout breakage caused by the varying packing.
---
 src/gallium/drivers/r600/r600_shader.c |   54 +++-
 1 file changed, 47 insertions(+), 7 deletions(-)

diff --git a/src/gallium/drivers/r600/r600_shader.c 
b/src/gallium/drivers/r600/r600_shader.c
index 0ffa1fa..55b5db3 100644
--- a/src/gallium/drivers/r600/r600_shader.c
+++ b/src/gallium/drivers/r600/r600_shader.c
@@ -1530,23 +1530,63 @@ static int r600_shader_from_tgsi(struct r600_screen 
*rscreen,
 
/* Add stream outputs. */
if (ctx.type == TGSI_PROCESSOR_VERTEX && so.num_outputs) {
-   for (i = 0; i < so.num_outputs; i++) {
-   struct r600_bytecode_output output;
+   unsigned so_gpr[PIPE_MAX_SHADER_OUTPUTS];
 
+   /* Sanity checking. */
+   if (so.num_outputs > PIPE_MAX_SHADER_OUTPUTS) {
+   R600_ERR("Too many stream outputs: %d\n", 
so.num_outputs);
+   r = -EINVAL;
+   goto out_err;
+   }
+   for (i = 0; i < so.num_outputs; i++) {
if (so.output[i].output_buffer >= 4) {
-   R600_ERR("exceeded the max number of stream 
output buffers, got: %d\n",
+   R600_ERR("Exceeded the max number of stream 
output buffers, got: %d\n",
 so.output[i].output_buffer);
r = -EINVAL;
goto out_err;
}
+   }
+
+   /* Initialize locations where the outputs are stored. */
+   for (i = 0; i < so.num_outputs; i++) {
+   so_gpr[i] = 
shader->output[so.output[i].register_index].gpr;
+
+   /* Lower outputs with dst_offset < start_component.
+*
+* We can only output 4D vectors with a write mask, 
e.g. we can
+* only output the W component at offset 3, etc. If we 
want
+* to store Y, Z, or W at buffer offset 0, we need to 
use MOV
+* to move it to X and output X. */
if (so.output[i].dst_offset < 
so.output[i].start_component) {
-  R600_ERR("stream_output - dst_offset cannot be less 
than start_component\n");
-  r = -EINVAL;
-  goto out_err;
+   unsigned tmp = r600_get_temp(&ctx);
+
+   for (j = 0; j < so.output[i].num_components; 
j++) {
+   struct r600_bytecode_alu alu;
+   memset(&alu, 0, sizeof(struct 
r600_bytecode_alu));
+   alu.inst = BC_INST(ctx.bc, 
V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV);
+   alu.src[0].sel = so_gpr[i];
+   alu.src[0].chan = 
so.output[i].start_component + j;
+
+   alu.dst.sel = tmp;
+   alu.dst.chan = j;
+   alu.dst.write = 1;
+   if (j == so.output[i].num_components - 
1)
+   alu.last = 1;
+   r = r600_bytecode_add_alu(ctx.bc, &alu);
+   if (r)
+   return r;
+   }
+   so.output[i].start_component = 0;
+   so_gpr[i] = tmp;
}
+   }
+
+   /* Write outputs to buffers. */
+   for (i = 0; i < so.num_outputs; i++) {
+   struct r600_bytecode_output output;
 
memset(&output, 0, sizeof(struct r600_bytecode_output));
-   output.gpr = 
shader->output[so.output[i].register_index].gpr;
+   output.gpr = so_gpr[i];
output.elem_size = 0;
output.array_base = so.output[i].dst_offset - 
so.output[i].start_component;
output.type = 
V_SQ_CF_ALLOC_EXPORT_WORD0_SQ_EXPORT_WRITE;
-- 
1.7.10.4

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 3/4] r600g: try to fix streamout for the cases where BURST_COUNT > 0

2012-12-19 Thread Marek Olšák
The burst was incorrectly used, because ELEM_SIZE was always 0.
I don't know if the burst works, because I don't know of any test
which uses it.

NOTE: This is a candidate for the stable branches.
---
 src/gallium/drivers/r600/r600_shader.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/gallium/drivers/r600/r600_shader.c 
b/src/gallium/drivers/r600/r600_shader.c
index 55b5db3..470a345 100644
--- a/src/gallium/drivers/r600/r600_shader.c
+++ b/src/gallium/drivers/r600/r600_shader.c
@@ -1587,7 +1587,7 @@ static int r600_shader_from_tgsi(struct r600_screen 
*rscreen,
 
memset(&output, 0, sizeof(struct r600_bytecode_output));
output.gpr = so_gpr[i];
-   output.elem_size = 0;
+   output.elem_size = so.output[i].num_components;
output.array_base = so.output[i].dst_offset - 
so.output[i].start_component;
output.type = 
V_SQ_CF_ALLOC_EXPORT_WORD0_SQ_EXPORT_WRITE;
output.burst_count = 1;
-- 
1.7.10.4

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 4/4] r600g: refactor and make streamout dumping more informative

2012-12-19 Thread Marek Olšák
---
 src/gallium/drivers/r600/r600_shader.c |   33 
 1 file changed, 21 insertions(+), 12 deletions(-)

diff --git a/src/gallium/drivers/r600/r600_shader.c 
b/src/gallium/drivers/r600/r600_shader.c
index 470a345..bca62ad 100644
--- a/src/gallium/drivers/r600/r600_shader.c
+++ b/src/gallium/drivers/r600/r600_shader.c
@@ -108,6 +108,26 @@ static int r600_shader_from_tgsi(struct r600_screen 
*rscreen,
 struct r600_pipe_shader *pipeshader,
 struct r600_shader_key key);
 
+static void r600_dump_streamout(struct pipe_stream_output_info *so)
+{
+   unsigned i;
+
+   fprintf(stderr, "STREAMOUT\n");
+   for (i = 0; i < so->num_outputs; i++) {
+   unsigned mask = ((1 << so->output[i].num_components) - 1) <<
+   so->output[i].start_component;
+   fprintf(stderr, "  %i: MEM_STREAM0_BUF%i[%i..%i] <- 
OUT[%i].%s%s%s%s%s\n",
+   i, so->output[i].output_buffer,
+   so->output[i].dst_offset, so->output[i].dst_offset + 
so->output[i].num_components - 1,
+   so->output[i].register_index,
+   mask & 1 ? "x" : "",
+   mask & 2 ? "y" : "",
+   mask & 4 ? "z" : "",
+   mask & 8 ? "w" : "",
+   so->output[i].dst_offset < 
so->output[i].start_component ? " (will lower)" : "");
+   }
+}
+
 int r600_pipe_shader_create(struct pipe_context *ctx,
struct r600_pipe_shader *shader,
struct r600_shader_key key)
@@ -127,18 +147,7 @@ int r600_pipe_shader_create(struct pipe_context *ctx,
tgsi_dump(sel->tokens, 0);
 
if (sel->so.num_outputs) {
-   unsigned i;
-   fprintf(stderr, "STREAMOUT\n");
-   for (i = 0; i < sel->so.num_outputs; i++) {
-   unsigned mask = ((1 << 
sel->so.output[i].num_components) - 1) <<
-   
sel->so.output[i].start_component;
-   fprintf(stderr, "  %i: MEM_STREAM0_BUF%i 
OUT[%i].%s%s%s%s\n", i,
-   sel->so.output[i].output_buffer, 
sel->so.output[i].register_index,
-   mask & 1 ? "x" : "_",
-   (mask >> 1) & 1 ? "y" : "_",
-   (mask >> 2) & 1 ? "z" : "_",
-   (mask >> 3) & 1 ? "w" : "_");
-   }
+   r600_dump_streamout(&sel->so);
}
}
r = r600_shader_from_tgsi(rctx->screen, shader, key);
-- 
1.7.10.4

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 3/5] glsl: Plumb through is_parameter to apply_type_qualifier_to_variable()

2012-12-19 Thread Paul Berry
This patch adds logic to allow the ast_to_hir function
apply_type_qualifier_to_variable() to tell whether it is acting on a
variable declaration or a function parameter.  This will allow it to
correctly interpret the meaning of "out" and "in" keywords (which have
different meanings in those two contexts).
---
 src/glsl/ast_to_hir.cpp | 7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp
index 94b63f6..a14fe7d 100644
--- a/src/glsl/ast_to_hir.cpp
+++ b/src/glsl/ast_to_hir.cpp
@@ -1915,7 +1915,8 @@ apply_type_qualifier_to_variable(const struct 
ast_type_qualifier *qual,
 ir_variable *var,
 struct _mesa_glsl_parse_state *state,
 YYLTYPE *loc,
-bool ubo_qualifiers_valid)
+bool ubo_qualifiers_valid,
+ bool is_parameter)
 {
if (qual->flags.q.invariant) {
   if (var->used) {
@@ -2626,7 +2627,7 @@ ast_declarator_list::hir(exec_list *instructions,
   }
 
   apply_type_qualifier_to_variable(& this->type->qualifier, var, state,
-  & loc, this->ubo_qualifiers_valid);
+  & loc, this->ubo_qualifiers_valid, 
false);
 
   if (this->type->qualifier.flags.q.invariant) {
 if ((state->target == vertex_shader) && !(var->mode == ir_var_out ||
@@ -3065,7 +3066,7 @@ ast_parameter_declarator::hir(exec_list *instructions,
 * for function parameters the default mode is 'in'.
 */
apply_type_qualifier_to_variable(& this->type->qualifier, var, state, & loc,
-   false);
+   false, true);
 
/* From page 17 (page 23 of the PDF) of the GLSL 1.20 spec:
 *
-- 
1.8.0.2

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 4/5] glsl: Prohibit structs and bools from being used as "varyings".

2012-12-19 Thread Paul Berry
The GLSL 1.30 spec only allows vertex shader outputs and fragment
shader inputs ("varyings" in pre-GLSL-1.30 parlance) to be of type
int, uint, float, or vectors, matrices, or arrays thereof.  Bools,
bvec's, and structs are prohibited.  (Integral varyings were
prohibited prior to GLSL 1.30).

Previously, Mesa only performed this check on variables declared with
the "varying" keyword, and it always performed the check according to
the pre-GLSL-1.30 rules.  As a result, bools and structs were allowed
to slip through, provided they were declared using the new in/out
syntax.

This patch modifies the error check so that it occurs after "varying"
is converted to "in/out", and corrects it to properly account for GLSL
version.

Fixes piglit tests:
  in-bool-prohibited.frag
  in-bvec2-prohibited.frag
  in-bvec3-prohibited.frag
  in-bvec4-prohibited.frag
  in-struct-prohibited.frag
  out-bool-prohibited.vert
  out-bvec2-prohibited.vert
  out-bvec3-prohibited.vert
  out-bvec4-prohibited.vert
  out-struct-prohibited.vert
---
 src/glsl/ast_to_hir.cpp | 92 ++---
 1 file changed, 71 insertions(+), 21 deletions(-)

diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp
index a14fe7d..f934c8e 100644
--- a/src/glsl/ast_to_hir.cpp
+++ b/src/glsl/ast_to_hir.cpp
@@ -1910,6 +1910,29 @@ ast_type_specifier::glsl_type(const char **name,
 }
 
 
+/**
+ * Determine whether a toplevel variable declaration declares a varying.  This
+ * function operates by examining the variable's mode and the shader target,
+ * so it correctly identifies linkage variables regardless of whether they are
+ * declared using the deprecated "varying" syntax or the new "in/out" syntax.
+ *
+ * Passing a non-toplevel variable declaration (e.g. a function parameter) to
+ * this function will produce undefined results.
+ */
+static bool
+is_varying_var(ir_variable *var, _mesa_glsl_parser_targets target)
+{
+   switch (target) {
+   case vertex_shader:
+  return var->mode == ir_var_out;
+   case fragment_shader:
+  return var->mode == ir_var_in;
+   default:
+  return var->mode == ir_var_out || var->mode == ir_var_in;
+   }
+}
+
+
 static void
 apply_type_qualifier_to_variable(const struct ast_type_qualifier *qual,
 ir_variable *var,
@@ -1945,27 +1968,6 @@ apply_type_qualifier_to_variable(const struct 
ast_type_qualifier *qual,
   _mesa_glsl_shader_target_name(state->target));
}
 
-   /* From page 25 (page 31 of the PDF) of the GLSL 1.10 spec:
-*
-* "The varying qualifier can be used only with the data types
-* float, vec2, vec3, vec4, mat2, mat3, and mat4, or arrays of
-* these."
-*/
-   if (qual->flags.q.varying) {
-  const glsl_type *non_array_type;
-
-  if (var->type && var->type->is_array())
-non_array_type = var->type->fields.array;
-  else
-non_array_type = var->type;
-
-  if (non_array_type && non_array_type->base_type != GLSL_TYPE_FLOAT) {
-var->type = glsl_type::error_type;
-_mesa_glsl_error(loc, state,
- "varying variables must be of base type float");
-  }
-   }
-
/* If there is no qualifier that changes the mode of the variable, leave
 * the setting alone.
 */
@@ -1980,6 +1982,54 @@ apply_type_qualifier_to_variable(const struct 
ast_type_qualifier *qual,
else if (qual->flags.q.uniform)
   var->mode = ir_var_uniform;
 
+   if (!is_parameter && is_varying_var(var, state->target)) {
+  /* This variable is being used to link data between shader stages (in
+   * pre-glsl-1.30 parlance, it's a "varying").  Check that it has a type
+   * that is allowed for such purposes.
+   *
+   * From page 25 (page 31 of the PDF) of the GLSL 1.10 spec:
+   *
+   * "The varying qualifier can be used only with the data types
+   * float, vec2, vec3, vec4, mat2, mat3, and mat4, or arrays of
+   * these."
+   *
+   * This was relaxed in GLSL version 1.30 and GLSL ES version 3.00.  From
+   * page 31 (page 37 of the PDF) of the GLSL 1.30 spec:
+   *
+   * "Fragment inputs can only be signed and unsigned integers and
+   * integer vectors, float, floating-point vectors, matrices, or
+   * arrays of these. Structures cannot be input.
+   *
+   * Similar text exists in the section on vertex shader outputs.
+   *
+   * Similar text exists in the GLSL ES 3.00 spec, except that the GLSL ES
+   * 3.00 spec claims to allow structs as well.  However, this is likely
+   * an error, since section 11 of the spec ("Counting of Inputs and
+   * Outputs") enumerates all possible types of interstage linkage
+   * variables, and it does not mention structs.
+   */
+  switch (var->type->get_scalar_type()->base_type) {
+  case GLSL_TYPE_FLOAT:
+ /* Ok in all GLSL versions */
+ break;
+  case GLSL_TY

[Mesa-dev] [PATCH 5/5] glsl: Pack flat "varyings" of mixed types together.

2012-12-19 Thread Paul Berry
This patch enhances the varying packing code so that flat varyings of
uint, int, and float types can be packed together.

We accomplish this in lower_packed_varyings.cpp by making the type of
all flat varyings ivec4, and then using information-preserving type
conversions (e.g. ir_unop_bitcast_f2i) to convert all other types to
ints.

The varying_matches::compute_packing_class() function is updated to
reflect the fact that varying packing no longer needs to segregate
varyings of different base types.

Fixes piglit test varying-packing-mixed-types.
---
 src/glsl/link_varyings.cpp | 20 +++
 src/glsl/lower_packed_varyings.cpp | 72 +-
 2 files changed, 78 insertions(+), 14 deletions(-)

diff --git a/src/glsl/link_varyings.cpp b/src/glsl/link_varyings.cpp
index b9c3f5d..5c27f23 100644
--- a/src/glsl/link_varyings.cpp
+++ b/src/glsl/link_varyings.cpp
@@ -777,17 +777,25 @@ varying_matches::store_locations(unsigned producer_base,
 unsigned
 varying_matches::compute_packing_class(ir_variable *var)
 {
-   /* In this initial implementation we conservatively assume that variables
-* can only be packed if their base type (float/int/uint/bool) matches and
-* their interpolation and centroid qualifiers match.
+   /* Without help from the back-end, there is no way to pack together
+* variables with different interpolation types, because
+* lower_packed_varyings must choose exactly one interpolation type for
+* each packed varying it creates.
 *
-* TODO: relax these restrictions when the driver back-end permits.
+* However, we can safely pack together floats, ints, and uints, because:
+*
+* - varyings of base type "int" and "uint" must use the "flat"
+*   interpolation type, which can only occur in GLSL 1.30 and above.
+*
+* - On platforms that support GLSL 1.30 and above, lower_packed_varyings
+*   can store flat floats as ints without losing any information (using
+*   the ir_unop_bitcast_* opcodes).
+*
+* Therefore, the packing class depends only on the interpolation type.
 */
unsigned packing_class = var->centroid ? 1 : 0;
packing_class *= 4;
packing_class += var->interpolation;
-   packing_class *= GLSL_TYPE_ERROR;
-   packing_class += var->type->get_scalar_type()->base_type;
return packing_class;
 }
 
diff --git a/src/glsl/lower_packed_varyings.cpp 
b/src/glsl/lower_packed_varyings.cpp
index 09c551c..9cf1075 100644
--- a/src/glsl/lower_packed_varyings.cpp
+++ b/src/glsl/lower_packed_varyings.cpp
@@ -66,6 +66,10 @@
  * performance.  However, hopefully in most cases the performance loss will
  * either be absorbed by a later optimization pass, or it will be offset by
  * memory bandwidth savings (because fewer varyings are used).
+ *
+ * This lowering pass also packs flat floats, ints, and uints together, by
+ * using ivec4 as the base type of flat "varyings", and using appropriate
+ * casts to convert floats and uints into ints.
  */
 
 #include "glsl_symbol_table.h"
@@ -90,6 +94,7 @@ public:
void run(exec_list *instructions);
 
 private:
+   ir_assignment *bitwise_assign(ir_rvalue *lhs, ir_rvalue *rhs);
unsigned lower_rvalue(ir_rvalue *rvalue, unsigned fine_location,
  ir_variable *unpacked_var, const char *name);
unsigned lower_arraylike(ir_rvalue *rvalue, unsigned array_size,
@@ -181,6 +186,55 @@ lower_packed_varyings_visitor::run(exec_list *instructions)
}
 }
 
+
+/**
+ * Make an ir_assignment from \c rhs to \c lhs, performing appropriate
+ * bitcasts if necessary to match up types.
+ */
+ir_assignment *
+lower_packed_varyings_visitor::bitwise_assign(ir_rvalue *lhs, ir_rvalue *rhs)
+{
+   if (lhs->type->base_type != rhs->type->base_type) {
+  /* Since we only mix types in flat varyings, and we always store flat
+   * varyings as type ivec4, we need only produce conversions to and from
+   * int.
+   */
+  switch (rhs->type->base_type) {
+  case GLSL_TYPE_UINT:
+ rhs = new(this->mem_ctx)
+ir_expression(ir_unop_u2i, lhs->type, rhs);
+ break;
+  case GLSL_TYPE_FLOAT:
+ rhs = new(this->mem_ctx)
+ir_expression(ir_unop_bitcast_f2i, lhs->type, rhs);
+ break;
+  case GLSL_TYPE_INT:
+ switch (lhs->type->base_type) {
+ case GLSL_TYPE_UINT:
+rhs = new(this->mem_ctx)
+   ir_expression(ir_unop_i2u, lhs->type, rhs);
+break;
+ case GLSL_TYPE_FLOAT:
+rhs = new(this->mem_ctx)
+   ir_expression(ir_unop_bitcast_i2f, lhs->type, rhs);
+break;
+ case GLSL_TYPE_INT:
+/* No conversion needed */
+break;
+ default:
+assert(!"Unexpected type conversion while lowering varyings");
+break;
+ }
+ break;
+  default:
+ assert(!"Unexpected type conversion while lowering varyings");
+ break;
+ 

[Mesa-dev] [PATCH 1/5] mesa: Add ALIGN() macro to main/macros.h.

2012-12-19 Thread Paul Berry
Previously this macro existed in 3 separate places, some inside the
intel driver and some outside of it.  It makes more sense to have it
in main/macros.h
---
 src/glsl/linker.cpp|  2 --
 src/mesa/drivers/dri/i965/brw_context.h|  1 +
 src/mesa/drivers/dri/intel/intel_context.h | 13 -
 src/mesa/main/extensions.c |  3 +--
 src/mesa/main/macros.h | 13 +
 5 files changed, 15 insertions(+), 17 deletions(-)

diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp
index be08156..c5c462b 100644
--- a/src/glsl/linker.cpp
+++ b/src/glsl/linker.cpp
@@ -76,8 +76,6 @@ extern "C" {
 #include "main/shaderobj.h"
 }
 
-#define ALIGN(value, alignment)  (((value) + alignment - 1) & ~(alignment - 1))
-
 /**
  * Visitor that determines whether or not a variable is ever written.
  */
diff --git a/src/mesa/drivers/dri/i965/brw_context.h 
b/src/mesa/drivers/dri/i965/brw_context.h
index eba9eb5..c7fc586 100644
--- a/src/mesa/drivers/dri/i965/brw_context.h
+++ b/src/mesa/drivers/dri/i965/brw_context.h
@@ -36,6 +36,7 @@
 #include "intel_context.h"
 #include "brw_structs.h"
 #include "main/imports.h"
+#include "main/macros.h"
 
 #ifdef __cplusplus
 extern "C" {
diff --git a/src/mesa/drivers/dri/intel/intel_context.h 
b/src/mesa/drivers/dri/intel/intel_context.h
index 8d544dc..dbc5ea0 100644
--- a/src/mesa/drivers/dri/intel/intel_context.h
+++ b/src/mesa/drivers/dri/intel/intel_context.h
@@ -350,19 +350,6 @@ extern char *__progname;
 #define ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0]))
 
 /**
- * Align a value up to an alignment value
- *
- * If \c value is not already aligned to the requested alignment value, it
- * will be rounded up.
- *
- * \param value  Value to be rounded
- * \param alignment  Alignment value to be used.  This must be a power of two.
- *
- * \sa ROUND_DOWN_TO()
- */
-#define ALIGN(value, alignment)  (((value) + alignment - 1) & ~(alignment - 1))
-
-/**
  * Align a value down to an alignment value
  *
  * If \c value is not already aligned to the requested alignment value, it
diff --git a/src/mesa/main/extensions.c b/src/mesa/main/extensions.c
index 98711b3..3486b65 100644
--- a/src/mesa/main/extensions.c
+++ b/src/mesa/main/extensions.c
@@ -34,11 +34,10 @@
 #include "imports.h"
 #include "context.h"
 #include "extensions.h"
+#include "macros.h"
 #include "mfeatures.h"
 #include "mtypes.h"
 
-#define ALIGN(value, alignment)  (((value) + alignment - 1) & ~(alignment - 1))
-
 enum {
DISABLE = 0,
GLL = 1 << API_OPENGL_COMPAT,   /* GL Legacy / Compatibility */
diff --git a/src/mesa/main/macros.h b/src/mesa/main/macros.h
index 14a5d5f..d1e81fe 100644
--- a/src/mesa/main/macros.h
+++ b/src/mesa/main/macros.h
@@ -656,6 +656,19 @@ INTERP_4F(GLfloat t, GLfloat dst[4], const GLfloat out[4], 
const GLfloat in[4])
 #define MIN3( A, B, C ) ((A) < (B) ? MIN2(A, C) : MIN2(B, C))
 #define MAX3( A, B, C ) ((A) > (B) ? MAX2(A, C) : MAX2(B, C))
 
+/**
+ * Align a value up to an alignment value
+ *
+ * If \c value is not already aligned to the requested alignment value, it
+ * will be rounded up.
+ *
+ * \param value  Value to be rounded
+ * \param alignment  Alignment value to be used.  This must be a power of two.
+ *
+ * \sa ROUND_DOWN_TO()
+ */
+#define ALIGN(value, alignment)  (((value) + alignment - 1) & ~(alignment - 1))
+
 
 
 /** Cross product of two 3-element vectors */
-- 
1.8.0.2

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 3/5] glsl: Plumb through is_parameter to apply_type_qualifier_to_variable()

2012-12-19 Thread Matt Turner
On Wed, Dec 19, 2012 at 8:42 AM, Paul Berry  wrote:
> This patch adds logic to allow the ast_to_hir function
> apply_type_qualifier_to_variable() to tell whether it is acting on a
> variable declaration or a function parameter.  This will allow it to
> correctly interpret the meaning of "out" and "in" keywords (which have
> different meanings in those two contexts).
> ---
>  src/glsl/ast_to_hir.cpp | 7 ---
>  1 file changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp
> index 94b63f6..a14fe7d 100644
> --- a/src/glsl/ast_to_hir.cpp
> +++ b/src/glsl/ast_to_hir.cpp
> @@ -1915,7 +1915,8 @@ apply_type_qualifier_to_variable(const struct 
> ast_type_qualifier *qual,
>  ir_variable *var,
>  struct _mesa_glsl_parse_state *state,
>  YYLTYPE *loc,
> -bool ubo_qualifiers_valid)
> +bool ubo_qualifiers_valid,
> + bool is_parameter)

Whitespace might be a little off here.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH] r600g: add cs tracing infrastructure for lockup pin pointing

2012-12-19 Thread j . glisse
From: Jerome Glisse 

It's a build time option you need to set R600_TRACE_CS to 1 and it
will print to stderr all cs along as cs trace point value which
gave last offset into a cs process by the GPU.

Signed-off-by: Jerome Glisse 
---
 src/gallium/drivers/r600/r600_hw_context.c  | 41 +
 src/gallium/drivers/r600/r600_hw_context_priv.h |  5 +--
 src/gallium/drivers/r600/r600_pipe.c| 20 
 src/gallium/drivers/r600/r600_pipe.h| 16 ++
 src/gallium/drivers/r600/r600_state_common.c| 26 
 5 files changed, 106 insertions(+), 2 deletions(-)

diff --git a/src/gallium/drivers/r600/r600_hw_context.c 
b/src/gallium/drivers/r600/r600_hw_context.c
index cdd31a4..6c8cb9d 100644
--- a/src/gallium/drivers/r600/r600_hw_context.c
+++ b/src/gallium/drivers/r600/r600_hw_context.c
@@ -27,6 +27,7 @@
 #include "r600d.h"
 #include "util/u_memory.h"
 #include 
+#include 
 
 /* Get backends mask */
 void r600_get_backend_mask(struct r600_context *ctx)
@@ -369,6 +370,11 @@ void r600_need_cs_space(struct r600_context *ctx, unsigned 
num_dw,
for (i = 0; i < R600_NUM_ATOMS; i++) {
if (ctx->atoms[i] && ctx->atoms[i]->dirty) {
num_dw += ctx->atoms[i]->num_dw;
+#if R600_TRACE_CS
+   if (ctx->screen->trace_bo) {
+   num_dw += R600_TRACE_CS_DWORDS;
+   }
+#endif
}
}
 
@@ -376,6 +382,11 @@ void r600_need_cs_space(struct r600_context *ctx, unsigned 
num_dw,
 
/* The upper-bound of how much space a draw command would take. 
*/
num_dw += R600_MAX_FLUSH_CS_DWORDS + R600_MAX_DRAW_CS_DWORDS;
+#if R600_TRACE_CS
+   if (ctx->screen->trace_bo) {
+   num_dw += R600_TRACE_CS_DWORDS;
+   }
+#endif
}
 
/* Count in queries_suspend. */
@@ -717,7 +728,37 @@ void r600_context_flush(struct r600_context *ctx, unsigned 
flags)
}
 
/* Flush the CS. */
+#if R600_TRACE_CS
+   if (ctx->screen->trace_bo) {
+   struct r600_screen *rscreen = ctx->screen;
+   unsigned i;
+
+   for (i = 0; i < cs->cdw; i++) {
+   fprintf(stderr, "[%4d] [%5d] 0x%08x\n", 
rscreen->cs_count, i, cs->buf[i]);
+   }
+   rscreen->cs_count++;
+   }
+#endif
ctx->ws->cs_flush(ctx->cs, flags);
+#if R600_TRACE_CS
+   if (ctx->screen->trace_bo) {
+   struct r600_screen *rscreen = ctx->screen;
+   unsigned i;
+
+   for (i = 0; i < 10; i++) {
+   usleep(5);
+   if (!ctx->ws->buffer_is_busy(rscreen->trace_bo->buf, 
RADEON_USAGE_READWRITE)) {
+   break;
+   }
+   }
+   if (i == 10) {
+   fprintf(stderr, "timeout on cs lockup likely happen at 
cs %d dw %d\n",
+   rscreen->trace_ptr[1], rscreen->trace_ptr[0]);
+   } else {
+   fprintf(stderr, "cs %d executed in %dms\n", 
rscreen->trace_ptr[1], i * 5);
+   }
+   }
+#endif
 
r600_begin_new_cs(ctx);
 }
diff --git a/src/gallium/drivers/r600/r600_hw_context_priv.h 
b/src/gallium/drivers/r600/r600_hw_context_priv.h
index 050c472..692e6ec 100644
--- a/src/gallium/drivers/r600/r600_hw_context_priv.h
+++ b/src/gallium/drivers/r600/r600_hw_context_priv.h
@@ -29,8 +29,9 @@
 #include "r600_pipe.h"
 
 /* the number of CS dwords for flushing and drawing */
-#define R600_MAX_FLUSH_CS_DWORDS 12
-#define R600_MAX_DRAW_CS_DWORDS 34
+#define R600_MAX_FLUSH_CS_DWORDS   12
+#define R600_MAX_DRAW_CS_DWORDS34
+#define R600_TRACE_CS_DWORDS   7
 
 /* these flags are used in register flags and added into block flags */
 #define REG_FLAG_NEED_BO 1
diff --git a/src/gallium/drivers/r600/r600_pipe.c 
b/src/gallium/drivers/r600/r600_pipe.c
index e497744..7990400 100644
--- a/src/gallium/drivers/r600/r600_pipe.c
+++ b/src/gallium/drivers/r600/r600_pipe.c
@@ -723,6 +723,12 @@ static void r600_destroy_screen(struct pipe_screen* 
pscreen)
rscreen->ws->buffer_unmap(rscreen->fences.bo->cs_buf);
pipe_resource_reference((struct 
pipe_resource**)&rscreen->fences.bo, NULL);
}
+#if R600_TRACE_CS
+   if (rscreen->trace_bo) {
+   rscreen->ws->buffer_unmap(rscreen->trace_bo->cs_buf);
+   pipe_resource_reference((struct 
pipe_resource**)&rscreen->trace_bo, NULL);
+   }
+#endif
pipe_mutex_destroy(rscreen->fences.mutex);
 
rscreen->ws->destroy(rscreen->ws);
@@ -1042,5 +1048,19 @@ struct pipe_screen *r600_screen_create(struct 
radeon_winsys *ws)
 
rscreen->global_pool = compute_memory_pool_new(rscreen);
 
+#if R600_TRACE_CS
+   rscreen->cs_

Re: [Mesa-dev] [PATCH] r600g: add cs tracing infrastructure for lockup pin pointing

2012-12-19 Thread Jerome Glisse
On Wed, Dec 19, 2012 at 12:17 PM,   wrote:
> From: Jerome Glisse 
>
> It's a build time option you need to set R600_TRACE_CS to 1 and it
> will print to stderr all cs along as cs trace point value which
> gave last offset into a cs process by the GPU.
>
> Signed-off-by: Jerome Glisse 

For information this is something i have been using for a while and i
am just getting tire of porting it over and over so i cleaned it up
into something that i believe is usefull. My rdb tools can be used to
annotate cs output given by this infrastructure: rdb_annotateib
hd2xxx.rdb dumpfile > dumpfile.readablebyhuman

I gave the the last dw before lockup. If you don't have many
application running at the same time it has proven to be accurate most
of the time.

Note you will need the kernel patch i just sent.

Cheers,
Jerome


> ---
>  src/gallium/drivers/r600/r600_hw_context.c  | 41 
> +
>  src/gallium/drivers/r600/r600_hw_context_priv.h |  5 +--
>  src/gallium/drivers/r600/r600_pipe.c| 20 
>  src/gallium/drivers/r600/r600_pipe.h| 16 ++
>  src/gallium/drivers/r600/r600_state_common.c| 26 
>  5 files changed, 106 insertions(+), 2 deletions(-)
>
> diff --git a/src/gallium/drivers/r600/r600_hw_context.c 
> b/src/gallium/drivers/r600/r600_hw_context.c
> index cdd31a4..6c8cb9d 100644
> --- a/src/gallium/drivers/r600/r600_hw_context.c
> +++ b/src/gallium/drivers/r600/r600_hw_context.c
> @@ -27,6 +27,7 @@
>  #include "r600d.h"
>  #include "util/u_memory.h"
>  #include 
> +#include 
>
>  /* Get backends mask */
>  void r600_get_backend_mask(struct r600_context *ctx)
> @@ -369,6 +370,11 @@ void r600_need_cs_space(struct r600_context *ctx, 
> unsigned num_dw,
> for (i = 0; i < R600_NUM_ATOMS; i++) {
> if (ctx->atoms[i] && ctx->atoms[i]->dirty) {
> num_dw += ctx->atoms[i]->num_dw;
> +#if R600_TRACE_CS
> +   if (ctx->screen->trace_bo) {
> +   num_dw += R600_TRACE_CS_DWORDS;
> +   }
> +#endif
> }
> }
>
> @@ -376,6 +382,11 @@ void r600_need_cs_space(struct r600_context *ctx, 
> unsigned num_dw,
>
> /* The upper-bound of how much space a draw command would 
> take. */
> num_dw += R600_MAX_FLUSH_CS_DWORDS + R600_MAX_DRAW_CS_DWORDS;
> +#if R600_TRACE_CS
> +   if (ctx->screen->trace_bo) {
> +   num_dw += R600_TRACE_CS_DWORDS;
> +   }
> +#endif
> }
>
> /* Count in queries_suspend. */
> @@ -717,7 +728,37 @@ void r600_context_flush(struct r600_context *ctx, 
> unsigned flags)
> }
>
> /* Flush the CS. */
> +#if R600_TRACE_CS
> +   if (ctx->screen->trace_bo) {
> +   struct r600_screen *rscreen = ctx->screen;
> +   unsigned i;
> +
> +   for (i = 0; i < cs->cdw; i++) {
> +   fprintf(stderr, "[%4d] [%5d] 0x%08x\n", 
> rscreen->cs_count, i, cs->buf[i]);
> +   }
> +   rscreen->cs_count++;
> +   }
> +#endif
> ctx->ws->cs_flush(ctx->cs, flags);
> +#if R600_TRACE_CS
> +   if (ctx->screen->trace_bo) {
> +   struct r600_screen *rscreen = ctx->screen;
> +   unsigned i;
> +
> +   for (i = 0; i < 10; i++) {
> +   usleep(5);
> +   if (!ctx->ws->buffer_is_busy(rscreen->trace_bo->buf, 
> RADEON_USAGE_READWRITE)) {
> +   break;
> +   }
> +   }
> +   if (i == 10) {
> +   fprintf(stderr, "timeout on cs lockup likely happen 
> at cs %d dw %d\n",
> +   rscreen->trace_ptr[1], rscreen->trace_ptr[0]);
> +   } else {
> +   fprintf(stderr, "cs %d executed in %dms\n", 
> rscreen->trace_ptr[1], i * 5);
> +   }
> +   }
> +#endif
>
> r600_begin_new_cs(ctx);
>  }
> diff --git a/src/gallium/drivers/r600/r600_hw_context_priv.h 
> b/src/gallium/drivers/r600/r600_hw_context_priv.h
> index 050c472..692e6ec 100644
> --- a/src/gallium/drivers/r600/r600_hw_context_priv.h
> +++ b/src/gallium/drivers/r600/r600_hw_context_priv.h
> @@ -29,8 +29,9 @@
>  #include "r600_pipe.h"
>
>  /* the number of CS dwords for flushing and drawing */
> -#define R600_MAX_FLUSH_CS_DWORDS 12
> -#define R600_MAX_DRAW_CS_DWORDS 34
> +#define R600_MAX_FLUSH_CS_DWORDS   12
> +#define R600_MAX_DRAW_CS_DWORDS34
> +#define R600_TRACE_CS_DWORDS   7
>
>  /* these flags are used in register flags and added into block flags */
>  #define REG_FLAG_NEED_BO 1
> diff --git a/src/gallium/drivers/r600/r600_pipe.c 
> b/src/gallium/drivers/r600/r600_pipe.c
> index e497744..7990400 100644
> --- a/src/gallium/drivers/r600/r600_pipe.c
> +++ b/src/gallium/driver

Re: [Mesa-dev] [PATCH 2/2] r600g: texture buffer object + glsl 1.40 enable support

2012-12-19 Thread Tom Stellard
On Sun, Dec 16, 2012 at 08:33:23PM +1000, Dave Airlie wrote:
> From: Dave Airlie 
> 
> This adds TBO support to r600g, and with GLSL 1.40 enabled,
> we now get 3.1 core profiles advertised for r600g.
> 
> This code is evergreen only so far, but I don't think there is
> much to make it work on r600/700/cayman other than testing.
> 
> a) buffer txq is broken like cube map txq, this sucks, fix it the
> exact same way.
> 
> b) buffer fetches are done with a vertex clause,
> 
> c) vertex swizzling offsets are different than texture swizzles,
> but we still need to use the combiner, so make it configurable.
> 
> d) add implementation of UCMP.
> 
> TODO: r600/700/cayman testin
> Signed-off-by: Dave Airlie 
> ---
>  src/gallium/drivers/r600/evergreen_state.c   | 55 
>  src/gallium/drivers/r600/r600_asm.c  |  2 +-
>  src/gallium/drivers/r600/r600_asm.h  |  2 +
>  src/gallium/drivers/r600/r600_pipe.c |  4 +-
>  src/gallium/drivers/r600/r600_pipe.h | 10 +++-
>  src/gallium/drivers/r600/r600_shader.c   | 75 
> 
>  src/gallium/drivers/r600/r600_shader.h   |  1 +
>  src/gallium/drivers/r600/r600_state_common.c | 58 +
>  src/gallium/drivers/r600/r600_texture.c  | 16 --
>  9 files changed, 204 insertions(+), 19 deletions(-)
> 

[snip]

> diff --git a/src/gallium/drivers/r600/r600_shader.c 
> b/src/gallium/drivers/r600/r600_shader.c
> index feb7001..60667e7 100644
> --- a/src/gallium/drivers/r600/r600_shader.c
> +++ b/src/gallium/drivers/r600/r600_shader.c
> @@ -3819,6 +3819,71 @@ static inline unsigned tgsi_tex_get_src_gpr(struct 
> r600_shader_ctx *ctx,
>   return ctx->file_offset[inst->Src[index].Register.File] + 
> inst->Src[index].Register.Index;
>  }
>  
> +static int do_vtx_fetch_inst(struct r600_shader_ctx *ctx, boolean 
> src_requires_loading)
> +{
> + struct r600_bytecode_vtx vtx;
> + struct r600_bytecode_alu alu;
> + struct tgsi_full_instruction *inst = 
> &ctx->parse.FullToken.FullInstruction;
> + int src_gpr, r, i;
> +
> + src_gpr = tgsi_tex_get_src_gpr(ctx, 0);
> + if (src_requires_loading) {
> + for (i = 0; i < 4; i++) {
> + memset(&alu, 0, sizeof(struct r600_bytecode_alu));
> + alu.inst = CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV);
> + r600_bytecode_src(&alu.src[0], &ctx->src[0], i);
> + alu.dst.sel = ctx->temp_reg;
> + alu.dst.chan = i;
> + if (i == 3)
> + alu.last = 1;
> + alu.dst.write = 1;
> + r = r600_bytecode_add_alu(ctx->bc, &alu);
> + if (r)
> + return r;
> + }
> + src_gpr = ctx->temp_reg;
> + }
> +
> + memset(&vtx, 0, sizeof(vtx));
> + vtx.inst = 0;
> + vtx.buffer_id = tgsi_tex_get_src_gpr(ctx, 1) + R600_MAX_CONST_BUFFERS;;
> + vtx.fetch_type = 2; /* VTX_FETCH_NO_INDEX_OFFSET */
> + vtx.src_gpr = src_gpr;
> + vtx.mega_fetch_count = 16;
> + vtx.dst_gpr = ctx->file_offset[inst->Dst[0].Register.File] + 
> inst->Dst[0].Register.Index;
> + vtx.dst_sel_x = (inst->Dst[0].Register.WriteMask & 1) ? 0 : 7;  
> /* SEL_X */
> + vtx.dst_sel_y = (inst->Dst[0].Register.WriteMask & 2) ? 1 : 7;  
> /* SEL_Y */
> + vtx.dst_sel_z = (inst->Dst[0].Register.WriteMask & 4) ? 2 : 7;  
> /* SEL_Z */
> + vtx.dst_sel_w = (inst->Dst[0].Register.WriteMask & 8) ? 3 : 7;  
> /* SEL_W */
> + vtx.use_const_fields = 1;
> + vtx.srf_mode_all = 1;   /* SRF_MODE_NO_ZERO */
> +

According to the docs, srf_mode_all will be ignored if use_const_fields
is set.  However, based on my tests while running compute shaders, other
fields like data_format, which are supposed to be ignored weren't being
ignored unless the were set to zero.  So, I think it would be safer
here to set srf_mode_all to zero and make sure that bit gets set on
the resource.


> + if ((r = r600_bytecode_add_vtx(ctx->bc, &vtx)))
> + return r;
> + return 0;
> +}
> +

Otherwise, this code for vtx fetch looks good to me.  One problem I ran into
with vtx fetch instructions while working on compute shaders was that
the GPU will hang if you write to vtx.src_gpr in the
instruction group following the vtx fetch.  Here is a simple example:

%T2_X = MOV %ZERO
%T3_X = VTX_READ_eg %T2_X, 24
%T2_X = MOV %ZERO

I'm not sure if this happens on all GPU variants, but I was able to
consistently reproduce this on my SUMO.  You may want to keep an eye
out for this in case you run into any unexplainable hangs.

-Tom
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 3/5] glsl: Plumb through is_parameter to apply_type_qualifier_to_variable()

2012-12-19 Thread Paul Berry
On 19 December 2012 09:13, Matt Turner  wrote:

> On Wed, Dec 19, 2012 at 8:42 AM, Paul Berry 
> wrote:
> > This patch adds logic to allow the ast_to_hir function
> > apply_type_qualifier_to_variable() to tell whether it is acting on a
> > variable declaration or a function parameter.  This will allow it to
> > correctly interpret the meaning of "out" and "in" keywords (which have
> > different meanings in those two contexts).
> > ---
> >  src/glsl/ast_to_hir.cpp | 7 ---
> >  1 file changed, 4 insertions(+), 3 deletions(-)
> >
> > diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp
> > index 94b63f6..a14fe7d 100644
> > --- a/src/glsl/ast_to_hir.cpp
> > +++ b/src/glsl/ast_to_hir.cpp
> > @@ -1915,7 +1915,8 @@ apply_type_qualifier_to_variable(const struct
> ast_type_qualifier *qual,
> >  ir_variable *var,
> >  struct _mesa_glsl_parse_state *state,
> >  YYLTYPE *loc,
> > -bool ubo_qualifiers_valid)
> > +bool ubo_qualifiers_valid,
> > + bool is_parameter)
>
> Whitespace might be a little off here.
>

It's actually fine--this is another case of the old "tabs vs spaces look
different in diffs" problem.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 4/4] i965: Assert that relayout laid out something that won't need it again.

2012-12-19 Thread Jordan Justen
On Tue, Dec 18, 2012 at 1:35 PM, Eric Anholt  wrote:
> The ETC1 changes failed at this, so let's make sure it will be caught in
> testing next time.
> ---
>  src/mesa/drivers/dri/intel/intel_tex_validate.c |6 ++
>  1 file changed, 6 insertions(+)
>
> diff --git a/src/mesa/drivers/dri/intel/intel_tex_validate.c 
> b/src/mesa/drivers/dri/intel/intel_tex_validate.c
> index 2f1b354..3f21601 100644
> --- a/src/mesa/drivers/dri/intel/intel_tex_validate.c
> +++ b/src/mesa/drivers/dri/intel/intel_tex_validate.c
> @@ -113,6 +113,12 @@ intel_finalize_mipmap_tree(struct intel_context *intel, 
> GLuint unit)
>   if (intelObj->mt != intelImage->mt) {
>  intel_miptree_copy_teximage(intel, intelImage, intelObj->mt);
>   }
> +
> + /* After we're done, we'd better agree that our layout is
> +  * appropriate, or we'll end up hitting this function again on the
> +  * next draw
> +  */
> + assert(intel_miptree_match_image(intelObj->mt, 
> &intelImage->base.Base));

Should we use _mesa_error here, or is it very unlikely another
scenario will lead here?

Series Reviewed-by: Jordan Justen 
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 4/4] i965: Assert that relayout laid out something that won't need it again.

2012-12-19 Thread Eric Anholt
Jordan Justen  writes:

> On Tue, Dec 18, 2012 at 1:35 PM, Eric Anholt  wrote:
>> The ETC1 changes failed at this, so let's make sure it will be caught in
>> testing next time.
>> ---
>>  src/mesa/drivers/dri/intel/intel_tex_validate.c |6 ++
>>  1 file changed, 6 insertions(+)
>>
>> diff --git a/src/mesa/drivers/dri/intel/intel_tex_validate.c 
>> b/src/mesa/drivers/dri/intel/intel_tex_validate.c
>> index 2f1b354..3f21601 100644
>> --- a/src/mesa/drivers/dri/intel/intel_tex_validate.c
>> +++ b/src/mesa/drivers/dri/intel/intel_tex_validate.c
>> @@ -113,6 +113,12 @@ intel_finalize_mipmap_tree(struct intel_context *intel, 
>> GLuint unit)
>>   if (intelObj->mt != intelImage->mt) {
>>  intel_miptree_copy_teximage(intel, intelImage, intelObj->mt);
>>   }
>> +
>> + /* After we're done, we'd better agree that our layout is
>> +  * appropriate, or we'll end up hitting this function again on the
>> +  * next draw
>> +  */
>> + assert(intel_miptree_match_image(intelObj->mt, 
>> &intelImage->base.Base));
>
> Should we use _mesa_error here, or is it very unlikely another
> scenario will lead here?

Well, it's not a GL error, so not _mesa_error.  It's something that we
should always catch in testing, so I think assert is fine instead of
_mesa_problem().

> Series Reviewed-by: Jordan Justen 


pgp9944T1dzel.pgp
Description: PGP signature
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 2/2] r600g: texture buffer object + glsl 1.40 enable support

2012-12-19 Thread Jerome Glisse
On Wed, Dec 19, 2012 at 12:33 PM, Tom Stellard  wrote:
> On Sun, Dec 16, 2012 at 08:33:23PM +1000, Dave Airlie wrote:
>> From: Dave Airlie 
>>
>> This adds TBO support to r600g, and with GLSL 1.40 enabled,
>> we now get 3.1 core profiles advertised for r600g.
>>
>> This code is evergreen only so far, but I don't think there is
>> much to make it work on r600/700/cayman other than testing.
>>
>> a) buffer txq is broken like cube map txq, this sucks, fix it the
>> exact same way.
>>
>> b) buffer fetches are done with a vertex clause,
>>
>> c) vertex swizzling offsets are different than texture swizzles,
>> but we still need to use the combiner, so make it configurable.
>>
>> d) add implementation of UCMP.
>>
>> TODO: r600/700/cayman testin
>> Signed-off-by: Dave Airlie 
>> ---
>>  src/gallium/drivers/r600/evergreen_state.c   | 55 
>>  src/gallium/drivers/r600/r600_asm.c  |  2 +-
>>  src/gallium/drivers/r600/r600_asm.h  |  2 +
>>  src/gallium/drivers/r600/r600_pipe.c |  4 +-
>>  src/gallium/drivers/r600/r600_pipe.h | 10 +++-
>>  src/gallium/drivers/r600/r600_shader.c   | 75 
>> 
>>  src/gallium/drivers/r600/r600_shader.h   |  1 +
>>  src/gallium/drivers/r600/r600_state_common.c | 58 +
>>  src/gallium/drivers/r600/r600_texture.c  | 16 --
>>  9 files changed, 204 insertions(+), 19 deletions(-)
>>
>
> [snip]
>
>> diff --git a/src/gallium/drivers/r600/r600_shader.c 
>> b/src/gallium/drivers/r600/r600_shader.c
>> index feb7001..60667e7 100644
>> --- a/src/gallium/drivers/r600/r600_shader.c
>> +++ b/src/gallium/drivers/r600/r600_shader.c
>> @@ -3819,6 +3819,71 @@ static inline unsigned tgsi_tex_get_src_gpr(struct 
>> r600_shader_ctx *ctx,
>>   return ctx->file_offset[inst->Src[index].Register.File] + 
>> inst->Src[index].Register.Index;
>>  }
>>
>> +static int do_vtx_fetch_inst(struct r600_shader_ctx *ctx, boolean 
>> src_requires_loading)
>> +{
>> + struct r600_bytecode_vtx vtx;
>> + struct r600_bytecode_alu alu;
>> + struct tgsi_full_instruction *inst = 
>> &ctx->parse.FullToken.FullInstruction;
>> + int src_gpr, r, i;
>> +
>> + src_gpr = tgsi_tex_get_src_gpr(ctx, 0);
>> + if (src_requires_loading) {
>> + for (i = 0; i < 4; i++) {
>> + memset(&alu, 0, sizeof(struct r600_bytecode_alu));
>> + alu.inst = 
>> CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV);
>> + r600_bytecode_src(&alu.src[0], &ctx->src[0], i);
>> + alu.dst.sel = ctx->temp_reg;
>> + alu.dst.chan = i;
>> + if (i == 3)
>> + alu.last = 1;
>> + alu.dst.write = 1;
>> + r = r600_bytecode_add_alu(ctx->bc, &alu);
>> + if (r)
>> + return r;
>> + }
>> + src_gpr = ctx->temp_reg;
>> + }
>> +
>> + memset(&vtx, 0, sizeof(vtx));
>> + vtx.inst = 0;
>> + vtx.buffer_id = tgsi_tex_get_src_gpr(ctx, 1) + R600_MAX_CONST_BUFFERS;;
>> + vtx.fetch_type = 2; /* VTX_FETCH_NO_INDEX_OFFSET */
>> + vtx.src_gpr = src_gpr;
>> + vtx.mega_fetch_count = 16;
>> + vtx.dst_gpr = ctx->file_offset[inst->Dst[0].Register.File] + 
>> inst->Dst[0].Register.Index;
>> + vtx.dst_sel_x = (inst->Dst[0].Register.WriteMask & 1) ? 0 : 7; 
>>  /* SEL_X */
>> + vtx.dst_sel_y = (inst->Dst[0].Register.WriteMask & 2) ? 1 : 7; 
>>  /* SEL_Y */
>> + vtx.dst_sel_z = (inst->Dst[0].Register.WriteMask & 4) ? 2 : 7; 
>>  /* SEL_Z */
>> + vtx.dst_sel_w = (inst->Dst[0].Register.WriteMask & 8) ? 3 : 7; 
>>  /* SEL_W */
>> + vtx.use_const_fields = 1;
>> + vtx.srf_mode_all = 1;   /* SRF_MODE_NO_ZERO */
>> +
>
> According to the docs, srf_mode_all will be ignored if use_const_fields
> is set.  However, based on my tests while running compute shaders, other
> fields like data_format, which are supposed to be ignored weren't being
> ignored unless the were set to zero.  So, I think it would be safer
> here to set srf_mode_all to zero and make sure that bit gets set on
> the resource.
>
>
>> + if ((r = r600_bytecode_add_vtx(ctx->bc, &vtx)))
>> + return r;
>> + return 0;
>> +}
>> +
>
> Otherwise, this code for vtx fetch looks good to me.  One problem I ran into
> with vtx fetch instructions while working on compute shaders was that
> the GPU will hang if you write to vtx.src_gpr in the
> instruction group following the vtx fetch.  Here is a simple example:
>
> %T2_X = MOV %ZERO
> %T3_X = VTX_READ_eg %T2_X, 24
> %T2_X = MOV %ZERO
>
> I'm not sure if this happens on all GPU variants, but I was able to
> consistently reproduce this on my SUMO.  You may want to keep an eye
> out for this in case you run into any unexplainable hangs.
>

The vtx fetch group had the barrier flag set ?

Cheers,
Jerome

Re: [Mesa-dev] [PATCH 3/8] egl/gbm: Implement EGL_EXT_buffer_age

2012-12-19 Thread Kristian Høgsberg
On Sat, Dec 15, 2012 at 2:44 AM, Kristian Høgsberg  wrote:
> On Fri, Dec 14, 2012 at 04:54:32PM -0800, Eric Anholt wrote:
>> Kristian Høgsberg  writes:
>>
>> > ---
>> >  src/egl/drivers/dri2/egl_dri2.h |1 +
>> >  src/egl/drivers/dri2/platform_drm.c |   23 +++
>> >  2 files changed, 24 insertions(+)
>> >
>> > diff --git a/src/egl/drivers/dri2/egl_dri2.h 
>> > b/src/egl/drivers/dri2/egl_dri2.h
>> > index be359d3..fa2a9f3 100644
>> > --- a/src/egl/drivers/dri2/egl_dri2.h
>> > +++ b/src/egl/drivers/dri2/egl_dri2.h
>> > @@ -189,6 +189,7 @@ struct dri2_egl_surface
>> > struct {
>> >struct gbm_bo   *bo;
>> >int  locked;
>> > +  int  age;
>> > } color_buffers[3], *back, *current;
>> >  #ifndef HAVE_WAYLAND_PLATFORM
>> > __DRIbuffer   *dri_buffers[__DRI_BUFFER_COUNT];
>> > diff --git a/src/egl/drivers/dri2/platform_drm.c 
>> > b/src/egl/drivers/dri2/platform_drm.c
>> > index 3e04a6c..1923033 100644
>> > --- a/src/egl/drivers/dri2/platform_drm.c
>> > +++ b/src/egl/drivers/dri2/platform_drm.c
>> > @@ -324,11 +324,16 @@ dri2_swap_buffers(_EGLDriver *drv, _EGLDisplay 
>> > *disp, _EGLSurface *draw)
>> >  {
>> > struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
>> > struct dri2_egl_surface *dri2_surf = dri2_egl_surface(draw);
>> > +   int i;
>> >
>> > if (dri2_surf->base.Type == EGL_WINDOW_BIT) {
>> >if (dri2_surf->current)
>> >  _eglError(EGL_BAD_SURFACE, "dri2_swap_buffers");
>> > +  for (i = 0; i < ARRAY_SIZE(dri2_surf->color_buffers); i++)
>> > + if (dri2_surf->color_buffers[i].bo)
>> > +dri2_surf->color_buffers[i].age++;
>> >dri2_surf->current = dri2_surf->back;
>> > +  dri2_surf->current->age = 1;
>> >dri2_surf->back = NULL;
>>
>> OK, if I'm following this right, the ages of my buffers with this code are:
>
> You're missing the if (dri2_surf->color_buffers[i].bo) condition on
> incrementing age.  We start out with bo = NULL for color_buffer[0..2]
> and allocate the bos on demand...
>
>> entering my first swap
>> buffers[0] = 0 <- front
>> buffers[1] = 0 <- back
>>
>> after first swap:
>> buffers[0] = 1 <- back
>> buffers[1] = 1 <- front
>
> and so here back age will be 0 because we pick a new color_buffer from
> the pool that doesn't yet have a bo and whose age was never incremented.
>
>> after second swap:
>> buffers[0] = 1 <- front
>> buffers[1] = 2 <- back
>>
>> But reading the spec, I think it's supposed to be:
>>
>> entering my first swap
>> buffers[0] = 0 <- front
>> buffers[1] = 0 <- back
>>
>> after first swap:
>> buffers[0] = 0 <- back
>> buffers[1] = 1 <- front
>>
>> after second swap:
>> buffers[0] = 1 <- front
>> buffers[1] = 2 <- back
>>
>> Note how after the first swap, my backbuffer should have an age of 0, for
>> "unknown junk".
>
> Yup, and that's what this patch gets.

Does the explanation above make sense?

Kristian
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 3/5] glsl: Plumb through is_parameter to apply_type_qualifier_to_variable()

2012-12-19 Thread Matt Turner
On Wed, Dec 19, 2012 at 9:41 AM, Paul Berry  wrote:
> On 19 December 2012 09:13, Matt Turner  wrote:
>>
>> On Wed, Dec 19, 2012 at 8:42 AM, Paul Berry 
>> wrote:
>> > This patch adds logic to allow the ast_to_hir function
>> > apply_type_qualifier_to_variable() to tell whether it is acting on a
>> > variable declaration or a function parameter.  This will allow it to
>> > correctly interpret the meaning of "out" and "in" keywords (which have
>> > different meanings in those two contexts).
>> > ---
>> >  src/glsl/ast_to_hir.cpp | 7 ---
>> >  1 file changed, 4 insertions(+), 3 deletions(-)
>> >
>> > diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp
>> > index 94b63f6..a14fe7d 100644
>> > --- a/src/glsl/ast_to_hir.cpp
>> > +++ b/src/glsl/ast_to_hir.cpp
>> > @@ -1915,7 +1915,8 @@ apply_type_qualifier_to_variable(const struct
>> > ast_type_qualifier *qual,
>> >  ir_variable *var,
>> >  struct _mesa_glsl_parse_state *state,
>> >  YYLTYPE *loc,
>> > -bool ubo_qualifiers_valid)
>> > +bool ubo_qualifiers_valid,
>> > + bool is_parameter)
>>
>> Whitespace might be a little off here.
>
>
> It's actually fine--this is another case of the old "tabs vs spaces look
> different in diffs" problem.

The problem seems to be that the whitespace before
ubo_qualifiers_valid is tabs, and the whitespace before is_parameter
is spaces. I don't think that's intentional?
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 3/4] queryobj: Add IsQuery flag, making ISQuery() return false before BeginQuery()

2012-12-19 Thread Matt Turner
On Mon, Dec 17, 2012 at 2:24 PM, Carl Worth  wrote:
> This flag allows for the specified behavior that GenQueries reserves a name,
> but does not associate an object with it until BeginQuery. We allocate the
> object immediately with the new IsQuery flag set to false, and then set the
> flag to true at the time of BeginQuery.
>
> This allows us to implement a conformant IsQuery function by checking the
> state of the new IsQuery flag.
>
> This fixes the following es3conform tests:
>
> occlusion_query_genqueries
> occlusion_query_is_query_nonzero
> ---
>  src/mesa/main/mtypes.h   |1 +
>  src/mesa/main/queryobj.c |   20 +++-
>  2 files changed, 20 insertions(+), 1 deletion(-)
>
> diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
> index 1164fdf..5241660 100644
> --- a/src/mesa/main/mtypes.h
> +++ b/src/mesa/main/mtypes.h
> @@ -2495,6 +2495,7 @@ struct gl_query_object
> GLuint64EXT Result; /**< the counter */
> GLboolean Active;   /**< inside Begin/EndQuery */
> GLboolean Ready;/**< result is ready? */
> +   GLboolean IsQuery;  /**< query object is an actual query (see spec.) */
>  };
>
>
> diff --git a/src/mesa/main/queryobj.c b/src/mesa/main/queryobj.c
> index b482b15..74e8b2b 100644
> --- a/src/mesa/main/queryobj.c
> +++ b/src/mesa/main/queryobj.c
> @@ -56,6 +56,14 @@ _mesa_new_query_object(struct gl_context *ctx, GLuint id)
> * 2.13).
> */
>q->Ready = GL_TRUE;
> +
> +  /* OpenGL 3.1 § 2.13 says about GenQueries, "These names are marked as
> +   * used, but no object is associated with them until the first time 
> they
> +   * are used by BeginQuery." Since our implementation actually does
> +   * allocate an object at this point, use a flag to indicate that this
> +   * object is not (yet) a query.
> +   */
> +  q->IsQuery = GL_FALSE;
> }
> return q;
>  }
> @@ -257,13 +265,22 @@ _mesa_DeleteQueries(GLsizei n, const GLuint *ids)
>  GLboolean GLAPIENTRY
>  _mesa_IsQuery(GLuint id)
>  {
> +   struct gl_query_object *q;
> +
> GET_CURRENT_CONTEXT(ctx);
> ASSERT_OUTSIDE_BEGIN_END_WITH_RETVAL(ctx, GL_FALSE);
>
> if (MESA_VERBOSE & VERBOSE_API)
>_mesa_debug(ctx, "glIsQuery(%u)\n", id);
>
> -   if (id && _mesa_lookup_query_object(ctx, id))
> +   if (id == 0)
> +  return GL_FALSE;
> +
> +   q = _mesa_lookup_query_object(ctx, id);
> +   if (q == NULL)
> +  return GL_FALSE;
> +
> +   if (q->IsQuery)
>return GL_TRUE;
> else
>return GL_FALSE;

Just return q->IsQuery here? It's already declared as GLboolean.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH] mesa: Allow glReadBuffer(GL_NONE) for winsys framebuffers.

2012-12-19 Thread Paul Berry
Previously, Mesa code assumed that glReadBuffer(GL_NONE) was only
valid for user-created framebuffer objects.  However, the spec is
quite clear that is should also be valid for the default framebuffer.
>From section 18.2.1 ("Obtaining Pixels from the Framebuffer") of the
GL 4.3 spec:

"When READ_FRAMEBUFFER_BINDING is zero, i.e. the default
framebuffer, src must be one of the values listed in table 17.4,
including NONE."

Similar language exists in the GLES 3.0 spec, and in desktop GL all
the way back to ARB_framebuffer_object.

Partially fixes GLES3 conformance test "CoverageES30.test".
---
 src/mesa/main/buffers.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/mesa/main/buffers.c b/src/mesa/main/buffers.c
index 76f0d46..d10a573 100644
--- a/src/mesa/main/buffers.c
+++ b/src/mesa/main/buffers.c
@@ -532,8 +532,8 @@ _mesa_ReadBuffer(GLenum buffer)
if (MESA_VERBOSE & VERBOSE_API)
   _mesa_debug(ctx, "glReadBuffer %s\n", _mesa_lookup_enum_by_nr(buffer));
 
-   if (_mesa_is_user_fbo(fb) && buffer == GL_NONE) {
-  /* This is legal for user-created framebuffer objects */
+   if (buffer == GL_NONE) {
+  /* This is legal--it means that no buffer should be bound for reading. */
   srcBuffer = -1;
}
else {
-- 
1.8.0.2

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 3/5] glsl: Plumb through is_parameter to apply_type_qualifier_to_variable()

2012-12-19 Thread Eric Anholt
Matt Turner  writes:

> On Wed, Dec 19, 2012 at 9:41 AM, Paul Berry  wrote:
>> On 19 December 2012 09:13, Matt Turner  wrote:
>>>
>>> On Wed, Dec 19, 2012 at 8:42 AM, Paul Berry 
>>> wrote:
>>> > This patch adds logic to allow the ast_to_hir function
>>> > apply_type_qualifier_to_variable() to tell whether it is acting on a
>>> > variable declaration or a function parameter.  This will allow it to
>>> > correctly interpret the meaning of "out" and "in" keywords (which have
>>> > different meanings in those two contexts).
>>> > ---
>>> >  src/glsl/ast_to_hir.cpp | 7 ---
>>> >  1 file changed, 4 insertions(+), 3 deletions(-)
>>> >
>>> > diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp
>>> > index 94b63f6..a14fe7d 100644
>>> > --- a/src/glsl/ast_to_hir.cpp
>>> > +++ b/src/glsl/ast_to_hir.cpp
>>> > @@ -1915,7 +1915,8 @@ apply_type_qualifier_to_variable(const struct
>>> > ast_type_qualifier *qual,
>>> >  ir_variable *var,
>>> >  struct _mesa_glsl_parse_state *state,
>>> >  YYLTYPE *loc,
>>> > -bool ubo_qualifiers_valid)
>>> > +bool ubo_qualifiers_valid,
>>> > + bool is_parameter)
>>>
>>> Whitespace might be a little off here.
>>
>>
>> It's actually fine--this is another case of the old "tabs vs spaces look
>> different in diffs" problem.
>
> The problem seems to be that the whitespace before
> ubo_qualifiers_valid is tabs, and the whitespace before is_parameter
> is spaces. I don't think that's intentional?

Basically, the tabs are my fault and Ian's (I think) from before we
picked up the style that had been set down in 2006, and it's accepted
for new code to follow that style even when the surrounding code doesn't
follow it.



pgpdSxFmDetpj.pgp
Description: PGP signature
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 3/4] queryobj: Add IsQuery flag, making ISQuery() return false before BeginQuery()

2012-12-19 Thread Matt Turner
On Mon, Dec 17, 2012 at 2:24 PM, Carl Worth  wrote:
> +  /* OpenGL 3.1 § 2.13 says about GenQueries, "These names are marked as
> +   * used, but no object is associated with them until the first time 
> they
> +   * are used by BeginQuery." Since our implementation actually does
> +   * allocate an object at this point, use a flag to indicate that this
> +   * object is not (yet) a query.
> +   */
> +  q->IsQuery = GL_FALSE;

The 4.2 and 4.3 specs say

... but no object is associated with them until the first time they
are used by BeginQuery, BeginQueryIndexed, or QueryCounter.

BeginQuery vs BeginQueryIndexed are no problem, since _mesa_BeginQuery
internally is implemented with the -Indexed version. Is the
QueryCounter change actually a change in behavior or should be be
implementing that now too?
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 3/5] glsl: Plumb through is_parameter to apply_type_qualifier_to_variable()

2012-12-19 Thread Matt Turner
On Wed, Dec 19, 2012 at 1:53 PM, Eric Anholt  wrote:
> Matt Turner  writes:
>
>> On Wed, Dec 19, 2012 at 9:41 AM, Paul Berry  wrote:
>>> On 19 December 2012 09:13, Matt Turner  wrote:

 On Wed, Dec 19, 2012 at 8:42 AM, Paul Berry 
 wrote:
 > This patch adds logic to allow the ast_to_hir function
 > apply_type_qualifier_to_variable() to tell whether it is acting on a
 > variable declaration or a function parameter.  This will allow it to
 > correctly interpret the meaning of "out" and "in" keywords (which have
 > different meanings in those two contexts).
 > ---
 >  src/glsl/ast_to_hir.cpp | 7 ---
 >  1 file changed, 4 insertions(+), 3 deletions(-)
 >
 > diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp
 > index 94b63f6..a14fe7d 100644
 > --- a/src/glsl/ast_to_hir.cpp
 > +++ b/src/glsl/ast_to_hir.cpp
 > @@ -1915,7 +1915,8 @@ apply_type_qualifier_to_variable(const struct
 > ast_type_qualifier *qual,
 >  ir_variable *var,
 >  struct _mesa_glsl_parse_state *state,
 >  YYLTYPE *loc,
 > -bool ubo_qualifiers_valid)
 > +bool ubo_qualifiers_valid,
 > + bool is_parameter)

 Whitespace might be a little off here.
>>>
>>>
>>> It's actually fine--this is another case of the old "tabs vs spaces look
>>> different in diffs" problem.
>>
>> The problem seems to be that the whitespace before
>> ubo_qualifiers_valid is tabs, and the whitespace before is_parameter
>> is spaces. I don't think that's intentional?
>
> Basically, the tabs are my fault and Ian's (I think) from before we
> picked up the style that had been set down in 2006, and it's accepted
> for new code to follow that style even when the surrounding code doesn't
> follow it.

Okay, works for me. Maybe we should run the code through indent after
gles3 is merged.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 3/8] egl/gbm: Implement EGL_EXT_buffer_age

2012-12-19 Thread Eric Anholt
Kristian Høgsberg  writes:

> On Sat, Dec 15, 2012 at 2:44 AM, Kristian Høgsberg  
> wrote:
>> On Fri, Dec 14, 2012 at 04:54:32PM -0800, Eric Anholt wrote:
>>> Kristian Høgsberg  writes:
>>>
>>> > ---
>>> >  src/egl/drivers/dri2/egl_dri2.h |1 +
>>> >  src/egl/drivers/dri2/platform_drm.c |   23 +++
>>> >  2 files changed, 24 insertions(+)
>>> >
>>> > diff --git a/src/egl/drivers/dri2/egl_dri2.h 
>>> > b/src/egl/drivers/dri2/egl_dri2.h
>>> > index be359d3..fa2a9f3 100644
>>> > --- a/src/egl/drivers/dri2/egl_dri2.h
>>> > +++ b/src/egl/drivers/dri2/egl_dri2.h
>>> > @@ -189,6 +189,7 @@ struct dri2_egl_surface
>>> > struct {
>>> >struct gbm_bo   *bo;
>>> >int  locked;
>>> > +  int  age;
>>> > } color_buffers[3], *back, *current;
>>> >  #ifndef HAVE_WAYLAND_PLATFORM
>>> > __DRIbuffer   *dri_buffers[__DRI_BUFFER_COUNT];
>>> > diff --git a/src/egl/drivers/dri2/platform_drm.c 
>>> > b/src/egl/drivers/dri2/platform_drm.c
>>> > index 3e04a6c..1923033 100644
>>> > --- a/src/egl/drivers/dri2/platform_drm.c
>>> > +++ b/src/egl/drivers/dri2/platform_drm.c
>>> > @@ -324,11 +324,16 @@ dri2_swap_buffers(_EGLDriver *drv, _EGLDisplay 
>>> > *disp, _EGLSurface *draw)
>>> >  {
>>> > struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
>>> > struct dri2_egl_surface *dri2_surf = dri2_egl_surface(draw);
>>> > +   int i;
>>> >
>>> > if (dri2_surf->base.Type == EGL_WINDOW_BIT) {
>>> >if (dri2_surf->current)
>>> >  _eglError(EGL_BAD_SURFACE, "dri2_swap_buffers");
>>> > +  for (i = 0; i < ARRAY_SIZE(dri2_surf->color_buffers); i++)
>>> > + if (dri2_surf->color_buffers[i].bo)
>>> > +dri2_surf->color_buffers[i].age++;
>>> >dri2_surf->current = dri2_surf->back;
>>> > +  dri2_surf->current->age = 1;
>>> >dri2_surf->back = NULL;
>>>
>>> OK, if I'm following this right, the ages of my buffers with this code are:
>>
>> You're missing the if (dri2_surf->color_buffers[i].bo) condition on
>> incrementing age.  We start out with bo = NULL for color_buffer[0..2]
>> and allocate the bos on demand...
>>
>>> entering my first swap
>>> buffers[0] = 0 <- front
>>> buffers[1] = 0 <- back
>>>
>>> after first swap:
>>> buffers[0] = 1 <- back
>>> buffers[1] = 1 <- front
>>
>> and so here back age will be 0 because we pick a new color_buffer from
>> the pool that doesn't yet have a bo and whose age was never incremented.
>>
>>> after second swap:
>>> buffers[0] = 1 <- front
>>> buffers[1] = 2 <- back
>>>
>>> But reading the spec, I think it's supposed to be:
>>>
>>> entering my first swap
>>> buffers[0] = 0 <- front
>>> buffers[1] = 0 <- back
>>>
>>> after first swap:
>>> buffers[0] = 0 <- back
>>> buffers[1] = 1 <- front
>>>
>>> after second swap:
>>> buffers[0] = 1 <- front
>>> buffers[1] = 2 <- back
>>>
>>> Note how after the first swap, my backbuffer should have an age of 0, for
>>> "unknown junk".
>>
>> Yup, and that's what this patch gets.
>
> Does the explanation above make sense?

Sort of -- it's all predicated on there being no way for buffers to be
allocated other than a swapbuffers -- so no MESA_copy_sub_buffers or its
cousins, and nothing for binding the front buffer as an egl image (do we
actually not support any of those?).  It seems more future-proof to just
implement the "if (buffer->age != 0)" check from the spec, along with or
in place of the "if (buffer->bo != NULL)"


pgpapy8ZQWcrD.pgp
Description: PGP signature
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 6/6] mesa: Fix framebuffer blitting to GL_COLOR_ATTACHMENTi when i!=0

2012-12-19 Thread Anuj Phogat
On Tue, Dec 18, 2012 at 11:57 AM, Kenneth Graunke  wrote:
> On 12/17/2012 07:35 PM, Anuj Phogat wrote:
>>
>> This patch fixes a case when blitting to a framebuffer with
>> renderbuffers/textures attached to GL_COLOR_ATTACHMENT{1, 2, ...}.
>> Earlier we were incorrectly blitting to GL_COLOR_ATTACHMENT0 by default.
>>
>> It also fixes a blitting case when drawAttachment->Texture ==
>> readAttachment->Texture. This was causing an assertion failure in intel's
>> i965 drivers (intel_miptree_attach_map()) with gles3 conformance test
>> case:
>> framebuffer_blit_functionality_minifying_blit
>>
>> V2: Fixed a case when number of draw buffer attachments are zero.
>> Signed-off-by: Anuj Phogat 
>> ---
>>   src/mesa/main/fbobject.c |   14 +-
>>   src/mesa/swrast/s_blit.c |   33 ++---
>>   2 files changed, 39 insertions(+), 8 deletions(-)
>>
>> diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c
>> index d87239e..f4e427b 100644
>> --- a/src/mesa/main/fbobject.c
>> +++ b/src/mesa/main/fbobject.c
>> @@ -2818,8 +2818,20 @@ _mesa_BlitFramebuffer(GLint srcX0, GLint srcY0,
>> GLint srcX1, GLint srcY1,
>>
>>  /* get color read/draw renderbuffers */
>>  if (mask & GL_COLOR_BUFFER_BIT) {
>> +  const  GLuint numColorDrawBuffers =
>> + ctx->DrawBuffer->_NumColorDrawBuffers;
>> colorReadRb = readFb->_ColorReadBuffer;
>> -  colorDrawRb = drawFb->_ColorDrawBuffers[0];
>> +
>> +  if (numColorDrawBuffers > 0) {
>> + for (int i = 0; i < numColorDrawBuffers; i++) {
>> +if (ctx->DrawBuffer->_ColorDrawBuffers[i] != NULL) {
>> +   colorDrawRb = ctx->DrawBuffer->_ColorDrawBuffers[i];
>> +  break;
>> +   }
>> + }
>> +  }
>> +  else
>> + colorDrawRb = NULL;
>
>
> This looks wrong to me.  You're looping through all the draw buffers,
> advancing the pointer until you find the first drawbuffer, then
> stopping...but you're not doing any checks.
>
> I believe you actually want to check the read buffer against *each* of the
> draw buffers, i.e.
>
>  colorReadRb = readFb->_ColorReadBuffer;
>
>  for (int i = 0; i < numColorDrawBuffers; i++) {
> if (ctx->DrawBuffer->_ColorDrawBuffers[i] == NULL) {
>continue;
>
>/* From the EXT_framebuffer_object spec: ... */
>if (colorReadRb == NULL || colorDrawRb == NULL) {
>colorReadRb = colorDrawRb = NULL;
>mask &= ~GL_COLOR_BUFFER_BIT;
>break;
>} else if (!compatible_color_datatypes(...)) {
>...error...
>return;
>}
> }
>  }
>
> It looks like the compatible_resolve_formats check (below) should also be in
> this loop, so it happens on a per-buffer basis.
>
> I believe my interpretation of checking the read buffer against *all* color
> draw buffers is correct.  For example, this spec text:
>
> "The read buffer contains signed integer values and **any** draw buffer
>  does not contain signed integer values."
>
> ...really seems to imply that we should be applying these error checks to
> each of the draw buffers in turn.
I added this code to correctly handle a case when color renderbuffer/texture
is attached to GL_COLOR_ATTACHMENT{i} (where i!=0). Earlier it skips color
blitting if nothing is found attached to GL_COLOR_ATTACHMENT0.

Yes, I should also include compatible_color_datatypes() check inside 'for' loop.
Consider it fixed in next version of this patch.

>>
>> /* From the EXT_framebuffer_object spec:
>>  *
>> diff --git a/src/mesa/swrast/s_blit.c b/src/mesa/swrast/s_blit.c
>> index b0c56a4..c579572 100644
>> --- a/src/mesa/swrast/s_blit.c
>> +++ b/src/mesa/swrast/s_blit.c
>> @@ -111,6 +111,9 @@ blit_nearest(struct gl_context *ctx,
>>GLbitfield buffer)
>>   {
>>  struct gl_renderbuffer *readRb, *drawRb;
>> +   struct gl_renderbuffer_attachment *readAtt, *drawAtt;
>> +   struct gl_framebuffer *readFb = ctx->ReadBuffer;
>> +   struct gl_framebuffer *drawFb = ctx->DrawBuffer;
>>
>>  const GLint srcWidth = ABS(srcX1 - srcX0);
>>  const GLint dstWidth = ABS(dstX1 - dstX0);
>> @@ -146,8 +149,18 @@ blit_nearest(struct gl_context *ctx,
>>
>>  switch (buffer) {
>>  case GL_COLOR_BUFFER_BIT:
>> -  readRb = ctx->ReadBuffer->_ColorReadBuffer;
>> -  drawRb = ctx->DrawBuffer->_ColorDrawBuffers[0];
>> +  readAtt = &readFb->Attachment[readFb->_ColorReadBufferIndex];
>> +  for (int i = 0; i < drawFb->_NumColorDrawBuffers; i++) {
>> +  int idx = drawFb->_ColorDrawBufferIndexes[i];
>> +  if (idx != -1) {
>> + drawAtt = &drawFb->Attachment[idx];
>> +  }
>> +  else {
>> +continue;
>
>
> if (idx == -1)
>continue;
>
>
> drawAtt = &drawFb->Attachment[idx];
>
> but again, I'm skeptical here since this loop finds the last dra

Re: [Mesa-dev] [PATCH 2/2] r600g: texture buffer object + glsl 1.40 enable support

2012-12-19 Thread Tom Stellard
On Wed, Dec 19, 2012 at 02:07:22PM -0500, Jerome Glisse wrote:
> On Wed, Dec 19, 2012 at 12:33 PM, Tom Stellard  wrote:
> > On Sun, Dec 16, 2012 at 08:33:23PM +1000, Dave Airlie wrote:
> >> From: Dave Airlie 
> >>
> >> This adds TBO support to r600g, and with GLSL 1.40 enabled,
> >> we now get 3.1 core profiles advertised for r600g.
> >>
> >> This code is evergreen only so far, but I don't think there is
> >> much to make it work on r600/700/cayman other than testing.
> >>
> >> a) buffer txq is broken like cube map txq, this sucks, fix it the
> >> exact same way.
> >>
> >> b) buffer fetches are done with a vertex clause,
> >>
> >> c) vertex swizzling offsets are different than texture swizzles,
> >> but we still need to use the combiner, so make it configurable.
> >>
> >> d) add implementation of UCMP.
> >>
> >> TODO: r600/700/cayman testin
> >> Signed-off-by: Dave Airlie 
> >> ---
> >>  src/gallium/drivers/r600/evergreen_state.c   | 55 
> >>  src/gallium/drivers/r600/r600_asm.c  |  2 +-
> >>  src/gallium/drivers/r600/r600_asm.h  |  2 +
> >>  src/gallium/drivers/r600/r600_pipe.c |  4 +-
> >>  src/gallium/drivers/r600/r600_pipe.h | 10 +++-
> >>  src/gallium/drivers/r600/r600_shader.c   | 75 
> >> 
> >>  src/gallium/drivers/r600/r600_shader.h   |  1 +
> >>  src/gallium/drivers/r600/r600_state_common.c | 58 +
> >>  src/gallium/drivers/r600/r600_texture.c  | 16 --
> >>  9 files changed, 204 insertions(+), 19 deletions(-)
> >>
> >
> > [snip]
> >
> >> diff --git a/src/gallium/drivers/r600/r600_shader.c 
> >> b/src/gallium/drivers/r600/r600_shader.c
> >> index feb7001..60667e7 100644
> >> --- a/src/gallium/drivers/r600/r600_shader.c
> >> +++ b/src/gallium/drivers/r600/r600_shader.c
> >> @@ -3819,6 +3819,71 @@ static inline unsigned tgsi_tex_get_src_gpr(struct 
> >> r600_shader_ctx *ctx,
> >>   return ctx->file_offset[inst->Src[index].Register.File] + 
> >> inst->Src[index].Register.Index;
> >>  }
> >>
> >> +static int do_vtx_fetch_inst(struct r600_shader_ctx *ctx, boolean 
> >> src_requires_loading)
> >> +{
> >> + struct r600_bytecode_vtx vtx;
> >> + struct r600_bytecode_alu alu;
> >> + struct tgsi_full_instruction *inst = 
> >> &ctx->parse.FullToken.FullInstruction;
> >> + int src_gpr, r, i;
> >> +
> >> + src_gpr = tgsi_tex_get_src_gpr(ctx, 0);
> >> + if (src_requires_loading) {
> >> + for (i = 0; i < 4; i++) {
> >> + memset(&alu, 0, sizeof(struct r600_bytecode_alu));
> >> + alu.inst = 
> >> CTX_INST(V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV);
> >> + r600_bytecode_src(&alu.src[0], &ctx->src[0], i);
> >> + alu.dst.sel = ctx->temp_reg;
> >> + alu.dst.chan = i;
> >> + if (i == 3)
> >> + alu.last = 1;
> >> + alu.dst.write = 1;
> >> + r = r600_bytecode_add_alu(ctx->bc, &alu);
> >> + if (r)
> >> + return r;
> >> + }
> >> + src_gpr = ctx->temp_reg;
> >> + }
> >> +
> >> + memset(&vtx, 0, sizeof(vtx));
> >> + vtx.inst = 0;
> >> + vtx.buffer_id = tgsi_tex_get_src_gpr(ctx, 1) + 
> >> R600_MAX_CONST_BUFFERS;;
> >> + vtx.fetch_type = 2; /* VTX_FETCH_NO_INDEX_OFFSET */
> >> + vtx.src_gpr = src_gpr;
> >> + vtx.mega_fetch_count = 16;
> >> + vtx.dst_gpr = ctx->file_offset[inst->Dst[0].Register.File] + 
> >> inst->Dst[0].Register.Index;
> >> + vtx.dst_sel_x = (inst->Dst[0].Register.WriteMask & 1) ? 0 : 7;   
> >>/* SEL_X */
> >> + vtx.dst_sel_y = (inst->Dst[0].Register.WriteMask & 2) ? 1 : 7;   
> >>/* SEL_Y */
> >> + vtx.dst_sel_z = (inst->Dst[0].Register.WriteMask & 4) ? 2 : 7;   
> >>/* SEL_Z */
> >> + vtx.dst_sel_w = (inst->Dst[0].Register.WriteMask & 8) ? 3 : 7;   
> >>/* SEL_W */
> >> + vtx.use_const_fields = 1;
> >> + vtx.srf_mode_all = 1;   /* SRF_MODE_NO_ZERO */
> >> +
> >
> > According to the docs, srf_mode_all will be ignored if use_const_fields
> > is set.  However, based on my tests while running compute shaders, other
> > fields like data_format, which are supposed to be ignored weren't being
> > ignored unless the were set to zero.  So, I think it would be safer
> > here to set srf_mode_all to zero and make sure that bit gets set on
> > the resource.
> >
> >
> >> + if ((r = r600_bytecode_add_vtx(ctx->bc, &vtx)))
> >> + return r;
> >> + return 0;
> >> +}
> >> +
> >
> > Otherwise, this code for vtx fetch looks good to me.  One problem I ran into
> > with vtx fetch instructions while working on compute shaders was that
> > the GPU will hang if you write to vtx.src_gpr in the
> > instruction group following the vtx fetch.  Here is a simple example:
> >
> > %T2_X = MOV %ZERO
> > %T3_X = VTX_RE

Re: [Mesa-dev] [PATCH 1/4] i965: Add perf debug for texture relayout.

2012-12-19 Thread Ian Romanick

Strong work.

Series is

Reviewed-by: Ian Romanick 

On 12/18/2012 01:35 PM, Eric Anholt wrote:

Relayout is expensive, so it's something developers (both us and others)
should know about when it happens.
---
  src/mesa/drivers/dri/intel/intel_tex_validate.c |5 +
  1 file changed, 5 insertions(+)

diff --git a/src/mesa/drivers/dri/intel/intel_tex_validate.c 
b/src/mesa/drivers/dri/intel/intel_tex_validate.c
index ad173c9..2f1b354 100644
--- a/src/mesa/drivers/dri/intel/intel_tex_validate.c
+++ b/src/mesa/drivers/dri/intel/intel_tex_validate.c
@@ -79,6 +79,11 @@ intel_finalize_mipmap_tree(struct intel_context *intel, 
GLuint unit)
intel_miptree_get_dimensions_for_image(&firstImage->base.Base,
 &width, &height, &depth);

+  perf_debug("Creating new %s %dx%dx%d %d..%d miptree to handle finalized "
+ "texture miptree.\n",
+ _mesa_get_format_name(firstImage->base.Base.TexFormat),
+ width, height, depth, tObj->BaseLevel, intelObj->_MaxLevel);
+
intelObj->mt = intel_miptree_create(intel,
intelObj->base.Target,
  firstImage->base.Base.TexFormat,



___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 1/4] softpipe: Use os_time_get_nano() everywhere.

2012-12-19 Thread jfonseca
From: José Fonseca 

---
 src/gallium/drivers/softpipe/sp_query.c  |8 
 src/gallium/drivers/softpipe/sp_screen.c |2 +-
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/gallium/drivers/softpipe/sp_query.c 
b/src/gallium/drivers/softpipe/sp_query.c
index c173736..3981325 100644
--- a/src/gallium/drivers/softpipe/sp_query.c
+++ b/src/gallium/drivers/softpipe/sp_query.c
@@ -91,7 +91,7 @@ softpipe_begin_query(struct pipe_context *pipe, struct 
pipe_query *q)
   break;
case PIPE_QUERY_TIMESTAMP_DISJOINT:
case PIPE_QUERY_TIME_ELAPSED:
-  sq->start = 1000*os_time_get();
+  sq->start = os_time_get_nano();
   break;
case PIPE_QUERY_SO_STATISTICS:
   sq->so.primitives_storage_needed = 0;
@@ -131,7 +131,7 @@ softpipe_end_query(struct pipe_context *pipe, struct 
pipe_query *q)
   /* fall through */
case PIPE_QUERY_TIMESTAMP_DISJOINT:
case PIPE_QUERY_TIME_ELAPSED:
-  sq->end = 1000*os_time_get();
+  sq->end = os_time_get_nano();
   break;
case PIPE_QUERY_SO_STATISTICS:
   sq->so.primitives_storage_needed =
@@ -172,8 +172,8 @@ softpipe_get_query_result(struct pipe_context *pipe,
   break;
case PIPE_QUERY_TIMESTAMP_DISJOINT: {
   struct pipe_query_data_timestamp_disjoint td;
-  /*os_get_time is in microseconds*/
-  td.frequency = 100;
+  /* os_time_get_nano return nanoseconds */
+  td.frequency = UINT64_C(10);
   td.disjoint = sq->end != sq->start;
   memcpy(vresult, &td,
  sizeof(struct pipe_query_data_timestamp_disjoint));
diff --git a/src/gallium/drivers/softpipe/sp_screen.c 
b/src/gallium/drivers/softpipe/sp_screen.c
index 909fa1c..f344814 100644
--- a/src/gallium/drivers/softpipe/sp_screen.c
+++ b/src/gallium/drivers/softpipe/sp_screen.c
@@ -366,7 +366,7 @@ softpipe_flush_frontbuffer(struct pipe_screen *_screen,
 static uint64_t
 softpipe_get_timestamp(struct pipe_screen *_screen)
 {
-   return os_time_get()*1000;
+   return os_time_get_nano();
 }
 
 /**
-- 
1.7.9.5

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 2/4] gallium: s/PIPE_CAP_TIMER_QUERY/PIPE_CAP_QUERY_TIME_ELAPSED/

2012-12-19 Thread jfonseca
From: José Fonseca 

To better reflect what it iis being advertised.
---
 src/gallium/docs/source/screen.rst   |2 +-
 src/gallium/drivers/galahad/glhd_context.c   |2 +-
 src/gallium/drivers/i915/i915_screen.c   |2 +-
 src/gallium/drivers/llvmpipe/lp_screen.c |2 +-
 src/gallium/drivers/nv30/nv30_screen.c   |2 +-
 src/gallium/drivers/nv50/nv50_screen.c   |2 +-
 src/gallium/drivers/nvc0/nvc0_screen.c   |2 +-
 src/gallium/drivers/r300/r300_screen.c   |2 +-
 src/gallium/drivers/r600/r600_pipe.c |2 +-
 src/gallium/drivers/radeonsi/radeonsi_pipe.c |2 +-
 src/gallium/drivers/softpipe/sp_screen.c |2 +-
 src/gallium/drivers/svga/svga_screen.c   |2 +-
 src/gallium/include/pipe/p_defines.h |2 +-
 src/mesa/state_tracker/st_extensions.c   |4 ++--
 14 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/src/gallium/docs/source/screen.rst 
b/src/gallium/docs/source/screen.rst
index 6c89171..f4750e5 100644
--- a/src/gallium/docs/source/screen.rst
+++ b/src/gallium/docs/source/screen.rst
@@ -33,7 +33,7 @@ The integer capabilities:
 * ``PIPE_CAP_MAX_RENDER_TARGETS``: The maximum number of render targets that 
may be
   bound.
 * ``PIPE_CAP_OCCLUSION_QUERY``: Whether occlusion queries are available.
-* ``PIPE_CAP_TIMER_QUERY``: Whether timer queries are available.
+* ``PIPE_CAP_QUERY_TIME_ELAPSED``: Whether PIPE_QUERY_TIME_ELAPSED queries are 
available.
 * ``PIPE_CAP_TEXTURE_SHADOW_MAP``: indicates whether the fragment shader 
hardware
   can do the depth texture / Z comparison operation in TEX instructions
   for shadow testing.
diff --git a/src/gallium/drivers/galahad/glhd_context.c 
b/src/gallium/drivers/galahad/glhd_context.c
index ac666d4..151c8f4 100644
--- a/src/gallium/drivers/galahad/glhd_context.c
+++ b/src/gallium/drivers/galahad/glhd_context.c
@@ -74,7 +74,7 @@ galahad_context_create_query(struct pipe_context *_pipe,
}
 
if (query_type == PIPE_QUERY_TIME_ELAPSED &&
-  !pipe->screen->get_param(pipe->screen, PIPE_CAP_TIMER_QUERY)) {
+  !pipe->screen->get_param(pipe->screen, PIPE_CAP_QUERY_TIME_ELAPSED)) {
   glhd_error("Timer query requested but not supported");
}
 
diff --git a/src/gallium/drivers/i915/i915_screen.c 
b/src/gallium/drivers/i915/i915_screen.c
index 45f48c2..6f66f49 100644
--- a/src/gallium/drivers/i915/i915_screen.c
+++ b/src/gallium/drivers/i915/i915_screen.c
@@ -193,7 +193,7 @@ i915_get_param(struct pipe_screen *screen, enum pipe_cap 
cap)
case PIPE_CAP_SHADER_STENCIL_EXPORT:
case PIPE_CAP_TEXTURE_MIRROR_CLAMP:
case PIPE_CAP_TEXTURE_SWIZZLE:
-   case PIPE_CAP_TIMER_QUERY:
+   case PIPE_CAP_QUERY_TIME_ELAPSED:
case PIPE_CAP_SM3:
case PIPE_CAP_SEAMLESS_CUBE_MAP:
case PIPE_CAP_SEAMLESS_CUBE_MAP_PER_TEXTURE:
diff --git a/src/gallium/drivers/llvmpipe/lp_screen.c 
b/src/gallium/drivers/llvmpipe/lp_screen.c
index 0f30447..a974427 100644
--- a/src/gallium/drivers/llvmpipe/lp_screen.c
+++ b/src/gallium/drivers/llvmpipe/lp_screen.c
@@ -126,7 +126,7 @@ llvmpipe_get_param(struct pipe_screen *screen, enum 
pipe_cap param)
   return PIPE_MAX_COLOR_BUFS;
case PIPE_CAP_OCCLUSION_QUERY:
   return 1;
-   case PIPE_CAP_TIMER_QUERY:
+   case PIPE_CAP_QUERY_TIME_ELAPSED:
case PIPE_CAP_QUERY_TIMESTAMP:
   return 1;
case PIPE_CAP_TEXTURE_MIRROR_CLAMP:
diff --git a/src/gallium/drivers/nv30/nv30_screen.c 
b/src/gallium/drivers/nv30/nv30_screen.c
index 4733661..9ed7d82 100644
--- a/src/gallium/drivers/nv30/nv30_screen.c
+++ b/src/gallium/drivers/nv30/nv30_screen.c
@@ -70,7 +70,7 @@ nv30_screen_get_param(struct pipe_screen *pscreen, enum 
pipe_cap param)
case PIPE_CAP_POINT_SPRITE:
case PIPE_CAP_SCALED_RESOLVE:
case PIPE_CAP_OCCLUSION_QUERY:
-   case PIPE_CAP_TIMER_QUERY:
+   case PIPE_CAP_QUERY_TIME_ELAPSED:
case PIPE_CAP_QUERY_TIMESTAMP:
case PIPE_CAP_TEXTURE_SHADOW_MAP:
case PIPE_CAP_TEXTURE_SWIZZLE:
diff --git a/src/gallium/drivers/nv50/nv50_screen.c 
b/src/gallium/drivers/nv50/nv50_screen.c
index 2d6d4d6..a376db2 100644
--- a/src/gallium/drivers/nv50/nv50_screen.c
+++ b/src/gallium/drivers/nv50/nv50_screen.c
@@ -134,7 +134,7 @@ nv50_screen_get_param(struct pipe_screen *pscreen, enum 
pipe_cap param)
case PIPE_CAP_VERTEX_COLOR_CLAMPED:
   return 1;
case PIPE_CAP_QUERY_TIMESTAMP:
-   case PIPE_CAP_TIMER_QUERY:
+   case PIPE_CAP_QUERY_TIME_ELAPSED:
case PIPE_CAP_OCCLUSION_QUERY:
   return 1;
case PIPE_CAP_MAX_STREAM_OUTPUT_BUFFERS:
diff --git a/src/gallium/drivers/nvc0/nvc0_screen.c 
b/src/gallium/drivers/nvc0/nvc0_screen.c
index 08fc3b4..8d0f19a 100644
--- a/src/gallium/drivers/nvc0/nvc0_screen.c
+++ b/src/gallium/drivers/nvc0/nvc0_screen.c
@@ -110,7 +110,7 @@ nvc0_screen_get_param(struct pipe_screen *pscreen, enum 
pipe_cap param)
case PIPE_CAP_VERTEX_COLOR_CLAMPED:
   return 1;
case PIPE_CAP_QUERY_TIMESTAMP:
-   case PIPE_CAP_TIMER_QUERY:
+   case PIPE_CAP_QUERY_TIM

[Mesa-dev] [PATCH 3/4] mesa/st: Implement GL_TIME_ELAPSED w/ PIPE_QUERY_TIMESTAMP.

2012-12-19 Thread jfonseca
From: José Fonseca 

ARB/EXT_timer_query's definition of GL_TIME_ELAPSED match precisely the
subtraction of two GL_TIMESTAMP queries.

And for a lot of drivers, that's precisely how they have to implement
internally -- by emitting two hardware timestamp queries.

So, to simplify driver implementation, simply allow doing so in the state
tracker.

Eventually if no driver implements PIPE_QUERY_TIME_ELAPSED then we could
retire it.
---
 src/mesa/state_tracker/st_cb_queryobj.c |   85 ---
 src/mesa/state_tracker/st_cb_queryobj.h |4 ++
 src/mesa/state_tracker/st_context.h |1 +
 src/mesa/state_tracker/st_extensions.c  |   11 ++--
 4 files changed, 79 insertions(+), 22 deletions(-)

diff --git a/src/mesa/state_tracker/st_cb_queryobj.c 
b/src/mesa/state_tracker/st_cb_queryobj.c
index b10fd93..98b61f5 100644
--- a/src/mesa/state_tracker/st_cb_queryobj.c
+++ b/src/mesa/state_tracker/st_cb_queryobj.c
@@ -72,6 +72,11 @@ st_DeleteQuery(struct gl_context *ctx, struct 
gl_query_object *q)
   stq->pq = NULL;
}
 
+   if (stq->pq_begin) {
+  pipe->destroy_query(pipe, stq->pq_begin);
+  stq->pq_begin = NULL;
+   }
+
free(stq);
 }
 
@@ -79,7 +84,8 @@ st_DeleteQuery(struct gl_context *ctx, struct gl_query_object 
*q)
 static void
 st_BeginQuery(struct gl_context *ctx, struct gl_query_object *q)
 {
-   struct pipe_context *pipe = st_context(ctx)->pipe;
+   struct st_context *st = st_context(ctx);
+   struct pipe_context *pipe = st->pipe;
struct st_query_object *stq = st_query_object(q);
unsigned type;
 
@@ -98,29 +104,46 @@ st_BeginQuery(struct gl_context *ctx, struct 
gl_query_object *q)
case GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN:
   type = PIPE_QUERY_PRIMITIVES_EMITTED;
   break;
-   case GL_TIME_ELAPSED_EXT:
-  type = PIPE_QUERY_TIME_ELAPSED;
+   case GL_TIME_ELAPSED:
+  if (st->has_time_elapsed)
+ type = PIPE_QUERY_TIME_ELAPSED;
+  else
+ type = PIPE_QUERY_TIMESTAMP;
   break;
default:
   assert(0 && "unexpected query target in st_BeginQuery()");
   return;
}
 
-   if (stq->pq && stq->type != type) {
+   if (stq->type != type) {
   /* free old query of different type */
-  pipe->destroy_query(pipe, stq->pq);
-  stq->pq = NULL;
+  if (stq->pq) {
+ pipe->destroy_query(pipe, stq->pq);
+ stq->pq = NULL;
+  }
+  if (stq->pq_begin) {
+ pipe->destroy_query(pipe, stq->pq_begin);
+ stq->pq_begin = NULL;
+  }
   stq->type = PIPE_QUERY_TYPES; /* an invalid value */
}
 
-   if (!stq->pq) {
-  stq->pq = pipe->create_query(pipe, type);
-  stq->type = type;
+   if (q->Target == GL_TIME_ELAPSED &&
+   type == PIPE_QUERY_TIMESTAMP) {
+  /* Determine time elapsed by emitting two timestamp queries. */
+  if (!stq->pq_begin) {
+ stq->pq_begin = pipe->create_query(pipe, type);
+ stq->type = type;
+  }
+  pipe->end_query(pipe, stq->pq_begin);
+   } else {
+  if (!stq->pq) {
+ stq->pq = pipe->create_query(pipe, type);
+ stq->type = type;
+  }
+  pipe->begin_query(pipe, stq->pq);
}
-
assert(stq->type == type);
-
-   pipe->begin_query(pipe, stq->pq);
 }
 
 
@@ -132,7 +155,9 @@ st_EndQuery(struct gl_context *ctx, struct gl_query_object 
*q)
 
st_flush_bitmap_cache(st_context(ctx));
 
-   if (q->Target == GL_TIMESTAMP && !stq->pq) {
+   if ((q->Target == GL_TIMESTAMP ||
+q->Target == GL_TIME_ELAPSED) &&
+   !stq->pq) {
   stq->pq = pipe->create_query(pipe, PIPE_QUERY_TIMESTAMP);
   stq->type = PIPE_QUERY_TIMESTAMP;
}
@@ -141,6 +166,33 @@ st_EndQuery(struct gl_context *ctx, struct gl_query_object 
*q)
 }
 
 
+static boolean
+get_query_result(struct pipe_context *pipe,
+ struct st_query_object *stq,
+ boolean wait)
+{
+   if (!pipe->get_query_result(pipe,
+   stq->pq,
+   wait,
+   (void *)&stq->base.Result)) {
+  return FALSE;
+   }
+
+   if (stq->base.Target == GL_TIME_ELAPSED &&
+   stq->type == PIPE_QUERY_TIMESTAMP) {
+  /* Calculate the elapsed time from the two timestamp queries */
+  GLuint64EXT Result0 = 0;
+  assert(stq->pq_begin);
+  pipe->get_query_result(pipe, stq->pq_begin, TRUE, (void *)&Result0);
+  stq->base.Result -= Result0;
+   } else {
+  assert(!stq->pq_begin);
+   }
+
+   return TRUE;
+}
+
+
 static void
 st_WaitQuery(struct gl_context *ctx, struct gl_query_object *q)
 {
@@ -151,10 +203,7 @@ st_WaitQuery(struct gl_context *ctx, struct 
gl_query_object *q)
assert(!stq->base.Ready);
 
while (!stq->base.Ready &&
- !pipe->get_query_result(pipe, 
- stq->pq,
- TRUE,
- (void*)&q->Result))
+ !get_query_result(pipe, stq, TRUE))
{
   /* nothing */
}
@@ -169,7 +218,7 

[Mesa-dev] [PATCH 4/4] llvmpipe: Drop PIPE_QUERY_TIME_ELAPSED support.

2012-12-19 Thread jfonseca
From: José Fonseca 

It was slightly wrong: we were computing the longest duration of
the query among all the rasterizer tasks.

Regardless, for tile-based implementations such as llvmpipe, time differences
will never be very useful, because rendering before/during/after the query
is all interleaved.  And this is expected, see ARB_timer_query spec, issue 10.

In particular, piglit ext_timer_query-time-elapsed still fails, because
it makes assumptions that don't hold true in in tiled architectures. Not
sure how to fix that though.
---
 src/gallium/drivers/llvmpipe/lp_query.c  |7 ---
 src/gallium/drivers/llvmpipe/lp_rast.c   |6 --
 src/gallium/drivers/llvmpipe/lp_screen.c |1 +
 3 files changed, 1 insertion(+), 13 deletions(-)

diff --git a/src/gallium/drivers/llvmpipe/lp_query.c 
b/src/gallium/drivers/llvmpipe/lp_query.c
index 7a62a80..01d5201 100644
--- a/src/gallium/drivers/llvmpipe/lp_query.c
+++ b/src/gallium/drivers/llvmpipe/lp_query.c
@@ -122,13 +122,6 @@ llvmpipe_get_query_result(struct pipe_context *pipe,
  *result += pq->count[i];
   }
   break;
-   case PIPE_QUERY_TIME_ELAPSED:
-  for (i = 0; i < LP_MAX_THREADS; i++) {
- if (pq->count[i] > *result) {
-*result = pq->count[i];
- }
-  }
-  break;
case PIPE_QUERY_TIMESTAMP:
   for (i = 0; i < LP_MAX_THREADS; i++) {
  if (pq->count[i] > *result) {
diff --git a/src/gallium/drivers/llvmpipe/lp_rast.c 
b/src/gallium/drivers/llvmpipe/lp_rast.c
index 37be6ad..44e8324 100644
--- a/src/gallium/drivers/llvmpipe/lp_rast.c
+++ b/src/gallium/drivers/llvmpipe/lp_rast.c
@@ -437,9 +437,6 @@ lp_rast_begin_query(struct lp_rasterizer_task *task,
case PIPE_QUERY_OCCLUSION_COUNTER:
   task->vis_counter = 0;
   break;
-   case PIPE_QUERY_TIME_ELAPSED:
-  task->query_start = os_time_get_nano();
-  break;
case PIPE_QUERY_PRIMITIVES_GENERATED:
case PIPE_QUERY_PRIMITIVES_EMITTED:
   break;
@@ -468,9 +465,6 @@ lp_rast_end_query(struct lp_rasterizer_task *task,
case PIPE_QUERY_OCCLUSION_COUNTER:
   pq->count[task->thread_index] += task->vis_counter;
   break;
-   case PIPE_QUERY_TIME_ELAPSED:
-  pq->count[task->thread_index] = os_time_get_nano() - task->query_start;
-  break;
case PIPE_QUERY_TIMESTAMP:
   pq->count[task->thread_index] = os_time_get_nano();
   break;
diff --git a/src/gallium/drivers/llvmpipe/lp_screen.c 
b/src/gallium/drivers/llvmpipe/lp_screen.c
index a974427..3c2f60b 100644
--- a/src/gallium/drivers/llvmpipe/lp_screen.c
+++ b/src/gallium/drivers/llvmpipe/lp_screen.c
@@ -127,6 +127,7 @@ llvmpipe_get_param(struct pipe_screen *screen, enum 
pipe_cap param)
case PIPE_CAP_OCCLUSION_QUERY:
   return 1;
case PIPE_CAP_QUERY_TIME_ELAPSED:
+  return 0;
case PIPE_CAP_QUERY_TIMESTAMP:
   return 1;
case PIPE_CAP_TEXTURE_MIRROR_CLAMP:
-- 
1.7.9.5

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 1/4] r600g: use r600_get_temp to get temporaries for CLIPDIST shader outputs

2012-12-19 Thread Dave Airlie
All 4 look good to me,

Reviewed-by: Dave Airlie 

On Thu, Dec 20, 2012 at 2:24 AM, Marek Olšák  wrote:
> I need this to be able to use r600_get_temp in the function later.
> ---
>  src/gallium/drivers/r600/r600_shader.c |   14 +++---
>  1 file changed, 11 insertions(+), 3 deletions(-)
>
> diff --git a/src/gallium/drivers/r600/r600_shader.c 
> b/src/gallium/drivers/r600/r600_shader.c
> index bcd43f1..0ffa1fa 100644
> --- a/src/gallium/drivers/r600/r600_shader.c
> +++ b/src/gallium/drivers/r600/r600_shader.c
> @@ -1468,6 +1468,9 @@ static int r600_shader_from_tgsi(struct r600_screen 
> *rscreen,
> }
> }
>
> +   /* Reset the temporary register counter. */
> +   ctx.max_driver_temp_used = 0;
> +
> /* Get instructions if we are using the LLVM backend. */
> if (use_llvm) {
> r600_bytecode_from_byte_stream(&ctx, inst_bytes, 
> inst_byte_count);
> @@ -1477,15 +1480,20 @@ static int r600_shader_from_tgsi(struct r600_screen 
> *rscreen,
> noutput = shader->noutput;
>
> if (ctx.clip_vertex_write) {
> +   unsigned clipdist_temp[2];
> +
> +   clipdist_temp[0] = r600_get_temp(&ctx);
> +   clipdist_temp[1] = r600_get_temp(&ctx);
> +
> /* need to convert a clipvertex write into clipdistance 
> writes and not export
>the clip vertex anymore */
>
> memset(&shader->output[noutput], 0, 2*sizeof(struct 
> r600_shader_io));
> shader->output[noutput].name = TGSI_SEMANTIC_CLIPDIST;
> -   shader->output[noutput].gpr = ctx.temp_reg;
> +   shader->output[noutput].gpr = clipdist_temp[0];
> noutput++;
> shader->output[noutput].name = TGSI_SEMANTIC_CLIPDIST;
> -   shader->output[noutput].gpr = ctx.temp_reg+1;
> +   shader->output[noutput].gpr = clipdist_temp[1];
> noutput++;
>
> /* reset spi_sid for clipvertex output to avoid confusing spi 
> */
> @@ -1508,7 +1516,7 @@ static int r600_shader_from_tgsi(struct r600_screen 
> *rscreen,
> alu.src[1].kc_bank = R600_UCP_CONST_BUFFER;
> alu.src[1].chan = j;
>
> -   alu.dst.sel = ctx.temp_reg + oreg;
> +   alu.dst.sel = clipdist_temp[oreg];
> alu.dst.chan = j;
> alu.dst.write = (j == ochan);
> if (j == 3)
> --
> 1.7.10.4
>
> ___
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 1/4] softpipe: Use os_time_get_nano() everywhere.

2012-12-19 Thread Dave Airlie
Looks fine to me,

Reviewed-by: Dave Airlie 

I'll let Marek look at the timer query stuff, he has a better idea how
the drivers use it.

On Thu, Dec 20, 2012 at 9:26 AM,   wrote:
> From: José Fonseca 
>
> ---
>  src/gallium/drivers/softpipe/sp_query.c  |8 
>  src/gallium/drivers/softpipe/sp_screen.c |2 +-
>  2 files changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/src/gallium/drivers/softpipe/sp_query.c 
> b/src/gallium/drivers/softpipe/sp_query.c
> index c173736..3981325 100644
> --- a/src/gallium/drivers/softpipe/sp_query.c
> +++ b/src/gallium/drivers/softpipe/sp_query.c
> @@ -91,7 +91,7 @@ softpipe_begin_query(struct pipe_context *pipe, struct 
> pipe_query *q)
>break;
> case PIPE_QUERY_TIMESTAMP_DISJOINT:
> case PIPE_QUERY_TIME_ELAPSED:
> -  sq->start = 1000*os_time_get();
> +  sq->start = os_time_get_nano();
>break;
> case PIPE_QUERY_SO_STATISTICS:
>sq->so.primitives_storage_needed = 0;
> @@ -131,7 +131,7 @@ softpipe_end_query(struct pipe_context *pipe, struct 
> pipe_query *q)
>/* fall through */
> case PIPE_QUERY_TIMESTAMP_DISJOINT:
> case PIPE_QUERY_TIME_ELAPSED:
> -  sq->end = 1000*os_time_get();
> +  sq->end = os_time_get_nano();
>break;
> case PIPE_QUERY_SO_STATISTICS:
>sq->so.primitives_storage_needed =
> @@ -172,8 +172,8 @@ softpipe_get_query_result(struct pipe_context *pipe,
>break;
> case PIPE_QUERY_TIMESTAMP_DISJOINT: {
>struct pipe_query_data_timestamp_disjoint td;
> -  /*os_get_time is in microseconds*/
> -  td.frequency = 100;
> +  /* os_time_get_nano return nanoseconds */
> +  td.frequency = UINT64_C(10);
>td.disjoint = sq->end != sq->start;
>memcpy(vresult, &td,
>   sizeof(struct pipe_query_data_timestamp_disjoint));
> diff --git a/src/gallium/drivers/softpipe/sp_screen.c 
> b/src/gallium/drivers/softpipe/sp_screen.c
> index 909fa1c..f344814 100644
> --- a/src/gallium/drivers/softpipe/sp_screen.c
> +++ b/src/gallium/drivers/softpipe/sp_screen.c
> @@ -366,7 +366,7 @@ softpipe_flush_frontbuffer(struct pipe_screen *_screen,
>  static uint64_t
>  softpipe_get_timestamp(struct pipe_screen *_screen)
>  {
> -   return os_time_get()*1000;
> +   return os_time_get_nano();
>  }
>
>  /**
> --
> 1.7.9.5
>
> ___
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH] docs: Document spec quoting practices

2012-12-19 Thread Ian Romanick
From: Ian Romanick 

Signed-off-by: Ian Romanick 
Cc: Paul Berry 
Cc: Brian Paul 
---
 docs/devinfo.html | 42 ++
 1 file changed, 42 insertions(+)

diff --git a/docs/devinfo.html b/docs/devinfo.html
index 8f4aeef..eb4c897 100644
--- a/docs/devinfo.html
+++ b/docs/devinfo.html
@@ -155,6 +155,48 @@ of bool, true, and
 src/mesa/state_tracker/st_glsl_to_tgsi.cpp can serve as examples.
 
 
+
+It is often useful to quote sections from relevant specifications near
+code that implements part of the spec.  In order to make it easier to
+find such quotations in the code (via grep and friends) and to find the
+quoted text in the specifications, please use one of the following
+formats.
+
+
+
+Text quoted from the core OpenGL or OpenGL ES specifications:
+
+
+
+   /* Page AA (page BB of the PDF) in section C.D.E of the OpenGL F.G
+* specification says:
+*
+* "Some quoted text from the specificiation"
+*/
+
+
+
+Text quoted from the GLSL or GLSL ES ES specifications:
+
+
+
+   /* Page AA (page BB of the PDF) in section C.D.E of the GLSL F.G
+* specification says:
+*
+* "Some quoted text from the specificiation"
+*/
+
+
+
+Text quoted from an extension specifications:
+
+
+
+   /* Section C.D.E of the GL_EXT_foo_bar specification says:
+*
+* "Some quoted text from the specificiation"
+*/
+
 
 Marking a commit as a candidate for a stable branch
 
-- 
1.7.11.7

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] mesa: Allow glReadBuffer(GL_NONE) for winsys framebuffers.

2012-12-19 Thread Eric Anholt
Paul Berry  writes:

> Previously, Mesa code assumed that glReadBuffer(GL_NONE) was only
> valid for user-created framebuffer objects.  However, the spec is
> quite clear that is should also be valid for the default framebuffer.
> From section 18.2.1 ("Obtaining Pixels from the Framebuffer") of the
> GL 4.3 spec:
>
> "When READ_FRAMEBUFFER_BINDING is zero, i.e. the default
> framebuffer, src must be one of the values listed in table 17.4,
> including NONE."
>
> Similar language exists in the GLES 3.0 spec, and in desktop GL all
> the way back to ARB_framebuffer_object.

Even farther, back to EXT_framebuffer_object, too!

Reviewed-by: Eric Anholt 


pgpZnOCqvC6JK.pgp
Description: PGP signature
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 0/9] Implement GL_ARB_internalformat_query

2012-12-19 Thread Ian Romanick
GL_ARB_internalformat_query is a required part of OpenGL ES 3.0, and this
series impelments it in core Mesa and the i965 driver.  Implementation for
Gallium drivers should be trivial.

With this series all of the GL_ARB_internalformat_query recently pushed to
piglit pass *execpt* the SNORM part of the
arb_internalformat_query-api-errors.  The question of whether SNORM formats
should be renderable is still open in Khronos.  Until that is resolved, I
don't want to change the test (which matches other implementations) or Mesa
(which matches the letter of the spec).

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 1/9] mesa: Disallow deprecated SNORM formats for renderbuffers

2012-12-19 Thread Ian Romanick
From: Ian Romanick 

The OpenGL 3.2 core profile spec says:

"The following base internal formats from table 3.11 are
color-renderable: RED, RG, RGB, and RGBA. The sized internal formats
from table 3.12 that have a color-renderable base internal format
are also color-renderable. No other formats, including compressed
internal formats, are color-renderable."

The OpenGL 3.2 compatibility profile spec says (only ALPHA is added):

"The following base internal formats from table 3.16 are
color-renderable: ALPHA, RED, RG, RGB, and RGBA. The sized internal formats
from table 3.17 that have a color-renderable base internal format
are also color-renderable. No other formats, including compressed
internal formats, are color-renderable."

Table 3.12 in the core profile spec and table 3.17 in the compatibility
profile spec list SNORM formats as having a base internal format of RED,
RG, RGB, or RGBA.  From this we infer that they should also be color
renderable.

The OpenGL ES 3.0 spec says:

"An internal format is color-renderable if it is one of the formats
from table 3.12 noted as color-renderable or if it is unsized format
RGBA or RGB. No other formats, including compressed internal
formats, are color-renderable."

In the OpenGL ES 3.0 spec, none of the SNORM formats have "color-
renderable" marked in table 3.12.  The RGB I and UI formats also are not
color-renderable in ES3, but we'll save that change for another patch.

Both NVIDIA's closed-source driver (version 304.64) and AMD's
closed-source driver (Catalyst 12.6 on HD 3650) reject *all* SNORM
formats for renderbuffers in OpenGL 3.3 compatibility profiles.

v2: Move {RED,RG,RGB,RGBA}_SNORM changes from the this commit to the
next commit.  Based on suggestions from Ken.

Signed-off-by: Ian Romanick 
Reviewed-by: Marek Olšák 
Reviewed-by: Kenneth Graunke 
Reviewed-by: Eric Anholt 
---
 src/mesa/main/fbobject.c | 18 --
 1 file changed, 18 deletions(-)

diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c
index ce77b9f..0ae4d38 100644
--- a/src/mesa/main/fbobject.c
+++ b/src/mesa/main/fbobject.c
@@ -1207,24 +1207,6 @@ _mesa_base_fbo_format(struct gl_context *ctx, GLenum 
internalFormat)
   return ctx->API == API_OPENGL_COMPAT &&
  ctx->Extensions.EXT_texture_snorm &&
  ctx->Extensions.ARB_framebuffer_object ? GL_ALPHA : 0;
-   case GL_LUMINANCE_SNORM:
-   case GL_LUMINANCE8_SNORM:
-   case GL_LUMINANCE16_SNORM:
-  return ctx->API == API_OPENGL_COMPAT &&
- ctx->Extensions.EXT_texture_snorm &&
- ctx->Extensions.ARB_framebuffer_object ? GL_LUMINANCE : 0;
-   case GL_LUMINANCE_ALPHA_SNORM:
-   case GL_LUMINANCE8_ALPHA8_SNORM:
-   case GL_LUMINANCE16_ALPHA16_SNORM:
-  return ctx->API == API_OPENGL_COMPAT &&
- ctx->Extensions.EXT_texture_snorm &&
- ctx->Extensions.ARB_framebuffer_object ? GL_LUMINANCE_ALPHA : 0;
-   case GL_INTENSITY_SNORM:
-   case GL_INTENSITY8_SNORM:
-   case GL_INTENSITY16_SNORM:
-  return ctx->API == API_OPENGL_COMPAT &&
- ctx->Extensions.EXT_texture_snorm &&
- ctx->Extensions.ARB_framebuffer_object ? GL_INTENSITY : 0;
case GL_R16F:
case GL_R32F:
   return ctx->Version >= 30
-- 
1.7.11.7

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 2/9] mesa: Disallow SNORM formats for renderbuffers in OpenGL ES

2012-12-19 Thread Ian Romanick
From: Ian Romanick 

v2: Move {RED,RG,RGB,RGBA}_SNORM changes from the previous commit to
this commit.  Based on suggestions from Ken.

Signed-off-by: Ian Romanick 
Reviewed-by: Marek Olšák 
Reviewed-by: Kenneth Graunke 
Reviewed-by: Eric Anholt 
---
 src/mesa/main/fbobject.c | 20 
 1 file changed, 4 insertions(+), 16 deletions(-)

diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c
index 0ae4d38..ab53bac 100644
--- a/src/mesa/main/fbobject.c
+++ b/src/mesa/main/fbobject.c
@@ -1169,35 +1169,23 @@ _mesa_base_fbo_format(struct gl_context *ctx, GLenum 
internalFormat)
   return ctx->API != API_OPENGLES && ctx->Extensions.ARB_texture_rg
  ? GL_RG : 0;
/* signed normalized texture formats */
-   case GL_R8_SNORM:
-  return ctx->Version >= 30
- || (ctx->API == API_OPENGL_COMPAT && 
ctx->Extensions.EXT_texture_snorm)
- ? GL_RED : 0;
case GL_RED_SNORM:
+   case GL_R8_SNORM:
case GL_R16_SNORM:
   return _mesa_is_desktop_gl(ctx) && ctx->Extensions.EXT_texture_snorm
  ? GL_RED : 0;
-   case GL_RG8_SNORM:
-  return ctx->Version >= 30
- || (ctx->API == API_OPENGL_COMPAT && 
ctx->Extensions.EXT_texture_snorm)
- ? GL_RG : 0;
case GL_RG_SNORM:
+   case GL_RG8_SNORM:
case GL_RG16_SNORM:
   return _mesa_is_desktop_gl(ctx) && ctx->Extensions.EXT_texture_snorm
  ? GL_RG : 0;
-   case GL_RGB8_SNORM:
-  return ctx->Version >= 30
- || (ctx->API == API_OPENGL_COMPAT && 
ctx->Extensions.EXT_texture_snorm)
- ? GL_RGB : 0;
case GL_RGB_SNORM:
+   case GL_RGB8_SNORM:
case GL_RGB16_SNORM:
   return _mesa_is_desktop_gl(ctx) && ctx->Extensions.EXT_texture_snorm
  ? GL_RGB : 0;
-   case GL_RGBA8_SNORM:
-  return ctx->Version >= 30
- || (ctx->API == API_OPENGL_COMPAT && 
ctx->Extensions.EXT_texture_snorm)
- ? GL_RGBA : 0;
case GL_RGBA_SNORM:
+   case GL_RGBA8_SNORM:
case GL_RGBA16_SNORM:
   return _mesa_is_desktop_gl(ctx) && ctx->Extensions.EXT_texture_snorm
  ? GL_RGBA : 0;
-- 
1.7.11.7

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 3/9] mesa: Disallow R, RG, or RGB integer and unsigned formats in OpenGL ES 3.0

2012-12-19 Thread Ian Romanick
From: Ian Romanick 

Signed-off-by: Ian Romanick 
Reviewed-by: Marek Olšák 
Reviewed-by: Kenneth Graunke 
Reviewed-by: Eric Anholt 
---
 src/mesa/main/fbobject.c | 6 ++
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c
index ab53bac..281cdd0 100644
--- a/src/mesa/main/fbobject.c
+++ b/src/mesa/main/fbobject.c
@@ -1261,10 +1261,8 @@ _mesa_base_fbo_format(struct gl_context *ctx, GLenum 
internalFormat)
case GL_RGB8I_EXT:
case GL_RGB16I_EXT:
case GL_RGB32I_EXT:
-  return ctx->Version >= 30
- || (_mesa_is_desktop_gl(ctx) &&
- ctx->Extensions.EXT_texture_integer) ? GL_RGB : 0;
-
+  return _mesa_is_desktop_gl(ctx) && ctx->Extensions.EXT_texture_integer
+ ? GL_RGB : 0;
case GL_R8UI:
case GL_R8I:
case GL_R16UI:
-- 
1.7.11.7

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 4/9] intel: Fix copy-and-paste bug setting gl_constants::MaxSamples

2012-12-19 Thread Ian Romanick
From: Ian Romanick 

gl_constants::MaxSamples is an integer, so setting it to 1.0 is just
silly.

Signed-off-by: Ian Romanick 
Reviewed-by: Kenneth Graunke 
Reviewed-by: Chris Forbes 
---
 src/mesa/drivers/dri/intel/intel_context.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/mesa/drivers/dri/intel/intel_context.c 
b/src/mesa/drivers/dri/intel/intel_context.c
index b95972f..f3f9983 100644
--- a/src/mesa/drivers/dri/intel/intel_context.c
+++ b/src/mesa/drivers/dri/intel/intel_context.c
@@ -681,7 +681,7 @@ intelInitContext(struct intel_context *intel,
ctx->Const.MaxPointSizeAA = 3.0;
ctx->Const.PointSizeGranularity = 1.0;
 
-   ctx->Const.MaxSamples = 1.0;
+   ctx->Const.MaxSamples = 1;
 
if (intel->gen >= 6)
   ctx->Const.MaxClipPlanes = 8;
-- 
1.7.11.7

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 5/9] mesa: Add skeleton implementation of glGetInternalformativ

2012-12-19 Thread Ian Romanick
From: Ian Romanick 

This is for the GL_ARB_internalformat_query extension and GLES 3.0.

Signed-off-by: Ian Romanick 
---
 src/mesa/main/formatquery.c | 119 
 src/mesa/main/formatquery.h |  35 +
 src/mesa/sources.mak|   1 +
 3 files changed, 155 insertions(+)
 create mode 100644 src/mesa/main/formatquery.c
 create mode 100644 src/mesa/main/formatquery.h

diff --git a/src/mesa/main/formatquery.c b/src/mesa/main/formatquery.c
new file mode 100644
index 000..5a815c2
--- /dev/null
+++ b/src/mesa/main/formatquery.c
@@ -0,0 +1,119 @@
+/*
+ * Copyright © 2012 Intel Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+#include "mtypes.h"
+#include "glformats.h"
+#include "macros.h"
+#include "mfeatures.h"
+#include "enums.h"
+#include "fbobject.h"
+#include "formatquery.h"
+
+void GLAPIENTRY
+_mesa_GetInternalformativ(GLenum target, GLenum internalformat, GLenum pname,
+  GLsizei bufSize, GLint *params)
+{
+   GLint buffer[16];
+   GLsizei count = 0;
+   GET_CURRENT_CONTEXT(ctx);
+
+   /* The ARB_internalformat_query spec says:
+*
+* "If the  parameter to GetInternalformativ is not one of
+* TEXTURE_2D_MULTISAMPLE, TEXTURE_2D_MULTISAMPLE_ARRAY or RENDERBUFFER
+* then an INVALID_ENUM error is generated."
+*/
+   switch (target) {
+   case GL_RENDERBUFFER:
+  break;
+
+   case GL_TEXTURE_2D_MULTISAMPLE:
+   case GL_TEXTURE_2D_MULTISAMPLE_ARRAY:
+  /* Mesa does not currently support GL_ARB_texture_multisample, so these
+   * enums are not valid on this implementation either.
+   */
+   default:
+  _mesa_error(ctx, GL_INVALID_ENUM,
+  "glGetInternalformativ(target=%s)",
+  _mesa_lookup_enum_by_nr(target));
+  return;
+   }
+
+   /* The ARB_internalformat_query spec says:
+*
+* "If the  parameter to GetInternalformativ is not
+* color-, depth- or stencil-renderable, then an INVALID_ENUM error is
+* generated."
+*/
+   if (_mesa_base_fbo_format(ctx, internalformat) == 0) {
+  _mesa_error(ctx, GL_INVALID_ENUM,
+  "glGetInternalformativ(internalformat=%s)",
+  _mesa_lookup_enum_by_nr(internalformat));
+  return;
+   }
+
+   /* The ARB_internalformat_query spec says:
+*
+* "If the  parameter to GetInternalformativ is negative, then
+* an INVALID_VALUE error is generated."
+*/
+   if (bufSize < 0) {
+  _mesa_error(ctx, GL_INVALID_VALUE,
+  "glGetInternalformativ(target=%s)",
+  _mesa_lookup_enum_by_nr(target));
+  return;
+   }
+
+   switch (pname) {
+   case GL_SAMPLES:
+  buffer[0] = ctx->Const.MaxSamples;
+  count = 1;
+  break;
+   case GL_NUM_SAMPLE_COUNTS:
+  buffer[0] = 1;
+  count = 1;
+  break;
+   default:
+  _mesa_error(ctx, GL_INVALID_ENUM,
+  "glGetInternalformativ(pname=%s)",
+  _mesa_lookup_enum_by_nr(pname));
+  return;
+   }
+
+   if (bufSize != 0 && params == NULL) {
+  /* Emit a warning to aid application debugging, but go ahead and do the
+   * memcpy (and probably crash) anyway.
+   */
+  _mesa_warning(ctx,
+"glGetInternalformativ(bufSize = %d, but params = NULL",
+bufSize);
+   }
+
+   /* Copy the data from the temporary buffer to the buffer supplied by the
+* application.  Clamp the size of the copy to the size supplied by the
+* application.
+*/
+   memcpy(params, buffer, MIN2(count, bufSize) * sizeof(GLint));
+
+   return;
+}
diff --git a/src/mesa/main/formatquery.h b/src/mesa/main/formatquery.h
new file mode 100644
index 000..585c3eb
--- /dev/null
+++ b/src/mesa/main/formatquery.h
@@ -0,0 +1,35 @@
+/*
+ * Copyright © 2012 Intel Corporation
+ *
+ * Permission is hereby granted, fr

[Mesa-dev] [PATCH 7/9] mesa: Add dispatch and extension XML for GL_ARB_internalformat_query

2012-12-19 Thread Ian Romanick
From: Ian Romanick 

Signed-off-by: Ian Romanick 
---
 src/mapi/glapi/gen/ARB_internalformat_query.xml | 21 +
 src/mapi/glapi/gen/gl_API.xml   |  6 +++---
 src/mapi/glapi/gen/gl_genexec.py|  1 +
 src/mesa/main/tests/dispatch_sanity.cpp |  6 --
 4 files changed, 29 insertions(+), 5 deletions(-)
 create mode 100644 src/mapi/glapi/gen/ARB_internalformat_query.xml

diff --git a/src/mapi/glapi/gen/ARB_internalformat_query.xml 
b/src/mapi/glapi/gen/ARB_internalformat_query.xml
new file mode 100644
index 000..70a2a31
--- /dev/null
+++ b/src/mapi/glapi/gen/ARB_internalformat_query.xml
@@ -0,0 +1,21 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/mapi/glapi/gen/gl_API.xml b/src/mapi/glapi/gen/gl_API.xml
index a47316a..5d87210 100644
--- a/src/mapi/glapi/gen/gl_API.xml
+++ b/src/mapi/glapi/gen/gl_API.xml
@@ -8296,14 +8296,14 @@
   
 
 
-
+
+
+http://www.w3.org/2001/XInclude"/>
 
 
   
 
 
-
-
 http://www.w3.org/2001/XInclude"/>
 
 http://www.w3.org/2001/XInclude"/>
diff --git a/src/mapi/glapi/gen/gl_genexec.py b/src/mapi/glapi/gen/gl_genexec.py
index da9ae71..a85b447 100644
--- a/src/mapi/glapi/gen/gl_genexec.py
+++ b/src/mapi/glapi/gen/gl_genexec.py
@@ -108,6 +108,7 @@ header = """/**
 #include "main/shaderapi.h"
 #include "main/uniforms.h"
 #include "main/syncobj.h"
+#include "main/formatquery.h"
 #include "main/dispatch.h"
 
 
diff --git a/src/mesa/main/tests/dispatch_sanity.cpp 
b/src/mesa/main/tests/dispatch_sanity.cpp
index a285559..39e08c8 100644
--- a/src/mesa/main/tests/dispatch_sanity.cpp
+++ b/src/mesa/main/tests/dispatch_sanity.cpp
@@ -895,6 +895,9 @@ const struct function gl_core_functions_possible[] = {
 // { "glTextureStorage2DMultisampleEXT", 43, -1 },  // XXX: Add to xml
 // { "glTextureStorage3DMultisampleEXT", 43, -1 },  // XXX: Add to xml
 
+   /* GL_ARB_internalformat_query */
+   { "glGetInternalformativ", 30, -1 },
+
{ NULL, 0, -1 }
 };
 
@@ -1314,8 +1317,7 @@ const struct function gles3_functions_possible[] = {
// { "glGetInteger64i_v", 30, -1 },
{ "glGetInteger64v", 30, -1 },
{ "glGetIntegeri_v", 30, -1 },
-   // XXX: Missing implementation of ARB_internalformat_query
-   // { "glGetInternalformativ", 30, -1 },
+   { "glGetInternalformativ", 30, -1 },
// XXX: Missing implementation of ARB_get_program_binary
/// { "glGetProgramBinary", 30, -1 },
{ "glGetQueryiv", 30, -1 },
-- 
1.7.11.7

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 6/9] mesa: Add extension tracking bit for GL_ARB_internalformat_query

2012-12-19 Thread Ian Romanick
From: Ian Romanick 

Though, I'm tempted to always expose this extension when
GL_ARB_framebuffer_object is exposed.  In that case, it would share the same
enable bit.

Signed-off-by: Ian Romanick 
---
 src/mesa/main/extensions.c | 1 +
 src/mesa/main/mtypes.h | 1 +
 2 files changed, 2 insertions(+)

diff --git a/src/mesa/main/extensions.c b/src/mesa/main/extensions.c
index 98711b3..1b8f267 100644
--- a/src/mesa/main/extensions.c
+++ b/src/mesa/main/extensions.c
@@ -103,6 +103,7 @@ static const struct extension extension_table[] = {
{ "GL_ARB_framebuffer_sRGB",o(EXT_framebuffer_sRGB),
GL, 1998 },
{ "GL_ARB_half_float_pixel",o(ARB_half_float_pixel),
GL, 2003 },
{ "GL_ARB_half_float_vertex",   o(ARB_half_float_vertex),   
GL, 2008 },
+   { "GL_ARB_internalformat_query",
o(ARB_internalformat_query),GL, 2011 },
{ "GL_ARB_instanced_arrays",o(ARB_instanced_arrays),
GL, 2008 },
{ "GL_ARB_invalidate_subdata",  o(dummy_true),  
GL, 2012 },
{ "GL_ARB_map_buffer_alignment",
o(ARB_map_buffer_alignment),GL, 2011 },
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index 097cdc1..00145ea 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -2995,6 +2995,7 @@ struct gl_extensions
GLboolean ARB_geometry_shader4;
GLboolean ARB_half_float_pixel;
GLboolean ARB_half_float_vertex;
+   GLboolean ARB_internalformat_query;
GLboolean ARB_instanced_arrays;
GLboolean ARB_map_buffer_alignment;
GLboolean ARB_map_buffer_range;
-- 
1.7.11.7

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 8/9] mesa: Add driver method to determine the possible sample counts

2012-12-19 Thread Ian Romanick
From: Ian Romanick 

Use this method in _mesa_GetInternalformativ for both GL_SAMPLES and
GL_NUM_SAMPLE_COUNTS.

Signed-off-by: Ian Romanick 
---
 src/mesa/drivers/common/driverfuncs.c |  1 +
 src/mesa/main/dd.h| 19 +++
 src/mesa/main/formatquery.c   | 20 +---
 3 files changed, 37 insertions(+), 3 deletions(-)

diff --git a/src/mesa/drivers/common/driverfuncs.c 
b/src/mesa/drivers/common/driverfuncs.c
index 93fa3c7..3de5199 100644
--- a/src/mesa/drivers/common/driverfuncs.c
+++ b/src/mesa/drivers/common/driverfuncs.c
@@ -91,6 +91,7 @@ _mesa_init_driver_functions(struct dd_function_table *driver)
 
/* Texture functions */
driver->ChooseTextureFormat = _mesa_choose_tex_format;
+   driver->QuerySamplesForFormat = NULL;
driver->TexImage = _mesa_store_teximage;
driver->TexSubImage = _mesa_store_texsubimage;
driver->GetTexImage = _mesa_meta_GetTexImage;
diff --git a/src/mesa/main/dd.h b/src/mesa/main/dd.h
index 70c5324..3daf3da 100644
--- a/src/mesa/main/dd.h
+++ b/src/mesa/main/dd.h
@@ -201,6 +201,25 @@ struct dd_function_table {
  GLenum srcFormat, GLenum srcType );
 
/**
+* Determine sample counts support for a particular format
+*
+* \param ctxGL context
+* \param internalFormat GL format enum.  Must be color renderable
+* \param samplesBuffer to hold the returned sample counts.
+*   Drivers \b must \b not return more than 16 counts.
+*
+* \note
+* Callers of this method must not pass an invalid value for \c
+* internalFormat.
+*
+* \returns
+* The number of sample counts actually written to \c samples.
+*/
+   size_t (*QuerySamplesForFormat)(struct gl_context *ctx,
+   GLenum internalFormat,
+   int samples[16]);
+
+   /**
 * Called by glTexImage[123]D() and glCopyTexImage[12]D()
 * Allocate texture memory and copy the user's image to the buffer.
 * The gl_texture_image fields, etc. will be fully initialized.
diff --git a/src/mesa/main/formatquery.c b/src/mesa/main/formatquery.c
index 5a815c2..989d90b 100644
--- a/src/mesa/main/formatquery.c
+++ b/src/mesa/main/formatquery.c
@@ -86,11 +86,25 @@ _mesa_GetInternalformativ(GLenum target, GLenum 
internalformat, GLenum pname,
 
switch (pname) {
case GL_SAMPLES:
-  buffer[0] = ctx->Const.MaxSamples;
-  count = 1;
+  if (ctx->Driver.QuerySamplesForFormat)
+ count = ctx->Driver.QuerySamplesForFormat(ctx, internalformat,
+   buffer);
+  else
+ count = 0;
   break;
case GL_NUM_SAMPLE_COUNTS:
-  buffer[0] = 1;
+  if (ctx->Driver.QuerySamplesForFormat) {
+ const size_t num_samples =
+ctx->Driver.QuerySamplesForFormat(ctx, internalformat, buffer);
+
+ /* QuerySamplesForFormat writes some stuff to buffer, so we have to
+  * separately over-write it with the requested value.
+  */
+ buffer[0] = (GLint) num_samples;
+  } else {
+ buffer[0] = 0;
+  }
+
   count = 1;
   break;
default:
-- 
1.7.11.7

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 9/9] intel: Enable GL_ARB_internalformat_query

2012-12-19 Thread Ian Romanick
From: Ian Romanick 

Signed-off-by: Ian Romanick 
---
 src/mesa/drivers/dri/i965/brw_context.c   | 23 +++
 src/mesa/drivers/dri/intel/intel_extensions.c |  1 +
 2 files changed, 24 insertions(+)

diff --git a/src/mesa/drivers/dri/i965/brw_context.c 
b/src/mesa/drivers/dri/i965/brw_context.c
index df0f8d6..eb8de1f 100644
--- a/src/mesa/drivers/dri/i965/brw_context.c
+++ b/src/mesa/drivers/dri/i965/brw_context.c
@@ -58,6 +58,28 @@
  * Mesa's Driver Functions
  ***/
 
+static size_t
+brw_query_samples_for_format(struct gl_context *ctx, GLenum internalFormat,
+ int samples[16])
+{
+   struct intel_context *intel = intel_context(ctx);
+
+   switch (intel->gen) {
+   case 7:
+  samples[0] = 8;
+  samples[1] = 4;
+  return 2;
+
+   case 6:
+  samples[0] = 4;
+  return 1;
+
+   default:
+  samples[0] = 1;
+  return 1;
+   }
+}
+
 static void brwInitDriverFunctions(struct intel_screen *screen,
   struct dd_function_table *functions)
 {
@@ -66,6 +88,7 @@ static void brwInitDriverFunctions(struct intel_screen 
*screen,
brwInitFragProgFuncs( functions );
brw_init_queryobj_functions(functions);
 
+   functions->QuerySamplesForFormat = brw_query_samples_for_format;
functions->BeginTransformFeedback = brw_begin_transform_feedback;
 
if (screen->gen >= 7)
diff --git a/src/mesa/drivers/dri/intel/intel_extensions.c 
b/src/mesa/drivers/dri/intel/intel_extensions.c
index 5c6b651..8d92df2 100755
--- a/src/mesa/drivers/dri/intel/intel_extensions.c
+++ b/src/mesa/drivers/dri/intel/intel_extensions.c
@@ -47,6 +47,7 @@ intelInitExtensions(struct gl_context *ctx)
ctx->Extensions.ARB_explicit_attrib_location = true;
ctx->Extensions.ARB_framebuffer_object = true;
ctx->Extensions.ARB_half_float_pixel = true;
+   ctx->Extensions.ARB_internalformat_query = true;
ctx->Extensions.ARB_map_buffer_range = true;
ctx->Extensions.ARB_point_sprite = true;
ctx->Extensions.ARB_shader_objects = true;
-- 
1.7.11.7

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 3/4] queryobj: Add IsQuery flag, making ISQuery() return false before BeginQuery()

2012-12-19 Thread Carl Worth
Matt Turner  writes:
> The 4.2 and 4.3 specs say
>
> ... but no object is associated with them until the first time they
> are used by BeginQuery, BeginQueryIndexed, or QueryCounter.
>
> BeginQuery vs BeginQueryIndexed are no problem, since _mesa_BeginQuery
> internally is implemented with the -Indexed version. Is the
> QueryCounter change actually a change in behavior or should be be
> implementing that now too?

I think that's a useful clarification in the specification, and I'll fix
my patch to update the IsQuery flag there as well.

(I was working from the 3.1 specification which doesn't have
QueryCounter. The 3.3 specification adds QueryCounter, and didn't change
this sentence, but probably should have, which was fixed by the time of
4.2.)

Thanks for the catch,

-Carl

-- 
carl.d.wo...@intel.com


pgpoLhK2benf3.pgp
Description: PGP signature
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 00/11] Implement GL_ARB_get_program_binary

2012-12-19 Thread Ian Romanick
GL_ARB_get_program_binary is a required part of OpenGL ES 3.0, and this
series impelments it for all Mesa drivers.  We take the same approach of
implementing the interface with zero binary formats that we take with
GL_ARB_get_shader_binary / OpenGL ES 2.0.

This series passes all of the GL_ARB_get_program_binary recently posted
to the piglit list *except* the PROGRAM_BINARY_RETRIEVABLE_HINT.  The
test assumes that the value of the hint should be patched by
glLinkProgram as is implied by the spec.  However, this is not how
NVIDIA's implementation works, and there is debate within Khronos as to
which way is correct.

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 01/11] mesa: Fix GL_SHADER_BINARY_FORMATS query

2012-12-19 Thread Ian Romanick
From: Ian Romanick 

There were two bugs here.  First, this and several other queries were
not available in a desktop GL context with GL_ARB_ES2_compatibility.
Second, GL_NUM_SHADER_BINARY_FORMATS returns zero, but
GL_SHADER_BINARY_FORMATS writes one element of data to the buffer.  If
NUM is zero, no data should be written.

Fixes piglit test 'arb_get_program_binary-overrun shader'.

NOTE: This is a candidate for stable release branches.

Signed-off-by: Ian Romanick 
---
 src/mesa/main/get.c  |  6 +-
 src/mesa/main/get_hash_params.py | 26 --
 2 files changed, 13 insertions(+), 19 deletions(-)

diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c
index 273a79f..41f4612 100644
--- a/src/mesa/main/get.c
+++ b/src/mesa/main/get.c
@@ -296,8 +296,12 @@ static const int 
extra_ARB_uniform_buffer_object_and_geometry_shader[] = {
EXTRA_END
 };
 
+static const int extra_ARB_ES2_compatibility[] = {
+   EXTRA_API_ES2,
+   EXT(ARB_ES2_compatibility),
+   EXTRA_END
+};
 
-EXTRA_EXT(ARB_ES2_compatibility);
 EXTRA_EXT(ARB_texture_cube_map);
 EXTRA_EXT(MESA_texture_array);
 EXTRA_EXT2(EXT_secondary_color, ARB_vertex_program);
diff --git a/src/mesa/main/get_hash_params.py b/src/mesa/main/get_hash_params.py
index ac9c79c..9f67466 100644
--- a/src/mesa/main/get_hash_params.py
+++ b/src/mesa/main/get_hash_params.py
@@ -204,12 +204,6 @@ descriptor=[
   [ "TEXTURE_COORD_ARRAY_TYPE", "LOC_CUSTOM, TYPE_ENUM, offsetof(struct 
gl_client_array, Type), NO_EXTRA" ],
   [ "TEXTURE_COORD_ARRAY_STRIDE", "LOC_CUSTOM, TYPE_INT, offsetof(struct 
gl_client_array, Stride), NO_EXTRA" ],
 
-# GL_ARB_ES2_compatibility
-  [ "SHADER_COMPILER", "CONST(1), extra_ARB_ES2_compatibility" ],
-  [ "MAX_VARYING_VECTORS", "CONTEXT_INT(Const.MaxVarying), 
extra_ARB_ES2_compatibility" ],
-  [ "MAX_VERTEX_UNIFORM_VECTORS", "LOC_CUSTOM, TYPE_INT, 0, 
extra_ARB_ES2_compatibility" ],
-  [ "MAX_FRAGMENT_UNIFORM_VECTORS", "LOC_CUSTOM, TYPE_INT, 0, 
extra_ARB_ES2_compatibility" ],
-
 # GL_ARB_multitexture
   [ "MAX_TEXTURE_UNITS", "CONTEXT_INT(Const.MaxTextureUnits), NO_EXTRA" ],
   [ "CLIENT_ACTIVE_TEXTURE", "LOC_CUSTOM, TYPE_INT, 0, NO_EXTRA" ],
@@ -317,6 +311,14 @@ descriptor=[
 
 # GL_NV_read_buffer
   [ "READ_BUFFER", "LOC_CUSTOM, TYPE_ENUM, NO_OFFSET, 
extra_NV_read_buffer_api_gl" ],
+
+# GL_ARB_ES2_compatibility
+  [ "SHADER_COMPILER", "CONST(1), extra_ARB_ES2_compatibility" ],
+  [ "MAX_VARYING_VECTORS", "CONTEXT_INT(Const.MaxVarying), 
extra_ARB_ES2_compatibility" ],
+  [ "MAX_VERTEX_UNIFORM_VECTORS", "LOC_CUSTOM, TYPE_INT, 0, 
extra_ARB_ES2_compatibility" ],
+  [ "MAX_FRAGMENT_UNIFORM_VECTORS", "LOC_CUSTOM, TYPE_INT, 0, 
extra_ARB_ES2_compatibility" ],
+  [ "NUM_SHADER_BINARY_FORMATS", "CONST(0), extra_ARB_ES2_compatibility" ],
+  [ "SHADER_BINARY_FORMATS", "LOC_CUSTOM, TYPE_INVALID, 0, 
extra_ARB_ES2_compatibility" ],
 ]},
 
 { "apis": ["GLES", "GLES2"], "params": [
@@ -325,18 +327,6 @@ descriptor=[
   [ "TEXTURE_EXTERNAL_OES", "LOC_CUSTOM, TYPE_BOOLEAN, 0, 
extra_OES_EGL_image_external" ],
 ]},
 
-# Enums unique to OpenGL ES 2.0
-{ "apis": ["GLES2"], "params": [
-  [ "MAX_FRAGMENT_UNIFORM_VECTORS", "LOC_CUSTOM, TYPE_INT, 0, NO_EXTRA" ],
-  [ "MAX_VARYING_VECTORS", "CONTEXT_INT(Const.MaxVarying), NO_EXTRA" ],
-  [ "MAX_VERTEX_UNIFORM_VECTORS", "LOC_CUSTOM, TYPE_INT, 0, NO_EXTRA" ],
-  [ "SHADER_COMPILER", "CONST(1), NO_EXTRA" ],
-# OES_get_program_binary
-  [ "NUM_SHADER_BINARY_FORMATS", "CONST(0), NO_EXTRA" ],
-  [ "SHADER_BINARY_FORMATS", "CONST(0), NO_EXTRA" ],
-]},
-
-
 # Remaining enums are only in OpenGL
 { "apis": ["GL", "GL_CORE"], "params": [
   [ "ACCUM_RED_BITS", "BUFFER_INT(Visual.accumRedBits), NO_EXTRA" ],
-- 
1.7.11.7

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 03/11] mesa: Fix the naming of _mesa_ProgramParameteriARB

2012-12-19 Thread Ian Romanick
From: Ian Romanick 

After recent changes in the XML, the dispatch generators will expect
this function to be named _mesa_ProgramParameteri.

Signed-off-by: Ian Romanick 
---
 src/mesa/main/shaderapi.c | 4 ++--
 src/mesa/main/shaderapi.h | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/mesa/main/shaderapi.c b/src/mesa/main/shaderapi.c
index 1f0002f..19fa6fc 100644
--- a/src/mesa/main/shaderapi.c
+++ b/src/mesa/main/shaderapi.c
@@ -1502,7 +1502,7 @@ _mesa_ShaderBinary(GLint n, const GLuint* shaders, GLenum 
binaryformat,
 
 
 void GLAPIENTRY
-_mesa_ProgramParameteriARB(GLuint program, GLenum pname, GLint value)
+_mesa_ProgramParameteri(GLuint program, GLenum pname, GLint value)
 {
struct gl_shader_program *shProg;
GET_CURRENT_CONTEXT(ctx);
@@ -1556,7 +1556,7 @@ _mesa_ProgramParameteriARB(GLuint program, GLenum pname, 
GLint value)
   }
   break;
default:
-  _mesa_error(ctx, GL_INVALID_ENUM, "glProgramParameteriARB(pname=%s)",
+  _mesa_error(ctx, GL_INVALID_ENUM, "glProgramParameteri(pname=%s)",
   _mesa_lookup_enum_by_nr(pname));
   break;
}
diff --git a/src/mesa/main/shaderapi.h b/src/mesa/main/shaderapi.h
index 8ee68d8..53d8303 100644
--- a/src/mesa/main/shaderapi.h
+++ b/src/mesa/main/shaderapi.h
@@ -190,8 +190,8 @@ _mesa_ShaderBinary(GLint n, const GLuint *shaders, GLenum 
binaryformat,
const void* binary, GLint length);
 
 extern void GLAPIENTRY
-_mesa_ProgramParameteriARB(GLuint program, GLenum pname,
-   GLint value);
+_mesa_ProgramParameteri(GLuint program, GLenum pname, GLint value);
+
 void
 _mesa_use_shader_program(struct gl_context *ctx, GLenum type,
 struct gl_shader_program *shProg);
-- 
1.7.11.7

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 02/11] glapi: Reorder and clean up some of the includes and comments

2012-12-19 Thread Ian Romanick
From: Ian Romanick 

Signed-off-by: Ian Romanick 
---
 src/mapi/glapi/gen/gl_API.xml | 10 --
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/src/mapi/glapi/gen/gl_API.xml b/src/mapi/glapi/gen/gl_API.xml
index a47316a..6781067 100644
--- a/src/mapi/glapi/gen/gl_API.xml
+++ b/src/mapi/glapi/gen/gl_API.xml
@@ -8269,15 +8269,17 @@
   
 
 
+
+
 http://www.w3.org/2001/XInclude"/>
 
-
+http://www.w3.org/2001/XInclude"/>
 
 http://www.w3.org/2001/XInclude"/>
 
 http://www.w3.org/2001/XInclude"/>
 
-
+http://www.w3.org/2001/XInclude"/>
 
 
   
 
-http://www.w3.org/2001/XInclude"/>
-
 http://www.w3.org/2001/XInclude"/>
 
 http://www.w3.org/2001/XInclude"/>
@@ -12986,6 +12986,4 @@
 
 http://www.w3.org/2001/XInclude"/>
 
-http://www.w3.org/2001/XInclude"/>
-
 
-- 
1.7.11.7

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 04/11] mesa: Add stub implementations of glGetProgramBinary and glProgramBinary

2012-12-19 Thread Ian Romanick
From: Ian Romanick 

Signed-off-by: Ian Romanick 
---
 src/mesa/main/shaderapi.c | 50 +++
 src/mesa/main/shaderapi.h |  8 
 2 files changed, 58 insertions(+)

diff --git a/src/mesa/main/shaderapi.c b/src/mesa/main/shaderapi.c
index 19fa6fc..550018e 100644
--- a/src/mesa/main/shaderapi.c
+++ b/src/mesa/main/shaderapi.c
@@ -1500,6 +1500,56 @@ _mesa_ShaderBinary(GLint n, const GLuint* shaders, 
GLenum binaryformat,
 
 #endif /* FEATURE_ES2 */
 
+void GLAPIENTRY
+_mesa_GetProgramBinary(GLuint program, GLsizei bufSize, GLsizei *length,
+   GLenum *binaryFormat, GLvoid *binary)
+{
+   struct gl_shader_program *shProg;
+   GET_CURRENT_CONTEXT(ctx);
+
+   ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+   shProg = _mesa_lookup_shader_program_err(ctx, program, 
"glGetProgramBinary");
+   if (!shProg)
+  return;
+
+   if (!shProg->LinkStatus) {
+  _mesa_error(ctx, GL_INVALID_OPERATION,
+ "glGetProgramBinary(program %u not linked)",
+  shProg->Name);
+  return;
+   }
+
+   if (bufSize < 0){
+  _mesa_error(ctx, GL_INVALID_VALUE, "glGetProgramBinary(bufSize < 0)");
+  return;
+   }
+
+   *length = 0;
+
+   (void) binaryFormat;
+   (void) binary;
+}
+
+void GLAPIENTRY
+_mesa_ProgramBinary(GLuint program, GLenum binaryFormat,
+const GLvoid *binary, GLsizei length)
+{
+   struct gl_shader_program *shProg;
+   GET_CURRENT_CONTEXT(ctx);
+
+   ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+   shProg = _mesa_lookup_shader_program_err(ctx, program, "glProgramBinary");
+   if (!shProg)
+  return;
+
+   (void) binaryFormat;
+   (void) binary;
+   (void) length;
+   _mesa_error(ctx, GL_INVALID_OPERATION, __FUNCTION__);
+}
+
 
 void GLAPIENTRY
 _mesa_ProgramParameteri(GLuint program, GLenum pname, GLint value)
diff --git a/src/mesa/main/shaderapi.h b/src/mesa/main/shaderapi.h
index 53d8303..d3199db 100644
--- a/src/mesa/main/shaderapi.h
+++ b/src/mesa/main/shaderapi.h
@@ -190,6 +190,14 @@ _mesa_ShaderBinary(GLint n, const GLuint *shaders, GLenum 
binaryformat,
const void* binary, GLint length);
 
 extern void GLAPIENTRY
+_mesa_GetProgramBinary(GLuint program, GLsizei bufSize, GLsizei *length,
+   GLenum *binaryFormat, GLvoid *binary);
+
+extern void GLAPIENTRY
+_mesa_ProgramBinary(GLuint program, GLenum binaryFormat,
+const GLvoid *binary, GLsizei length);
+
+extern void GLAPIENTRY
 _mesa_ProgramParameteri(GLuint program, GLenum pname, GLint value);
 
 void
-- 
1.7.11.7

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 05/11] glapi: Remove spurious space from end of extension name

2012-12-19 Thread Ian Romanick
From: Ian Romanick 

Signed-off-by: Ian Romanick 
---
 src/mapi/glapi/gen/ARB_get_program_binary.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/mapi/glapi/gen/ARB_get_program_binary.xml 
b/src/mapi/glapi/gen/ARB_get_program_binary.xml
index 7db1665..b268302 100644
--- a/src/mapi/glapi/gen/ARB_get_program_binary.xml
+++ b/src/mapi/glapi/gen/ARB_get_program_binary.xml
@@ -5,7 +5,7 @@
 
 
 
-
+
 
 
 
-- 
1.7.11.7

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 06/11] glapi: Emit dispatch for {ARB, OES}_get_program_binary

2012-12-19 Thread Ian Romanick
From: Ian Romanick 

Signed-off-by: Ian Romanick 
---
 src/mapi/glapi/gen/ARB_get_program_binary.xml |  9 +++--
 src/mesa/main/tests/dispatch_sanity.cpp   | 19 +--
 2 files changed, 16 insertions(+), 12 deletions(-)

diff --git a/src/mapi/glapi/gen/ARB_get_program_binary.xml 
b/src/mapi/glapi/gen/ARB_get_program_binary.xml
index b268302..e84d067 100644
--- a/src/mapi/glapi/gen/ARB_get_program_binary.xml
+++ b/src/mapi/glapi/gen/ARB_get_program_binary.xml
@@ -11,8 +11,7 @@
 
 
 
-
+
 
 
 
@@ -20,16 +19,14 @@
 
 
 
-
+
 
 
 
 
 
 
-
+
 
 
 
diff --git a/src/mesa/main/tests/dispatch_sanity.cpp 
b/src/mesa/main/tests/dispatch_sanity.cpp
index a285559..7b755ba 100644
--- a/src/mesa/main/tests/dispatch_sanity.cpp
+++ b/src/mesa/main/tests/dispatch_sanity.cpp
@@ -497,6 +497,11 @@ const struct function gl_core_functions_possible[] = {
{ "glGetInfoLogARB", 31, -1 },
{ "glGetAttachedObjectsARB", 31, -1 },
 
+   /* GL_ARB_get_program_binary */
+   { "glGetProgramBinary", 30, -1 },
+   { "glProgramBinary", 30, -1 },
+   { "glProgramParameteri", 30, -1 },
+
/* GL_EXT_transform_feedback */
{ "glBindBufferOffsetEXT", 31, -1 },
 
@@ -1256,6 +1261,11 @@ const struct function gles2_functions_possible[] = {
{ "glVertexAttrib4fv", 20, -1 },
{ "glVertexAttribPointer", 20, -1 },
{ "glViewport", 20, _gloffset_Viewport },
+
+   /* GL_OES_get_program_binary - Also part of OpenGL ES 3.0. */
+   { "glGetProgramBinaryOES", 20, -1 },
+   { "glProgramBinaryOES", 20, -1 },
+
{ NULL, 0, -1 }
 };
 
@@ -1316,8 +1326,7 @@ const struct function gles3_functions_possible[] = {
{ "glGetIntegeri_v", 30, -1 },
// XXX: Missing implementation of ARB_internalformat_query
// { "glGetInternalformativ", 30, -1 },
-   // XXX: Missing implementation of ARB_get_program_binary
-   /// { "glGetProgramBinary", 30, -1 },
+   // glGetProgramBinary aliases glGetProgramBinaryOES in GLES 2
{ "glGetQueryiv", 30, -1 },
{ "glGetQueryObjectuiv", 30, -1 },
{ "glGetSamplerParameterfv", 30, -1 },
@@ -1341,10 +1350,8 @@ const struct function gles3_functions_possible[] = {
// We check for the aliased -EXT version in GLES 2
// { "glMapBufferRange", 30, -1 },
{ "glPauseTransformFeedback", 30, -1 },
-   // XXX: Missing implementation of ARB_get_program_binary
-   // { "glProgramBinary", 30, -1 },
-   // XXX: Missing implementation of ARB_get_program_binary
-   // { "glProgramParameteri", 30, -1 },
+   // glProgramBinary aliases glProgramBinaryOES in GLES 2
+   { "glProgramParameteri", 30, -1 },
// We check for the aliased -NV version in GLES 2
// { "glReadBuffer", 30, -1 },
{ "glRenderbufferStorageMultisample", 30, -1 },
-- 
1.7.11.7

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 07/11] mesa: Emit errors for geometry shader enums when ARB_gs4 is not supported

2012-12-19 Thread Ian Romanick
From: Ian Romanick 

Signed-off-by: Ian Romanick 
---
 src/mesa/main/shaderapi.c | 20 +++-
 1 file changed, 15 insertions(+), 5 deletions(-)

diff --git a/src/mesa/main/shaderapi.c b/src/mesa/main/shaderapi.c
index 550018e..53f593a 100644
--- a/src/mesa/main/shaderapi.c
+++ b/src/mesa/main/shaderapi.c
@@ -1566,6 +1566,9 @@ _mesa_ProgramParameteri(GLuint program, GLenum pname, 
GLint value)
 
switch (pname) {
case GL_GEOMETRY_VERTICES_OUT_ARB:
+  if (!_mesa_is_desktop_gl(ctx) || !ctx->Extensions.ARB_geometry_shader4)
+ break;
+
   if (value < 1 ||
   (unsigned) value > ctx->Const.MaxGeometryOutputVertices) {
  _mesa_error(ctx, GL_INVALID_VALUE,
@@ -1574,8 +1577,11 @@ _mesa_ProgramParameteri(GLuint program, GLenum pname, 
GLint value)
  return;
   }
   shProg->Geom.VerticesOut = value;
-  break;
+  return;
case GL_GEOMETRY_INPUT_TYPE_ARB:
+  if (!_mesa_is_desktop_gl(ctx) || !ctx->Extensions.ARB_geometry_shader4)
+ break;
+
   switch (value) {
   case GL_POINTS:
   case GL_LINES:
@@ -1590,8 +1596,11 @@ _mesa_ProgramParameteri(GLuint program, GLenum pname, 
GLint value)
  _mesa_lookup_enum_by_nr(value));
  return;
   }
-  break;
+  return;
case GL_GEOMETRY_OUTPUT_TYPE_ARB:
+  if (!_mesa_is_desktop_gl(ctx) || !ctx->Extensions.ARB_geometry_shader4)
+ break;
+
   switch (value) {
   case GL_POINTS:
   case GL_LINE_STRIP:
@@ -1604,12 +1613,13 @@ _mesa_ProgramParameteri(GLuint program, GLenum pname, 
GLint value)
  _mesa_lookup_enum_by_nr(value));
  return;
   }
-  break;
+  return;
default:
-  _mesa_error(ctx, GL_INVALID_ENUM, "glProgramParameteri(pname=%s)",
-  _mesa_lookup_enum_by_nr(pname));
   break;
}
+
+   _mesa_error(ctx, GL_INVALID_ENUM, "glProgramParameteri(pname=%s)",
+   _mesa_lookup_enum_by_nr(pname));
 }
 
 void
-- 
1.7.11.7

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 08/11] mesa: Add tracking for GL_PROGRAM_BINARY_RETRIEVABLE_HINT state

2012-12-19 Thread Ian Romanick
From: Ian Romanick 

Signed-off-by: Ian Romanick 
---
 src/mesa/main/mtypes.h|  5 +
 src/mesa/main/shaderapi.c | 57 +++
 2 files changed, 62 insertions(+)

diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index 097cdc1..1a2ed19 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -2302,6 +2302,11 @@ struct gl_shader_program
GLboolean DeletePending;
 
/**
+* Is the application intending to glGetProgramBinary this program?
+*/
+   GLboolean BinaryRetreivableHint;
+
+   /**
 * Flags that the linker should not reject the program if it lacks
 * a vertex or fragment shader.  GLES2 doesn't allow separate
 * shader objects, and would reject them.  However, we internally
diff --git a/src/mesa/main/shaderapi.c b/src/mesa/main/shaderapi.c
index 53f593a..39a883e 100644
--- a/src/mesa/main/shaderapi.c
+++ b/src/mesa/main/shaderapi.c
@@ -583,6 +583,18 @@ get_programiv(struct gl_context *ctx, GLuint program, 
GLenum pname, GLint *param
 
   *params = shProg->NumUniformBlocks;
   return;
+   case GL_PROGRAM_BINARY_RETRIEVABLE_HINT:
+  /* This enum isn't part of the OES extension for OpenGL ES 2.0.  It is
+   * only available with desktop OpenGL 3.0+ with the
+   * GL_ARB_get_program_binary extension or OpenGL ES 3.0.
+   *
+   * On desktop, we ignore the 3.0+ requirement because it is silly.
+   */
+  if (!_mesa_is_desktop_gl(ctx) && !_mesa_is_gles3(ctx))
+ break;
+
+  *params = shProg->BinaryRetreivableHint;
+  return;
default:
   break;
}
@@ -1614,6 +1626,51 @@ _mesa_ProgramParameteri(GLuint program, GLenum pname, 
GLint value)
  return;
   }
   return;
+   case GL_PROGRAM_BINARY_RETRIEVABLE_HINT:
+  /* This enum isn't part of the OES extension for OpenGL ES 2.0, but it
+   * is part of OpenGL ES 3.0.  For the ES2 case, this function shouldn't
+   * even be in the dispatch table, so we shouldn't need to expclicitly
+   * check here.
+   *
+   * On desktop, we ignore the 3.0+ requirement because it is silly.
+   */
+
+  /* The ARB_get_program_binary extension spec says:
+   *
+   * "An INVALID_VALUE error is generated if the  argument to
+   * ProgramParameteri is not TRUE or FALSE."
+   */
+  if (value != GL_TRUE && value != GL_FALSE) {
+ _mesa_error(ctx, GL_INVALID_VALUE,
+ "glProgramParameteri(pname=%s, value=%d): "
+ "value must be 0 or 1.",
+ _mesa_lookup_enum_by_nr(pname),
+ value);
+ return;
+  }
+
+  /* No need to notify the driver.  Any changes will actually take effect
+   * the next time the shader is linked.
+   *
+   * The ARB_get_program_binary extension spec says:
+   *
+   * "To indicate that a program binary is likely to be retrieved,
+   * ProgramParameteri should be called with 
+   * PROGRAM_BINARY_RETRIEVABLE_HINT and  TRUE. This setting
+   * will not be in effect until the next time LinkProgram or
+   * ProgramBinary has been called successfully."
+   *
+   * The resloution of issue 9 in the extension spec also says:
+   *
+   * "The application may use the PROGRAM_BINARY_RETRIEVABLE_HINT hint
+   * to indicate to the GL implementation that this program will
+   * likely be saved with GetProgramBinary at some point. This will
+   * give the GL implementation the opportunity to track any state
+   * changes made to the program before being saved such that when it
+   * is loaded again a recompile can be avoided."
+   */
+  shProg->BinaryRetreivableHint = value;
+  return;
default:
   break;
}
-- 
1.7.11.7

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 09/11] mesa: Add Get support for PROGRAM_BINARY_FORMATS and NUM_PROGRAM_BINARY_FORMATS

2012-12-19 Thread Ian Romanick
From: Ian Romanick 

Signed-off-by: Ian Romanick 
---
 src/mesa/main/get_hash_params.py | 4 
 1 file changed, 4 insertions(+)

diff --git a/src/mesa/main/get_hash_params.py b/src/mesa/main/get_hash_params.py
index 9f67466..c9717c1 100644
--- a/src/mesa/main/get_hash_params.py
+++ b/src/mesa/main/get_hash_params.py
@@ -319,6 +319,10 @@ descriptor=[
   [ "MAX_FRAGMENT_UNIFORM_VECTORS", "LOC_CUSTOM, TYPE_INT, 0, 
extra_ARB_ES2_compatibility" ],
   [ "NUM_SHADER_BINARY_FORMATS", "CONST(0), extra_ARB_ES2_compatibility" ],
   [ "SHADER_BINARY_FORMATS", "LOC_CUSTOM, TYPE_INVALID, 0, 
extra_ARB_ES2_compatibility" ],
+
+# GL_ARB_get_program_binary / GL_OES_get_program_binary
+  [ "NUM_PROGRAM_BINARY_FORMATS", "CONST(0), extra_ARB_shader_objects" ],
+  [ "PROGRAM_BINARY_FORMATS", "LOC_CUSTOM, TYPE_INVALID, 0, 
extra_ARB_shader_objects" ],
 ]},
 
 { "apis": ["GLES", "GLES2"], "params": [
-- 
1.7.11.7

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 10/11] mesa: Add GetProgramiv support for GL_PROGRAM_BINARY_LENGTH

2012-12-19 Thread Ian Romanick
From: Ian Romanick 

Signed-off-by: Ian Romanick 
---
 src/mesa/main/shaderapi.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/mesa/main/shaderapi.c b/src/mesa/main/shaderapi.c
index 39a883e..c7934d7 100644
--- a/src/mesa/main/shaderapi.c
+++ b/src/mesa/main/shaderapi.c
@@ -595,6 +595,9 @@ get_programiv(struct gl_context *ctx, GLuint program, 
GLenum pname, GLint *param
 
   *params = shProg->BinaryRetreivableHint;
   return;
+   case GL_PROGRAM_BINARY_LENGTH:
+  *params = 0;
+  return;
default:
   break;
}
-- 
1.7.11.7

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 11/11] mesa: Add extension tracking for {ARB, OES}_get_program_binary

2012-12-19 Thread Ian Romanick
From: Ian Romanick 

The ARB_get_program_binary spec says "OpenGL 3.0 is required."  The
nearly identical OES_get_program_binary extension is available for
OpenGL ES 2.0, so I don't see how / why OpenGL 3.0 is a requirement for
the ARB version.  Let's just enable whenever GL_ARB_shader_objects is
available.

Signed-off-by: Ian Romanick 
---
 src/mesa/main/extensions.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/mesa/main/extensions.c b/src/mesa/main/extensions.c
index 98711b3..31e540a 100644
--- a/src/mesa/main/extensions.c
+++ b/src/mesa/main/extensions.c
@@ -101,6 +101,7 @@ static const struct extension extension_table[] = {
{ "GL_ARB_fragment_shader", o(ARB_fragment_shader), 
GL, 2002 },
{ "GL_ARB_framebuffer_object",  o(ARB_framebuffer_object),  
GL, 2005 },
{ "GL_ARB_framebuffer_sRGB",o(EXT_framebuffer_sRGB),
GL, 1998 },
+   { "GL_ARB_get_program_binary",  o(ARB_shader_objects),  
GL, 2010 },
{ "GL_ARB_half_float_pixel",o(ARB_half_float_pixel),
GL, 2003 },
{ "GL_ARB_half_float_vertex",   o(ARB_half_float_vertex),   
GL, 2008 },
{ "GL_ARB_instanced_arrays",o(ARB_instanced_arrays),
GL, 2008 },
@@ -250,6 +251,7 @@ static const struct extension extension_table[] = {
{ "GL_OES_fbo_render_mipmap",   o(EXT_framebuffer_object),  
 ES1 | ES2, 2005 },
{ "GL_OES_fixed_point", o(dummy_true),  
 ES1,   2002 },
{ "GL_OES_framebuffer_object",  o(EXT_framebuffer_object),  
 ES1,   2005 },
+   { "GL_OES_get_program_binary",  o(ARB_shader_objects),  
   ES2, 2008 },
{ "GL_OES_mapbuffer",   o(dummy_true),  
 ES1 | ES2, 2005 },
{ "GL_OES_matrix_get",  o(dummy_true),  
 ES1,   2004 },
{ "GL_OES_packed_depth_stencil",
o(EXT_packed_depth_stencil), ES1 | ES2, 2007 },
-- 
1.7.11.7

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 4/4] i965: Force even an empty query to flush all previous queries.

2012-12-19 Thread Carl Worth
Ian Romanick  writes:
> Do we potentially have this same problem for timer queries?

Quite possibly. I'll try to take a look at that as well.

-Carl


pgpRlUbqUVEKJ.pgp
Description: PGP signature
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 3/4] queryobj: Add IsQuery flag, making ISQuery() return false before BeginQuery()

2012-12-19 Thread Carl Worth
Matt Turner  writes:
>> +   if (q->IsQuery)
>>return GL_TRUE;
>> else
>>return GL_FALSE;
>
> Just return q->IsQuery here? It's already declared as GLboolean.

Yes, definitely. This code resulted from the squashing of two previous
commits, so it wasn't as obvious as that when I wrote it originally.

Thanks for the review.

-Carl



pgpkw8pd5LXih.pgp
Description: PGP signature
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 2/4] gallium: s/PIPE_CAP_TIMER_QUERY/PIPE_CAP_QUERY_TIME_ELAPSED/

2012-12-19 Thread Brian Paul

On 12/19/2012 04:26 PM, jfons...@vmware.com wrote:

From: José Fonseca

To better reflect what it iis being advertised.


iis -> is

Reviewed-by: Brian Paul 
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 3/4] mesa/st: Implement GL_TIME_ELAPSED w/ PIPE_QUERY_TIMESTAMP.

2012-12-19 Thread Brian Paul

On 12/19/2012 04:26 PM, jfons...@vmware.com wrote:

From: José Fonseca

ARB/EXT_timer_query's definition of GL_TIME_ELAPSED match precisely the
subtraction of two GL_TIMESTAMP queries.

And for a lot of drivers, that's precisely how they have to implement
internally -- by emitting two hardware timestamp queries.

So, to simplify driver implementation, simply allow doing so in the state
tracker.

Eventually if no driver implements PIPE_QUERY_TIME_ELAPSED then we could
retire it.
---
  src/mesa/state_tracker/st_cb_queryobj.c |   85 ---
  src/mesa/state_tracker/st_cb_queryobj.h |4 ++
  src/mesa/state_tracker/st_context.h |1 +
  src/mesa/state_tracker/st_extensions.c  |   11 ++--
  4 files changed, 79 insertions(+), 22 deletions(-)


LGTM.

For 3&4: Reviewed-by: Brian Paul 
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [Bug 58545] New: [llvmpipe] src/gallium/auxiliary/gallivm/lp_bld_tgsi_info.c:75:analyse_src: Assertion `src->Index < (sizeof(ctx->imm)/sizeof((ctx->imm)[0]))' failed.

2012-12-19 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=58545

  Priority: medium
Bug ID: 58545
  Assignee: mesa-dev@lists.freedesktop.org
   Summary: [llvmpipe]
src/gallium/auxiliary/gallivm/lp_bld_tgsi_info.c:75:an
alyse_src: Assertion `src->Index <
(sizeof(ctx->imm)/sizeof((ctx->imm)[0]))' failed.
  Severity: critical
Classification: Unclassified
OS: Linux (All)
  Reporter: v...@freedesktop.org
  Hardware: x86-64 (AMD64)
Status: NEW
   Version: git
 Component: Other
   Product: Mesa

mesa: fddcc67f5cb41f70d1d11827eb9190a5caec13c5 (master)

Run piglit varying-packing-simple test on llvmpipe.

$ ./bin/varying-packing-simple float array -auto
src/gallium/auxiliary/gallivm/lp_bld_tgsi_info.c:75:analyse_src: Assertion
`src->Index < (sizeof(ctx->imm)/sizeof((ctx->imm)[0]))' failed.

(gdb) bt
#0  0x7ffbe8fb5761 in _debug_assert_fail (expr=0x7ffbe98ce1e8 "src->Index <
(sizeof(ctx->imm)/sizeof((ctx->imm)[0]))", file=0x7ffbe98ce1b0
"src/gallium/auxiliary/gallivm/lp_bld_tgsi_info.c", 
line=75, function=0x7ffbe98ce4a0 "analyse_src") at
src/gallium/auxiliary/util/u_debug.c:278
#1  0x7ffbe904230f in analyse_src (ctx=0x7fff62f25ee0,
chan_info=0x7fff62f25e50, src=0x7fff62f26538, chan=0) at
src/gallium/auxiliary/gallivm/lp_bld_tgsi_info.c:75
#2  0x7ffbe904289c in analyse_instruction (ctx=0x7fff62f25ee0,
inst=0x7fff62f26508) at src/gallium/auxiliary/gallivm/lp_bld_tgsi_info.c:266
#3  0x7ffbe9042fc1 in lp_build_tgsi_info (tokens=0xdae5b0, info=0xe63170)
at src/gallium/auxiliary/gallivm/lp_bld_tgsi_info.c:435
#4  0x7ffbe8c898db in llvmpipe_create_fs_state (pipe=0xb67b50,
templ=0xe621a0) at src/gallium/drivers/llvmpipe/lp_state_fs.c:2231
#5  0x7ffbe8f7ae0b in aaline_create_fs_state (pipe=0xb67b50, fs=0xe621a0)
at src/gallium/auxiliary/draw/draw_pipe_aaline.c:855
#6  0x7ffbe8f7d1f1 in aapoint_create_fs_state (pipe=0xb67b50, fs=0xe621a0)
at src/gallium/auxiliary/draw/draw_pipe_aapoint.c:840
#7  0x7ffbe8f819bb in pstip_create_fs_state (pipe=0xb67b50, fs=0xe621a0) at
src/gallium/auxiliary/draw/draw_pipe_pstipple.c:668
#8  0x7ffbe8dd85c8 in st_translate_fragment_program (st=0xc1b800,
stfp=0x111e8c0, key=0x7fff62f26a50) at src/mesa/state_tracker/st_program.c:746
#9  0x7ffbe8dd8701 in st_get_fp_variant (st=0xc1b800, stfp=0x111e8c0,
key=0x7fff62f26a50) at src/mesa/state_tracker/st_program.c:783
#10 0x7ffbe8eb2203 in update_fp (st=0xc1b800) at
src/mesa/state_tracker/st_atom_shader.c:91
#11 0x7ffbe8eacc33 in st_validate_state (st=0xc1b800) at
src/mesa/state_tracker/st_atom.c:205
#12 0x7ffbe8dd39d0 in st_draw_vbo (ctx=0xbd4650, prims=0x7fff62f26bc0,
nr_prims=1, ib=0x0, index_bounds_valid=1 '\001', min_index=0, max_index=3,
tfb_vertcount=0x0)
at src/mesa/state_tracker/st_draw.c:200
#13 0x7ffbe8e8c5d7 in vbo_draw_arrays (ctx=0xbd4650, mode=7, start=0,
count=4, numInstances=1, baseInstance=0) at src/mesa/vbo/vbo_exec_array.c:619
#14 0x7ffbe8e8c6b0 in vbo_exec_DrawArrays (mode=7, start=0, count=4) at
src/mesa/vbo/vbo_exec_array.c:649
#15 0x7ffbeb4a934a in stub_glDrawArrays (mode=7, first=0, count=4) at
piglit/tests/util/generated_dispatch.c:5061
#16 0x7ffbeb4ffe49 in piglit_draw_rect (x=-1, y=-1, w=2, h=2) at
piglit/tests/util/piglit-util-gl.c:872
#17 0x00401cd6 in piglit_display () at
piglit/tests/spec/glsl-1.10/execution/varying-packing/simple.c:407
#18 0x7ffbeb49e180 in display () at
piglit/tests/util/piglit-framework-gl/piglit_glut_framework.c:60
#19 0x7ffbeac55137 in fghRedrawWindow (window=0xb65690) at
freeglut_main.c:210
#20 fghcbDisplayWindow (window=0xb65690, enumerator=0x7fff62f26db0) at
freeglut_main.c:227
#21 0x7ffbeac58889 in fgEnumWindows (enumCallback=0x7ffbeac550d0
, enumerator=0x7fff62f26db0) at freeglut_structure.c:394
#22 0x7ffbeac555fa in fghDisplayAll () at freeglut_main.c:249
#23 glutMainLoopEvent () at freeglut_main.c:1450
#24 0x7ffbeac55f05 in glutMainLoop () at freeglut_main.c:1498
#25 0x7ffbeb49e358 in run_test (gl_fw=0x7ffbeb7677c0, argc=3,
argv=0x7fff62f27178) at
piglit/tests/util/piglit-framework-gl/piglit_glut_framework.c:127
#26 0x7ffbeb49c49e in piglit_gl_test_run (argc=3, argv=0x7fff62f27178,
config=0x7fff62f27060) at piglit/tests/util/piglit-framework-gl.c:127
#27 0x0040137e in main (argc=4, argv=0x7fff62f27178) at
piglit/tests/spec/glsl-1.10/execution/varying-packing/simple.c:108
(gdb) frame 1
#1  0x7ffbe904230f in analyse_src (ctx=0x7fff62f25ee0,
chan_info=0x7fff62f25e50, src=0x7fff62f26538, chan=0) at
src/gallium/auxiliary/gallivm/lp_bld_tgsi_info.c:75
75assert(src->Index < Elements(ctx->imm));
(gdb) print src->Index
$1 = 33
(gdb) print ctx->imm
$2 = {{0, -nan(0x7f), 0, 0}, {1.40129846e-45, 2.80259693e-45,
4.20389539e-45, 5.60519386e-45}, {7.00649232e-45, 8.40779079e-45,
9.80908925e-45, 1.12103877e-

Re: [Mesa-dev] [PATCH] mesa: Allow glReadBuffer(GL_NONE) for winsys framebuffers.

2012-12-19 Thread Ian Romanick

On 12/19/2012 01:07 PM, Paul Berry wrote:

Previously, Mesa code assumed that glReadBuffer(GL_NONE) was only
valid for user-created framebuffer objects.  However, the spec is
quite clear that is should also be valid for the default framebuffer.
 From section 18.2.1 ("Obtaining Pixels from the Framebuffer") of the
GL 4.3 spec:

 "When READ_FRAMEBUFFER_BINDING is zero, i.e. the default
 framebuffer, src must be one of the values listed in table 17.4,
 including NONE."

Similar language exists in the GLES 3.0 spec, and in desktop GL all
the way back to ARB_framebuffer_object.

Partially fixes GLES3 conformance test "CoverageES30.test".


Reviewed-by: Ian Romanick 

Candidate for stable branches?


---
  src/mesa/main/buffers.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/mesa/main/buffers.c b/src/mesa/main/buffers.c
index 76f0d46..d10a573 100644
--- a/src/mesa/main/buffers.c
+++ b/src/mesa/main/buffers.c
@@ -532,8 +532,8 @@ _mesa_ReadBuffer(GLenum buffer)
 if (MESA_VERBOSE & VERBOSE_API)
_mesa_debug(ctx, "glReadBuffer %s\n", _mesa_lookup_enum_by_nr(buffer));

-   if (_mesa_is_user_fbo(fb) && buffer == GL_NONE) {
-  /* This is legal for user-created framebuffer objects */
+   if (buffer == GL_NONE) {
+  /* This is legal--it means that no buffer should be bound for reading. */
srcBuffer = -1;
 }
 else {



___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 3/8] egl/gbm: Implement EGL_EXT_buffer_age

2012-12-19 Thread Kristian Høgsberg
On Wed, Dec 19, 2012 at 11:17 PM, Eric Anholt  wrote:
> Kristian Høgsberg  writes:
>
>> On Sat, Dec 15, 2012 at 2:44 AM, Kristian Høgsberg  
>> wrote:
>>> On Fri, Dec 14, 2012 at 04:54:32PM -0800, Eric Anholt wrote:
 Kristian Høgsberg  writes:

 > ---
 >  src/egl/drivers/dri2/egl_dri2.h |1 +
 >  src/egl/drivers/dri2/platform_drm.c |   23 +++
 >  2 files changed, 24 insertions(+)
 >
 > diff --git a/src/egl/drivers/dri2/egl_dri2.h 
 > b/src/egl/drivers/dri2/egl_dri2.h
 > index be359d3..fa2a9f3 100644
 > --- a/src/egl/drivers/dri2/egl_dri2.h
 > +++ b/src/egl/drivers/dri2/egl_dri2.h
 > @@ -189,6 +189,7 @@ struct dri2_egl_surface
 > struct {
 >struct gbm_bo   *bo;
 >int  locked;
 > +  int  age;
 > } color_buffers[3], *back, *current;
 >  #ifndef HAVE_WAYLAND_PLATFORM
 > __DRIbuffer   *dri_buffers[__DRI_BUFFER_COUNT];
 > diff --git a/src/egl/drivers/dri2/platform_drm.c 
 > b/src/egl/drivers/dri2/platform_drm.c
 > index 3e04a6c..1923033 100644
 > --- a/src/egl/drivers/dri2/platform_drm.c
 > +++ b/src/egl/drivers/dri2/platform_drm.c
 > @@ -324,11 +324,16 @@ dri2_swap_buffers(_EGLDriver *drv, _EGLDisplay 
 > *disp, _EGLSurface *draw)
 >  {
 > struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
 > struct dri2_egl_surface *dri2_surf = dri2_egl_surface(draw);
 > +   int i;
 >
 > if (dri2_surf->base.Type == EGL_WINDOW_BIT) {
 >if (dri2_surf->current)
 >  _eglError(EGL_BAD_SURFACE, "dri2_swap_buffers");
 > +  for (i = 0; i < ARRAY_SIZE(dri2_surf->color_buffers); i++)
 > + if (dri2_surf->color_buffers[i].bo)
 > +dri2_surf->color_buffers[i].age++;
 >dri2_surf->current = dri2_surf->back;
 > +  dri2_surf->current->age = 1;
 >dri2_surf->back = NULL;

 OK, if I'm following this right, the ages of my buffers with this code are:
>>>
>>> You're missing the if (dri2_surf->color_buffers[i].bo) condition on
>>> incrementing age.  We start out with bo = NULL for color_buffer[0..2]
>>> and allocate the bos on demand...
>>>
 entering my first swap
 buffers[0] = 0 <- front
 buffers[1] = 0 <- back

 after first swap:
 buffers[0] = 1 <- back
 buffers[1] = 1 <- front
>>>
>>> and so here back age will be 0 because we pick a new color_buffer from
>>> the pool that doesn't yet have a bo and whose age was never incremented.
>>>
 after second swap:
 buffers[0] = 1 <- front
 buffers[1] = 2 <- back

 But reading the spec, I think it's supposed to be:

 entering my first swap
 buffers[0] = 0 <- front
 buffers[1] = 0 <- back

 after first swap:
 buffers[0] = 0 <- back
 buffers[1] = 1 <- front

 after second swap:
 buffers[0] = 1 <- front
 buffers[1] = 2 <- back

 Note how after the first swap, my backbuffer should have an age of 0, for
 "unknown junk".
>>>
>>> Yup, and that's what this patch gets.
>>
>> Does the explanation above make sense?
>
> Sort of -- it's all predicated on there being no way for buffers to be
> allocated other than a swapbuffers -- so no MESA_copy_sub_buffers or its
> cousins, and nothing for binding the front buffer as an egl image (do we
> actually not support any of those?).  It seems more future-proof to just
> implement the "if (buffer->age != 0)" check from the spec, along with or
> in place of the "if (buffer->bo != NULL)"

The way I think of this is that if buffer->bo != NULL, then that slot
in the color_buffer pool is in use and we have a valid buffer age.  In
the code the invariant is that valid buffer iff age > 0, and thus,
testing one or the other doesn't make a difference.  Given that the
spec says "increment if buffer age > 0", I agree that it makes more
sense to go for that condition.

Buffers are allocated at getbuffers time and we don't support any kind
of copy operations for swapbuffers in the gbm or wayland backends.  We
always only swap and copying will require exporting some kind of "copy
region" extension from the dri driver.

Kristian
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [Bug 58548] New: [swrast] SIGSEGV src/mesa/swrast/s_texfetch.c:100

2012-12-19 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=58548

  Priority: medium
Bug ID: 58548
  Keywords: regression
CC: bri...@vmware.com
  Assignee: mesa-dev@lists.freedesktop.org
   Summary: [swrast] SIGSEGV src/mesa/swrast/s_texfetch.c:100
  Severity: critical
Classification: Unclassified
OS: Linux (All)
  Reporter: v...@freedesktop.org
  Hardware: x86-64 (AMD64)
Status: NEW
   Version: git
 Component: Other
   Product: Mesa

mesa: fddcc67f5cb41f70d1d11827eb9190a5caec13c5 (master)

Run piglit getteximage-formats on swrast.

$ ./bin/getteximage-formats -auto
Mesa warning: failed to remap index 167
Mesa warning: failed to remap index 207
Mesa warning: failed to remap index 208
Mesa warning: failed to remap index 211
Mesa warning: failed to remap index 377
Using test set: Core formats
Segmentation fault (core dumped)


(gdb) bt
#0  0x in ?? ()
#1  0x7f66f1228668 in fetch_compressed (swImage=0x1fa53e0, i=0, j=0, k=0,
texel=0x7f66efa74010) at ../../../src/mesa/swrast/s_texfetch.c:100
#2  0x7f66f122b7d2 in sample_2d_nearest (ctx=0x1daeed0, samp=0x1fa4e94,
img=0x1fa53e0, texcoord=0x7f66f01b0010, rgba=0x7f66efa74010) at
../../../src/mesa/swrast/s_texfilter.c:1137
#3  0x7f66f122c3db in sample_nearest_2d (ctx=0x1daeed0, samp=0x1fa4e94,
tObj=0x1fa4e60, n=127, texcoords=0x7f66f01b0010, lambda=0x7f66f0d24020,
rgba=0x7f66efa74010)
at ../../../src/mesa/swrast/s_texfilter.c:1369
#4  0x7f66f121b782 in _swrast_texture_span (ctx=0x1daeed0,
span=0x7fffe3150d70) at ../../../src/mesa/swrast/s_texcombine.c:762
#5  0x7f66f12153dc in shade_texture_span (ctx=0x1daeed0,
span=0x7fffe3150d70) at ../../../src/mesa/swrast/s_span.c:1028
#6  0x7f66f1215d47 in _swrast_write_rgba_span (ctx=0x1daeed0,
span=0x7fffe3150d70) at ../../../src/mesa/swrast/s_span.c:1261
#7  0x7f66f12499d3 in general_triangle (ctx=0x1daeed0, v0=0x7f66efe75040,
v1=0x7f66efe75348, v2=0x7f66efe75958) at
../../../src/mesa/swrast/s_tritemp.h:819
#8  0x7f66f120166f in _swrast_validate_triangle (ctx=0x1daeed0,
v0=0x7f66efe75040, v1=0x7f66efe75348, v2=0x7f66efe75958) at
../../../src/mesa/swrast/s_context.c:363
#9  0x7f66f1201e16 in _swrast_Triangle (ctx=0x1daeed0, v0=0x7f66efe75040,
v1=0x7f66efe75348, v2=0x7f66efe75958) at
../../../src/mesa/swrast/s_context.c:630
#10 0x7f66f124e695 in triangle_rgba (ctx=0x1daeed0, e0=0, e1=1, e2=3) at
../../../src/mesa/swrast_setup/ss_tritmp.h:176
#11 0x7f66f124e6c5 in quadfunc_rgba (ctx=0x1daeed0, v0=0, v1=1, v2=2, v3=3)
at ../../../src/mesa/swrast_setup/ss_tritmp.h:232
#12 0x7f66f11dbb13 in _tnl_render_quads_verts (ctx=0x1daeed0, start=0,
count=4, flags=55) at ../../../src/mesa/tnl/t_vb_rendertmp.h:383
#13 0x7f66f11ddc37 in run_render (ctx=0x1daeed0, stage=0x1e2cdb0) at
../../../src/mesa/tnl/t_vb_render.c:321
#14 0x7f66f11cbb8a in _tnl_run_pipeline (ctx=0x1daeed0) at
../../../src/mesa/tnl/t_pipeline.c:163
#15 0x7f66f11cd49c in _tnl_draw_prims (ctx=0x1daeed0, arrays=0x1e19cb0,
prim=0x7fffe3152750, nr_prims=1, ib=0x0, min_index=0, max_index=3) at
../../../src/mesa/tnl/t_draw.c:525
#16 0x7f66f11cd149 in _tnl_vbo_draw_prims (ctx=0x1daeed0,
prim=0x7fffe3152750, nr_prims=1, ib=0x0, index_bounds_valid=1 '\001',
min_index=0, max_index=3, tfb_vertcount=0x0)
at ../../../src/mesa/tnl/t_draw.c:425
#17 0x7f66f11a83f7 in vbo_draw_arrays (ctx=0x1daeed0, mode=7, start=0,
count=4, numInstances=1, baseInstance=0) at
../../../src/mesa/vbo/vbo_exec_array.c:619
#18 0x7f66f11a84d0 in vbo_exec_DrawArrays (mode=7, start=0, count=4) at
../../../src/mesa/vbo/vbo_exec_array.c:649
#19 0x7f66f4be9106 in piglit_draw_rect_tex (x=10, y=40, w=128, h=128, tx=0,
ty=0, tw=1, th=1) at piglit/tests/util/piglit-util-gl.c:951
#20 0x0040284f in test_format (test=0x405328, fmt=0x4038e0) at
piglit/tests/texturing/getteximage-formats.c:356
#21 0x00402c65 in test_all_formats () at
piglit/tests/texturing/getteximage-formats.c:448
#22 0x00402cc6 in piglit_display () at
piglit/tests/texturing/getteximage-formats.c:467
#23 0x7f66f4b87180 in display () at
piglit/tests/util/piglit-framework-gl/piglit_glut_framework.c:60
#24 0x7f66f433e137 in fghRedrawWindow (window=0x1daae60) at
freeglut_main.c:210
#25 fghcbDisplayWindow (window=0x1daae60, enumerator=0x7fffe3192a00) at
freeglut_main.c:227
#26 0x7f66f4341889 in fgEnumWindows (enumCallback=0x7f66f433e0d0
, enumerator=0x7fffe3192a00) at freeglut_structure.c:394
#27 0x7f66f433e5fa in fghDisplayAll () at freeglut_main.c:249
#28 glutMainLoopEvent () at freeglut_main.c:1450
#29 0x7f66f433ef05 in glutMainLoop () at freeglut_main.c:1498
---Type  to continue, or q  to quit---
#30 0x7f66f4b87358 in run_test (gl_fw=0x7f66f4e507c0, argc=1,
argv=0x7fffe3192dc8) at
piglit/tests/util/piglit-framework-gl/piglit_glut_framework.c:127
#31 0x7f66f4b8549e in piglit_gl_test_run (

Re: [Mesa-dev] [PATCH] mesa: Allow glReadBuffer(GL_NONE) for winsys framebuffers.

2012-12-19 Thread Paul Berry
On 19 December 2012 16:36, Ian Romanick  wrote:

> On 12/19/2012 01:07 PM, Paul Berry wrote:
>
>> Previously, Mesa code assumed that glReadBuffer(GL_NONE) was only
>> valid for user-created framebuffer objects.  However, the spec is
>> quite clear that is should also be valid for the default framebuffer.
>>  From section 18.2.1 ("Obtaining Pixels from the Framebuffer") of the
>> GL 4.3 spec:
>>
>>  "When READ_FRAMEBUFFER_BINDING is zero, i.e. the default
>>  framebuffer, src must be one of the values listed in table 17.4,
>>  including NONE."
>>
>> Similar language exists in the GLES 3.0 spec, and in desktop GL all
>> the way back to ARB_framebuffer_object.
>>
>> Partially fixes GLES3 conformance test "CoverageES30.test".
>>
>
> Reviewed-by: Ian Romanick 
>
> Candidate for stable branches?


Yes, good point.  I'll add that annotation before I push it.


>
>
>  ---
>>   src/mesa/main/buffers.c | 4 ++--
>>   1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/src/mesa/main/buffers.c b/src/mesa/main/buffers.c
>> index 76f0d46..d10a573 100644
>> --- a/src/mesa/main/buffers.c
>> +++ b/src/mesa/main/buffers.c
>> @@ -532,8 +532,8 @@ _mesa_ReadBuffer(GLenum buffer)
>>  if (MESA_VERBOSE & VERBOSE_API)
>> _mesa_debug(ctx, "glReadBuffer %s\n", _mesa_lookup_enum_by_nr(**
>> buffer));
>>
>> -   if (_mesa_is_user_fbo(fb) && buffer == GL_NONE) {
>> -  /* This is legal for user-created framebuffer objects */
>> +   if (buffer == GL_NONE) {
>> +  /* This is legal--it means that no buffer should be bound for
>> reading. */
>> srcBuffer = -1;
>>  }
>>  else {
>>
>>
>
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] mesa: Use GL_RED for DEPTH_TEXTURE_MODE for everything but legacy GL.

2012-12-19 Thread Paul Berry
On 19 November 2012 11:06, Kenneth Graunke  wrote:

> On 11/18/2012 05:43 PM, Ian Romanick wrote:
>
>> On Nov 17, 2012, at 11:26 PM, Kenneth Graunke 
>> wrote:
>>
>>  According to page 163 of the ES 3.0 spec:
>>>
>>> "Texture lookups involving textures with depth component data generate
>>> a texture base color C_b either using depth data directly or by
>>> performing a comparison with the D_ref value used to perform the
>>> lookup, as described in section 3.8.15.  The resulting value R_t is
>>> then expanded to a color C_b = (R_t,0,0,1), ..."
>>>
>>> In other words, depth textures are supposed to be treated as GL_RED.
>>>
>>> A discussion about this text can be found in Khronos bugzilla:
>>> https://cvs.khronos.org/**bugzilla/show_bug.cgi?id=7962
>>>
>>> It's unclear what the behavior of desktop GL should be.  The GL 3.x
>>> specifications indicate that it should be (r, r, r, 1), which is
>>> GL_LUMINANCE (the old default).  However, page 112 of the 4.2 core
>>> specification contains the text quoted above, explicitly declaring it
>>> to be (R_t, 0, 0, 1), which is GL_RED.
>>>
>>> So it hinges on whether the 4.2 text is a change or a clarification.
>>> Personally I think that using GL_RED in core contexts and GL_INTENSITY
>>> in legacy contexts seems reasonable.
>>>
>>
>> I believe it was an intentional change somewhere in 4.x.  We may want to
>> select behavior based on API / version.
>>
>
> Ugh.  On further investigation, it turns out that OES_depth_texture (which
> is ES2 only) does not provide DEPTH_TEXTURE_MODE, but explicitly states
> that it should act as GL_LUMINANCE.  There's also a conformance test for
> that.
>
> So, for ES 2, it *must* be GL_LUMINANCE.  For ES 3, it *must* be RED.
>
> Time to file spec bugs...
>
> __**_
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> http://lists.freedesktop.org/**mailman/listinfo/mesa-dev
>

Does anyone know if this ever got addressed?  I'm still seeing these GLES3
conformance failures.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 1/4] softpipe: Use os_time_get_nano() everywhere.

2012-12-19 Thread Marek Olšák
For the series:

Reviewed-by: Marek Olšák 

Marek

On Thu, Dec 20, 2012 at 12:26 AM,   wrote:
> From: José Fonseca 
>
> ---
>  src/gallium/drivers/softpipe/sp_query.c  |8 
>  src/gallium/drivers/softpipe/sp_screen.c |2 +-
>  2 files changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/src/gallium/drivers/softpipe/sp_query.c 
> b/src/gallium/drivers/softpipe/sp_query.c
> index c173736..3981325 100644
> --- a/src/gallium/drivers/softpipe/sp_query.c
> +++ b/src/gallium/drivers/softpipe/sp_query.c
> @@ -91,7 +91,7 @@ softpipe_begin_query(struct pipe_context *pipe, struct 
> pipe_query *q)
>break;
> case PIPE_QUERY_TIMESTAMP_DISJOINT:
> case PIPE_QUERY_TIME_ELAPSED:
> -  sq->start = 1000*os_time_get();
> +  sq->start = os_time_get_nano();
>break;
> case PIPE_QUERY_SO_STATISTICS:
>sq->so.primitives_storage_needed = 0;
> @@ -131,7 +131,7 @@ softpipe_end_query(struct pipe_context *pipe, struct 
> pipe_query *q)
>/* fall through */
> case PIPE_QUERY_TIMESTAMP_DISJOINT:
> case PIPE_QUERY_TIME_ELAPSED:
> -  sq->end = 1000*os_time_get();
> +  sq->end = os_time_get_nano();
>break;
> case PIPE_QUERY_SO_STATISTICS:
>sq->so.primitives_storage_needed =
> @@ -172,8 +172,8 @@ softpipe_get_query_result(struct pipe_context *pipe,
>break;
> case PIPE_QUERY_TIMESTAMP_DISJOINT: {
>struct pipe_query_data_timestamp_disjoint td;
> -  /*os_get_time is in microseconds*/
> -  td.frequency = 100;
> +  /* os_time_get_nano return nanoseconds */
> +  td.frequency = UINT64_C(10);
>td.disjoint = sq->end != sq->start;
>memcpy(vresult, &td,
>   sizeof(struct pipe_query_data_timestamp_disjoint));
> diff --git a/src/gallium/drivers/softpipe/sp_screen.c 
> b/src/gallium/drivers/softpipe/sp_screen.c
> index 909fa1c..f344814 100644
> --- a/src/gallium/drivers/softpipe/sp_screen.c
> +++ b/src/gallium/drivers/softpipe/sp_screen.c
> @@ -366,7 +366,7 @@ softpipe_flush_frontbuffer(struct pipe_screen *_screen,
>  static uint64_t
>  softpipe_get_timestamp(struct pipe_screen *_screen)
>  {
> -   return os_time_get()*1000;
> +   return os_time_get_nano();
>  }
>
>  /**
> --
> 1.7.9.5
>
> ___
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 3/4] queryobj: Add IsQuery flag, making ISQuery() return false before BeginQuery()

2012-12-19 Thread Matt Turner
On Mon, Dec 17, 2012 at 2:24 PM, Carl Worth  wrote:
> +   GLboolean IsQuery;  /**< query object is an actual query (see spec.) */

I don't mean to bikeshed this, but I'm doing this patch for the other
Is* functions and I'm thinking that Is* is a really bad name for this
field. Vertex array objects already have a _Used field, since ARB vs
Apple semantics are determined by which bind call is used. Can we come
up with a better naming convention? Maybe _Used/Used/EverBound or
something?
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] mesa: Use GL_RED for DEPTH_TEXTURE_MODE for everything but legacy GL.

2012-12-19 Thread Ian Romanick

On 12/19/2012 05:59 PM, Paul Berry wrote:

On 19 November 2012 11:06, Kenneth Graunke mailto:kenn...@whitecape.org>> wrote:

On 11/18/2012 05:43 PM, Ian Romanick wrote:

On Nov 17, 2012, at 11:26 PM, Kenneth Graunke
mailto:kenn...@whitecape.org>> wrote:

According to page 163 of the ES 3.0 spec:

"Texture lookups involving textures with depth component
data generate
a texture base color C_b either using depth data directly or by
performing a comparison with the D_ref value used to perform the
lookup, as described in section 3.8.15.  The resulting value
R_t is
then expanded to a color C_b = (R_t,0,0,1), ..."

In other words, depth textures are supposed to be treated as
GL_RED.

A discussion about this text can be found in Khronos bugzilla:
https://cvs.khronos.org/__bugzilla/show_bug.cgi?id=7962


It's unclear what the behavior of desktop GL should be.  The
GL 3.x
specifications indicate that it should be (r, r, r, 1), which is
GL_LUMINANCE (the old default).  However, page 112 of the
4.2 core
specification contains the text quoted above, explicitly
declaring it
to be (R_t, 0, 0, 1), which is GL_RED.

So it hinges on whether the 4.2 text is a change or a
clarification.
Personally I think that using GL_RED in core contexts and
GL_INTENSITY
in legacy contexts seems reasonable.


I believe it was an intentional change somewhere in 4.x.  We may
want to select behavior based on API / version.


Ugh.  On further investigation, it turns out that OES_depth_texture
(which is ES2 only) does not provide DEPTH_TEXTURE_MODE, but
explicitly states that it should act as GL_LUMINANCE.  There's also
a conformance test for that.

So, for ES 2, it *must* be GL_LUMINANCE.  For ES 3, it *must* be RED.

Time to file spec bugs...

Does anyone know if this ever got addressed?  I'm still seeing these
GLES3 conformance failures.


There was some discussion, but I don't feel like there was any 
resolution.  I'll rattle the cage again...


___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] When is a sampler object not a sampler object?

2012-12-19 Thread Matt Turner
The ES 3.0 and GL 3.3+ specs say:

A new sampler object is created by binding an unused name to a
texture unit.

[...]

The names are marked as used, for the purposes of GenSamplers only,
but they acquire state only when they are first used as a parameter
to BindSampler, SamplerParameter*, GetSamplerParameter*, or IsSampler.
When a sampler object is first used in one of these functions, the
resulting sampler object is initialized with a new state vector,
comprising all the state and with the same initial values listed in
table 6.10.

We're not handling the requirement to initialize the object specified
in the 2nd paragraph, but my real question is --

Can IsSampler ever return false if given a name returned by
GenSamplers? Does 'acquire state' mean becomes a sampler object? These
paragraphs seem contradictory.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [Bug 58548] [swrast] SIGSEGV src/mesa/swrast/s_texfetch.c:100

2012-12-19 Thread bugzilla-daemon
https://bugs.freedesktop.org/show_bug.cgi?id=58548

Vinson Lee  changed:

   What|Removed |Added

   Keywords||have-backtrace

--- Comment #1 from Vinson Lee  ---
7dc36a50de516d95fc6edc58cf1ab5cd7129e95a is the first bad commit
commit 7dc36a50de516d95fc6edc58cf1ab5cd7129e95a
Author: Brian Paul 
Date:   Sat Dec 8 15:19:44 2012 -0700

swrast: use new core Mesa compressed texel fetch functions

:04 04 0405f735572be3a6db5629481683197ad8e8d0a8
d7a74fc7a39f46c45fbe4f6d128237167947f37a M  src
bisect run success

-- 
You are receiving this mail because:
You are the assignee for the bug.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 3/4] queryobj: Add IsQuery flag, making ISQuery() return false before BeginQuery()

2012-12-19 Thread Paul Berry
On 19 December 2012 20:17, Matt Turner  wrote:

> On Mon, Dec 17, 2012 at 2:24 PM, Carl Worth  wrote:
> > +   GLboolean IsQuery;  /**< query object is an actual query (see spec.)
> */
>
> I don't mean to bikeshed this, but I'm doing this patch for the other
> Is* functions and I'm thinking that Is* is a really bad name for this
> field. Vertex array objects already have a _Used field, since ARB vs
> Apple semantics are determined by which bind call is used. Can we come
> up with a better naming convention? Maybe _Used/Used/EverBound or
> something?
> ___
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
>

I'd like to put in a vote for EverBound--it makes it immediately clear (a)
what action causes it to become true, and (b) that it thereafter remains
true for the lifetime of the object.  (Neither of those two things are
quite so obvious with Used or IsQuery).
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] docs: Document spec quoting practices

2012-12-19 Thread Paul Berry
On 19 December 2012 15:46, Ian Romanick  wrote:

> From: Ian Romanick 
>
> Signed-off-by: Ian Romanick 
> Cc: Paul Berry 
> Cc: Brian Paul 
> ---
>  docs/devinfo.html | 42 ++
>  1 file changed, 42 insertions(+)
>
> diff --git a/docs/devinfo.html b/docs/devinfo.html
> index 8f4aeef..eb4c897 100644
> --- a/docs/devinfo.html
> +++ b/docs/devinfo.html
> @@ -155,6 +155,48 @@ of bool, true, and
>  src/mesa/state_tracker/st_glsl_to_tgsi.cpp can serve as examples.
>  
>
> +
> +It is often useful to quote sections from relevant specifications near
> +code that implements part of the spec.  In order to make it easier to
> +find such quotations in the code (via grep and friends) and to find the
> +quoted text in the specifications, please use one of the following
> +formats.
> +
> +
> +
> +Text quoted from the core OpenGL or OpenGL ES specifications:
> +
> +
> +
> +   /* Page AA (page BB of the PDF) in section C.D.E of the OpenGL F.G
> +* specification says:
> +*
> +* "Some quoted text from the specificiation"
> +*/
> +
>

The OpenGL specs since version 3.2 come in four flavours:
- glspecN.core.MMDD.pdf
- glspecN.core.MMDD.withchanges.pdf
- glspecN.compatibility.MMDD.pdf
- glspecN.compatibility.MMDD.withchanges.pdf

Since these four documents don't in general have matching page numbers, I
think we should make a recommendation as to which one to quote from.  My
preference: glspecN.compatibility.MMDD.withchanges.pdf, since it
contains information about the deltas both from core to compatibility and
from one version to the next, so it's the most likely to tip us off to
subtle API or version dependencies that we need to be careful about.


> +
> +
> +Text quoted from the GLSL or GLSL ES ES specifications:
> +
> +
> +
> +   /* Page AA (page BB of the PDF) in section C.D.E of the GLSL F.G
> +* specification says:
> +*
> +* "Some quoted text from the specificiation"
> +*/
> +
> +
> +
> +Text quoted from an extension specifications:
> +
> +
> +
> +   /* Section C.D.E of the GL_EXT_foo_bar specification says:
> +*
> +* "Some quoted text from the specificiation"
> +*/
> +
>

My impression is that most extension specs aren't divided into numbered
sections like this--instead the sections tend to be labeled things like
"Overview", "Issues", or "Additions to Chapter N...".  Since extension
specifications are text files, perhaps it would be better to quote by line
number?


>
>  Marking a commit as a candidate for a stable branch
>
> --
> 1.7.11.7
>
>
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH] glu: src/libtess: memory has been freed using uninitialized pointer

2012-12-19 Thread Mike Gorchak
Hi !

I've attached the patch which fixes access to unitialized pointer during
memory free operation.

pqNewPriorityQ() function creates and setups PriorityQ structure, all
except for the field "order". It is filled later in function pqInit().
Depending on vertices of polygon which must be tesselated there possible
following situation, pqDeletePriorityQ() is called right after
pqNewPriorityQ() function. pqNewPriorityQ() tries to free memory using
pq->order as pointer, which is unitialized at this point.

P.S. Bug has been found by Victor Magalhaes while using my port of GLU
library to OpenGL ES ( http://code.google.com/p/glues/ ). My port was based
on the latest MESA/GLU sources.

Thanks.


priorityq.diff
Description: Binary data
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev