Am 24.01.2010 um 21:16 schrieb Henri Verbeet:
if(texrect) { if(lod) { sample_function->name = projected ? "texture2DRectProjLod" : "texture2DRectLod"; - } else if(grad) { - sample_function->name = projected ? "texture2DRectProjGradARB" : "texture2DRectGradARB"; - } else { + } + else if (grad) + { + if (gl_info->supported[EXT_GPU_SHADER4]) + sample_function->name = projected ? "texture2DRectProjGrad" : "texture2DRectGrad"; + else if (gl_info->supported[ARB_SHADER_TEXTURE_LOD]) + sample_function->name = projected ? "texture2DRectProjGradARB" : "texture2DRectGradARB"; + else + { + FIXME("Unsupported RECT grad function.\n"); + sample_function->name = "unsupported2DRectGrad"; + } + } + else + { sample_function->name = projected ? "texture2DRectProj" : "texture2DRect"; } } else {
I think these if constructs in shader_glsl_get_sample_function are becoming ugly with more and more possibilities added. Isn't there a nicer way, like a table that is either searched, or a multi-dimensional array to look up the end result?