mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-25 13:00:09 +01:00
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 <marek.olsak@amd.com>
This commit is contained in:
parent
334a27afa7
commit
12e1f0c696
1 changed files with 21 additions and 0 deletions
|
|
@ -816,6 +816,27 @@ struct glsl_type {
|
|||
return (enum glsl_interface_packing)interface_packing;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue