<div dir="ltr">On 15 September 2013 00:10, Francisco Jerez <span dir="ltr"><<a href="mailto:currojerez@riseup.net" target="_blank">currojerez@riseup.net</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote">
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">---<br>
src/glsl/ast_to_hir.cpp | 1 +<br>
src/glsl/builtin_type_macros.h | 2 ++<br>
src/glsl/builtin_types.cpp | 6 ++++++<br>
src/glsl/glsl_types.cpp | 2 ++<br>
src/glsl/glsl_types.h | 14 ++++++++++++++<br>
src/glsl/ir_clone.cpp | 1 +<br>
src/glsl/link_uniform_initializers.cpp | 1 +<br>
src/glsl/tests/uniform_initializer_utils.cpp | 3 +++<br>
src/mesa/program/ir_to_mesa.cpp | 2 ++<br>
src/mesa/state_tracker/st_glsl_to_tgsi.cpp | 1 +<br>
10 files changed, 33 insertions(+)<br>
<br>
diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp<br>
index 2316cf8..fcca5df 100644<br>
--- a/src/glsl/ast_to_hir.cpp<br>
+++ b/src/glsl/ast_to_hir.cpp<br>
@@ -902,6 +902,7 @@ do_comparison(void *mem_ctx, int operation, ir_rvalue *op0, ir_rvalue *op1)<br>
case GLSL_TYPE_VOID:<br>
case GLSL_TYPE_SAMPLER:<br>
case GLSL_TYPE_INTERFACE:<br>
+ case GLSL_TYPE_ATOMIC_UINT:<br>
/* I assume a comparison of a struct containing a sampler just<br>
* ignores the sampler present in the type.<br>
*/<br>
diff --git a/src/glsl/builtin_type_macros.h b/src/glsl/builtin_type_macros.h<br>
index fec38da..263fd83 100644<br>
--- a/src/glsl/builtin_type_macros.h<br>
+++ b/src/glsl/builtin_type_macros.h<br>
@@ -110,6 +110,8 @@ DECL_TYPE(sampler2DRectShadow, GL_SAMPLER_2D_RECT_SHADOW, GLSL_SAMPLER<br>
<br>
DECL_TYPE(samplerExternalOES, GL_SAMPLER_EXTERNAL_OES, GLSL_SAMPLER_DIM_EXTERNAL, 0, 0, GLSL_TYPE_FLOAT)<br>
<br>
+DECL_TYPE(atomic_uint, GL_UNSIGNED_INT_ATOMIC_COUNTER, GLSL_TYPE_ATOMIC_UINT, 1, 1)<br>
+<br>
STRUCT_TYPE(gl_DepthRangeParameters)<br>
STRUCT_TYPE(gl_PointParameters)<br>
STRUCT_TYPE(gl_MaterialParameters)<br>
diff --git a/src/glsl/builtin_types.cpp b/src/glsl/builtin_types.cpp<br>
index 722eda2..8311a91 100644<br>
--- a/src/glsl/builtin_types.cpp<br>
+++ b/src/glsl/builtin_types.cpp<br>
@@ -203,6 +203,8 @@ const static struct builtin_type_versions {<br>
T(sampler2DRectShadow, 140, 999)<br>
<br>
T(struct_gl_DepthRangeParameters, 110, 100)<br>
+<br>
+ T(atomic_uint, 130, 999)<br></blockquote><div><br></div><div>This should be the GLSL version in which the type became available without the use of an extension, so it should be 420, not 130.<br></div>
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
};<br>
<br>
const glsl_type *const deprecated_types[] = {<br>
@@ -284,5 +286,9 @@ _mesa_glsl_initialize_types(struct _mesa_glsl_parse_state *state)<br>
if (state->OES_texture_3D_enable) {<br>
add_type(symbols, glsl_type::sampler3D_type);<br>
}<br>
+<br>
+ if (state->ARB_shader_atomic_counters_enable) {<br>
+ add_type(symbols, glsl_type::atomic_uint_type);<br>
+ }<br>
}<br>
/** @} */<br>
diff --git a/src/glsl/glsl_types.cpp b/src/glsl/glsl_types.cpp<br>
index 3c396dd..e1fe153 100644<br>
--- a/src/glsl/glsl_types.cpp<br>
+++ b/src/glsl/glsl_types.cpp<br>
@@ -586,6 +586,7 @@ glsl_type::component_slots() const<br>
return this->length * this->fields.array->component_slots();<br>
<br>
case GLSL_TYPE_SAMPLER:<br>
+ case GLSL_TYPE_ATOMIC_UINT:<br>
case GLSL_TYPE_VOID:<br>
case GLSL_TYPE_ERROR:<br>
break;<br>
@@ -874,6 +875,7 @@ glsl_type::count_attribute_slots() const<br>
return this->length * this->fields.array->count_attribute_slots();<br>
<br>
case GLSL_TYPE_SAMPLER:<br>
+ case GLSL_TYPE_ATOMIC_UINT:<br>
case GLSL_TYPE_VOID:<br>
case GLSL_TYPE_ERROR:<br>
break;<br>
diff --git a/src/glsl/glsl_types.h b/src/glsl/glsl_types.h<br>
index acdf48f..d0274e6 100644<br>
--- a/src/glsl/glsl_types.h<br>
+++ b/src/glsl/glsl_types.h<br>
@@ -53,6 +53,7 @@ enum glsl_base_type {<br>
GLSL_TYPE_FLOAT,<br>
GLSL_TYPE_BOOL,<br>
GLSL_TYPE_SAMPLER,<br>
+ GLSL_TYPE_ATOMIC_UINT,<br>
GLSL_TYPE_STRUCT,<br>
GLSL_TYPE_INTERFACE,<br>
GLSL_TYPE_ARRAY,<br>
@@ -434,6 +435,19 @@ struct glsl_type {<br>
}<br>
<br>
/**<br>
+ * Return the amount of atomic counter storage required for a type.<br>
+ */<br>
+ unsigned atomic_size() const<br>
+ {<br>
+ if (base_type == GLSL_TYPE_ATOMIC_UINT)<br>
+ return ATOMIC_COUNTER_SIZE;<br>
+ else if (is_array())<br>
+ return length * element_type()->atomic_size();<br>
+ else<br>
+ return 0;<br>
+ }<br></blockquote><div><br></div><div>Can atomic counters appear inside structs? If so, we probably need an is_record() case here. If not, it would be nice to have a comment explaining why it's unnecessary.<br>
</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
+<br>
+ /**<br>
* Query the full type of a matrix row<br>
*<br>
* \return<br>
diff --git a/src/glsl/ir_clone.cpp b/src/glsl/ir_clone.cpp<br>
index fb303b0..b70b7db 100644<br>
--- a/src/glsl/ir_clone.cpp<br>
+++ b/src/glsl/ir_clone.cpp<br>
@@ -385,6 +385,7 @@ ir_constant::clone(void *mem_ctx, struct hash_table *ht) const<br>
}<br>
<br>
case GLSL_TYPE_SAMPLER:<br>
+ case GLSL_TYPE_ATOMIC_UINT:<br>
case GLSL_TYPE_VOID:<br>
case GLSL_TYPE_ERROR:<br>
case GLSL_TYPE_INTERFACE:<br>
diff --git a/src/glsl/link_uniform_initializers.cpp b/src/glsl/link_uniform_initializers.cpp<br>
index 3f66710..786aaf0 100644<br>
--- a/src/glsl/link_uniform_initializers.cpp<br>
+++ b/src/glsl/link_uniform_initializers.cpp<br>
@@ -69,6 +69,7 @@ copy_constant_to_storage(union gl_constant_value *storage,<br>
break;<br>
case GLSL_TYPE_ARRAY:<br>
case GLSL_TYPE_STRUCT:<br>
+ case GLSL_TYPE_ATOMIC_UINT:<br>
case GLSL_TYPE_INTERFACE:<br>
case GLSL_TYPE_VOID:<br>
case GLSL_TYPE_ERROR:<br>
diff --git a/src/glsl/tests/uniform_initializer_utils.cpp b/src/glsl/tests/uniform_initializer_utils.cpp<br>
index a04f5dd..5e86c24 100644<br>
--- a/src/glsl/tests/uniform_initializer_utils.cpp<br>
+++ b/src/glsl/tests/uniform_initializer_utils.cpp<br>
@@ -92,6 +92,7 @@ generate_data_element(void *mem_ctx, const glsl_type *type,<br>
case GLSL_TYPE_BOOL:<br>
data.b[i] = bool(values[idx]);<br>
break;<br>
+ case GLSL_TYPE_ATOMIC_UINT:<br>
case GLSL_TYPE_STRUCT:<br>
case GLSL_TYPE_ARRAY:<br>
case GLSL_TYPE_VOID:<br>
@@ -119,6 +120,7 @@ generate_data_element(void *mem_ctx, const glsl_type *type,<br>
case GLSL_TYPE_BOOL:<br>
ASSERT_EQ(data.b[i], val->value.b[i]);<br>
break;<br>
+ case GLSL_TYPE_ATOMIC_UINT:<br>
case GLSL_TYPE_STRUCT:<br>
case GLSL_TYPE_ARRAY:<br>
case GLSL_TYPE_VOID:<br>
@@ -217,6 +219,7 @@ verify_data(gl_constant_value *storage, unsigned storage_array_size,<br>
case GLSL_TYPE_BOOL:<br>
EXPECT_EQ(int(val->value.b[i]), storage[i].i);<br>
break;<br>
+ case GLSL_TYPE_ATOMIC_UINT:<br>
case GLSL_TYPE_STRUCT:<br>
case GLSL_TYPE_ARRAY:<br>
case GLSL_TYPE_VOID:<br>
diff --git a/src/mesa/program/ir_to_mesa.cpp b/src/mesa/program/ir_to_mesa.cpp<br>
index 41274a2..44f6d08 100644<br>
--- a/src/mesa/program/ir_to_mesa.cpp<br>
+++ b/src/mesa/program/ir_to_mesa.cpp<br>
@@ -619,6 +619,7 @@ type_size(const struct glsl_type *type)<br>
* at link time.<br>
*/<br>
return 1;<br>
+ case GLSL_TYPE_ATOMIC_UINT:<br>
case GLSL_TYPE_VOID:<br>
case GLSL_TYPE_ERROR:<br>
case GLSL_TYPE_INTERFACE:<br>
@@ -2584,6 +2585,7 @@ _mesa_associate_uniform_storage(struct gl_context *ctx,<br>
format = uniform_native;<br>
columns = 1;<br>
break;<br>
+ case GLSL_TYPE_ATOMIC_UINT:<br>
case GLSL_TYPE_ARRAY:<br>
case GLSL_TYPE_VOID:<br>
case GLSL_TYPE_STRUCT:<br>
diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp<br>
index cd4802b..67a8ed6 100644<br>
--- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp<br>
+++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp<br>
@@ -974,6 +974,7 @@ type_size(const struct glsl_type *type)<br>
* at link time.<br>
*/<br>
return 1;<br>
+ case GLSL_TYPE_ATOMIC_UINT:<br>
case GLSL_TYPE_INTERFACE:<br>
case GLSL_TYPE_VOID:<br>
case GLSL_TYPE_ERROR:<br>
<span class="HOEnZb"><font color="#888888">--<br>
1.8.3.4<br>
<br>
_______________________________________________<br>
mesa-dev mailing list<br>
<a href="mailto:mesa-dev@lists.freedesktop.org">mesa-dev@lists.freedesktop.org</a><br>
<a href="http://lists.freedesktop.org/mailman/listinfo/mesa-dev" target="_blank">http://lists.freedesktop.org/mailman/listinfo/mesa-dev</a><br>
</font></span></blockquote></div><br></div></div>