diff options
Diffstat (limited to 'mesalib/src')
-rw-r--r-- | mesalib/src/mesa/drivers/common/meta.c | 12 | ||||
-rw-r--r-- | mesalib/src/mesa/main/fbobject.c | 2 | ||||
-rw-r--r-- | mesalib/src/mesa/main/teximage.c | 39 |
3 files changed, 34 insertions, 19 deletions
diff --git a/mesalib/src/mesa/drivers/common/meta.c b/mesalib/src/mesa/drivers/common/meta.c index 6c8495ddb..95336fc28 100644 --- a/mesalib/src/mesa/drivers/common/meta.c +++ b/mesalib/src/mesa/drivers/common/meta.c @@ -174,15 +174,19 @@ struct save_state struct gl_query_object *CondRenderQuery; GLenum CondRenderMode; +#if FEATURE_feedback /** MESA_META_SELECT_FEEDBACK */ GLenum RenderMode; struct gl_selection Select; struct gl_feedback Feedback; +#endif /** Miscellaneous (always disabled) */ GLboolean Lighting; GLboolean RasterDiscard; +#if FEATURE_EXT_transform_feedback GLboolean TransformFeedbackNeedsResume; +#endif }; /** @@ -425,6 +429,7 @@ _mesa_meta_begin(struct gl_context *ctx, GLbitfield state) memset(save, 0, sizeof(*save)); save->SavedState = state; +#if FEATURE_EXT_transform_feedback /* Pausing transform feedback needs to be done early, or else we won't be * able to change other state. */ @@ -433,6 +438,7 @@ _mesa_meta_begin(struct gl_context *ctx, GLbitfield state) !ctx->TransformFeedback.CurrentObject->Paused; if (save->TransformFeedbackNeedsResume) _mesa_PauseTransformFeedback(); +#endif if (state & MESA_META_ALPHA_TEST) { save->AlphaEnabled = ctx->Color.AlphaEnabled; @@ -700,6 +706,7 @@ _mesa_meta_begin(struct gl_context *ctx, GLbitfield state) _mesa_EndConditionalRender(); } +#if FEATURE_feedback if (state & MESA_META_SELECT_FEEDBACK) { save->RenderMode = ctx->RenderMode; if (ctx->RenderMode == GL_SELECT) { @@ -710,6 +717,7 @@ _mesa_meta_begin(struct gl_context *ctx, GLbitfield state) _mesa_RenderMode(GL_RENDER); } } +#endif /* misc */ { @@ -984,6 +992,7 @@ _mesa_meta_end(struct gl_context *ctx) save->CondRenderMode); } +#if FEATURE_feedback if (state & MESA_META_SELECT_FEEDBACK) { if (save->RenderMode == GL_SELECT) { _mesa_RenderMode(GL_SELECT); @@ -993,6 +1002,7 @@ _mesa_meta_end(struct gl_context *ctx) ctx->Feedback = save->Feedback; } } +#endif /* misc */ if (save->Lighting) { @@ -1001,8 +1011,10 @@ _mesa_meta_end(struct gl_context *ctx) if (save->RasterDiscard) { _mesa_set_enable(ctx, GL_RASTERIZER_DISCARD, GL_TRUE); } +#if FEATURE_EXT_transform_feedback if (save->TransformFeedbackNeedsResume) _mesa_ResumeTransformFeedback(); +#endif } diff --git a/mesalib/src/mesa/main/fbobject.c b/mesalib/src/mesa/main/fbobject.c index 6ee062d0b..281b1ca2f 100644 --- a/mesalib/src/mesa/main/fbobject.c +++ b/mesalib/src/mesa/main/fbobject.c @@ -1994,7 +1994,7 @@ framebuffer_texture(struct gl_context *ctx, const char *caller, GLenum target, } if ((level < 0) || - (level >= _mesa_max_texture_levels(ctx, texObj->Target))) { + (level >= _mesa_max_texture_levels(ctx, textarget))) { _mesa_error(ctx, GL_INVALID_VALUE, "glFramebufferTexture%sEXT(level)", caller); return; diff --git a/mesalib/src/mesa/main/teximage.c b/mesalib/src/mesa/main/teximage.c index 4fb81e62d..cf0a0cb2a 100644 --- a/mesalib/src/mesa/main/teximage.c +++ b/mesalib/src/mesa/main/teximage.c @@ -915,7 +915,6 @@ _mesa_max_texture_levels(struct gl_context *ctx, GLenum target) case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB: case GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB: case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB: - case GL_TEXTURE_CUBE_MAP_ARB: case GL_PROXY_TEXTURE_CUBE_MAP_ARB: return ctx->Extensions.ARB_texture_cube_map ? ctx->Const.MaxCubeTextureLevels : 0; @@ -2422,7 +2421,7 @@ _mesa_choose_texture_format(struct gl_context *ctx, /** * Adjust pixel unpack params and image dimensions to strip off the - * texture border. + * one-pixel texture border. * * Gallium and intel don't support texture borders. They've seldem been used * and seldom been implemented correctly anyway. @@ -2430,34 +2429,37 @@ _mesa_choose_texture_format(struct gl_context *ctx, * \param unpackNew returns the new pixel unpack parameters */ static void -strip_texture_border(GLint *border, +strip_texture_border(GLenum target, GLint *width, GLint *height, GLint *depth, const struct gl_pixelstore_attrib *unpack, struct gl_pixelstore_attrib *unpackNew) { - assert(*border > 0); /* sanity check */ + assert(width); + assert(height); + assert(depth); *unpackNew = *unpack; if (unpackNew->RowLength == 0) unpackNew->RowLength = *width; - if (depth && unpackNew->ImageHeight == 0) + if (unpackNew->ImageHeight == 0) unpackNew->ImageHeight = *height; - unpackNew->SkipPixels += *border; - if (height) - unpackNew->SkipRows += *border; - if (depth) - unpackNew->SkipImages += *border; - assert(*width >= 3); - *width = *width - 2 * *border; - if (height && *height >= 3) - *height = *height - 2 * *border; - if (depth && *depth >= 3) - *depth = *depth - 2 * *border; - *border = 0; + unpackNew->SkipPixels++; /* skip the border */ + *width = *width - 2; /* reduce the width by two border pixels */ + + /* The min height of a texture with a border is 3 */ + if (*height >= 3 && target != GL_TEXTURE_1D_ARRAY) { + unpackNew->SkipRows++; /* skip the border */ + *height = *height - 2; /* reduce the height by two border pixels */ + } + + if (*depth >= 3 && target != GL_TEXTURE_2D_ARRAY) { + unpackNew->SkipImages++; /* skip the border */ + *depth = *depth - 2; /* reduce the depth by two border pixels */ + } } /** @@ -2542,8 +2544,9 @@ teximage(struct gl_context *ctx, GLuint dims, * rarely-tested software fallback rendering. */ if (border && ctx->Const.StripTextureBorder) { - strip_texture_border(&border, &width, &height, &depth, unpack, + strip_texture_border(target, &width, &height, &depth, unpack, &unpack_no_border); + border = 0; unpack = &unpack_no_border; } |