/*
 * $Id: $
 */

/*
 * Mesa 3-D graphics library
 * Copyright (C) 1995  Brian Paul  (brianp@ssec.wisc.edu)
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Library General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * Library General Public License for more details.
 *
 * You should have received a copy of the GNU Library General Public
 * License along with this library; if not, write to the Free
 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 */

#ifndef	AMIGAMESAint_H
#define	AMIGAMESAint_H

#include <cybergraphx/cybergraphx.h>
#include <exec/memory.h>
#include <exec/types.h>
#include <intuition/screens.h>
#include <inline/cybergraphx.h>

#include <inline/exec.h>
#include <inline/intuition.h>
#include <inline/graphics.h>
#include <inline/utility.h>

extern struct ExecBase *SysBase;
extern struct Library *GfxBase;
extern struct Library *UtilityBase;
extern struct Library *CyberGfxBase;

#include <gl/amigamesa.h>

#include "AOS/ht_colors.h"

#include "AOS/amigadisp.h"
#include "AOS/amigadisp_cgx.h"
#include "AOS/mempools.h"

/*
 * Note that you'll usually have to flip Y coordinates since Mesa's
 * window coordinates start at the bottom and increase upward.  Most
 * window system's Y-axis increases downward
 *
 * See dd.h for more device driver info.
 * See the other device driver implementations for ideas.
 */

#define	RESOURCE_VISUAL	(1 << 0)
#define	RESOURCE_BUFFER	(1 << 1)

#define FIXx(x) ((amesa->left + (x)))
#define FIXy(y) ((amesa->RealHeight - amesa->bottom - (y)))
#define FIXxy(x,y) (((amesa->RealWidth * FIXy(y)) + FIXx(x)))

#define MAX_POLYGON 300

/* deactive debugging-output only on request */
#if !defined(NDEBUG) && !defined(NODEBUG)
extern LONG debugOutput;
#define DEBUGOUT(level,str,args...) ({	\
  if(debugOutput >= level) {		\
    printf(str,##args);			\
  }					\
})
#else
#define DEBUGOUT(level,str,args...) ({})
#endif

extern int trueColor;
extern BOOL tryCached;
#endif

/*
 * TODO:
 *  -implement dither-availability as kind of doublebuffering
 *   can be done as cybergraphics + doublebuffer + swap[dither and/or quantize]
 */
