{
struct intel_context *intel = intel_context(ctx);
- _swrast_InvalidateState(ctx, new_state);
+ if (ctx->swrast_context)
+ _swrast_InvalidateState(ctx, new_state);
_vbo_InvalidateState(ctx, new_state);
intel->NewGLState |= new_state;
ctx->Const.MaxRenderbufferSize = 2048;
}
- /* Initialize the software rasterizer and helper modules. */
- _swrast_CreateContext(ctx);
+ /* Initialize the software rasterizer and helper modules.
+ *
+ * As of GL 3.1 core, the gen4+ driver doesn't need the swrast context for
+ * software fallbacks (which we have to support on legacy GL to do weird
+ * glDrawPixels(), glBitmap(), and other functions).
+ */
+ if (intel->gen <= 3 || api != API_OPENGL_CORE) {
+ _swrast_CreateContext(ctx);
+ }
+
_vbo_CreateContext(ctx);
- _tnl_CreateContext(ctx);
- _swsetup_CreateContext(ctx);
-
- /* Configure swrast to match hardware characteristics: */
- _swrast_allow_pixel_fog(ctx, false);
- _swrast_allow_vertex_fog(ctx, true);
+ if (ctx->swrast_context) {
+ _tnl_CreateContext(ctx);
+ _swsetup_CreateContext(ctx);
+
+ /* Configure swrast to match hardware characteristics: */
+ _swrast_allow_pixel_fog(ctx, false);
+ _swrast_allow_vertex_fog(ctx, true);
+ }
_mesa_meta_init(ctx);
{
struct intel_context *intel =
(struct intel_context *) driContextPriv->driverPrivate;
+ struct gl_context *ctx = &intel->ctx;
assert(intel); /* should never be null */
if (intel) {
intel->vtbl.destroy(intel);
- _swsetup_DestroyContext(&intel->ctx);
- _tnl_DestroyContext(&intel->ctx);
+ if (ctx->swrast_context) {
+ _swsetup_DestroyContext(&intel->ctx);
+ _tnl_DestroyContext(&intel->ctx);
+ }
_vbo_DestroyContext(&intel->ctx);
- _swrast_DestroyContext(&intel->ctx);
+ if (ctx->swrast_context)
+ _swrast_DestroyContext(&intel->ctx);
intel->Fallback = 0x0; /* don't call _swrast_Flush later */
intel_batchbuffer_free(intel);