Optimization: decouple internal and uniform SPHERE_MAX
This commit is contained in:
parent
ec48592ef1
commit
f62f44b5a7
@ -25,10 +25,10 @@ vecInv sphere(vec3 center, float radius) {
|
||||
|
||||
// construction. the SPHERE_MAX array size seems to affect frame rate a lot,
|
||||
// even though we should only be using the first few elements of each array
|
||||
const int SPHERE_MAX = 12;
|
||||
const int SPHERE_MAX_UNIFORM = 12;
|
||||
uniform int sphere_cnt;
|
||||
uniform vecInv sphere_list[SPHERE_MAX];
|
||||
uniform vec3 color_list[SPHERE_MAX];
|
||||
uniform vecInv sphere_list[SPHERE_MAX_UNIFORM];
|
||||
uniform vec3 color_list[SPHERE_MAX_UNIFORM];
|
||||
|
||||
// view
|
||||
uniform vec2 resolution;
|
||||
@ -135,8 +135,9 @@ void main() {
|
||||
vec3 dir = vec3(focal_slope * scr, -1.);
|
||||
|
||||
// cast rays through the spheres
|
||||
vec2 depth_pairs [SPHERE_MAX];
|
||||
taggedFrag frags [2*SPHERE_MAX];
|
||||
const int SPHERE_MAX_INTERNAL = 6;
|
||||
vec2 depth_pairs [SPHERE_MAX_INTERNAL];
|
||||
taggedFrag frags [2*SPHERE_MAX_INTERNAL];
|
||||
int frag_cnt = 0;
|
||||
for (int i = 0; i < sphere_cnt; ++i) {
|
||||
vec2 hit_depths = sphere_cast(sphere_list[i], dir);
|
||||
|
Loading…
Reference in New Issue
Block a user