glsl: Use bit-flags image attributes and uint16_t for the image format

All of the GL image enums fit in 16-bits.

Also move the fields from the anonymous "image" structucture to the next
higher structure.  This will enable packing the bits with the other
bitfield.

Valgrind massif results for a trimmed apitrace of dota2:

                  n        time(i)         total(B)   useful-heap(B) extra-heap(B)    stacks(B)
Before (32-bit): 76 40,572,916,873       68,831,248       63,328,783     5,502,465            0
After  (32-bit): 70 40,577,421,777       68,487,584       62,973,695     5,513,889            0

Before (64-bit): 60 36,822,640,058       96,526,824       88,735,296     7,791,528            0
After  (64-bit): 74 37,124,603,758       95,891,808       88,466,712     7,425,096            0

A real savings of 346KiB on 32-bit and 262KiB on 64-bit.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
This commit is contained in:
Ian Romanick
2014-07-14 15:48:38 -07:00
committed by Kenneth Graunke
parent 8eeca7a56c
commit 932b0ef1ce
6 changed files with 42 additions and 43 deletions

View File

@@ -697,6 +697,19 @@ public:
*/
unsigned index:1;
/**
* ARB_shader_image_load_store qualifiers.
*/
unsigned image_read_only:1; /**< "readonly" qualifier. */
unsigned image_write_only:1; /**< "writeonly" qualifier. */
unsigned image_coherent:1;
unsigned image_volatile:1;
unsigned image_restrict:1;
/** Image internal format if specified explicitly, otherwise GL_NONE. */
uint16_t image_format;
/**
* \brief Layout qualifier for gl_FragDepth.
*
@@ -744,20 +757,6 @@ public:
unsigned offset;
} atomic;
/**
* ARB_shader_image_load_store qualifiers.
*/
struct {
bool read_only; /**< "readonly" qualifier. */
bool write_only; /**< "writeonly" qualifier. */
bool coherent;
bool _volatile;
bool restrict_flag;
/** Image internal format if specified explicitly, otherwise GL_NONE. */
GLenum format;
} image;
/**
* Highest element accessed with a constant expression array index
*