_query(struct gl_context *ctx, struct gl_query_object *q) {    struct brw_context *brw = brw_context(ctx);    struct brw_query_object *query = (struct brw_query_object *)q;     switch (query->Base.Target) {    case GL_TIME_ELAPSED:       brw_write_timestamp(brw, query->bo, 0);       break;     case GL_ANY_SAMPLES_PASSED:    case GL_ANY_SAMPLES_PASSED_CONSERVATIVE:    case GL_SAMPLES_PASSED_ARB:       brw_write_depth_count(brw, query->bo, 0);       break;     case GL_PRIMITIVES_GENERATED:       write_primitives_generated(brw, query->bo, query->Base.Stream, 0);       if (query->Base.Stream == 0)          ctx->NewDriverState |= BRW_NEW_RASTERIZER_DISCARD;       break;     case GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN:       write_xfb_primitives_written(brw, query->bo, query->Base.Stream, 0);       break;     case GL_TRANSFORM_FEEDBACK_STREAM_OVERFLOW_ARB:       write_xfb_overflow_streams(ctx, query->bo, query->Base.Stream, 0, 0);       break;     case GL_TRANSFORM_FEEDBACK_OVERFLOW_ARB:       write_xfb_overflow_streams(ctx, query->bo, 0, MAX_VERTEX_STREAMS, 0);       break;     