-extern cvar_t r_shadow_shadow_polygonfactor;
-extern cvar_t r_shadow_shadow_polygonoffset;
-extern cvar_t r_shadow_singlepassvolumegeneration;
-extern cvar_t r_shadow_texture3d;
-extern cvar_t gl_ext_separatestencil;
-extern cvar_t gl_ext_stenciltwoside;
+
+// used by shader for bouncegrid feature
+typedef struct r_shadow_bouncegrid_settings_s
+{
+ qboolean staticmode;
+ qboolean bounceanglediffuse;
+ qboolean directionalshading;
+ qboolean includedirectlighting;
+ qboolean blur;
+ qboolean normalizevectors;
+ int floatcolors;
+ float dlightparticlemultiplier;
+ qboolean hitmodels;
+ float lightradiusscale;
+ int maxbounce;
+ float lightpathsize_initial;
+ float lightpathsize_conespread;
+ float particlebounceintensity;
+ float particleintensity;
+ int maxphotons;
+ float energyperphoton;
+ float spacing[3];
+ int rng_type;
+ int rng_seed;
+ float bounceminimumintensity2;
+}
+r_shadow_bouncegrid_settings_t;
+
+typedef struct r_shadow_bouncegrid_state_s
+{
+ r_shadow_bouncegrid_settings_t settings;
+ qboolean capable;
+ qboolean allowdirectionalshading;
+ qboolean directional; // copied from settings.directionalshading after createtexture is decided
+ qboolean createtexture; // set to true to recreate the texture rather than updating it - happens when size changes or directional changes
+ rtexture_t *texture;
+ matrix4x4_t matrix;
+ vec_t intensity;
+ double lastupdatetime;
+ int resolution[3];
+ int numpixels;
+ int pixelbands;
+ int pixelsperband;
+ int bytesperband;
+ float spacing[3];
+ float ispacing[3];
+ vec3_t mins;
+ vec3_t maxs;
+ vec3_t size;
+ int maxsplatpaths;
+
+ // per-frame data that is very temporary
+ int numsplatpaths;
+ struct r_shadow_bouncegrid_splatpath_s *splatpaths;
+ int highpixels_index; // which one is active - this toggles when doing blur
+ float *highpixels; // equals blurpixels[highpixels_index]
+ float *blurpixels[2];
+ unsigned char *u8pixels; // temporary processing buffer when outputting to rgba8 format
+ unsigned short *fp16pixels; // temporary processing buffer when outputting to rgba16f format
+}
+r_shadow_bouncegrid_state_t;
+
+extern r_shadow_bouncegrid_state_t r_shadow_bouncegrid_state;