diff options
author | Ian Romanick <[email protected]> | 2014-07-14 15:48:38 -0700 |
---|---|---|
committer | Kenneth Graunke <[email protected]> | 2014-08-29 23:29:19 -0700 |
commit | 932b0ef1ceecf873213447a8778e5cbe1b3b6be7 (patch) | |
tree | e0925b8001889ad75902abe9c5d2d740b8883b5d /src/glsl/ast_to_hir.cpp | |
parent | 8eeca7a56cf1ef47b6f86cc5a0397a532a7c2932 (diff) |
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 <[email protected]>
Reviewed-by: Kenneth Graunke <[email protected]>
Diffstat (limited to 'src/glsl/ast_to_hir.cpp')
-rw-r--r-- | src/glsl/ast_to_hir.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp index 30b02d01662..897505c6053 100644 --- a/src/glsl/ast_to_hir.cpp +++ b/src/glsl/ast_to_hir.cpp @@ -2360,11 +2360,11 @@ apply_image_qualifier_to_variable(const struct ast_type_qualifier *qual, "global variables"); } - var->data.image.read_only |= qual->flags.q.read_only; - var->data.image.write_only |= qual->flags.q.write_only; - var->data.image.coherent |= qual->flags.q.coherent; - var->data.image._volatile |= qual->flags.q._volatile; - var->data.image.restrict_flag |= qual->flags.q.restrict_flag; + var->data.image_read_only |= qual->flags.q.read_only; + var->data.image_write_only |= qual->flags.q.write_only; + var->data.image_coherent |= qual->flags.q.coherent; + var->data.image_volatile |= qual->flags.q._volatile; + var->data.image_restrict |= qual->flags.q.restrict_flag; var->data.read_only = true; if (qual->flags.q.explicit_image_format) { @@ -2378,7 +2378,7 @@ apply_image_qualifier_to_variable(const struct ast_type_qualifier *qual, "base data type of the image"); } - var->data.image.format = qual->image_format; + var->data.image_format = qual->image_format; } else { if (var->data.mode == ir_var_uniform && !qual->flags.q.write_only) { _mesa_glsl_error(loc, state, "uniforms not qualified with " @@ -2386,7 +2386,7 @@ apply_image_qualifier_to_variable(const struct ast_type_qualifier *qual, "qualifier"); } - var->data.image.format = GL_NONE; + var->data.image_format = GL_NONE; } } } |