diff options
author | Brian Paul <[email protected]> | 2004-06-02 00:16:42 +0000 |
---|---|---|
committer | Brian Paul <[email protected]> | 2004-06-02 00:16:42 +0000 |
commit | d203091d204ea2e543cd41ea85d0fc57aa794a4b (patch) | |
tree | a2d64d26d4faed3f4f92d772098260be22f7923b /src/mesa/swrast/s_context.c | |
parent | a4436a8f4476344f1ec81cacf35f5693d58dcc06 (diff) |
Check for NULL texture object when choosing texture sampler. Fixes segfault when fragment program references an incomplete texture
Diffstat (limited to 'src/mesa/swrast/s_context.c')
-rw-r--r-- | src/mesa/swrast/s_context.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/mesa/swrast/s_context.c b/src/mesa/swrast/s_context.c index 972de03b145..06f0d88abd8 100644 --- a/src/mesa/swrast/s_context.c +++ b/src/mesa/swrast/s_context.c @@ -333,6 +333,14 @@ _swrast_validate_blend_func( GLcontext *ctx, GLuint n, } +/** + * Called via the swrast->TextureSample[i] function pointer. + * Basically, given a texture object, an array of texture coords + * and an array of level-of-detail values, return an array of colors. + * In this case, determine the correct texture sampling routine + * (depending on filter mode, texture dimensions, etc) then call the + * sampler routine. + */ static void _swrast_validate_texture_sample( GLcontext *ctx, GLuint texUnit, const struct gl_texture_object *tObj, @@ -344,7 +352,7 @@ _swrast_validate_texture_sample( GLcontext *ctx, GLuint texUnit, _swrast_validate_derived( ctx ); /* Compute min/mag filter threshold */ - if (tObj->MinFilter != tObj->MagFilter) { + if (tObj && tObj->MinFilter != tObj->MagFilter) { if (tObj->MagFilter == GL_LINEAR && (tObj->MinFilter == GL_NEAREST_MIPMAP_NEAREST || tObj->MinFilter == GL_NEAREST_MIPMAP_LINEAR)) { |