diff options
author | Timothy Arceri <[email protected]> | 2017-07-24 10:11:04 +1000 |
---|---|---|
committer | Timothy Arceri <[email protected]> | 2017-08-22 11:29:27 +1000 |
commit | 12e1f0c69676c256279f29309c36ece584f02c17 (patch) | |
tree | bd9f6494bee067b98c3ec8f0d9548ed44f56ef4c /src | |
parent | 334a27afa75d31af40b265219ba504cbb8c81255 (diff) |
glsl: add get_internal_ifc_packing() type helper
This is used to avoid code duplication when selecting the
packing type for shared and packed layouts.
Reviewed-by: Marek Olšák <[email protected]>
Diffstat (limited to 'src')
-rw-r--r-- | src/compiler/glsl_types.h | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/compiler/glsl_types.h b/src/compiler/glsl_types.h index f67465e6c87..3c18f6cce5b 100644 --- a/src/compiler/glsl_types.h +++ b/src/compiler/glsl_types.h @@ -817,6 +817,27 @@ struct glsl_type { } /** + * Get the type interface packing used internally. For shared and packing + * layouts this is implementation defined. + */ + enum glsl_interface_packing get_internal_ifc_packing(bool std430_supported) const + { + enum glsl_interface_packing packing = this->get_interface_packing(); + if (packing == GLSL_INTERFACE_PACKING_STD140 || + (!std430_supported && + (packing == GLSL_INTERFACE_PACKING_SHARED || + packing == GLSL_INTERFACE_PACKING_PACKED))) { + return GLSL_INTERFACE_PACKING_STD140; + } else { + assert(packing == GLSL_INTERFACE_PACKING_STD430 || + (std430_supported && + (packing == GLSL_INTERFACE_PACKING_SHARED || + packing == GLSL_INTERFACE_PACKING_PACKED))); + return GLSL_INTERFACE_PACKING_STD430; + } + } + + /** * Check if the type interface is row major */ bool get_interface_row_major() const |