Officially make BROKEN_ARRAYS_WORKAROUND the default

Pretty awkward compromise, but the array version seems to confuse a lot of
drivers, without causing an actual error. So this is probably better in
practice until better drivers are more common.
Peter Wortmann 2012-11-05 16:57:33 +00:00
parent 8dcf8d1552
commit 75a404090d
2 changed files with 3 additions and 9 deletions

View File

@ -9,14 +9,8 @@ uniform sampler3D materialTex;
// Resolution of the landscape texture
uniform vec2 resolution;
// Use sampler if the GPU doesn't support enough uniforms to
// get the matMap as an array
#if MAX_FRAGMENT_UNIFORM_COMPONENTS < 259
#define BROKEN_ARRAYS_WORKAROUND
#endif
// Texture map
#ifdef BROKEN_ARRAYS_WORKAROUND
#ifndef NO_BROKEN_ARRAYS_WORKAROUND
uniform sampler1D matMapTex;
#else
uniform float matMap[256];
@ -42,7 +36,7 @@ int f2i(float x) {
float queryMatMap(int pix)
{
#ifdef BROKEN_ARRAYS_WORKAROUND
#ifndef NO_BROKEN_ARRAYS_WORKAROUND
int idx = f2i(texture1D(matMapTex, float(pix) / 256.0 + 0.5 / 256.0).r);
return float(idx) / 256.0 + 0.5 / float(materialDepth);
#else

View File

@ -34,7 +34,7 @@ const int C4LR_BiasDistanceY = 8;
// Workarounds to try if shader fails to compile
const char *C4LR_ShaderWorkarounds[] = {
"#define NO_TEXTURE_LOD_IN_FRAGMENT\n",
"#define BROKEN_ARRAYS_WORKAROUND\n",
"#define NO_BROKEN_ARRAYS_WORKAROUND\n",
"#define SCALER_IN_GPU\n",
};
const int C4LR_ShaderWorkaroundCount = sizeof(C4LR_ShaderWorkarounds) / sizeof(*C4LR_ShaderWorkarounds);