summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
0c9df36)
If MaxAttribs were ever raised to 32, undefined behavior would occur.
We had already gone to the effort (albeit incorrectly) handle this in
one case, so fix them all.
CID:
1369628
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Alejandro PiƱeiro <apinheiro@igalia.com>
+#define SAFE_MASK_FROM_INDEX(i) (((i) >= 32) ? ~0 : ((1 << (i)) - 1))
+
/**
* Assign locations for either VS inputs or FS outputs
*
/**
* Assign locations for either VS inputs or FS outputs
*
/* Mark invalid locations as being used.
*/
/* Mark invalid locations as being used.
*/
- unsigned used_locations = (max_index >= 32)
- ? 0 : ~((1 << max_index) - 1);
+ unsigned used_locations = ~SAFE_MASK_FROM_INDEX(max_index);
unsigned double_storage_locations = 0;
assert((target_index == MESA_SHADER_VERTEX)
unsigned double_storage_locations = 0;
assert((target_index == MESA_SHADER_VERTEX)
if (target_index == MESA_SHADER_VERTEX) {
unsigned total_attribs_size =
if (target_index == MESA_SHADER_VERTEX) {
unsigned total_attribs_size =
- _mesa_bitcount(used_locations & ((1 << max_index) - 1)) +
+ _mesa_bitcount(used_locations & SAFE_MASK_FROM_INDEX(max_index)) +
_mesa_bitcount(double_storage_locations);
if (total_attribs_size > max_index) {
linker_error(prog,
_mesa_bitcount(double_storage_locations);
if (total_attribs_size > max_index) {
linker_error(prog,
*/
if (target_index == MESA_SHADER_VERTEX) {
unsigned total_attribs_size =
*/
if (target_index == MESA_SHADER_VERTEX) {
unsigned total_attribs_size =
- _mesa_bitcount(used_locations & ((1 << max_index) - 1)) +
+ _mesa_bitcount(used_locations & SAFE_MASK_FROM_INDEX(max_index)) +
_mesa_bitcount(double_storage_locations);
if (total_attribs_size > max_index) {
linker_error(prog,
_mesa_bitcount(double_storage_locations);
if (total_attribs_size > max_index) {
linker_error(prog,