Project

General

Profile

« Previous | Next » 

Revision 80961fc1

Added by Leszek Koltunski about 3 years ago

Make the 'Component Associations' UBO (on most devices) twice smaller -
use the 'packed' layout and 'ivec2' in place of 'ivec4'.

This forces us to dynamically probe the 'Stride' - number of 4-byte entities that the UBO's 'ivec4' takes - and correct the already-constructed UniformBlockAssociation objects in case this turns out to be different than the expected 2, i.e. tightly-packed.

The point: this saves a lot of uniform space in th vertex shader, which lets us declare larger MAX_NUM_COMPONENTS - needed for the Gigaminx.

(and no, we cannot assume an UBO can hold at least 16KB since this is not the case on Samsung Galaxy J4+)

View differences:

src/main/res/raw/main_vertex_shader.glsl
65 65
                                      // second vec4: first float - cache, next 3: Center, the third -  the Region.
66 66
  };
67 67

  
68
layout (std140) uniform componentAssociation
68
layout (packed) uniform componentAssociation
69 69
  {
70
  ivec4 vComAssoc[MAX_COMPON];        // component Associations, 4 ints:
71
                                      // 1: component's AND association
72
                                      // 2: reserved. Probably another AND assoc in the future.
73
                                      // 3: component's EQU association
74
                                      // 4: reserved
70
  ivec2 vComAssoc[MAX_COMPON];        // component 'AND' and 'EQU' Associations
75 71
  };
76 72

  
77 73
//////////////////////////////////////////////////////////////////////////////////////////////
......
131 127

  
132 128
  for(int i=0; i<vNumEffects; i++)
133 129
    {
134
    if( ((vComAssoc[component].x & vProperties[i].y) != 0) || (vComAssoc[component].z == vProperties[i].w) )
130
    if( ((vComAssoc[component].x & vProperties[i].y) != 0) || (vComAssoc[component].y == vProperties[i].w) )
135 131
      {
136 132
      // ENABLED EFFECTS WILL BE INSERTED HERE
137 133

  

Also available in: Unified diff