diff --git a/src/compiler/glsl_types.cpp b/src/compiler/glsl_types.cpp index 302e1a5bf2e..e4ea204fd6b 100644 --- a/src/compiler/glsl_types.cpp +++ b/src/compiler/glsl_types.cpp @@ -2414,10 +2414,10 @@ glsl_get_std430_base_alignment(const struct glsl_type *t, bool row_major) return -1; } -unsigned -glsl_type::std430_array_stride(bool row_major) const +extern "C" unsigned +glsl_get_std430_array_stride(const struct glsl_type *t, bool row_major) { - unsigned N = is_64bit() ? 8 : 4; + unsigned N = t->is_64bit() ? 8 : 4; /* Notice that the array stride of a vec3 is not 3 * N but 4 * N. * See OpenGL 4.30 spec, section 7.6.2.2 "Standard Uniform Block Layout" @@ -2425,12 +2425,12 @@ glsl_type::std430_array_stride(bool row_major) const * (3) If the member is a three-component vector with components consuming * basic machine units, the base alignment is 4. */ - if (this->is_vector() && this->vector_elements == 3) + if (t->is_vector() && t->vector_elements == 3) return 4 * N; /* By default use std430_size(row_major) */ - unsigned stride = this->std430_size(row_major); - assert(this->explicit_stride == 0 || this->explicit_stride == stride); + unsigned stride = t->std430_size(row_major); + assert(t->explicit_stride == 0 || t->explicit_stride == stride); return stride; } diff --git a/src/compiler/glsl_types.h b/src/compiler/glsl_types.h index 6923cfe3e27..0032f0b19b9 100644 --- a/src/compiler/glsl_types.h +++ b/src/compiler/glsl_types.h @@ -1587,6 +1587,7 @@ glsl_get_ifc_packing(const struct glsl_type *t) unsigned glsl_get_std140_base_alignment(const struct glsl_type *t, bool row_major); unsigned glsl_get_std140_size(const struct glsl_type *t, bool row_major); +unsigned glsl_get_std430_array_stride(const struct glsl_type *t, bool row_major); unsigned glsl_get_std430_base_alignment(const struct glsl_type *t, bool row_major); unsigned glsl_get_std430_size(const struct glsl_type *t, bool row_major); unsigned glsl_get_explicit_size(const struct glsl_type *t, bool align_to_stride); diff --git a/src/compiler/glsl_types_impl.h b/src/compiler/glsl_types_impl.h index 63ae0f46b4a..619da0087f1 100644 --- a/src/compiler/glsl_types_impl.h +++ b/src/compiler/glsl_types_impl.h @@ -77,6 +77,7 @@ inline unsigned glsl_type::cl_alignment() const { return glsl_get_cl_alignment(t inline unsigned glsl_type::std140_base_alignment(bool row_major) const { return glsl_get_std140_base_alignment(this, row_major); } inline unsigned glsl_type::std140_size(bool row_major) const { return glsl_get_std140_size(this, row_major); } inline unsigned glsl_type::std430_base_alignment(bool row_major) const { return glsl_get_std430_base_alignment(this, row_major); } +inline unsigned glsl_type::std430_array_stride(bool row_major) const { return glsl_get_std430_array_stride(this, row_major); } inline unsigned glsl_type::std430_size(bool row_major) const { return glsl_get_std430_size(this, row_major); } inline unsigned glsl_type::explicit_size(bool align_to_stride) const { return glsl_get_explicit_size(this, align_to_stride); }