[Mesa-dev] [PATCH] drivers/common/meta: Disable GL_PRIMITIVE_RESTART in glBlitFramebuffer
Andrey Sudnik
andrey.sudnik at intel.com
Wed Nov 2 12:16:23 UTC 2016
glTexSubImage2D works incorrectly in i965
when GL_PIXEL_UNPACK_BUFFER is set and
GL_PRIMITIVE_RESTART is enabled.
The patch fixes this issue.
Signed-off-by: Andrey Sudnik <andrey.sudnik at intel.com>
---
src/mesa/drivers/common/meta.c | 12 ++++++++++++
src/mesa/drivers/common/meta.h | 6 ++++++
src/mesa/drivers/common/meta_blit.c | 3 +++
3 files changed, 21 insertions(+)
diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c
index 6dcbc8b..f48e943 100644
--- a/src/mesa/drivers/common/meta.c
+++ b/src/mesa/drivers/common/meta.c
@@ -789,6 +789,12 @@ _mesa_meta_begin(struct gl_context *ctx, GLbitfield state)
sizeof(save->ColorDrawBuffers));
}
+ if (state & MESA_META_PRIMITIVE_RESTART){
+ save->PrimitiveRestart = ctx->Array.PrimitiveRestart;
+ save->PrimitiveRestartFixedIndex = ctx->Array.PrimitiveRestartFixedIndex;
+ save->RestartIndex = ctx->Array.RestartIndex;
+ }
+
/* misc */
{
save->Lighting = ctx->Light.Enabled;
@@ -1175,6 +1181,12 @@ _mesa_meta_end(struct gl_context *ctx)
_mesa_set_framebuffer_srgb(ctx, save->sRGBEnabled);
}
+ if ( state & MESA_META_PRIMITIVE_RESTART) {
+ ctx->Array.PrimitiveRestart = save->PrimitiveRestart;
+ ctx->Array.PrimitiveRestartFixedIndex = save->PrimitiveRestartFixedIndex;
+ ctx->Array.RestartIndex = save->RestartIndex;
+ }
+
/* misc */
if (save->Lighting) {
_mesa_set_enable(ctx, GL_LIGHTING, GL_TRUE);
diff --git a/src/mesa/drivers/common/meta.h b/src/mesa/drivers/common/meta.h
index 0a7321c..9ba2850 100644
--- a/src/mesa/drivers/common/meta.h
+++ b/src/mesa/drivers/common/meta.h
@@ -60,6 +60,7 @@
#define MESA_META_OCCLUSION_QUERY 0x400000
#define MESA_META_DRAW_BUFFERS 0x800000
#define MESA_META_DITHER 0x1000000
+#define MESA_META_PRIMITIVE_RESTART 0x2000000
/**\}*/
/**
@@ -191,6 +192,11 @@ struct save_state
/** MESA_META_DRAW_BUFFERS */
GLenum ColorDrawBuffers[MAX_DRAW_BUFFERS];
+
+ /** MESA GL_PRIMITIVE_RESTART */
+ GLboolean PrimitiveRestart;
+ GLboolean PrimitiveRestartFixedIndex;
+ GLuint RestartIndex;
};
/**
diff --git a/src/mesa/drivers/common/meta_blit.c b/src/mesa/drivers/common/meta_blit.c
index 20d3215..d13d844 100644
--- a/src/mesa/drivers/common/meta_blit.c
+++ b/src/mesa/drivers/common/meta_blit.c
@@ -1020,6 +1020,9 @@ _mesa_meta_BlitFramebuffer(struct gl_context *ctx,
/* Dithering shouldn't be performed for glBlitFramebuffer */
_mesa_set_enable(ctx, GL_DITHER, GL_FALSE);
+ /* Disable Primitive Restart */
+ _mesa_set_enable(ctx, GL_PRIMITIVE_RESTART, GL_FALSE);
+
/* If the clipping earlier changed the destination rect at all, then
* enable the scissor to clip to it.
*/
--
2.7.4
--------------------------------------------------------------------
Joint Stock Company Intel A/O
Registered legal address: Krylatsky Hills Business Park,
17 Krylatskaya Str., Bldg 4, Moscow 121614,
Russian Federation
This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.
More information about the mesa-dev
mailing list