Compare commits
81 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
faa8c0ce8c | ||
|
8e60aeca2e | ||
|
f2e8f4c473 | ||
|
cf83f0b812 | ||
|
407ef9b5cc | ||
|
61cc9a7538 | ||
|
59cee11522 | ||
|
5a27e8e2ae | ||
|
533b766383 | ||
|
71f028bf93 | ||
|
f007d0f89d | ||
|
728df9aaca | ||
|
f8a500d96b | ||
|
12f4f51873 | ||
|
0c3f95e5e8 | ||
|
b3e27bca9f | ||
|
d2ade4b802 | ||
|
e48964a561 | ||
|
53557f1f34 | ||
|
3bf7ea2a1c | ||
|
4784a5030a | ||
|
bf3b9187f0 | ||
|
d747bfc224 | ||
|
f3b55494f3 | ||
|
8b68c0aa24 | ||
|
3c407b52ff | ||
|
210b74c613 | ||
|
dd0292dcf9 | ||
|
8c1b3b102d | ||
|
320b7ac65e | ||
|
5571689f8f | ||
|
49dbb9def6 | ||
|
90d824edaf | ||
|
d3702fc3ea | ||
|
f7638f004d | ||
|
30e9ffcd3b | ||
|
cdf9f4680f | ||
|
0bb23b4b6f | ||
|
a2dcd67c39 | ||
|
34e4091a44 | ||
|
ebb5228d18 | ||
|
df104eaa47 | ||
|
ebf84d9a2c | ||
|
2b1b51db7d | ||
|
a5fca974cf | ||
|
269f416864 | ||
|
6434e18af2 | ||
|
dbf423975c | ||
|
e53e7c9346 | ||
|
144b103f7f | ||
|
09cd109d98 | ||
|
136a938559 | ||
|
159dc4deff | ||
|
2a366a296f | ||
|
6d54bba2d5 | ||
|
74070e397f | ||
|
95b25b642e | ||
|
11d8caf376 | ||
|
5510842f97 | ||
|
56e993e946 | ||
|
b5157a0885 | ||
|
72c3667cb7 | ||
|
a063e12754 | ||
|
1f34dd5a7e | ||
|
623ff81931 | ||
|
98227f3181 | ||
|
381ccb50b9 | ||
|
64386d0893 | ||
|
cd53b44af0 | ||
|
fda7cbdc80 | ||
|
3f03f71caf | ||
|
a6ba493d71 | ||
|
2180ba68f1 | ||
|
2a2f8580b7 | ||
|
7fca3e5243 | ||
|
d233c5b75e | ||
|
df4d6bcbe8 | ||
|
ba34fdb5b9 | ||
|
2c9cc93f2a | ||
|
07f9b7cf82 | ||
|
4d63be67f3 |
@@ -14,6 +14,8 @@ ARCH_FLAGS = @ARCH_FLAGS@
|
||||
ASM_FLAGS = @ASM_FLAGS@
|
||||
PIC_FLAGS = @PIC_FLAGS@
|
||||
DEFINES = @DEFINES@
|
||||
API_DEFINES = @API_DEFINES@
|
||||
APIS = @APIS@
|
||||
CFLAGS = @CPPFLAGS@ @CFLAGS@ \
|
||||
$(OPT_FLAGS) $(PIC_FLAGS) $(ARCH_FLAGS) $(ASM_FLAGS) $(DEFINES)
|
||||
CXXFLAGS = @CPPFLAGS@ @CXXFLAGS@ \
|
||||
@@ -27,7 +29,7 @@ INTEL_CFLAGS = @INTEL_CFLAGS@
|
||||
X11_LIBS = @X11_LIBS@
|
||||
X11_CFLAGS = @X11_CFLAGS@
|
||||
|
||||
# Assembler
|
||||
# Source selection
|
||||
MESA_ASM_SOURCES = @MESA_ASM_SOURCES@
|
||||
GLAPI_ASM_SOURCES = @GLAPI_ASM_SOURCES@
|
||||
|
||||
@@ -49,6 +51,8 @@ GLU_LIB = GLU
|
||||
GLUT_LIB = glut
|
||||
GLW_LIB = GLw
|
||||
OSMESA_LIB = @OSMESA_LIB@
|
||||
GLESv1_CM_LIB = GLESv1_CM
|
||||
GLESv2_LIB = GLESv2
|
||||
|
||||
# Library names (actual file names)
|
||||
GL_LIB_NAME = @GL_LIB_NAME@
|
||||
@@ -57,6 +61,8 @@ GLUT_LIB_NAME = @GLUT_LIB_NAME@
|
||||
GLW_LIB_NAME = @GLW_LIB_NAME@
|
||||
OSMESA_LIB_NAME = @OSMESA_LIB_NAME@
|
||||
EGL_LIB_NAME = @EGL_LIB_NAME@
|
||||
GLESv1_CM_LIB_NAME = @GLESv1_CM_LIB_NAME@
|
||||
GLESv2_LIB_NAME = @GLESv2_LIB_NAME@
|
||||
|
||||
# Globs used to install the lib and all symlinks
|
||||
GL_LIB_GLOB = @GL_LIB_GLOB@
|
||||
@@ -65,6 +71,8 @@ GLUT_LIB_GLOB = @GLUT_LIB_GLOB@
|
||||
GLW_LIB_GLOB = @GLW_LIB_GLOB@
|
||||
OSMESA_LIB_GLOB = @OSMESA_LIB_GLOB@
|
||||
EGL_LIB_GLOB = @EGL_LIB_GLOB@
|
||||
GLESv1_CM_LIB_GLOB = @GLESv1_CM_LIB_GLOB@
|
||||
GLESv2_LIB_GLOB = @GLESv2_LIB_GLOB@
|
||||
|
||||
# Directories to build
|
||||
LIB_DIR = @LIB_DIR@
|
||||
@@ -107,6 +115,8 @@ GLUT_LIB_DEPS = -L$(TOP)/$(LIB_DIR) @GLUT_MESA_DEPS@ \
|
||||
GLW_LIB_DEPS = -L$(TOP)/$(LIB_DIR) @GLW_MESA_DEPS@ \
|
||||
$(EXTRA_LIB_PATH) @GLW_LIB_DEPS@
|
||||
APP_LIB_DEPS = $(EXTRA_LIB_PATH) @APP_LIB_DEPS@
|
||||
GLESv1_CM_LIB_DEPS = $(EXTRA_LIB_PATH) @GLESv1_LIB_DEPS@
|
||||
GLESv2_LIB_DEPS = $(EXTRA_LIB_PATH) @GLESv2_LIB_DEPS@
|
||||
|
||||
# DRI dependencies
|
||||
DRI_LIB_DEPS = $(EXTRA_LIB_PATH) @DRI_LIB_DEPS@
|
||||
@@ -155,6 +165,11 @@ GLW_PC_LIB_PRIV = @GLW_PC_LIB_PRIV@
|
||||
GLW_PC_CFLAGS = @GLW_PC_CFLAGS@
|
||||
OSMESA_PC_REQ = @OSMESA_PC_REQ@
|
||||
OSMESA_PC_LIB_PRIV = @OSMESA_PC_LIB_PRIV@
|
||||
GLESv1_CM_PC_LIB_PRIV = @GLESv1_CM_PC_LIB_PRIV@
|
||||
GLESv2_PC_LIB_PRIV = @GLESv2_PC_LIB_PRIV@
|
||||
EGL_PC_REQ_PRIV = @GL_PC_REQ_PRIV@
|
||||
EGL_PC_LIB_PRIV = @GL_PC_LIB_PRIV@
|
||||
EGL_PC_CFLAGS = @GL_PC_CFLAGS@
|
||||
|
||||
EGL_DRI2_CFLAGS = @EGL_DRI2_CFLAGS@
|
||||
EGL_DRI2_LIBS = @EGL_DRI2_LIBS@
|
||||
|
56
configure.ac
56
configure.ac
@@ -279,6 +279,8 @@ GLUT_LIB_NAME='lib$(GLUT_LIB).'${LIB_EXTENSION}
|
||||
GLW_LIB_NAME='lib$(GLW_LIB).'${LIB_EXTENSION}
|
||||
OSMESA_LIB_NAME='lib$(OSMESA_LIB).'${LIB_EXTENSION}
|
||||
EGL_LIB_NAME='lib$(EGL_LIB).'${LIB_EXTENSION}
|
||||
GLESv1_CM_LIB_NAME='lib$(GLESv1_CM_LIB).'${LIB_EXTENSION}
|
||||
GLESv2_LIB_NAME='lib$(GLESv2_LIB).'${LIB_EXTENSION}
|
||||
|
||||
GL_LIB_GLOB='lib$(GL_LIB).*'${LIB_EXTENSION}'*'
|
||||
GLU_LIB_GLOB='lib$(GLU_LIB).*'${LIB_EXTENSION}'*'
|
||||
@@ -286,6 +288,8 @@ GLUT_LIB_GLOB='lib$(GLUT_LIB).*'${LIB_EXTENSION}'*'
|
||||
GLW_LIB_GLOB='lib$(GLW_LIB).*'${LIB_EXTENSION}'*'
|
||||
OSMESA_LIB_GLOB='lib$(OSMESA_LIB).*'${LIB_EXTENSION}'*'
|
||||
EGL_LIB_GLOB='lib$(EGL_LIB).*'${LIB_EXTENSION}'*'
|
||||
GLESv1_CM_LIB_GLOB='lib$(GLESv1_CM_LIB).*'${LIB_EXTENSION}'*'
|
||||
GLESv2_LIB_GLOB='lib$(GLESv2_LIB).*'${LIB_EXTENSION}'*'
|
||||
|
||||
AC_SUBST([GL_LIB_NAME])
|
||||
AC_SUBST([GLU_LIB_NAME])
|
||||
@@ -293,6 +297,8 @@ AC_SUBST([GLUT_LIB_NAME])
|
||||
AC_SUBST([GLW_LIB_NAME])
|
||||
AC_SUBST([OSMESA_LIB_NAME])
|
||||
AC_SUBST([EGL_LIB_NAME])
|
||||
AC_SUBST([GLESv1_CM_LIB_NAME])
|
||||
AC_SUBST([GLESv2_LIB_NAME])
|
||||
|
||||
AC_SUBST([GL_LIB_GLOB])
|
||||
AC_SUBST([GLU_LIB_GLOB])
|
||||
@@ -300,6 +306,8 @@ AC_SUBST([GLUT_LIB_GLOB])
|
||||
AC_SUBST([GLW_LIB_GLOB])
|
||||
AC_SUBST([OSMESA_LIB_GLOB])
|
||||
AC_SUBST([EGL_LIB_GLOB])
|
||||
AC_SUBST([GLESv1_CM_LIB_GLOB])
|
||||
AC_SUBST([GLESv2_LIB_GLOB])
|
||||
|
||||
dnl
|
||||
dnl Arch/platform-specific settings
|
||||
@@ -655,6 +663,10 @@ dri)
|
||||
# need DRM libs, -lpthread, etc.
|
||||
GL_LIB_DEPS="$GL_LIB_DEPS $LIBDRM_LIBS -lm -lpthread $DLOPEN_LIBS"
|
||||
GL_PC_LIB_PRIV="-lm -lpthread $DLOPEN_LIBS"
|
||||
GLESv1_CM_LIB_DEPS="$LIBDRM_LIBS -lm -lpthread $DLOPEN_LIBS"
|
||||
GLESv1_CM_PC_LIB_PRIV="-lm -lpthread $DLOPEN_LIBS"
|
||||
GLESv2_LIB_DEPS="$LIBDRM_LIBS -lm -lpthread $DLOPEN_LIBS"
|
||||
GLESv2_PC_LIB_PRIV="-lm -lpthread $DLOPEN_LIBS"
|
||||
;;
|
||||
osmesa)
|
||||
# No libGL for osmesa
|
||||
@@ -666,6 +678,11 @@ AC_SUBST([GL_PC_REQ_PRIV])
|
||||
AC_SUBST([GL_PC_LIB_PRIV])
|
||||
AC_SUBST([GL_PC_CFLAGS])
|
||||
AC_SUBST([DRI_PC_REQ_PRIV])
|
||||
AC_SUBST([GLESv1_LIB_DEPS])
|
||||
AC_SUBST([GLESv1_CM_PC_LIB_PRIV])
|
||||
AC_SUBST([GLESv2_LIB_DEPS])
|
||||
AC_SUBST([GLESv2_PC_LIB_PRIV])
|
||||
|
||||
|
||||
dnl
|
||||
dnl More X11 setup
|
||||
@@ -713,6 +730,45 @@ if test "x$with_dri_drivers" = x; then
|
||||
with_dri_drivers=no
|
||||
fi
|
||||
|
||||
dnl Determine which APIs to support
|
||||
AC_ARG_ENABLE([opengl],
|
||||
[AS_HELP_STRING([--disable-opengl],
|
||||
[disable support for standard OpenGL API @<:@default=no@:>@])],
|
||||
[enable_opengl="$enableval"],
|
||||
[enable_opengl=yes])
|
||||
AC_ARG_ENABLE([gles1],
|
||||
[AS_HELP_STRING([--enable-gles1],
|
||||
[enable support for OpenGL ES 1.x API @<:@default=no@:>@])],
|
||||
[enable_gles1="$enableval"],
|
||||
[enable_gles1=no])
|
||||
AC_ARG_ENABLE([gles2],
|
||||
[AS_HELP_STRING([--enable-gles2],
|
||||
[enable support for OpenGL ES 2.x API @<:@default=no@:>@])],
|
||||
[enable_gles2="$enableval"],
|
||||
[enable_gles2=no])
|
||||
|
||||
API_DEFINES=""
|
||||
APIS=""
|
||||
if test "x$enable_opengl" = xno; then
|
||||
API_DEFINES="$API_DEFINES -DFEATURE_GL=0"
|
||||
else
|
||||
API_DEFINES="$API_DEFINES -DFEATURE_GL=1"
|
||||
APIS="$APIS gl"
|
||||
fi
|
||||
if test "x$enable_gles1" = xyes; then
|
||||
API_DEFINES="$API_DEFINES -DFEATURE_ES1=1"
|
||||
APIS="$APIS es1"
|
||||
fi
|
||||
if test "x$enable_gles2" = xyes; then
|
||||
API_DEFINES="$API_DEFINES -DFEATURE_ES2=1"
|
||||
APIS="$APIS es2"
|
||||
fi
|
||||
if test "x$enable_gles1" = xyes -o "x$enable_gles2" = xyes; then
|
||||
SRC_DIRS="$SRC_DIRS gles"
|
||||
fi
|
||||
AC_SUBST([API_DEFINES])
|
||||
AC_SUBST([APIS])
|
||||
|
||||
dnl If $with_dri_drivers is yes, directories will be added through
|
||||
dnl platform checks
|
||||
DRI_DIRS=""
|
||||
|
@@ -227,6 +227,25 @@ typedef EGLBoolean (EGLAPIENTRYP PFNEGLCOPYCONTEXTMESA) (EGLDisplay dpy, EGLCont
|
||||
#define EGL_CONTEXT_PRIORITY_LOW_IMG 0x3103
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef EGL_NOK_swap_region
|
||||
#define EGL_NOK_swap_region 1
|
||||
|
||||
#ifdef EGL_EGLEXT_PROTOTYPES
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglSwapBuffersRegionNOK(EGLDisplay dpy, EGLSurface surface, EGLint numRects, const EGLint* rects);
|
||||
#endif
|
||||
|
||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLSWAPBUFFERSREGIONNOK) (EGLDisplay dpy, EGLSurface surface, EGLint numRects, const EGLint* rects);
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef EGL_NOK_texture_from_pixmap
|
||||
#define EGL_NOK_texture_from_pixmap 1
|
||||
|
||||
#define EGL_Y_INVERTED_NOK 0x307F
|
||||
#endif /* EGL_NOK_texture_from_pixmap */
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@@ -730,7 +730,11 @@ struct __DRIdri2LoaderExtensionRec {
|
||||
* constructors for DRI2.
|
||||
*/
|
||||
#define __DRI_DRI2 "DRI_DRI2"
|
||||
#define __DRI_DRI2_VERSION 1
|
||||
#define __DRI_DRI2_VERSION 2
|
||||
|
||||
#define __DRI_API_OPENGL 0
|
||||
#define __DRI_API_GLES 1
|
||||
#define __DRI_API_GLES2 2
|
||||
|
||||
struct __DRIdri2ExtensionRec {
|
||||
__DRIextension base;
|
||||
@@ -749,6 +753,14 @@ struct __DRIdri2ExtensionRec {
|
||||
__DRIcontext *shared,
|
||||
void *loaderPrivate);
|
||||
|
||||
/* Since version 2 */
|
||||
unsigned int (*getAPIMask)(__DRIscreen *screen);
|
||||
|
||||
__DRIcontext *(*createNewContextForAPI)(__DRIscreen *screen,
|
||||
int api,
|
||||
const __DRIconfig *config,
|
||||
__DRIcontext *shared,
|
||||
void *data);
|
||||
};
|
||||
|
||||
|
||||
|
@@ -51,9 +51,13 @@
|
||||
#include "eglsurface.h"
|
||||
#include "eglimage.h"
|
||||
|
||||
#define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0]))
|
||||
|
||||
struct dri2_egl_driver
|
||||
{
|
||||
_EGLDriver base;
|
||||
|
||||
void (*glFlush)(void);
|
||||
};
|
||||
|
||||
struct dri2_egl_display
|
||||
@@ -161,7 +165,7 @@ EGLint dri2_to_egl_attribute_map[] = {
|
||||
0, /* __DRI_ATTRIB_BIND_TO_TEXTURE_RGBA */
|
||||
0, /* __DRI_ATTRIB_BIND_TO_MIPMAP_TEXTURE */
|
||||
0, /* __DRI_ATTRIB_BIND_TO_TEXTURE_TARGETS */
|
||||
0, /* __DRI_ATTRIB_YINVERTED */
|
||||
EGL_Y_INVERTED_NOK, /* __DRI_ATTRIB_YINVERTED */
|
||||
};
|
||||
|
||||
static void
|
||||
@@ -252,9 +256,8 @@ dri2_add_config(_EGLDisplay *disp, const __DRIconfig *dri_config, int id,
|
||||
_eglSetConfigKey(&base,
|
||||
EGL_BIND_TO_TEXTURE_RGBA, bind_to_texture_rgba);
|
||||
|
||||
/* EGL_OPENGL_ES_BIT, EGL_OPENVG_BIT, EGL_OPENGL_ES2_BIT */
|
||||
_eglSetConfigKey(&base, EGL_RENDERABLE_TYPE, EGL_OPENGL_BIT);
|
||||
_eglSetConfigKey(&base, EGL_CONFORMANT, EGL_OPENGL_BIT);
|
||||
_eglSetConfigKey(&base, EGL_RENDERABLE_TYPE, disp->ClientAPIsMask);
|
||||
_eglSetConfigKey(&base, EGL_CONFORMANT, disp->ClientAPIsMask);
|
||||
|
||||
if (!_eglValidateConfig(&base, EGL_FALSE)) {
|
||||
_eglLog(_EGL_DEBUG, "DRI2: failed to validate config %d", id);
|
||||
@@ -641,6 +644,7 @@ dri2_initialize(_EGLDriver *drv, _EGLDisplay *disp,
|
||||
const __DRIextension **extensions;
|
||||
struct dri2_egl_display *dri2_dpy;
|
||||
char path[PATH_MAX], *search_paths, *p, *next, *end;
|
||||
unsigned int api_mask;
|
||||
|
||||
dri2_dpy = malloc(sizeof *dri2_dpy);
|
||||
if (!dri2_dpy)
|
||||
@@ -683,10 +687,12 @@ dri2_initialize(_EGLDriver *drv, _EGLDisplay *disp,
|
||||
snprintf(path, sizeof path,
|
||||
dri_driver_format, (int) (next - p), p, dri2_dpy->driver_name);
|
||||
dri2_dpy->driver = dlopen(path, RTLD_NOW | RTLD_GLOBAL);
|
||||
if (dri2_dpy->driver == NULL)
|
||||
_eglLog(_EGL_DEBUG, "failed to open %s: %s\n", path, dlerror());
|
||||
}
|
||||
|
||||
if (dri2_dpy->driver == NULL) {
|
||||
_eglLog(_EGL_FATAL,
|
||||
_eglLog(_EGL_WARNING,
|
||||
"DRI2: failed to open any driver (search paths %s)",
|
||||
search_paths);
|
||||
goto cleanup_conn;
|
||||
@@ -695,7 +701,7 @@ dri2_initialize(_EGLDriver *drv, _EGLDisplay *disp,
|
||||
_eglLog(_EGL_DEBUG, "DRI2: dlopen(%s)", path);
|
||||
extensions = dlsym(dri2_dpy->driver, __DRI_DRIVER_EXTENSIONS);
|
||||
if (extensions == NULL) {
|
||||
_eglLog(_EGL_FATAL,
|
||||
_eglLog(_EGL_WARNING,
|
||||
"DRI2: driver exports no extensions (%s)", dlerror());
|
||||
goto cleanup_driver;
|
||||
}
|
||||
@@ -705,7 +711,7 @@ dri2_initialize(_EGLDriver *drv, _EGLDisplay *disp,
|
||||
|
||||
dri2_dpy->fd = open(dri2_dpy->device_name, O_RDWR);
|
||||
if (dri2_dpy->fd == -1) {
|
||||
_eglLog(_EGL_FATAL,
|
||||
_eglLog(_EGL_WARNING,
|
||||
"DRI2: could not open %s (%s)", dri2_dpy->device_name,
|
||||
strerror(errno));
|
||||
goto cleanup_driver;
|
||||
@@ -744,7 +750,7 @@ dri2_initialize(_EGLDriver *drv, _EGLDisplay *disp,
|
||||
&dri2_dpy->driver_configs, dri2_dpy);
|
||||
|
||||
if (dri2_dpy->dri_screen == NULL) {
|
||||
_eglLog(_EGL_FATAL, "DRI2: failed to create dri screen");
|
||||
_eglLog(_EGL_WARNING, "DRI2: failed to create dri screen");
|
||||
goto cleanup_fd;
|
||||
}
|
||||
|
||||
@@ -752,15 +758,30 @@ dri2_initialize(_EGLDriver *drv, _EGLDisplay *disp,
|
||||
if (!dri2_bind_extensions(dri2_dpy, dri2_core_extensions, extensions))
|
||||
goto cleanup_dri_screen;
|
||||
|
||||
if (dri2_dpy->dri2->base.version >= 2)
|
||||
api_mask = dri2_dpy->dri2->getAPIMask(dri2_dpy->dri_screen);
|
||||
else
|
||||
api_mask = __DRI_API_OPENGL;
|
||||
|
||||
disp->ClientAPIsMask = 0;
|
||||
if (api_mask & (1 <<__DRI_API_OPENGL))
|
||||
disp->ClientAPIsMask |= EGL_OPENGL_BIT;
|
||||
if (api_mask & (1 <<__DRI_API_GLES))
|
||||
disp->ClientAPIsMask |= EGL_OPENGL_ES_BIT;
|
||||
if (api_mask & (1 << __DRI_API_GLES2))
|
||||
disp->ClientAPIsMask |= EGL_OPENGL_ES2_BIT;
|
||||
|
||||
if (dri2_dpy->conn) {
|
||||
if (!dri2_add_configs_for_visuals(dri2_dpy, disp))
|
||||
goto cleanup_configs;
|
||||
}
|
||||
|
||||
disp->ClientAPIsMask = EGL_OPENGL_BIT;
|
||||
disp->Extensions.KHR_image_base = EGL_TRUE;
|
||||
disp->Extensions.KHR_image_pixmap = EGL_TRUE;
|
||||
disp->Extensions.KHR_gl_renderbuffer_image = EGL_TRUE;
|
||||
disp->Extensions.KHR_gl_texture_2D_image = EGL_TRUE;
|
||||
disp->Extensions.NOK_swap_region = EGL_TRUE;
|
||||
disp->Extensions.NOK_texture_from_pixmap = EGL_TRUE;
|
||||
|
||||
/* we're supporting EGL 1.4 */
|
||||
*major = 1;
|
||||
@@ -819,6 +840,7 @@ dri2_create_context(_EGLDriver *drv, _EGLDisplay *disp, _EGLConfig *conf,
|
||||
struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
|
||||
struct dri2_egl_context *dri2_ctx_shared = dri2_egl_context(share_list);
|
||||
struct dri2_egl_config *dri2_config = dri2_egl_config(conf);
|
||||
int api;
|
||||
|
||||
dri2_ctx = malloc(sizeof *dri2_ctx);
|
||||
if (!dri2_ctx) {
|
||||
@@ -829,12 +851,46 @@ dri2_create_context(_EGLDriver *drv, _EGLDisplay *disp, _EGLConfig *conf,
|
||||
if (!_eglInitContext(&dri2_ctx->base, disp, conf, attrib_list))
|
||||
goto cleanup;
|
||||
|
||||
dri2_ctx->dri_context =
|
||||
dri2_dpy->dri2->createNewContext(dri2_dpy->dri_screen,
|
||||
dri2_config->dri_config,
|
||||
dri2_ctx_shared ?
|
||||
dri2_ctx_shared->dri_context : NULL,
|
||||
dri2_ctx);
|
||||
switch (dri2_ctx->base.ClientAPI) {
|
||||
case EGL_OPENGL_ES_API:
|
||||
switch (dri2_ctx->base.ClientVersion) {
|
||||
case 1:
|
||||
api = __DRI_API_GLES;
|
||||
break;
|
||||
case 2:
|
||||
api = __DRI_API_GLES2;
|
||||
break;
|
||||
default:
|
||||
_eglError(EGL_BAD_PARAMETER, "eglCreateContext");
|
||||
return NULL;
|
||||
}
|
||||
break;
|
||||
case EGL_OPENGL_API:
|
||||
api = __DRI_API_OPENGL;
|
||||
break;
|
||||
default:
|
||||
_eglError(EGL_BAD_PARAMETER, "eglCreateContext");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (dri2_dpy->dri2->base.version >= 2) {
|
||||
dri2_ctx->dri_context =
|
||||
dri2_dpy->dri2->createNewContextForAPI(dri2_dpy->dri_screen,
|
||||
api,
|
||||
dri2_config->dri_config,
|
||||
dri2_ctx_shared ?
|
||||
dri2_ctx_shared->dri_context : NULL,
|
||||
dri2_ctx);
|
||||
} else if (api == __DRI_API_OPENGL) {
|
||||
dri2_ctx->dri_context =
|
||||
dri2_dpy->dri2->createNewContext(dri2_dpy->dri_screen,
|
||||
dri2_config->dri_config,
|
||||
dri2_ctx_shared ?
|
||||
dri2_ctx_shared->dri_context : NULL,
|
||||
dri2_ctx);
|
||||
} else {
|
||||
/* fail */
|
||||
}
|
||||
|
||||
if (!dri2_ctx->dri_context)
|
||||
goto cleanup;
|
||||
@@ -874,6 +930,7 @@ static EGLBoolean
|
||||
dri2_make_current(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *dsurf,
|
||||
_EGLSurface *rsurf, _EGLContext *ctx)
|
||||
{
|
||||
struct dri2_egl_driver *dri2_drv = dri2_egl_driver(drv);
|
||||
struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
|
||||
struct dri2_egl_surface *dri2_dsurf = dri2_egl_surface(dsurf);
|
||||
struct dri2_egl_surface *dri2_rsurf = dri2_egl_surface(rsurf);
|
||||
@@ -885,6 +942,10 @@ dri2_make_current(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *dsurf,
|
||||
if (!_eglBindContext(&ctx, &dsurf, &rsurf))
|
||||
return EGL_FALSE;
|
||||
|
||||
/* flush before context switch */
|
||||
if (ctx && dri2_drv->glFlush)
|
||||
dri2_drv->glFlush();
|
||||
|
||||
ddraw = (dri2_dsurf) ? dri2_dsurf->dri_drawable : NULL;
|
||||
rdraw = (dri2_rsurf) ? dri2_rsurf->dri_drawable : NULL;
|
||||
cctx = (dri2_ctx) ? dri2_ctx->dri_context : NULL;
|
||||
@@ -1010,12 +1071,21 @@ dri2_create_pbuffer_surface(_EGLDriver *drv, _EGLDisplay *disp,
|
||||
}
|
||||
|
||||
static EGLBoolean
|
||||
dri2_swap_buffers(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *draw)
|
||||
dri2_copy_region(_EGLDriver *drv, _EGLDisplay *disp,
|
||||
_EGLSurface *draw, xcb_xfixes_region_t region)
|
||||
{
|
||||
struct dri2_egl_driver *dri2_drv = dri2_egl_driver(drv);
|
||||
struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
|
||||
struct dri2_egl_surface *dri2_surf = dri2_egl_surface(draw);
|
||||
_EGLContext *ctx;
|
||||
xcb_dri2_copy_region_cookie_t cookie;
|
||||
|
||||
if (dri2_drv->glFlush) {
|
||||
ctx = _eglGetCurrentContext();
|
||||
if (ctx && ctx->DrawSurface == &dri2_surf->base)
|
||||
dri2_drv->glFlush();
|
||||
}
|
||||
|
||||
(*dri2_dpy->flush->flush)(dri2_surf->dri_drawable);
|
||||
|
||||
#if 0
|
||||
@@ -1034,7 +1104,7 @@ dri2_swap_buffers(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *draw)
|
||||
|
||||
cookie = xcb_dri2_copy_region_unchecked(dri2_dpy->conn,
|
||||
dri2_surf->drawable,
|
||||
dri2_surf->region,
|
||||
region,
|
||||
XCB_DRI2_ATTACHMENT_BUFFER_FRONT_LEFT,
|
||||
XCB_DRI2_ATTACHMENT_BUFFER_FAKE_FRONT_LEFT);
|
||||
free(xcb_dri2_copy_region_reply(dri2_dpy->conn, cookie, NULL));
|
||||
@@ -1042,6 +1112,44 @@ dri2_swap_buffers(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *draw)
|
||||
return EGL_TRUE;
|
||||
}
|
||||
|
||||
static EGLBoolean
|
||||
dri2_swap_buffers(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *draw)
|
||||
{
|
||||
struct dri2_egl_surface *dri2_surf = dri2_egl_surface(draw);
|
||||
|
||||
return dri2_copy_region(drv, disp, draw, dri2_surf->region);
|
||||
}
|
||||
|
||||
static EGLBoolean
|
||||
dri2_swap_buffers_region(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *draw,
|
||||
EGLint numRects, const EGLint *rects)
|
||||
{
|
||||
struct dri2_egl_display *dri2_dpy = dri2_egl_display(disp);
|
||||
struct dri2_egl_surface *dri2_surf = dri2_egl_surface(draw);
|
||||
EGLBoolean ret;
|
||||
xcb_xfixes_region_t region;
|
||||
xcb_rectangle_t rectangles[16];
|
||||
int i;
|
||||
|
||||
if (numRects > ARRAY_SIZE(rectangles))
|
||||
return dri2_copy_region(drv, disp, draw, dri2_surf->region);
|
||||
|
||||
/* FIXME: Invert y here? */
|
||||
for (i = 0; i < numRects; i++) {
|
||||
rectangles[i].x = rects[i * 4];
|
||||
rectangles[i].y = rects[i * 4 + 1];
|
||||
rectangles[i].width = rects[i * 4 + 2];
|
||||
rectangles[i].height = rects[i * 4 + 3];
|
||||
}
|
||||
|
||||
region = xcb_generate_id(dri2_dpy->conn);
|
||||
xcb_xfixes_create_region(dri2_dpy->conn, region, numRects, rectangles);
|
||||
ret = dri2_copy_region(drv, disp, draw, region);
|
||||
xcb_xfixes_destroy_region(dri2_dpy->conn, region);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*
|
||||
* Called from eglGetProcAddress() via drv->API.GetProcAddress().
|
||||
*/
|
||||
@@ -1122,19 +1230,8 @@ dri2_bind_tex_image(_EGLDriver *drv,
|
||||
ctx = _eglGetCurrentContext();
|
||||
dri2_ctx = dri2_egl_context(ctx);
|
||||
|
||||
if (buffer != EGL_BACK_BUFFER) {
|
||||
_eglError(EGL_BAD_PARAMETER, "eglBindTexImage");
|
||||
if (!_eglBindTexImage(drv, disp, surf, buffer))
|
||||
return EGL_FALSE;
|
||||
}
|
||||
|
||||
/* We allow binding pixmaps too... Not conformat, but we can do it
|
||||
* for free and it's useful for X compositors. Supposedly there's
|
||||
* a EGL_NOKIA_texture_from_pixmap extension that allows that, but
|
||||
* I couldn't find it at this time. */
|
||||
if ((dri2_surf->base.Type & (EGL_PBUFFER_BIT | EGL_PIXMAP_BIT)) == 0) {
|
||||
_eglError(EGL_BAD_SURFACE, "eglBindTexImage");
|
||||
return EGL_FALSE;
|
||||
}
|
||||
|
||||
switch (dri2_surf->base.TextureFormat) {
|
||||
case EGL_TEXTURE_RGB:
|
||||
@@ -1144,8 +1241,7 @@ dri2_bind_tex_image(_EGLDriver *drv,
|
||||
format = __DRI_TEXTURE_FORMAT_RGBA;
|
||||
break;
|
||||
default:
|
||||
_eglError(EGL_BAD_MATCH, "eglBindTexImage");
|
||||
return EGL_FALSE;
|
||||
assert(0);
|
||||
}
|
||||
|
||||
switch (dri2_surf->base.TextureTarget) {
|
||||
@@ -1153,15 +1249,14 @@ dri2_bind_tex_image(_EGLDriver *drv,
|
||||
target = GL_TEXTURE_2D;
|
||||
break;
|
||||
default:
|
||||
_eglError(EGL_BAD_PARAMETER, "eglBindTexImage");
|
||||
return EGL_FALSE;
|
||||
assert(0);
|
||||
}
|
||||
|
||||
(*dri2_dpy->tex_buffer->setTexBuffer2)(dri2_ctx->dri_context,
|
||||
target, format,
|
||||
dri2_surf->dri_drawable);
|
||||
|
||||
return dri2_surf->base.BoundToTexture = EGL_TRUE;
|
||||
return EGL_TRUE;
|
||||
}
|
||||
|
||||
static EGLBoolean
|
||||
@@ -1331,6 +1426,7 @@ _eglMain(const char *args)
|
||||
if (!dri2_drv)
|
||||
return NULL;
|
||||
|
||||
memset(dri2_drv, 0, sizeof *dri2_drv);
|
||||
_eglInitDriverFallbacks(&dri2_drv->base);
|
||||
dri2_drv->base.API.Initialize = dri2_initialize;
|
||||
dri2_drv->base.API.Terminate = dri2_terminate;
|
||||
@@ -1349,9 +1445,13 @@ _eglMain(const char *args)
|
||||
dri2_drv->base.API.ReleaseTexImage = dri2_release_tex_image;
|
||||
dri2_drv->base.API.CreateImageKHR = dri2_create_image_khr;
|
||||
dri2_drv->base.API.DestroyImageKHR = dri2_destroy_image_khr;
|
||||
dri2_drv->base.API.SwapBuffersRegionNOK = dri2_swap_buffers_region;
|
||||
|
||||
dri2_drv->base.Name = "DRI2";
|
||||
dri2_drv->base.Unload = dri2_unload;
|
||||
|
||||
dri2_drv->glFlush =
|
||||
(void (*)(void)) dri2_get_proc_address(&dri2_drv->base, "glFlush");
|
||||
|
||||
return &dri2_drv->base;
|
||||
}
|
||||
|
@@ -41,6 +41,7 @@
|
||||
#include "eglconfigutil.h"
|
||||
#include "eglconfig.h"
|
||||
#include "eglcontext.h"
|
||||
#include "egldefines.h"
|
||||
#include "egldisplay.h"
|
||||
#include "egldriver.h"
|
||||
#include "eglcurrent.h"
|
||||
@@ -48,7 +49,6 @@
|
||||
#include "eglsurface.h"
|
||||
|
||||
#define CALLOC_STRUCT(T) (struct T *) calloc(1, sizeof(struct T))
|
||||
#define ARRAY_SIZE(a) (sizeof(a) / sizeof(a[0]))
|
||||
|
||||
#ifndef GLX_VERSION_1_4
|
||||
#error "GL/glx.h must be equal to or greater than GLX 1.4"
|
||||
|
@@ -82,10 +82,27 @@ install-headers:
|
||||
$(INSTALL) -m 644 $(TOP)/include/EGL/*.h \
|
||||
$(DESTDIR)$(INSTALL_INC_DIR)/EGL
|
||||
|
||||
install: default install-headers
|
||||
PKG_CONFIG_DIR = $(INSTALL_LIB_DIR)/pkgconfig
|
||||
|
||||
gl_pcedit = sed \
|
||||
-e 's,@INSTALL_DIR@,$(INSTALL_DIR),' \
|
||||
-e 's,@INSTALL_LIB_DIR@,$(INSTALL_LIB_DIR),' \
|
||||
-e 's,@INSTALL_INC_DIR@,$(INSTALL_INC_DIR),' \
|
||||
-e 's,@VERSION@,$(MESA_MAJOR).$(MESA_MINOR).$(MESA_TINY),' \
|
||||
-e 's,@EGL_PC_REQ_PRIV@,$(EGL_PC_REQ_PRIV),' \
|
||||
-e 's,@EGL_PC_LIB_PRIV@,$(EGL_PC_LIB_PRIV),' \
|
||||
-e 's,@EGL_PC_CFLAGS@,$(EGL_PC_CFLAGS),' \
|
||||
-e 's,@EGL_LIB@,$(EGL_LIB),'
|
||||
|
||||
egl.pc: egl.pc.in
|
||||
$(gl_pcedit) $< > $@
|
||||
|
||||
install: default install-headers egl.pc
|
||||
$(INSTALL) -d $(DESTDIR)$(INSTALL_LIB_DIR)
|
||||
$(MINSTALL) $(TOP)/$(LIB_DIR)/$(EGL_LIB_GLOB) \
|
||||
$(DESTDIR)$(INSTALL_LIB_DIR)
|
||||
$(INSTALL) -d $(DESTDIR)$(PKG_CONFIG_DIR)
|
||||
$(INSTALL) -m 644 egl.pc $(DESTDIR)$(PKG_CONFIG_DIR)
|
||||
|
||||
clean:
|
||||
-rm -f *.o
|
||||
|
12
src/egl/main/egl.pc.in
Normal file
12
src/egl/main/egl.pc.in
Normal file
@@ -0,0 +1,12 @@
|
||||
prefix=@INSTALL_DIR@
|
||||
exec_prefix=${prefix}
|
||||
libdir=@INSTALL_LIB_DIR@
|
||||
includedir=@INSTALL_INC_DIR@
|
||||
|
||||
Name: egl
|
||||
Description: Mesa EGL library
|
||||
Requires.private: @EGL_PC_REQ_PRIV@
|
||||
Version: @VERSION@
|
||||
Libs: -L${libdir} -l@EGL_LIB@
|
||||
Libs.private: @EGL_PC_LIB_PRIV@
|
||||
Cflags: -I${includedir} @EGL_PC_CFLAGS@
|
@@ -261,7 +261,7 @@ EGLBoolean EGLAPIENTRY
|
||||
eglInitialize(EGLDisplay dpy, EGLint *major, EGLint *minor)
|
||||
{
|
||||
_EGLDisplay *disp = _eglLockDisplay(dpy);
|
||||
EGLint major_int, minor_int;
|
||||
EGLint major_int = 0, minor_int = 0;
|
||||
|
||||
if (!disp)
|
||||
RETURN_EGL_ERROR(NULL, EGL_BAD_DISPLAY, EGL_FALSE);
|
||||
@@ -272,13 +272,15 @@ eglInitialize(EGLDisplay dpy, EGLint *major, EGLint *minor)
|
||||
if (!drv) {
|
||||
_eglPreloadDrivers();
|
||||
drv = _eglMatchDriver(disp);
|
||||
if (!drv)
|
||||
RETURN_EGL_ERROR(disp, EGL_NOT_INITIALIZED, EGL_FALSE);
|
||||
/* Initialize the particular display now */
|
||||
if (drv && !drv->API.Initialize(drv, disp, &major_int, &minor_int))
|
||||
RETURN_EGL_ERROR(disp, EGL_NOT_INITIALIZED, EGL_FALSE);
|
||||
}
|
||||
|
||||
/* Initialize the particular display now */
|
||||
if (!drv->API.Initialize(drv, disp, &major_int, &minor_int))
|
||||
RETURN_EGL_ERROR(disp, EGL_NOT_INITIALIZED, EGL_FALSE);
|
||||
if (!drv)
|
||||
/* Load and initialize the first default driver that works */
|
||||
drv = _eglLoadDefaultDriver(disp, &major_int, &minor_int);
|
||||
if (!drv)
|
||||
RETURN_EGL_ERROR(disp, EGL_NOT_INITIALIZED, EGL_FALSE);
|
||||
|
||||
disp->APImajor = major_int;
|
||||
disp->APIminor = minor_int;
|
||||
@@ -836,6 +838,9 @@ eglGetProcAddress(const char *procname)
|
||||
{ "eglCreateImageKHR", (_EGLProc) eglCreateImageKHR },
|
||||
{ "eglDestroyImageKHR", (_EGLProc) eglDestroyImageKHR },
|
||||
#endif /* EGL_KHR_image_base */
|
||||
#ifdef EGL_NOK_swap_region
|
||||
{ "eglSwapBuffersRegionNOK", (_EGLProc) eglSwapBuffersRegionNOK },
|
||||
#endif
|
||||
{ NULL, NULL }
|
||||
};
|
||||
EGLint i;
|
||||
@@ -1244,3 +1249,32 @@ eglDestroyImageKHR(EGLDisplay dpy, EGLImageKHR image)
|
||||
|
||||
|
||||
#endif /* EGL_KHR_image_base */
|
||||
|
||||
|
||||
#ifdef EGL_NOK_swap_region
|
||||
|
||||
EGLBoolean
|
||||
eglSwapBuffersRegionNOK(EGLDisplay dpy, EGLSurface surface,
|
||||
EGLint numRects, const EGLint *rects)
|
||||
{
|
||||
_EGLContext *ctx = _eglGetCurrentContext();
|
||||
_EGLDisplay *disp = _eglLockDisplay(dpy);
|
||||
_EGLSurface *surf = _eglLookupSurface(surface, disp);
|
||||
_EGLDriver *drv;
|
||||
EGLBoolean ret;
|
||||
|
||||
_EGL_CHECK_SURFACE(disp, surf, EGL_FALSE, drv);
|
||||
|
||||
/* surface must be bound to current context in EGL 1.4 */
|
||||
if (!ctx || !_eglIsContextLinked(ctx) || surf != ctx->DrawSurface)
|
||||
RETURN_EGL_ERROR(disp, EGL_BAD_SURFACE, EGL_FALSE);
|
||||
|
||||
if (drv->API.SwapBuffersRegionNOK)
|
||||
ret = drv->API.SwapBuffersRegionNOK(drv, disp, surf, numRects, rects);
|
||||
else
|
||||
ret = drv->API.SwapBuffers(drv, disp, surf);
|
||||
|
||||
RETURN_EGL_EVAL(disp, ret);
|
||||
}
|
||||
|
||||
#endif /* EGL_NOK_swap_region */
|
||||
|
@@ -76,6 +76,9 @@ typedef _EGLImage *(*CreateImageKHR_t)(_EGLDriver *drv, _EGLDisplay *dpy, _EGLCo
|
||||
typedef EGLBoolean (*DestroyImageKHR_t)(_EGLDriver *drv, _EGLDisplay *dpy, _EGLImage *image);
|
||||
#endif /* EGL_KHR_image_base */
|
||||
|
||||
#ifdef EGL_NOK_swap_region
|
||||
typedef EGLBoolean (*SwapBuffersRegionNOK_t)(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *surf, EGLint numRects, const EGLint *rects);
|
||||
#endif
|
||||
|
||||
/**
|
||||
* The API dispatcher jumps through these functions
|
||||
@@ -134,6 +137,10 @@ struct _egl_api
|
||||
CreateImageKHR_t CreateImageKHR;
|
||||
DestroyImageKHR_t DestroyImageKHR;
|
||||
#endif /* EGL_KHR_image_base */
|
||||
|
||||
#ifdef EGL_NOK_swap_region
|
||||
SwapBuffersRegionNOK_t SwapBuffersRegionNOK;
|
||||
#endif
|
||||
};
|
||||
|
||||
#endif /* EGLAPI_INCLUDED */
|
||||
|
@@ -13,7 +13,6 @@
|
||||
|
||||
|
||||
#define MIN2(A, B) (((A) < (B)) ? (A) : (B))
|
||||
#define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0]))
|
||||
|
||||
|
||||
/**
|
||||
@@ -224,7 +223,12 @@ static const struct {
|
||||
0 },
|
||||
{ EGL_NONE, ATTRIB_TYPE_PSEUDO,
|
||||
ATTRIB_CRITERION_IGNORE,
|
||||
0 }
|
||||
0 },
|
||||
|
||||
{ EGL_Y_INVERTED_NOK, ATTRIB_TYPE_BOOLEAN,
|
||||
ATTRIB_CRITERION_EXACT,
|
||||
EGL_DONT_CARE },
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -479,6 +483,28 @@ _eglMatchConfig(const _EGLConfig *conf, const _EGLConfig *criteria)
|
||||
return matched;
|
||||
}
|
||||
|
||||
static INLINE EGLBoolean
|
||||
_eglIsConfigAttribValid(_EGLConfig *conf, EGLint attr)
|
||||
{
|
||||
if (_eglIndexConfig(conf, attr) < 0)
|
||||
return EGL_FALSE;
|
||||
|
||||
/* there are some holes in the range */
|
||||
switch (attr) {
|
||||
case 0x3030 /* a gap before EGL_SAMPLES */:
|
||||
case EGL_NONE:
|
||||
#ifdef EGL_VERSION_1_4
|
||||
case EGL_MATCH_NATIVE_PIXMAP:
|
||||
#endif
|
||||
return EGL_FALSE;
|
||||
case EGL_Y_INVERTED_NOK:
|
||||
return conf->Display->Extensions.NOK_texture_from_pixmap;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return EGL_TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize a criteria config from the given attribute list.
|
||||
@@ -501,15 +527,13 @@ _eglParseConfigAttribList(_EGLConfig *conf, const EGLint *attrib_list)
|
||||
|
||||
/* parse the list */
|
||||
for (i = 0; attrib_list && attrib_list[i] != EGL_NONE; i += 2) {
|
||||
EGLint idx;
|
||||
|
||||
attr = attrib_list[i];
|
||||
val = attrib_list[i + 1];
|
||||
|
||||
idx = _eglIndexConfig(conf, attr);
|
||||
if (idx < 0)
|
||||
return EGL_FALSE;
|
||||
conf->Storage[idx] = val;
|
||||
if (!_eglIsConfigAttribValid(conf, attr))
|
||||
return EGL_FALSE;
|
||||
|
||||
SET_CONFIG_ATTRIB(conf, attr, val);
|
||||
|
||||
/* rememeber some attributes for post-processing */
|
||||
switch (attr) {
|
||||
@@ -782,28 +806,6 @@ _eglChooseConfig(_EGLDriver *drv, _EGLDisplay *disp, const EGLint *attrib_list,
|
||||
}
|
||||
|
||||
|
||||
static INLINE EGLBoolean
|
||||
_eglIsConfigAttribValid(_EGLConfig *conf, EGLint attr)
|
||||
{
|
||||
if (_eglIndexConfig(conf, attr) < 0)
|
||||
return EGL_FALSE;
|
||||
|
||||
/* there are some holes in the range */
|
||||
switch (attr) {
|
||||
case 0x3030 /* a gap before EGL_SAMPLES */:
|
||||
case EGL_NONE:
|
||||
#ifdef EGL_VERSION_1_4
|
||||
case EGL_MATCH_NATIVE_PIXMAP:
|
||||
#endif
|
||||
return EGL_FALSE;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return EGL_TRUE;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Fallback for eglGetConfigAttrib.
|
||||
*/
|
||||
|
@@ -8,16 +8,24 @@
|
||||
|
||||
#define _EGL_CONFIG_FIRST_ATTRIB EGL_BUFFER_SIZE
|
||||
#define _EGL_CONFIG_LAST_ATTRIB EGL_CONFORMANT
|
||||
#define _EGL_CONFIG_NUM_ATTRIBS \
|
||||
#define _EGL_CONFIG_NUM_CONTIGUOUS_ATTRIBS \
|
||||
(_EGL_CONFIG_LAST_ATTRIB - _EGL_CONFIG_FIRST_ATTRIB + 1)
|
||||
|
||||
#define _EGL_CONFIG_STORAGE_SIZE _EGL_CONFIG_NUM_ATTRIBS
|
||||
/* Attributes outside the contiguous block:
|
||||
*
|
||||
* EGL_Y_INVERTED_NOK
|
||||
*/
|
||||
#define _EGL_CONFIG_FIRST_EXTRA_ATTRIB _EGL_CONFIG_NUM_CONTIGUOUS_ATTRIBS
|
||||
#define _EGL_CONFIG_NUM_EXTRA_ATTRIBS 1
|
||||
|
||||
#define _EGL_CONFIG_NUM_ATTRIBS \
|
||||
_EGL_CONFIG_NUM_CONTIGUOUS_ATTRIBS + _EGL_CONFIG_NUM_EXTRA_ATTRIBS
|
||||
|
||||
|
||||
struct _egl_config
|
||||
{
|
||||
_EGLDisplay *Display;
|
||||
EGLint Storage[_EGL_CONFIG_STORAGE_SIZE];
|
||||
EGLint Storage[_EGL_CONFIG_NUM_ATTRIBS];
|
||||
};
|
||||
|
||||
|
||||
@@ -37,10 +45,15 @@ _eglIndexConfig(const _EGLConfig *conf, EGLint key)
|
||||
{
|
||||
(void) conf;
|
||||
if (key >= _EGL_CONFIG_FIRST_ATTRIB &&
|
||||
key < _EGL_CONFIG_FIRST_ATTRIB + _EGL_CONFIG_NUM_ATTRIBS)
|
||||
key < _EGL_CONFIG_FIRST_ATTRIB + _EGL_CONFIG_NUM_CONTIGUOUS_ATTRIBS)
|
||||
return key - _EGL_CONFIG_FIRST_ATTRIB;
|
||||
else
|
||||
|
||||
switch (key) {
|
||||
case EGL_Y_INVERTED_NOK:
|
||||
return _EGL_CONFIG_FIRST_EXTRA_ATTRIB;
|
||||
default:
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@@ -40,6 +40,7 @@
|
||||
|
||||
#define _EGL_VENDOR_STRING "Mesa Project"
|
||||
|
||||
#define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0]))
|
||||
|
||||
|
||||
#endif /* EGLDEFINES_INCLUDED */
|
||||
|
@@ -46,6 +46,8 @@ struct _egl_extensions
|
||||
EGLBoolean KHR_gl_texture_cubemap_image;
|
||||
EGLBoolean KHR_gl_texture_3D_image;
|
||||
EGLBoolean KHR_gl_renderbuffer_image;
|
||||
EGLBoolean NOK_swap_region;
|
||||
EGLBoolean NOK_texture_from_pixmap;
|
||||
|
||||
char String[_EGL_MAX_EXTENSIONS_LEN];
|
||||
};
|
||||
|
@@ -36,7 +36,9 @@
|
||||
|
||||
|
||||
/* XXX Need to decide how to do dynamic name lookup on Windows */
|
||||
static const char DefaultDriverName[] = "TBD";
|
||||
static const char DefaultDriverNames[] = {
|
||||
"TBD",
|
||||
};
|
||||
|
||||
typedef HMODULE lib_handle;
|
||||
|
||||
@@ -63,7 +65,10 @@ library_suffix(void)
|
||||
#elif defined(_EGL_PLATFORM_POSIX)
|
||||
|
||||
|
||||
static const char DefaultDriverName[] = "egl_glx";
|
||||
static const char *DefaultDriverNames[] = {
|
||||
"egl_dri2",
|
||||
"egl_glx"
|
||||
};
|
||||
|
||||
typedef void * lib_handle;
|
||||
|
||||
@@ -87,32 +92,6 @@ library_suffix(void)
|
||||
}
|
||||
|
||||
|
||||
#else /* _EGL_PLATFORM_NO_OS */
|
||||
|
||||
|
||||
static const char DefaultDriverName[] = "builtin";
|
||||
|
||||
typedef void *lib_handle;
|
||||
|
||||
static INLINE void *
|
||||
open_library(const char *filename)
|
||||
{
|
||||
return (void *) filename;
|
||||
}
|
||||
|
||||
static INLINE void
|
||||
close_library(void *lib)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
static const char *
|
||||
library_suffix(void)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -157,12 +136,6 @@ _eglOpenLibrary(const char *driverPath, lib_handle *handle)
|
||||
else {
|
||||
error = dlerror();
|
||||
}
|
||||
#else /* _EGL_PLATFORM_NO_OS */
|
||||
/* must be the default driver name */
|
||||
if (strcmp(driverPath, DefaultDriverName) == 0)
|
||||
mainFunc = (_EGLMain_t) _eglMain;
|
||||
else
|
||||
error = "not builtin driver";
|
||||
#endif
|
||||
|
||||
if (!lib) {
|
||||
@@ -293,9 +266,9 @@ _eglLoaderFile(const char *dir, size_t len, void *loader_data)
|
||||
len += flen;
|
||||
path[len] = '\0';
|
||||
|
||||
drv = _eglLoadDriver(path, NULL);
|
||||
/* fix the path and load again */
|
||||
if (!drv && library_suffix()) {
|
||||
if (library_suffix() == NULL || strstr(path, library_suffix()))
|
||||
drv = _eglLoadDriver(path, NULL);
|
||||
else {
|
||||
const char *suffix = library_suffix();
|
||||
size_t slen = strlen(suffix);
|
||||
const char *p;
|
||||
@@ -306,6 +279,8 @@ _eglLoaderFile(const char *dir, size_t len, void *loader_data)
|
||||
if (need_suffix && len + slen + 1 <= sizeof(path)) {
|
||||
strcpy(path + len, suffix);
|
||||
drv = _eglLoadDriver(path, NULL);
|
||||
} else {
|
||||
drv = NULL;
|
||||
}
|
||||
}
|
||||
if (!drv)
|
||||
@@ -517,17 +492,6 @@ _eglPreloadDisplayDrivers(void)
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Preload the default driver.
|
||||
*/
|
||||
static EGLBoolean
|
||||
_eglPreloadDefaultDriver(void)
|
||||
{
|
||||
return (_eglPreloadForEach(_eglGetSearchPath(),
|
||||
_eglLoaderFile, (void *) DefaultDriverName) > 0);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Preload drivers.
|
||||
*
|
||||
@@ -549,15 +513,13 @@ _eglPreloadDrivers(void)
|
||||
}
|
||||
|
||||
loaded = (_eglPreloadUserDriver() ||
|
||||
_eglPreloadDisplayDrivers() ||
|
||||
_eglPreloadDefaultDriver());
|
||||
_eglPreloadDisplayDrivers());
|
||||
|
||||
_eglUnlockMutex(_eglGlobal.Mutex);
|
||||
|
||||
return loaded;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Unload preloaded drivers.
|
||||
*/
|
||||
@@ -588,6 +550,30 @@ _eglUnloadDrivers(void)
|
||||
_eglGlobal.NumDrivers = 0;
|
||||
}
|
||||
|
||||
_EGLDriver *
|
||||
_eglLoadDefaultDriver(EGLDisplay dpy, EGLint *major, EGLint *minor)
|
||||
{
|
||||
_EGLDriver *drv = NULL;
|
||||
int i;
|
||||
|
||||
_eglLockMutex(_eglGlobal.Mutex);
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(DefaultDriverNames); i++) {
|
||||
_eglPreloadForEach(_eglGetSearchPath(),
|
||||
_eglLoaderFile, (void *) DefaultDriverNames[i]);
|
||||
if (_eglGlobal.NumDrivers == 0)
|
||||
continue;
|
||||
drv = _eglGlobal.Drivers[0];
|
||||
if (drv->API.Initialize(drv, dpy, major, minor))
|
||||
break;
|
||||
_eglUnloadDrivers();
|
||||
}
|
||||
|
||||
_eglUnlockMutex(_eglGlobal.Mutex);
|
||||
|
||||
return drv;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Plug all the available fallback routines into the given driver's
|
||||
|
@@ -84,6 +84,10 @@ extern void
|
||||
_eglUnloadDrivers(void);
|
||||
|
||||
|
||||
extern _EGLDriver *
|
||||
_eglLoadDefaultDriver(EGLDisplay dpy, EGLint *major, EGLint *minor);
|
||||
|
||||
|
||||
PUBLIC void
|
||||
_eglInitDriverFallbacks(_EGLDriver *drv);
|
||||
|
||||
|
@@ -6,9 +6,6 @@
|
||||
#include "eglmutex.h"
|
||||
|
||||
|
||||
#define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0]))
|
||||
|
||||
|
||||
static _EGL_DECLARE_MUTEX(_eglGlobalMutex);
|
||||
struct _egl_global _eglGlobal =
|
||||
{
|
||||
|
@@ -96,6 +96,8 @@ _eglUpdateExtensionsString(_EGLDisplay *dpy)
|
||||
_EGL_CHECK_EXTENSION(KHR_gl_texture_3D_image);
|
||||
_EGL_CHECK_EXTENSION(KHR_gl_renderbuffer_image);
|
||||
|
||||
_EGL_CHECK_EXTENSION(NOK_swap_region);
|
||||
_EGL_CHECK_EXTENSION(NOK_texture_from_pixmap);
|
||||
#undef _EGL_CHECK_EXTENSION
|
||||
}
|
||||
|
||||
|
@@ -36,12 +36,17 @@ _eglClampSwapInterval(_EGLSurface *surf, EGLint interval)
|
||||
static EGLint
|
||||
_eglParseSurfaceAttribList(_EGLSurface *surf, const EGLint *attrib_list)
|
||||
{
|
||||
_EGLDisplay *dpy = surf->Resource.Display;
|
||||
EGLint type = surf->Type;
|
||||
EGLint texture_type = EGL_PBUFFER_BIT;
|
||||
EGLint i, err = EGL_SUCCESS;
|
||||
|
||||
if (!attrib_list)
|
||||
return EGL_SUCCESS;
|
||||
|
||||
if (dpy->Extensions.NOK_texture_from_pixmap)
|
||||
texture_type |= EGL_PIXMAP_BIT;
|
||||
|
||||
for (i = 0; attrib_list[i] != EGL_NONE; i++) {
|
||||
EGLint attr = attrib_list[i++];
|
||||
EGLint val = attrib_list[i];
|
||||
@@ -125,7 +130,7 @@ _eglParseSurfaceAttribList(_EGLSurface *surf, const EGLint *attrib_list)
|
||||
surf->LargestPbuffer = !!val;
|
||||
break;
|
||||
case EGL_TEXTURE_FORMAT:
|
||||
if (type != EGL_PBUFFER_BIT) {
|
||||
if (!(type & texture_type)) {
|
||||
err = EGL_BAD_ATTRIBUTE;
|
||||
break;
|
||||
}
|
||||
@@ -143,7 +148,7 @@ _eglParseSurfaceAttribList(_EGLSurface *surf, const EGLint *attrib_list)
|
||||
surf->TextureFormat = val;
|
||||
break;
|
||||
case EGL_TEXTURE_TARGET:
|
||||
if (type != EGL_PBUFFER_BIT) {
|
||||
if (!(type & texture_type)) {
|
||||
err = EGL_BAD_ATTRIBUTE;
|
||||
break;
|
||||
}
|
||||
@@ -160,7 +165,7 @@ _eglParseSurfaceAttribList(_EGLSurface *surf, const EGLint *attrib_list)
|
||||
surf->TextureTarget = val;
|
||||
break;
|
||||
case EGL_MIPMAP_TEXTURE:
|
||||
if (type != EGL_PBUFFER_BIT) {
|
||||
if (!(type & texture_type)) {
|
||||
err = EGL_BAD_ATTRIBUTE;
|
||||
break;
|
||||
}
|
||||
@@ -452,11 +457,16 @@ EGLBoolean
|
||||
_eglBindTexImage(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surface,
|
||||
EGLint buffer)
|
||||
{
|
||||
EGLint texture_type = EGL_PBUFFER_BIT;
|
||||
|
||||
/* Just do basic error checking and return success/fail.
|
||||
* Drivers must implement the real stuff.
|
||||
*/
|
||||
|
||||
if (surface->Type != EGL_PBUFFER_BIT) {
|
||||
if (dpy->Extensions.NOK_texture_from_pixmap)
|
||||
texture_type |= EGL_PIXMAP_BIT;
|
||||
|
||||
if (!(surface->Type & texture_type)) {
|
||||
_eglError(EGL_BAD_SURFACE, "eglBindTexImage");
|
||||
return EGL_FALSE;
|
||||
}
|
||||
@@ -466,6 +476,11 @@ _eglBindTexImage(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surface,
|
||||
return EGL_FALSE;
|
||||
}
|
||||
|
||||
if (surface->TextureTarget == EGL_NO_TEXTURE) {
|
||||
_eglError(EGL_BAD_MATCH, "eglBindTexImage");
|
||||
return EGL_FALSE;
|
||||
}
|
||||
|
||||
if (buffer != EGL_BACK_BUFFER) {
|
||||
_eglError(EGL_BAD_PARAMETER, "eglBindTexImage");
|
||||
return EGL_FALSE;
|
||||
|
@@ -83,7 +83,7 @@ extern EGLBoolean
|
||||
_eglSurfaceAttrib(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surf, EGLint attribute, EGLint value);
|
||||
|
||||
|
||||
extern EGLBoolean
|
||||
PUBLIC extern EGLBoolean
|
||||
_eglBindTexImage(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surf, EGLint buffer);
|
||||
|
||||
|
||||
|
2
src/gallium/auxiliary/indices/.gitignore
vendored
Normal file
2
src/gallium/auxiliary/indices/.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
u_indices_gen.c
|
||||
u_unfilled_gen.c
|
File diff suppressed because it is too large
Load Diff
@@ -1,992 +0,0 @@
|
||||
/* File automatically generated by u_unfilled_gen.py */
|
||||
|
||||
/*
|
||||
* Copyright 2009 VMware, Inc.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* on the rights to use, copy, modify, merge, publish, distribute, sub
|
||||
* license, and/or sell copies of the Software, and to permit persons to whom
|
||||
* the Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the next
|
||||
* paragraph) shall be included in all copies or substantial portions of the
|
||||
* Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
|
||||
* VMWARE AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
|
||||
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
||||
* USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Functions to translate and generate index lists
|
||||
*/
|
||||
|
||||
#include "indices/u_indices.h"
|
||||
#include "indices/u_indices_priv.h"
|
||||
#include "pipe/p_compiler.h"
|
||||
#include "util/u_debug.h"
|
||||
#include "pipe/p_defines.h"
|
||||
#include "util/u_memory.h"
|
||||
|
||||
|
||||
static unsigned out_size_idx( unsigned index_size )
|
||||
{
|
||||
switch (index_size) {
|
||||
case 4: return OUT_UINT;
|
||||
case 2: return OUT_USHORT;
|
||||
default: assert(0); return OUT_USHORT;
|
||||
}
|
||||
}
|
||||
|
||||
static unsigned in_size_idx( unsigned index_size )
|
||||
{
|
||||
switch (index_size) {
|
||||
case 4: return IN_UINT;
|
||||
case 2: return IN_USHORT;
|
||||
case 1: return IN_UBYTE;
|
||||
default: assert(0); return IN_UBYTE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static u_generate_func generate_line[OUT_COUNT][PRIM_COUNT];
|
||||
static u_translate_func translate_line[IN_COUNT][OUT_COUNT][PRIM_COUNT];
|
||||
|
||||
|
||||
static void generate_tris_ushort(
|
||||
unsigned nr,
|
||||
void *_out )
|
||||
{
|
||||
ushort *out = (ushort*)_out;
|
||||
unsigned i, j;
|
||||
(void)j;
|
||||
for (j = i = 0; j < nr; j+=6, i+=3) {
|
||||
(out+j)[0] = (ushort)(i);
|
||||
(out+j)[1] = (ushort)(i+1);
|
||||
(out+j+2)[0] = (ushort)(i+1);
|
||||
(out+j+2)[1] = (ushort)(i+2);
|
||||
(out+j+4)[0] = (ushort)(i+2);
|
||||
(out+j+4)[1] = (ushort)(i);
|
||||
}
|
||||
}
|
||||
static void generate_tristrip_ushort(
|
||||
unsigned nr,
|
||||
void *_out )
|
||||
{
|
||||
ushort *out = (ushort*)_out;
|
||||
unsigned i, j;
|
||||
(void)j;
|
||||
for (j = i = 0; j < nr; j+=6, i++) {
|
||||
(out+j)[0] = (ushort)(i);
|
||||
(out+j)[1] = (ushort)(i+1/*+(i&1)*/);
|
||||
(out+j+2)[0] = (ushort)(i+1/*+(i&1)*/);
|
||||
(out+j+2)[1] = (ushort)(i+2/*-(i&1)*/);
|
||||
(out+j+4)[0] = (ushort)(i+2/*-(i&1)*/);
|
||||
(out+j+4)[1] = (ushort)(i);
|
||||
}
|
||||
}
|
||||
static void generate_trifan_ushort(
|
||||
unsigned nr,
|
||||
void *_out )
|
||||
{
|
||||
ushort *out = (ushort*)_out;
|
||||
unsigned i, j;
|
||||
(void)j;
|
||||
for (j = i = 0; j < nr; j+=6, i++) {
|
||||
(out+j)[0] = (ushort)(0);
|
||||
(out+j)[1] = (ushort)(i+1);
|
||||
(out+j+2)[0] = (ushort)(i+1);
|
||||
(out+j+2)[1] = (ushort)(i+2);
|
||||
(out+j+4)[0] = (ushort)(i+2);
|
||||
(out+j+4)[1] = (ushort)(0);
|
||||
}
|
||||
}
|
||||
static void generate_quads_ushort(
|
||||
unsigned nr,
|
||||
void *_out )
|
||||
{
|
||||
ushort *out = (ushort*)_out;
|
||||
unsigned i, j;
|
||||
(void)j;
|
||||
for (j = i = 0; j < nr; j+=8, i+=4) {
|
||||
(out+j)[0] = (ushort)(i+0);
|
||||
(out+j)[1] = (ushort)(i+1);
|
||||
(out+j+2)[0] = (ushort)(i+1);
|
||||
(out+j+2)[1] = (ushort)(i+2);
|
||||
(out+j+4)[0] = (ushort)(i+2);
|
||||
(out+j+4)[1] = (ushort)(i+3);
|
||||
(out+j+6)[0] = (ushort)(i+3);
|
||||
(out+j+6)[1] = (ushort)(i+0);
|
||||
}
|
||||
}
|
||||
static void generate_quadstrip_ushort(
|
||||
unsigned nr,
|
||||
void *_out )
|
||||
{
|
||||
ushort *out = (ushort*)_out;
|
||||
unsigned i, j;
|
||||
(void)j;
|
||||
for (j = i = 0; j < nr; j+=8, i+=2) {
|
||||
(out+j)[0] = (ushort)(i+2);
|
||||
(out+j)[1] = (ushort)(i+0);
|
||||
(out+j+2)[0] = (ushort)(i+0);
|
||||
(out+j+2)[1] = (ushort)(i+1);
|
||||
(out+j+4)[0] = (ushort)(i+1);
|
||||
(out+j+4)[1] = (ushort)(i+3);
|
||||
(out+j+6)[0] = (ushort)(i+3);
|
||||
(out+j+6)[1] = (ushort)(i+2);
|
||||
}
|
||||
}
|
||||
static void generate_polygon_ushort(
|
||||
unsigned nr,
|
||||
void *_out )
|
||||
{
|
||||
ushort *out = (ushort*)_out;
|
||||
unsigned i, j;
|
||||
(void)j;
|
||||
for (j = i = 0; j < nr; j+=6, i++) {
|
||||
(out+j)[0] = (ushort)(0);
|
||||
(out+j)[1] = (ushort)(i+1);
|
||||
(out+j+2)[0] = (ushort)(i+1);
|
||||
(out+j+2)[1] = (ushort)(i+2);
|
||||
(out+j+4)[0] = (ushort)(i+2);
|
||||
(out+j+4)[1] = (ushort)(0);
|
||||
}
|
||||
}
|
||||
static void generate_tris_uint(
|
||||
unsigned nr,
|
||||
void *_out )
|
||||
{
|
||||
uint *out = (uint*)_out;
|
||||
unsigned i, j;
|
||||
(void)j;
|
||||
for (j = i = 0; j < nr; j+=6, i+=3) {
|
||||
(out+j)[0] = (uint)(i);
|
||||
(out+j)[1] = (uint)(i+1);
|
||||
(out+j+2)[0] = (uint)(i+1);
|
||||
(out+j+2)[1] = (uint)(i+2);
|
||||
(out+j+4)[0] = (uint)(i+2);
|
||||
(out+j+4)[1] = (uint)(i);
|
||||
}
|
||||
}
|
||||
static void generate_tristrip_uint(
|
||||
unsigned nr,
|
||||
void *_out )
|
||||
{
|
||||
uint *out = (uint*)_out;
|
||||
unsigned i, j;
|
||||
(void)j;
|
||||
for (j = i = 0; j < nr; j+=6, i++) {
|
||||
(out+j)[0] = (uint)(i);
|
||||
(out+j)[1] = (uint)(i+1/*+(i&1)*/);
|
||||
(out+j+2)[0] = (uint)(i+1/*+(i&1)*/);
|
||||
(out+j+2)[1] = (uint)(i+2/*-(i&1)*/);
|
||||
(out+j+4)[0] = (uint)(i+2/*-(i&1)*/);
|
||||
(out+j+4)[1] = (uint)(i);
|
||||
}
|
||||
}
|
||||
static void generate_trifan_uint(
|
||||
unsigned nr,
|
||||
void *_out )
|
||||
{
|
||||
uint *out = (uint*)_out;
|
||||
unsigned i, j;
|
||||
(void)j;
|
||||
for (j = i = 0; j < nr; j+=6, i++) {
|
||||
(out+j)[0] = (uint)(0);
|
||||
(out+j)[1] = (uint)(i+1);
|
||||
(out+j+2)[0] = (uint)(i+1);
|
||||
(out+j+2)[1] = (uint)(i+2);
|
||||
(out+j+4)[0] = (uint)(i+2);
|
||||
(out+j+4)[1] = (uint)(0);
|
||||
}
|
||||
}
|
||||
static void generate_quads_uint(
|
||||
unsigned nr,
|
||||
void *_out )
|
||||
{
|
||||
uint *out = (uint*)_out;
|
||||
unsigned i, j;
|
||||
(void)j;
|
||||
for (j = i = 0; j < nr; j+=8, i+=4) {
|
||||
(out+j)[0] = (uint)(i+0);
|
||||
(out+j)[1] = (uint)(i+1);
|
||||
(out+j+2)[0] = (uint)(i+1);
|
||||
(out+j+2)[1] = (uint)(i+2);
|
||||
(out+j+4)[0] = (uint)(i+2);
|
||||
(out+j+4)[1] = (uint)(i+3);
|
||||
(out+j+6)[0] = (uint)(i+3);
|
||||
(out+j+6)[1] = (uint)(i+0);
|
||||
}
|
||||
}
|
||||
static void generate_quadstrip_uint(
|
||||
unsigned nr,
|
||||
void *_out )
|
||||
{
|
||||
uint *out = (uint*)_out;
|
||||
unsigned i, j;
|
||||
(void)j;
|
||||
for (j = i = 0; j < nr; j+=8, i+=2) {
|
||||
(out+j)[0] = (uint)(i+2);
|
||||
(out+j)[1] = (uint)(i+0);
|
||||
(out+j+2)[0] = (uint)(i+0);
|
||||
(out+j+2)[1] = (uint)(i+1);
|
||||
(out+j+4)[0] = (uint)(i+1);
|
||||
(out+j+4)[1] = (uint)(i+3);
|
||||
(out+j+6)[0] = (uint)(i+3);
|
||||
(out+j+6)[1] = (uint)(i+2);
|
||||
}
|
||||
}
|
||||
static void generate_polygon_uint(
|
||||
unsigned nr,
|
||||
void *_out )
|
||||
{
|
||||
uint *out = (uint*)_out;
|
||||
unsigned i, j;
|
||||
(void)j;
|
||||
for (j = i = 0; j < nr; j+=6, i++) {
|
||||
(out+j)[0] = (uint)(0);
|
||||
(out+j)[1] = (uint)(i+1);
|
||||
(out+j+2)[0] = (uint)(i+1);
|
||||
(out+j+2)[1] = (uint)(i+2);
|
||||
(out+j+4)[0] = (uint)(i+2);
|
||||
(out+j+4)[1] = (uint)(0);
|
||||
}
|
||||
}
|
||||
static void translate_tris_ubyte2ushort(
|
||||
const void * _in,
|
||||
unsigned nr,
|
||||
void *_out )
|
||||
{
|
||||
const ubyte*in = (const ubyte*)_in;
|
||||
ushort *out = (ushort*)_out;
|
||||
unsigned i, j;
|
||||
(void)j;
|
||||
for (j = i = 0; j < nr; j+=6, i+=3) {
|
||||
(out+j)[0] = (ushort)in[i];
|
||||
(out+j)[1] = (ushort)in[i+1];
|
||||
(out+j+2)[0] = (ushort)in[i+1];
|
||||
(out+j+2)[1] = (ushort)in[i+2];
|
||||
(out+j+4)[0] = (ushort)in[i+2];
|
||||
(out+j+4)[1] = (ushort)in[i];
|
||||
}
|
||||
}
|
||||
static void translate_tristrip_ubyte2ushort(
|
||||
const void * _in,
|
||||
unsigned nr,
|
||||
void *_out )
|
||||
{
|
||||
const ubyte*in = (const ubyte*)_in;
|
||||
ushort *out = (ushort*)_out;
|
||||
unsigned i, j;
|
||||
(void)j;
|
||||
for (j = i = 0; j < nr; j+=6, i++) {
|
||||
(out+j)[0] = (ushort)in[i];
|
||||
(out+j)[1] = (ushort)in[i+1/*+(i&1)*/];
|
||||
(out+j+2)[0] = (ushort)in[i+1/*+(i&1)*/];
|
||||
(out+j+2)[1] = (ushort)in[i+2/*-(i&1)*/];
|
||||
(out+j+4)[0] = (ushort)in[i+2/*-(i&1)*/];
|
||||
(out+j+4)[1] = (ushort)in[i];
|
||||
}
|
||||
}
|
||||
static void translate_trifan_ubyte2ushort(
|
||||
const void * _in,
|
||||
unsigned nr,
|
||||
void *_out )
|
||||
{
|
||||
const ubyte*in = (const ubyte*)_in;
|
||||
ushort *out = (ushort*)_out;
|
||||
unsigned i, j;
|
||||
(void)j;
|
||||
for (j = i = 0; j < nr; j+=6, i++) {
|
||||
(out+j)[0] = (ushort)in[0];
|
||||
(out+j)[1] = (ushort)in[i+1];
|
||||
(out+j+2)[0] = (ushort)in[i+1];
|
||||
(out+j+2)[1] = (ushort)in[i+2];
|
||||
(out+j+4)[0] = (ushort)in[i+2];
|
||||
(out+j+4)[1] = (ushort)in[0];
|
||||
}
|
||||
}
|
||||
static void translate_quads_ubyte2ushort(
|
||||
const void * _in,
|
||||
unsigned nr,
|
||||
void *_out )
|
||||
{
|
||||
const ubyte*in = (const ubyte*)_in;
|
||||
ushort *out = (ushort*)_out;
|
||||
unsigned i, j;
|
||||
(void)j;
|
||||
for (j = i = 0; j < nr; j+=8, i+=4) {
|
||||
(out+j)[0] = (ushort)in[i+0];
|
||||
(out+j)[1] = (ushort)in[i+1];
|
||||
(out+j+2)[0] = (ushort)in[i+1];
|
||||
(out+j+2)[1] = (ushort)in[i+2];
|
||||
(out+j+4)[0] = (ushort)in[i+2];
|
||||
(out+j+4)[1] = (ushort)in[i+3];
|
||||
(out+j+6)[0] = (ushort)in[i+3];
|
||||
(out+j+6)[1] = (ushort)in[i+0];
|
||||
}
|
||||
}
|
||||
static void translate_quadstrip_ubyte2ushort(
|
||||
const void * _in,
|
||||
unsigned nr,
|
||||
void *_out )
|
||||
{
|
||||
const ubyte*in = (const ubyte*)_in;
|
||||
ushort *out = (ushort*)_out;
|
||||
unsigned i, j;
|
||||
(void)j;
|
||||
for (j = i = 0; j < nr; j+=8, i+=2) {
|
||||
(out+j)[0] = (ushort)in[i+2];
|
||||
(out+j)[1] = (ushort)in[i+0];
|
||||
(out+j+2)[0] = (ushort)in[i+0];
|
||||
(out+j+2)[1] = (ushort)in[i+1];
|
||||
(out+j+4)[0] = (ushort)in[i+1];
|
||||
(out+j+4)[1] = (ushort)in[i+3];
|
||||
(out+j+6)[0] = (ushort)in[i+3];
|
||||
(out+j+6)[1] = (ushort)in[i+2];
|
||||
}
|
||||
}
|
||||
static void translate_polygon_ubyte2ushort(
|
||||
const void * _in,
|
||||
unsigned nr,
|
||||
void *_out )
|
||||
{
|
||||
const ubyte*in = (const ubyte*)_in;
|
||||
ushort *out = (ushort*)_out;
|
||||
unsigned i, j;
|
||||
(void)j;
|
||||
for (j = i = 0; j < nr; j+=6, i++) {
|
||||
(out+j)[0] = (ushort)in[0];
|
||||
(out+j)[1] = (ushort)in[i+1];
|
||||
(out+j+2)[0] = (ushort)in[i+1];
|
||||
(out+j+2)[1] = (ushort)in[i+2];
|
||||
(out+j+4)[0] = (ushort)in[i+2];
|
||||
(out+j+4)[1] = (ushort)in[0];
|
||||
}
|
||||
}
|
||||
static void translate_tris_ubyte2uint(
|
||||
const void * _in,
|
||||
unsigned nr,
|
||||
void *_out )
|
||||
{
|
||||
const ubyte*in = (const ubyte*)_in;
|
||||
uint *out = (uint*)_out;
|
||||
unsigned i, j;
|
||||
(void)j;
|
||||
for (j = i = 0; j < nr; j+=6, i+=3) {
|
||||
(out+j)[0] = (uint)in[i];
|
||||
(out+j)[1] = (uint)in[i+1];
|
||||
(out+j+2)[0] = (uint)in[i+1];
|
||||
(out+j+2)[1] = (uint)in[i+2];
|
||||
(out+j+4)[0] = (uint)in[i+2];
|
||||
(out+j+4)[1] = (uint)in[i];
|
||||
}
|
||||
}
|
||||
static void translate_tristrip_ubyte2uint(
|
||||
const void * _in,
|
||||
unsigned nr,
|
||||
void *_out )
|
||||
{
|
||||
const ubyte*in = (const ubyte*)_in;
|
||||
uint *out = (uint*)_out;
|
||||
unsigned i, j;
|
||||
(void)j;
|
||||
for (j = i = 0; j < nr; j+=6, i++) {
|
||||
(out+j)[0] = (uint)in[i];
|
||||
(out+j)[1] = (uint)in[i+1/*+(i&1)*/];
|
||||
(out+j+2)[0] = (uint)in[i+1/*+(i&1)*/];
|
||||
(out+j+2)[1] = (uint)in[i+2/*-(i&1)*/];
|
||||
(out+j+4)[0] = (uint)in[i+2/*-(i&1)*/];
|
||||
(out+j+4)[1] = (uint)in[i];
|
||||
}
|
||||
}
|
||||
static void translate_trifan_ubyte2uint(
|
||||
const void * _in,
|
||||
unsigned nr,
|
||||
void *_out )
|
||||
{
|
||||
const ubyte*in = (const ubyte*)_in;
|
||||
uint *out = (uint*)_out;
|
||||
unsigned i, j;
|
||||
(void)j;
|
||||
for (j = i = 0; j < nr; j+=6, i++) {
|
||||
(out+j)[0] = (uint)in[0];
|
||||
(out+j)[1] = (uint)in[i+1];
|
||||
(out+j+2)[0] = (uint)in[i+1];
|
||||
(out+j+2)[1] = (uint)in[i+2];
|
||||
(out+j+4)[0] = (uint)in[i+2];
|
||||
(out+j+4)[1] = (uint)in[0];
|
||||
}
|
||||
}
|
||||
static void translate_quads_ubyte2uint(
|
||||
const void * _in,
|
||||
unsigned nr,
|
||||
void *_out )
|
||||
{
|
||||
const ubyte*in = (const ubyte*)_in;
|
||||
uint *out = (uint*)_out;
|
||||
unsigned i, j;
|
||||
(void)j;
|
||||
for (j = i = 0; j < nr; j+=8, i+=4) {
|
||||
(out+j)[0] = (uint)in[i+0];
|
||||
(out+j)[1] = (uint)in[i+1];
|
||||
(out+j+2)[0] = (uint)in[i+1];
|
||||
(out+j+2)[1] = (uint)in[i+2];
|
||||
(out+j+4)[0] = (uint)in[i+2];
|
||||
(out+j+4)[1] = (uint)in[i+3];
|
||||
(out+j+6)[0] = (uint)in[i+3];
|
||||
(out+j+6)[1] = (uint)in[i+0];
|
||||
}
|
||||
}
|
||||
static void translate_quadstrip_ubyte2uint(
|
||||
const void * _in,
|
||||
unsigned nr,
|
||||
void *_out )
|
||||
{
|
||||
const ubyte*in = (const ubyte*)_in;
|
||||
uint *out = (uint*)_out;
|
||||
unsigned i, j;
|
||||
(void)j;
|
||||
for (j = i = 0; j < nr; j+=8, i+=2) {
|
||||
(out+j)[0] = (uint)in[i+2];
|
||||
(out+j)[1] = (uint)in[i+0];
|
||||
(out+j+2)[0] = (uint)in[i+0];
|
||||
(out+j+2)[1] = (uint)in[i+1];
|
||||
(out+j+4)[0] = (uint)in[i+1];
|
||||
(out+j+4)[1] = (uint)in[i+3];
|
||||
(out+j+6)[0] = (uint)in[i+3];
|
||||
(out+j+6)[1] = (uint)in[i+2];
|
||||
}
|
||||
}
|
||||
static void translate_polygon_ubyte2uint(
|
||||
const void * _in,
|
||||
unsigned nr,
|
||||
void *_out )
|
||||
{
|
||||
const ubyte*in = (const ubyte*)_in;
|
||||
uint *out = (uint*)_out;
|
||||
unsigned i, j;
|
||||
(void)j;
|
||||
for (j = i = 0; j < nr; j+=6, i++) {
|
||||
(out+j)[0] = (uint)in[0];
|
||||
(out+j)[1] = (uint)in[i+1];
|
||||
(out+j+2)[0] = (uint)in[i+1];
|
||||
(out+j+2)[1] = (uint)in[i+2];
|
||||
(out+j+4)[0] = (uint)in[i+2];
|
||||
(out+j+4)[1] = (uint)in[0];
|
||||
}
|
||||
}
|
||||
static void translate_tris_ushort2ushort(
|
||||
const void * _in,
|
||||
unsigned nr,
|
||||
void *_out )
|
||||
{
|
||||
const ushort*in = (const ushort*)_in;
|
||||
ushort *out = (ushort*)_out;
|
||||
unsigned i, j;
|
||||
(void)j;
|
||||
for (j = i = 0; j < nr; j+=6, i+=3) {
|
||||
(out+j)[0] = (ushort)in[i];
|
||||
(out+j)[1] = (ushort)in[i+1];
|
||||
(out+j+2)[0] = (ushort)in[i+1];
|
||||
(out+j+2)[1] = (ushort)in[i+2];
|
||||
(out+j+4)[0] = (ushort)in[i+2];
|
||||
(out+j+4)[1] = (ushort)in[i];
|
||||
}
|
||||
}
|
||||
static void translate_tristrip_ushort2ushort(
|
||||
const void * _in,
|
||||
unsigned nr,
|
||||
void *_out )
|
||||
{
|
||||
const ushort*in = (const ushort*)_in;
|
||||
ushort *out = (ushort*)_out;
|
||||
unsigned i, j;
|
||||
(void)j;
|
||||
for (j = i = 0; j < nr; j+=6, i++) {
|
||||
(out+j)[0] = (ushort)in[i];
|
||||
(out+j)[1] = (ushort)in[i+1/*+(i&1)*/];
|
||||
(out+j+2)[0] = (ushort)in[i+1/*+(i&1)*/];
|
||||
(out+j+2)[1] = (ushort)in[i+2/*-(i&1)*/];
|
||||
(out+j+4)[0] = (ushort)in[i+2/*-(i&1)*/];
|
||||
(out+j+4)[1] = (ushort)in[i];
|
||||
}
|
||||
}
|
||||
static void translate_trifan_ushort2ushort(
|
||||
const void * _in,
|
||||
unsigned nr,
|
||||
void *_out )
|
||||
{
|
||||
const ushort*in = (const ushort*)_in;
|
||||
ushort *out = (ushort*)_out;
|
||||
unsigned i, j;
|
||||
(void)j;
|
||||
for (j = i = 0; j < nr; j+=6, i++) {
|
||||
(out+j)[0] = (ushort)in[0];
|
||||
(out+j)[1] = (ushort)in[i+1];
|
||||
(out+j+2)[0] = (ushort)in[i+1];
|
||||
(out+j+2)[1] = (ushort)in[i+2];
|
||||
(out+j+4)[0] = (ushort)in[i+2];
|
||||
(out+j+4)[1] = (ushort)in[0];
|
||||
}
|
||||
}
|
||||
static void translate_quads_ushort2ushort(
|
||||
const void * _in,
|
||||
unsigned nr,
|
||||
void *_out )
|
||||
{
|
||||
const ushort*in = (const ushort*)_in;
|
||||
ushort *out = (ushort*)_out;
|
||||
unsigned i, j;
|
||||
(void)j;
|
||||
for (j = i = 0; j < nr; j+=8, i+=4) {
|
||||
(out+j)[0] = (ushort)in[i+0];
|
||||
(out+j)[1] = (ushort)in[i+1];
|
||||
(out+j+2)[0] = (ushort)in[i+1];
|
||||
(out+j+2)[1] = (ushort)in[i+2];
|
||||
(out+j+4)[0] = (ushort)in[i+2];
|
||||
(out+j+4)[1] = (ushort)in[i+3];
|
||||
(out+j+6)[0] = (ushort)in[i+3];
|
||||
(out+j+6)[1] = (ushort)in[i+0];
|
||||
}
|
||||
}
|
||||
static void translate_quadstrip_ushort2ushort(
|
||||
const void * _in,
|
||||
unsigned nr,
|
||||
void *_out )
|
||||
{
|
||||
const ushort*in = (const ushort*)_in;
|
||||
ushort *out = (ushort*)_out;
|
||||
unsigned i, j;
|
||||
(void)j;
|
||||
for (j = i = 0; j < nr; j+=8, i+=2) {
|
||||
(out+j)[0] = (ushort)in[i+2];
|
||||
(out+j)[1] = (ushort)in[i+0];
|
||||
(out+j+2)[0] = (ushort)in[i+0];
|
||||
(out+j+2)[1] = (ushort)in[i+1];
|
||||
(out+j+4)[0] = (ushort)in[i+1];
|
||||
(out+j+4)[1] = (ushort)in[i+3];
|
||||
(out+j+6)[0] = (ushort)in[i+3];
|
||||
(out+j+6)[1] = (ushort)in[i+2];
|
||||
}
|
||||
}
|
||||
static void translate_polygon_ushort2ushort(
|
||||
const void * _in,
|
||||
unsigned nr,
|
||||
void *_out )
|
||||
{
|
||||
const ushort*in = (const ushort*)_in;
|
||||
ushort *out = (ushort*)_out;
|
||||
unsigned i, j;
|
||||
(void)j;
|
||||
for (j = i = 0; j < nr; j+=6, i++) {
|
||||
(out+j)[0] = (ushort)in[0];
|
||||
(out+j)[1] = (ushort)in[i+1];
|
||||
(out+j+2)[0] = (ushort)in[i+1];
|
||||
(out+j+2)[1] = (ushort)in[i+2];
|
||||
(out+j+4)[0] = (ushort)in[i+2];
|
||||
(out+j+4)[1] = (ushort)in[0];
|
||||
}
|
||||
}
|
||||
static void translate_tris_ushort2uint(
|
||||
const void * _in,
|
||||
unsigned nr,
|
||||
void *_out )
|
||||
{
|
||||
const ushort*in = (const ushort*)_in;
|
||||
uint *out = (uint*)_out;
|
||||
unsigned i, j;
|
||||
(void)j;
|
||||
for (j = i = 0; j < nr; j+=6, i+=3) {
|
||||
(out+j)[0] = (uint)in[i];
|
||||
(out+j)[1] = (uint)in[i+1];
|
||||
(out+j+2)[0] = (uint)in[i+1];
|
||||
(out+j+2)[1] = (uint)in[i+2];
|
||||
(out+j+4)[0] = (uint)in[i+2];
|
||||
(out+j+4)[1] = (uint)in[i];
|
||||
}
|
||||
}
|
||||
static void translate_tristrip_ushort2uint(
|
||||
const void * _in,
|
||||
unsigned nr,
|
||||
void *_out )
|
||||
{
|
||||
const ushort*in = (const ushort*)_in;
|
||||
uint *out = (uint*)_out;
|
||||
unsigned i, j;
|
||||
(void)j;
|
||||
for (j = i = 0; j < nr; j+=6, i++) {
|
||||
(out+j)[0] = (uint)in[i];
|
||||
(out+j)[1] = (uint)in[i+1/*+(i&1)*/];
|
||||
(out+j+2)[0] = (uint)in[i+1/*+(i&1)*/];
|
||||
(out+j+2)[1] = (uint)in[i+2/*-(i&1)*/];
|
||||
(out+j+4)[0] = (uint)in[i+2/*-(i&1)*/];
|
||||
(out+j+4)[1] = (uint)in[i];
|
||||
}
|
||||
}
|
||||
static void translate_trifan_ushort2uint(
|
||||
const void * _in,
|
||||
unsigned nr,
|
||||
void *_out )
|
||||
{
|
||||
const ushort*in = (const ushort*)_in;
|
||||
uint *out = (uint*)_out;
|
||||
unsigned i, j;
|
||||
(void)j;
|
||||
for (j = i = 0; j < nr; j+=6, i++) {
|
||||
(out+j)[0] = (uint)in[0];
|
||||
(out+j)[1] = (uint)in[i+1];
|
||||
(out+j+2)[0] = (uint)in[i+1];
|
||||
(out+j+2)[1] = (uint)in[i+2];
|
||||
(out+j+4)[0] = (uint)in[i+2];
|
||||
(out+j+4)[1] = (uint)in[0];
|
||||
}
|
||||
}
|
||||
static void translate_quads_ushort2uint(
|
||||
const void * _in,
|
||||
unsigned nr,
|
||||
void *_out )
|
||||
{
|
||||
const ushort*in = (const ushort*)_in;
|
||||
uint *out = (uint*)_out;
|
||||
unsigned i, j;
|
||||
(void)j;
|
||||
for (j = i = 0; j < nr; j+=8, i+=4) {
|
||||
(out+j)[0] = (uint)in[i+0];
|
||||
(out+j)[1] = (uint)in[i+1];
|
||||
(out+j+2)[0] = (uint)in[i+1];
|
||||
(out+j+2)[1] = (uint)in[i+2];
|
||||
(out+j+4)[0] = (uint)in[i+2];
|
||||
(out+j+4)[1] = (uint)in[i+3];
|
||||
(out+j+6)[0] = (uint)in[i+3];
|
||||
(out+j+6)[1] = (uint)in[i+0];
|
||||
}
|
||||
}
|
||||
static void translate_quadstrip_ushort2uint(
|
||||
const void * _in,
|
||||
unsigned nr,
|
||||
void *_out )
|
||||
{
|
||||
const ushort*in = (const ushort*)_in;
|
||||
uint *out = (uint*)_out;
|
||||
unsigned i, j;
|
||||
(void)j;
|
||||
for (j = i = 0; j < nr; j+=8, i+=2) {
|
||||
(out+j)[0] = (uint)in[i+2];
|
||||
(out+j)[1] = (uint)in[i+0];
|
||||
(out+j+2)[0] = (uint)in[i+0];
|
||||
(out+j+2)[1] = (uint)in[i+1];
|
||||
(out+j+4)[0] = (uint)in[i+1];
|
||||
(out+j+4)[1] = (uint)in[i+3];
|
||||
(out+j+6)[0] = (uint)in[i+3];
|
||||
(out+j+6)[1] = (uint)in[i+2];
|
||||
}
|
||||
}
|
||||
static void translate_polygon_ushort2uint(
|
||||
const void * _in,
|
||||
unsigned nr,
|
||||
void *_out )
|
||||
{
|
||||
const ushort*in = (const ushort*)_in;
|
||||
uint *out = (uint*)_out;
|
||||
unsigned i, j;
|
||||
(void)j;
|
||||
for (j = i = 0; j < nr; j+=6, i++) {
|
||||
(out+j)[0] = (uint)in[0];
|
||||
(out+j)[1] = (uint)in[i+1];
|
||||
(out+j+2)[0] = (uint)in[i+1];
|
||||
(out+j+2)[1] = (uint)in[i+2];
|
||||
(out+j+4)[0] = (uint)in[i+2];
|
||||
(out+j+4)[1] = (uint)in[0];
|
||||
}
|
||||
}
|
||||
static void translate_tris_uint2ushort(
|
||||
const void * _in,
|
||||
unsigned nr,
|
||||
void *_out )
|
||||
{
|
||||
const uint*in = (const uint*)_in;
|
||||
ushort *out = (ushort*)_out;
|
||||
unsigned i, j;
|
||||
(void)j;
|
||||
for (j = i = 0; j < nr; j+=6, i+=3) {
|
||||
(out+j)[0] = (ushort)in[i];
|
||||
(out+j)[1] = (ushort)in[i+1];
|
||||
(out+j+2)[0] = (ushort)in[i+1];
|
||||
(out+j+2)[1] = (ushort)in[i+2];
|
||||
(out+j+4)[0] = (ushort)in[i+2];
|
||||
(out+j+4)[1] = (ushort)in[i];
|
||||
}
|
||||
}
|
||||
static void translate_tristrip_uint2ushort(
|
||||
const void * _in,
|
||||
unsigned nr,
|
||||
void *_out )
|
||||
{
|
||||
const uint*in = (const uint*)_in;
|
||||
ushort *out = (ushort*)_out;
|
||||
unsigned i, j;
|
||||
(void)j;
|
||||
for (j = i = 0; j < nr; j+=6, i++) {
|
||||
(out+j)[0] = (ushort)in[i];
|
||||
(out+j)[1] = (ushort)in[i+1/*+(i&1)*/];
|
||||
(out+j+2)[0] = (ushort)in[i+1/*+(i&1)*/];
|
||||
(out+j+2)[1] = (ushort)in[i+2/*-(i&1)*/];
|
||||
(out+j+4)[0] = (ushort)in[i+2/*-(i&1)*/];
|
||||
(out+j+4)[1] = (ushort)in[i];
|
||||
}
|
||||
}
|
||||
static void translate_trifan_uint2ushort(
|
||||
const void * _in,
|
||||
unsigned nr,
|
||||
void *_out )
|
||||
{
|
||||
const uint*in = (const uint*)_in;
|
||||
ushort *out = (ushort*)_out;
|
||||
unsigned i, j;
|
||||
(void)j;
|
||||
for (j = i = 0; j < nr; j+=6, i++) {
|
||||
(out+j)[0] = (ushort)in[0];
|
||||
(out+j)[1] = (ushort)in[i+1];
|
||||
(out+j+2)[0] = (ushort)in[i+1];
|
||||
(out+j+2)[1] = (ushort)in[i+2];
|
||||
(out+j+4)[0] = (ushort)in[i+2];
|
||||
(out+j+4)[1] = (ushort)in[0];
|
||||
}
|
||||
}
|
||||
static void translate_quads_uint2ushort(
|
||||
const void * _in,
|
||||
unsigned nr,
|
||||
void *_out )
|
||||
{
|
||||
const uint*in = (const uint*)_in;
|
||||
ushort *out = (ushort*)_out;
|
||||
unsigned i, j;
|
||||
(void)j;
|
||||
for (j = i = 0; j < nr; j+=8, i+=4) {
|
||||
(out+j)[0] = (ushort)in[i+0];
|
||||
(out+j)[1] = (ushort)in[i+1];
|
||||
(out+j+2)[0] = (ushort)in[i+1];
|
||||
(out+j+2)[1] = (ushort)in[i+2];
|
||||
(out+j+4)[0] = (ushort)in[i+2];
|
||||
(out+j+4)[1] = (ushort)in[i+3];
|
||||
(out+j+6)[0] = (ushort)in[i+3];
|
||||
(out+j+6)[1] = (ushort)in[i+0];
|
||||
}
|
||||
}
|
||||
static void translate_quadstrip_uint2ushort(
|
||||
const void * _in,
|
||||
unsigned nr,
|
||||
void *_out )
|
||||
{
|
||||
const uint*in = (const uint*)_in;
|
||||
ushort *out = (ushort*)_out;
|
||||
unsigned i, j;
|
||||
(void)j;
|
||||
for (j = i = 0; j < nr; j+=8, i+=2) {
|
||||
(out+j)[0] = (ushort)in[i+2];
|
||||
(out+j)[1] = (ushort)in[i+0];
|
||||
(out+j+2)[0] = (ushort)in[i+0];
|
||||
(out+j+2)[1] = (ushort)in[i+1];
|
||||
(out+j+4)[0] = (ushort)in[i+1];
|
||||
(out+j+4)[1] = (ushort)in[i+3];
|
||||
(out+j+6)[0] = (ushort)in[i+3];
|
||||
(out+j+6)[1] = (ushort)in[i+2];
|
||||
}
|
||||
}
|
||||
static void translate_polygon_uint2ushort(
|
||||
const void * _in,
|
||||
unsigned nr,
|
||||
void *_out )
|
||||
{
|
||||
const uint*in = (const uint*)_in;
|
||||
ushort *out = (ushort*)_out;
|
||||
unsigned i, j;
|
||||
(void)j;
|
||||
for (j = i = 0; j < nr; j+=6, i++) {
|
||||
(out+j)[0] = (ushort)in[0];
|
||||
(out+j)[1] = (ushort)in[i+1];
|
||||
(out+j+2)[0] = (ushort)in[i+1];
|
||||
(out+j+2)[1] = (ushort)in[i+2];
|
||||
(out+j+4)[0] = (ushort)in[i+2];
|
||||
(out+j+4)[1] = (ushort)in[0];
|
||||
}
|
||||
}
|
||||
static void translate_tris_uint2uint(
|
||||
const void * _in,
|
||||
unsigned nr,
|
||||
void *_out )
|
||||
{
|
||||
const uint*in = (const uint*)_in;
|
||||
uint *out = (uint*)_out;
|
||||
unsigned i, j;
|
||||
(void)j;
|
||||
for (j = i = 0; j < nr; j+=6, i+=3) {
|
||||
(out+j)[0] = (uint)in[i];
|
||||
(out+j)[1] = (uint)in[i+1];
|
||||
(out+j+2)[0] = (uint)in[i+1];
|
||||
(out+j+2)[1] = (uint)in[i+2];
|
||||
(out+j+4)[0] = (uint)in[i+2];
|
||||
(out+j+4)[1] = (uint)in[i];
|
||||
}
|
||||
}
|
||||
static void translate_tristrip_uint2uint(
|
||||
const void * _in,
|
||||
unsigned nr,
|
||||
void *_out )
|
||||
{
|
||||
const uint*in = (const uint*)_in;
|
||||
uint *out = (uint*)_out;
|
||||
unsigned i, j;
|
||||
(void)j;
|
||||
for (j = i = 0; j < nr; j+=6, i++) {
|
||||
(out+j)[0] = (uint)in[i];
|
||||
(out+j)[1] = (uint)in[i+1/*+(i&1)*/];
|
||||
(out+j+2)[0] = (uint)in[i+1/*+(i&1)*/];
|
||||
(out+j+2)[1] = (uint)in[i+2/*-(i&1)*/];
|
||||
(out+j+4)[0] = (uint)in[i+2/*-(i&1)*/];
|
||||
(out+j+4)[1] = (uint)in[i];
|
||||
}
|
||||
}
|
||||
static void translate_trifan_uint2uint(
|
||||
const void * _in,
|
||||
unsigned nr,
|
||||
void *_out )
|
||||
{
|
||||
const uint*in = (const uint*)_in;
|
||||
uint *out = (uint*)_out;
|
||||
unsigned i, j;
|
||||
(void)j;
|
||||
for (j = i = 0; j < nr; j+=6, i++) {
|
||||
(out+j)[0] = (uint)in[0];
|
||||
(out+j)[1] = (uint)in[i+1];
|
||||
(out+j+2)[0] = (uint)in[i+1];
|
||||
(out+j+2)[1] = (uint)in[i+2];
|
||||
(out+j+4)[0] = (uint)in[i+2];
|
||||
(out+j+4)[1] = (uint)in[0];
|
||||
}
|
||||
}
|
||||
static void translate_quads_uint2uint(
|
||||
const void * _in,
|
||||
unsigned nr,
|
||||
void *_out )
|
||||
{
|
||||
const uint*in = (const uint*)_in;
|
||||
uint *out = (uint*)_out;
|
||||
unsigned i, j;
|
||||
(void)j;
|
||||
for (j = i = 0; j < nr; j+=8, i+=4) {
|
||||
(out+j)[0] = (uint)in[i+0];
|
||||
(out+j)[1] = (uint)in[i+1];
|
||||
(out+j+2)[0] = (uint)in[i+1];
|
||||
(out+j+2)[1] = (uint)in[i+2];
|
||||
(out+j+4)[0] = (uint)in[i+2];
|
||||
(out+j+4)[1] = (uint)in[i+3];
|
||||
(out+j+6)[0] = (uint)in[i+3];
|
||||
(out+j+6)[1] = (uint)in[i+0];
|
||||
}
|
||||
}
|
||||
static void translate_quadstrip_uint2uint(
|
||||
const void * _in,
|
||||
unsigned nr,
|
||||
void *_out )
|
||||
{
|
||||
const uint*in = (const uint*)_in;
|
||||
uint *out = (uint*)_out;
|
||||
unsigned i, j;
|
||||
(void)j;
|
||||
for (j = i = 0; j < nr; j+=8, i+=2) {
|
||||
(out+j)[0] = (uint)in[i+2];
|
||||
(out+j)[1] = (uint)in[i+0];
|
||||
(out+j+2)[0] = (uint)in[i+0];
|
||||
(out+j+2)[1] = (uint)in[i+1];
|
||||
(out+j+4)[0] = (uint)in[i+1];
|
||||
(out+j+4)[1] = (uint)in[i+3];
|
||||
(out+j+6)[0] = (uint)in[i+3];
|
||||
(out+j+6)[1] = (uint)in[i+2];
|
||||
}
|
||||
}
|
||||
static void translate_polygon_uint2uint(
|
||||
const void * _in,
|
||||
unsigned nr,
|
||||
void *_out )
|
||||
{
|
||||
const uint*in = (const uint*)_in;
|
||||
uint *out = (uint*)_out;
|
||||
unsigned i, j;
|
||||
(void)j;
|
||||
for (j = i = 0; j < nr; j+=6, i++) {
|
||||
(out+j)[0] = (uint)in[0];
|
||||
(out+j)[1] = (uint)in[i+1];
|
||||
(out+j+2)[0] = (uint)in[i+1];
|
||||
(out+j+2)[1] = (uint)in[i+2];
|
||||
(out+j+4)[0] = (uint)in[i+2];
|
||||
(out+j+4)[1] = (uint)in[0];
|
||||
}
|
||||
}
|
||||
void u_unfilled_init( void )
|
||||
{
|
||||
static int firsttime = 1;
|
||||
if (!firsttime) return;
|
||||
firsttime = 0;
|
||||
generate_line[OUT_USHORT][PIPE_PRIM_TRIANGLES] = generate_tris_ushort;
|
||||
generate_line[OUT_USHORT][PIPE_PRIM_TRIANGLE_FAN] = generate_trifan_ushort;
|
||||
generate_line[OUT_USHORT][PIPE_PRIM_TRIANGLE_STRIP] = generate_tristrip_ushort;
|
||||
generate_line[OUT_USHORT][PIPE_PRIM_QUADS] = generate_quads_ushort;
|
||||
generate_line[OUT_USHORT][PIPE_PRIM_QUAD_STRIP] = generate_quadstrip_ushort;
|
||||
generate_line[OUT_USHORT][PIPE_PRIM_POLYGON] = generate_polygon_ushort;
|
||||
generate_line[OUT_UINT][PIPE_PRIM_TRIANGLES] = generate_tris_uint;
|
||||
generate_line[OUT_UINT][PIPE_PRIM_TRIANGLE_FAN] = generate_trifan_uint;
|
||||
generate_line[OUT_UINT][PIPE_PRIM_TRIANGLE_STRIP] = generate_tristrip_uint;
|
||||
generate_line[OUT_UINT][PIPE_PRIM_QUADS] = generate_quads_uint;
|
||||
generate_line[OUT_UINT][PIPE_PRIM_QUAD_STRIP] = generate_quadstrip_uint;
|
||||
generate_line[OUT_UINT][PIPE_PRIM_POLYGON] = generate_polygon_uint;
|
||||
translate_line[IN_UBYTE][OUT_USHORT][PIPE_PRIM_TRIANGLES] = translate_tris_ubyte2ushort;
|
||||
translate_line[IN_UBYTE][OUT_USHORT][PIPE_PRIM_TRIANGLE_FAN] = translate_trifan_ubyte2ushort;
|
||||
translate_line[IN_UBYTE][OUT_USHORT][PIPE_PRIM_TRIANGLE_STRIP] = translate_tristrip_ubyte2ushort;
|
||||
translate_line[IN_UBYTE][OUT_USHORT][PIPE_PRIM_QUADS] = translate_quads_ubyte2ushort;
|
||||
translate_line[IN_UBYTE][OUT_USHORT][PIPE_PRIM_QUAD_STRIP] = translate_quadstrip_ubyte2ushort;
|
||||
translate_line[IN_UBYTE][OUT_USHORT][PIPE_PRIM_POLYGON] = translate_polygon_ubyte2ushort;
|
||||
translate_line[IN_UBYTE][OUT_UINT][PIPE_PRIM_TRIANGLES] = translate_tris_ubyte2uint;
|
||||
translate_line[IN_UBYTE][OUT_UINT][PIPE_PRIM_TRIANGLE_FAN] = translate_trifan_ubyte2uint;
|
||||
translate_line[IN_UBYTE][OUT_UINT][PIPE_PRIM_TRIANGLE_STRIP] = translate_tristrip_ubyte2uint;
|
||||
translate_line[IN_UBYTE][OUT_UINT][PIPE_PRIM_QUADS] = translate_quads_ubyte2uint;
|
||||
translate_line[IN_UBYTE][OUT_UINT][PIPE_PRIM_QUAD_STRIP] = translate_quadstrip_ubyte2uint;
|
||||
translate_line[IN_UBYTE][OUT_UINT][PIPE_PRIM_POLYGON] = translate_polygon_ubyte2uint;
|
||||
translate_line[IN_USHORT][OUT_USHORT][PIPE_PRIM_TRIANGLES] = translate_tris_ushort2ushort;
|
||||
translate_line[IN_USHORT][OUT_USHORT][PIPE_PRIM_TRIANGLE_FAN] = translate_trifan_ushort2ushort;
|
||||
translate_line[IN_USHORT][OUT_USHORT][PIPE_PRIM_TRIANGLE_STRIP] = translate_tristrip_ushort2ushort;
|
||||
translate_line[IN_USHORT][OUT_USHORT][PIPE_PRIM_QUADS] = translate_quads_ushort2ushort;
|
||||
translate_line[IN_USHORT][OUT_USHORT][PIPE_PRIM_QUAD_STRIP] = translate_quadstrip_ushort2ushort;
|
||||
translate_line[IN_USHORT][OUT_USHORT][PIPE_PRIM_POLYGON] = translate_polygon_ushort2ushort;
|
||||
translate_line[IN_USHORT][OUT_UINT][PIPE_PRIM_TRIANGLES] = translate_tris_ushort2uint;
|
||||
translate_line[IN_USHORT][OUT_UINT][PIPE_PRIM_TRIANGLE_FAN] = translate_trifan_ushort2uint;
|
||||
translate_line[IN_USHORT][OUT_UINT][PIPE_PRIM_TRIANGLE_STRIP] = translate_tristrip_ushort2uint;
|
||||
translate_line[IN_USHORT][OUT_UINT][PIPE_PRIM_QUADS] = translate_quads_ushort2uint;
|
||||
translate_line[IN_USHORT][OUT_UINT][PIPE_PRIM_QUAD_STRIP] = translate_quadstrip_ushort2uint;
|
||||
translate_line[IN_USHORT][OUT_UINT][PIPE_PRIM_POLYGON] = translate_polygon_ushort2uint;
|
||||
translate_line[IN_UINT][OUT_USHORT][PIPE_PRIM_TRIANGLES] = translate_tris_uint2ushort;
|
||||
translate_line[IN_UINT][OUT_USHORT][PIPE_PRIM_TRIANGLE_FAN] = translate_trifan_uint2ushort;
|
||||
translate_line[IN_UINT][OUT_USHORT][PIPE_PRIM_TRIANGLE_STRIP] = translate_tristrip_uint2ushort;
|
||||
translate_line[IN_UINT][OUT_USHORT][PIPE_PRIM_QUADS] = translate_quads_uint2ushort;
|
||||
translate_line[IN_UINT][OUT_USHORT][PIPE_PRIM_QUAD_STRIP] = translate_quadstrip_uint2ushort;
|
||||
translate_line[IN_UINT][OUT_USHORT][PIPE_PRIM_POLYGON] = translate_polygon_uint2ushort;
|
||||
translate_line[IN_UINT][OUT_UINT][PIPE_PRIM_TRIANGLES] = translate_tris_uint2uint;
|
||||
translate_line[IN_UINT][OUT_UINT][PIPE_PRIM_TRIANGLE_FAN] = translate_trifan_uint2uint;
|
||||
translate_line[IN_UINT][OUT_UINT][PIPE_PRIM_TRIANGLE_STRIP] = translate_tristrip_uint2uint;
|
||||
translate_line[IN_UINT][OUT_UINT][PIPE_PRIM_QUADS] = translate_quads_uint2uint;
|
||||
translate_line[IN_UINT][OUT_UINT][PIPE_PRIM_QUAD_STRIP] = translate_quadstrip_uint2uint;
|
||||
translate_line[IN_UINT][OUT_UINT][PIPE_PRIM_POLYGON] = translate_polygon_uint2uint;
|
||||
}
|
||||
#include "indices/u_unfilled_indices.c"
|
@@ -43,7 +43,7 @@
|
||||
#include "util/u_memory.h"
|
||||
|
||||
GLboolean
|
||||
dri_create_context(const __GLcontextModes * visual,
|
||||
dri_create_context(gl_api api, const __GLcontextModes * visual,
|
||||
__DRIcontext * cPriv, void *sharedContextPrivate)
|
||||
{
|
||||
__DRIscreen *sPriv = cPriv->driScreenPriv;
|
||||
|
@@ -35,6 +35,8 @@
|
||||
#include "pipe/p_compiler.h"
|
||||
#include "drm.h"
|
||||
#include "dri_util.h"
|
||||
#include "dri_wrapper.h"
|
||||
#include "main/mtypes.h"
|
||||
|
||||
struct pipe_context;
|
||||
struct pipe_fence;
|
||||
@@ -109,7 +111,8 @@ dri_make_current(__DRIcontext * driContextPriv,
|
||||
__DRIdrawable * driReadPriv);
|
||||
|
||||
boolean
|
||||
dri_create_context(const __GLcontextModes * visual,
|
||||
dri_create_context(gl_api api,
|
||||
const __GLcontextModes * visual,
|
||||
__DRIcontext * driContextPriv,
|
||||
void *sharedContextPrivate);
|
||||
|
||||
|
70
src/gles/Makefile
Normal file
70
src/gles/Makefile
Normal file
@@ -0,0 +1,70 @@
|
||||
TOP = ../..
|
||||
MESA = $(TOP)/src/mesa
|
||||
include $(TOP)/configs/current
|
||||
include $(MESA)/sources.mak
|
||||
|
||||
GLESv1_CM_ASM := $(addprefix $(MESA)/es/glapi/glapi-es1/,$(GLAPI_ASM_SOURCES))
|
||||
GLESv2_ASM := $(addprefix $(MESA)/es/glapi/glapi-es2/,$(GLAPI_ASM_SOURCES))
|
||||
API_SOURCES := $(addprefix $(MESA)/,$(GLAPI_SOURCES))
|
||||
|
||||
$(TOP)/$(LIB_DIR)/$(GLESv1_CM_LIB_NAME) : PREFIX = es1
|
||||
$(TOP)/$(LIB_DIR)/$(GLESv1_CM_LIB_NAME) : NAME = GLESv1_CM
|
||||
|
||||
$(TOP)/$(LIB_DIR)/$(GLESv2_LIB_NAME) : PREFIX = es2
|
||||
$(TOP)/$(LIB_DIR)/$(GLESv2_LIB_NAME) : NAME = GLESv2
|
||||
|
||||
INCLUDES = -I$(TOP)/include -I$(MESA)/es/glapi/glapi-$(PREFIX) -I$(MESA)
|
||||
|
||||
OBJECTS = \
|
||||
$(notdir $(GLAPI_ASM_SOURCES:%.S=%.o)) \
|
||||
$(notdir $(GLAPI_SOURCES:%.c=%.o))
|
||||
|
||||
GLESv1_CM_OBJECTS = $(addprefix es1-,$(OBJECTS))
|
||||
GLESv2_OBJECTS = $(addprefix es2-,$(OBJECTS))
|
||||
|
||||
es1-%.o: $(dir $(GLESv1_CM_ASM))%.S
|
||||
$(CC) -c $(CFLAGS) $(INCLUDES) -o $@ $<
|
||||
es1-%.o: $(MESA)/glapi/%.c
|
||||
$(CC) -c $(CFLAGS) $(INCLUDES) -o $@ $<
|
||||
|
||||
es2-%.o: $(dir $(GLESv2_ASM))%.S
|
||||
$(CC) -c $(CFLAGS) $(INCLUDES) -o $@ $<
|
||||
es2-%.o: $(MESA)/glapi/%.c
|
||||
$(CC) -c $(CFLAGS) $(INCLUDES) -o $@ $<
|
||||
|
||||
default: depend \
|
||||
$(TOP)/$(LIB_DIR)/$(GLESv1_CM_LIB_NAME) \
|
||||
$(TOP)/$(LIB_DIR)/$(GLESv2_LIB_NAME)
|
||||
|
||||
$(TOP)/$(LIB_DIR)/$(GLESv1_CM_LIB_NAME) : $(GLESv1_CM_OBJECTS)
|
||||
$(TOP)/$(LIB_DIR)/$(GLESv2_LIB_NAME) : $(GLESv2_OBJECTS)
|
||||
|
||||
$(TOP)/$(LIB_DIR)/$(GLESv1_CM_LIB_NAME) \
|
||||
$(TOP)/$(LIB_DIR)/$(GLESv2_LIB_NAME) : Makefile
|
||||
$(MKLIB) -o $($(NAME)_LIB) -linker '$(CC)' -ldflags '$(LDFLAGS)' \
|
||||
-major 1 -minor 2 $(MKLIB_OPTIONS) \
|
||||
-install $(TOP)/$(LIB_DIR) -id \
|
||||
$(INSTALL_LIB_DIR)/lib$($(NAME)_LIB).1.dylib \
|
||||
$($(NAME)_LIB_DEPS) $($(NAME)_OBJECTS)
|
||||
|
||||
depend: Makefile
|
||||
rm -f depend
|
||||
touch depend
|
||||
$(MKDEP) $(MKDEP_OPTIONS) $(INCLUDES) $(API_SOURCES) \
|
||||
$(ES1_API_ASM) $(ES2_API_ASM)
|
||||
|
||||
# Emacs tags
|
||||
tags:
|
||||
etags `find . -name \*.[ch]` `find $(TOP)/include`
|
||||
|
||||
install: $(TOP)/$(LIB_DIR)/$(GLESv1_CM_LIB_NAME) $(TOP)/$(LIB_DIR)/$(GLESv2_LIB_NAME)
|
||||
$(MAKE) -C $(TOP)/src/mesa install-es2 install-es1
|
||||
|
||||
# Remove .o and backup files
|
||||
clean:
|
||||
-rm -f $(TOP)/$(LIB_DIR)/$(GLESv1_CM_LIB_GLOB)
|
||||
-rm -f $(TOP)/$(LIB_DIR)/$(GLESv2_LIB_GLOB)
|
||||
-rm -f *.o *~
|
||||
-rm -f depend depend.bak
|
||||
|
||||
-include depend
|
@@ -887,9 +887,6 @@ glXCopyContext(Display * dpy, GLXContext source,
|
||||
static Bool
|
||||
__glXIsDirect(Display * dpy, GLXContextID contextID)
|
||||
{
|
||||
#ifdef GLX_USE_APPLEGL /* TODO: apple indirect */
|
||||
return GC_IS_DIRECT(gc);
|
||||
#else
|
||||
#if !defined(USE_XCB)
|
||||
xGLXIsDirectReq *req;
|
||||
xGLXIsDirectReply reply;
|
||||
@@ -925,7 +922,6 @@ __glXIsDirect(Display * dpy, GLXContextID contextID)
|
||||
|
||||
return reply.isDirect;
|
||||
#endif /* USE_XCB */
|
||||
#endif /* GLX_USE_APPLEGL */
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -943,7 +939,11 @@ glXIsDirect(Display * dpy, GLXContext gc)
|
||||
else if (GC_IS_DIRECT(gc)) {
|
||||
return GL_TRUE;
|
||||
}
|
||||
#ifdef GLX_USE_APPLEGL /* TODO: indirect on darwin */
|
||||
return GL_FALSE;
|
||||
#else
|
||||
return __glXIsDirect(dpy, gc->xid);
|
||||
#endif
|
||||
}
|
||||
|
||||
PUBLIC GLXPixmap
|
||||
@@ -1766,6 +1766,15 @@ static int __glXQueryContextInfo(Display * dpy, GLXContext ctx)
|
||||
unsigned i;
|
||||
|
||||
_XRead(dpy, (char *) propList, nPropListBytes);
|
||||
|
||||
/* Look up screen first so we can look up visuals/fbconfigs later */
|
||||
pProp = propList;
|
||||
for (i = 0; i < numValues; i++, pProp += 2)
|
||||
if (pProp[0] == GLX_SCREEN) {
|
||||
ctx->screen = pProp[1];
|
||||
ctx->psc = GetGLXScreenConfigs(dpy, ctx->screen);
|
||||
}
|
||||
|
||||
pProp = propList;
|
||||
for (i = 0; i < numValues; i++) {
|
||||
switch (*pProp++) {
|
||||
@@ -1776,9 +1785,6 @@ static int __glXQueryContextInfo(Display * dpy, GLXContext ctx)
|
||||
ctx->mode =
|
||||
_gl_context_modes_find_visual(ctx->psc->visuals, *pProp++);
|
||||
break;
|
||||
case GLX_SCREEN:
|
||||
ctx->screen = *pProp++;
|
||||
break;
|
||||
case GLX_FBCONFIG_ID:
|
||||
ctx->mode =
|
||||
_gl_context_modes_find_fbconfig(ctx->psc->configs,
|
||||
@@ -1787,6 +1793,7 @@ static int __glXQueryContextInfo(Display * dpy, GLXContext ctx)
|
||||
case GLX_RENDER_TYPE:
|
||||
ctx->renderType = *pProp++;
|
||||
break;
|
||||
case GLX_SCREEN:
|
||||
default:
|
||||
pProp++;
|
||||
continue;
|
||||
|
@@ -16,14 +16,32 @@ include sources.mak
|
||||
.S.o:
|
||||
$(CC) -c $(INCLUDE_DIRS) $(CFLAGS) $< -o $@
|
||||
|
||||
CFLAGS += $(API_DEFINES)
|
||||
|
||||
|
||||
# Default: build dependencies, then asm_subdirs, GLSL built-in lib,
|
||||
# then convenience libs (.a) and finally the device drivers:
|
||||
default: depend asm_subdirs glsl_builtin libmesa.a libmesagallium.a \
|
||||
default: depend es_glapi asm_subdirs glsl_builtin libmesa.a libmesagallium.a \
|
||||
libglapi.a driver_subdirs
|
||||
|
||||
es_glapi:
|
||||
@for api in $(APIS) ; do \
|
||||
case "$$api" in \
|
||||
es1|es2) $(MAKE) -C es/glapi $$api;; \
|
||||
esac; \
|
||||
done
|
||||
|
||||
main/api_exec_es1.c: main/APIspec.xml main/es_generator.py main/APIspecutil.py main/APIspec.py
|
||||
$(PYTHON2) $(PYTHON_FLAGS) main/es_generator.py -S main/APIspec.xml -V GLES1.1 > $@
|
||||
|
||||
main/api_exec_es2.c: main/APIspec.xml main/es_generator.py main/APIspecutil.py main/APIspec.py
|
||||
$(PYTHON2) $(PYTHON_FLAGS) main/es_generator.py -S main/APIspec.xml -V GLES2.0 > $@
|
||||
|
||||
main/get_es1.c: main/get_gen_es.py
|
||||
$(PYTHON2) $(PYTHON_FLAGS) $< 1 > $@
|
||||
|
||||
main/get_es2.c: main/get_gen_es.py
|
||||
$(PYTHON2) $(PYTHON_FLAGS) $< 2 > $@
|
||||
|
||||
######################################################################
|
||||
# Helper libraries used by many drivers:
|
||||
@@ -94,14 +112,23 @@ install: default
|
||||
dri) $(MAKE) install-libgl install-dri || exit 1 ;; \
|
||||
*) $(MAKE) install-libgl || exit 1 ;; \
|
||||
esac ; \
|
||||
done; \
|
||||
for api in $(APIS) ; do \
|
||||
case "$$api" in \
|
||||
es1) $(MAKE) install-es1 || exit 1;; \
|
||||
es2) $(MAKE) install-es2 || exit 1;; \
|
||||
esac; \
|
||||
done
|
||||
|
||||
|
||||
gl_pcedit = sed \
|
||||
pcedit = \
|
||||
-e 's,@INSTALL_DIR@,$(INSTALL_DIR),' \
|
||||
-e 's,@INSTALL_LIB_DIR@,$(INSTALL_LIB_DIR),' \
|
||||
-e 's,@INSTALL_INC_DIR@,$(INSTALL_INC_DIR),' \
|
||||
-e 's,@VERSION@,$(MESA_MAJOR).$(MESA_MINOR).$(MESA_TINY),' \
|
||||
|
||||
|
||||
gl_pcedit = sed \
|
||||
$(pcedit) \
|
||||
-e 's,@GL_PC_REQ_PRIV@,$(GL_PC_REQ_PRIV),' \
|
||||
-e 's,@GL_PC_LIB_PRIV@,$(GL_PC_LIB_PRIV),' \
|
||||
-e 's,@GL_PC_CFLAGS@,$(GL_PC_CFLAGS),' \
|
||||
@@ -110,11 +137,24 @@ gl_pcedit = sed \
|
||||
gl.pc: gl.pc.in
|
||||
$(gl_pcedit) $< > $@
|
||||
|
||||
glesv2_pcedit = sed \
|
||||
$(pcedit) \
|
||||
-e 's,@GLESv2_PC_LIB_PRIV@,$(GLESv2_PC_LIB_PRIV),' \
|
||||
-e 's,@GLESv2_LIB@,$(GLESv2_LIB),'
|
||||
|
||||
glesv2.pc: glesv2.pc.in
|
||||
$(glesv2_pcedit) $< > $@
|
||||
|
||||
glesv1_cm_pcedit = sed \
|
||||
$(pcedit) \
|
||||
-e 's,@GLESv1_CM_PC_LIB_PRIV@,$(GLESv1_CM_PC_LIB_PRIV),' \
|
||||
-e 's,@GLESv1_CM_LIB@,$(GLESv1_CM_LIB),'
|
||||
|
||||
glesv1_cm.pc: glesv1_cm.pc.in
|
||||
$(glesv1_cm_pcedit) $< > $@
|
||||
|
||||
osmesa_pcedit = sed \
|
||||
-e 's,@INSTALL_DIR@,$(INSTALL_DIR),' \
|
||||
-e 's,@INSTALL_LIB_DIR@,$(INSTALL_LIB_DIR),' \
|
||||
-e 's,@INSTALL_INC_DIR@,$(INSTALL_INC_DIR),' \
|
||||
-e 's,@VERSION@,$(MESA_MAJOR).$(MESA_MINOR).$(MESA_TINY),' \
|
||||
$(pcedit) \
|
||||
-e 's,@OSMESA_LIB@,$(OSMESA_LIB),' \
|
||||
-e 's,@OSMESA_PC_REQ@,$(OSMESA_PC_REQ),' \
|
||||
-e 's,@OSMESA_PC_LIB_PRIV@,$(OSMESA_PC_LIB_PRIV),'
|
||||
@@ -134,6 +174,30 @@ install-libgl: default gl.pc install-headers
|
||||
$(DESTDIR)$(INSTALL_LIB_DIR)
|
||||
$(INSTALL) -m 644 gl.pc $(DESTDIR)$(INSTALL_LIB_DIR)/pkgconfig
|
||||
|
||||
install-headers-es1:
|
||||
$(INSTALL) -d $(DESTDIR)$(INSTALL_INC_DIR)/GLES
|
||||
$(INSTALL) -m 644 $(TOP)/include/GLES/*.h \
|
||||
$(DESTDIR)$(INSTALL_INC_DIR)/GLES
|
||||
|
||||
install-es1: default glesv1_cm.pc install-headers-es1
|
||||
$(INSTALL) -d $(DESTDIR)$(INSTALL_LIB_DIR)
|
||||
$(INSTALL) -d $(DESTDIR)$(INSTALL_LIB_DIR)/pkgconfig
|
||||
$(MINSTALL) $(TOP)/$(LIB_DIR)/$(GLESv1_CM_LIB_GLOB) \
|
||||
$(DESTDIR)$(INSTALL_LIB_DIR)
|
||||
$(INSTALL) -m 644 glesv1_cm.pc $(DESTDIR)$(INSTALL_LIB_DIR)/pkgconfig
|
||||
|
||||
install-headers-es2:
|
||||
$(INSTALL) -d $(DESTDIR)$(INSTALL_INC_DIR)/GLES2
|
||||
$(INSTALL) -m 644 $(TOP)/include/GLES2/*.h \
|
||||
$(DESTDIR)$(INSTALL_INC_DIR)/GLES2
|
||||
|
||||
install-es2: default glesv2.pc install-headers-es2
|
||||
$(INSTALL) -d $(DESTDIR)$(INSTALL_LIB_DIR)
|
||||
$(INSTALL) -d $(DESTDIR)$(INSTALL_LIB_DIR)/pkgconfig
|
||||
$(MINSTALL) $(TOP)/$(LIB_DIR)/$(GLESv2_LIB_GLOB) \
|
||||
$(DESTDIR)$(INSTALL_LIB_DIR)
|
||||
$(INSTALL) -m 644 glesv2.pc $(DESTDIR)$(INSTALL_LIB_DIR)/pkgconfig
|
||||
|
||||
install-osmesa: default osmesa.pc
|
||||
$(INSTALL) -d $(DESTDIR)$(INSTALL_LIB_DIR)
|
||||
$(INSTALL) -d $(DESTDIR)$(INSTALL_LIB_DIR)/pkgconfig
|
||||
|
@@ -31,6 +31,7 @@ SHARED_INCLUDES = \
|
||||
-I$(TOP)/src/egl/drivers/dri \
|
||||
$(LIBDRM_CFLAGS)
|
||||
|
||||
CFLAGS += $(API_DEFINES)
|
||||
|
||||
##### RULES #####
|
||||
|
||||
|
@@ -603,7 +603,8 @@ driCreateNewContext(__DRIscreen *psp, const __DRIconfig *config,
|
||||
|
||||
pcp->hHWContext = hwContext;
|
||||
|
||||
if ( !(*psp->DriverAPI.CreateContext)(&config->modes, pcp, shareCtx) ) {
|
||||
if ( !(*psp->DriverAPI.CreateContext)(API_OPENGL,
|
||||
&config->modes, pcp, shareCtx) ) {
|
||||
free(pcp);
|
||||
return NULL;
|
||||
}
|
||||
@@ -611,15 +612,62 @@ driCreateNewContext(__DRIscreen *psp, const __DRIconfig *config,
|
||||
return pcp;
|
||||
}
|
||||
|
||||
static unsigned int
|
||||
dri2GetAPIMask(__DRIscreen *screen)
|
||||
{
|
||||
return screen->api_mask;
|
||||
}
|
||||
|
||||
static __DRIcontext *
|
||||
dri2CreateNewContextForAPI(__DRIscreen *screen, int api,
|
||||
const __DRIconfig *config,
|
||||
__DRIcontext *shared, void *data)
|
||||
{
|
||||
__DRIcontext *context;
|
||||
void *shareCtx = (shared != NULL) ? shared->driverPrivate : NULL;
|
||||
gl_api mesa_api;
|
||||
|
||||
if (!(screen->api_mask & (1 << api)))
|
||||
return NULL;
|
||||
|
||||
switch (api) {
|
||||
case __DRI_API_OPENGL:
|
||||
mesa_api = API_OPENGL;
|
||||
break;
|
||||
case __DRI_API_GLES:
|
||||
mesa_api = API_OPENGLES;
|
||||
break;
|
||||
case __DRI_API_GLES2:
|
||||
mesa_api = API_OPENGLES2;
|
||||
break;
|
||||
}
|
||||
|
||||
context = malloc(sizeof *context);
|
||||
if (!context)
|
||||
return NULL;
|
||||
|
||||
context->driScreenPriv = screen;
|
||||
context->driDrawablePriv = NULL;
|
||||
context->loaderPrivate = data;
|
||||
|
||||
if (!(*screen->DriverAPI.CreateContext)(api, &config->modes,
|
||||
context, shareCtx) ) {
|
||||
free(context);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return context;
|
||||
}
|
||||
|
||||
|
||||
static __DRIcontext *
|
||||
dri2CreateNewContext(__DRIscreen *screen, const __DRIconfig *config,
|
||||
__DRIcontext *shared, void *data)
|
||||
{
|
||||
return driCreateNewContext(screen, config, 0, shared, 0, data);
|
||||
return dri2CreateNewContextForAPI(screen, __DRI_API_OPENGL,
|
||||
config, shared, data);
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
driCopyContext(__DRIcontext *dest, __DRIcontext *src, unsigned long mask)
|
||||
{
|
||||
@@ -764,6 +812,7 @@ driCreateNewScreen(int scrn,
|
||||
psp->dummyContextPriv.driScreenPriv = NULL;
|
||||
|
||||
psp->DriverAPI = driDriverAPI;
|
||||
psp->api_mask = (1 << __DRI_API_OPENGL);
|
||||
|
||||
*driver_modes = driDriverAPI.InitScreen(psp);
|
||||
if (*driver_modes == NULL) {
|
||||
@@ -809,6 +858,7 @@ dri2CreateNewScreen(int scrn, int fd,
|
||||
psp->dri2.enabled = GL_TRUE;
|
||||
|
||||
psp->DriverAPI = driDriverAPI;
|
||||
psp->api_mask = (1 << __DRI_API_OPENGL);
|
||||
*driver_configs = driDriverAPI.InitScreen2(psp);
|
||||
if (*driver_configs == NULL) {
|
||||
free(psp);
|
||||
@@ -857,6 +907,8 @@ const __DRIdri2Extension driDRI2Extension = {
|
||||
dri2CreateNewScreen,
|
||||
dri2CreateNewDrawable,
|
||||
dri2CreateNewContext,
|
||||
dri2GetAPIMask,
|
||||
dri2CreateNewContextForAPI
|
||||
};
|
||||
|
||||
static int
|
||||
|
@@ -52,6 +52,7 @@
|
||||
#include <drm_sarea.h>
|
||||
#include <xf86drm.h>
|
||||
#include "main/glheader.h"
|
||||
#include "main/mtypes.h"
|
||||
#include "GL/internal/glcore.h"
|
||||
#include "GL/internal/dri_interface.h"
|
||||
|
||||
@@ -146,8 +147,9 @@ struct __DriverAPIRec {
|
||||
/**
|
||||
* Context creation callback
|
||||
*/
|
||||
GLboolean (*CreateContext)(const __GLcontextModes *glVis,
|
||||
__DRIcontext *driContextPriv,
|
||||
GLboolean (*CreateContext)(gl_api api,
|
||||
const __GLcontextModes *glVis,
|
||||
__DRIcontext *driContextPriv,
|
||||
void *sharedContextPrivate);
|
||||
|
||||
/**
|
||||
@@ -549,6 +551,8 @@ struct __DRIscreenRec {
|
||||
|
||||
/* The lock actually in use, old sarea or DRI2 */
|
||||
drmLock *lock;
|
||||
|
||||
unsigned int api_mask;
|
||||
};
|
||||
|
||||
extern void
|
||||
|
@@ -166,7 +166,8 @@ static const struct dri_debug_control debug_control[] =
|
||||
};
|
||||
|
||||
GLboolean
|
||||
i810CreateContext( const __GLcontextModes *mesaVis,
|
||||
i810CreateContext( gl_api api,
|
||||
const __GLcontextModes *mesaVis,
|
||||
__DRIcontext *driContextPriv,
|
||||
void *sharedContextPrivate )
|
||||
{
|
||||
|
@@ -78,7 +78,8 @@ typedef struct {
|
||||
|
||||
|
||||
extern GLboolean
|
||||
i810CreateContext( const __GLcontextModes *mesaVis,
|
||||
i810CreateContext( gl_api api,
|
||||
const __GLcontextModes *mesaVis,
|
||||
__DRIcontext *driContextPriv,
|
||||
void *sharedContextPrivate );
|
||||
|
||||
|
@@ -18,6 +18,7 @@ DRIVER_SOURCES = \
|
||||
intel_batchbuffer.c \
|
||||
intel_clear.c \
|
||||
intel_extensions.c \
|
||||
intel_extensions_es2.c \
|
||||
intel_mipmap_tree.c \
|
||||
intel_tex_layout.c \
|
||||
intel_tex_image.c \
|
||||
|
@@ -63,7 +63,7 @@ i830CreateContext(const __GLcontextModes * mesaVis,
|
||||
i830InitVtbl(i830);
|
||||
i830InitDriverFunctions(&functions);
|
||||
|
||||
if (!intelInitContext(intel, mesaVis, driContextPriv,
|
||||
if (!intelInitContext(intel, __DRI_API_OPENGL, mesaVis, driContextPriv,
|
||||
sharedContextPrivate, &functions)) {
|
||||
FREE(i830);
|
||||
return GL_FALSE;
|
||||
|
@@ -94,7 +94,8 @@ i915InitDriverFunctions(struct dd_function_table *functions)
|
||||
extern const struct tnl_pipeline_stage *intel_pipeline[];
|
||||
|
||||
GLboolean
|
||||
i915CreateContext(const __GLcontextModes * mesaVis,
|
||||
i915CreateContext(int api,
|
||||
const __GLcontextModes * mesaVis,
|
||||
__DRIcontext * driContextPriv,
|
||||
void *sharedContextPrivate)
|
||||
{
|
||||
@@ -114,7 +115,7 @@ i915CreateContext(const __GLcontextModes * mesaVis,
|
||||
|
||||
i915InitDriverFunctions(&functions);
|
||||
|
||||
if (!intelInitContext(intel, mesaVis, driContextPriv,
|
||||
if (!intelInitContext(intel, api, mesaVis, driContextPriv,
|
||||
sharedContextPrivate, &functions)) {
|
||||
FREE(i915);
|
||||
return GL_FALSE;
|
||||
|
@@ -318,7 +318,8 @@ do { \
|
||||
/*======================================================================
|
||||
* i915_context.c
|
||||
*/
|
||||
extern GLboolean i915CreateContext(const __GLcontextModes * mesaVis,
|
||||
extern GLboolean i915CreateContext(int api,
|
||||
const __GLcontextModes * mesaVis,
|
||||
__DRIcontext * driContextPriv,
|
||||
void *sharedContextPrivate);
|
||||
|
||||
|
@@ -484,7 +484,7 @@ i945_miptree_layout(struct intel_context *intel, struct intel_mipmap_tree * mt,
|
||||
case GL_TEXTURE_1D:
|
||||
case GL_TEXTURE_2D:
|
||||
case GL_TEXTURE_RECTANGLE_ARB:
|
||||
i945_miptree_layout_2d(intel, mt, tiling);
|
||||
i945_miptree_layout_2d(intel, mt, tiling, 1);
|
||||
break;
|
||||
default:
|
||||
_mesa_problem(NULL, "Unexpected tex target in i945_miptree_layout()");
|
||||
|
1
src/mesa/drivers/dri/i915/intel_extensions_es2.c
Symbolic link
1
src/mesa/drivers/dri/i915/intel_extensions_es2.c
Symbolic link
@@ -0,0 +1 @@
|
||||
../intel/intel_extensions_es2.c
|
@@ -13,6 +13,7 @@ DRIVER_SOURCES = \
|
||||
intel_context.c \
|
||||
intel_decode.c \
|
||||
intel_extensions.c \
|
||||
intel_extensions_es2.c \
|
||||
intel_fbo.c \
|
||||
intel_mipmap_tree.c \
|
||||
intel_regions.c \
|
||||
|
@@ -72,7 +72,7 @@ static void compile_clip_prog( struct brw_context *brw,
|
||||
*/
|
||||
c.header_position_offset = ATTR_SIZE;
|
||||
|
||||
if (intel->is_ironlake)
|
||||
if (intel->gen == 5)
|
||||
delta = 3 * REG_SIZE;
|
||||
else
|
||||
delta = REG_SIZE;
|
||||
@@ -85,7 +85,7 @@ static void compile_clip_prog( struct brw_context *brw,
|
||||
|
||||
c.nr_attrs = brw_count_bits(c.key.attrs);
|
||||
|
||||
if (intel->is_ironlake)
|
||||
if (intel->gen == 5)
|
||||
c.nr_regs = (c.nr_attrs + 1) / 2 + 3; /* are vertices packed, or reg-aligned? */
|
||||
else
|
||||
c.nr_regs = (c.nr_attrs + 1) / 2 + 1; /* are vertices packed, or reg-aligned? */
|
||||
@@ -162,7 +162,7 @@ static void upload_clip_prog(struct brw_context *brw)
|
||||
/* _NEW_TRANSFORM */
|
||||
key.nr_userclip = brw_count_bits(ctx->Transform.ClipPlanesEnabled);
|
||||
|
||||
if (intel->is_ironlake)
|
||||
if (intel->gen == 5)
|
||||
key.clip_mode = BRW_CLIPMODE_KERNEL_CLIP;
|
||||
else
|
||||
key.clip_mode = BRW_CLIPMODE_NORMAL;
|
||||
|
@@ -102,10 +102,10 @@ clip_unit_create_from_key(struct brw_context *brw,
|
||||
*/
|
||||
assert(key->nr_urb_entries % 2 == 0);
|
||||
|
||||
/* Although up to 16 concurrent Clip threads are allowed on IGDNG,
|
||||
/* Although up to 16 concurrent Clip threads are allowed on Ironlake,
|
||||
* only 2 threads can output VUEs at a time.
|
||||
*/
|
||||
if (intel->is_ironlake)
|
||||
if (intel->gen == 5)
|
||||
clip.thread4.max_threads = 16 - 1;
|
||||
else
|
||||
clip.thread4.max_threads = 2 - 1;
|
||||
|
@@ -78,7 +78,7 @@ void brw_clip_tri_alloc_regs( struct brw_clip_compile *c,
|
||||
for (j = 0; j < 3; j++) {
|
||||
GLuint delta = c->nr_attrs*16 + 32;
|
||||
|
||||
if (intel->is_ironlake)
|
||||
if (intel->gen == 5)
|
||||
delta = c->nr_attrs * 16 + 32 * 3;
|
||||
|
||||
brw_MOV(&c->func, byte_offset(c->reg.vertex[j], delta), brw_imm_f(0));
|
||||
|
@@ -151,7 +151,7 @@ void brw_clip_interp_vertex( struct brw_clip_compile *c,
|
||||
for (i = 0; i < c->nr_attrs; i++) {
|
||||
GLuint delta = i*16 + 32;
|
||||
|
||||
if (intel->is_ironlake)
|
||||
if (intel->gen == 5)
|
||||
delta = i * 16 + 32 * 3;
|
||||
|
||||
if (delta == c->offset[VERT_RESULT_EDGE]) {
|
||||
@@ -185,7 +185,7 @@ void brw_clip_interp_vertex( struct brw_clip_compile *c,
|
||||
if (i & 1) {
|
||||
GLuint delta = i*16 + 32;
|
||||
|
||||
if (intel->is_ironlake)
|
||||
if (intel->gen == 5)
|
||||
delta = i * 16 + 32 * 3;
|
||||
|
||||
brw_MOV(p, deref_4f(dest_ptr, delta), brw_imm_f(0));
|
||||
|
@@ -68,7 +68,8 @@ static void brwInitDriverFunctions( struct dd_function_table *functions )
|
||||
functions->Viewport = intel_viewport;
|
||||
}
|
||||
|
||||
GLboolean brwCreateContext( const __GLcontextModes *mesaVis,
|
||||
GLboolean brwCreateContext( int api,
|
||||
const __GLcontextModes *mesaVis,
|
||||
__DRIcontext *driContextPriv,
|
||||
void *sharedContextPrivate)
|
||||
{
|
||||
@@ -85,7 +86,7 @@ GLboolean brwCreateContext( const __GLcontextModes *mesaVis,
|
||||
brwInitVtbl( brw );
|
||||
brwInitDriverFunctions( &functions );
|
||||
|
||||
if (!intelInitContext( intel, mesaVis, driContextPriv,
|
||||
if (!intelInitContext( intel, api, mesaVis, driContextPriv,
|
||||
sharedContextPrivate, &functions )) {
|
||||
printf("%s: failed to init intel context\n", __FUNCTION__);
|
||||
FREE(brw);
|
||||
@@ -150,7 +151,7 @@ GLboolean brwCreateContext( const __GLcontextModes *mesaVis,
|
||||
MIN2(ctx->Const.FragmentProgram.MaxNativeParameters,
|
||||
ctx->Const.FragmentProgram.MaxEnvParams);
|
||||
|
||||
if (intel->is_ironlake || intel->is_g4x || intel->gen >= 6) {
|
||||
if (intel->is_g4x || intel->gen >= 5) {
|
||||
brw->CMD_VF_STATISTICS = CMD_VF_STATISTICS_GM45;
|
||||
brw->CMD_PIPELINE_SELECT = CMD_PIPELINE_SELECT_GM45;
|
||||
brw->has_surface_tile_offset = GL_TRUE;
|
||||
@@ -162,7 +163,7 @@ GLboolean brwCreateContext( const __GLcontextModes *mesaVis,
|
||||
}
|
||||
|
||||
/* WM maximum threads is number of EUs times number of threads per EU. */
|
||||
if (intel->is_ironlake) {
|
||||
if (intel->gen == 5) {
|
||||
brw->urb.size = 1024;
|
||||
brw->vs_max_threads = 72;
|
||||
brw->wm_max_threads = 12 * 6;
|
||||
|
@@ -686,7 +686,8 @@ void brwInitVtbl( struct brw_context *brw );
|
||||
/*======================================================================
|
||||
* brw_context.c
|
||||
*/
|
||||
GLboolean brwCreateContext( const __GLcontextModes *mesaVis,
|
||||
GLboolean brwCreateContext( int api,
|
||||
const __GLcontextModes *mesaVis,
|
||||
__DRIcontext *driContextPriv,
|
||||
void *sharedContextPrivate);
|
||||
|
||||
|
@@ -674,12 +674,12 @@
|
||||
#define BRW_SAMPLER_MESSAGE_SIMD8_LD 3
|
||||
#define BRW_SAMPLER_MESSAGE_SIMD16_LD 3
|
||||
|
||||
#define BRW_SAMPLER_MESSAGE_SAMPLE_IGDNG 0
|
||||
#define BRW_SAMPLER_MESSAGE_SAMPLE_BIAS_IGDNG 1
|
||||
#define BRW_SAMPLER_MESSAGE_SAMPLE_LOD_IGDNG 2
|
||||
#define BRW_SAMPLER_MESSAGE_SAMPLE_COMPARE_IGDNG 3
|
||||
#define BRW_SAMPLER_MESSAGE_SAMPLE_GEN5 0
|
||||
#define BRW_SAMPLER_MESSAGE_SAMPLE_BIAS_GEN5 1
|
||||
#define BRW_SAMPLER_MESSAGE_SAMPLE_LOD_GEN5 2
|
||||
#define BRW_SAMPLER_MESSAGE_SAMPLE_COMPARE_GEN5 3
|
||||
|
||||
/* for IGDNG only */
|
||||
/* for GEN5 only */
|
||||
#define BRW_SAMPLER_SIMD_MODE_SIMD4X2 0
|
||||
#define BRW_SAMPLER_SIMD_MODE_SIMD8 1
|
||||
#define BRW_SAMPLER_SIMD_MODE_SIMD16 2
|
||||
|
@@ -522,7 +522,7 @@ static void brw_emit_vertices(struct brw_context *brw)
|
||||
OUT_RELOC(input->bo,
|
||||
I915_GEM_DOMAIN_VERTEX, 0,
|
||||
input->offset);
|
||||
if (intel->is_ironlake || intel->gen >= 6) {
|
||||
if (intel->gen >= 5) {
|
||||
OUT_RELOC(input->bo,
|
||||
I915_GEM_DOMAIN_VERTEX, 0,
|
||||
input->bo->size - 1);
|
||||
@@ -565,7 +565,7 @@ static void brw_emit_vertices(struct brw_context *brw)
|
||||
(0 << BRW_VE0_SRC_OFFSET_SHIFT));
|
||||
}
|
||||
|
||||
if (intel->is_ironlake || intel->gen >= 6)
|
||||
if (intel->gen >= 5)
|
||||
OUT_BATCH((comp0 << BRW_VE1_COMPONENT_0_SHIFT) |
|
||||
(comp1 << BRW_VE1_COMPONENT_1_SHIFT) |
|
||||
(comp2 << BRW_VE1_COMPONENT_2_SHIFT) |
|
||||
|
@@ -253,19 +253,19 @@ static void brw_set_math_message( struct brw_context *brw,
|
||||
struct intel_context *intel = &brw->intel;
|
||||
brw_set_src1(insn, brw_imm_d(0));
|
||||
|
||||
if (intel->is_ironlake) {
|
||||
insn->bits3.math_igdng.function = function;
|
||||
insn->bits3.math_igdng.int_type = integer_type;
|
||||
insn->bits3.math_igdng.precision = low_precision;
|
||||
insn->bits3.math_igdng.saturate = saturate;
|
||||
insn->bits3.math_igdng.data_type = dataType;
|
||||
insn->bits3.math_igdng.snapshot = 0;
|
||||
insn->bits3.math_igdng.header_present = 0;
|
||||
insn->bits3.math_igdng.response_length = response_length;
|
||||
insn->bits3.math_igdng.msg_length = msg_length;
|
||||
insn->bits3.math_igdng.end_of_thread = 0;
|
||||
insn->bits2.send_igdng.sfid = BRW_MESSAGE_TARGET_MATH;
|
||||
insn->bits2.send_igdng.end_of_thread = 0;
|
||||
if (intel->gen == 5) {
|
||||
insn->bits3.math_gen5.function = function;
|
||||
insn->bits3.math_gen5.int_type = integer_type;
|
||||
insn->bits3.math_gen5.precision = low_precision;
|
||||
insn->bits3.math_gen5.saturate = saturate;
|
||||
insn->bits3.math_gen5.data_type = dataType;
|
||||
insn->bits3.math_gen5.snapshot = 0;
|
||||
insn->bits3.math_gen5.header_present = 0;
|
||||
insn->bits3.math_gen5.response_length = response_length;
|
||||
insn->bits3.math_gen5.msg_length = msg_length;
|
||||
insn->bits3.math_gen5.end_of_thread = 0;
|
||||
insn->bits2.send_gen5.sfid = BRW_MESSAGE_TARGET_MATH;
|
||||
insn->bits2.send_gen5.end_of_thread = 0;
|
||||
} else {
|
||||
insn->bits3.math.function = function;
|
||||
insn->bits3.math.int_type = integer_type;
|
||||
@@ -293,18 +293,18 @@ static void brw_set_ff_sync_message( struct brw_context *brw,
|
||||
{
|
||||
brw_set_src1(insn, brw_imm_d(0));
|
||||
|
||||
insn->bits3.urb_igdng.opcode = 1;
|
||||
insn->bits3.urb_igdng.offset = offset;
|
||||
insn->bits3.urb_igdng.swizzle_control = swizzle_control;
|
||||
insn->bits3.urb_igdng.allocate = allocate;
|
||||
insn->bits3.urb_igdng.used = used;
|
||||
insn->bits3.urb_igdng.complete = complete;
|
||||
insn->bits3.urb_igdng.header_present = 1;
|
||||
insn->bits3.urb_igdng.response_length = response_length;
|
||||
insn->bits3.urb_igdng.msg_length = msg_length;
|
||||
insn->bits3.urb_igdng.end_of_thread = end_of_thread;
|
||||
insn->bits2.send_igdng.sfid = BRW_MESSAGE_TARGET_URB;
|
||||
insn->bits2.send_igdng.end_of_thread = end_of_thread;
|
||||
insn->bits3.urb_gen5.opcode = 1;
|
||||
insn->bits3.urb_gen5.offset = offset;
|
||||
insn->bits3.urb_gen5.swizzle_control = swizzle_control;
|
||||
insn->bits3.urb_gen5.allocate = allocate;
|
||||
insn->bits3.urb_gen5.used = used;
|
||||
insn->bits3.urb_gen5.complete = complete;
|
||||
insn->bits3.urb_gen5.header_present = 1;
|
||||
insn->bits3.urb_gen5.response_length = response_length;
|
||||
insn->bits3.urb_gen5.msg_length = msg_length;
|
||||
insn->bits3.urb_gen5.end_of_thread = end_of_thread;
|
||||
insn->bits2.send_gen5.sfid = BRW_MESSAGE_TARGET_URB;
|
||||
insn->bits2.send_gen5.end_of_thread = end_of_thread;
|
||||
}
|
||||
|
||||
static void brw_set_urb_message( struct brw_context *brw,
|
||||
@@ -321,17 +321,17 @@ static void brw_set_urb_message( struct brw_context *brw,
|
||||
struct intel_context *intel = &brw->intel;
|
||||
brw_set_src1(insn, brw_imm_d(0));
|
||||
|
||||
if (intel->is_ironlake || intel->gen >= 6) {
|
||||
insn->bits3.urb_igdng.opcode = 0; /* ? */
|
||||
insn->bits3.urb_igdng.offset = offset;
|
||||
insn->bits3.urb_igdng.swizzle_control = swizzle_control;
|
||||
insn->bits3.urb_igdng.allocate = allocate;
|
||||
insn->bits3.urb_igdng.used = used; /* ? */
|
||||
insn->bits3.urb_igdng.complete = complete;
|
||||
insn->bits3.urb_igdng.header_present = 1;
|
||||
insn->bits3.urb_igdng.response_length = response_length;
|
||||
insn->bits3.urb_igdng.msg_length = msg_length;
|
||||
insn->bits3.urb_igdng.end_of_thread = end_of_thread;
|
||||
if (intel->gen >= 5) {
|
||||
insn->bits3.urb_gen5.opcode = 0; /* ? */
|
||||
insn->bits3.urb_gen5.offset = offset;
|
||||
insn->bits3.urb_gen5.swizzle_control = swizzle_control;
|
||||
insn->bits3.urb_gen5.allocate = allocate;
|
||||
insn->bits3.urb_gen5.used = used; /* ? */
|
||||
insn->bits3.urb_gen5.complete = complete;
|
||||
insn->bits3.urb_gen5.header_present = 1;
|
||||
insn->bits3.urb_gen5.response_length = response_length;
|
||||
insn->bits3.urb_gen5.msg_length = msg_length;
|
||||
insn->bits3.urb_gen5.end_of_thread = end_of_thread;
|
||||
if (intel->gen >= 6) {
|
||||
/* For SNB, the SFID bits moved to the condmod bits, and
|
||||
* EOT stayed in bits3 above. Does the EOT bit setting
|
||||
@@ -339,8 +339,8 @@ static void brw_set_urb_message( struct brw_context *brw,
|
||||
*/
|
||||
insn->header.destreg__conditionalmod = BRW_MESSAGE_TARGET_URB;
|
||||
} else {
|
||||
insn->bits2.send_igdng.sfid = BRW_MESSAGE_TARGET_URB;
|
||||
insn->bits2.send_igdng.end_of_thread = end_of_thread;
|
||||
insn->bits2.send_gen5.sfid = BRW_MESSAGE_TARGET_URB;
|
||||
insn->bits2.send_gen5.end_of_thread = end_of_thread;
|
||||
}
|
||||
} else {
|
||||
insn->bits3.urb.opcode = 0; /* ? */
|
||||
@@ -369,18 +369,18 @@ static void brw_set_dp_write_message( struct brw_context *brw,
|
||||
struct intel_context *intel = &brw->intel;
|
||||
brw_set_src1(insn, brw_imm_d(0));
|
||||
|
||||
if (intel->is_ironlake) {
|
||||
insn->bits3.dp_write_igdng.binding_table_index = binding_table_index;
|
||||
insn->bits3.dp_write_igdng.msg_control = msg_control;
|
||||
insn->bits3.dp_write_igdng.pixel_scoreboard_clear = pixel_scoreboard_clear;
|
||||
insn->bits3.dp_write_igdng.msg_type = msg_type;
|
||||
insn->bits3.dp_write_igdng.send_commit_msg = 0;
|
||||
insn->bits3.dp_write_igdng.header_present = 1;
|
||||
insn->bits3.dp_write_igdng.response_length = response_length;
|
||||
insn->bits3.dp_write_igdng.msg_length = msg_length;
|
||||
insn->bits3.dp_write_igdng.end_of_thread = end_of_thread;
|
||||
insn->bits2.send_igdng.sfid = BRW_MESSAGE_TARGET_DATAPORT_WRITE;
|
||||
insn->bits2.send_igdng.end_of_thread = end_of_thread;
|
||||
if (intel->gen == 5) {
|
||||
insn->bits3.dp_write_gen5.binding_table_index = binding_table_index;
|
||||
insn->bits3.dp_write_gen5.msg_control = msg_control;
|
||||
insn->bits3.dp_write_gen5.pixel_scoreboard_clear = pixel_scoreboard_clear;
|
||||
insn->bits3.dp_write_gen5.msg_type = msg_type;
|
||||
insn->bits3.dp_write_gen5.send_commit_msg = 0;
|
||||
insn->bits3.dp_write_gen5.header_present = 1;
|
||||
insn->bits3.dp_write_gen5.response_length = response_length;
|
||||
insn->bits3.dp_write_gen5.msg_length = msg_length;
|
||||
insn->bits3.dp_write_gen5.end_of_thread = end_of_thread;
|
||||
insn->bits2.send_gen5.sfid = BRW_MESSAGE_TARGET_DATAPORT_WRITE;
|
||||
insn->bits2.send_gen5.end_of_thread = end_of_thread;
|
||||
} else {
|
||||
insn->bits3.dp_write.binding_table_index = binding_table_index;
|
||||
insn->bits3.dp_write.msg_control = msg_control;
|
||||
@@ -407,18 +407,18 @@ static void brw_set_dp_read_message( struct brw_context *brw,
|
||||
struct intel_context *intel = &brw->intel;
|
||||
brw_set_src1(insn, brw_imm_d(0));
|
||||
|
||||
if (intel->is_ironlake) {
|
||||
insn->bits3.dp_read_igdng.binding_table_index = binding_table_index;
|
||||
insn->bits3.dp_read_igdng.msg_control = msg_control;
|
||||
insn->bits3.dp_read_igdng.msg_type = msg_type;
|
||||
insn->bits3.dp_read_igdng.target_cache = target_cache;
|
||||
insn->bits3.dp_read_igdng.header_present = 1;
|
||||
insn->bits3.dp_read_igdng.response_length = response_length;
|
||||
insn->bits3.dp_read_igdng.msg_length = msg_length;
|
||||
insn->bits3.dp_read_igdng.pad1 = 0;
|
||||
insn->bits3.dp_read_igdng.end_of_thread = end_of_thread;
|
||||
insn->bits2.send_igdng.sfid = BRW_MESSAGE_TARGET_DATAPORT_READ;
|
||||
insn->bits2.send_igdng.end_of_thread = end_of_thread;
|
||||
if (intel->gen == 5) {
|
||||
insn->bits3.dp_read_gen5.binding_table_index = binding_table_index;
|
||||
insn->bits3.dp_read_gen5.msg_control = msg_control;
|
||||
insn->bits3.dp_read_gen5.msg_type = msg_type;
|
||||
insn->bits3.dp_read_gen5.target_cache = target_cache;
|
||||
insn->bits3.dp_read_gen5.header_present = 1;
|
||||
insn->bits3.dp_read_gen5.response_length = response_length;
|
||||
insn->bits3.dp_read_gen5.msg_length = msg_length;
|
||||
insn->bits3.dp_read_gen5.pad1 = 0;
|
||||
insn->bits3.dp_read_gen5.end_of_thread = end_of_thread;
|
||||
insn->bits2.send_gen5.sfid = BRW_MESSAGE_TARGET_DATAPORT_READ;
|
||||
insn->bits2.send_gen5.end_of_thread = end_of_thread;
|
||||
} else {
|
||||
insn->bits3.dp_read.binding_table_index = binding_table_index; /*0:7*/
|
||||
insn->bits3.dp_read.msg_control = msg_control; /*8:11*/
|
||||
@@ -447,17 +447,17 @@ static void brw_set_sampler_message(struct brw_context *brw,
|
||||
assert(eot == 0);
|
||||
brw_set_src1(insn, brw_imm_d(0));
|
||||
|
||||
if (intel->is_ironlake) {
|
||||
insn->bits3.sampler_igdng.binding_table_index = binding_table_index;
|
||||
insn->bits3.sampler_igdng.sampler = sampler;
|
||||
insn->bits3.sampler_igdng.msg_type = msg_type;
|
||||
insn->bits3.sampler_igdng.simd_mode = simd_mode;
|
||||
insn->bits3.sampler_igdng.header_present = header_present;
|
||||
insn->bits3.sampler_igdng.response_length = response_length;
|
||||
insn->bits3.sampler_igdng.msg_length = msg_length;
|
||||
insn->bits3.sampler_igdng.end_of_thread = eot;
|
||||
insn->bits2.send_igdng.sfid = BRW_MESSAGE_TARGET_SAMPLER;
|
||||
insn->bits2.send_igdng.end_of_thread = eot;
|
||||
if (intel->gen == 5) {
|
||||
insn->bits3.sampler_gen5.binding_table_index = binding_table_index;
|
||||
insn->bits3.sampler_gen5.sampler = sampler;
|
||||
insn->bits3.sampler_gen5.msg_type = msg_type;
|
||||
insn->bits3.sampler_gen5.simd_mode = simd_mode;
|
||||
insn->bits3.sampler_gen5.header_present = header_present;
|
||||
insn->bits3.sampler_gen5.response_length = response_length;
|
||||
insn->bits3.sampler_gen5.msg_length = msg_length;
|
||||
insn->bits3.sampler_gen5.end_of_thread = eot;
|
||||
insn->bits2.send_gen5.sfid = BRW_MESSAGE_TARGET_SAMPLER;
|
||||
insn->bits2.send_gen5.end_of_thread = eot;
|
||||
} else if (intel->is_g4x) {
|
||||
insn->bits3.sampler_g4x.binding_table_index = binding_table_index;
|
||||
insn->bits3.sampler_g4x.sampler = sampler;
|
||||
@@ -663,7 +663,7 @@ struct brw_instruction *brw_ELSE(struct brw_compile *p,
|
||||
struct brw_instruction *insn;
|
||||
GLuint br = 1;
|
||||
|
||||
if (intel->is_ironlake)
|
||||
if (intel->gen == 5)
|
||||
br = 2;
|
||||
|
||||
if (p->single_program_flow) {
|
||||
@@ -705,7 +705,7 @@ void brw_ENDIF(struct brw_compile *p,
|
||||
struct intel_context *intel = &p->brw->intel;
|
||||
GLuint br = 1;
|
||||
|
||||
if (intel->is_ironlake)
|
||||
if (intel->gen == 5)
|
||||
br = 2;
|
||||
|
||||
if (p->single_program_flow) {
|
||||
@@ -820,7 +820,7 @@ struct brw_instruction *brw_WHILE(struct brw_compile *p,
|
||||
struct brw_instruction *insn;
|
||||
GLuint br = 1;
|
||||
|
||||
if (intel->is_ironlake)
|
||||
if (intel->gen == 5)
|
||||
br = 2;
|
||||
|
||||
if (p->single_program_flow)
|
||||
@@ -864,7 +864,7 @@ void brw_land_fwd_jump(struct brw_compile *p,
|
||||
struct brw_instruction *landing = &p->store[p->nr_insn];
|
||||
GLuint jmpi = 1;
|
||||
|
||||
if (intel->is_ironlake)
|
||||
if (intel->gen == 5)
|
||||
jmpi = 2;
|
||||
|
||||
assert(jmp_insn->header.opcode == BRW_OPCODE_JMPI);
|
||||
|
@@ -60,7 +60,7 @@ static void compile_gs_prog( struct brw_context *brw,
|
||||
*/
|
||||
c.nr_attrs = brw_count_bits(c.key.attrs);
|
||||
|
||||
if (intel->is_ironlake)
|
||||
if (intel->gen == 5)
|
||||
c.nr_regs = (c.nr_attrs + 1) / 2 + 3; /* are vertices packed, or reg-aligned? */
|
||||
else
|
||||
c.nr_regs = (c.nr_attrs + 1) / 2 + 1; /* are vertices packed, or reg-aligned? */
|
||||
|
@@ -98,7 +98,7 @@ gs_unit_create_from_key(struct brw_context *brw, struct brw_gs_unit_key *key)
|
||||
else
|
||||
gs.thread4.max_threads = 0;
|
||||
|
||||
if (intel->is_ironlake)
|
||||
if (intel->gen == 5)
|
||||
gs.thread4.rendering_enable = 1;
|
||||
|
||||
if (INTEL_DEBUG & DEBUG_STATS)
|
||||
|
@@ -248,7 +248,7 @@ static void emit_depthbuffer(struct brw_context *brw)
|
||||
|
||||
if (intel->gen >= 6)
|
||||
len = 7;
|
||||
else if (intel->is_g4x || intel->is_ironlake)
|
||||
else if (intel->is_g4x || intel->gen == 5)
|
||||
len = 6;
|
||||
else
|
||||
len = 5;
|
||||
@@ -262,7 +262,7 @@ static void emit_depthbuffer(struct brw_context *brw)
|
||||
OUT_BATCH(0);
|
||||
OUT_BATCH(0);
|
||||
|
||||
if (intel->is_g4x || intel->is_ironlake || intel->gen >= 6)
|
||||
if (intel->is_g4x || intel->gen >= 5)
|
||||
OUT_BATCH(0);
|
||||
|
||||
if (intel->gen >= 6)
|
||||
@@ -306,7 +306,7 @@ static void emit_depthbuffer(struct brw_context *brw)
|
||||
((region->height - 1) << 19));
|
||||
OUT_BATCH(0);
|
||||
|
||||
if (intel->is_g4x || intel->is_ironlake || intel->gen >= 6)
|
||||
if (intel->is_g4x || intel->gen >= 5)
|
||||
OUT_BATCH(0);
|
||||
|
||||
if (intel->gen >= 6)
|
||||
@@ -608,7 +608,7 @@ static void upload_state_base_address( struct brw_context *brw )
|
||||
OUT_BATCH(1); /* Indirect object upper bound */
|
||||
OUT_BATCH(1); /* Instruction access upper bound */
|
||||
ADVANCE_BATCH();
|
||||
} else if (intel->is_ironlake) {
|
||||
} else if (intel->gen == 5) {
|
||||
BEGIN_BATCH(8);
|
||||
OUT_BATCH(CMD_STATE_BASE_ADDRESS << 16 | (8 - 2));
|
||||
OUT_BATCH(1); /* General state base address */
|
||||
|
@@ -34,6 +34,7 @@
|
||||
#include "shader/prog_parameter.h"
|
||||
#include "shader/program.h"
|
||||
#include "shader/programopt.h"
|
||||
#include "shader/shader_api.h"
|
||||
#include "tnl/tnl.h"
|
||||
|
||||
#include "brw_context.h"
|
||||
@@ -119,12 +120,28 @@ static GLboolean brwIsProgramNative( GLcontext *ctx,
|
||||
return GL_TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
shader_error(GLcontext *ctx, struct gl_program *prog, const char *msg)
|
||||
{
|
||||
struct gl_shader_program *shader;
|
||||
|
||||
shader = _mesa_lookup_shader_program(ctx, prog->Id);
|
||||
|
||||
if (shader) {
|
||||
if (shader->InfoLog) {
|
||||
free(shader->InfoLog);
|
||||
}
|
||||
shader->InfoLog = _mesa_strdup(msg);
|
||||
shader->LinkStatus = GL_FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
static GLboolean brwProgramStringNotify( GLcontext *ctx,
|
||||
GLenum target,
|
||||
struct gl_program *prog )
|
||||
{
|
||||
struct brw_context *brw = brw_context(ctx);
|
||||
int i;
|
||||
|
||||
if (target == GL_FRAGMENT_PROGRAM_ARB) {
|
||||
struct gl_fragment_program *fprog = (struct gl_fragment_program *) prog;
|
||||
@@ -160,7 +177,22 @@ static GLboolean brwProgramStringNotify( GLcontext *ctx,
|
||||
_tnl_program_string(ctx, target, prog);
|
||||
}
|
||||
|
||||
/* XXX check if program is legal, within limits */
|
||||
/* Reject programs with subroutines, which are totally broken at the moment
|
||||
* (all program flows return when any program flow returns, and
|
||||
* the VS also hangs if a function call calls a function.
|
||||
*
|
||||
* See piglit glsl-{vs,fs}-functions-[23] tests.
|
||||
*/
|
||||
for (i = 0; i < prog->NumInstructions; i++) {
|
||||
if (prog->Instructions[i].Opcode == OPCODE_CAL) {
|
||||
shader_error(ctx, prog,
|
||||
"i965 driver doesn't yet support uninlined function "
|
||||
"calls. Move to using a single return statement at "
|
||||
"the end of the function to work around it.");
|
||||
return GL_FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
return GL_TRUE;
|
||||
}
|
||||
|
||||
|
@@ -162,7 +162,7 @@ static void do_flatshade_triangle( struct brw_sf_compile *c )
|
||||
if (c->key.primitive == SF_UNFILLED_TRIS)
|
||||
return;
|
||||
|
||||
if (intel->is_ironlake)
|
||||
if (intel->gen == 5)
|
||||
jmpi = 2;
|
||||
|
||||
brw_push_insn_state(p);
|
||||
@@ -201,7 +201,7 @@ static void do_flatshade_line( struct brw_sf_compile *c )
|
||||
if (c->key.primitive == SF_UNFILLED_TRIS)
|
||||
return;
|
||||
|
||||
if (intel->is_ironlake)
|
||||
if (intel->gen == 5)
|
||||
jmpi = 2;
|
||||
|
||||
brw_push_insn_state(p);
|
||||
|
@@ -76,7 +76,20 @@ static void upload_sf_vp(struct brw_context *brw)
|
||||
* Note that the hardware's coordinates are inclusive, while Mesa's min is
|
||||
* inclusive but max is exclusive.
|
||||
*/
|
||||
if (render_to_fbo) {
|
||||
|
||||
if (ctx->DrawBuffer->_Xmin == ctx->DrawBuffer->_Xmax ||
|
||||
ctx->DrawBuffer->_Ymin == ctx->DrawBuffer->_Ymax) {
|
||||
/* If the scissor was out of bounds and got clamped to 0
|
||||
* width/height at the bounds, the subtraction of 1 from
|
||||
* maximums could produce a negative number and thus not clip
|
||||
* anything. Instead, just provide a min > max scissor inside
|
||||
* the bounds, which produces the expected no rendering.
|
||||
*/
|
||||
sfv.scissor.xmin = 1;
|
||||
sfv.scissor.xmax = 0;
|
||||
sfv.scissor.ymin = 1;
|
||||
sfv.scissor.ymax = 0;
|
||||
} else if (render_to_fbo) {
|
||||
/* texmemory: Y=0=bottom */
|
||||
sfv.scissor.xmin = ctx->DrawBuffer->_Xmin;
|
||||
sfv.scissor.xmax = ctx->DrawBuffer->_Xmax - 1;
|
||||
@@ -177,7 +190,7 @@ sf_unit_create_from_key(struct brw_context *brw, struct brw_sf_unit_key *key,
|
||||
|
||||
sf.thread3.dispatch_grf_start_reg = 3;
|
||||
|
||||
if (intel->is_ironlake)
|
||||
if (intel->gen == 5)
|
||||
sf.thread3.urb_entry_read_offset = 3;
|
||||
else
|
||||
sf.thread3.urb_entry_read_offset = 1;
|
||||
@@ -190,7 +203,7 @@ sf_unit_create_from_key(struct brw_context *brw, struct brw_sf_unit_key *key,
|
||||
/* Each SF thread produces 1 PUE, and there can be up to 24 (Pre-Ironlake) or
|
||||
* 48 (Ironlake) threads.
|
||||
*/
|
||||
if (intel->is_ironlake)
|
||||
if (intel->gen == 5)
|
||||
chipset_max_threads = 48;
|
||||
else
|
||||
chipset_max_threads = 24;
|
||||
|
@@ -925,7 +925,7 @@ struct brw_gs_unit_state
|
||||
struct
|
||||
{
|
||||
GLuint pad0:8;
|
||||
GLuint rendering_enable:1; /* for IGDNG */
|
||||
GLuint rendering_enable:1; /* for Ironlake */
|
||||
GLuint pad4:1;
|
||||
GLuint stats_enable:1;
|
||||
GLuint nr_urb_entries:7;
|
||||
@@ -1035,7 +1035,7 @@ struct brw_wm_unit_state
|
||||
GLfloat global_depth_offset_constant;
|
||||
GLfloat global_depth_offset_scale;
|
||||
|
||||
/* for IGDNG only */
|
||||
/* for Ironlake only */
|
||||
struct {
|
||||
GLuint pad0:1;
|
||||
GLuint grf_reg_count_1:3;
|
||||
@@ -1448,7 +1448,7 @@ struct brw_instruction
|
||||
GLuint end_of_thread:1;
|
||||
GLuint pad1:1;
|
||||
GLuint sfid:4;
|
||||
} send_igdng; /* for IGDNG only */
|
||||
} send_gen5; /* for Ironlake only */
|
||||
|
||||
} bits2;
|
||||
|
||||
@@ -1549,7 +1549,7 @@ struct brw_instruction
|
||||
GLuint msg_length:4;
|
||||
GLuint pad1:2;
|
||||
GLuint end_of_thread:1;
|
||||
} math_igdng;
|
||||
} math_gen5;
|
||||
|
||||
struct {
|
||||
GLuint binding_table_index:8;
|
||||
@@ -1585,7 +1585,7 @@ struct brw_instruction
|
||||
GLuint msg_length:4;
|
||||
GLuint pad1:2;
|
||||
GLuint end_of_thread:1;
|
||||
} sampler_igdng;
|
||||
} sampler_gen5;
|
||||
|
||||
struct brw_urb_immediate urb;
|
||||
|
||||
@@ -1603,7 +1603,7 @@ struct brw_instruction
|
||||
GLuint msg_length:4;
|
||||
GLuint pad1:2;
|
||||
GLuint end_of_thread:1;
|
||||
} urb_igdng;
|
||||
} urb_gen5;
|
||||
|
||||
struct {
|
||||
GLuint binding_table_index:8;
|
||||
@@ -1628,7 +1628,7 @@ struct brw_instruction
|
||||
GLuint msg_length:4;
|
||||
GLuint pad1:2;
|
||||
GLuint end_of_thread:1;
|
||||
} dp_read_igdng;
|
||||
} dp_read_gen5;
|
||||
|
||||
struct {
|
||||
GLuint binding_table_index:8;
|
||||
@@ -1655,7 +1655,7 @@ struct brw_instruction
|
||||
GLuint msg_length:4;
|
||||
GLuint pad1:2;
|
||||
GLuint end_of_thread:1;
|
||||
} dp_write_igdng;
|
||||
} dp_write_gen5;
|
||||
|
||||
struct {
|
||||
GLuint pad:16;
|
||||
@@ -1673,7 +1673,7 @@ struct brw_instruction
|
||||
GLuint msg_length:4;
|
||||
GLuint pad1:2;
|
||||
GLuint end_of_thread:1;
|
||||
} generic_igdng;
|
||||
} generic_gen5;
|
||||
|
||||
GLint d;
|
||||
GLuint ud;
|
||||
|
@@ -48,77 +48,31 @@ GLboolean brw_miptree_layout(struct intel_context *intel,
|
||||
|
||||
switch (mt->target) {
|
||||
case GL_TEXTURE_CUBE_MAP:
|
||||
if (intel->is_ironlake) {
|
||||
GLuint align_h = 2, align_w = 4;
|
||||
if (intel->gen == 5) {
|
||||
GLuint align_h = 2;
|
||||
GLuint level;
|
||||
GLuint x = 0;
|
||||
GLuint y = 0;
|
||||
GLuint width = mt->width0;
|
||||
GLuint height = mt->height0;
|
||||
GLuint qpitch = 0;
|
||||
GLuint y_pitch = 0;
|
||||
int h0, h1, q;
|
||||
|
||||
mt->pitch = mt->width0;
|
||||
intel_get_texture_alignment_unit(mt->internal_format, &align_w, &align_h);
|
||||
y_pitch = ALIGN(height, align_h);
|
||||
/* On Ironlake, cube maps are finally represented as just a series
|
||||
* of MIPLAYOUT_BELOW 2D textures (like 2D texture arrays), separated
|
||||
* by a pitch of qpitch rows, where qpitch is defined by the equation
|
||||
* given in Volume 1 of the BSpec.
|
||||
*/
|
||||
h0 = ALIGN(mt->height0, align_h);
|
||||
h1 = ALIGN(minify(h0), align_h);
|
||||
qpitch = (h0 + h1 + 11 * align_h);
|
||||
if (mt->compressed)
|
||||
qpitch /= 4;
|
||||
|
||||
if (mt->compressed) {
|
||||
mt->pitch = ALIGN(mt->width0, align_w);
|
||||
}
|
||||
|
||||
if (mt->first_level != mt->last_level) {
|
||||
GLuint mip1_width;
|
||||
|
||||
if (mt->compressed) {
|
||||
mip1_width = ALIGN(minify(mt->width0), align_w)
|
||||
+ ALIGN(minify(minify(mt->width0)), align_w);
|
||||
} else {
|
||||
mip1_width = ALIGN(minify(mt->width0), align_w)
|
||||
+ minify(minify(mt->width0));
|
||||
}
|
||||
|
||||
if (mip1_width > mt->pitch) {
|
||||
mt->pitch = mip1_width;
|
||||
}
|
||||
}
|
||||
|
||||
mt->pitch = intel_miptree_pitch_align(intel, mt, tiling, mt->pitch);
|
||||
|
||||
if (mt->compressed) {
|
||||
qpitch = (y_pitch + ALIGN(minify(y_pitch), align_h) + 11 * align_h) / 4;
|
||||
mt->total_height = (y_pitch + ALIGN(minify(y_pitch), align_h) + 11 * align_h) / 4 * 6;
|
||||
} else {
|
||||
qpitch = (y_pitch + ALIGN(minify(y_pitch), align_h) + 11 * align_h);
|
||||
mt->total_height = (y_pitch + ALIGN(minify(y_pitch), align_h) + 11 * align_h) * 6;
|
||||
}
|
||||
i945_miptree_layout_2d(intel, mt, tiling, 6);
|
||||
|
||||
for (level = mt->first_level; level <= mt->last_level; level++) {
|
||||
GLuint img_height;
|
||||
GLuint nr_images = 6;
|
||||
GLuint q = 0;
|
||||
|
||||
intel_miptree_set_level_info(mt, level, nr_images, x, y, width,
|
||||
height, 1);
|
||||
|
||||
for (q = 0; q < nr_images; q++)
|
||||
intel_miptree_set_image_offset(mt, level, q,
|
||||
x, y + q * qpitch);
|
||||
|
||||
if (mt->compressed)
|
||||
img_height = MAX2(1, height/4);
|
||||
else
|
||||
img_height = ALIGN(height, align_h);
|
||||
|
||||
if (level == mt->first_level + 1) {
|
||||
x += ALIGN(width, align_w);
|
||||
}
|
||||
else {
|
||||
y += img_height;
|
||||
}
|
||||
|
||||
width = minify(width);
|
||||
height = minify(height);
|
||||
for (q = 0; q < 6; q++) {
|
||||
intel_miptree_set_image_offset(mt, level, q, 0, q * qpitch);
|
||||
}
|
||||
}
|
||||
mt->total_height = qpitch * 6;
|
||||
|
||||
break;
|
||||
}
|
||||
@@ -208,7 +162,7 @@ GLboolean brw_miptree_layout(struct intel_context *intel,
|
||||
}
|
||||
|
||||
default:
|
||||
i945_miptree_layout_2d(intel, mt, tiling);
|
||||
i945_miptree_layout_2d(intel, mt, tiling, 1);
|
||||
break;
|
||||
}
|
||||
DBG("%s: %dx%dx%d - sz 0x%x\n", __FUNCTION__,
|
||||
|
@@ -148,7 +148,7 @@ static void recalculate_urb_fence( struct brw_context *brw )
|
||||
|
||||
brw->urb.constrained = 0;
|
||||
|
||||
if (intel->is_ironlake) {
|
||||
if (intel->gen == 5) {
|
||||
brw->urb.nr_vs_entries = 128;
|
||||
brw->urb.nr_sf_entries = 48;
|
||||
if (check_urb_layout(brw)) {
|
||||
|
@@ -182,7 +182,7 @@ static void brw_vs_alloc_regs( struct brw_vs_compile *c )
|
||||
|
||||
if (intel->gen >= 6)
|
||||
mrf = 6;
|
||||
else if (intel->is_ironlake)
|
||||
else if (intel->gen == 5)
|
||||
mrf = 8;
|
||||
else
|
||||
mrf = 4;
|
||||
@@ -283,7 +283,7 @@ static void brw_vs_alloc_regs( struct brw_vs_compile *c )
|
||||
|
||||
if (intel->gen >= 6)
|
||||
c->prog_data.urb_entry_size = (attributes_in_vue + 4 + 7) / 8;
|
||||
else if (intel->is_ironlake)
|
||||
else if (intel->gen == 5)
|
||||
c->prog_data.urb_entry_size = (attributes_in_vue + 6 + 3) / 4;
|
||||
else
|
||||
c->prog_data.urb_entry_size = (attributes_in_vue + 2 + 3) / 4;
|
||||
@@ -1288,7 +1288,7 @@ static void emit_vertex_write( struct brw_vs_compile *c)
|
||||
brw_MOV(p, offset(m0, 2), pos);
|
||||
brw_MOV(p, offset(m0, 5), pos);
|
||||
len_vertex_header = 4;
|
||||
} else if (intel->is_ironlake) {
|
||||
} else if (intel->gen == 5) {
|
||||
/* There are 20 DWs (D0-D19) in VUE header on Ironlake:
|
||||
* dword 0-3 (m1) of the header is indices, point width, clip flags.
|
||||
* dword 4-7 (m2) is the ndc position (set above)
|
||||
@@ -1710,7 +1710,7 @@ void brw_vs_emit(struct brw_vs_compile *c )
|
||||
|
||||
loop_depth--;
|
||||
|
||||
if (intel->is_ironlake)
|
||||
if (intel->gen == 5)
|
||||
br = 2;
|
||||
|
||||
inst0 = inst1 = brw_WHILE(p, loop_inst[loop_depth]);
|
||||
|
@@ -98,7 +98,7 @@ vs_unit_create_from_key(struct brw_context *brw, struct brw_vs_unit_key *key)
|
||||
*/
|
||||
vs.thread1.single_program_flow = 0;
|
||||
|
||||
if (intel->is_ironlake)
|
||||
if (intel->gen == 5)
|
||||
vs.thread1.binding_table_entry_count = 0; /* hardware requirement */
|
||||
else
|
||||
vs.thread1.binding_table_entry_count = key->nr_surfaces;
|
||||
@@ -109,7 +109,7 @@ vs_unit_create_from_key(struct brw_context *brw, struct brw_vs_unit_key *key)
|
||||
vs.thread3.urb_entry_read_offset = 0;
|
||||
vs.thread3.const_urb_entry_read_offset = key->curbe_offset * 2;
|
||||
|
||||
if (intel->is_ironlake) {
|
||||
if (intel->gen == 5) {
|
||||
switch (key->nr_urb_entries) {
|
||||
case 8:
|
||||
case 12:
|
||||
@@ -150,7 +150,7 @@ vs_unit_create_from_key(struct brw_context *brw, struct brw_vs_unit_key *key)
|
||||
|
||||
/* No samplers for ARB_vp programs:
|
||||
*/
|
||||
/* It has to be set to 0 for IGDNG
|
||||
/* It has to be set to 0 for Ironlake
|
||||
*/
|
||||
vs.vs5.sampler_count = 0;
|
||||
|
||||
|
@@ -898,7 +898,7 @@ void emit_tex(struct brw_wm_compile *c,
|
||||
}
|
||||
|
||||
/* Pre-Ironlake, the 8-wide sampler always took u,v,r. */
|
||||
if (!intel->is_ironlake && c->dispatch_width == 8)
|
||||
if (intel->gen < 5 && c->dispatch_width == 8)
|
||||
nr_texcoords = 3;
|
||||
|
||||
/* For shadow comparisons, we have to supply u,v,r. */
|
||||
@@ -916,7 +916,7 @@ void emit_tex(struct brw_wm_compile *c,
|
||||
|
||||
/* Fill in the shadow comparison reference value. */
|
||||
if (shadow) {
|
||||
if (intel->is_ironlake) {
|
||||
if (intel->gen == 5) {
|
||||
/* Fill in the cube map array index value. */
|
||||
brw_MOV(p, brw_message_reg(cur_mrf), brw_imm_f(0));
|
||||
cur_mrf += mrf_per_channel;
|
||||
@@ -929,11 +929,11 @@ void emit_tex(struct brw_wm_compile *c,
|
||||
cur_mrf += mrf_per_channel;
|
||||
}
|
||||
|
||||
if (intel->is_ironlake) {
|
||||
if (intel->gen == 5) {
|
||||
if (shadow)
|
||||
msg_type = BRW_SAMPLER_MESSAGE_SAMPLE_COMPARE_IGDNG;
|
||||
msg_type = BRW_SAMPLER_MESSAGE_SAMPLE_COMPARE_GEN5;
|
||||
else
|
||||
msg_type = BRW_SAMPLER_MESSAGE_SAMPLE_IGDNG;
|
||||
msg_type = BRW_SAMPLER_MESSAGE_SAMPLE_GEN5;
|
||||
} else {
|
||||
/* Note that G45 and older determines shadow compare and dispatch width
|
||||
* from message length for most messages.
|
||||
@@ -981,16 +981,16 @@ void emit_txb(struct brw_wm_compile *c,
|
||||
* undefined, and trust the execution mask to keep the undefined pixels
|
||||
* from mattering.
|
||||
*/
|
||||
if (c->dispatch_width == 16 || !intel->is_ironlake) {
|
||||
if (intel->is_ironlake)
|
||||
msg_type = BRW_SAMPLER_MESSAGE_SAMPLE_BIAS_IGDNG;
|
||||
if (c->dispatch_width == 16 || intel->gen < 5) {
|
||||
if (intel->gen == 5)
|
||||
msg_type = BRW_SAMPLER_MESSAGE_SAMPLE_BIAS_GEN5;
|
||||
else
|
||||
msg_type = BRW_SAMPLER_MESSAGE_SIMD16_SAMPLE_BIAS;
|
||||
mrf_per_channel = 2;
|
||||
dst_retyped = retype(vec16(dst[0]), BRW_REGISTER_TYPE_UW);
|
||||
response_length = 8;
|
||||
} else {
|
||||
msg_type = BRW_SAMPLER_MESSAGE_SAMPLE_BIAS_IGDNG;
|
||||
msg_type = BRW_SAMPLER_MESSAGE_SAMPLE_BIAS_GEN5;
|
||||
mrf_per_channel = 1;
|
||||
dst_retyped = retype(vec8(dst[0]), BRW_REGISTER_TYPE_UW);
|
||||
response_length = 4;
|
||||
|
@@ -2006,7 +2006,7 @@ static void brw_wm_emit_glsl(struct brw_context *brw, struct brw_wm_compile *c)
|
||||
struct brw_instruction *inst0, *inst1;
|
||||
GLuint br = 1;
|
||||
|
||||
if (intel->is_ironlake)
|
||||
if (intel->gen == 5)
|
||||
br = 2;
|
||||
|
||||
assert(loop_depth > 0);
|
||||
|
@@ -137,7 +137,7 @@ wm_unit_create_from_key(struct brw_context *brw, struct brw_wm_unit_key *key,
|
||||
wm.thread1.depth_coef_urb_read_offset = 1;
|
||||
wm.thread1.floating_point_mode = BRW_FLOATING_POINT_NON_IEEE_754;
|
||||
|
||||
if (intel->is_ironlake)
|
||||
if (intel->gen == 5)
|
||||
wm.thread1.binding_table_entry_count = 0; /* hardware requirement */
|
||||
else
|
||||
wm.thread1.binding_table_entry_count = key->nr_surfaces;
|
||||
@@ -157,7 +157,7 @@ wm_unit_create_from_key(struct brw_context *brw, struct brw_wm_unit_key *key,
|
||||
wm.thread3.const_urb_entry_read_length = key->curb_entry_read_length;
|
||||
wm.thread3.const_urb_entry_read_offset = key->curbe_offset * 2;
|
||||
|
||||
if (intel->is_ironlake)
|
||||
if (intel->gen == 5)
|
||||
wm.wm4.sampler_count = 0; /* hardware requirement */
|
||||
else
|
||||
wm.wm4.sampler_count = (key->sampler_count + 1) / 4;
|
||||
|
@@ -588,7 +588,7 @@ brw_update_renderbuffer_surface(struct brw_context *brw,
|
||||
tile_base = ((key.draw_y / 32) * (32 * pitch));
|
||||
tile_base += (key.draw_x - tile_x) / (128 / key.cpp) * 4096;
|
||||
}
|
||||
assert(intel->is_g4x || (tile_x == 0 && tile_y == 0));
|
||||
assert(brw->has_surface_tile_offset || (tile_x == 0 && tile_y == 0));
|
||||
assert(tile_x % 4 == 0);
|
||||
assert(tile_y % 2 == 0);
|
||||
/* Note that the low bits of these fields are missing, so
|
||||
|
1
src/mesa/drivers/dri/i965/intel_extensions_es2.c
Symbolic link
1
src/mesa/drivers/dri/i965/intel_extensions_es2.c
Symbolic link
@@ -0,0 +1 @@
|
||||
../intel/intel_extensions_es2.c
|
@@ -93,7 +93,7 @@
|
||||
|
||||
#define IS_ILD(devid) (devid == PCI_CHIP_ILD_G)
|
||||
#define IS_ILM(devid) (devid == PCI_CHIP_ILM_G)
|
||||
#define IS_IGDNG(devid) (IS_ILD(devid) || IS_ILM(devid))
|
||||
#define IS_GEN5(devid) (IS_ILD(devid) || IS_ILM(devid))
|
||||
|
||||
#define IS_915(devid) (devid == PCI_CHIP_I915_G || \
|
||||
devid == PCI_CHIP_E7221_G || \
|
||||
@@ -118,7 +118,7 @@
|
||||
|
||||
#define IS_965(devid) (IS_GEN4(devid) || \
|
||||
IS_G4X(devid) || \
|
||||
IS_IGDNG(devid) || \
|
||||
IS_GEN5(devid) || \
|
||||
IS_GEN6(devid))
|
||||
|
||||
#define IS_9XX(devid) (IS_915(devid) || \
|
||||
|
@@ -159,10 +159,10 @@ intelGetString(GLcontext * ctx, GLenum name)
|
||||
chipset = "Intel(R) B43";
|
||||
break;
|
||||
case PCI_CHIP_ILD_G:
|
||||
chipset = "Intel(R) IGDNG_D";
|
||||
chipset = "Intel(R) Ironlake Desktop";
|
||||
break;
|
||||
case PCI_CHIP_ILM_G:
|
||||
chipset = "Intel(R) IGDNG_M";
|
||||
chipset = "Intel(R) Ironlake Mobile";
|
||||
break;
|
||||
default:
|
||||
chipset = "Unknown Intel Chipset";
|
||||
@@ -362,7 +362,7 @@ intel_update_renderbuffers(__DRIcontext *context, __DRIdrawable *drawable)
|
||||
if (buffers[i].attachment == __DRI_BUFFER_DEPTH)
|
||||
depth_region = region;
|
||||
|
||||
intel_renderbuffer_set_region(rb, region);
|
||||
intel_renderbuffer_set_region(intel, rb, region);
|
||||
intel_region_release(®ion);
|
||||
|
||||
if (buffers[i].attachment == __DRI_BUFFER_DEPTH_STENCIL) {
|
||||
@@ -374,7 +374,7 @@ intel_update_renderbuffers(__DRIcontext *context, __DRIdrawable *drawable)
|
||||
continue;
|
||||
|
||||
intel_region_reference(&stencil_region, region);
|
||||
intel_renderbuffer_set_region(rb, stencil_region);
|
||||
intel_renderbuffer_set_region(intel, rb, stencil_region);
|
||||
intel_region_release(&stencil_region);
|
||||
}
|
||||
}
|
||||
@@ -583,6 +583,7 @@ intelInitDriverFunctions(struct dd_function_table *functions)
|
||||
|
||||
GLboolean
|
||||
intelInitContext(struct intel_context *intel,
|
||||
int api,
|
||||
const __GLcontextModes * mesaVis,
|
||||
__DRIcontext * driContextPriv,
|
||||
void *sharedContextPrivate,
|
||||
@@ -598,8 +599,8 @@ intelInitContext(struct intel_context *intel,
|
||||
if (intelScreen->bufmgr == NULL)
|
||||
return GL_FALSE;
|
||||
|
||||
if (!_mesa_initialize_context(&intel->ctx, mesaVis, shareCtx,
|
||||
functions, (void *) intel)) {
|
||||
if (!_mesa_initialize_context_for_api(&intel->ctx, api, mesaVis, shareCtx,
|
||||
functions, (void *) intel)) {
|
||||
printf("%s: failed to init mesa context\n", __FUNCTION__);
|
||||
return GL_FALSE;
|
||||
}
|
||||
@@ -614,8 +615,16 @@ intelInitContext(struct intel_context *intel,
|
||||
intel->gen = 6;
|
||||
intel->needs_ff_sync = GL_TRUE;
|
||||
intel->has_luminance_srgb = GL_TRUE;
|
||||
} else if (IS_GEN5(intel->intelScreen->deviceID)) {
|
||||
intel->gen = 5;
|
||||
intel->needs_ff_sync = GL_TRUE;
|
||||
intel->has_luminance_srgb = GL_TRUE;
|
||||
} else if (IS_965(intel->intelScreen->deviceID)) {
|
||||
intel->gen = 4;
|
||||
if (IS_G4X(intel->intelScreen->deviceID)) {
|
||||
intel->has_luminance_srgb = GL_TRUE;
|
||||
intel->is_g4x = GL_TRUE;
|
||||
}
|
||||
} else if (IS_9XX(intel->intelScreen->deviceID)) {
|
||||
intel->gen = 3;
|
||||
if (IS_945(intel->intelScreen->deviceID)) {
|
||||
@@ -625,15 +634,6 @@ intelInitContext(struct intel_context *intel,
|
||||
intel->gen = 2;
|
||||
}
|
||||
|
||||
if (IS_IGDNG(intel->intelScreen->deviceID)) {
|
||||
intel->is_ironlake = GL_TRUE;
|
||||
intel->needs_ff_sync = GL_TRUE;
|
||||
intel->has_luminance_srgb = GL_TRUE;
|
||||
} else if (IS_G4X(intel->intelScreen->deviceID)) {
|
||||
intel->has_luminance_srgb = GL_TRUE;
|
||||
intel->is_g4x = GL_TRUE;
|
||||
}
|
||||
|
||||
driParseConfigFiles(&intel->optionCache, &intelScreen->optionCache,
|
||||
intel->driScreen->myNum,
|
||||
(intel->gen >= 4) ? "i965" : "i915");
|
||||
@@ -736,7 +736,16 @@ intelInitContext(struct intel_context *intel,
|
||||
|
||||
intel->RenderIndex = ~0;
|
||||
|
||||
intelInitExtensions(ctx);
|
||||
switch (ctx->API) {
|
||||
case API_OPENGL:
|
||||
intelInitExtensions(ctx);
|
||||
break;
|
||||
case API_OPENGLES:
|
||||
break;
|
||||
case API_OPENGLES2:
|
||||
intelInitExtensionsES2(ctx);
|
||||
break;
|
||||
}
|
||||
|
||||
INTEL_DEBUG = driParseDebugString(getenv("INTEL_DEBUG"), debug_control);
|
||||
if (INTEL_DEBUG & DEBUG_BUFMGR)
|
||||
|
@@ -142,7 +142,6 @@ struct intel_context
|
||||
*/
|
||||
int gen;
|
||||
GLboolean needs_ff_sync;
|
||||
GLboolean is_ironlake;
|
||||
GLboolean is_g4x;
|
||||
GLboolean is_945;
|
||||
GLboolean has_luminance_srgb;
|
||||
@@ -367,6 +366,7 @@ extern int INTEL_DEBUG;
|
||||
*/
|
||||
|
||||
extern GLboolean intelInitContext(struct intel_context *intel,
|
||||
int api,
|
||||
const __GLcontextModes * mesaVis,
|
||||
__DRIcontext * driContextPriv,
|
||||
void *sharedContextPrivate,
|
||||
|
@@ -63,6 +63,7 @@
|
||||
#define need_GL_ATI_envmap_bumpmap
|
||||
#define need_GL_NV_point_sprite
|
||||
#define need_GL_NV_vertex_program
|
||||
#define need_GL_OES_EGL_image
|
||||
#define need_GL_VERSION_2_0
|
||||
#define need_GL_VERSION_2_1
|
||||
|
||||
@@ -130,6 +131,9 @@ static const struct dri_extension card_extensions[] = {
|
||||
{ "GL_NV_vertex_program", GL_NV_vertex_program_functions },
|
||||
{ "GL_NV_vertex_program1_1", NULL },
|
||||
{ "GL_SGIS_generate_mipmap", NULL },
|
||||
#if FEATURE_OES_EGL_image
|
||||
{ "GL_OES_EGL_image", GL_OES_EGL_image_functions },
|
||||
#endif
|
||||
{ NULL, NULL }
|
||||
};
|
||||
|
||||
|
@@ -33,7 +33,7 @@ extern void
|
||||
intelInitExtensions(GLcontext *ctx);
|
||||
|
||||
extern void
|
||||
intelFlushDrawable(__DRIdrawable *drawable);
|
||||
intelInitExtensionsES2(GLcontext *ctx);
|
||||
|
||||
|
||||
#endif
|
||||
|
94
src/mesa/drivers/dri/intel/intel_extensions_es2.c
Normal file
94
src/mesa/drivers/dri/intel/intel_extensions_es2.c
Normal file
@@ -0,0 +1,94 @@
|
||||
/**************************************************************************
|
||||
*
|
||||
* Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sub license, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the
|
||||
* next paragraph) shall be included in all copies or substantial portions
|
||||
* of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
|
||||
* IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
|
||||
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
#include "main/extensions.h"
|
||||
|
||||
#include "intel_extensions.h"
|
||||
#include "utils.h"
|
||||
|
||||
static const char *es2_extensions[] = {
|
||||
/* Used by mesa internally (cf all_mesa_extensions in ../common/utils.c) */
|
||||
"GL_ARB_draw_buffers",
|
||||
"GL_ARB_multisample",
|
||||
"GL_ARB_texture_compression",
|
||||
"GL_ARB_transpose_matrix",
|
||||
"GL_ARB_vertex_buffer_object",
|
||||
"GL_ARB_window_pos",
|
||||
"GL_EXT_blend_func_separate",
|
||||
"GL_EXT_compiled_vertex_array",
|
||||
"GL_EXT_multi_draw_arrays",
|
||||
"GL_EXT_polygon_offset",
|
||||
"GL_EXT_texture_object",
|
||||
"GL_EXT_vertex_array",
|
||||
"GL_IBM_multimode_draw_arrays",
|
||||
"GL_MESA_window_pos",
|
||||
"GL_NV_vertex_program",
|
||||
|
||||
/* Required by GLES2 */
|
||||
"GL_ARB_fragment_program",
|
||||
"GL_ARB_fragment_shader",
|
||||
"GL_ARB_multitexture",
|
||||
"GL_ARB_shader_objects",
|
||||
"GL_ARB_texture_cube_map",
|
||||
"GL_ARB_texture_mirrored_repeat",
|
||||
"GL_ARB_texture_non_power_of_two",
|
||||
"GL_ARB_vertex_shader",
|
||||
"GL_EXT_blend_color",
|
||||
"GL_EXT_blend_equation_separate",
|
||||
"GL_EXT_blend_minmax",
|
||||
"GL_EXT_blend_subtract",
|
||||
"GL_EXT_stencil_wrap",
|
||||
|
||||
/* Optional GLES2 */
|
||||
"GL_ARB_framebuffer_object",
|
||||
"GL_EXT_texture_filter_anisotropic",
|
||||
"GL_ARB_depth_texture",
|
||||
"GL_EXT_packed_depth_stencil",
|
||||
"GL_EXT_framebuffer_object",
|
||||
|
||||
#if FEATURE_OES_EGL_image
|
||||
"GL_OES_EGL_image",
|
||||
#endif
|
||||
|
||||
NULL,
|
||||
};
|
||||
|
||||
/**
|
||||
* Initializes potential list of extensions if ctx == NULL, or actually enables
|
||||
* extensions for a context.
|
||||
*/
|
||||
void
|
||||
intelInitExtensionsES2(GLcontext *ctx)
|
||||
{
|
||||
int i;
|
||||
|
||||
/* Can't use driInitExtensions() since it uses extensions from
|
||||
* main/remap_helper.h when called the first time. */
|
||||
|
||||
for (i = 0; es2_extensions[i]; i++)
|
||||
_mesa_enable_extension(ctx, es2_extensions[i]);
|
||||
}
|
@@ -42,7 +42,9 @@
|
||||
#include "intel_fbo.h"
|
||||
#include "intel_mipmap_tree.h"
|
||||
#include "intel_regions.h"
|
||||
|
||||
#ifndef I915
|
||||
#include "brw_state.h"
|
||||
#endif
|
||||
|
||||
#define FILE_DEBUG_FLAG DEBUG_FBO
|
||||
|
||||
@@ -280,7 +282,8 @@ intel_nop_alloc_storage(GLcontext * ctx, struct gl_renderbuffer *rb,
|
||||
|
||||
|
||||
void
|
||||
intel_renderbuffer_set_region(struct intel_renderbuffer *rb,
|
||||
intel_renderbuffer_set_region(struct intel_context *intel,
|
||||
struct intel_renderbuffer *rb,
|
||||
struct intel_region *region)
|
||||
{
|
||||
struct intel_region *old;
|
||||
@@ -288,6 +291,12 @@ intel_renderbuffer_set_region(struct intel_renderbuffer *rb,
|
||||
old = rb->region;
|
||||
rb->region = NULL;
|
||||
intel_region_reference(&rb->region, region);
|
||||
#ifndef I915
|
||||
if (old) {
|
||||
brw_state_cache_bo_delete(&brw_context(&intel->ctx)->surface_cache,
|
||||
old->buffer);
|
||||
}
|
||||
#endif
|
||||
intel_region_release(&old);
|
||||
}
|
||||
|
||||
|
@@ -82,7 +82,8 @@ intel_get_renderbuffer(struct gl_framebuffer *fb, int attIndex)
|
||||
|
||||
|
||||
extern void
|
||||
intel_renderbuffer_set_region(struct intel_renderbuffer *irb,
|
||||
intel_renderbuffer_set_region(struct intel_context *intel,
|
||||
struct intel_renderbuffer *irb,
|
||||
struct intel_region *region);
|
||||
|
||||
|
||||
|
@@ -117,17 +117,16 @@ intel_miptree_create(struct intel_context *intel,
|
||||
GLboolean expect_accelerated_upload)
|
||||
{
|
||||
struct intel_mipmap_tree *mt;
|
||||
uint32_t tiling;
|
||||
uint32_t tiling = I915_TILING_NONE;
|
||||
|
||||
if (intel->use_texture_tiling && compress_byte == 0) {
|
||||
if (intel->gen >= 4 &&
|
||||
(base_format == GL_DEPTH_COMPONENT ||
|
||||
base_format == GL_DEPTH_STENCIL_EXT))
|
||||
tiling = I915_TILING_Y;
|
||||
else
|
||||
else if (width0 >= 64)
|
||||
tiling = I915_TILING_X;
|
||||
} else
|
||||
tiling = I915_TILING_NONE;
|
||||
}
|
||||
|
||||
mt = intel_miptree_create_internal(intel, target, internal_format,
|
||||
first_level, last_level, width0,
|
||||
|
@@ -167,7 +167,7 @@ intel_stencil_drawpixels(GLcontext * ctx,
|
||||
irb = intel_create_renderbuffer(MESA_FORMAT_ARGB8888);
|
||||
irb->Base.Width = depth_irb->Base.Width;
|
||||
irb->Base.Height = depth_irb->Base.Height;
|
||||
intel_renderbuffer_set_region(irb, depth_irb->region);
|
||||
intel_renderbuffer_set_region(intel, irb, depth_irb->region);
|
||||
|
||||
/* Create a name for our renderbuffer, which lets us use other mesa
|
||||
* rb functions for convenience.
|
||||
|
@@ -361,15 +361,18 @@ extern GLboolean i830CreateContext(const __GLcontextModes * mesaVis,
|
||||
__DRIcontext * driContextPriv,
|
||||
void *sharedContextPrivate);
|
||||
|
||||
extern GLboolean i915CreateContext(const __GLcontextModes * mesaVis,
|
||||
extern GLboolean i915CreateContext(int api,
|
||||
const __GLcontextModes * mesaVis,
|
||||
__DRIcontext * driContextPriv,
|
||||
void *sharedContextPrivate);
|
||||
extern GLboolean brwCreateContext(const __GLcontextModes * mesaVis,
|
||||
extern GLboolean brwCreateContext(int api,
|
||||
const __GLcontextModes * mesaVis,
|
||||
__DRIcontext * driContextPriv,
|
||||
void *sharedContextPrivate);
|
||||
|
||||
static GLboolean
|
||||
intelCreateContext(const __GLcontextModes * mesaVis,
|
||||
intelCreateContext(gl_api api,
|
||||
const __GLcontextModes * mesaVis,
|
||||
__DRIcontext * driContextPriv,
|
||||
void *sharedContextPrivate)
|
||||
{
|
||||
@@ -379,7 +382,7 @@ intelCreateContext(const __GLcontextModes * mesaVis,
|
||||
#ifdef I915
|
||||
if (IS_9XX(intelScreen->deviceID)) {
|
||||
if (!IS_965(intelScreen->deviceID)) {
|
||||
return i915CreateContext(mesaVis, driContextPriv,
|
||||
return i915CreateContext(api, mesaVis, driContextPriv,
|
||||
sharedContextPrivate);
|
||||
}
|
||||
} else {
|
||||
@@ -388,7 +391,8 @@ intelCreateContext(const __GLcontextModes * mesaVis,
|
||||
}
|
||||
#else
|
||||
if (IS_965(intelScreen->deviceID))
|
||||
return brwCreateContext(mesaVis, driContextPriv, sharedContextPrivate);
|
||||
return brwCreateContext(api, mesaVis,
|
||||
driContextPriv, sharedContextPrivate);
|
||||
#endif
|
||||
fprintf(stderr, "Unrecognized deviceID %x\n", intelScreen->deviceID);
|
||||
return GL_FALSE;
|
||||
@@ -435,6 +439,7 @@ __DRIconfig **intelInitScreen2(__DRIscreen *psp)
|
||||
struct intel_screen *intelScreen;
|
||||
GLenum fb_format[3];
|
||||
GLenum fb_type[3];
|
||||
unsigned int api_mask;
|
||||
|
||||
static const GLenum back_buffer_modes[] = {
|
||||
GLX_NONE, GLX_SWAP_UNDEFINED_OML, GLX_SWAP_COPY_OML
|
||||
@@ -461,6 +466,17 @@ __DRIconfig **intelInitScreen2(__DRIscreen *psp)
|
||||
&intelScreen->deviceID))
|
||||
return GL_FALSE;
|
||||
|
||||
api_mask = (1 << __DRI_API_OPENGL);
|
||||
#if FEATURE_ES1
|
||||
api_mask |= (1 << __DRI_API_GLES);
|
||||
#endif
|
||||
#if FEATURE_ES2
|
||||
api_mask |= (1 << __DRI_API_GLES2);
|
||||
#endif
|
||||
|
||||
if (IS_9XX(intelScreen->deviceID) || IS_965(intelScreen->deviceID))
|
||||
psp->api_mask = api_mask;
|
||||
|
||||
if (!intel_init_bufmgr(intelScreen))
|
||||
return GL_FALSE;
|
||||
|
||||
|
@@ -63,9 +63,9 @@ void intel_get_texture_alignment_unit(GLenum internalFormat, GLuint *w, GLuint *
|
||||
}
|
||||
}
|
||||
|
||||
void i945_miptree_layout_2d( struct intel_context *intel,
|
||||
struct intel_mipmap_tree *mt,
|
||||
uint32_t tiling )
|
||||
void i945_miptree_layout_2d(struct intel_context *intel,
|
||||
struct intel_mipmap_tree *mt,
|
||||
uint32_t tiling, int nr_images)
|
||||
{
|
||||
GLuint align_h = 2, align_w = 4;
|
||||
GLuint level;
|
||||
@@ -111,7 +111,7 @@ void i945_miptree_layout_2d( struct intel_context *intel,
|
||||
for ( level = mt->first_level ; level <= mt->last_level ; level++ ) {
|
||||
GLuint img_height;
|
||||
|
||||
intel_miptree_set_level_info(mt, level, 1, x, y, width,
|
||||
intel_miptree_set_level_info(mt, level, nr_images, x, y, width,
|
||||
height, 1);
|
||||
|
||||
if (mt->compressed)
|
||||
|
@@ -40,5 +40,5 @@ static INLINE GLuint minify( GLuint d )
|
||||
|
||||
extern void i945_miptree_layout_2d(struct intel_context *intel,
|
||||
struct intel_mipmap_tree *mt,
|
||||
uint32_t tiling);
|
||||
uint32_t tiling, int nr_images);
|
||||
extern void intel_get_texture_alignment_unit(GLenum, GLuint *, GLuint *);
|
||||
|
@@ -86,7 +86,8 @@ static const struct dri_extension card_extensions[] =
|
||||
|
||||
/* Create the device specific context.
|
||||
*/
|
||||
GLboolean mach64CreateContext( const __GLcontextModes *glVisual,
|
||||
GLboolean mach64CreateContext( gl_api api,
|
||||
const __GLcontextModes *glVisual,
|
||||
__DRIcontext *driContextPriv,
|
||||
void *sharedContextPrivate )
|
||||
{
|
||||
|
@@ -273,7 +273,8 @@ struct mach64_context {
|
||||
#define MACH64_CONTEXT(ctx) ((mach64ContextPtr)(ctx->DriverCtx))
|
||||
|
||||
|
||||
extern GLboolean mach64CreateContext( const __GLcontextModes *glVisual,
|
||||
extern GLboolean mach64CreateContext( gl_api api,
|
||||
const __GLcontextModes *glVisual,
|
||||
__DRIcontext *driContextPriv,
|
||||
void *sharedContextPrivate );
|
||||
|
||||
|
@@ -423,7 +423,8 @@ static const struct dri_debug_control debug_control[] =
|
||||
|
||||
|
||||
static GLboolean
|
||||
mgaCreateContext( const __GLcontextModes *mesaVis,
|
||||
mgaCreateContext( gl_api api,
|
||||
const __GLcontextModes *mesaVis,
|
||||
__DRIcontext *driContextPriv,
|
||||
void *sharedContextPrivate )
|
||||
{
|
||||
|
@@ -71,7 +71,8 @@ nouveau_channel_flush_notify(struct nouveau_channel *chan)
|
||||
}
|
||||
|
||||
GLboolean
|
||||
nouveau_context_create(const __GLcontextModes *visual, __DRIcontext *dri_ctx,
|
||||
nouveau_context_create(gl_api api,
|
||||
const __GLcontextModes *visual, __DRIcontext *dri_ctx,
|
||||
void *share_ctx)
|
||||
{
|
||||
__DRIscreen *dri_screen = dri_ctx->driScreenPriv;
|
||||
|
@@ -99,7 +99,8 @@ static const struct dri_debug_control debug_control[] =
|
||||
|
||||
/* Create the device specific context.
|
||||
*/
|
||||
GLboolean r128CreateContext( const __GLcontextModes *glVisual,
|
||||
GLboolean r128CreateContext( gl_api api,
|
||||
const __GLcontextModes *glVisual,
|
||||
__DRIcontext *driContextPriv,
|
||||
void *sharedContextPrivate )
|
||||
{
|
||||
|
@@ -224,7 +224,8 @@ struct r128_context {
|
||||
(rmesa->r128Screen->chipset == R128_CARD_TYPE_R128_MOBILITY)
|
||||
|
||||
|
||||
extern GLboolean r128CreateContext( const __GLcontextModes *glVisual,
|
||||
extern GLboolean r128CreateContext( gl_api api,
|
||||
const __GLcontextModes *glVisual,
|
||||
__DRIcontext *driContextPriv,
|
||||
void *sharedContextPrivate );
|
||||
|
||||
|
@@ -271,7 +271,8 @@ static void r200_init_vtbl(radeonContextPtr radeon)
|
||||
|
||||
/* Create the device specific rendering context.
|
||||
*/
|
||||
GLboolean r200CreateContext( const __GLcontextModes *glVisual,
|
||||
GLboolean r200CreateContext( gl_api api,
|
||||
const __GLcontextModes *glVisual,
|
||||
__DRIcontext *driContextPriv,
|
||||
void *sharedContextPrivate)
|
||||
{
|
||||
|
@@ -637,7 +637,8 @@ struct r200_context {
|
||||
|
||||
|
||||
extern void r200DestroyContext( __DRIcontext *driContextPriv );
|
||||
extern GLboolean r200CreateContext( const __GLcontextModes *glVisual,
|
||||
extern GLboolean r200CreateContext( gl_api api,
|
||||
const __GLcontextModes *glVisual,
|
||||
__DRIcontext *driContextPriv,
|
||||
void *sharedContextPrivate);
|
||||
extern GLboolean r200MakeCurrent( __DRIcontext *driContextPriv,
|
||||
|
@@ -472,7 +472,8 @@ static void r300InitIoctlFuncs(struct dd_function_table *functions)
|
||||
|
||||
/* Create the device specific rendering context.
|
||||
*/
|
||||
GLboolean r300CreateContext(const __GLcontextModes * glVisual,
|
||||
GLboolean r300CreateContext(gl_api api,
|
||||
const __GLcontextModes * glVisual,
|
||||
__DRIcontext * driContextPriv,
|
||||
void *sharedContextPrivate)
|
||||
{
|
||||
|
@@ -543,7 +543,8 @@ struct r300_context {
|
||||
#define R300_CONTEXT(ctx) ((r300ContextPtr)(ctx->DriverCtx))
|
||||
|
||||
extern void r300DestroyContext(__DRIcontext * driContextPriv);
|
||||
extern GLboolean r300CreateContext(const __GLcontextModes * glVisual,
|
||||
extern GLboolean r300CreateContext(gl_api api,
|
||||
const __GLcontextModes * glVisual,
|
||||
__DRIcontext * driContextPriv,
|
||||
void *sharedContextPrivate);
|
||||
|
||||
|
@@ -352,7 +352,8 @@ static void r600InitGLExtensions(GLcontext *ctx)
|
||||
|
||||
/* Create the device specific rendering context.
|
||||
*/
|
||||
GLboolean r600CreateContext(const __GLcontextModes * glVisual,
|
||||
GLboolean r600CreateContext(gl_api api,
|
||||
const __GLcontextModes * glVisual,
|
||||
__DRIcontext * driContextPriv,
|
||||
void *sharedContextPrivate)
|
||||
{
|
||||
|
@@ -155,7 +155,8 @@ struct r600_context {
|
||||
#define R700_CONTEXT(ctx) ((context_t *)(ctx->DriverCtx))
|
||||
#define GL_CONTEXT(context) ((GLcontext *)(context->radeon.glCtx))
|
||||
|
||||
extern GLboolean r600CreateContext(const __GLcontextModes * glVisual,
|
||||
extern GLboolean r600CreateContext(gl_api api,
|
||||
const __GLcontextModes * glVisual,
|
||||
__DRIcontext * driContextPriv,
|
||||
void *sharedContextPrivate);
|
||||
|
||||
|
@@ -205,9 +205,10 @@ static void r100_init_vtbl(radeonContextPtr radeon)
|
||||
/* Create the device specific context.
|
||||
*/
|
||||
GLboolean
|
||||
r100CreateContext( const __GLcontextModes *glVisual,
|
||||
__DRIcontext *driContextPriv,
|
||||
void *sharedContextPrivate)
|
||||
r100CreateContext( gl_api api,
|
||||
const __GLcontextModes *glVisual,
|
||||
__DRIcontext *driContextPriv,
|
||||
void *sharedContextPrivate)
|
||||
{
|
||||
__DRIscreen *sPriv = driContextPriv->driScreenPriv;
|
||||
radeonScreenPtr screen = (radeonScreenPtr)(sPriv->private);
|
||||
|
@@ -450,7 +450,8 @@ struct r100_context {
|
||||
|
||||
#define RADEON_OLD_PACKETS 1
|
||||
|
||||
extern GLboolean r100CreateContext( const __GLcontextModes *glVisual,
|
||||
extern GLboolean r100CreateContext( gl_api api,
|
||||
const __GLcontextModes *glVisual,
|
||||
__DRIcontext *driContextPriv,
|
||||
void *sharedContextPrivate);
|
||||
|
||||
|
@@ -288,7 +288,8 @@ savageDestroyScreen(__DRIscreen *sPriv)
|
||||
}
|
||||
|
||||
static GLboolean
|
||||
savageCreateContext( const __GLcontextModes *mesaVis,
|
||||
savageCreateContext( gl_api api,
|
||||
const __GLcontextModes *mesaVis,
|
||||
__DRIcontext *driContextPriv,
|
||||
void *sharedContextPrivate )
|
||||
{
|
||||
|
@@ -158,7 +158,8 @@ void sisReAllocateBuffers(GLcontext *ctx, GLframebuffer *drawbuffer,
|
||||
}
|
||||
|
||||
GLboolean
|
||||
sisCreateContext( const __GLcontextModes *glVisual,
|
||||
sisCreateContext( gl_api api,
|
||||
const __GLcontextModes *glVisual,
|
||||
__DRIcontext *driContextPriv,
|
||||
void *sharedContextPrivate )
|
||||
{
|
||||
|
@@ -438,7 +438,8 @@ enum _sis_verbose {
|
||||
VERBOSE_SIS_MEMORY = 0x2
|
||||
};
|
||||
|
||||
extern GLboolean sisCreateContext( const __GLcontextModes *glVisual,
|
||||
extern GLboolean sisCreateContext( gl_api api,
|
||||
const __GLcontextModes *glVisual,
|
||||
__DRIcontext *driContextPriv,
|
||||
void *sharedContextPrivate );
|
||||
extern void sisDestroyContext( __DRIcontext * );
|
||||
|
@@ -164,7 +164,8 @@ static const struct dri_debug_control debug_control[] =
|
||||
{ NULL, 0 }
|
||||
};
|
||||
|
||||
GLboolean tdfxCreateContext( const __GLcontextModes *mesaVis,
|
||||
GLboolean tdfxCreateContext( gl_api api,
|
||||
const __GLcontextModes *mesaVis,
|
||||
__DRIcontext *driContextPriv,
|
||||
void *sharedContextPrivate )
|
||||
{
|
||||
|
@@ -937,7 +937,8 @@ struct tdfx_context {
|
||||
|
||||
|
||||
extern GLboolean
|
||||
tdfxCreateContext( const __GLcontextModes *mesaVis,
|
||||
tdfxCreateContext( gl_api api,
|
||||
const __GLcontextModes *mesaVis,
|
||||
__DRIcontext *driContextPriv,
|
||||
void *sharedContextPrivate );
|
||||
|
||||
|
@@ -456,7 +456,8 @@ FreeBuffer(struct via_context *vmesa)
|
||||
|
||||
|
||||
GLboolean
|
||||
viaCreateContext(const __GLcontextModes *visual,
|
||||
viaCreateContext(gl_api api,
|
||||
const __GLcontextModes *visual,
|
||||
__DRIcontext *driContextPriv,
|
||||
void *sharedContextPrivate)
|
||||
{
|
||||
|
@@ -76,7 +76,8 @@ typedef struct {
|
||||
|
||||
|
||||
extern GLboolean
|
||||
viaCreateContext(const __GLcontextModes *mesaVis,
|
||||
viaCreateContext(gl_api api,
|
||||
const __GLcontextModes *mesaVis,
|
||||
__DRIcontext *driContextPriv,
|
||||
void *sharedContextPrivate);
|
||||
|
||||
|
@@ -1004,7 +1004,20 @@ new_osmesa_renderbuffer(GLcontext *ctx, GLenum format, GLenum type)
|
||||
rb->AllocStorage = osmesa_renderbuffer_storage;
|
||||
|
||||
rb->InternalFormat = GL_RGBA;
|
||||
rb->Format = MESA_FORMAT_RGBA8888;
|
||||
switch (type) {
|
||||
case GL_UNSIGNED_BYTE:
|
||||
rb->Format = MESA_FORMAT_RGBA8888;
|
||||
break;
|
||||
case GL_UNSIGNED_SHORT:
|
||||
rb->Format = MESA_FORMAT_SIGNED_RGBA_16;
|
||||
break;
|
||||
case GL_FLOAT:
|
||||
rb->Format = MESA_FORMAT_RGBA_FLOAT32;
|
||||
break;
|
||||
default:
|
||||
assert(0 && "Unexpected type in new_osmesa_renderbuffer()");
|
||||
rb->Format = MESA_FORMAT_RGBA8888;
|
||||
}
|
||||
rb->_BaseFormat = GL_RGBA;
|
||||
rb->DataType = type;
|
||||
}
|
||||
@@ -1167,11 +1180,9 @@ OSMesaCreateContextExt( GLenum format, GLint depthBits, GLint stencilBits,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* create front color buffer in user-provided memory (no back buffer) */
|
||||
osmesa->rb = new_osmesa_renderbuffer(&osmesa->mesa, format, type);
|
||||
_mesa_add_renderbuffer(osmesa->gl_buffer, BUFFER_FRONT_LEFT, osmesa->rb);
|
||||
assert(osmesa->rb->RefCount == 2);
|
||||
|
||||
/* Create depth/stencil/accum buffers. We'll create the color
|
||||
* buffer later in OSMesaMakeCurrent().
|
||||
*/
|
||||
_mesa_add_soft_renderbuffers(osmesa->gl_buffer,
|
||||
GL_FALSE, /* color */
|
||||
osmesa->gl_visual->haveDepthBuffer,
|
||||
@@ -1308,11 +1319,23 @@ OSMesaMakeCurrent( OSMesaContext osmesa, void *buffer, GLenum type,
|
||||
*/
|
||||
_glapi_check_multithread();
|
||||
|
||||
|
||||
/* Create a front/left color buffer which wraps the user-provided buffer.
|
||||
* There is no back color buffer.
|
||||
* If the user tries to use a 8, 16 or 32-bit/channel buffer that
|
||||
* doesn't match what Mesa was compiled for (CHAN_BITS) the
|
||||
* _mesa_add_renderbuffer() function will create a "wrapper" renderbuffer
|
||||
* that converts rendering from CHAN_BITS to the user-requested channel
|
||||
* size.
|
||||
*/
|
||||
osmesa->rb = new_osmesa_renderbuffer(&osmesa->mesa, osmesa->format, type);
|
||||
_mesa_add_renderbuffer(osmesa->gl_buffer, BUFFER_FRONT_LEFT, osmesa->rb);
|
||||
assert(osmesa->rb->RefCount == 2);
|
||||
|
||||
/* Set renderbuffer fields. Set width/height = 0 to force
|
||||
* osmesa_renderbuffer_storage() being called by _mesa_resize_framebuffer()
|
||||
*/
|
||||
osmesa->rb->Data = buffer;
|
||||
osmesa->rb->DataType = type;
|
||||
osmesa->rb->Width = osmesa->rb->Height = 0;
|
||||
|
||||
/* Set the framebuffer's size. This causes the
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user