Merge remote branch 'origin/master' into radeon-rewrite
This commit is contained in:
+5
-2
@@ -66,8 +66,11 @@ if [ $# -ge 2 ] ; then
|
||||
|
||||
elif [ -f "$FILE" ] ; then
|
||||
#echo "$FILE" is a regular file
|
||||
$RM "$DEST/`basename $FILE`"
|
||||
cp "$FILE" "$DEST"
|
||||
# Only copy if the files differ
|
||||
if ! cmp -s $FILE $DEST/`basename $FILE`; then
|
||||
$RM "$DEST/`basename $FILE`"
|
||||
cp "$FILE" "$DEST"
|
||||
fi
|
||||
if [ $MODE ] ; then
|
||||
FILE=`basename "$FILE"`
|
||||
chmod $MODE "$DEST/$FILE"
|
||||
|
||||
@@ -55,7 +55,7 @@ def AddOptions(opts):
|
||||
from SCons.Options.EnumOption import EnumOption
|
||||
opts.Add(BoolOption('debug', 'debug build', 'no'))
|
||||
opts.Add(BoolOption('profile', 'profile build', 'no'))
|
||||
#opts.Add(BoolOption('quiet', 'quiet command lines', 'no'))
|
||||
opts.Add(BoolOption('quiet', 'quiet command lines', 'yes'))
|
||||
opts.Add(EnumOption('machine', 'use machine-specific assembly code', default_machine,
|
||||
allowed_values=('generic', 'ppc', 'x86', 'x86_64')))
|
||||
opts.Add(EnumOption('platform', 'target platform', default_platform,
|
||||
|
||||
@@ -33,6 +33,7 @@ SHELL = @SHELL@
|
||||
MKLIB_OPTIONS = @MKLIB_OPTIONS@
|
||||
MKDEP = @MKDEP@
|
||||
MKDEP_OPTIONS = @MKDEP_OPTIONS@
|
||||
INSTALL = @INSTALL@
|
||||
|
||||
# Python and flags (generally only needed by the developers)
|
||||
PYTHON2 = python
|
||||
|
||||
+5
-2
@@ -36,7 +36,10 @@ MKLIB_OPTIONS =
|
||||
MKDEP = makedepend
|
||||
MKDEP_OPTIONS = -fdepend
|
||||
MAKE = make
|
||||
INSTALL = $(SHELL) $(TOP)/bin/minstall
|
||||
|
||||
# Use MINSTALL for installing libraries, INSTALL for everything else
|
||||
MINSTALL = $(SHELL) $(TOP)/bin/minstall
|
||||
INSTALL = $(MINSTALL)
|
||||
|
||||
# Tools for regenerating glapi (generally only needed by the developers)
|
||||
PYTHON2 = python
|
||||
@@ -90,7 +93,7 @@ EGL_DRIVERS_DIRS = demo
|
||||
|
||||
# Gallium directories and
|
||||
GALLIUM_DIRS = auxiliary drivers state_trackers
|
||||
GALLIUM_AUXILIARY_DIRS = draw translate cso_cache pipebuffer tgsi sct rtasm util indices
|
||||
GALLIUM_AUXILIARY_DIRS = rbug draw translate cso_cache pipebuffer tgsi sct rtasm util indices
|
||||
GALLIUM_AUXILIARIES = $(foreach DIR,$(GALLIUM_AUXILIARY_DIRS),$(TOP)/src/gallium/auxiliary/$(DIR)/lib$(DIR).a)
|
||||
GALLIUM_DRIVERS_DIRS = softpipe i915simple failover trace
|
||||
GALLIUM_DRIVERS = $(foreach DIR,$(GALLIUM_DRIVERS_DIRS),$(TOP)/src/gallium/drivers/$(DIR)/lib$(DIR).a)
|
||||
|
||||
+9
-7
@@ -29,6 +29,11 @@ AC_CHECK_PROGS([MAKE], [gmake make])
|
||||
AC_PATH_PROG([MKDEP], [makedepend])
|
||||
AC_PATH_PROG([SED], [sed])
|
||||
|
||||
dnl Our fallback install-sh is a symlink to minstall. Use the existing
|
||||
dnl configuration in that case.
|
||||
AC_PROG_INSTALL
|
||||
test "x$INSTALL" = "x$ac_install_sh" && INSTALL='$(MINSTALL)'
|
||||
|
||||
dnl We need a POSIX shell for parts of the build. Assume we have one
|
||||
dnl in most cases.
|
||||
case "$host_os" in
|
||||
@@ -409,7 +414,7 @@ WINDOW_SYSTEM=""
|
||||
GALLIUM_DIRS="auxiliary drivers state_trackers"
|
||||
GALLIUM_WINSYS_DIRS=""
|
||||
GALLIUM_WINSYS_DRM_DIRS=""
|
||||
GALLIUM_AUXILIARY_DIRS="draw translate cso_cache pipebuffer tgsi sct rtasm util indices"
|
||||
GALLIUM_AUXILIARY_DIRS="rbug draw translate cso_cache pipebuffer tgsi sct rtasm util indices"
|
||||
GALLIUM_DRIVERS_DIRS="softpipe failover trace"
|
||||
GALLIUM_STATE_TRACKERS_DIRS=""
|
||||
|
||||
@@ -835,12 +840,12 @@ case "$mesa_driver" in
|
||||
osmesa)
|
||||
# only link libraries with osmesa if shared
|
||||
if test "$enable_static" = no; then
|
||||
OSMESA_LIB_DEPS="-lm -lpthread $SELINUX_LIBS"
|
||||
OSMESA_LIB_DEPS="-lm -lpthread $SELINUX_LIBS $DLOPEN_LIBS"
|
||||
else
|
||||
OSMESA_LIB_DEPS=""
|
||||
fi
|
||||
OSMESA_MESA_DEPS=""
|
||||
OSMESA_PC_LIB_PRIV="-lm -lpthread $SELINUX_LIBS"
|
||||
OSMESA_PC_LIB_PRIV="-lm -lpthread $SELINUX_LIBS $DLOPEN_LIBS"
|
||||
;;
|
||||
*)
|
||||
# Link OSMesa to libGL otherwise
|
||||
@@ -854,9 +859,6 @@ osmesa)
|
||||
OSMESA_PC_REQ="gl"
|
||||
;;
|
||||
esac
|
||||
if test "$enable_static" = no; then
|
||||
OSMESA_LIB_DEPS="$OSMESA_LIB_DEPS"
|
||||
fi
|
||||
OSMESA_PC_LIB_PRIV="$OSMESA_PC_LIB_PRIV"
|
||||
AC_SUBST([OSMESA_LIB_DEPS])
|
||||
AC_SUBST([OSMESA_MESA_DEPS])
|
||||
@@ -1188,7 +1190,7 @@ AC_ARG_ENABLE([gallium-nouveau],
|
||||
[enable_gallium_nouveau=no])
|
||||
if test "x$enable_gallium_nouveau" = xyes; then
|
||||
GALLIUM_WINSYS_DRM_DIRS="$GALLIUM_WINSYS_DRM_DIRS nouveau"
|
||||
GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS nv04 nv10 nv20 nv30 nv40 nv50"
|
||||
GALLIUM_DRIVERS_DIRS="$GALLIUM_DRIVERS_DIRS nouveau nv04 nv10 nv20 nv30 nv40 nv50"
|
||||
fi
|
||||
|
||||
|
||||
|
||||
@@ -24,13 +24,6 @@ Some drivers don't support all the features required in OpenGL 2.1.
|
||||
See the <a href="install.html">Compiling/Installing page</a> for prerequisites
|
||||
for DRI hardware acceleration.
|
||||
</p>
|
||||
<p>
|
||||
Note that the Mesa project is no longer using odd/even version numbers
|
||||
to indicate development/stable releases.
|
||||
The so-called development releases have been fairly stable.
|
||||
If you're especially concerned with stability you should probably look for
|
||||
"point" releases such as 7.5.1 which will be a bug-fix release.
|
||||
</p>
|
||||
|
||||
|
||||
<h2>MD5 checksums</h2>
|
||||
@@ -44,6 +37,7 @@ tbd
|
||||
<li><a href="openvg.html">OpenVG</a> front-end (state tracker for Gallium).
|
||||
This was written by Zack Rusin at Tungsten Graphics.
|
||||
<li>GL_APPLE_vertex_array_object for Gallium drivers and Intel DRI drivers.
|
||||
<li>GL_ARB_copy_buffer extension (supported in Gallium and swrast drivers)
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
+2
-83
@@ -1,8 +1,9 @@
|
||||
/*
|
||||
* Mesa 3-D graphics library
|
||||
* Version: 7.5
|
||||
* Version: 7.6
|
||||
*
|
||||
* Copyright (C) 1999-2006 Brian Paul All Rights Reserved.
|
||||
* Copyright (C) 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"),
|
||||
@@ -1739,41 +1740,6 @@ GLAPI void GLAPIENTRY glSeparableFilter2D( GLenum target,
|
||||
GLAPI void GLAPIENTRY glGetSeparableFilter( GLenum target, GLenum format,
|
||||
GLenum type, GLvoid *row, GLvoid *column, GLvoid *span );
|
||||
|
||||
typedef void (APIENTRYP PFNGLBLENDCOLORPROC) (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);
|
||||
typedef void (APIENTRYP PFNGLBLENDEQUATIONPROC) (GLenum mode);
|
||||
typedef void (APIENTRYP PFNGLCOLORTABLEPROC) (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *table);
|
||||
typedef void (APIENTRYP PFNGLCOLORTABLEPARAMETERFVPROC) (GLenum target, GLenum pname, const GLfloat *params);
|
||||
typedef void (APIENTRYP PFNGLCOLORTABLEPARAMETERIVPROC) (GLenum target, GLenum pname, const GLint *params);
|
||||
typedef void (APIENTRYP PFNGLCOPYCOLORTABLEPROC) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width);
|
||||
typedef void (APIENTRYP PFNGLGETCOLORTABLEPROC) (GLenum target, GLenum format, GLenum type, GLvoid *table);
|
||||
typedef void (APIENTRYP PFNGLGETCOLORTABLEPARAMETERFVPROC) (GLenum target, GLenum pname, GLfloat *params);
|
||||
typedef void (APIENTRYP PFNGLGETCOLORTABLEPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params);
|
||||
typedef void (APIENTRYP PFNGLCOLORSUBTABLEPROC) (GLenum target, GLsizei start, GLsizei count, GLenum format, GLenum type, const GLvoid *data);
|
||||
typedef void (APIENTRYP PFNGLCOPYCOLORSUBTABLEPROC) (GLenum target, GLsizei start, GLint x, GLint y, GLsizei width);
|
||||
typedef void (APIENTRYP PFNGLCONVOLUTIONFILTER1DPROC) (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *image);
|
||||
typedef void (APIENTRYP PFNGLCONVOLUTIONFILTER2DPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *image);
|
||||
typedef void (APIENTRYP PFNGLCONVOLUTIONPARAMETERFPROC) (GLenum target, GLenum pname, GLfloat params);
|
||||
typedef void (APIENTRYP PFNGLCONVOLUTIONPARAMETERFVPROC) (GLenum target, GLenum pname, const GLfloat *params);
|
||||
typedef void (APIENTRYP PFNGLCONVOLUTIONPARAMETERIPROC) (GLenum target, GLenum pname, GLint params);
|
||||
typedef void (APIENTRYP PFNGLCONVOLUTIONPARAMETERIVPROC) (GLenum target, GLenum pname, const GLint *params);
|
||||
typedef void (APIENTRYP PFNGLCOPYCONVOLUTIONFILTER1DPROC) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width);
|
||||
typedef void (APIENTRYP PFNGLCOPYCONVOLUTIONFILTER2DPROC) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height);
|
||||
typedef void (APIENTRYP PFNGLGETCONVOLUTIONFILTERPROC) (GLenum target, GLenum format, GLenum type, GLvoid *image);
|
||||
typedef void (APIENTRYP PFNGLGETCONVOLUTIONPARAMETERFVPROC) (GLenum target, GLenum pname, GLfloat *params);
|
||||
typedef void (APIENTRYP PFNGLGETCONVOLUTIONPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params);
|
||||
typedef void (APIENTRYP PFNGLGETSEPARABLEFILTERPROC) (GLenum target, GLenum format, GLenum type, GLvoid *row, GLvoid *column, GLvoid *span);
|
||||
typedef void (APIENTRYP PFNGLSEPARABLEFILTER2DPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *row, const GLvoid *column);
|
||||
typedef void (APIENTRYP PFNGLGETHISTOGRAMPROC) (GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values);
|
||||
typedef void (APIENTRYP PFNGLGETHISTOGRAMPARAMETERFVPROC) (GLenum target, GLenum pname, GLfloat *params);
|
||||
typedef void (APIENTRYP PFNGLGETHISTOGRAMPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params);
|
||||
typedef void (APIENTRYP PFNGLGETMINMAXPROC) (GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values);
|
||||
typedef void (APIENTRYP PFNGLGETMINMAXPARAMETERFVPROC) (GLenum target, GLenum pname, GLfloat *params);
|
||||
typedef void (APIENTRYP PFNGLGETMINMAXPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params);
|
||||
typedef void (APIENTRYP PFNGLHISTOGRAMPROC) (GLenum target, GLsizei width, GLenum internalformat, GLboolean sink);
|
||||
typedef void (APIENTRYP PFNGLMINMAXPROC) (GLenum target, GLenum internalformat, GLboolean sink);
|
||||
typedef void (APIENTRYP PFNGLRESETHISTOGRAMPROC) (GLenum target);
|
||||
typedef void (APIENTRYP PFNGLRESETMINMAXPROC) (GLenum target);
|
||||
|
||||
|
||||
|
||||
/*
|
||||
@@ -1978,53 +1944,6 @@ GLAPI void GLAPIENTRY glMultTransposeMatrixf( const GLfloat m[16] );
|
||||
|
||||
GLAPI void GLAPIENTRY glSampleCoverage( GLclampf value, GLboolean invert );
|
||||
|
||||
typedef void (APIENTRYP PFNGLACTIVETEXTUREPROC) (GLenum texture);
|
||||
typedef void (APIENTRYP PFNGLCLIENTACTIVETEXTUREPROC) (GLenum texture);
|
||||
typedef void (APIENTRYP PFNGLMULTITEXCOORD1DPROC) (GLenum target, GLdouble s);
|
||||
typedef void (APIENTRYP PFNGLMULTITEXCOORD1DVPROC) (GLenum target, const GLdouble *v);
|
||||
typedef void (APIENTRYP PFNGLMULTITEXCOORD1FPROC) (GLenum target, GLfloat s);
|
||||
typedef void (APIENTRYP PFNGLMULTITEXCOORD1FVPROC) (GLenum target, const GLfloat *v);
|
||||
typedef void (APIENTRYP PFNGLMULTITEXCOORD1IPROC) (GLenum target, GLint s);
|
||||
typedef void (APIENTRYP PFNGLMULTITEXCOORD1IVPROC) (GLenum target, const GLint *v);
|
||||
typedef void (APIENTRYP PFNGLMULTITEXCOORD1SPROC) (GLenum target, GLshort s);
|
||||
typedef void (APIENTRYP PFNGLMULTITEXCOORD1SVPROC) (GLenum target, const GLshort *v);
|
||||
typedef void (APIENTRYP PFNGLMULTITEXCOORD2DPROC) (GLenum target, GLdouble s, GLdouble t);
|
||||
typedef void (APIENTRYP PFNGLMULTITEXCOORD2DVPROC) (GLenum target, const GLdouble *v);
|
||||
typedef void (APIENTRYP PFNGLMULTITEXCOORD2FPROC) (GLenum target, GLfloat s, GLfloat t);
|
||||
typedef void (APIENTRYP PFNGLMULTITEXCOORD2FVPROC) (GLenum target, const GLfloat *v);
|
||||
typedef void (APIENTRYP PFNGLMULTITEXCOORD2IPROC) (GLenum target, GLint s, GLint t);
|
||||
typedef void (APIENTRYP PFNGLMULTITEXCOORD2IVPROC) (GLenum target, const GLint *v);
|
||||
typedef void (APIENTRYP PFNGLMULTITEXCOORD2SPROC) (GLenum target, GLshort s, GLshort t);
|
||||
typedef void (APIENTRYP PFNGLMULTITEXCOORD2SVPROC) (GLenum target, const GLshort *v);
|
||||
typedef void (APIENTRYP PFNGLMULTITEXCOORD3DPROC) (GLenum target, GLdouble s, GLdouble t, GLdouble r);
|
||||
typedef void (APIENTRYP PFNGLMULTITEXCOORD3DVPROC) (GLenum target, const GLdouble *v);
|
||||
typedef void (APIENTRYP PFNGLMULTITEXCOORD3FPROC) (GLenum target, GLfloat s, GLfloat t, GLfloat r);
|
||||
typedef void (APIENTRYP PFNGLMULTITEXCOORD3FVPROC) (GLenum target, const GLfloat *v);
|
||||
typedef void (APIENTRYP PFNGLMULTITEXCOORD3IPROC) (GLenum target, GLint s, GLint t, GLint r);
|
||||
typedef void (APIENTRYP PFNGLMULTITEXCOORD3IVPROC) (GLenum target, const GLint *v);
|
||||
typedef void (APIENTRYP PFNGLMULTITEXCOORD3SPROC) (GLenum target, GLshort s, GLshort t, GLshort r);
|
||||
typedef void (APIENTRYP PFNGLMULTITEXCOORD3SVPROC) (GLenum target, const GLshort *v);
|
||||
typedef void (APIENTRYP PFNGLMULTITEXCOORD4DPROC) (GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q);
|
||||
typedef void (APIENTRYP PFNGLMULTITEXCOORD4DVPROC) (GLenum target, const GLdouble *v);
|
||||
typedef void (APIENTRYP PFNGLMULTITEXCOORD4FPROC) (GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q);
|
||||
typedef void (APIENTRYP PFNGLMULTITEXCOORD4FVPROC) (GLenum target, const GLfloat *v);
|
||||
typedef void (APIENTRYP PFNGLMULTITEXCOORD4IPROC) (GLenum target, GLint s, GLint t, GLint r, GLint q);
|
||||
typedef void (APIENTRYP PFNGLMULTITEXCOORD4IVPROC) (GLenum target, const GLint *v);
|
||||
typedef void (APIENTRYP PFNGLMULTITEXCOORD4SPROC) (GLenum target, GLshort s, GLshort t, GLshort r, GLshort q);
|
||||
typedef void (APIENTRYP PFNGLMULTITEXCOORD4SVPROC) (GLenum target, const GLshort *v);
|
||||
typedef void (APIENTRYP PFNGLLOADTRANSPOSEMATRIXFPROC) (const GLfloat *m);
|
||||
typedef void (APIENTRYP PFNGLLOADTRANSPOSEMATRIXDPROC) (const GLdouble *m);
|
||||
typedef void (APIENTRYP PFNGLMULTTRANSPOSEMATRIXFPROC) (const GLfloat *m);
|
||||
typedef void (APIENTRYP PFNGLMULTTRANSPOSEMATRIXDPROC) (const GLdouble *m);
|
||||
typedef void (APIENTRYP PFNGLSAMPLECOVERAGEPROC) (GLclampf value, GLboolean invert);
|
||||
typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE3DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data);
|
||||
typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE2DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data);
|
||||
typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE1DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *data);
|
||||
typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *data);
|
||||
typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data);
|
||||
typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE1DPROC) (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *data);
|
||||
typedef void (APIENTRYP PFNGLGETCOMPRESSEDTEXIMAGEPROC) (GLenum target, GLint level, void *img);
|
||||
|
||||
|
||||
/*
|
||||
* GL_ARB_multitexture (ARB extension 1 and OpenGL 1.2.1)
|
||||
|
||||
+308
-180
@@ -6,7 +6,7 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
** Copyright (c) 2007 The Khronos Group Inc.
|
||||
** Copyright (c) 2007-2009 The Khronos Group Inc.
|
||||
**
|
||||
** Permission is hereby granted, free of charge, to any person obtaining a
|
||||
** copy of this software and/or associated documentation files (the
|
||||
@@ -28,6 +28,13 @@ extern "C" {
|
||||
** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
|
||||
*/
|
||||
|
||||
/* Header file version number, required by OpenGL ABI for Linux */
|
||||
/* glext.h last updated $Date: 2009-05-05 15:27:42 -0700 (Tue, 05 May 2009) $ */
|
||||
/* Current version at http://www.opengl.org/registry/ */
|
||||
#define GL_GLEXT_VERSION 52
|
||||
|
||||
/* Function declaration macros - to move into glplatform.h */
|
||||
|
||||
#if defined(_WIN32) && !defined(APIENTRY) && !defined(__CYGWIN__) && !defined(__SCITECH_SNAP__)
|
||||
#define WIN32_LEAN_AND_MEAN 1
|
||||
#include <windows.h>
|
||||
@@ -45,18 +52,12 @@ extern "C" {
|
||||
|
||||
/*************************************************************/
|
||||
|
||||
/* Header file version number, required by OpenGL ABI for Linux */
|
||||
/* glext.h last updated 2009/03/19 */
|
||||
/* Current version at http://www.opengl.org/registry/ */
|
||||
#define GL_GLEXT_VERSION 48
|
||||
|
||||
#ifndef GL_VERSION_1_2
|
||||
#define GL_UNSIGNED_BYTE_3_3_2 0x8032
|
||||
#define GL_UNSIGNED_SHORT_4_4_4_4 0x8033
|
||||
#define GL_UNSIGNED_SHORT_5_5_5_1 0x8034
|
||||
#define GL_UNSIGNED_INT_8_8_8_8 0x8035
|
||||
#define GL_UNSIGNED_INT_10_10_10_2 0x8036
|
||||
#define GL_RESCALE_NORMAL 0x803A
|
||||
#define GL_TEXTURE_BINDING_3D 0x806A
|
||||
#define GL_PACK_SKIP_IMAGES 0x806B
|
||||
#define GL_PACK_IMAGE_HEIGHT 0x806C
|
||||
@@ -83,17 +84,21 @@ extern "C" {
|
||||
#define GL_TEXTURE_MAX_LOD 0x813B
|
||||
#define GL_TEXTURE_BASE_LEVEL 0x813C
|
||||
#define GL_TEXTURE_MAX_LEVEL 0x813D
|
||||
#define GL_LIGHT_MODEL_COLOR_CONTROL 0x81F8
|
||||
#define GL_SINGLE_COLOR 0x81F9
|
||||
#define GL_SEPARATE_SPECULAR_COLOR 0x81FA
|
||||
#define GL_SMOOTH_POINT_SIZE_RANGE 0x0B12
|
||||
#define GL_SMOOTH_POINT_SIZE_GRANULARITY 0x0B13
|
||||
#define GL_SMOOTH_LINE_WIDTH_RANGE 0x0B22
|
||||
#define GL_SMOOTH_LINE_WIDTH_GRANULARITY 0x0B23
|
||||
#define GL_ALIASED_POINT_SIZE_RANGE 0x846D
|
||||
#define GL_ALIASED_LINE_WIDTH_RANGE 0x846E
|
||||
#endif
|
||||
|
||||
#ifndef GL_VERSION_1_2_DEPRECATED
|
||||
#define GL_RESCALE_NORMAL 0x803A
|
||||
#define GL_LIGHT_MODEL_COLOR_CONTROL 0x81F8
|
||||
#define GL_SINGLE_COLOR 0x81F9
|
||||
#define GL_SEPARATE_SPECULAR_COLOR 0x81FA
|
||||
#define GL_ALIASED_POINT_SIZE_RANGE 0x846D
|
||||
#endif
|
||||
|
||||
#ifndef GL_ARB_imaging
|
||||
#define GL_CONSTANT_COLOR 0x8001
|
||||
#define GL_ONE_MINUS_CONSTANT_COLOR 0x8002
|
||||
@@ -106,6 +111,9 @@ extern "C" {
|
||||
#define GL_BLEND_EQUATION 0x8009
|
||||
#define GL_FUNC_SUBTRACT 0x800A
|
||||
#define GL_FUNC_REVERSE_SUBTRACT 0x800B
|
||||
#endif
|
||||
|
||||
#ifndef GL_ARB_imaging_DEPRECATED
|
||||
#define GL_CONVOLUTION_1D 0x8010
|
||||
#define GL_CONVOLUTION_2D 0x8011
|
||||
#define GL_SEPARABLE_2D 0x8012
|
||||
@@ -206,12 +214,6 @@ extern "C" {
|
||||
#define GL_TEXTURE30 0x84DE
|
||||
#define GL_TEXTURE31 0x84DF
|
||||
#define GL_ACTIVE_TEXTURE 0x84E0
|
||||
#define GL_CLIENT_ACTIVE_TEXTURE 0x84E1
|
||||
#define GL_MAX_TEXTURE_UNITS 0x84E2
|
||||
#define GL_TRANSPOSE_MODELVIEW_MATRIX 0x84E3
|
||||
#define GL_TRANSPOSE_PROJECTION_MATRIX 0x84E4
|
||||
#define GL_TRANSPOSE_TEXTURE_MATRIX 0x84E5
|
||||
#define GL_TRANSPOSE_COLOR_MATRIX 0x84E6
|
||||
#define GL_MULTISAMPLE 0x809D
|
||||
#define GL_SAMPLE_ALPHA_TO_COVERAGE 0x809E
|
||||
#define GL_SAMPLE_ALPHA_TO_ONE 0x809F
|
||||
@@ -220,9 +222,6 @@ extern "C" {
|
||||
#define GL_SAMPLES 0x80A9
|
||||
#define GL_SAMPLE_COVERAGE_VALUE 0x80AA
|
||||
#define GL_SAMPLE_COVERAGE_INVERT 0x80AB
|
||||
#define GL_MULTISAMPLE_BIT 0x20000000
|
||||
#define GL_NORMAL_MAP 0x8511
|
||||
#define GL_REFLECTION_MAP 0x8512
|
||||
#define GL_TEXTURE_CUBE_MAP 0x8513
|
||||
#define GL_TEXTURE_BINDING_CUBE_MAP 0x8514
|
||||
#define GL_TEXTURE_CUBE_MAP_POSITIVE_X 0x8515
|
||||
@@ -233,10 +232,6 @@ extern "C" {
|
||||
#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z 0x851A
|
||||
#define GL_PROXY_TEXTURE_CUBE_MAP 0x851B
|
||||
#define GL_MAX_CUBE_MAP_TEXTURE_SIZE 0x851C
|
||||
#define GL_COMPRESSED_ALPHA 0x84E9
|
||||
#define GL_COMPRESSED_LUMINANCE 0x84EA
|
||||
#define GL_COMPRESSED_LUMINANCE_ALPHA 0x84EB
|
||||
#define GL_COMPRESSED_INTENSITY 0x84EC
|
||||
#define GL_COMPRESSED_RGB 0x84ED
|
||||
#define GL_COMPRESSED_RGBA 0x84EE
|
||||
#define GL_TEXTURE_COMPRESSION_HINT 0x84EF
|
||||
@@ -245,6 +240,22 @@ extern "C" {
|
||||
#define GL_NUM_COMPRESSED_TEXTURE_FORMATS 0x86A2
|
||||
#define GL_COMPRESSED_TEXTURE_FORMATS 0x86A3
|
||||
#define GL_CLAMP_TO_BORDER 0x812D
|
||||
#endif
|
||||
|
||||
#ifndef GL_VERSION_1_3_DEPRECATED
|
||||
#define GL_CLIENT_ACTIVE_TEXTURE 0x84E1
|
||||
#define GL_MAX_TEXTURE_UNITS 0x84E2
|
||||
#define GL_TRANSPOSE_MODELVIEW_MATRIX 0x84E3
|
||||
#define GL_TRANSPOSE_PROJECTION_MATRIX 0x84E4
|
||||
#define GL_TRANSPOSE_TEXTURE_MATRIX 0x84E5
|
||||
#define GL_TRANSPOSE_COLOR_MATRIX 0x84E6
|
||||
#define GL_MULTISAMPLE_BIT 0x20000000
|
||||
#define GL_NORMAL_MAP 0x8511
|
||||
#define GL_REFLECTION_MAP 0x8512
|
||||
#define GL_COMPRESSED_ALPHA 0x84E9
|
||||
#define GL_COMPRESSED_LUMINANCE 0x84EA
|
||||
#define GL_COMPRESSED_LUMINANCE_ALPHA 0x84EB
|
||||
#define GL_COMPRESSED_INTENSITY 0x84EC
|
||||
#define GL_COMBINE 0x8570
|
||||
#define GL_COMBINE_RGB 0x8571
|
||||
#define GL_COMBINE_ALPHA 0x8572
|
||||
@@ -276,16 +287,26 @@ extern "C" {
|
||||
#define GL_BLEND_SRC_RGB 0x80C9
|
||||
#define GL_BLEND_DST_ALPHA 0x80CA
|
||||
#define GL_BLEND_SRC_ALPHA 0x80CB
|
||||
#define GL_POINT_SIZE_MIN 0x8126
|
||||
#define GL_POINT_SIZE_MAX 0x8127
|
||||
#define GL_POINT_FADE_THRESHOLD_SIZE 0x8128
|
||||
#define GL_POINT_DISTANCE_ATTENUATION 0x8129
|
||||
#define GL_GENERATE_MIPMAP 0x8191
|
||||
#define GL_GENERATE_MIPMAP_HINT 0x8192
|
||||
#define GL_DEPTH_COMPONENT16 0x81A5
|
||||
#define GL_DEPTH_COMPONENT24 0x81A6
|
||||
#define GL_DEPTH_COMPONENT32 0x81A7
|
||||
#define GL_MIRRORED_REPEAT 0x8370
|
||||
#define GL_MAX_TEXTURE_LOD_BIAS 0x84FD
|
||||
#define GL_TEXTURE_LOD_BIAS 0x8501
|
||||
#define GL_INCR_WRAP 0x8507
|
||||
#define GL_DECR_WRAP 0x8508
|
||||
#define GL_TEXTURE_DEPTH_SIZE 0x884A
|
||||
#define GL_TEXTURE_COMPARE_MODE 0x884C
|
||||
#define GL_TEXTURE_COMPARE_FUNC 0x884D
|
||||
#endif
|
||||
|
||||
#ifndef GL_VERSION_1_4_DEPRECATED
|
||||
#define GL_POINT_SIZE_MIN 0x8126
|
||||
#define GL_POINT_SIZE_MAX 0x8127
|
||||
#define GL_POINT_DISTANCE_ATTENUATION 0x8129
|
||||
#define GL_GENERATE_MIPMAP 0x8191
|
||||
#define GL_GENERATE_MIPMAP_HINT 0x8192
|
||||
#define GL_FOG_COORDINATE_SOURCE 0x8450
|
||||
#define GL_FOG_COORDINATE 0x8451
|
||||
#define GL_FRAGMENT_DEPTH 0x8452
|
||||
@@ -301,15 +322,8 @@ extern "C" {
|
||||
#define GL_SECONDARY_COLOR_ARRAY_STRIDE 0x845C
|
||||
#define GL_SECONDARY_COLOR_ARRAY_POINTER 0x845D
|
||||
#define GL_SECONDARY_COLOR_ARRAY 0x845E
|
||||
#define GL_MAX_TEXTURE_LOD_BIAS 0x84FD
|
||||
#define GL_TEXTURE_FILTER_CONTROL 0x8500
|
||||
#define GL_TEXTURE_LOD_BIAS 0x8501
|
||||
#define GL_INCR_WRAP 0x8507
|
||||
#define GL_DECR_WRAP 0x8508
|
||||
#define GL_TEXTURE_DEPTH_SIZE 0x884A
|
||||
#define GL_DEPTH_TEXTURE_MODE 0x884B
|
||||
#define GL_TEXTURE_COMPARE_MODE 0x884C
|
||||
#define GL_TEXTURE_COMPARE_FUNC 0x884D
|
||||
#define GL_COMPARE_R_TO_TEXTURE 0x884E
|
||||
#endif
|
||||
|
||||
@@ -324,15 +338,6 @@ extern "C" {
|
||||
#define GL_ELEMENT_ARRAY_BUFFER 0x8893
|
||||
#define GL_ARRAY_BUFFER_BINDING 0x8894
|
||||
#define GL_ELEMENT_ARRAY_BUFFER_BINDING 0x8895
|
||||
#define GL_VERTEX_ARRAY_BUFFER_BINDING 0x8896
|
||||
#define GL_NORMAL_ARRAY_BUFFER_BINDING 0x8897
|
||||
#define GL_COLOR_ARRAY_BUFFER_BINDING 0x8898
|
||||
#define GL_INDEX_ARRAY_BUFFER_BINDING 0x8899
|
||||
#define GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING 0x889A
|
||||
#define GL_EDGE_FLAG_ARRAY_BUFFER_BINDING 0x889B
|
||||
#define GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING 0x889C
|
||||
#define GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING 0x889D
|
||||
#define GL_WEIGHT_ARRAY_BUFFER_BINDING 0x889E
|
||||
#define GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING 0x889F
|
||||
#define GL_READ_ONLY 0x88B8
|
||||
#define GL_WRITE_ONLY 0x88B9
|
||||
@@ -350,31 +355,42 @@ extern "C" {
|
||||
#define GL_DYNAMIC_READ 0x88E9
|
||||
#define GL_DYNAMIC_COPY 0x88EA
|
||||
#define GL_SAMPLES_PASSED 0x8914
|
||||
#define GL_FOG_COORD_SRC GL_FOG_COORDINATE_SOURCE
|
||||
#define GL_FOG_COORD GL_FOG_COORDINATE
|
||||
#define GL_CURRENT_FOG_COORD GL_CURRENT_FOG_COORDINATE
|
||||
#define GL_FOG_COORD_ARRAY_TYPE GL_FOG_COORDINATE_ARRAY_TYPE
|
||||
#define GL_FOG_COORD_ARRAY_STRIDE GL_FOG_COORDINATE_ARRAY_STRIDE
|
||||
#define GL_FOG_COORD_ARRAY_POINTER GL_FOG_COORDINATE_ARRAY_POINTER
|
||||
#define GL_FOG_COORD_ARRAY GL_FOG_COORDINATE_ARRAY
|
||||
#define GL_FOG_COORD_ARRAY_BUFFER_BINDING GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING
|
||||
#define GL_SRC0_RGB GL_SOURCE0_RGB
|
||||
#define GL_SRC1_RGB GL_SOURCE1_RGB
|
||||
#define GL_SRC2_RGB GL_SOURCE2_RGB
|
||||
#define GL_SRC0_ALPHA GL_SOURCE0_ALPHA
|
||||
#define GL_SRC1_ALPHA GL_SOURCE1_ALPHA
|
||||
#define GL_SRC2_ALPHA GL_SOURCE2_ALPHA
|
||||
#endif
|
||||
|
||||
#ifndef GL_VERSION_1_5_DEPRECATED
|
||||
#define GL_VERTEX_ARRAY_BUFFER_BINDING 0x8896
|
||||
#define GL_NORMAL_ARRAY_BUFFER_BINDING 0x8897
|
||||
#define GL_COLOR_ARRAY_BUFFER_BINDING 0x8898
|
||||
#define GL_INDEX_ARRAY_BUFFER_BINDING 0x8899
|
||||
#define GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING 0x889A
|
||||
#define GL_EDGE_FLAG_ARRAY_BUFFER_BINDING 0x889B
|
||||
#define GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING 0x889C
|
||||
#define GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING 0x889D
|
||||
#define GL_WEIGHT_ARRAY_BUFFER_BINDING 0x889E
|
||||
#define GL_FOG_COORD_SRC 0x8450
|
||||
#define GL_FOG_COORD 0x8451
|
||||
#define GL_CURRENT_FOG_COORD 0x8453
|
||||
#define GL_FOG_COORD_ARRAY_TYPE 0x8454
|
||||
#define GL_FOG_COORD_ARRAY_STRIDE 0x8455
|
||||
#define GL_FOG_COORD_ARRAY_POINTER 0x8456
|
||||
#define GL_FOG_COORD_ARRAY 0x8457
|
||||
#define GL_FOG_COORD_ARRAY_BUFFER_BINDING 0x889D
|
||||
#define GL_SRC0_RGB 0x8580
|
||||
#define GL_SRC1_RGB 0x8581
|
||||
#define GL_SRC2_RGB 0x8582
|
||||
#define GL_SRC0_ALPHA 0x8588
|
||||
#define GL_SRC1_ALPHA 0x8589
|
||||
#define GL_SRC2_ALPHA 0x858A
|
||||
#endif
|
||||
|
||||
#ifndef GL_VERSION_2_0
|
||||
#define GL_BLEND_EQUATION_RGB GL_BLEND_EQUATION
|
||||
#define GL_BLEND_EQUATION_RGB 0x8009
|
||||
#define GL_VERTEX_ATTRIB_ARRAY_ENABLED 0x8622
|
||||
#define GL_VERTEX_ATTRIB_ARRAY_SIZE 0x8623
|
||||
#define GL_VERTEX_ATTRIB_ARRAY_STRIDE 0x8624
|
||||
#define GL_VERTEX_ATTRIB_ARRAY_TYPE 0x8625
|
||||
#define GL_CURRENT_VERTEX_ATTRIB 0x8626
|
||||
#define GL_VERTEX_PROGRAM_POINT_SIZE 0x8642
|
||||
#define GL_VERTEX_PROGRAM_TWO_SIDE 0x8643
|
||||
#define GL_VERTEX_ATTRIB_ARRAY_POINTER 0x8645
|
||||
#define GL_STENCIL_BACK_FUNC 0x8800
|
||||
#define GL_STENCIL_BACK_FAIL 0x8801
|
||||
@@ -398,11 +414,8 @@ extern "C" {
|
||||
#define GL_DRAW_BUFFER14 0x8833
|
||||
#define GL_DRAW_BUFFER15 0x8834
|
||||
#define GL_BLEND_EQUATION_ALPHA 0x883D
|
||||
#define GL_POINT_SPRITE 0x8861
|
||||
#define GL_COORD_REPLACE 0x8862
|
||||
#define GL_MAX_VERTEX_ATTRIBS 0x8869
|
||||
#define GL_VERTEX_ATTRIB_ARRAY_NORMALIZED 0x886A
|
||||
#define GL_MAX_TEXTURE_COORDS 0x8871
|
||||
#define GL_MAX_TEXTURE_IMAGE_UNITS 0x8872
|
||||
#define GL_FRAGMENT_SHADER 0x8B30
|
||||
#define GL_VERTEX_SHADER 0x8B31
|
||||
@@ -453,8 +466,14 @@ extern "C" {
|
||||
#define GL_STENCIL_BACK_WRITEMASK 0x8CA5
|
||||
#endif
|
||||
|
||||
#ifndef GL_VERSION_2_0_DEPRECATED
|
||||
#define GL_VERTEX_PROGRAM_TWO_SIDE 0x8643
|
||||
#define GL_POINT_SPRITE 0x8861
|
||||
#define GL_COORD_REPLACE 0x8862
|
||||
#define GL_MAX_TEXTURE_COORDS 0x8871
|
||||
#endif
|
||||
|
||||
#ifndef GL_VERSION_2_1
|
||||
#define GL_CURRENT_RASTER_SECONDARY_COLOR 0x845F
|
||||
#define GL_PIXEL_PACK_BUFFER 0x88EB
|
||||
#define GL_PIXEL_UNPACK_BUFFER 0x88EC
|
||||
#define GL_PIXEL_PACK_BUFFER_BINDING 0x88ED
|
||||
@@ -469,25 +488,29 @@ extern "C" {
|
||||
#define GL_SRGB8 0x8C41
|
||||
#define GL_SRGB_ALPHA 0x8C42
|
||||
#define GL_SRGB8_ALPHA8 0x8C43
|
||||
#define GL_COMPRESSED_SRGB 0x8C48
|
||||
#define GL_COMPRESSED_SRGB_ALPHA 0x8C49
|
||||
#endif
|
||||
|
||||
#ifndef GL_VERSION_2_1_DEPRECATED
|
||||
#define GL_CURRENT_RASTER_SECONDARY_COLOR 0x845F
|
||||
#define GL_SLUMINANCE_ALPHA 0x8C44
|
||||
#define GL_SLUMINANCE8_ALPHA8 0x8C45
|
||||
#define GL_SLUMINANCE 0x8C46
|
||||
#define GL_SLUMINANCE8 0x8C47
|
||||
#define GL_COMPRESSED_SRGB 0x8C48
|
||||
#define GL_COMPRESSED_SRGB_ALPHA 0x8C49
|
||||
#define GL_COMPRESSED_SLUMINANCE 0x8C4A
|
||||
#define GL_COMPRESSED_SLUMINANCE_ALPHA 0x8C4B
|
||||
#endif
|
||||
|
||||
#ifndef GL_VERSION_3_0
|
||||
#define GL_COMPARE_REF_TO_TEXTURE GL_COMPARE_R_TO_TEXTURE_ARB
|
||||
#define GL_CLIP_DISTANCE0 GL_CLIP_PLANE0
|
||||
#define GL_CLIP_DISTANCE1 GL_CLIP_PLANE1
|
||||
#define GL_CLIP_DISTANCE2 GL_CLIP_PLANE2
|
||||
#define GL_CLIP_DISTANCE3 GL_CLIP_PLANE3
|
||||
#define GL_CLIP_DISTANCE4 GL_CLIP_PLANE4
|
||||
#define GL_CLIP_DISTANCE5 GL_CLIP_PLANE5
|
||||
#define GL_MAX_CLIP_DISTANCES GL_MAX_CLIP_PLANES
|
||||
#define GL_COMPARE_REF_TO_TEXTURE 0x884E
|
||||
#define GL_CLIP_DISTANCE0 0x3000
|
||||
#define GL_CLIP_DISTANCE1 0x3001
|
||||
#define GL_CLIP_DISTANCE2 0x3002
|
||||
#define GL_CLIP_DISTANCE3 0x3003
|
||||
#define GL_CLIP_DISTANCE4 0x3004
|
||||
#define GL_CLIP_DISTANCE5 0x3005
|
||||
#define GL_MAX_CLIP_DISTANCES 0x0D32
|
||||
#define GL_MAJOR_VERSION 0x821B
|
||||
#define GL_MINOR_VERSION 0x821C
|
||||
#define GL_NUM_EXTENSIONS 0x821D
|
||||
@@ -505,19 +528,9 @@ extern "C" {
|
||||
#define GL_MAX_ARRAY_TEXTURE_LAYERS 0x88FF
|
||||
#define GL_MIN_PROGRAM_TEXEL_OFFSET 0x8904
|
||||
#define GL_MAX_PROGRAM_TEXEL_OFFSET 0x8905
|
||||
#define GL_CLAMP_VERTEX_COLOR 0x891A
|
||||
#define GL_CLAMP_FRAGMENT_COLOR 0x891B
|
||||
#define GL_CLAMP_READ_COLOR 0x891C
|
||||
#define GL_FIXED_ONLY 0x891D
|
||||
#define GL_MAX_VARYING_COMPONENTS GL_MAX_VARYING_FLOATS
|
||||
#define GL_TEXTURE_RED_TYPE 0x8C10
|
||||
#define GL_TEXTURE_GREEN_TYPE 0x8C11
|
||||
#define GL_TEXTURE_BLUE_TYPE 0x8C12
|
||||
#define GL_TEXTURE_ALPHA_TYPE 0x8C13
|
||||
#define GL_TEXTURE_LUMINANCE_TYPE 0x8C14
|
||||
#define GL_TEXTURE_INTENSITY_TYPE 0x8C15
|
||||
#define GL_TEXTURE_DEPTH_TYPE 0x8C16
|
||||
#define GL_UNSIGNED_NORMALIZED 0x8C17
|
||||
#define GL_MAX_VARYING_COMPONENTS 0x8B4B
|
||||
#define GL_TEXTURE_1D_ARRAY 0x8C18
|
||||
#define GL_PROXY_TEXTURE_1D_ARRAY 0x8C19
|
||||
#define GL_TEXTURE_2D_ARRAY 0x8C1A
|
||||
@@ -559,7 +572,6 @@ extern "C" {
|
||||
#define GL_RED_INTEGER 0x8D94
|
||||
#define GL_GREEN_INTEGER 0x8D95
|
||||
#define GL_BLUE_INTEGER 0x8D96
|
||||
#define GL_ALPHA_INTEGER 0x8D97
|
||||
#define GL_RGB_INTEGER 0x8D98
|
||||
#define GL_RGBA_INTEGER 0x8D99
|
||||
#define GL_BGR_INTEGER 0x8D9A
|
||||
@@ -615,8 +627,6 @@ extern "C" {
|
||||
/* reuse GL_TEXTURE_GREEN_TYPE */
|
||||
/* reuse GL_TEXTURE_BLUE_TYPE */
|
||||
/* reuse GL_TEXTURE_ALPHA_TYPE */
|
||||
/* reuse GL_TEXTURE_LUMINANCE_TYPE */
|
||||
/* reuse GL_TEXTURE_INTENSITY_TYPE */
|
||||
/* reuse GL_TEXTURE_DEPTH_TYPE */
|
||||
/* reuse GL_UNSIGNED_NORMALIZED */
|
||||
/* reuse GL_FRAMEBUFFER_BINDING */
|
||||
@@ -716,7 +726,32 @@ extern "C" {
|
||||
/* reuse GL_VERTEX_ARRAY_BINDING */
|
||||
#endif
|
||||
|
||||
#ifndef GL_VERSION_3_0_DEPRECATED
|
||||
#define GL_CLAMP_VERTEX_COLOR 0x891A
|
||||
#define GL_CLAMP_FRAGMENT_COLOR 0x891B
|
||||
#define GL_ALPHA_INTEGER 0x8D97
|
||||
/* Reuse tokens from ARB_framebuffer_object */
|
||||
/* reuse GL_TEXTURE_LUMINANCE_TYPE */
|
||||
/* reuse GL_TEXTURE_INTENSITY_TYPE */
|
||||
#endif
|
||||
|
||||
#ifndef GL_VERSION_3_1
|
||||
#define GL_SAMPLER_2D_RECT 0x8B63
|
||||
#define GL_SAMPLER_2D_RECT_SHADOW 0x8B64
|
||||
#define GL_SAMPLER_BUFFER 0x8DC2
|
||||
#define GL_INT_SAMPLER_2D_RECT 0x8DCD
|
||||
#define GL_INT_SAMPLER_BUFFER 0x8DD0
|
||||
#define GL_UNSIGNED_INT_SAMPLER_2D_RECT 0x8DD5
|
||||
#define GL_UNSIGNED_INT_SAMPLER_BUFFER 0x8DD8
|
||||
#define GL_TEXTURE_BUFFER 0x8C2A
|
||||
#define GL_MAX_TEXTURE_BUFFER_SIZE 0x8C2B
|
||||
#define GL_TEXTURE_BINDING_BUFFER 0x8C2C
|
||||
#define GL_TEXTURE_BUFFER_DATA_STORE_BINDING 0x8C2D
|
||||
#define GL_TEXTURE_BUFFER_FORMAT 0x8C2E
|
||||
#define GL_TEXTURE_RECTANGLE 0x84F5
|
||||
#define GL_TEXTURE_BINDING_RECTANGLE 0x84F6
|
||||
#define GL_PROXY_TEXTURE_RECTANGLE 0x84F7
|
||||
#define GL_MAX_RECTANGLE_TEXTURE_SIZE 0x84F8
|
||||
#define GL_RED_SNORM 0x8F90
|
||||
#define GL_RG_SNORM 0x8F91
|
||||
#define GL_RGB_SNORM 0x8F92
|
||||
@@ -732,6 +767,41 @@ extern "C" {
|
||||
#define GL_SIGNED_NORMALIZED 0x8F9C
|
||||
#define GL_PRIMITIVE_RESTART 0x8F9D
|
||||
#define GL_PRIMITIVE_RESTART_INDEX 0x8F9E
|
||||
/* Reuse tokens from ARB_copy_buffer */
|
||||
/* reuse GL_COPY_READ_BUFFER */
|
||||
/* reuse GL_COPY_WRITE_BUFFER */
|
||||
/* Would reuse tokens from ARB_draw_instanced, but it has none */
|
||||
/* Reuse tokens from ARB_uniform_buffer_object */
|
||||
/* reuse GL_UNIFORM_BUFFER */
|
||||
/* reuse GL_UNIFORM_BUFFER_BINDING */
|
||||
/* reuse GL_UNIFORM_BUFFER_START */
|
||||
/* reuse GL_UNIFORM_BUFFER_SIZE */
|
||||
/* reuse GL_MAX_VERTEX_UNIFORM_BLOCKS */
|
||||
/* reuse GL_MAX_FRAGMENT_UNIFORM_BLOCKS */
|
||||
/* reuse GL_MAX_COMBINED_UNIFORM_BLOCKS */
|
||||
/* reuse GL_MAX_UNIFORM_BUFFER_BINDINGS */
|
||||
/* reuse GL_MAX_UNIFORM_BLOCK_SIZE */
|
||||
/* reuse GL_MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS */
|
||||
/* reuse GL_MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS */
|
||||
/* reuse GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT */
|
||||
/* reuse GL_ACTIVE_UNIFORM_BLOCK_MAX_NAME_LENGTH */
|
||||
/* reuse GL_ACTIVE_UNIFORM_BLOCKS */
|
||||
/* reuse GL_UNIFORM_TYPE */
|
||||
/* reuse GL_UNIFORM_SIZE */
|
||||
/* reuse GL_UNIFORM_NAME_LENGTH */
|
||||
/* reuse GL_UNIFORM_BLOCK_INDEX */
|
||||
/* reuse GL_UNIFORM_OFFSET */
|
||||
/* reuse GL_UNIFORM_ARRAY_STRIDE */
|
||||
/* reuse GL_UNIFORM_MATRIX_STRIDE */
|
||||
/* reuse GL_UNIFORM_IS_ROW_MAJOR */
|
||||
/* reuse GL_UNIFORM_BLOCK_BINDING */
|
||||
/* reuse GL_UNIFORM_BLOCK_DATA_SIZE */
|
||||
/* reuse GL_UNIFORM_BLOCK_NAME_LENGTH */
|
||||
/* reuse GL_UNIFORM_BLOCK_ACTIVE_UNIFORMS */
|
||||
/* reuse GL_UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES */
|
||||
/* reuse GL_UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER */
|
||||
/* reuse GL_UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER */
|
||||
/* reuse GL_INVALID_INDEX */
|
||||
#endif
|
||||
|
||||
#ifndef GL_ARB_multitexture
|
||||
@@ -1251,12 +1321,17 @@ extern "C" {
|
||||
#define GL_FRAMEBUFFER_DEFAULT 0x8218
|
||||
#define GL_FRAMEBUFFER_UNDEFINED 0x8219
|
||||
#define GL_DEPTH_STENCIL_ATTACHMENT 0x821A
|
||||
#define GL_INDEX 0x8222
|
||||
#define GL_MAX_RENDERBUFFER_SIZE 0x84E8
|
||||
#define GL_DEPTH_STENCIL 0x84F9
|
||||
#define GL_UNSIGNED_INT_24_8 0x84FA
|
||||
#define GL_DEPTH24_STENCIL8 0x88F0
|
||||
#define GL_TEXTURE_STENCIL_SIZE 0x88F1
|
||||
#define GL_TEXTURE_RED_TYPE 0x8C10
|
||||
#define GL_TEXTURE_GREEN_TYPE 0x8C11
|
||||
#define GL_TEXTURE_BLUE_TYPE 0x8C12
|
||||
#define GL_TEXTURE_ALPHA_TYPE 0x8C13
|
||||
#define GL_TEXTURE_DEPTH_TYPE 0x8C16
|
||||
#define GL_UNSIGNED_NORMALIZED 0x8C17
|
||||
#define GL_FRAMEBUFFER_BINDING 0x8CA6
|
||||
#define GL_DRAW_FRAMEBUFFER_BINDING GL_FRAMEBUFFER_BINDING
|
||||
#define GL_RENDERBUFFER_BINDING 0x8CA7
|
||||
@@ -1313,6 +1388,12 @@ extern "C" {
|
||||
#define GL_MAX_SAMPLES 0x8D57
|
||||
#endif
|
||||
|
||||
#ifndef GL_ARB_framebuffer_object_DEPRECATED
|
||||
#define GL_INDEX 0x8222
|
||||
#define GL_TEXTURE_LUMINANCE_TYPE 0x8C14
|
||||
#define GL_TEXTURE_INTENSITY_TYPE 0x8C15
|
||||
#endif
|
||||
|
||||
#ifndef GL_ARB_framebuffer_sRGB
|
||||
#define GL_FRAMEBUFFER_SRGB 0x8DB9
|
||||
#endif
|
||||
@@ -1434,7 +1515,7 @@ extern "C" {
|
||||
#define GL_UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER 0x8A44
|
||||
#define GL_UNIFORM_BLOCK_REFERENCED_BY_GEOMETRY_SHADER 0x8A45
|
||||
#define GL_UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER 0x8A46
|
||||
#define GL_INVALID_INDEX_ARB 0xFFFFFFFFu
|
||||
#define GL_INVALID_INDEX 0xFFFFFFFFu
|
||||
#endif
|
||||
|
||||
#ifndef GL_ARB_compatibility
|
||||
@@ -1446,6 +1527,9 @@ extern "C" {
|
||||
#define GL_COPY_WRITE_BUFFER 0x8F37
|
||||
#endif
|
||||
|
||||
#ifndef GL_ARB_shader_texture_lod
|
||||
#endif
|
||||
|
||||
#ifndef GL_EXT_abgr
|
||||
#define GL_ABGR_EXT 0x8000
|
||||
#endif
|
||||
@@ -3431,7 +3515,7 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
#ifndef GL_EXT_blend_equation_separate
|
||||
#define GL_BLEND_EQUATION_RGB_EXT GL_BLEND_EQUATION
|
||||
#define GL_BLEND_EQUATION_RGB_EXT 0x8009
|
||||
#define GL_BLEND_EQUATION_ALPHA_EXT 0x883D
|
||||
#endif
|
||||
|
||||
@@ -3968,7 +4052,7 @@ extern "C" {
|
||||
#include <stddef.h>
|
||||
#ifndef GL_VERSION_2_0
|
||||
/* GL type for program/shader text */
|
||||
typedef char GLchar; /* native character */
|
||||
typedef char GLchar;
|
||||
#endif
|
||||
|
||||
#ifndef GL_VERSION_1_5
|
||||
@@ -3984,12 +4068,12 @@ typedef ptrdiff_t GLsizeiptrARB;
|
||||
#endif
|
||||
|
||||
#ifndef GL_ARB_shader_objects
|
||||
/* GL types for handling shader object handles and program/shader text */
|
||||
typedef char GLcharARB; /* native character */
|
||||
typedef unsigned int GLhandleARB; /* shader object handle */
|
||||
/* GL types for program/shader text and shader object handles */
|
||||
typedef char GLcharARB;
|
||||
typedef unsigned int GLhandleARB;
|
||||
#endif
|
||||
|
||||
/* GL types for "half" precision (s10e5) float data in host memory */
|
||||
/* GL type for "half" precision (s10e5) float data in host memory */
|
||||
#ifndef GL_ARB_half_float_pixel
|
||||
typedef unsigned short GLhalfARB;
|
||||
#endif
|
||||
@@ -4031,7 +4115,8 @@ typedef __int32 int32_t;
|
||||
typedef __int64 int64_t;
|
||||
typedef unsigned __int64 uint64_t;
|
||||
#else
|
||||
#include <inttypes.h> /* Fallback option */
|
||||
/* Fallback if nothing above works */
|
||||
#include <inttypes.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -4046,6 +4131,21 @@ typedef uint64_t GLuint64EXT;
|
||||
GLAPI void APIENTRY glBlendColor (GLclampf, GLclampf, GLclampf, GLclampf);
|
||||
GLAPI void APIENTRY glBlendEquation (GLenum);
|
||||
GLAPI void APIENTRY glDrawRangeElements (GLenum, GLuint, GLuint, GLsizei, GLenum, const GLvoid *);
|
||||
GLAPI void APIENTRY glTexImage3D (GLenum, GLint, GLint, GLsizei, GLsizei, GLsizei, GLint, GLenum, GLenum, const GLvoid *);
|
||||
GLAPI void APIENTRY glTexSubImage3D (GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *);
|
||||
GLAPI void APIENTRY glCopyTexSubImage3D (GLenum, GLint, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei);
|
||||
#endif /* GL_GLEXT_PROTOTYPES */
|
||||
typedef void (APIENTRYP PFNGLBLENDCOLORPROC) (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);
|
||||
typedef void (APIENTRYP PFNGLBLENDEQUATIONPROC) (GLenum mode);
|
||||
typedef void (APIENTRYP PFNGLDRAWRANGEELEMENTSPROC) (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices);
|
||||
typedef void (APIENTRYP PFNGLTEXIMAGE3DPROC) (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
|
||||
typedef void (APIENTRYP PFNGLTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels);
|
||||
typedef void (APIENTRYP PFNGLCOPYTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height);
|
||||
#endif
|
||||
|
||||
#ifndef GL_VERSION_1_2_DEPRECATED
|
||||
#define GL_VERSION_1_2_DEPRECATED 1
|
||||
#ifdef GL_GLEXT_PROTOTYPES
|
||||
GLAPI void APIENTRY glColorTable (GLenum, GLenum, GLsizei, GLenum, GLenum, const GLvoid *);
|
||||
GLAPI void APIENTRY glColorTableParameterfv (GLenum, GLenum, const GLfloat *);
|
||||
GLAPI void APIENTRY glColorTableParameteriv (GLenum, GLenum, const GLint *);
|
||||
@@ -4078,13 +4178,7 @@ GLAPI void APIENTRY glHistogram (GLenum, GLsizei, GLenum, GLboolean);
|
||||
GLAPI void APIENTRY glMinmax (GLenum, GLenum, GLboolean);
|
||||
GLAPI void APIENTRY glResetHistogram (GLenum);
|
||||
GLAPI void APIENTRY glResetMinmax (GLenum);
|
||||
GLAPI void APIENTRY glTexImage3D (GLenum, GLint, GLint, GLsizei, GLsizei, GLsizei, GLint, GLenum, GLenum, const GLvoid *);
|
||||
GLAPI void APIENTRY glTexSubImage3D (GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *);
|
||||
GLAPI void APIENTRY glCopyTexSubImage3D (GLenum, GLint, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei);
|
||||
#endif /* GL_GLEXT_PROTOTYPES */
|
||||
typedef void (APIENTRYP PFNGLBLENDCOLORPROC) (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);
|
||||
typedef void (APIENTRYP PFNGLBLENDEQUATIONPROC) (GLenum mode);
|
||||
typedef void (APIENTRYP PFNGLDRAWRANGEELEMENTSPROC) (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices);
|
||||
typedef void (APIENTRYP PFNGLCOLORTABLEPROC) (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *table);
|
||||
typedef void (APIENTRYP PFNGLCOLORTABLEPARAMETERFVPROC) (GLenum target, GLenum pname, const GLfloat *params);
|
||||
typedef void (APIENTRYP PFNGLCOLORTABLEPARAMETERIVPROC) (GLenum target, GLenum pname, const GLint *params);
|
||||
@@ -4117,15 +4211,35 @@ typedef void (APIENTRYP PFNGLHISTOGRAMPROC) (GLenum target, GLsizei width, GLenu
|
||||
typedef void (APIENTRYP PFNGLMINMAXPROC) (GLenum target, GLenum internalformat, GLboolean sink);
|
||||
typedef void (APIENTRYP PFNGLRESETHISTOGRAMPROC) (GLenum target);
|
||||
typedef void (APIENTRYP PFNGLRESETMINMAXPROC) (GLenum target);
|
||||
typedef void (APIENTRYP PFNGLTEXIMAGE3DPROC) (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
|
||||
typedef void (APIENTRYP PFNGLTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels);
|
||||
typedef void (APIENTRYP PFNGLCOPYTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height);
|
||||
#endif
|
||||
|
||||
#ifndef GL_VERSION_1_3
|
||||
#define GL_VERSION_1_3 1
|
||||
#ifdef GL_GLEXT_PROTOTYPES
|
||||
GLAPI void APIENTRY glActiveTexture (GLenum);
|
||||
GLAPI void APIENTRY glSampleCoverage (GLclampf, GLboolean);
|
||||
GLAPI void APIENTRY glCompressedTexImage3D (GLenum, GLint, GLenum, GLsizei, GLsizei, GLsizei, GLint, GLsizei, const GLvoid *);
|
||||
GLAPI void APIENTRY glCompressedTexImage2D (GLenum, GLint, GLenum, GLsizei, GLsizei, GLint, GLsizei, const GLvoid *);
|
||||
GLAPI void APIENTRY glCompressedTexImage1D (GLenum, GLint, GLenum, GLsizei, GLint, GLsizei, const GLvoid *);
|
||||
GLAPI void APIENTRY glCompressedTexSubImage3D (GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLsizei, const GLvoid *);
|
||||
GLAPI void APIENTRY glCompressedTexSubImage2D (GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLsizei, const GLvoid *);
|
||||
GLAPI void APIENTRY glCompressedTexSubImage1D (GLenum, GLint, GLint, GLsizei, GLenum, GLsizei, const GLvoid *);
|
||||
GLAPI void APIENTRY glGetCompressedTexImage (GLenum, GLint, GLvoid *);
|
||||
#endif /* GL_GLEXT_PROTOTYPES */
|
||||
typedef void (APIENTRYP PFNGLACTIVETEXTUREPROC) (GLenum texture);
|
||||
typedef void (APIENTRYP PFNGLSAMPLECOVERAGEPROC) (GLclampf value, GLboolean invert);
|
||||
typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE3DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data);
|
||||
typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE2DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data);
|
||||
typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE1DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *data);
|
||||
typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *data);
|
||||
typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data);
|
||||
typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE1DPROC) (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *data);
|
||||
typedef void (APIENTRYP PFNGLGETCOMPRESSEDTEXIMAGEPROC) (GLenum target, GLint level, GLvoid *img);
|
||||
#endif
|
||||
|
||||
#ifndef GL_VERSION_1_3_DEPRECATED
|
||||
#define GL_VERSION_1_3_DEPRECATED 1
|
||||
#ifdef GL_GLEXT_PROTOTYPES
|
||||
GLAPI void APIENTRY glClientActiveTexture (GLenum);
|
||||
GLAPI void APIENTRY glMultiTexCoord1d (GLenum, GLdouble);
|
||||
GLAPI void APIENTRY glMultiTexCoord1dv (GLenum, const GLdouble *);
|
||||
@@ -4163,16 +4277,7 @@ GLAPI void APIENTRY glLoadTransposeMatrixf (const GLfloat *);
|
||||
GLAPI void APIENTRY glLoadTransposeMatrixd (const GLdouble *);
|
||||
GLAPI void APIENTRY glMultTransposeMatrixf (const GLfloat *);
|
||||
GLAPI void APIENTRY glMultTransposeMatrixd (const GLdouble *);
|
||||
GLAPI void APIENTRY glSampleCoverage (GLclampf, GLboolean);
|
||||
GLAPI void APIENTRY glCompressedTexImage3D (GLenum, GLint, GLenum, GLsizei, GLsizei, GLsizei, GLint, GLsizei, const GLvoid *);
|
||||
GLAPI void APIENTRY glCompressedTexImage2D (GLenum, GLint, GLenum, GLsizei, GLsizei, GLint, GLsizei, const GLvoid *);
|
||||
GLAPI void APIENTRY glCompressedTexImage1D (GLenum, GLint, GLenum, GLsizei, GLint, GLsizei, const GLvoid *);
|
||||
GLAPI void APIENTRY glCompressedTexSubImage3D (GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLsizei, const GLvoid *);
|
||||
GLAPI void APIENTRY glCompressedTexSubImage2D (GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLsizei, const GLvoid *);
|
||||
GLAPI void APIENTRY glCompressedTexSubImage1D (GLenum, GLint, GLint, GLsizei, GLenum, GLsizei, const GLvoid *);
|
||||
GLAPI void APIENTRY glGetCompressedTexImage (GLenum, GLint, GLvoid *);
|
||||
#endif /* GL_GLEXT_PROTOTYPES */
|
||||
typedef void (APIENTRYP PFNGLACTIVETEXTUREPROC) (GLenum texture);
|
||||
typedef void (APIENTRYP PFNGLCLIENTACTIVETEXTUREPROC) (GLenum texture);
|
||||
typedef void (APIENTRYP PFNGLMULTITEXCOORD1DPROC) (GLenum target, GLdouble s);
|
||||
typedef void (APIENTRYP PFNGLMULTITEXCOORD1DVPROC) (GLenum target, const GLdouble *v);
|
||||
@@ -4210,31 +4315,36 @@ typedef void (APIENTRYP PFNGLLOADTRANSPOSEMATRIXFPROC) (const GLfloat *m);
|
||||
typedef void (APIENTRYP PFNGLLOADTRANSPOSEMATRIXDPROC) (const GLdouble *m);
|
||||
typedef void (APIENTRYP PFNGLMULTTRANSPOSEMATRIXFPROC) (const GLfloat *m);
|
||||
typedef void (APIENTRYP PFNGLMULTTRANSPOSEMATRIXDPROC) (const GLdouble *m);
|
||||
typedef void (APIENTRYP PFNGLSAMPLECOVERAGEPROC) (GLclampf value, GLboolean invert);
|
||||
typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE3DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data);
|
||||
typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE2DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data);
|
||||
typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE1DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *data);
|
||||
typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *data);
|
||||
typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data);
|
||||
typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE1DPROC) (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *data);
|
||||
typedef void (APIENTRYP PFNGLGETCOMPRESSEDTEXIMAGEPROC) (GLenum target, GLint level, GLvoid *img);
|
||||
#endif
|
||||
|
||||
#ifndef GL_VERSION_1_4
|
||||
#define GL_VERSION_1_4 1
|
||||
#ifdef GL_GLEXT_PROTOTYPES
|
||||
GLAPI void APIENTRY glBlendFuncSeparate (GLenum, GLenum, GLenum, GLenum);
|
||||
GLAPI void APIENTRY glFogCoordf (GLfloat);
|
||||
GLAPI void APIENTRY glFogCoordfv (const GLfloat *);
|
||||
GLAPI void APIENTRY glFogCoordd (GLdouble);
|
||||
GLAPI void APIENTRY glFogCoorddv (const GLdouble *);
|
||||
GLAPI void APIENTRY glFogCoordPointer (GLenum, GLsizei, const GLvoid *);
|
||||
GLAPI void APIENTRY glMultiDrawArrays (GLenum, GLint *, GLsizei *, GLsizei);
|
||||
GLAPI void APIENTRY glMultiDrawElements (GLenum, const GLsizei *, GLenum, const GLvoid* *, GLsizei);
|
||||
GLAPI void APIENTRY glPointParameterf (GLenum, GLfloat);
|
||||
GLAPI void APIENTRY glPointParameterfv (GLenum, const GLfloat *);
|
||||
GLAPI void APIENTRY glPointParameteri (GLenum, GLint);
|
||||
GLAPI void APIENTRY glPointParameteriv (GLenum, const GLint *);
|
||||
#endif /* GL_GLEXT_PROTOTYPES */
|
||||
typedef void (APIENTRYP PFNGLBLENDFUNCSEPARATEPROC) (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha);
|
||||
typedef void (APIENTRYP PFNGLMULTIDRAWARRAYSPROC) (GLenum mode, GLint *first, GLsizei *count, GLsizei primcount);
|
||||
typedef void (APIENTRYP PFNGLMULTIDRAWELEMENTSPROC) (GLenum mode, const GLsizei *count, GLenum type, const GLvoid* *indices, GLsizei primcount);
|
||||
typedef void (APIENTRYP PFNGLPOINTPARAMETERFPROC) (GLenum pname, GLfloat param);
|
||||
typedef void (APIENTRYP PFNGLPOINTPARAMETERFVPROC) (GLenum pname, const GLfloat *params);
|
||||
typedef void (APIENTRYP PFNGLPOINTPARAMETERIPROC) (GLenum pname, GLint param);
|
||||
typedef void (APIENTRYP PFNGLPOINTPARAMETERIVPROC) (GLenum pname, const GLint *params);
|
||||
#endif
|
||||
|
||||
#ifndef GL_VERSION_1_4_DEPRECATED
|
||||
#define GL_VERSION_1_4_DEPRECATED 1
|
||||
#ifdef GL_GLEXT_PROTOTYPES
|
||||
GLAPI void APIENTRY glFogCoordf (GLfloat);
|
||||
GLAPI void APIENTRY glFogCoordfv (const GLfloat *);
|
||||
GLAPI void APIENTRY glFogCoordd (GLdouble);
|
||||
GLAPI void APIENTRY glFogCoorddv (const GLdouble *);
|
||||
GLAPI void APIENTRY glFogCoordPointer (GLenum, GLsizei, const GLvoid *);
|
||||
GLAPI void APIENTRY glSecondaryColor3b (GLbyte, GLbyte, GLbyte);
|
||||
GLAPI void APIENTRY glSecondaryColor3bv (const GLbyte *);
|
||||
GLAPI void APIENTRY glSecondaryColor3d (GLdouble, GLdouble, GLdouble);
|
||||
@@ -4269,18 +4379,11 @@ GLAPI void APIENTRY glWindowPos3iv (const GLint *);
|
||||
GLAPI void APIENTRY glWindowPos3s (GLshort, GLshort, GLshort);
|
||||
GLAPI void APIENTRY glWindowPos3sv (const GLshort *);
|
||||
#endif /* GL_GLEXT_PROTOTYPES */
|
||||
typedef void (APIENTRYP PFNGLBLENDFUNCSEPARATEPROC) (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha);
|
||||
typedef void (APIENTRYP PFNGLFOGCOORDFPROC) (GLfloat coord);
|
||||
typedef void (APIENTRYP PFNGLFOGCOORDFVPROC) (const GLfloat *coord);
|
||||
typedef void (APIENTRYP PFNGLFOGCOORDDPROC) (GLdouble coord);
|
||||
typedef void (APIENTRYP PFNGLFOGCOORDDVPROC) (const GLdouble *coord);
|
||||
typedef void (APIENTRYP PFNGLFOGCOORDPOINTERPROC) (GLenum type, GLsizei stride, const GLvoid *pointer);
|
||||
typedef void (APIENTRYP PFNGLMULTIDRAWARRAYSPROC) (GLenum mode, GLint *first, GLsizei *count, GLsizei primcount);
|
||||
typedef void (APIENTRYP PFNGLMULTIDRAWELEMENTSPROC) (GLenum mode, const GLsizei *count, GLenum type, const GLvoid* *indices, GLsizei primcount);
|
||||
typedef void (APIENTRYP PFNGLPOINTPARAMETERFPROC) (GLenum pname, GLfloat param);
|
||||
typedef void (APIENTRYP PFNGLPOINTPARAMETERFVPROC) (GLenum pname, const GLfloat *params);
|
||||
typedef void (APIENTRYP PFNGLPOINTPARAMETERIPROC) (GLenum pname, GLint param);
|
||||
typedef void (APIENTRYP PFNGLPOINTPARAMETERIVPROC) (GLenum pname, const GLint *params);
|
||||
typedef void (APIENTRYP PFNGLSECONDARYCOLOR3BPROC) (GLbyte red, GLbyte green, GLbyte blue);
|
||||
typedef void (APIENTRYP PFNGLSECONDARYCOLOR3BVPROC) (const GLbyte *v);
|
||||
typedef void (APIENTRYP PFNGLSECONDARYCOLOR3DPROC) (GLdouble red, GLdouble green, GLdouble blue);
|
||||
@@ -4592,26 +4695,6 @@ GLAPI void APIENTRY glGetTransformFeedbackVarying (GLuint, GLuint, GLsizei, GLsi
|
||||
GLAPI void APIENTRY glClampColor (GLenum, GLenum);
|
||||
GLAPI void APIENTRY glBeginConditionalRender (GLuint, GLenum);
|
||||
GLAPI void APIENTRY glEndConditionalRender (void);
|
||||
GLAPI void APIENTRY glVertexAttribI1i (GLuint, GLint);
|
||||
GLAPI void APIENTRY glVertexAttribI2i (GLuint, GLint, GLint);
|
||||
GLAPI void APIENTRY glVertexAttribI3i (GLuint, GLint, GLint, GLint);
|
||||
GLAPI void APIENTRY glVertexAttribI4i (GLuint, GLint, GLint, GLint, GLint);
|
||||
GLAPI void APIENTRY glVertexAttribI1ui (GLuint, GLuint);
|
||||
GLAPI void APIENTRY glVertexAttribI2ui (GLuint, GLuint, GLuint);
|
||||
GLAPI void APIENTRY glVertexAttribI3ui (GLuint, GLuint, GLuint, GLuint);
|
||||
GLAPI void APIENTRY glVertexAttribI4ui (GLuint, GLuint, GLuint, GLuint, GLuint);
|
||||
GLAPI void APIENTRY glVertexAttribI1iv (GLuint, const GLint *);
|
||||
GLAPI void APIENTRY glVertexAttribI2iv (GLuint, const GLint *);
|
||||
GLAPI void APIENTRY glVertexAttribI3iv (GLuint, const GLint *);
|
||||
GLAPI void APIENTRY glVertexAttribI4iv (GLuint, const GLint *);
|
||||
GLAPI void APIENTRY glVertexAttribI1uiv (GLuint, const GLuint *);
|
||||
GLAPI void APIENTRY glVertexAttribI2uiv (GLuint, const GLuint *);
|
||||
GLAPI void APIENTRY glVertexAttribI3uiv (GLuint, const GLuint *);
|
||||
GLAPI void APIENTRY glVertexAttribI4uiv (GLuint, const GLuint *);
|
||||
GLAPI void APIENTRY glVertexAttribI4bv (GLuint, const GLbyte *);
|
||||
GLAPI void APIENTRY glVertexAttribI4sv (GLuint, const GLshort *);
|
||||
GLAPI void APIENTRY glVertexAttribI4ubv (GLuint, const GLubyte *);
|
||||
GLAPI void APIENTRY glVertexAttribI4usv (GLuint, const GLushort *);
|
||||
GLAPI void APIENTRY glVertexAttribIPointer (GLuint, GLint, GLenum, GLsizei, const GLvoid *);
|
||||
GLAPI void APIENTRY glGetVertexAttribIiv (GLuint, GLenum, GLint *);
|
||||
GLAPI void APIENTRY glGetVertexAttribIuiv (GLuint, GLenum, GLuint *);
|
||||
@@ -4651,26 +4734,6 @@ typedef void (APIENTRYP PFNGLGETTRANSFORMFEEDBACKVARYINGPROC) (GLuint program, G
|
||||
typedef void (APIENTRYP PFNGLCLAMPCOLORPROC) (GLenum target, GLenum clamp);
|
||||
typedef void (APIENTRYP PFNGLBEGINCONDITIONALRENDERPROC) (GLuint id, GLenum mode);
|
||||
typedef void (APIENTRYP PFNGLENDCONDITIONALRENDERPROC) (void);
|
||||
typedef void (APIENTRYP PFNGLVERTEXATTRIBI1IPROC) (GLuint index, GLint x);
|
||||
typedef void (APIENTRYP PFNGLVERTEXATTRIBI2IPROC) (GLuint index, GLint x, GLint y);
|
||||
typedef void (APIENTRYP PFNGLVERTEXATTRIBI3IPROC) (GLuint index, GLint x, GLint y, GLint z);
|
||||
typedef void (APIENTRYP PFNGLVERTEXATTRIBI4IPROC) (GLuint index, GLint x, GLint y, GLint z, GLint w);
|
||||
typedef void (APIENTRYP PFNGLVERTEXATTRIBI1UIPROC) (GLuint index, GLuint x);
|
||||
typedef void (APIENTRYP PFNGLVERTEXATTRIBI2UIPROC) (GLuint index, GLuint x, GLuint y);
|
||||
typedef void (APIENTRYP PFNGLVERTEXATTRIBI3UIPROC) (GLuint index, GLuint x, GLuint y, GLuint z);
|
||||
typedef void (APIENTRYP PFNGLVERTEXATTRIBI4UIPROC) (GLuint index, GLuint x, GLuint y, GLuint z, GLuint w);
|
||||
typedef void (APIENTRYP PFNGLVERTEXATTRIBI1IVPROC) (GLuint index, const GLint *v);
|
||||
typedef void (APIENTRYP PFNGLVERTEXATTRIBI2IVPROC) (GLuint index, const GLint *v);
|
||||
typedef void (APIENTRYP PFNGLVERTEXATTRIBI3IVPROC) (GLuint index, const GLint *v);
|
||||
typedef void (APIENTRYP PFNGLVERTEXATTRIBI4IVPROC) (GLuint index, const GLint *v);
|
||||
typedef void (APIENTRYP PFNGLVERTEXATTRIBI1UIVPROC) (GLuint index, const GLuint *v);
|
||||
typedef void (APIENTRYP PFNGLVERTEXATTRIBI2UIVPROC) (GLuint index, const GLuint *v);
|
||||
typedef void (APIENTRYP PFNGLVERTEXATTRIBI3UIVPROC) (GLuint index, const GLuint *v);
|
||||
typedef void (APIENTRYP PFNGLVERTEXATTRIBI4UIVPROC) (GLuint index, const GLuint *v);
|
||||
typedef void (APIENTRYP PFNGLVERTEXATTRIBI4BVPROC) (GLuint index, const GLbyte *v);
|
||||
typedef void (APIENTRYP PFNGLVERTEXATTRIBI4SVPROC) (GLuint index, const GLshort *v);
|
||||
typedef void (APIENTRYP PFNGLVERTEXATTRIBI4UBVPROC) (GLuint index, const GLubyte *v);
|
||||
typedef void (APIENTRYP PFNGLVERTEXATTRIBI4USVPROC) (GLuint index, const GLushort *v);
|
||||
typedef void (APIENTRYP PFNGLVERTEXATTRIBIPOINTERPROC) (GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
|
||||
typedef void (APIENTRYP PFNGLGETVERTEXATTRIBIIVPROC) (GLuint index, GLenum pname, GLint *params);
|
||||
typedef void (APIENTRYP PFNGLGETVERTEXATTRIBIUIVPROC) (GLuint index, GLenum pname, GLuint *params);
|
||||
@@ -4696,6 +4759,69 @@ typedef void (APIENTRYP PFNGLCLEARBUFFERFIPROC) (GLenum buffer, GLint drawbuffer
|
||||
typedef const GLubyte * (APIENTRYP PFNGLGETSTRINGIPROC) (GLenum name, GLuint index);
|
||||
#endif
|
||||
|
||||
#ifndef GL_VERSION_3_0_DEPRECATED
|
||||
#define GL_VERSION_3_0_DEPRECATED 1
|
||||
#ifdef GL_GLEXT_PROTOTYPES
|
||||
GLAPI void APIENTRY glVertexAttribI1i (GLuint, GLint);
|
||||
GLAPI void APIENTRY glVertexAttribI2i (GLuint, GLint, GLint);
|
||||
GLAPI void APIENTRY glVertexAttribI3i (GLuint, GLint, GLint, GLint);
|
||||
GLAPI void APIENTRY glVertexAttribI4i (GLuint, GLint, GLint, GLint, GLint);
|
||||
GLAPI void APIENTRY glVertexAttribI1ui (GLuint, GLuint);
|
||||
GLAPI void APIENTRY glVertexAttribI2ui (GLuint, GLuint, GLuint);
|
||||
GLAPI void APIENTRY glVertexAttribI3ui (GLuint, GLuint, GLuint, GLuint);
|
||||
GLAPI void APIENTRY glVertexAttribI4ui (GLuint, GLuint, GLuint, GLuint, GLuint);
|
||||
GLAPI void APIENTRY glVertexAttribI1iv (GLuint, const GLint *);
|
||||
GLAPI void APIENTRY glVertexAttribI2iv (GLuint, const GLint *);
|
||||
GLAPI void APIENTRY glVertexAttribI3iv (GLuint, const GLint *);
|
||||
GLAPI void APIENTRY glVertexAttribI4iv (GLuint, const GLint *);
|
||||
GLAPI void APIENTRY glVertexAttribI1uiv (GLuint, const GLuint *);
|
||||
GLAPI void APIENTRY glVertexAttribI2uiv (GLuint, const GLuint *);
|
||||
GLAPI void APIENTRY glVertexAttribI3uiv (GLuint, const GLuint *);
|
||||
GLAPI void APIENTRY glVertexAttribI4uiv (GLuint, const GLuint *);
|
||||
GLAPI void APIENTRY glVertexAttribI4bv (GLuint, const GLbyte *);
|
||||
GLAPI void APIENTRY glVertexAttribI4sv (GLuint, const GLshort *);
|
||||
GLAPI void APIENTRY glVertexAttribI4ubv (GLuint, const GLubyte *);
|
||||
GLAPI void APIENTRY glVertexAttribI4usv (GLuint, const GLushort *);
|
||||
#endif /* GL_GLEXT_PROTOTYPES */
|
||||
typedef void (APIENTRYP PFNGLVERTEXATTRIBI1IPROC) (GLuint index, GLint x);
|
||||
typedef void (APIENTRYP PFNGLVERTEXATTRIBI2IPROC) (GLuint index, GLint x, GLint y);
|
||||
typedef void (APIENTRYP PFNGLVERTEXATTRIBI3IPROC) (GLuint index, GLint x, GLint y, GLint z);
|
||||
typedef void (APIENTRYP PFNGLVERTEXATTRIBI4IPROC) (GLuint index, GLint x, GLint y, GLint z, GLint w);
|
||||
typedef void (APIENTRYP PFNGLVERTEXATTRIBI1UIPROC) (GLuint index, GLuint x);
|
||||
typedef void (APIENTRYP PFNGLVERTEXATTRIBI2UIPROC) (GLuint index, GLuint x, GLuint y);
|
||||
typedef void (APIENTRYP PFNGLVERTEXATTRIBI3UIPROC) (GLuint index, GLuint x, GLuint y, GLuint z);
|
||||
typedef void (APIENTRYP PFNGLVERTEXATTRIBI4UIPROC) (GLuint index, GLuint x, GLuint y, GLuint z, GLuint w);
|
||||
typedef void (APIENTRYP PFNGLVERTEXATTRIBI1IVPROC) (GLuint index, const GLint *v);
|
||||
typedef void (APIENTRYP PFNGLVERTEXATTRIBI2IVPROC) (GLuint index, const GLint *v);
|
||||
typedef void (APIENTRYP PFNGLVERTEXATTRIBI3IVPROC) (GLuint index, const GLint *v);
|
||||
typedef void (APIENTRYP PFNGLVERTEXATTRIBI4IVPROC) (GLuint index, const GLint *v);
|
||||
typedef void (APIENTRYP PFNGLVERTEXATTRIBI1UIVPROC) (GLuint index, const GLuint *v);
|
||||
typedef void (APIENTRYP PFNGLVERTEXATTRIBI2UIVPROC) (GLuint index, const GLuint *v);
|
||||
typedef void (APIENTRYP PFNGLVERTEXATTRIBI3UIVPROC) (GLuint index, const GLuint *v);
|
||||
typedef void (APIENTRYP PFNGLVERTEXATTRIBI4UIVPROC) (GLuint index, const GLuint *v);
|
||||
typedef void (APIENTRYP PFNGLVERTEXATTRIBI4BVPROC) (GLuint index, const GLbyte *v);
|
||||
typedef void (APIENTRYP PFNGLVERTEXATTRIBI4SVPROC) (GLuint index, const GLshort *v);
|
||||
typedef void (APIENTRYP PFNGLVERTEXATTRIBI4UBVPROC) (GLuint index, const GLubyte *v);
|
||||
typedef void (APIENTRYP PFNGLVERTEXATTRIBI4USVPROC) (GLuint index, const GLushort *v);
|
||||
#endif
|
||||
|
||||
#ifndef GL_VERSION_3_1
|
||||
#define GL_VERSION_3_1 1
|
||||
/* OpenGL 3.1 also reuses entry points from these extensions: */
|
||||
/* ARB_copy_buffer */
|
||||
/* ARB_uniform_buffer_object */
|
||||
#ifdef GL_GLEXT_PROTOTYPES
|
||||
GLAPI void APIENTRY glDrawArraysInstanced (GLenum, GLint, GLsizei, GLsizei);
|
||||
GLAPI void APIENTRY glDrawElementsInstanced (GLenum, GLsizei, GLenum, const GLvoid *, GLsizei);
|
||||
GLAPI void APIENTRY glTexBuffer (GLenum, GLenum, GLuint);
|
||||
GLAPI void APIENTRY glPrimitiveRestartIndex (GLuint);
|
||||
#endif /* GL_GLEXT_PROTOTYPES */
|
||||
typedef void (APIENTRYP PFNGLDRAWARRAYSINSTANCEDPROC) (GLenum mode, GLint first, GLsizei count, GLsizei primcount);
|
||||
typedef void (APIENTRYP PFNGLDRAWELEMENTSINSTANCEDPROC) (GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei primcount);
|
||||
typedef void (APIENTRYP PFNGLTEXBUFFERPROC) (GLenum target, GLenum internalformat, GLuint buffer);
|
||||
typedef void (APIENTRYP PFNGLPRIMITIVERESTARTINDEXPROC) (GLuint index);
|
||||
#endif
|
||||
|
||||
#ifndef GL_ARB_multitexture
|
||||
#define GL_ARB_multitexture 1
|
||||
#ifdef GL_GLEXT_PROTOTYPES
|
||||
@@ -5360,9 +5486,9 @@ typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTUREFACEARBPROC) (GLenum target, GLen
|
||||
#ifndef GL_ARB_instanced_arrays
|
||||
#define GL_ARB_instanced_arrays 1
|
||||
#ifdef GL_GLEXT_PROTOTYPES
|
||||
GLAPI void APIENTRY glVertexAttribDivisor (GLuint, GLuint);
|
||||
GLAPI void APIENTRY glVertexAttribDivisorARB (GLuint, GLuint);
|
||||
#endif /* GL_GLEXT_PROTOTYPES */
|
||||
typedef void (APIENTRYP PFNGLVERTEXATTRIBDIVISORPROC) (GLuint index, GLuint divisor);
|
||||
typedef void (APIENTRYP PFNGLVERTEXATTRIBDIVISORARBPROC) (GLuint index, GLuint divisor);
|
||||
#endif
|
||||
|
||||
#ifndef GL_ARB_map_buffer_range
|
||||
@@ -5437,6 +5563,10 @@ GLAPI void APIENTRY glCopyBufferSubData (GLenum, GLenum, GLintptr, GLintptr, GLs
|
||||
typedef void (APIENTRYP PFNGLCOPYBUFFERSUBDATAPROC) (GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size);
|
||||
#endif
|
||||
|
||||
#ifndef GL_ARB_shader_texture_lod
|
||||
#define GL_ARB_shader_texture_lod 1
|
||||
#endif
|
||||
|
||||
#ifndef GL_EXT_abgr
|
||||
#define GL_EXT_abgr 1
|
||||
#endif
|
||||
@@ -8150,7 +8280,6 @@ GLAPI void APIENTRY glGetVideoivNV (GLuint, GLenum, GLint *);
|
||||
GLAPI void APIENTRY glGetVideouivNV (GLuint, GLenum, GLuint *);
|
||||
GLAPI void APIENTRY glGetVideoi64vNV (GLuint, GLenum, GLint64EXT *);
|
||||
GLAPI void APIENTRY glGetVideoui64vNV (GLuint, GLenum, GLuint64EXT *);
|
||||
GLAPI void APIENTRY glVideoParameterivNV (GLuint, GLenum, const GLint *);
|
||||
#endif /* GL_GLEXT_PROTOTYPES */
|
||||
typedef void (APIENTRYP PFNGLPRESENTFRAMEKEYEDNVPROC) (GLuint video_slot, GLuint64EXT minPresentTime, GLuint beginPresentTimeId, GLuint presentDurationId, GLenum type, GLenum target0, GLuint fill0, GLuint key0, GLenum target1, GLuint fill1, GLuint key1);
|
||||
typedef void (APIENTRYP PFNGLPRESENTFRAMEDUALFILLNVPROC) (GLuint video_slot, GLuint64EXT minPresentTime, GLuint beginPresentTimeId, GLuint presentDurationId, GLenum type, GLenum target0, GLuint fill0, GLenum target1, GLuint fill1, GLenum target2, GLuint fill2, GLenum target3, GLuint fill3);
|
||||
@@ -8158,7 +8287,6 @@ typedef void (APIENTRYP PFNGLGETVIDEOIVNVPROC) (GLuint video_slot, GLenum pname,
|
||||
typedef void (APIENTRYP PFNGLGETVIDEOUIVNVPROC) (GLuint video_slot, GLenum pname, GLuint *params);
|
||||
typedef void (APIENTRYP PFNGLGETVIDEOI64VNVPROC) (GLuint video_slot, GLenum pname, GLint64EXT *params);
|
||||
typedef void (APIENTRYP PFNGLGETVIDEOUI64VNVPROC) (GLuint video_slot, GLenum pname, GLuint64EXT *params);
|
||||
typedef void (APIENTRYP PFNGLVIDEOPARAMETERIVNVPROC) (GLuint video_slot, GLenum pname, const GLint *params);
|
||||
#endif
|
||||
|
||||
#ifndef GL_EXT_transform_feedback
|
||||
|
||||
+11
-1
@@ -6,7 +6,7 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
** Copyright (c) 2007 The Khronos Group Inc.
|
||||
** Copyright (c) 2007-2009 The Khronos Group Inc.
|
||||
**
|
||||
** Permission is hereby granted, free of charge, to any person obtaining a
|
||||
** copy of this software and/or associated documentation files (the
|
||||
@@ -28,6 +28,8 @@ extern "C" {
|
||||
** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
|
||||
*/
|
||||
|
||||
/* Function declaration macros - to move into glplatform.h */
|
||||
|
||||
#if defined(_WIN32) && !defined(APIENTRY) && !defined(__CYGWIN__) && !defined(__SCITECH_SNAP__)
|
||||
#define WIN32_LEAN_AND_MEAN 1
|
||||
#include <windows.h>
|
||||
@@ -709,6 +711,14 @@ typedef BOOL (WINAPI * PFNWGLQUERYFRAMETRACKINGI3DPROC) (DWORD *pFrameCount, DWO
|
||||
#define WGL_NV_float_buffer 1
|
||||
#endif
|
||||
|
||||
#ifndef WGL_3DL_stereo_control
|
||||
#define WGL_3DL_stereo_control 1
|
||||
#ifdef WGL_WGLEXT_PROTOTYPES
|
||||
extern BOOL WINAPI wglSetStereoEmitterState3DL (HDC, UINT);
|
||||
#endif /* WGL_WGLEXT_PROTOTYPES */
|
||||
typedef BOOL (WINAPI * PFNWGLSETSTEREOEMITTERSTATE3DLPROC) (HDC hDC, UINT uState);
|
||||
#endif
|
||||
|
||||
#ifndef WGL_EXT_pixel_format_packed_float
|
||||
#define WGL_EXT_pixel_format_packed_float 1
|
||||
#endif
|
||||
|
||||
+11
-10
@@ -80,25 +80,26 @@ clean:
|
||||
-rm -f *.o *~
|
||||
-rm -f extfuncs.h
|
||||
-rm -f shaderutil.*
|
||||
-rm -f readtex.*
|
||||
|
||||
|
||||
|
||||
##### Extra dependencies
|
||||
|
||||
extfuncs.h:
|
||||
cp $(TOP)/progs/util/extfuncs.h .
|
||||
extfuncs.h: $(TOP)/progs/util/extfuncs.h
|
||||
cp $< .
|
||||
|
||||
readtex.c:
|
||||
cp $(TOP)/progs/util/readtex.c .
|
||||
readtex.c: $(TOP)/progs/util/readtex.c
|
||||
cp $< .
|
||||
|
||||
readtex.h:
|
||||
cp $(TOP)/progs/util/readtex.h .
|
||||
readtex.h: $(TOP)/progs/util/readtex.h
|
||||
cp $< .
|
||||
|
||||
shaderutil.c:
|
||||
cp $(TOP)/progs/util/shaderutil.c .
|
||||
shaderutil.c: $(TOP)/progs/util/shaderutil.c
|
||||
cp $< .
|
||||
|
||||
shaderutil.h:
|
||||
cp $(TOP)/progs/util/shaderutil.h .
|
||||
shaderutil.h: $(TOP)/progs/util/shaderutil.h
|
||||
cp $< .
|
||||
|
||||
|
||||
|
||||
|
||||
+87
-6
@@ -51,6 +51,8 @@ static GLfloat Xrot = 0.0, Yrot = .0, Zrot = 0.0;
|
||||
static GLfloat EyeDist = 10;
|
||||
static GLboolean Anim = GL_TRUE;
|
||||
static GLboolean UseArrays = GL_TRUE;
|
||||
static GLboolean UseVBO = GL_TRUE;
|
||||
static GLuint VBO = 0;
|
||||
|
||||
static GLint VertCoord_attr = -1, TexCoord0_attr = -1, TexCoord1_attr = -1;
|
||||
|
||||
@@ -76,28 +78,81 @@ static const GLfloat VertCoords[4][2] = {
|
||||
};
|
||||
|
||||
|
||||
|
||||
static void
|
||||
SetupVertexBuffer(void)
|
||||
{
|
||||
glGenBuffersARB_func(1, &VBO);
|
||||
glBindBufferARB_func(GL_ARRAY_BUFFER_ARB, VBO);
|
||||
|
||||
glBufferDataARB_func(GL_ARRAY_BUFFER_ARB,
|
||||
sizeof(VertCoords) +
|
||||
sizeof(Tex0Coords) +
|
||||
sizeof(Tex1Coords),
|
||||
NULL,
|
||||
GL_STATIC_DRAW_ARB);
|
||||
|
||||
/* non-interleaved vertex arrays */
|
||||
|
||||
glBufferSubDataARB_func(GL_ARRAY_BUFFER_ARB,
|
||||
0, /* offset */
|
||||
sizeof(VertCoords), /* size */
|
||||
VertCoords); /* data */
|
||||
|
||||
glBufferSubDataARB_func(GL_ARRAY_BUFFER_ARB,
|
||||
sizeof(VertCoords), /* offset */
|
||||
sizeof(Tex0Coords), /* size */
|
||||
Tex0Coords); /* data */
|
||||
|
||||
glBufferSubDataARB_func(GL_ARRAY_BUFFER_ARB,
|
||||
sizeof(VertCoords) +
|
||||
sizeof(Tex0Coords), /* offset */
|
||||
sizeof(Tex1Coords), /* size */
|
||||
Tex1Coords); /* data */
|
||||
|
||||
glBindBufferARB_func(GL_ARRAY_BUFFER_ARB, 0);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
DrawPolygonArray(void)
|
||||
{
|
||||
void *vertPtr, *tex0Ptr, *tex1Ptr;
|
||||
|
||||
if (UseVBO) {
|
||||
glBindBufferARB_func(GL_ARRAY_BUFFER_ARB, VBO);
|
||||
vertPtr = (void *) 0;
|
||||
tex0Ptr = (void *) sizeof(VertCoords);
|
||||
tex1Ptr = (void *) (sizeof(VertCoords) + sizeof(Tex0Coords));
|
||||
}
|
||||
else {
|
||||
glBindBufferARB_func(GL_ARRAY_BUFFER_ARB, 0);
|
||||
vertPtr = VertCoords;
|
||||
tex0Ptr = Tex0Coords;
|
||||
tex1Ptr = Tex1Coords;
|
||||
}
|
||||
|
||||
if (VertCoord_attr >= 0) {
|
||||
glVertexAttribPointer_func(VertCoord_attr, 2, GL_FLOAT, GL_FALSE,
|
||||
0, VertCoords);
|
||||
0, vertPtr);
|
||||
glEnableVertexAttribArray_func(VertCoord_attr);
|
||||
}
|
||||
else {
|
||||
glVertexPointer(2, GL_FLOAT, 0, VertCoords);
|
||||
glVertexPointer(2, GL_FLOAT, 0, vertPtr);
|
||||
glEnable(GL_VERTEX_ARRAY);
|
||||
}
|
||||
|
||||
glVertexAttribPointer_func(TexCoord0_attr, 2, GL_FLOAT, GL_FALSE,
|
||||
0, Tex0Coords);
|
||||
0, tex0Ptr);
|
||||
glEnableVertexAttribArray_func(TexCoord0_attr);
|
||||
|
||||
glVertexAttribPointer_func(TexCoord1_attr, 2, GL_FLOAT, GL_FALSE,
|
||||
0, Tex1Coords);
|
||||
0, tex1Ptr);
|
||||
glEnableVertexAttribArray_func(TexCoord1_attr);
|
||||
|
||||
glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
|
||||
|
||||
glBindBufferARB_func(GL_ARRAY_BUFFER_ARB, 0);
|
||||
}
|
||||
|
||||
|
||||
@@ -163,6 +218,10 @@ key(unsigned char k, int x, int y)
|
||||
UseArrays = !UseArrays;
|
||||
printf("Arrays: %d\n", UseArrays);
|
||||
break;
|
||||
case 'v':
|
||||
UseVBO = !UseVBO;
|
||||
printf("Use VBO: %d\n", UseVBO);
|
||||
break;
|
||||
case ' ':
|
||||
Anim = !Anim;
|
||||
if (Anim)
|
||||
@@ -271,9 +330,24 @@ CreateProgram(const char *vertProgFile, const char *fragProgFile,
|
||||
|
||||
InitUniforms(program, uniforms);
|
||||
|
||||
VertCoord_attr = glGetAttribLocation_func(program, "VertCoord");
|
||||
if (VertCoord_attr > 0) {
|
||||
/* We want the VertCoord attrib to have position zero so that
|
||||
* the call to glVertexAttrib(0, xyz) triggers vertex processing.
|
||||
* Otherwise, if TexCoord0 or TexCoord1 gets position 0 we'd have
|
||||
* to set that attribute last (which is a PITA to manage).
|
||||
*/
|
||||
glBindAttribLocation_func(program, 0, "VertCoord");
|
||||
/* re-link */
|
||||
glLinkProgram_func(program);
|
||||
/* VertCoord_attr should be zero now */
|
||||
VertCoord_attr = glGetAttribLocation_func(program, "VertCoord");
|
||||
assert(VertCoord_attr == 0);
|
||||
}
|
||||
|
||||
TexCoord0_attr = glGetAttribLocation_func(program, "TexCoord0");
|
||||
TexCoord1_attr = glGetAttribLocation_func(program, "TexCoord1");
|
||||
VertCoord_attr = glGetAttribLocation_func(program, "VertCoord");
|
||||
|
||||
printf("TexCoord0_attr = %d\n", TexCoord0_attr);
|
||||
printf("TexCoord1_attr = %d\n", TexCoord1_attr);
|
||||
printf("VertCoord_attr = %d\n", VertCoord_attr);
|
||||
@@ -299,12 +373,19 @@ InitGL(void)
|
||||
/*exit(1);*/
|
||||
}
|
||||
printf("GL_RENDERER = %s\n",(const char *) glGetString(GL_RENDERER));
|
||||
|
||||
printf("Usage:\n");
|
||||
printf(" a - toggle arrays vs. immediate mode rendering\n");
|
||||
printf(" v - toggle VBO usage for array rendering\n");
|
||||
printf(" z/Z - change viewing distance\n");
|
||||
printf(" SPACE - toggle animation\n");
|
||||
printf(" Esc - exit\n");
|
||||
GetExtensionFuncs();
|
||||
|
||||
InitTextures();
|
||||
InitPrograms();
|
||||
|
||||
SetupVertexBuffer();
|
||||
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
|
||||
glClearColor(.6, .6, .9, 0);
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
simple_client
|
||||
simple_server
|
||||
shdr_info
|
||||
shdr_dump
|
||||
shdr_disable
|
||||
ctx_info
|
||||
tex_dump
|
||||
tex_info
|
||||
*.bmp
|
||||
@@ -0,0 +1,46 @@
|
||||
# progs/rbug/Makefile
|
||||
|
||||
TOP = ../..
|
||||
include $(TOP)/configs/current
|
||||
|
||||
INCLUDES = \
|
||||
-I. \
|
||||
-I$(TOP)/src/gallium/include \
|
||||
-I$(TOP)/src/gallium/auxiliary \
|
||||
-I$(TOP)/src/gallium/drivers \
|
||||
$(PROG_INCLUDES)
|
||||
|
||||
LINKS = \
|
||||
$(GALLIUM_AUXILIARIES) \
|
||||
$(PROG_LINKS)
|
||||
|
||||
SOURCES = \
|
||||
simple_client.c \
|
||||
simple_server.c \
|
||||
shdr_info.c \
|
||||
shdr_dump.c \
|
||||
shdr_disable.c \
|
||||
ctx_info.c \
|
||||
tex_info.c \
|
||||
tex_dump.c
|
||||
|
||||
|
||||
OBJECTS = $(SOURCES:.c=.o)
|
||||
|
||||
PROGS = $(OBJECTS:.o=)
|
||||
|
||||
##### TARGETS #####
|
||||
|
||||
default: $(OBJECTS) $(PROGS)
|
||||
|
||||
clean:
|
||||
-rm -f $(PROGS)
|
||||
-rm -f *.o
|
||||
|
||||
##### RULES #####
|
||||
|
||||
$(OBJECTS): %.o: %.c
|
||||
$(CC) -c $(INCLUDES) $(CFLAGS) $(DEFINES) $(PROG_DEFINES) $< -o $@
|
||||
|
||||
$(PROGS): %: %.o
|
||||
$(CC) $(LDFLAGS) $< $(LINKS) -o $@
|
||||
@@ -0,0 +1,39 @@
|
||||
REMOTE DEBUGGING CLI APPLICATIONS
|
||||
|
||||
|
||||
= About =
|
||||
|
||||
This directory contains a Gallium3D remote debugging cli applications.
|
||||
|
||||
|
||||
= Build Instructions =
|
||||
|
||||
To build, build a normal gallium build and from this directory do the following.
|
||||
|
||||
make
|
||||
|
||||
= Usage =
|
||||
|
||||
Make sure that you driver has trace integration, see
|
||||
src/gallium/driver/trace/README for more information about that. Then from on
|
||||
the computer that you want to debug do:
|
||||
|
||||
export GALLIUM_RBUG=true
|
||||
|
||||
<launch app>
|
||||
|
||||
From the debugging computer launch apps form this directory. Currently ip
|
||||
addresses are hardcoded and you need to edit the application, but that will
|
||||
change in the future.
|
||||
|
||||
= Testing =
|
||||
|
||||
The two apps simple_client and simple_server. Are unit testing of the
|
||||
connection and (de)marsheler. Just run the server first and then the client:
|
||||
|
||||
./simple_server &
|
||||
./simple_client
|
||||
|
||||
|
||||
--
|
||||
Jakob Bornecrantz <jakob@vmware.com>
|
||||
@@ -0,0 +1,80 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#include "pipe/p_compiler.h"
|
||||
#include "pipe/p_format.h"
|
||||
#include "util/u_memory.h"
|
||||
#include "util/u_debug.h"
|
||||
#include "util/u_network.h"
|
||||
|
||||
#include "rbug/rbug.h"
|
||||
|
||||
static void talk()
|
||||
{
|
||||
int c = u_socket_connect("localhost", 13370);
|
||||
struct rbug_connection *con = rbug_from_socket(c);
|
||||
struct rbug_header *header;
|
||||
struct rbug_proto_context_list_reply *list;
|
||||
struct rbug_proto_context_info_reply *info;
|
||||
int i;
|
||||
|
||||
assert(c >= 0);
|
||||
assert(con);
|
||||
debug_printf("Connection get!\n");
|
||||
|
||||
debug_printf("Sending get contexts\n");
|
||||
rbug_send_context_list(con, NULL);
|
||||
|
||||
debug_printf("Waiting for contexts\n");
|
||||
header = rbug_get_message(con, NULL);
|
||||
assert(header->opcode == RBUG_OP_CONTEXT_LIST_REPLY);
|
||||
list = (struct rbug_proto_context_list_reply *)header;
|
||||
|
||||
debug_printf("Got contexts:\n");
|
||||
for (i = 0; i < list->contexts_len; i++) {
|
||||
#if 0
|
||||
rbug_send_contexts_info(con, list->contexts[i], NULL);
|
||||
|
||||
header = rbug_get_message(con, NULL);
|
||||
assert(header->opcode == RBUG_OP_CONTEXT_INFO_REPLY);
|
||||
info = (struct rbug_proto_context_info_reply *)header;
|
||||
#else
|
||||
(void)info;
|
||||
header = NULL;
|
||||
#endif
|
||||
|
||||
debug_printf("%llu\n",
|
||||
(unsigned long long)list->contexts[i]);
|
||||
rbug_free_header(header);
|
||||
}
|
||||
|
||||
rbug_free_header(&list->header);
|
||||
rbug_disconnect(con);
|
||||
}
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
talk();
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#include "pipe/p_compiler.h"
|
||||
#include "pipe/p_format.h"
|
||||
#include "util/u_memory.h"
|
||||
#include "util/u_debug.h"
|
||||
#include "util/u_network.h"
|
||||
|
||||
#include "rbug/rbug.h"
|
||||
|
||||
static void talk(rbug_context_t ctx, rbug_shader_t shdr)
|
||||
{
|
||||
int c = u_socket_connect("localhost", 13370);
|
||||
struct rbug_connection *con = rbug_from_socket(c);
|
||||
struct rbug_header *header;
|
||||
|
||||
assert(c >= 0);
|
||||
assert(con);
|
||||
debug_printf("Connection get!\n");
|
||||
|
||||
rbug_send_shader_disable(con, ctx, shdr, true, NULL);
|
||||
|
||||
rbug_send_ping(con, NULL);
|
||||
|
||||
debug_printf("Sent waiting for reply\n");
|
||||
header = rbug_get_message(con, NULL);
|
||||
|
||||
if (header->opcode != RBUG_OP_PING_REPLY)
|
||||
debug_printf("Error\n");
|
||||
else
|
||||
debug_printf("Ok!\n");
|
||||
|
||||
rbug_free_header(header);
|
||||
rbug_disconnect(con);
|
||||
}
|
||||
|
||||
static void print_usage()
|
||||
{
|
||||
printf("Usage shdr_disable <context> <shader>\n");
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
long ctx;
|
||||
long shdr;
|
||||
|
||||
if (argc < 3)
|
||||
print_usage();
|
||||
|
||||
ctx = atol(argv[1]);
|
||||
shdr = atol(argv[2]);
|
||||
|
||||
if (ctx <= 0 && ctx <= 0)
|
||||
print_usage();
|
||||
|
||||
talk((uint64_t)ctx, (uint64_t)shdr);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,115 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#include "pipe/p_compiler.h"
|
||||
#include "pipe/p_format.h"
|
||||
#include "util/u_memory.h"
|
||||
#include "util/u_debug.h"
|
||||
#include "util/u_network.h"
|
||||
|
||||
#include "rbug/rbug.h"
|
||||
|
||||
#include "tgsi/tgsi_dump.h"
|
||||
|
||||
static void shader_info(struct rbug_connection *con, rbug_context_t ctx)
|
||||
{
|
||||
struct rbug_header *header;
|
||||
struct rbug_proto_shader_list_reply *list;
|
||||
struct rbug_proto_shader_info_reply *info;
|
||||
int i;
|
||||
|
||||
debug_printf("Sending get shaders to %llu\n", (unsigned long long)ctx);
|
||||
rbug_send_shader_list(con, ctx, NULL);
|
||||
|
||||
debug_printf("Waiting for shaders from %llu\n", (unsigned long long)ctx);
|
||||
header = rbug_get_message(con, NULL);
|
||||
assert(header->opcode == RBUG_OP_SHADER_LIST_REPLY);
|
||||
list = (struct rbug_proto_shader_list_reply *)header;
|
||||
|
||||
debug_printf("Got shaders:\n");
|
||||
for (i = 0; i < list->shaders_len; i++) {
|
||||
rbug_send_shader_info(con, ctx, list->shaders[i], NULL);
|
||||
|
||||
header = rbug_get_message(con, NULL);
|
||||
assert(header->opcode == RBUG_OP_SHADER_INFO_REPLY);
|
||||
info = (struct rbug_proto_shader_info_reply *)header;
|
||||
|
||||
debug_printf("#####################################################\n");
|
||||
debug_printf("ctx: %llu shdr: %llu disabled %u\n",
|
||||
(unsigned long long)ctx,
|
||||
(unsigned long long)list->shaders[i],
|
||||
info->disabled);
|
||||
|
||||
/* just to be sure */
|
||||
assert(sizeof(struct tgsi_token) == 4);
|
||||
|
||||
debug_printf("-----------------------------------------------------\n");
|
||||
tgsi_dump((struct tgsi_token *)info->original, 0);
|
||||
|
||||
if (info->replaced_len > 0) {
|
||||
debug_printf("-----------------------------------------------------\n");
|
||||
tgsi_dump((struct tgsi_token *)info->replaced, 0);
|
||||
}
|
||||
|
||||
rbug_free_header(header);
|
||||
}
|
||||
|
||||
debug_printf("#####################################################\n");
|
||||
rbug_free_header(&list->header);
|
||||
}
|
||||
|
||||
static void talk()
|
||||
{
|
||||
int c = u_socket_connect("localhost", 13370);
|
||||
struct rbug_connection *con = rbug_from_socket(c);
|
||||
struct rbug_header *header;
|
||||
struct rbug_proto_context_list_reply *list;
|
||||
int i;
|
||||
|
||||
assert(c >= 0);
|
||||
assert(con);
|
||||
debug_printf("Connection get!\n");
|
||||
|
||||
debug_printf("Sending get contexts\n");
|
||||
rbug_send_context_list(con, NULL);
|
||||
|
||||
debug_printf("Waiting for contexts\n");
|
||||
header = rbug_get_message(con, NULL);
|
||||
assert(header->opcode == RBUG_OP_CONTEXT_LIST_REPLY);
|
||||
list = (struct rbug_proto_context_list_reply *)header;
|
||||
|
||||
debug_printf("Got contexts:\n");
|
||||
for (i = 0; i < list->contexts_len; i++) {
|
||||
shader_info(con, list->contexts[i]);
|
||||
}
|
||||
|
||||
rbug_free_header(&list->header);
|
||||
rbug_disconnect(con);
|
||||
}
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
talk();
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,98 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#include "pipe/p_compiler.h"
|
||||
#include "pipe/p_format.h"
|
||||
#include "util/u_memory.h"
|
||||
#include "util/u_debug.h"
|
||||
#include "util/u_network.h"
|
||||
|
||||
#include "rbug/rbug.h"
|
||||
|
||||
static void shader_info(struct rbug_connection *con, rbug_context_t ctx)
|
||||
{
|
||||
struct rbug_header *header;
|
||||
struct rbug_proto_shader_list_reply *list;
|
||||
struct rbug_proto_shader_info_reply *info;
|
||||
int i;
|
||||
|
||||
rbug_send_shader_list(con, ctx, NULL);
|
||||
|
||||
header = rbug_get_message(con, NULL);
|
||||
assert(header->opcode == RBUG_OP_SHADER_LIST_REPLY);
|
||||
list = (struct rbug_proto_shader_list_reply *)header;
|
||||
|
||||
debug_printf(" context | shader | disabled |\n");
|
||||
for (i = 0; i < list->shaders_len; i++) {
|
||||
rbug_send_shader_info(con, ctx, list->shaders[i], NULL);
|
||||
|
||||
header = rbug_get_message(con, NULL);
|
||||
assert(header->opcode == RBUG_OP_SHADER_INFO_REPLY);
|
||||
info = (struct rbug_proto_shader_info_reply *)header;
|
||||
|
||||
debug_printf("% 15llu |% 15llu |% 15u |\n",
|
||||
(unsigned long long)ctx,
|
||||
(unsigned long long)list->shaders[i],
|
||||
(unsigned)info->disabled);
|
||||
|
||||
rbug_free_header(header);
|
||||
}
|
||||
|
||||
rbug_free_header(&list->header);
|
||||
}
|
||||
|
||||
static void talk()
|
||||
{
|
||||
int c = u_socket_connect("localhost", 13370);
|
||||
struct rbug_connection *con = rbug_from_socket(c);
|
||||
struct rbug_header *header;
|
||||
struct rbug_proto_context_list_reply *list;
|
||||
int i;
|
||||
|
||||
assert(c >= 0);
|
||||
assert(con);
|
||||
debug_printf("Connection get!\n");
|
||||
|
||||
debug_printf("Sending get contexts\n");
|
||||
rbug_send_context_list(con, NULL);
|
||||
|
||||
debug_printf("Waiting for contexts\n");
|
||||
header = rbug_get_message(con, NULL);
|
||||
assert(header->opcode == RBUG_OP_CONTEXT_LIST_REPLY);
|
||||
list = (struct rbug_proto_context_list_reply *)header;
|
||||
|
||||
debug_printf("Got contexts:\n");
|
||||
for (i = 0; i < list->contexts_len; i++) {
|
||||
shader_info(con, list->contexts[i]);
|
||||
}
|
||||
|
||||
rbug_free_header(&list->header);
|
||||
rbug_disconnect(con);
|
||||
}
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
talk();
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#include "pipe/p_compiler.h"
|
||||
#include "util/u_memory.h"
|
||||
#include "util/u_debug.h"
|
||||
#include "util/u_network.h"
|
||||
|
||||
#include "rbug/rbug.h"
|
||||
|
||||
static void talk()
|
||||
{
|
||||
int c = u_socket_connect("localhost", 13370);
|
||||
struct rbug_connection *con = rbug_from_socket(c);
|
||||
struct rbug_header *header;
|
||||
struct rbug_proto_texture_list_reply *list;
|
||||
int i;
|
||||
|
||||
assert(c >= 0);
|
||||
assert(con);
|
||||
debug_printf("Connection get!\n");
|
||||
|
||||
debug_printf("Sending get textures\n");
|
||||
rbug_send_texture_list(con, NULL);
|
||||
|
||||
debug_printf("Waiting for textures\n");
|
||||
header = rbug_get_message(con, NULL);
|
||||
assert(header->opcode == RBUG_OP_TEXTURE_LIST_REPLY);
|
||||
list = (struct rbug_proto_texture_list_reply *)header;
|
||||
|
||||
debug_printf("Got textures:\n");
|
||||
for (i = 0; i < list->textures_len; i++)
|
||||
debug_printf("\ttex %llu\n", (unsigned long long)list->textures[i]);
|
||||
|
||||
rbug_free_header(header);
|
||||
rbug_disconnect(con);
|
||||
}
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
talk();
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#include "pipe/p_compiler.h"
|
||||
#include "util/u_memory.h"
|
||||
#include "util/u_debug.h"
|
||||
#include "util/u_network.h"
|
||||
|
||||
#include "rbug/rbug.h"
|
||||
|
||||
static void wait()
|
||||
{
|
||||
int s = u_socket_listen_on_port(13370);
|
||||
int c = u_socket_accept(s);
|
||||
struct rbug_connection *con = rbug_from_socket(c);
|
||||
struct rbug_header *header;
|
||||
rbug_texture_t texs[2];
|
||||
uint32_t serial;
|
||||
texs[0] = 1337;
|
||||
texs[1] = 7331;
|
||||
|
||||
assert(s >= 0);
|
||||
assert(c >= 0);
|
||||
assert(con);
|
||||
debug_printf("Connection get!\n");
|
||||
|
||||
debug_printf("Waiting for get textures\n");
|
||||
header = rbug_get_message(con, &serial);
|
||||
assert(header);
|
||||
assert(header->opcode == RBUG_OP_TEXTURE_LIST);
|
||||
rbug_free_header(header);
|
||||
|
||||
rbug_send_texture_list_reply(con, serial, texs, 2, NULL);
|
||||
rbug_disconnect(con);
|
||||
}
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
wait();
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,127 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#include "pipe/p_compiler.h"
|
||||
#include "pipe/p_format.h"
|
||||
#include "pipe/p_state.h"
|
||||
#include "util/u_memory.h"
|
||||
#include "util/u_debug.h"
|
||||
#include "util/u_network.h"
|
||||
#include "util/u_tile.h"
|
||||
#include "rbug/rbug.h"
|
||||
|
||||
static void dump(rbug_texture_t tex,
|
||||
struct rbug_proto_texture_info_reply *info,
|
||||
struct rbug_proto_texture_read_reply *read,
|
||||
int mip)
|
||||
{
|
||||
enum pipe_format format = info->format;
|
||||
uint8_t *data = read->data;
|
||||
unsigned width = info->width[mip];
|
||||
unsigned height = info->height[mip];
|
||||
unsigned dst_stride = width * 4 * 4;
|
||||
unsigned src_stride = read->stride;
|
||||
float *rgba = MALLOC(dst_stride * height);
|
||||
int i;
|
||||
char filename[512];
|
||||
|
||||
util_snprintf(filename, 512, "%llu_%s_%u.bmp",
|
||||
(unsigned long long)tex, pf_name(info->format), mip);
|
||||
|
||||
if (pf_is_compressed(info->format)) {
|
||||
debug_printf("skipping: %s\n", filename);
|
||||
return;
|
||||
}
|
||||
|
||||
debug_printf("saving: %s\n", filename);
|
||||
|
||||
for (i = 0; i < height; i++) {
|
||||
pipe_tile_raw_to_rgba(format, data + src_stride * i,
|
||||
width, 1,
|
||||
&rgba[width*4*i], dst_stride);
|
||||
}
|
||||
|
||||
debug_dump_float_rgba_bmp(filename, width, height, rgba, width);
|
||||
|
||||
FREE(rgba);
|
||||
}
|
||||
|
||||
static void talk()
|
||||
{
|
||||
int c = u_socket_connect("localhost", 13370);
|
||||
struct rbug_connection *con = rbug_from_socket(c);
|
||||
struct rbug_header *header;
|
||||
struct rbug_header *header2;
|
||||
struct rbug_proto_texture_list_reply *list;
|
||||
struct rbug_proto_texture_info_reply *info;
|
||||
struct rbug_proto_texture_read_reply *read;
|
||||
int i, j;
|
||||
|
||||
assert(c >= 0);
|
||||
assert(con);
|
||||
debug_printf("Connection get!\n");
|
||||
|
||||
debug_printf("Sending get textures\n");
|
||||
rbug_send_texture_list(con, NULL);
|
||||
|
||||
debug_printf("Waiting for textures\n");
|
||||
header = rbug_get_message(con, NULL);
|
||||
assert(header->opcode == RBUG_OP_TEXTURE_LIST_REPLY);
|
||||
list = (struct rbug_proto_texture_list_reply *)header;
|
||||
|
||||
debug_printf("Got textures:\n");
|
||||
for (i = 0; i < list->textures_len; i++) {
|
||||
rbug_send_texture_info(con, list->textures[i], NULL);
|
||||
|
||||
header = rbug_get_message(con, NULL);
|
||||
assert(header->opcode == RBUG_OP_TEXTURE_INFO_REPLY);
|
||||
info = (struct rbug_proto_texture_info_reply *)header;
|
||||
|
||||
for (j = 0; j <= info->last_level; j++) {
|
||||
rbug_send_texture_read(con, list->textures[i],
|
||||
0, j, 0,
|
||||
0, 0, info->width[j], info->height[j],
|
||||
NULL);
|
||||
|
||||
header2 = rbug_get_message(con, NULL);
|
||||
assert(header2->opcode == RBUG_OP_TEXTURE_READ_REPLY);
|
||||
read = (struct rbug_proto_texture_read_reply *)header2;
|
||||
|
||||
dump(list->textures[i], info, read, j);
|
||||
|
||||
rbug_free_header(header2);
|
||||
}
|
||||
|
||||
rbug_free_header(header);
|
||||
|
||||
}
|
||||
rbug_free_header(&list->header);
|
||||
rbug_disconnect(con);
|
||||
}
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
talk();
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#include "pipe/p_compiler.h"
|
||||
#include "pipe/p_format.h"
|
||||
#include "util/u_memory.h"
|
||||
#include "util/u_debug.h"
|
||||
#include "util/u_network.h"
|
||||
|
||||
#include "rbug/rbug.h"
|
||||
|
||||
static void talk()
|
||||
{
|
||||
int c = u_socket_connect("localhost", 13370);
|
||||
struct rbug_connection *con = rbug_from_socket(c);
|
||||
struct rbug_header *header;
|
||||
struct rbug_proto_texture_list_reply *list;
|
||||
struct rbug_proto_texture_info_reply *info;
|
||||
int i;
|
||||
|
||||
assert(c >= 0);
|
||||
assert(con);
|
||||
debug_printf("Connection get!\n");
|
||||
|
||||
debug_printf("Sending get textures\n");
|
||||
rbug_send_texture_list(con, NULL);
|
||||
|
||||
debug_printf("Waiting for textures\n");
|
||||
header = rbug_get_message(con, NULL);
|
||||
assert(header->opcode == RBUG_OP_TEXTURE_LIST_REPLY);
|
||||
list = (struct rbug_proto_texture_list_reply *)header;
|
||||
|
||||
debug_printf("Got textures:\n");
|
||||
for (i = 0; i < list->textures_len; i++) {
|
||||
rbug_send_texture_info(con, list->textures[i], NULL);
|
||||
|
||||
header = rbug_get_message(con, NULL);
|
||||
assert(header->opcode == RBUG_OP_TEXTURE_INFO_REPLY);
|
||||
info = (struct rbug_proto_texture_info_reply *)header;
|
||||
|
||||
debug_printf("%llu %s %u x %u x %u, block(%ux%u %u), last_level: %u, nr_samples: %u, usage: %u\n",
|
||||
(unsigned long long)list->textures[i], pf_name(info->format),
|
||||
info->width[0], info->height[0], info->depth[0],
|
||||
info->blockw, info->blockh, info->blocksize,
|
||||
info->last_level, info->nr_samples, info->tex_usage);
|
||||
rbug_free_header(header);
|
||||
}
|
||||
|
||||
rbug_free_header(&list->header);
|
||||
rbug_disconnect(con);
|
||||
}
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
talk();
|
||||
return 0;
|
||||
}
|
||||
@@ -466,25 +466,22 @@ static void Draw(void)
|
||||
} else {
|
||||
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
|
||||
}
|
||||
#if 01
|
||||
|
||||
Viewport(0, 0); Point();
|
||||
Viewport(0, 1); Lines();
|
||||
Viewport(0, 2); LineStrip();
|
||||
Viewport(0, 3); LineLoop();
|
||||
|
||||
Viewport(1, 0); Bitmap();
|
||||
|
||||
Viewport(1, 1); TriangleFan();
|
||||
Viewport(1, 2); Triangles();
|
||||
Viewport(1, 3); TriangleStrip();
|
||||
|
||||
Viewport(2, 0); Rect();
|
||||
#endif
|
||||
Viewport(2, 1); PolygonFunc();
|
||||
#if 01
|
||||
Viewport(2, 2); Quads();
|
||||
Viewport(2, 3); QuadStrip();
|
||||
#endif
|
||||
|
||||
glFlush();
|
||||
|
||||
if (doubleBuffer) {
|
||||
|
||||
+40
-10
@@ -57,13 +57,19 @@ static struct { GLenum func; const char *str; } funcs[] =
|
||||
|
||||
static int curFunc = 0;
|
||||
static double clearVal = 1.0;
|
||||
|
||||
static float minZ = 0.0;
|
||||
static float maxZ = 1.0;
|
||||
|
||||
static void usage(void)
|
||||
{
|
||||
printf("t - toggle rendering order of triangles\n");
|
||||
printf("c - toggle Z clear value between 0, 1\n");
|
||||
printf("f - cycle through depth test functions\n");
|
||||
printf("t - toggle rendering order of triangles\n");
|
||||
printf("c - toggle Z clear value between 0, 1\n");
|
||||
printf("f - cycle through depth test functions\n");
|
||||
printf("n/N - decrease/increase depthrange minZ\n");
|
||||
printf("x/X - decrease/increase depthrange maxZ\n");
|
||||
printf("spc - reset\n");
|
||||
printf("z - set to reverse-direction (ztrick) mode\n");
|
||||
fflush(stdout);
|
||||
}
|
||||
|
||||
|
||||
@@ -97,9 +103,11 @@ static void drawRightTriangle(void)
|
||||
|
||||
void display(void)
|
||||
{
|
||||
printf("GL_CLEAR_DEPTH = %f GL_DEPTH_FUNC = %s\n",
|
||||
clearVal, funcs[curFunc].str);
|
||||
printf("GL_CLEAR_DEPTH = %.2f, GL_DEPTH_FUNC = %s, DepthRange(%.1f, %.1f)\n",
|
||||
clearVal, funcs[curFunc].str, minZ, maxZ);
|
||||
fflush(stdout);
|
||||
glClearDepth(clearVal);
|
||||
glDepthRange(minZ, maxZ);
|
||||
glDepthFunc(funcs[curFunc].func);
|
||||
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
@@ -131,27 +139,49 @@ void reshape(int w, int h)
|
||||
void keyboard(unsigned char key, int x, int y)
|
||||
{
|
||||
switch (key) {
|
||||
case 'n':
|
||||
minZ -= .1;
|
||||
break;
|
||||
case 'N':
|
||||
minZ += .1;
|
||||
break;
|
||||
case 'x':
|
||||
maxZ -= .1;
|
||||
break;
|
||||
case 'X':
|
||||
maxZ += .1;
|
||||
break;
|
||||
case 'c':
|
||||
case 'C':
|
||||
clearVal = 1.0 - clearVal;
|
||||
glutPostRedisplay();
|
||||
break;
|
||||
case 'f':
|
||||
case 'F':
|
||||
curFunc = (curFunc + 1) % NUM_FUNCS;
|
||||
glutPostRedisplay();
|
||||
break;
|
||||
case 't':
|
||||
case 'T':
|
||||
leftFirst = !leftFirst;
|
||||
glutPostRedisplay();
|
||||
break;
|
||||
case ' ':
|
||||
curFunc = 0;
|
||||
clearVal = 1.0;
|
||||
minZ = 0.0;
|
||||
maxZ = 1.0;
|
||||
break;
|
||||
case 'z':
|
||||
curFunc = 2;
|
||||
clearVal = 0.0;
|
||||
minZ = 1.0;
|
||||
maxZ = 0.0;
|
||||
break;
|
||||
case 27: /* Escape key */
|
||||
exit(0);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
return;
|
||||
}
|
||||
glutPostRedisplay();
|
||||
}
|
||||
|
||||
/* Main Loop
|
||||
|
||||
@@ -86,6 +86,15 @@ static PFNGLISVERTEXARRAYAPPLEPROC glIsVertexArrayAPPLE_func = NULL;
|
||||
/* GL_EXT_stencil_two_side */
|
||||
static PFNGLACTIVESTENCILFACEEXTPROC glActiveStencilFaceEXT_func = NULL;
|
||||
|
||||
/* GL_ARB_buffer_object */
|
||||
static PFNGLGENBUFFERSARBPROC glGenBuffersARB_func = NULL;
|
||||
static PFNGLDELETEBUFFERSARBPROC glDeleteBuffersARB_func = NULL;
|
||||
static PFNGLBINDBUFFERARBPROC glBindBufferARB_func = NULL;
|
||||
static PFNGLBUFFERDATAARBPROC glBufferDataARB_func = NULL;
|
||||
static PFNGLBUFFERSUBDATAARBPROC glBufferSubDataARB_func = NULL;
|
||||
static PFNGLMAPBUFFERARBPROC glMapBufferARB_func = NULL;
|
||||
static PFNGLUNMAPBUFFERARBPROC glUnmapBufferARB_func = NULL;
|
||||
|
||||
|
||||
static void
|
||||
GetExtensionFuncs(void)
|
||||
@@ -173,5 +182,15 @@ GetExtensionFuncs(void)
|
||||
|
||||
/* GL_EXT_stencil_two_side */
|
||||
glActiveStencilFaceEXT_func = (PFNGLACTIVESTENCILFACEEXTPROC) glutGetProcAddress("glActiveStencilFaceEXT");
|
||||
|
||||
/* GL_ARB_vertex_buffer_object */
|
||||
glGenBuffersARB_func = (PFNGLGENBUFFERSARBPROC) glutGetProcAddress("glGenBuffersARB");
|
||||
glDeleteBuffersARB_func = (PFNGLDELETEBUFFERSARBPROC) glutGetProcAddress("glDeleteBuffersARB");
|
||||
glBindBufferARB_func = (PFNGLBINDBUFFERARBPROC) glutGetProcAddress("glBindBufferARB");
|
||||
glBufferDataARB_func = (PFNGLBUFFERDATAARBPROC) glutGetProcAddress("glBufferDataARB");
|
||||
glBufferSubDataARB_func = (PFNGLBUFFERSUBDATAARBPROC) glutGetProcAddress("glBufferSubDataARB");
|
||||
glMapBufferARB_func = (PFNGLMAPBUFFERARBPROC) glutGetProcAddress("glMapBufferARB");
|
||||
glUnmapBufferARB_func = (PFNGLUNMAPBUFFERARBPROC) glutGetProcAddress("glUnmapBufferARB");
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
|
||||
void main() {
|
||||
gl_FrontColor = gl_Color;
|
||||
gl_PointSize = 2.0;
|
||||
gl_Position = gl_Vertex;
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
|
||||
void main() {
|
||||
gl_FrontColor = gl_Color;
|
||||
gl_PointSize = 10 * gl_Color.x;
|
||||
gl_Position = gl_Vertex;
|
||||
}
|
||||
+52
-6
@@ -10,6 +10,10 @@
|
||||
|
||||
static const char *filename = NULL;
|
||||
static GLuint nr_steps = 4;
|
||||
static GLuint prim = GL_TRIANGLES;
|
||||
static GLfloat psz = 1.0;
|
||||
static GLboolean pointsmooth = 0;
|
||||
static GLboolean program_point_size = 0;
|
||||
|
||||
static GLuint fragShader;
|
||||
static GLuint vertShader;
|
||||
@@ -229,6 +233,14 @@ static void subdiv( union vert *v0,
|
||||
}
|
||||
}
|
||||
|
||||
static void enable( GLenum value, GLboolean flag )
|
||||
{
|
||||
if (flag)
|
||||
glEnable(value);
|
||||
else
|
||||
glDisable(value);
|
||||
}
|
||||
|
||||
/** Assignment */
|
||||
#define ASSIGN_3V( V, V0, V1, V2 ) \
|
||||
do { \
|
||||
@@ -241,10 +253,13 @@ static void Display( void )
|
||||
{
|
||||
glClearColor(0.3, 0.3, 0.3, 1);
|
||||
glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
|
||||
glPointSize(psz);
|
||||
|
||||
glUseProgram(program);
|
||||
enable( GL_POINT_SMOOTH, pointsmooth );
|
||||
enable( GL_VERTEX_PROGRAM_POINT_SIZE_ARB, program_point_size );
|
||||
|
||||
glBegin(GL_TRIANGLES);
|
||||
glBegin(prim);
|
||||
|
||||
|
||||
{
|
||||
@@ -291,10 +306,41 @@ static void Key( unsigned char key, int x, int y )
|
||||
(void) x;
|
||||
(void) y;
|
||||
switch (key) {
|
||||
case 27:
|
||||
CleanUp();
|
||||
exit(0);
|
||||
break;
|
||||
case 'p':
|
||||
prim = GL_POINTS;
|
||||
break;
|
||||
case 't':
|
||||
prim = GL_TRIANGLES;
|
||||
break;
|
||||
case 's':
|
||||
psz += .5;
|
||||
break;
|
||||
case 'S':
|
||||
if (psz > .5)
|
||||
psz -= .5;
|
||||
break;
|
||||
case 'm':
|
||||
pointsmooth = !pointsmooth;
|
||||
break;
|
||||
case 'z':
|
||||
program_point_size = !program_point_size;
|
||||
break;
|
||||
case '+':
|
||||
nr_steps++;
|
||||
break;
|
||||
case '-':
|
||||
if (nr_steps)
|
||||
nr_steps--;
|
||||
break;
|
||||
case ' ':
|
||||
psz = 1.0;
|
||||
prim = GL_TRIANGLES;
|
||||
nr_steps = 4;
|
||||
break;
|
||||
case 27:
|
||||
CleanUp();
|
||||
exit(0);
|
||||
break;
|
||||
}
|
||||
glutPostRedisplay();
|
||||
}
|
||||
@@ -305,7 +351,7 @@ int main( int argc, char *argv[] )
|
||||
glutInitWindowPosition( 0, 0 );
|
||||
glutInitWindowSize( 250, 250 );
|
||||
glutInitDisplayMode( GLUT_RGB | GLUT_SINGLE | GLUT_DEPTH );
|
||||
glutCreateWindow(argv[0]);
|
||||
glutCreateWindow(argv[argc-1]);
|
||||
glewInit();
|
||||
glutReshapeFunc( Reshape );
|
||||
glutKeyboardFunc( Key );
|
||||
|
||||
+5
-6
@@ -348,7 +348,6 @@ print_screen_info(HDC _hdc, GLboolean limits)
|
||||
HWND win;
|
||||
HGLRC ctx;
|
||||
int visinfo;
|
||||
int width = 100, height = 100;
|
||||
HDC hdc;
|
||||
PIXELFORMATDESCRIPTOR pfd;
|
||||
|
||||
@@ -364,18 +363,18 @@ print_screen_info(HDC _hdc, GLboolean limits)
|
||||
win = CreateWindowEx(0,
|
||||
wc.lpszClassName,
|
||||
"wglinfo",
|
||||
WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN,
|
||||
WS_CLIPSIBLINGS | WS_CLIPCHILDREN,
|
||||
CW_USEDEFAULT,
|
||||
CW_USEDEFAULT,
|
||||
CW_USEDEFAULT,
|
||||
CW_USEDEFAULT,
|
||||
width,
|
||||
height,
|
||||
NULL,
|
||||
NULL,
|
||||
wc.hInstance,
|
||||
NULL);
|
||||
if (!win) {
|
||||
fprintf(stderr, "Couldn't create window");
|
||||
exit(1);
|
||||
return;
|
||||
}
|
||||
|
||||
hdc = GetDC(win);
|
||||
@@ -476,7 +475,7 @@ print_visual_attribs_verbose(int iPixelFormat, LPPIXELFORMATDESCRIPTOR ppfd)
|
||||
ppfd->dwFlags & PFD_DRAW_TO_WINDOW ? 1 : 0);
|
||||
printf(" bufferSize=%d level=%d renderType=%s doubleBuffer=%d stereo=%d\n",
|
||||
0 /* ppfd->bufferSize */, 0 /* ppfd->level */,
|
||||
visual_render_type_name(ppfd->dwFlags),
|
||||
visual_render_type_name(ppfd->iPixelType),
|
||||
ppfd->dwFlags & PFD_DOUBLEBUFFER ? 1 : 0,
|
||||
ppfd->dwFlags & PFD_STEREO ? 1 : 0);
|
||||
printf(" rgba: cRedBits=%d cGreenBits=%d cBlueBits=%d cAlphaBits=%d\n",
|
||||
|
||||
+26
-8
@@ -42,11 +42,17 @@ import SCons.Scanner
|
||||
def quietCommandLines(env):
|
||||
# Quiet command lines
|
||||
# See also http://www.scons.org/wiki/HidingCommandLinesInOutput
|
||||
env['ASCOMSTR'] = "Assembling $SOURCE ..."
|
||||
env['CCCOMSTR'] = "Compiling $SOURCE ..."
|
||||
env['SHCCCOMSTR'] = "Compiling $SOURCE ..."
|
||||
env['CXXCOMSTR'] = "Compiling $SOURCE ..."
|
||||
env['SHCXXCOMSTR'] = "Compiling $SOURCE ..."
|
||||
env['ARCOMSTR'] = "Archiving $TARGET ..."
|
||||
env['RANLIBCOMSTR'] = ""
|
||||
env['RANLIBCOMSTR'] = "Indexing $TARGET ..."
|
||||
env['LINKCOMSTR'] = "Linking $TARGET ..."
|
||||
env['SHLINKCOMSTR'] = "Linking $TARGET ..."
|
||||
env['LDMODULECOMSTR'] = "Linking $TARGET ..."
|
||||
env['SWIGCOMSTR'] = "Generating $TARGET ..."
|
||||
|
||||
|
||||
def createConvenienceLibBuilder(env):
|
||||
@@ -185,9 +191,8 @@ def num_jobs():
|
||||
def generate(env):
|
||||
"""Common environment generation code"""
|
||||
|
||||
# FIXME: this is already too late
|
||||
#if env.get('quiet', False):
|
||||
# quietCommandLines(env)
|
||||
if env.get('quiet', True):
|
||||
quietCommandLines(env)
|
||||
|
||||
# Toolchain
|
||||
platform = env['platform']
|
||||
@@ -357,11 +362,24 @@ def generate(env):
|
||||
'/GL-', # disable whole program optimization
|
||||
]
|
||||
else:
|
||||
if env['machine'] == 'x86_64':
|
||||
cflags += [
|
||||
# Same as /O2, but without global optimizations or auto-inlining
|
||||
# http://msdn.microsoft.com/en-us/library/8f8h5cxt.aspx
|
||||
'/Ob1', # enable inline expansion, disable auto-inlining
|
||||
'/Oi', # enable intrinsic functions
|
||||
'/Ot', # favors fast code
|
||||
'/Oy', # omit frame pointer
|
||||
'/Gs', # enable stack probes
|
||||
'/GF', # eliminate duplicate strings
|
||||
'/Gy', # enable function-level linking
|
||||
]
|
||||
else:
|
||||
cflags += [
|
||||
'/O2', # optimize for speed
|
||||
]
|
||||
cflags += [
|
||||
'/Ox', # maximum optimizations
|
||||
'/Oi', # enable intrinsic functions
|
||||
'/Ot', # favor code speed
|
||||
#'/fp:fast', # fast floating point
|
||||
#'/fp:fast', # fast floating point
|
||||
]
|
||||
if env['profile']:
|
||||
cflags += [
|
||||
|
||||
@@ -50,7 +50,7 @@ $(TOP)/$(LIB_DIR)/libEGLdri.so: $(OBJECTS)
|
||||
|
||||
install:
|
||||
$(INSTALL) -d $(DESTDIR)$(INSTALL_LIB_DIR)
|
||||
$(INSTALL) $(TOP)/$(LIB_DIR)/libEGLdri.so $(DESTDIR)$(INSTALL_LIB_DIR)
|
||||
$(MINSTALL) $(TOP)/$(LIB_DIR)/libEGLdri.so $(DESTDIR)$(INSTALL_LIB_DIR)
|
||||
|
||||
clean:
|
||||
-rm -f *.o
|
||||
|
||||
@@ -58,7 +58,7 @@ $(TOP)/$(LIB_DIR)/$(DRIVER_NAME): $(OBJECTS)
|
||||
|
||||
install:
|
||||
$(INSTALL) -d $(DESTDIR)$(INSTALL_LIB_DIR)
|
||||
$(INSTALL) $(TOP)/$(LIB_DIR)/$(DRIVER_NAME) $(DESTDIR)$(INSTALL_LIB_DIR)
|
||||
$(MINSTALL) $(TOP)/$(LIB_DIR)/$(DRIVER_NAME) $(DESTDIR)$(INSTALL_LIB_DIR)
|
||||
|
||||
clean:
|
||||
rm -f *.o
|
||||
|
||||
@@ -54,7 +54,7 @@ $(TOP)/$(LIB_DIR)/$(DRIVER_NAME): $(OBJECTS)
|
||||
|
||||
install:
|
||||
$(INSTALL) -d $(DESTDIR)$(INSTALL_LIB_DIR)
|
||||
$(INSTALL) $(TOP)/$(LIB_DIR)/$(DRIVER_NAME) $(DESTDIR)$(INSTALL_LIB_DIR)
|
||||
$(MINSTALL) $(TOP)/$(LIB_DIR)/$(DRIVER_NAME) $(DESTDIR)$(INSTALL_LIB_DIR)
|
||||
|
||||
clean:
|
||||
rm -f *.o
|
||||
|
||||
@@ -66,7 +66,7 @@ $(TOP)/$(LIB_DIR)/libEGL.so: $(OBJECTS)
|
||||
|
||||
install: default
|
||||
$(INSTALL) -d $(DESTDIR)$(INSTALL_LIB_DIR)
|
||||
$(INSTALL) $(TOP)/$(LIB_DIR)/libEGL.so* $(DESTDIR)$(INSTALL_LIB_DIR)
|
||||
$(MINSTALL) $(TOP)/$(LIB_DIR)/libEGL.so* $(DESTDIR)$(INSTALL_LIB_DIR)
|
||||
|
||||
clean:
|
||||
-rm -f *.o *.so*
|
||||
|
||||
@@ -22,6 +22,7 @@ SConscript([
|
||||
'auxiliary/draw/SConscript',
|
||||
'auxiliary/pipebuffer/SConscript',
|
||||
'auxiliary/indices/SConscript',
|
||||
'auxiliary/rbug/SConscript',
|
||||
])
|
||||
|
||||
for driver in env['drivers']:
|
||||
|
||||
@@ -60,8 +60,6 @@ struct aaline_fragment_shader
|
||||
struct pipe_shader_state state;
|
||||
void *driver_fs;
|
||||
void *aaline_fs;
|
||||
void *aapoint_fs; /* not yet */
|
||||
void *sprite_fs; /* not yet */
|
||||
uint sampler_unit;
|
||||
int generic_attrib; /**< texcoord/generic used for texture */
|
||||
};
|
||||
@@ -373,10 +371,15 @@ generate_aaline_fs(struct aaline_stage *aaline)
|
||||
aaline->fs->aaline_fs
|
||||
= aaline->driver_create_fs_state(aaline->pipe, &aaline_fs);
|
||||
if (aaline->fs->aaline_fs == NULL)
|
||||
return FALSE;
|
||||
goto fail;
|
||||
|
||||
aaline->fs->generic_attrib = transform.maxGeneric + 1;
|
||||
FREE((void *)aaline_fs.tokens);
|
||||
return TRUE;
|
||||
|
||||
fail:
|
||||
FREE((void *)aaline_fs.tokens);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
@@ -816,6 +819,10 @@ aaline_delete_fs_state(struct pipe_context *pipe, void *fs)
|
||||
struct aaline_fragment_shader *aafs = (struct aaline_fragment_shader *) fs;
|
||||
/* pass-through */
|
||||
aaline->driver_delete_fs_state(aaline->pipe, aafs->driver_fs);
|
||||
|
||||
if (aafs->aaline_fs)
|
||||
aaline->driver_delete_fs_state(aaline->pipe, aafs->aaline_fs);
|
||||
|
||||
FREE(aafs);
|
||||
}
|
||||
|
||||
|
||||
@@ -523,11 +523,15 @@ generate_aapoint_fs(struct aapoint_stage *aapoint)
|
||||
aapoint->fs->aapoint_fs
|
||||
= aapoint->driver_create_fs_state(aapoint->pipe, &aapoint_fs);
|
||||
if (aapoint->fs->aapoint_fs == NULL)
|
||||
return FALSE;
|
||||
goto fail;
|
||||
|
||||
aapoint->fs->generic_attrib = transform.maxGeneric + 1;
|
||||
|
||||
FREE((void *)aapoint_fs.tokens);
|
||||
return TRUE;
|
||||
|
||||
fail:
|
||||
FREE((void *)aapoint_fs.tokens);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
@@ -825,8 +829,13 @@ aapoint_delete_fs_state(struct pipe_context *pipe, void *fs)
|
||||
{
|
||||
struct aapoint_stage *aapoint = aapoint_stage_from_pipe(pipe);
|
||||
struct aapoint_fragment_shader *aafs = (struct aapoint_fragment_shader *) fs;
|
||||
|
||||
/* pass-through */
|
||||
aapoint->driver_delete_fs_state(aapoint->pipe, aafs->driver_fs);
|
||||
|
||||
if (aafs->aapoint_fs)
|
||||
aapoint->driver_delete_fs_state(aapoint->pipe, aafs->aapoint_fs);
|
||||
|
||||
FREE(aafs);
|
||||
}
|
||||
|
||||
|
||||
@@ -358,6 +358,7 @@ generate_pstip_fs(struct pstip_stage *pstip)
|
||||
|
||||
pstip->fs->pstip_fs = pstip->driver_create_fs_state(pstip->pipe, &pstip_fs);
|
||||
|
||||
FREE((void *)pstip_fs.tokens);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -649,6 +650,10 @@ pstip_delete_fs_state(struct pipe_context *pipe, void *fs)
|
||||
struct pstip_fragment_shader *aafs = (struct pstip_fragment_shader *) fs;
|
||||
/* pass-through */
|
||||
pstip->driver_delete_fs_state(pstip->pipe, aafs->driver_fs);
|
||||
|
||||
if (aafs->pstip_fs)
|
||||
pstip->driver_delete_fs_state(pstip->pipe, aafs->pstip_fs);
|
||||
|
||||
FREE(aafs);
|
||||
}
|
||||
|
||||
|
||||
@@ -253,6 +253,7 @@ static void widepoint_flush( struct draw_stage *stage, unsigned flags )
|
||||
{
|
||||
stage->point = widepoint_first_point;
|
||||
stage->next->flush( stage->next, flags );
|
||||
stage->draw->extra_vp_outputs.slot = 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -130,6 +130,10 @@ static void fetch_emit_prepare( struct draw_pt_middle_end *middle,
|
||||
unsigned output_format;
|
||||
|
||||
switch (vinfo->attrib[i].emit) {
|
||||
case EMIT_4UB:
|
||||
output_format = PIPE_FORMAT_R8G8B8A8_UNORM;
|
||||
emit_sz = 4 * sizeof(unsigned char);
|
||||
break;
|
||||
case EMIT_4F:
|
||||
output_format = PIPE_FORMAT_R32G32B32A32_FLOAT;
|
||||
emit_sz = 4 * sizeof(float);
|
||||
@@ -153,6 +157,8 @@ static void fetch_emit_prepare( struct draw_pt_middle_end *middle,
|
||||
output_format = PIPE_FORMAT_R32_FLOAT;
|
||||
emit_sz = 1 * sizeof(float);
|
||||
break;
|
||||
case EMIT_OMIT:
|
||||
continue;
|
||||
default:
|
||||
assert(0);
|
||||
output_format = PIPE_FORMAT_NONE;
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
TOP = ../../../..
|
||||
include $(TOP)/configs/current
|
||||
|
||||
LIBNAME = rbug
|
||||
|
||||
C_SOURCES = \
|
||||
rbug_connection.c \
|
||||
rbug_core.c \
|
||||
rbug_texture.c \
|
||||
rbug_context.c \
|
||||
rbug_shader.c \
|
||||
rbug_demarshal.c
|
||||
|
||||
include ../../Makefile.template
|
||||
@@ -0,0 +1,21 @@
|
||||
GALLIUM REMOTE DEBUGGING COMMON CODE
|
||||
|
||||
= About =
|
||||
|
||||
This directory contains the common code for the Gallium 3D remote debugging
|
||||
driver and clients. The code is two parts the connection managment code and
|
||||
the (de)marsheller.
|
||||
|
||||
The code currently uses tcp and ip4v for connections.
|
||||
|
||||
Information about driver integration can be found in:
|
||||
|
||||
src/gallium/drivers/trace/README
|
||||
|
||||
for information about applications look in:
|
||||
|
||||
progs/rbug/README
|
||||
|
||||
|
||||
--
|
||||
Jakob Bornecrantz <jakob@vmware.com>
|
||||
@@ -0,0 +1,14 @@
|
||||
Import('*')
|
||||
|
||||
rbug = env.ConvenienceLibrary(
|
||||
target = 'rbug',
|
||||
source = [
|
||||
'rbug_core.c',
|
||||
'rbug_shader.c',
|
||||
'rbug_context.c',
|
||||
'rbug_texture.c',
|
||||
'rbug_demarshal.c',
|
||||
'rbug_connection.c',
|
||||
])
|
||||
|
||||
auxiliaries.insert(0, rbug)
|
||||
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Include all for users the remote debugger protocol code.
|
||||
*/
|
||||
|
||||
#include "rbug/rbug_core.h"
|
||||
#include "rbug/rbug_shader.h"
|
||||
#include "rbug/rbug_context.h"
|
||||
#include "rbug/rbug_texture.h"
|
||||
#include "rbug/rbug_connection.h"
|
||||
@@ -0,0 +1,167 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#include "rbug/rbug.h"
|
||||
#include "rbug/rbug_internal.h"
|
||||
|
||||
#include "util/u_network.h"
|
||||
|
||||
struct rbug_connection
|
||||
{
|
||||
int socket;
|
||||
uint32_t send_serial;
|
||||
uint32_t recv_serial;
|
||||
enum rbug_opcode opcode;
|
||||
};
|
||||
|
||||
/**
|
||||
* Create a rbug connection from a socket created with u_socket.
|
||||
*
|
||||
* Result:
|
||||
* A new allocated connection using socket as communication path
|
||||
*/
|
||||
struct rbug_connection *
|
||||
rbug_from_socket(int socket)
|
||||
{
|
||||
struct rbug_connection *c = CALLOC_STRUCT(rbug_connection);
|
||||
c->socket = socket;
|
||||
return c;
|
||||
}
|
||||
|
||||
/**
|
||||
* Free a connection, also closes socket.
|
||||
*/
|
||||
void
|
||||
rbug_disconnect(struct rbug_connection *c)
|
||||
{
|
||||
u_socket_close(c->socket);
|
||||
FREE(c);
|
||||
}
|
||||
|
||||
/**
|
||||
* Waits for a message to be fully received.
|
||||
* Also returns the serial for the message, serial is not touched for replys.
|
||||
*
|
||||
* Result:
|
||||
* demarshaled message on success, NULL on connection error
|
||||
*/
|
||||
struct rbug_header *
|
||||
rbug_get_message(struct rbug_connection *c, uint32_t *serial)
|
||||
{
|
||||
struct rbug_proto_header header;
|
||||
struct rbug_header *out;
|
||||
struct rbug_proto_header *data;
|
||||
size_t length = 0;
|
||||
size_t read = 0;
|
||||
int ret;
|
||||
|
||||
|
||||
ret = u_socket_peek(c->socket, &header, sizeof(header));
|
||||
if (ret <= 0) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
length = (size_t)header.length * 4;
|
||||
data = MALLOC(length);
|
||||
if (!data) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
do {
|
||||
uint8_t *ptr = ((uint8_t*)data) + read;
|
||||
ret = u_socket_recv(c->socket, ptr, length - read);
|
||||
|
||||
if (ret <= 0) {
|
||||
FREE(data);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
read += ret;
|
||||
} while(read < length);
|
||||
|
||||
out = rbug_demarshal(data);
|
||||
if (!out)
|
||||
FREE(data);
|
||||
else if (serial)
|
||||
*serial = c->recv_serial++;
|
||||
else
|
||||
c->recv_serial++;
|
||||
|
||||
return out;
|
||||
}
|
||||
|
||||
/**
|
||||
* Frees a message and associated data.
|
||||
*/
|
||||
void
|
||||
rbug_free_header(struct rbug_header *header)
|
||||
{
|
||||
if (!header)
|
||||
return;
|
||||
|
||||
FREE(header->__message);
|
||||
FREE(header);
|
||||
}
|
||||
|
||||
/**
|
||||
* Internal function used by rbug_send_* functions.
|
||||
*
|
||||
* Start sending a message.
|
||||
*/
|
||||
int
|
||||
rbug_connection_send_start(struct rbug_connection *c, enum rbug_opcode opcode, uint32_t length)
|
||||
{
|
||||
c->opcode = opcode;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Internal function used by rbug_send_* functions.
|
||||
*
|
||||
* Write data to the socket.
|
||||
*/
|
||||
int
|
||||
rbug_connection_write(struct rbug_connection *c, void *to, uint32_t size)
|
||||
{
|
||||
int ret = u_socket_send(c->socket, to, size);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* Internal function used by rbug_send_* functions.
|
||||
*
|
||||
* Finish writeing data to the socket.
|
||||
* Ups the send_serial and sets the serial argument if supplied.
|
||||
*/
|
||||
int rbug_connection_send_finish(struct rbug_connection *c, uint32_t *serial)
|
||||
{
|
||||
if (c->opcode < 0)
|
||||
return 0;
|
||||
else if (serial)
|
||||
*serial = c->send_serial++;
|
||||
else
|
||||
c->send_serial++;
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* This file contains the function defentions for connection see c file for
|
||||
* more comments covering function use.
|
||||
*/
|
||||
|
||||
#ifndef _RBUG_CONNECTION_H_
|
||||
#define _RBUG_CONNECTION_H_
|
||||
|
||||
#include "rbug/rbug_proto.h"
|
||||
|
||||
struct rbug_connection * rbug_from_socket(int socket);
|
||||
|
||||
void rbug_disconnect(struct rbug_connection *c);
|
||||
|
||||
struct rbug_header * rbug_get_message(struct rbug_connection *c, uint32_t *serial);
|
||||
|
||||
void rbug_free_header(struct rbug_header *header);
|
||||
|
||||
struct rbug_header * rbug_demarshal(struct rbug_proto_header *header);
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,669 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* This file holds the function implementation for one of the rbug extensions.
|
||||
* Prototypes and declerations of functions and structs is in the same folder
|
||||
* in the header file matching this file's name.
|
||||
*
|
||||
* The functions starting rbug_send_* encodes a call to the write format and
|
||||
* sends that to the supplied connection, while functions starting with
|
||||
* rbug_demarshal_* demarshal data in the wire protocol.
|
||||
*
|
||||
* Functions ending with _reply are replies to requests.
|
||||
*/
|
||||
|
||||
#include "rbug_internal.h"
|
||||
#include "rbug/rbug_context.h"
|
||||
|
||||
int rbug_send_context_list(struct rbug_connection *__con,
|
||||
uint32_t *__serial)
|
||||
{
|
||||
uint32_t __len = 0;
|
||||
uint32_t __pos = 0;
|
||||
uint8_t *__data = NULL;
|
||||
int __ret = 0;
|
||||
|
||||
LEN(8); /* header */
|
||||
|
||||
/* align */
|
||||
PAD(__len, 8);
|
||||
|
||||
__data = (uint8_t*)MALLOC(__len);
|
||||
if (!__data)
|
||||
return -ENOMEM;
|
||||
|
||||
WRITE(4, int32_t, ((int32_t)RBUG_OP_CONTEXT_LIST));
|
||||
WRITE(4, uint32_t, ((uint32_t)(__len / 4)));
|
||||
|
||||
/* final pad */
|
||||
PAD(__pos, 8);
|
||||
|
||||
if (__pos != __len) {
|
||||
__ret = -EINVAL;
|
||||
} else {
|
||||
rbug_connection_send_start(__con, RBUG_OP_CONTEXT_LIST, __len);
|
||||
rbug_connection_write(__con, __data, __len);
|
||||
__ret = rbug_connection_send_finish(__con, __serial);
|
||||
}
|
||||
|
||||
FREE(__data);
|
||||
return __ret;
|
||||
}
|
||||
|
||||
int rbug_send_context_info(struct rbug_connection *__con,
|
||||
rbug_context_t context,
|
||||
uint32_t *__serial)
|
||||
{
|
||||
uint32_t __len = 0;
|
||||
uint32_t __pos = 0;
|
||||
uint8_t *__data = NULL;
|
||||
int __ret = 0;
|
||||
|
||||
LEN(8); /* header */
|
||||
LEN(8); /* context */
|
||||
|
||||
/* align */
|
||||
PAD(__len, 8);
|
||||
|
||||
__data = (uint8_t*)MALLOC(__len);
|
||||
if (!__data)
|
||||
return -ENOMEM;
|
||||
|
||||
WRITE(4, int32_t, ((int32_t)RBUG_OP_CONTEXT_INFO));
|
||||
WRITE(4, uint32_t, ((uint32_t)(__len / 4)));
|
||||
WRITE(8, rbug_context_t, context); /* context */
|
||||
|
||||
/* final pad */
|
||||
PAD(__pos, 8);
|
||||
|
||||
if (__pos != __len) {
|
||||
__ret = -EINVAL;
|
||||
} else {
|
||||
rbug_connection_send_start(__con, RBUG_OP_CONTEXT_INFO, __len);
|
||||
rbug_connection_write(__con, __data, __len);
|
||||
__ret = rbug_connection_send_finish(__con, __serial);
|
||||
}
|
||||
|
||||
FREE(__data);
|
||||
return __ret;
|
||||
}
|
||||
|
||||
int rbug_send_context_draw_block(struct rbug_connection *__con,
|
||||
rbug_context_t context,
|
||||
rbug_block_t block,
|
||||
uint32_t *__serial)
|
||||
{
|
||||
uint32_t __len = 0;
|
||||
uint32_t __pos = 0;
|
||||
uint8_t *__data = NULL;
|
||||
int __ret = 0;
|
||||
|
||||
LEN(8); /* header */
|
||||
LEN(8); /* context */
|
||||
LEN(4); /* block */
|
||||
|
||||
/* align */
|
||||
PAD(__len, 8);
|
||||
|
||||
__data = (uint8_t*)MALLOC(__len);
|
||||
if (!__data)
|
||||
return -ENOMEM;
|
||||
|
||||
WRITE(4, int32_t, ((int32_t)RBUG_OP_CONTEXT_DRAW_BLOCK));
|
||||
WRITE(4, uint32_t, ((uint32_t)(__len / 4)));
|
||||
WRITE(8, rbug_context_t, context); /* context */
|
||||
WRITE(4, rbug_block_t, block); /* block */
|
||||
|
||||
/* final pad */
|
||||
PAD(__pos, 8);
|
||||
|
||||
if (__pos != __len) {
|
||||
__ret = -EINVAL;
|
||||
} else {
|
||||
rbug_connection_send_start(__con, RBUG_OP_CONTEXT_DRAW_BLOCK, __len);
|
||||
rbug_connection_write(__con, __data, __len);
|
||||
__ret = rbug_connection_send_finish(__con, __serial);
|
||||
}
|
||||
|
||||
FREE(__data);
|
||||
return __ret;
|
||||
}
|
||||
|
||||
int rbug_send_context_draw_step(struct rbug_connection *__con,
|
||||
rbug_context_t context,
|
||||
rbug_block_t step,
|
||||
uint32_t *__serial)
|
||||
{
|
||||
uint32_t __len = 0;
|
||||
uint32_t __pos = 0;
|
||||
uint8_t *__data = NULL;
|
||||
int __ret = 0;
|
||||
|
||||
LEN(8); /* header */
|
||||
LEN(8); /* context */
|
||||
LEN(4); /* step */
|
||||
|
||||
/* align */
|
||||
PAD(__len, 8);
|
||||
|
||||
__data = (uint8_t*)MALLOC(__len);
|
||||
if (!__data)
|
||||
return -ENOMEM;
|
||||
|
||||
WRITE(4, int32_t, ((int32_t)RBUG_OP_CONTEXT_DRAW_STEP));
|
||||
WRITE(4, uint32_t, ((uint32_t)(__len / 4)));
|
||||
WRITE(8, rbug_context_t, context); /* context */
|
||||
WRITE(4, rbug_block_t, step); /* step */
|
||||
|
||||
/* final pad */
|
||||
PAD(__pos, 8);
|
||||
|
||||
if (__pos != __len) {
|
||||
__ret = -EINVAL;
|
||||
} else {
|
||||
rbug_connection_send_start(__con, RBUG_OP_CONTEXT_DRAW_STEP, __len);
|
||||
rbug_connection_write(__con, __data, __len);
|
||||
__ret = rbug_connection_send_finish(__con, __serial);
|
||||
}
|
||||
|
||||
FREE(__data);
|
||||
return __ret;
|
||||
}
|
||||
|
||||
int rbug_send_context_draw_unblock(struct rbug_connection *__con,
|
||||
rbug_context_t context,
|
||||
rbug_block_t unblock,
|
||||
uint32_t *__serial)
|
||||
{
|
||||
uint32_t __len = 0;
|
||||
uint32_t __pos = 0;
|
||||
uint8_t *__data = NULL;
|
||||
int __ret = 0;
|
||||
|
||||
LEN(8); /* header */
|
||||
LEN(8); /* context */
|
||||
LEN(4); /* unblock */
|
||||
|
||||
/* align */
|
||||
PAD(__len, 8);
|
||||
|
||||
__data = (uint8_t*)MALLOC(__len);
|
||||
if (!__data)
|
||||
return -ENOMEM;
|
||||
|
||||
WRITE(4, int32_t, ((int32_t)RBUG_OP_CONTEXT_DRAW_UNBLOCK));
|
||||
WRITE(4, uint32_t, ((uint32_t)(__len / 4)));
|
||||
WRITE(8, rbug_context_t, context); /* context */
|
||||
WRITE(4, rbug_block_t, unblock); /* unblock */
|
||||
|
||||
/* final pad */
|
||||
PAD(__pos, 8);
|
||||
|
||||
if (__pos != __len) {
|
||||
__ret = -EINVAL;
|
||||
} else {
|
||||
rbug_connection_send_start(__con, RBUG_OP_CONTEXT_DRAW_UNBLOCK, __len);
|
||||
rbug_connection_write(__con, __data, __len);
|
||||
__ret = rbug_connection_send_finish(__con, __serial);
|
||||
}
|
||||
|
||||
FREE(__data);
|
||||
return __ret;
|
||||
}
|
||||
|
||||
int rbug_send_context_flush(struct rbug_connection *__con,
|
||||
rbug_context_t context,
|
||||
int32_t flags,
|
||||
uint32_t *__serial)
|
||||
{
|
||||
uint32_t __len = 0;
|
||||
uint32_t __pos = 0;
|
||||
uint8_t *__data = NULL;
|
||||
int __ret = 0;
|
||||
|
||||
LEN(8); /* header */
|
||||
LEN(8); /* context */
|
||||
LEN(4); /* flags */
|
||||
|
||||
/* align */
|
||||
PAD(__len, 8);
|
||||
|
||||
__data = (uint8_t*)MALLOC(__len);
|
||||
if (!__data)
|
||||
return -ENOMEM;
|
||||
|
||||
WRITE(4, int32_t, ((int32_t)RBUG_OP_CONTEXT_FLUSH));
|
||||
WRITE(4, uint32_t, ((uint32_t)(__len / 4)));
|
||||
WRITE(8, rbug_context_t, context); /* context */
|
||||
WRITE(4, int32_t, flags); /* flags */
|
||||
|
||||
/* final pad */
|
||||
PAD(__pos, 8);
|
||||
|
||||
if (__pos != __len) {
|
||||
__ret = -EINVAL;
|
||||
} else {
|
||||
rbug_connection_send_start(__con, RBUG_OP_CONTEXT_FLUSH, __len);
|
||||
rbug_connection_write(__con, __data, __len);
|
||||
__ret = rbug_connection_send_finish(__con, __serial);
|
||||
}
|
||||
|
||||
FREE(__data);
|
||||
return __ret;
|
||||
}
|
||||
|
||||
int rbug_send_context_list_reply(struct rbug_connection *__con,
|
||||
uint32_t serial,
|
||||
rbug_context_t *contexts,
|
||||
uint32_t contexts_len,
|
||||
uint32_t *__serial)
|
||||
{
|
||||
uint32_t __len = 0;
|
||||
uint32_t __pos = 0;
|
||||
uint8_t *__data = NULL;
|
||||
int __ret = 0;
|
||||
|
||||
LEN(8); /* header */
|
||||
LEN(4); /* serial */
|
||||
LEN_ARRAY(8, contexts); /* contexts */
|
||||
|
||||
/* align */
|
||||
PAD(__len, 8);
|
||||
|
||||
__data = (uint8_t*)MALLOC(__len);
|
||||
if (!__data)
|
||||
return -ENOMEM;
|
||||
|
||||
WRITE(4, int32_t, ((int32_t)RBUG_OP_CONTEXT_LIST_REPLY));
|
||||
WRITE(4, uint32_t, ((uint32_t)(__len / 4)));
|
||||
WRITE(4, uint32_t, serial); /* serial */
|
||||
WRITE_ARRAY(8, rbug_context_t, contexts); /* contexts */
|
||||
|
||||
/* final pad */
|
||||
PAD(__pos, 8);
|
||||
|
||||
if (__pos != __len) {
|
||||
__ret = -EINVAL;
|
||||
} else {
|
||||
rbug_connection_send_start(__con, RBUG_OP_CONTEXT_LIST_REPLY, __len);
|
||||
rbug_connection_write(__con, __data, __len);
|
||||
__ret = rbug_connection_send_finish(__con, __serial);
|
||||
}
|
||||
|
||||
FREE(__data);
|
||||
return __ret;
|
||||
}
|
||||
|
||||
int rbug_send_context_info_reply(struct rbug_connection *__con,
|
||||
uint32_t serial,
|
||||
rbug_shader_t vertex,
|
||||
rbug_shader_t fragment,
|
||||
rbug_texture_t *cbufs,
|
||||
uint32_t cbufs_len,
|
||||
rbug_texture_t zsbuf,
|
||||
rbug_block_t blocker,
|
||||
rbug_block_t blocked,
|
||||
uint32_t *__serial)
|
||||
{
|
||||
uint32_t __len = 0;
|
||||
uint32_t __pos = 0;
|
||||
uint8_t *__data = NULL;
|
||||
int __ret = 0;
|
||||
|
||||
LEN(8); /* header */
|
||||
LEN(4); /* serial */
|
||||
LEN(8); /* vertex */
|
||||
LEN(8); /* fragment */
|
||||
LEN_ARRAY(8, cbufs); /* cbufs */
|
||||
LEN(8); /* zsbuf */
|
||||
LEN(4); /* blocker */
|
||||
LEN(4); /* blocked */
|
||||
|
||||
/* align */
|
||||
PAD(__len, 8);
|
||||
|
||||
__data = (uint8_t*)MALLOC(__len);
|
||||
if (!__data)
|
||||
return -ENOMEM;
|
||||
|
||||
WRITE(4, int32_t, ((int32_t)RBUG_OP_CONTEXT_INFO_REPLY));
|
||||
WRITE(4, uint32_t, ((uint32_t)(__len / 4)));
|
||||
WRITE(4, uint32_t, serial); /* serial */
|
||||
WRITE(8, rbug_shader_t, vertex); /* vertex */
|
||||
WRITE(8, rbug_shader_t, fragment); /* fragment */
|
||||
WRITE_ARRAY(8, rbug_texture_t, cbufs); /* cbufs */
|
||||
WRITE(8, rbug_texture_t, zsbuf); /* zsbuf */
|
||||
WRITE(4, rbug_block_t, blocker); /* blocker */
|
||||
WRITE(4, rbug_block_t, blocked); /* blocked */
|
||||
|
||||
/* final pad */
|
||||
PAD(__pos, 8);
|
||||
|
||||
if (__pos != __len) {
|
||||
__ret = -EINVAL;
|
||||
} else {
|
||||
rbug_connection_send_start(__con, RBUG_OP_CONTEXT_INFO_REPLY, __len);
|
||||
rbug_connection_write(__con, __data, __len);
|
||||
__ret = rbug_connection_send_finish(__con, __serial);
|
||||
}
|
||||
|
||||
FREE(__data);
|
||||
return __ret;
|
||||
}
|
||||
|
||||
int rbug_send_context_draw_blocked(struct rbug_connection *__con,
|
||||
rbug_context_t context,
|
||||
rbug_block_t block,
|
||||
uint32_t *__serial)
|
||||
{
|
||||
uint32_t __len = 0;
|
||||
uint32_t __pos = 0;
|
||||
uint8_t *__data = NULL;
|
||||
int __ret = 0;
|
||||
|
||||
LEN(8); /* header */
|
||||
LEN(8); /* context */
|
||||
LEN(4); /* block */
|
||||
|
||||
/* align */
|
||||
PAD(__len, 8);
|
||||
|
||||
__data = (uint8_t*)MALLOC(__len);
|
||||
if (!__data)
|
||||
return -ENOMEM;
|
||||
|
||||
WRITE(4, int32_t, ((int32_t)RBUG_OP_CONTEXT_DRAW_BLOCKED));
|
||||
WRITE(4, uint32_t, ((uint32_t)(__len / 4)));
|
||||
WRITE(8, rbug_context_t, context); /* context */
|
||||
WRITE(4, rbug_block_t, block); /* block */
|
||||
|
||||
/* final pad */
|
||||
PAD(__pos, 8);
|
||||
|
||||
if (__pos != __len) {
|
||||
__ret = -EINVAL;
|
||||
} else {
|
||||
rbug_connection_send_start(__con, RBUG_OP_CONTEXT_DRAW_BLOCKED, __len);
|
||||
rbug_connection_write(__con, __data, __len);
|
||||
__ret = rbug_connection_send_finish(__con, __serial);
|
||||
}
|
||||
|
||||
FREE(__data);
|
||||
return __ret;
|
||||
}
|
||||
|
||||
struct rbug_proto_context_list * rbug_demarshal_context_list(struct rbug_proto_header *header)
|
||||
{
|
||||
uint32_t len = 0;
|
||||
uint32_t pos = 0;
|
||||
uint8_t *data = NULL;
|
||||
struct rbug_proto_context_list *ret;
|
||||
|
||||
if (!header)
|
||||
return NULL;
|
||||
if (header->opcode != (int16_t)RBUG_OP_CONTEXT_LIST)
|
||||
return NULL;
|
||||
|
||||
pos = 0;
|
||||
len = header->length * 4;
|
||||
data = (uint8_t*)&header[1];
|
||||
ret = MALLOC(sizeof(*ret));
|
||||
if (!ret)
|
||||
return NULL;
|
||||
|
||||
ret->header.__message = header;
|
||||
ret->header.opcode = header->opcode;
|
||||
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
struct rbug_proto_context_info * rbug_demarshal_context_info(struct rbug_proto_header *header)
|
||||
{
|
||||
uint32_t len = 0;
|
||||
uint32_t pos = 0;
|
||||
uint8_t *data = NULL;
|
||||
struct rbug_proto_context_info *ret;
|
||||
|
||||
if (!header)
|
||||
return NULL;
|
||||
if (header->opcode != (int16_t)RBUG_OP_CONTEXT_INFO)
|
||||
return NULL;
|
||||
|
||||
pos = 0;
|
||||
len = header->length * 4;
|
||||
data = (uint8_t*)&header[1];
|
||||
ret = MALLOC(sizeof(*ret));
|
||||
if (!ret)
|
||||
return NULL;
|
||||
|
||||
ret->header.__message = header;
|
||||
ret->header.opcode = header->opcode;
|
||||
|
||||
READ(8, rbug_context_t, context); /* context */
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
struct rbug_proto_context_draw_block * rbug_demarshal_context_draw_block(struct rbug_proto_header *header)
|
||||
{
|
||||
uint32_t len = 0;
|
||||
uint32_t pos = 0;
|
||||
uint8_t *data = NULL;
|
||||
struct rbug_proto_context_draw_block *ret;
|
||||
|
||||
if (!header)
|
||||
return NULL;
|
||||
if (header->opcode != (int16_t)RBUG_OP_CONTEXT_DRAW_BLOCK)
|
||||
return NULL;
|
||||
|
||||
pos = 0;
|
||||
len = header->length * 4;
|
||||
data = (uint8_t*)&header[1];
|
||||
ret = MALLOC(sizeof(*ret));
|
||||
if (!ret)
|
||||
return NULL;
|
||||
|
||||
ret->header.__message = header;
|
||||
ret->header.opcode = header->opcode;
|
||||
|
||||
READ(8, rbug_context_t, context); /* context */
|
||||
READ(4, rbug_block_t, block); /* block */
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
struct rbug_proto_context_draw_step * rbug_demarshal_context_draw_step(struct rbug_proto_header *header)
|
||||
{
|
||||
uint32_t len = 0;
|
||||
uint32_t pos = 0;
|
||||
uint8_t *data = NULL;
|
||||
struct rbug_proto_context_draw_step *ret;
|
||||
|
||||
if (!header)
|
||||
return NULL;
|
||||
if (header->opcode != (int16_t)RBUG_OP_CONTEXT_DRAW_STEP)
|
||||
return NULL;
|
||||
|
||||
pos = 0;
|
||||
len = header->length * 4;
|
||||
data = (uint8_t*)&header[1];
|
||||
ret = MALLOC(sizeof(*ret));
|
||||
if (!ret)
|
||||
return NULL;
|
||||
|
||||
ret->header.__message = header;
|
||||
ret->header.opcode = header->opcode;
|
||||
|
||||
READ(8, rbug_context_t, context); /* context */
|
||||
READ(4, rbug_block_t, step); /* step */
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
struct rbug_proto_context_draw_unblock * rbug_demarshal_context_draw_unblock(struct rbug_proto_header *header)
|
||||
{
|
||||
uint32_t len = 0;
|
||||
uint32_t pos = 0;
|
||||
uint8_t *data = NULL;
|
||||
struct rbug_proto_context_draw_unblock *ret;
|
||||
|
||||
if (!header)
|
||||
return NULL;
|
||||
if (header->opcode != (int16_t)RBUG_OP_CONTEXT_DRAW_UNBLOCK)
|
||||
return NULL;
|
||||
|
||||
pos = 0;
|
||||
len = header->length * 4;
|
||||
data = (uint8_t*)&header[1];
|
||||
ret = MALLOC(sizeof(*ret));
|
||||
if (!ret)
|
||||
return NULL;
|
||||
|
||||
ret->header.__message = header;
|
||||
ret->header.opcode = header->opcode;
|
||||
|
||||
READ(8, rbug_context_t, context); /* context */
|
||||
READ(4, rbug_block_t, unblock); /* unblock */
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
struct rbug_proto_context_flush * rbug_demarshal_context_flush(struct rbug_proto_header *header)
|
||||
{
|
||||
uint32_t len = 0;
|
||||
uint32_t pos = 0;
|
||||
uint8_t *data = NULL;
|
||||
struct rbug_proto_context_flush *ret;
|
||||
|
||||
if (!header)
|
||||
return NULL;
|
||||
if (header->opcode != (int16_t)RBUG_OP_CONTEXT_FLUSH)
|
||||
return NULL;
|
||||
|
||||
pos = 0;
|
||||
len = header->length * 4;
|
||||
data = (uint8_t*)&header[1];
|
||||
ret = MALLOC(sizeof(*ret));
|
||||
if (!ret)
|
||||
return NULL;
|
||||
|
||||
ret->header.__message = header;
|
||||
ret->header.opcode = header->opcode;
|
||||
|
||||
READ(8, rbug_context_t, context); /* context */
|
||||
READ(4, int32_t, flags); /* flags */
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
struct rbug_proto_context_list_reply * rbug_demarshal_context_list_reply(struct rbug_proto_header *header)
|
||||
{
|
||||
uint32_t len = 0;
|
||||
uint32_t pos = 0;
|
||||
uint8_t *data = NULL;
|
||||
struct rbug_proto_context_list_reply *ret;
|
||||
|
||||
if (!header)
|
||||
return NULL;
|
||||
if (header->opcode != (int16_t)RBUG_OP_CONTEXT_LIST_REPLY)
|
||||
return NULL;
|
||||
|
||||
pos = 0;
|
||||
len = header->length * 4;
|
||||
data = (uint8_t*)&header[1];
|
||||
ret = MALLOC(sizeof(*ret));
|
||||
if (!ret)
|
||||
return NULL;
|
||||
|
||||
ret->header.__message = header;
|
||||
ret->header.opcode = header->opcode;
|
||||
|
||||
READ(4, uint32_t, serial); /* serial */
|
||||
READ_ARRAY(8, rbug_context_t, contexts); /* contexts */
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
struct rbug_proto_context_info_reply * rbug_demarshal_context_info_reply(struct rbug_proto_header *header)
|
||||
{
|
||||
uint32_t len = 0;
|
||||
uint32_t pos = 0;
|
||||
uint8_t *data = NULL;
|
||||
struct rbug_proto_context_info_reply *ret;
|
||||
|
||||
if (!header)
|
||||
return NULL;
|
||||
if (header->opcode != (int16_t)RBUG_OP_CONTEXT_INFO_REPLY)
|
||||
return NULL;
|
||||
|
||||
pos = 0;
|
||||
len = header->length * 4;
|
||||
data = (uint8_t*)&header[1];
|
||||
ret = MALLOC(sizeof(*ret));
|
||||
if (!ret)
|
||||
return NULL;
|
||||
|
||||
ret->header.__message = header;
|
||||
ret->header.opcode = header->opcode;
|
||||
|
||||
READ(4, uint32_t, serial); /* serial */
|
||||
READ(8, rbug_shader_t, vertex); /* vertex */
|
||||
READ(8, rbug_shader_t, fragment); /* fragment */
|
||||
READ_ARRAY(8, rbug_texture_t, cbufs); /* cbufs */
|
||||
READ(8, rbug_texture_t, zsbuf); /* zsbuf */
|
||||
READ(4, rbug_block_t, blocker); /* blocker */
|
||||
READ(4, rbug_block_t, blocked); /* blocked */
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
struct rbug_proto_context_draw_blocked * rbug_demarshal_context_draw_blocked(struct rbug_proto_header *header)
|
||||
{
|
||||
uint32_t len = 0;
|
||||
uint32_t pos = 0;
|
||||
uint8_t *data = NULL;
|
||||
struct rbug_proto_context_draw_blocked *ret;
|
||||
|
||||
if (!header)
|
||||
return NULL;
|
||||
if (header->opcode != (int16_t)RBUG_OP_CONTEXT_DRAW_BLOCKED)
|
||||
return NULL;
|
||||
|
||||
pos = 0;
|
||||
len = header->length * 4;
|
||||
data = (uint8_t*)&header[1];
|
||||
ret = MALLOC(sizeof(*ret));
|
||||
if (!ret)
|
||||
return NULL;
|
||||
|
||||
ret->header.__message = header;
|
||||
ret->header.opcode = header->opcode;
|
||||
|
||||
READ(8, rbug_context_t, context); /* context */
|
||||
READ(4, rbug_block_t, block); /* block */
|
||||
|
||||
return ret;
|
||||
}
|
||||
@@ -0,0 +1,184 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* This file holds structs decelerations and function prototypes for one of
|
||||
* the rbug extensions. Implementation of the functions is in the same folder
|
||||
* in the c file matching this file's name.
|
||||
*
|
||||
* The structs what is returned from the demarshal functions. The functions
|
||||
* starting rbug_send_* encodes a call to the write format and sends that to
|
||||
* the supplied connection, while functions starting with rbug_demarshal_*
|
||||
* demarshal data from the wire protocol.
|
||||
*
|
||||
* Structs and functions ending with _reply are replies to requests.
|
||||
*/
|
||||
|
||||
#ifndef _RBUG_PROTO_CONTEXT_H_
|
||||
#define _RBUG_PROTO_CONTEXT_H_
|
||||
|
||||
#include "rbug/rbug_proto.h"
|
||||
#include "rbug/rbug_core.h"
|
||||
|
||||
typedef enum
|
||||
{
|
||||
RBUG_BLOCK_BEFORE = 1,
|
||||
RBUG_BLOCK_AFTER = 2,
|
||||
} rbug_block_t;
|
||||
|
||||
struct rbug_proto_context_list
|
||||
{
|
||||
struct rbug_header header;
|
||||
};
|
||||
|
||||
struct rbug_proto_context_info
|
||||
{
|
||||
struct rbug_header header;
|
||||
rbug_context_t context;
|
||||
};
|
||||
|
||||
struct rbug_proto_context_draw_block
|
||||
{
|
||||
struct rbug_header header;
|
||||
rbug_context_t context;
|
||||
rbug_block_t block;
|
||||
};
|
||||
|
||||
struct rbug_proto_context_draw_step
|
||||
{
|
||||
struct rbug_header header;
|
||||
rbug_context_t context;
|
||||
rbug_block_t step;
|
||||
};
|
||||
|
||||
struct rbug_proto_context_draw_unblock
|
||||
{
|
||||
struct rbug_header header;
|
||||
rbug_context_t context;
|
||||
rbug_block_t unblock;
|
||||
};
|
||||
|
||||
struct rbug_proto_context_flush
|
||||
{
|
||||
struct rbug_header header;
|
||||
rbug_context_t context;
|
||||
int32_t flags;
|
||||
};
|
||||
|
||||
struct rbug_proto_context_list_reply
|
||||
{
|
||||
struct rbug_header header;
|
||||
uint32_t serial;
|
||||
rbug_context_t *contexts;
|
||||
uint32_t contexts_len;
|
||||
};
|
||||
|
||||
struct rbug_proto_context_info_reply
|
||||
{
|
||||
struct rbug_header header;
|
||||
uint32_t serial;
|
||||
rbug_shader_t vertex;
|
||||
rbug_shader_t fragment;
|
||||
rbug_texture_t *cbufs;
|
||||
uint32_t cbufs_len;
|
||||
rbug_texture_t zsbuf;
|
||||
rbug_block_t blocker;
|
||||
rbug_block_t blocked;
|
||||
};
|
||||
|
||||
struct rbug_proto_context_draw_blocked
|
||||
{
|
||||
struct rbug_header header;
|
||||
rbug_context_t context;
|
||||
rbug_block_t block;
|
||||
};
|
||||
|
||||
int rbug_send_context_list(struct rbug_connection *__con,
|
||||
uint32_t *__serial);
|
||||
|
||||
int rbug_send_context_info(struct rbug_connection *__con,
|
||||
rbug_context_t context,
|
||||
uint32_t *__serial);
|
||||
|
||||
int rbug_send_context_draw_block(struct rbug_connection *__con,
|
||||
rbug_context_t context,
|
||||
rbug_block_t block,
|
||||
uint32_t *__serial);
|
||||
|
||||
int rbug_send_context_draw_step(struct rbug_connection *__con,
|
||||
rbug_context_t context,
|
||||
rbug_block_t step,
|
||||
uint32_t *__serial);
|
||||
|
||||
int rbug_send_context_draw_unblock(struct rbug_connection *__con,
|
||||
rbug_context_t context,
|
||||
rbug_block_t unblock,
|
||||
uint32_t *__serial);
|
||||
|
||||
int rbug_send_context_flush(struct rbug_connection *__con,
|
||||
rbug_context_t context,
|
||||
int32_t flags,
|
||||
uint32_t *__serial);
|
||||
|
||||
int rbug_send_context_list_reply(struct rbug_connection *__con,
|
||||
uint32_t serial,
|
||||
rbug_context_t *contexts,
|
||||
uint32_t contexts_len,
|
||||
uint32_t *__serial);
|
||||
|
||||
int rbug_send_context_info_reply(struct rbug_connection *__con,
|
||||
uint32_t serial,
|
||||
rbug_shader_t vertex,
|
||||
rbug_shader_t fragment,
|
||||
rbug_texture_t *cbufs,
|
||||
uint32_t cbufs_len,
|
||||
rbug_texture_t zsbuf,
|
||||
rbug_block_t blocker,
|
||||
rbug_block_t blocked,
|
||||
uint32_t *__serial);
|
||||
|
||||
int rbug_send_context_draw_blocked(struct rbug_connection *__con,
|
||||
rbug_context_t context,
|
||||
rbug_block_t block,
|
||||
uint32_t *__serial);
|
||||
|
||||
struct rbug_proto_context_list * rbug_demarshal_context_list(struct rbug_proto_header *header);
|
||||
|
||||
struct rbug_proto_context_info * rbug_demarshal_context_info(struct rbug_proto_header *header);
|
||||
|
||||
struct rbug_proto_context_draw_block * rbug_demarshal_context_draw_block(struct rbug_proto_header *header);
|
||||
|
||||
struct rbug_proto_context_draw_step * rbug_demarshal_context_draw_step(struct rbug_proto_header *header);
|
||||
|
||||
struct rbug_proto_context_draw_unblock * rbug_demarshal_context_draw_unblock(struct rbug_proto_header *header);
|
||||
|
||||
struct rbug_proto_context_flush * rbug_demarshal_context_flush(struct rbug_proto_header *header);
|
||||
|
||||
struct rbug_proto_context_list_reply * rbug_demarshal_context_list_reply(struct rbug_proto_header *header);
|
||||
|
||||
struct rbug_proto_context_info_reply * rbug_demarshal_context_info_reply(struct rbug_proto_header *header);
|
||||
|
||||
struct rbug_proto_context_draw_blocked * rbug_demarshal_context_draw_blocked(struct rbug_proto_header *header);
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,359 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* This file holds the function implementation for one of the rbug extensions.
|
||||
* Prototypes and declerations of functions and structs is in the same folder
|
||||
* in the header file matching this file's name.
|
||||
*
|
||||
* The functions starting rbug_send_* encodes a call to the write format and
|
||||
* sends that to the supplied connection, while functions starting with
|
||||
* rbug_demarshal_* demarshal data in the wire protocol.
|
||||
*
|
||||
* Functions ending with _reply are replies to requests.
|
||||
*/
|
||||
|
||||
#include "rbug_internal.h"
|
||||
#include "rbug/rbug_core.h"
|
||||
|
||||
int rbug_send_noop(struct rbug_connection *__con,
|
||||
uint32_t *__serial)
|
||||
{
|
||||
uint32_t __len = 0;
|
||||
uint32_t __pos = 0;
|
||||
uint8_t *__data = NULL;
|
||||
int __ret = 0;
|
||||
|
||||
LEN(8); /* header */
|
||||
|
||||
/* align */
|
||||
PAD(__len, 8);
|
||||
|
||||
__data = (uint8_t*)MALLOC(__len);
|
||||
if (!__data)
|
||||
return -ENOMEM;
|
||||
|
||||
WRITE(4, int32_t, ((int32_t)RBUG_OP_NOOP));
|
||||
WRITE(4, uint32_t, ((uint32_t)(__len / 4)));
|
||||
|
||||
/* final pad */
|
||||
PAD(__pos, 8);
|
||||
|
||||
if (__pos != __len) {
|
||||
__ret = -EINVAL;
|
||||
} else {
|
||||
rbug_connection_send_start(__con, RBUG_OP_NOOP, __len);
|
||||
rbug_connection_write(__con, __data, __len);
|
||||
__ret = rbug_connection_send_finish(__con, __serial);
|
||||
}
|
||||
|
||||
FREE(__data);
|
||||
return __ret;
|
||||
}
|
||||
|
||||
int rbug_send_ping(struct rbug_connection *__con,
|
||||
uint32_t *__serial)
|
||||
{
|
||||
uint32_t __len = 0;
|
||||
uint32_t __pos = 0;
|
||||
uint8_t *__data = NULL;
|
||||
int __ret = 0;
|
||||
|
||||
LEN(8); /* header */
|
||||
|
||||
/* align */
|
||||
PAD(__len, 8);
|
||||
|
||||
__data = (uint8_t*)MALLOC(__len);
|
||||
if (!__data)
|
||||
return -ENOMEM;
|
||||
|
||||
WRITE(4, int32_t, ((int32_t)RBUG_OP_PING));
|
||||
WRITE(4, uint32_t, ((uint32_t)(__len / 4)));
|
||||
|
||||
/* final pad */
|
||||
PAD(__pos, 8);
|
||||
|
||||
if (__pos != __len) {
|
||||
__ret = -EINVAL;
|
||||
} else {
|
||||
rbug_connection_send_start(__con, RBUG_OP_PING, __len);
|
||||
rbug_connection_write(__con, __data, __len);
|
||||
__ret = rbug_connection_send_finish(__con, __serial);
|
||||
}
|
||||
|
||||
FREE(__data);
|
||||
return __ret;
|
||||
}
|
||||
|
||||
int rbug_send_error(struct rbug_connection *__con,
|
||||
uint32_t error,
|
||||
uint32_t *__serial)
|
||||
{
|
||||
uint32_t __len = 0;
|
||||
uint32_t __pos = 0;
|
||||
uint8_t *__data = NULL;
|
||||
int __ret = 0;
|
||||
|
||||
LEN(8); /* header */
|
||||
LEN(4); /* error */
|
||||
|
||||
/* align */
|
||||
PAD(__len, 8);
|
||||
|
||||
__data = (uint8_t*)MALLOC(__len);
|
||||
if (!__data)
|
||||
return -ENOMEM;
|
||||
|
||||
WRITE(4, int32_t, ((int32_t)RBUG_OP_ERROR));
|
||||
WRITE(4, uint32_t, ((uint32_t)(__len / 4)));
|
||||
WRITE(4, uint32_t, error); /* error */
|
||||
|
||||
/* final pad */
|
||||
PAD(__pos, 8);
|
||||
|
||||
if (__pos != __len) {
|
||||
__ret = -EINVAL;
|
||||
} else {
|
||||
rbug_connection_send_start(__con, RBUG_OP_ERROR, __len);
|
||||
rbug_connection_write(__con, __data, __len);
|
||||
__ret = rbug_connection_send_finish(__con, __serial);
|
||||
}
|
||||
|
||||
FREE(__data);
|
||||
return __ret;
|
||||
}
|
||||
|
||||
int rbug_send_ping_reply(struct rbug_connection *__con,
|
||||
uint32_t serial,
|
||||
uint32_t *__serial)
|
||||
{
|
||||
uint32_t __len = 0;
|
||||
uint32_t __pos = 0;
|
||||
uint8_t *__data = NULL;
|
||||
int __ret = 0;
|
||||
|
||||
LEN(8); /* header */
|
||||
LEN(4); /* serial */
|
||||
|
||||
/* align */
|
||||
PAD(__len, 8);
|
||||
|
||||
__data = (uint8_t*)MALLOC(__len);
|
||||
if (!__data)
|
||||
return -ENOMEM;
|
||||
|
||||
WRITE(4, int32_t, ((int32_t)RBUG_OP_PING_REPLY));
|
||||
WRITE(4, uint32_t, ((uint32_t)(__len / 4)));
|
||||
WRITE(4, uint32_t, serial); /* serial */
|
||||
|
||||
/* final pad */
|
||||
PAD(__pos, 8);
|
||||
|
||||
if (__pos != __len) {
|
||||
__ret = -EINVAL;
|
||||
} else {
|
||||
rbug_connection_send_start(__con, RBUG_OP_PING_REPLY, __len);
|
||||
rbug_connection_write(__con, __data, __len);
|
||||
__ret = rbug_connection_send_finish(__con, __serial);
|
||||
}
|
||||
|
||||
FREE(__data);
|
||||
return __ret;
|
||||
}
|
||||
|
||||
int rbug_send_error_reply(struct rbug_connection *__con,
|
||||
uint32_t serial,
|
||||
uint32_t error,
|
||||
uint32_t *__serial)
|
||||
{
|
||||
uint32_t __len = 0;
|
||||
uint32_t __pos = 0;
|
||||
uint8_t *__data = NULL;
|
||||
int __ret = 0;
|
||||
|
||||
LEN(8); /* header */
|
||||
LEN(4); /* serial */
|
||||
LEN(4); /* error */
|
||||
|
||||
/* align */
|
||||
PAD(__len, 8);
|
||||
|
||||
__data = (uint8_t*)MALLOC(__len);
|
||||
if (!__data)
|
||||
return -ENOMEM;
|
||||
|
||||
WRITE(4, int32_t, ((int32_t)RBUG_OP_ERROR_REPLY));
|
||||
WRITE(4, uint32_t, ((uint32_t)(__len / 4)));
|
||||
WRITE(4, uint32_t, serial); /* serial */
|
||||
WRITE(4, uint32_t, error); /* error */
|
||||
|
||||
/* final pad */
|
||||
PAD(__pos, 8);
|
||||
|
||||
if (__pos != __len) {
|
||||
__ret = -EINVAL;
|
||||
} else {
|
||||
rbug_connection_send_start(__con, RBUG_OP_ERROR_REPLY, __len);
|
||||
rbug_connection_write(__con, __data, __len);
|
||||
__ret = rbug_connection_send_finish(__con, __serial);
|
||||
}
|
||||
|
||||
FREE(__data);
|
||||
return __ret;
|
||||
}
|
||||
|
||||
struct rbug_proto_noop * rbug_demarshal_noop(struct rbug_proto_header *header)
|
||||
{
|
||||
uint32_t len = 0;
|
||||
uint32_t pos = 0;
|
||||
uint8_t *data = NULL;
|
||||
struct rbug_proto_noop *ret;
|
||||
|
||||
if (!header)
|
||||
return NULL;
|
||||
if (header->opcode != (int16_t)RBUG_OP_NOOP)
|
||||
return NULL;
|
||||
|
||||
pos = 0;
|
||||
len = header->length * 4;
|
||||
data = (uint8_t*)&header[1];
|
||||
ret = MALLOC(sizeof(*ret));
|
||||
if (!ret)
|
||||
return NULL;
|
||||
|
||||
ret->header.__message = header;
|
||||
ret->header.opcode = header->opcode;
|
||||
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
struct rbug_proto_ping * rbug_demarshal_ping(struct rbug_proto_header *header)
|
||||
{
|
||||
uint32_t len = 0;
|
||||
uint32_t pos = 0;
|
||||
uint8_t *data = NULL;
|
||||
struct rbug_proto_ping *ret;
|
||||
|
||||
if (!header)
|
||||
return NULL;
|
||||
if (header->opcode != (int16_t)RBUG_OP_PING)
|
||||
return NULL;
|
||||
|
||||
pos = 0;
|
||||
len = header->length * 4;
|
||||
data = (uint8_t*)&header[1];
|
||||
ret = MALLOC(sizeof(*ret));
|
||||
if (!ret)
|
||||
return NULL;
|
||||
|
||||
ret->header.__message = header;
|
||||
ret->header.opcode = header->opcode;
|
||||
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
struct rbug_proto_error * rbug_demarshal_error(struct rbug_proto_header *header)
|
||||
{
|
||||
uint32_t len = 0;
|
||||
uint32_t pos = 0;
|
||||
uint8_t *data = NULL;
|
||||
struct rbug_proto_error *ret;
|
||||
|
||||
if (!header)
|
||||
return NULL;
|
||||
if (header->opcode != (int16_t)RBUG_OP_ERROR)
|
||||
return NULL;
|
||||
|
||||
pos = 0;
|
||||
len = header->length * 4;
|
||||
data = (uint8_t*)&header[1];
|
||||
ret = MALLOC(sizeof(*ret));
|
||||
if (!ret)
|
||||
return NULL;
|
||||
|
||||
ret->header.__message = header;
|
||||
ret->header.opcode = header->opcode;
|
||||
|
||||
READ(4, uint32_t, error); /* error */
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
struct rbug_proto_ping_reply * rbug_demarshal_ping_reply(struct rbug_proto_header *header)
|
||||
{
|
||||
uint32_t len = 0;
|
||||
uint32_t pos = 0;
|
||||
uint8_t *data = NULL;
|
||||
struct rbug_proto_ping_reply *ret;
|
||||
|
||||
if (!header)
|
||||
return NULL;
|
||||
if (header->opcode != (int16_t)RBUG_OP_PING_REPLY)
|
||||
return NULL;
|
||||
|
||||
pos = 0;
|
||||
len = header->length * 4;
|
||||
data = (uint8_t*)&header[1];
|
||||
ret = MALLOC(sizeof(*ret));
|
||||
if (!ret)
|
||||
return NULL;
|
||||
|
||||
ret->header.__message = header;
|
||||
ret->header.opcode = header->opcode;
|
||||
|
||||
READ(4, uint32_t, serial); /* serial */
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
struct rbug_proto_error_reply * rbug_demarshal_error_reply(struct rbug_proto_header *header)
|
||||
{
|
||||
uint32_t len = 0;
|
||||
uint32_t pos = 0;
|
||||
uint8_t *data = NULL;
|
||||
struct rbug_proto_error_reply *ret;
|
||||
|
||||
if (!header)
|
||||
return NULL;
|
||||
if (header->opcode != (int16_t)RBUG_OP_ERROR_REPLY)
|
||||
return NULL;
|
||||
|
||||
pos = 0;
|
||||
len = header->length * 4;
|
||||
data = (uint8_t*)&header[1];
|
||||
ret = MALLOC(sizeof(*ret));
|
||||
if (!ret)
|
||||
return NULL;
|
||||
|
||||
ret->header.__message = header;
|
||||
ret->header.opcode = header->opcode;
|
||||
|
||||
READ(4, uint32_t, serial); /* serial */
|
||||
READ(4, uint32_t, error); /* error */
|
||||
|
||||
return ret;
|
||||
}
|
||||
@@ -0,0 +1,105 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* This file holds structs decelerations and function prototypes for one of
|
||||
* the rbug extensions. Implementation of the functions is in the same folder
|
||||
* in the c file matching this file's name.
|
||||
*
|
||||
* The structs what is returned from the demarshal functions. The functions
|
||||
* starting rbug_send_* encodes a call to the write format and sends that to
|
||||
* the supplied connection, while functions starting with rbug_demarshal_*
|
||||
* demarshal data from the wire protocol.
|
||||
*
|
||||
* Structs and functions ending with _reply are replies to requests.
|
||||
*/
|
||||
|
||||
#ifndef _RBUG_PROTO_CORE_H_
|
||||
#define _RBUG_PROTO_CORE_H_
|
||||
|
||||
#include "rbug/rbug_proto.h"
|
||||
|
||||
typedef uint64_t rbug_shader_t;
|
||||
typedef uint64_t rbug_context_t;
|
||||
typedef uint64_t rbug_texture_t;
|
||||
|
||||
struct rbug_proto_noop
|
||||
{
|
||||
struct rbug_header header;
|
||||
};
|
||||
|
||||
struct rbug_proto_ping
|
||||
{
|
||||
struct rbug_header header;
|
||||
};
|
||||
|
||||
struct rbug_proto_error
|
||||
{
|
||||
struct rbug_header header;
|
||||
uint32_t error;
|
||||
};
|
||||
|
||||
struct rbug_proto_ping_reply
|
||||
{
|
||||
struct rbug_header header;
|
||||
uint32_t serial;
|
||||
};
|
||||
|
||||
struct rbug_proto_error_reply
|
||||
{
|
||||
struct rbug_header header;
|
||||
uint32_t serial;
|
||||
uint32_t error;
|
||||
};
|
||||
|
||||
int rbug_send_noop(struct rbug_connection *__con,
|
||||
uint32_t *__serial);
|
||||
|
||||
int rbug_send_ping(struct rbug_connection *__con,
|
||||
uint32_t *__serial);
|
||||
|
||||
int rbug_send_error(struct rbug_connection *__con,
|
||||
uint32_t error,
|
||||
uint32_t *__serial);
|
||||
|
||||
int rbug_send_ping_reply(struct rbug_connection *__con,
|
||||
uint32_t serial,
|
||||
uint32_t *__serial);
|
||||
|
||||
int rbug_send_error_reply(struct rbug_connection *__con,
|
||||
uint32_t serial,
|
||||
uint32_t error,
|
||||
uint32_t *__serial);
|
||||
|
||||
struct rbug_proto_noop * rbug_demarshal_noop(struct rbug_proto_header *header);
|
||||
|
||||
struct rbug_proto_ping * rbug_demarshal_ping(struct rbug_proto_header *header);
|
||||
|
||||
struct rbug_proto_error * rbug_demarshal_error(struct rbug_proto_header *header);
|
||||
|
||||
struct rbug_proto_ping_reply * rbug_demarshal_ping_reply(struct rbug_proto_header *header);
|
||||
|
||||
struct rbug_proto_error_reply * rbug_demarshal_error_reply(struct rbug_proto_header *header);
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,91 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#include "rbug.h"
|
||||
|
||||
/**
|
||||
* Small function that looks at the proto_header and selects the correct
|
||||
* demarshal functions and return the result.
|
||||
*/
|
||||
struct rbug_header * rbug_demarshal(struct rbug_proto_header *header)
|
||||
{
|
||||
switch(header->opcode) {
|
||||
case RBUG_OP_NOOP:
|
||||
return (struct rbug_header *)rbug_demarshal_noop(header);
|
||||
case RBUG_OP_PING:
|
||||
return (struct rbug_header *)rbug_demarshal_ping(header);
|
||||
case RBUG_OP_ERROR:
|
||||
return (struct rbug_header *)rbug_demarshal_error(header);
|
||||
case RBUG_OP_PING_REPLY:
|
||||
return (struct rbug_header *)rbug_demarshal_ping_reply(header);
|
||||
case RBUG_OP_ERROR_REPLY:
|
||||
return (struct rbug_header *)rbug_demarshal_error_reply(header);
|
||||
case RBUG_OP_TEXTURE_LIST:
|
||||
return (struct rbug_header *)rbug_demarshal_texture_list(header);
|
||||
case RBUG_OP_TEXTURE_INFO:
|
||||
return (struct rbug_header *)rbug_demarshal_texture_info(header);
|
||||
case RBUG_OP_TEXTURE_WRITE:
|
||||
return (struct rbug_header *)rbug_demarshal_texture_write(header);
|
||||
case RBUG_OP_TEXTURE_READ:
|
||||
return (struct rbug_header *)rbug_demarshal_texture_read(header);
|
||||
case RBUG_OP_TEXTURE_LIST_REPLY:
|
||||
return (struct rbug_header *)rbug_demarshal_texture_list_reply(header);
|
||||
case RBUG_OP_TEXTURE_INFO_REPLY:
|
||||
return (struct rbug_header *)rbug_demarshal_texture_info_reply(header);
|
||||
case RBUG_OP_TEXTURE_READ_REPLY:
|
||||
return (struct rbug_header *)rbug_demarshal_texture_read_reply(header);
|
||||
case RBUG_OP_CONTEXT_LIST:
|
||||
return (struct rbug_header *)rbug_demarshal_context_list(header);
|
||||
case RBUG_OP_CONTEXT_INFO:
|
||||
return (struct rbug_header *)rbug_demarshal_context_info(header);
|
||||
case RBUG_OP_CONTEXT_DRAW_BLOCK:
|
||||
return (struct rbug_header *)rbug_demarshal_context_draw_block(header);
|
||||
case RBUG_OP_CONTEXT_DRAW_STEP:
|
||||
return (struct rbug_header *)rbug_demarshal_context_draw_step(header);
|
||||
case RBUG_OP_CONTEXT_DRAW_UNBLOCK:
|
||||
return (struct rbug_header *)rbug_demarshal_context_draw_unblock(header);
|
||||
case RBUG_OP_CONTEXT_FLUSH:
|
||||
return (struct rbug_header *)rbug_demarshal_context_flush(header);
|
||||
case RBUG_OP_CONTEXT_LIST_REPLY:
|
||||
return (struct rbug_header *)rbug_demarshal_context_list_reply(header);
|
||||
case RBUG_OP_CONTEXT_INFO_REPLY:
|
||||
return (struct rbug_header *)rbug_demarshal_context_info_reply(header);
|
||||
case RBUG_OP_CONTEXT_DRAW_BLOCKED:
|
||||
return (struct rbug_header *)rbug_demarshal_context_draw_blocked(header);
|
||||
case RBUG_OP_SHADER_LIST:
|
||||
return (struct rbug_header *)rbug_demarshal_shader_list(header);
|
||||
case RBUG_OP_SHADER_INFO:
|
||||
return (struct rbug_header *)rbug_demarshal_shader_info(header);
|
||||
case RBUG_OP_SHADER_DISABLE:
|
||||
return (struct rbug_header *)rbug_demarshal_shader_disable(header);
|
||||
case RBUG_OP_SHADER_REPLACE:
|
||||
return (struct rbug_header *)rbug_demarshal_shader_replace(header);
|
||||
case RBUG_OP_SHADER_LIST_REPLY:
|
||||
return (struct rbug_header *)rbug_demarshal_shader_list_reply(header);
|
||||
case RBUG_OP_SHADER_INFO_REPLY:
|
||||
return (struct rbug_header *)rbug_demarshal_shader_info_reply(header);
|
||||
default:
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,100 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* This file is internal to the rbug protocol code, and contains asorted
|
||||
* features needed by the code.
|
||||
*/
|
||||
|
||||
#ifndef _RBUG_INTERNAL_H_
|
||||
#define _RBUG_INTERNAL_H_
|
||||
|
||||
#include "rbug/rbug_proto.h"
|
||||
|
||||
#include "util/u_memory.h"
|
||||
#include "util/u_debug.h"
|
||||
#include <errno.h>
|
||||
|
||||
int rbug_connection_send_start(struct rbug_connection *con, enum rbug_opcode opcode, uint32_t length);
|
||||
int rbug_connection_write(struct rbug_connection *con, void *data, uint32_t size);
|
||||
int rbug_connection_send_finish(struct rbug_connection *con, uint32_t *c);
|
||||
|
||||
/**
|
||||
* Only works with multiples of 2
|
||||
*/
|
||||
#define PAD(from, to) \
|
||||
do { \
|
||||
from = (from + to - 1) & ~(to - 1); \
|
||||
} while(0)
|
||||
|
||||
#define LEN(size) \
|
||||
do { \
|
||||
PAD(__len, size); \
|
||||
__len += size; \
|
||||
} while(0)
|
||||
|
||||
#define LEN_ARRAY(size, name) \
|
||||
do { \
|
||||
LEN(4); \
|
||||
PAD(__len, size); \
|
||||
__len += size * name##_len; \
|
||||
} while(0)
|
||||
|
||||
#define WRITE(size, type, name) \
|
||||
do { \
|
||||
PAD(__pos, size); \
|
||||
*((type *)(&__data[__pos])) = name; \
|
||||
__pos += size; \
|
||||
} while(0)
|
||||
|
||||
#define WRITE_ARRAY(size, type, name) \
|
||||
do { \
|
||||
WRITE(4, uint32_t, name##_len); \
|
||||
PAD(__pos, size); \
|
||||
memcpy(&__data[__pos], name, size * name##_len); \
|
||||
__pos += size * name##_len; \
|
||||
} while(0)
|
||||
|
||||
#define READ(size, type, name) \
|
||||
do { \
|
||||
PAD(pos, size); \
|
||||
pos += size; \
|
||||
if (pos > len) \
|
||||
break; \
|
||||
ret->name = *((type *)(&data[pos - size])); \
|
||||
} while(0)
|
||||
|
||||
#define READ_ARRAY(size, type, name) \
|
||||
do { \
|
||||
READ(4, uint32_t, name##_len); \
|
||||
if (pos > len) \
|
||||
break; \
|
||||
PAD(pos, size); \
|
||||
pos += size * ret->name##_len; \
|
||||
if (pos > len) \
|
||||
break; \
|
||||
ret->name = (type *)&data[pos - size * ret->name##_len]; \
|
||||
} while(0)
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,93 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* This file holds common definitions of the gallium remote debugging protocol.
|
||||
*/
|
||||
|
||||
#ifndef _RBUG_PROTO_H_
|
||||
#define _RBUG_PROTO_H_
|
||||
|
||||
#include "pipe/p_compiler.h"
|
||||
|
||||
/**
|
||||
* Uniqe indentifier for each command.
|
||||
*
|
||||
* Replys are designated by negative.
|
||||
*/
|
||||
enum rbug_opcode
|
||||
{
|
||||
RBUG_OP_NOOP = 0,
|
||||
RBUG_OP_PING = 1,
|
||||
RBUG_OP_ERROR = 2,
|
||||
RBUG_OP_PING_REPLY = -1,
|
||||
RBUG_OP_ERROR_REPLY = -2,
|
||||
RBUG_OP_TEXTURE_LIST = 256,
|
||||
RBUG_OP_TEXTURE_INFO = 257,
|
||||
RBUG_OP_TEXTURE_WRITE = 258,
|
||||
RBUG_OP_TEXTURE_READ = 259,
|
||||
RBUG_OP_TEXTURE_LIST_REPLY = -256,
|
||||
RBUG_OP_TEXTURE_INFO_REPLY = -257,
|
||||
RBUG_OP_TEXTURE_READ_REPLY = -259,
|
||||
RBUG_OP_CONTEXT_LIST = 512,
|
||||
RBUG_OP_CONTEXT_INFO = 513,
|
||||
RBUG_OP_CONTEXT_DRAW_BLOCK = 514,
|
||||
RBUG_OP_CONTEXT_DRAW_STEP = 515,
|
||||
RBUG_OP_CONTEXT_DRAW_UNBLOCK = 516,
|
||||
RBUG_OP_CONTEXT_FLUSH = 518,
|
||||
RBUG_OP_CONTEXT_LIST_REPLY = -512,
|
||||
RBUG_OP_CONTEXT_INFO_REPLY = -513,
|
||||
RBUG_OP_CONTEXT_DRAW_BLOCKED = 517,
|
||||
RBUG_OP_SHADER_LIST = 768,
|
||||
RBUG_OP_SHADER_INFO = 769,
|
||||
RBUG_OP_SHADER_DISABLE = 770,
|
||||
RBUG_OP_SHADER_REPLACE = 771,
|
||||
RBUG_OP_SHADER_LIST_REPLY = -768,
|
||||
RBUG_OP_SHADER_INFO_REPLY = -769,
|
||||
};
|
||||
|
||||
/**
|
||||
* Header for demarshaled message.
|
||||
*/
|
||||
struct rbug_header
|
||||
{
|
||||
enum rbug_opcode opcode;
|
||||
void *__message;
|
||||
};
|
||||
|
||||
/**
|
||||
* Header for a message in wire format.
|
||||
*/
|
||||
struct rbug_proto_header
|
||||
{
|
||||
int32_t opcode;
|
||||
uint32_t length;
|
||||
};
|
||||
|
||||
/**
|
||||
* Forward declare connection here, as this file is included by all users.
|
||||
*/
|
||||
struct rbug_connection;
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,468 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* This file holds the function implementation for one of the rbug extensions.
|
||||
* Prototypes and declerations of functions and structs is in the same folder
|
||||
* in the header file matching this file's name.
|
||||
*
|
||||
* The functions starting rbug_send_* encodes a call to the write format and
|
||||
* sends that to the supplied connection, while functions starting with
|
||||
* rbug_demarshal_* demarshal data in the wire protocol.
|
||||
*
|
||||
* Functions ending with _reply are replies to requests.
|
||||
*/
|
||||
|
||||
#include "rbug_internal.h"
|
||||
#include "rbug/rbug_shader.h"
|
||||
|
||||
int rbug_send_shader_list(struct rbug_connection *__con,
|
||||
rbug_context_t context,
|
||||
uint32_t *__serial)
|
||||
{
|
||||
uint32_t __len = 0;
|
||||
uint32_t __pos = 0;
|
||||
uint8_t *__data = NULL;
|
||||
int __ret = 0;
|
||||
|
||||
LEN(8); /* header */
|
||||
LEN(8); /* context */
|
||||
|
||||
/* align */
|
||||
PAD(__len, 8);
|
||||
|
||||
__data = (uint8_t*)MALLOC(__len);
|
||||
if (!__data)
|
||||
return -ENOMEM;
|
||||
|
||||
WRITE(4, int32_t, ((int32_t)RBUG_OP_SHADER_LIST));
|
||||
WRITE(4, uint32_t, ((uint32_t)(__len / 4)));
|
||||
WRITE(8, rbug_context_t, context); /* context */
|
||||
|
||||
/* final pad */
|
||||
PAD(__pos, 8);
|
||||
|
||||
if (__pos != __len) {
|
||||
__ret = -EINVAL;
|
||||
} else {
|
||||
rbug_connection_send_start(__con, RBUG_OP_SHADER_LIST, __len);
|
||||
rbug_connection_write(__con, __data, __len);
|
||||
__ret = rbug_connection_send_finish(__con, __serial);
|
||||
}
|
||||
|
||||
FREE(__data);
|
||||
return __ret;
|
||||
}
|
||||
|
||||
int rbug_send_shader_info(struct rbug_connection *__con,
|
||||
rbug_context_t context,
|
||||
rbug_shader_t shader,
|
||||
uint32_t *__serial)
|
||||
{
|
||||
uint32_t __len = 0;
|
||||
uint32_t __pos = 0;
|
||||
uint8_t *__data = NULL;
|
||||
int __ret = 0;
|
||||
|
||||
LEN(8); /* header */
|
||||
LEN(8); /* context */
|
||||
LEN(8); /* shader */
|
||||
|
||||
/* align */
|
||||
PAD(__len, 8);
|
||||
|
||||
__data = (uint8_t*)MALLOC(__len);
|
||||
if (!__data)
|
||||
return -ENOMEM;
|
||||
|
||||
WRITE(4, int32_t, ((int32_t)RBUG_OP_SHADER_INFO));
|
||||
WRITE(4, uint32_t, ((uint32_t)(__len / 4)));
|
||||
WRITE(8, rbug_context_t, context); /* context */
|
||||
WRITE(8, rbug_shader_t, shader); /* shader */
|
||||
|
||||
/* final pad */
|
||||
PAD(__pos, 8);
|
||||
|
||||
if (__pos != __len) {
|
||||
__ret = -EINVAL;
|
||||
} else {
|
||||
rbug_connection_send_start(__con, RBUG_OP_SHADER_INFO, __len);
|
||||
rbug_connection_write(__con, __data, __len);
|
||||
__ret = rbug_connection_send_finish(__con, __serial);
|
||||
}
|
||||
|
||||
FREE(__data);
|
||||
return __ret;
|
||||
}
|
||||
|
||||
int rbug_send_shader_disable(struct rbug_connection *__con,
|
||||
rbug_context_t context,
|
||||
rbug_shader_t shader,
|
||||
uint8_t disable,
|
||||
uint32_t *__serial)
|
||||
{
|
||||
uint32_t __len = 0;
|
||||
uint32_t __pos = 0;
|
||||
uint8_t *__data = NULL;
|
||||
int __ret = 0;
|
||||
|
||||
LEN(8); /* header */
|
||||
LEN(8); /* context */
|
||||
LEN(8); /* shader */
|
||||
LEN(1); /* disable */
|
||||
|
||||
/* align */
|
||||
PAD(__len, 8);
|
||||
|
||||
__data = (uint8_t*)MALLOC(__len);
|
||||
if (!__data)
|
||||
return -ENOMEM;
|
||||
|
||||
WRITE(4, int32_t, ((int32_t)RBUG_OP_SHADER_DISABLE));
|
||||
WRITE(4, uint32_t, ((uint32_t)(__len / 4)));
|
||||
WRITE(8, rbug_context_t, context); /* context */
|
||||
WRITE(8, rbug_shader_t, shader); /* shader */
|
||||
WRITE(1, uint8_t, disable); /* disable */
|
||||
|
||||
/* final pad */
|
||||
PAD(__pos, 8);
|
||||
|
||||
if (__pos != __len) {
|
||||
__ret = -EINVAL;
|
||||
} else {
|
||||
rbug_connection_send_start(__con, RBUG_OP_SHADER_DISABLE, __len);
|
||||
rbug_connection_write(__con, __data, __len);
|
||||
__ret = rbug_connection_send_finish(__con, __serial);
|
||||
}
|
||||
|
||||
FREE(__data);
|
||||
return __ret;
|
||||
}
|
||||
|
||||
int rbug_send_shader_replace(struct rbug_connection *__con,
|
||||
rbug_context_t context,
|
||||
rbug_shader_t shader,
|
||||
uint32_t *tokens,
|
||||
uint32_t tokens_len,
|
||||
uint32_t *__serial)
|
||||
{
|
||||
uint32_t __len = 0;
|
||||
uint32_t __pos = 0;
|
||||
uint8_t *__data = NULL;
|
||||
int __ret = 0;
|
||||
|
||||
LEN(8); /* header */
|
||||
LEN(8); /* context */
|
||||
LEN(8); /* shader */
|
||||
LEN_ARRAY(4, tokens); /* tokens */
|
||||
|
||||
/* align */
|
||||
PAD(__len, 8);
|
||||
|
||||
__data = (uint8_t*)MALLOC(__len);
|
||||
if (!__data)
|
||||
return -ENOMEM;
|
||||
|
||||
WRITE(4, int32_t, ((int32_t)RBUG_OP_SHADER_REPLACE));
|
||||
WRITE(4, uint32_t, ((uint32_t)(__len / 4)));
|
||||
WRITE(8, rbug_context_t, context); /* context */
|
||||
WRITE(8, rbug_shader_t, shader); /* shader */
|
||||
WRITE_ARRAY(4, uint32_t, tokens); /* tokens */
|
||||
|
||||
/* final pad */
|
||||
PAD(__pos, 8);
|
||||
|
||||
if (__pos != __len) {
|
||||
__ret = -EINVAL;
|
||||
} else {
|
||||
rbug_connection_send_start(__con, RBUG_OP_SHADER_REPLACE, __len);
|
||||
rbug_connection_write(__con, __data, __len);
|
||||
__ret = rbug_connection_send_finish(__con, __serial);
|
||||
}
|
||||
|
||||
FREE(__data);
|
||||
return __ret;
|
||||
}
|
||||
|
||||
int rbug_send_shader_list_reply(struct rbug_connection *__con,
|
||||
uint32_t serial,
|
||||
rbug_shader_t *shaders,
|
||||
uint32_t shaders_len,
|
||||
uint32_t *__serial)
|
||||
{
|
||||
uint32_t __len = 0;
|
||||
uint32_t __pos = 0;
|
||||
uint8_t *__data = NULL;
|
||||
int __ret = 0;
|
||||
|
||||
LEN(8); /* header */
|
||||
LEN(4); /* serial */
|
||||
LEN_ARRAY(8, shaders); /* shaders */
|
||||
|
||||
/* align */
|
||||
PAD(__len, 8);
|
||||
|
||||
__data = (uint8_t*)MALLOC(__len);
|
||||
if (!__data)
|
||||
return -ENOMEM;
|
||||
|
||||
WRITE(4, int32_t, ((int32_t)RBUG_OP_SHADER_LIST_REPLY));
|
||||
WRITE(4, uint32_t, ((uint32_t)(__len / 4)));
|
||||
WRITE(4, uint32_t, serial); /* serial */
|
||||
WRITE_ARRAY(8, rbug_shader_t, shaders); /* shaders */
|
||||
|
||||
/* final pad */
|
||||
PAD(__pos, 8);
|
||||
|
||||
if (__pos != __len) {
|
||||
__ret = -EINVAL;
|
||||
} else {
|
||||
rbug_connection_send_start(__con, RBUG_OP_SHADER_LIST_REPLY, __len);
|
||||
rbug_connection_write(__con, __data, __len);
|
||||
__ret = rbug_connection_send_finish(__con, __serial);
|
||||
}
|
||||
|
||||
FREE(__data);
|
||||
return __ret;
|
||||
}
|
||||
|
||||
int rbug_send_shader_info_reply(struct rbug_connection *__con,
|
||||
uint32_t serial,
|
||||
uint32_t *original,
|
||||
uint32_t original_len,
|
||||
uint32_t *replaced,
|
||||
uint32_t replaced_len,
|
||||
uint8_t disabled,
|
||||
uint32_t *__serial)
|
||||
{
|
||||
uint32_t __len = 0;
|
||||
uint32_t __pos = 0;
|
||||
uint8_t *__data = NULL;
|
||||
int __ret = 0;
|
||||
|
||||
LEN(8); /* header */
|
||||
LEN(4); /* serial */
|
||||
LEN_ARRAY(4, original); /* original */
|
||||
LEN_ARRAY(4, replaced); /* replaced */
|
||||
LEN(1); /* disabled */
|
||||
|
||||
/* align */
|
||||
PAD(__len, 8);
|
||||
|
||||
__data = (uint8_t*)MALLOC(__len);
|
||||
if (!__data)
|
||||
return -ENOMEM;
|
||||
|
||||
WRITE(4, int32_t, ((int32_t)RBUG_OP_SHADER_INFO_REPLY));
|
||||
WRITE(4, uint32_t, ((uint32_t)(__len / 4)));
|
||||
WRITE(4, uint32_t, serial); /* serial */
|
||||
WRITE_ARRAY(4, uint32_t, original); /* original */
|
||||
WRITE_ARRAY(4, uint32_t, replaced); /* replaced */
|
||||
WRITE(1, uint8_t, disabled); /* disabled */
|
||||
|
||||
/* final pad */
|
||||
PAD(__pos, 8);
|
||||
|
||||
if (__pos != __len) {
|
||||
__ret = -EINVAL;
|
||||
} else {
|
||||
rbug_connection_send_start(__con, RBUG_OP_SHADER_INFO_REPLY, __len);
|
||||
rbug_connection_write(__con, __data, __len);
|
||||
__ret = rbug_connection_send_finish(__con, __serial);
|
||||
}
|
||||
|
||||
FREE(__data);
|
||||
return __ret;
|
||||
}
|
||||
|
||||
struct rbug_proto_shader_list * rbug_demarshal_shader_list(struct rbug_proto_header *header)
|
||||
{
|
||||
uint32_t len = 0;
|
||||
uint32_t pos = 0;
|
||||
uint8_t *data = NULL;
|
||||
struct rbug_proto_shader_list *ret;
|
||||
|
||||
if (!header)
|
||||
return NULL;
|
||||
if (header->opcode != (int16_t)RBUG_OP_SHADER_LIST)
|
||||
return NULL;
|
||||
|
||||
pos = 0;
|
||||
len = header->length * 4;
|
||||
data = (uint8_t*)&header[1];
|
||||
ret = MALLOC(sizeof(*ret));
|
||||
if (!ret)
|
||||
return NULL;
|
||||
|
||||
ret->header.__message = header;
|
||||
ret->header.opcode = header->opcode;
|
||||
|
||||
READ(8, rbug_context_t, context); /* context */
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
struct rbug_proto_shader_info * rbug_demarshal_shader_info(struct rbug_proto_header *header)
|
||||
{
|
||||
uint32_t len = 0;
|
||||
uint32_t pos = 0;
|
||||
uint8_t *data = NULL;
|
||||
struct rbug_proto_shader_info *ret;
|
||||
|
||||
if (!header)
|
||||
return NULL;
|
||||
if (header->opcode != (int16_t)RBUG_OP_SHADER_INFO)
|
||||
return NULL;
|
||||
|
||||
pos = 0;
|
||||
len = header->length * 4;
|
||||
data = (uint8_t*)&header[1];
|
||||
ret = MALLOC(sizeof(*ret));
|
||||
if (!ret)
|
||||
return NULL;
|
||||
|
||||
ret->header.__message = header;
|
||||
ret->header.opcode = header->opcode;
|
||||
|
||||
READ(8, rbug_context_t, context); /* context */
|
||||
READ(8, rbug_shader_t, shader); /* shader */
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
struct rbug_proto_shader_disable * rbug_demarshal_shader_disable(struct rbug_proto_header *header)
|
||||
{
|
||||
uint32_t len = 0;
|
||||
uint32_t pos = 0;
|
||||
uint8_t *data = NULL;
|
||||
struct rbug_proto_shader_disable *ret;
|
||||
|
||||
if (!header)
|
||||
return NULL;
|
||||
if (header->opcode != (int16_t)RBUG_OP_SHADER_DISABLE)
|
||||
return NULL;
|
||||
|
||||
pos = 0;
|
||||
len = header->length * 4;
|
||||
data = (uint8_t*)&header[1];
|
||||
ret = MALLOC(sizeof(*ret));
|
||||
if (!ret)
|
||||
return NULL;
|
||||
|
||||
ret->header.__message = header;
|
||||
ret->header.opcode = header->opcode;
|
||||
|
||||
READ(8, rbug_context_t, context); /* context */
|
||||
READ(8, rbug_shader_t, shader); /* shader */
|
||||
READ(1, uint8_t, disable); /* disable */
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
struct rbug_proto_shader_replace * rbug_demarshal_shader_replace(struct rbug_proto_header *header)
|
||||
{
|
||||
uint32_t len = 0;
|
||||
uint32_t pos = 0;
|
||||
uint8_t *data = NULL;
|
||||
struct rbug_proto_shader_replace *ret;
|
||||
|
||||
if (!header)
|
||||
return NULL;
|
||||
if (header->opcode != (int16_t)RBUG_OP_SHADER_REPLACE)
|
||||
return NULL;
|
||||
|
||||
pos = 0;
|
||||
len = header->length * 4;
|
||||
data = (uint8_t*)&header[1];
|
||||
ret = MALLOC(sizeof(*ret));
|
||||
if (!ret)
|
||||
return NULL;
|
||||
|
||||
ret->header.__message = header;
|
||||
ret->header.opcode = header->opcode;
|
||||
|
||||
READ(8, rbug_context_t, context); /* context */
|
||||
READ(8, rbug_shader_t, shader); /* shader */
|
||||
READ_ARRAY(4, uint32_t, tokens); /* tokens */
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
struct rbug_proto_shader_list_reply * rbug_demarshal_shader_list_reply(struct rbug_proto_header *header)
|
||||
{
|
||||
uint32_t len = 0;
|
||||
uint32_t pos = 0;
|
||||
uint8_t *data = NULL;
|
||||
struct rbug_proto_shader_list_reply *ret;
|
||||
|
||||
if (!header)
|
||||
return NULL;
|
||||
if (header->opcode != (int16_t)RBUG_OP_SHADER_LIST_REPLY)
|
||||
return NULL;
|
||||
|
||||
pos = 0;
|
||||
len = header->length * 4;
|
||||
data = (uint8_t*)&header[1];
|
||||
ret = MALLOC(sizeof(*ret));
|
||||
if (!ret)
|
||||
return NULL;
|
||||
|
||||
ret->header.__message = header;
|
||||
ret->header.opcode = header->opcode;
|
||||
|
||||
READ(4, uint32_t, serial); /* serial */
|
||||
READ_ARRAY(8, rbug_shader_t, shaders); /* shaders */
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
struct rbug_proto_shader_info_reply * rbug_demarshal_shader_info_reply(struct rbug_proto_header *header)
|
||||
{
|
||||
uint32_t len = 0;
|
||||
uint32_t pos = 0;
|
||||
uint8_t *data = NULL;
|
||||
struct rbug_proto_shader_info_reply *ret;
|
||||
|
||||
if (!header)
|
||||
return NULL;
|
||||
if (header->opcode != (int16_t)RBUG_OP_SHADER_INFO_REPLY)
|
||||
return NULL;
|
||||
|
||||
pos = 0;
|
||||
len = header->length * 4;
|
||||
data = (uint8_t*)&header[1];
|
||||
ret = MALLOC(sizeof(*ret));
|
||||
if (!ret)
|
||||
return NULL;
|
||||
|
||||
ret->header.__message = header;
|
||||
ret->header.opcode = header->opcode;
|
||||
|
||||
READ(4, uint32_t, serial); /* serial */
|
||||
READ_ARRAY(4, uint32_t, original); /* original */
|
||||
READ_ARRAY(4, uint32_t, replaced); /* replaced */
|
||||
READ(1, uint8_t, disabled); /* disabled */
|
||||
|
||||
return ret;
|
||||
}
|
||||
@@ -0,0 +1,142 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* This file holds structs decelerations and function prototypes for one of
|
||||
* the rbug extensions. Implementation of the functions is in the same folder
|
||||
* in the c file matching this file's name.
|
||||
*
|
||||
* The structs what is returned from the demarshal functions. The functions
|
||||
* starting rbug_send_* encodes a call to the write format and sends that to
|
||||
* the supplied connection, while functions starting with rbug_demarshal_*
|
||||
* demarshal data from the wire protocol.
|
||||
*
|
||||
* Structs and functions ending with _reply are replies to requests.
|
||||
*/
|
||||
|
||||
#ifndef _RBUG_PROTO_SHADER_H_
|
||||
#define _RBUG_PROTO_SHADER_H_
|
||||
|
||||
#include "rbug/rbug_proto.h"
|
||||
#include "rbug/rbug_core.h"
|
||||
|
||||
struct rbug_proto_shader_list
|
||||
{
|
||||
struct rbug_header header;
|
||||
rbug_context_t context;
|
||||
};
|
||||
|
||||
struct rbug_proto_shader_info
|
||||
{
|
||||
struct rbug_header header;
|
||||
rbug_context_t context;
|
||||
rbug_shader_t shader;
|
||||
};
|
||||
|
||||
struct rbug_proto_shader_disable
|
||||
{
|
||||
struct rbug_header header;
|
||||
rbug_context_t context;
|
||||
rbug_shader_t shader;
|
||||
uint8_t disable;
|
||||
};
|
||||
|
||||
struct rbug_proto_shader_replace
|
||||
{
|
||||
struct rbug_header header;
|
||||
rbug_context_t context;
|
||||
rbug_shader_t shader;
|
||||
uint32_t *tokens;
|
||||
uint32_t tokens_len;
|
||||
};
|
||||
|
||||
struct rbug_proto_shader_list_reply
|
||||
{
|
||||
struct rbug_header header;
|
||||
uint32_t serial;
|
||||
rbug_shader_t *shaders;
|
||||
uint32_t shaders_len;
|
||||
};
|
||||
|
||||
struct rbug_proto_shader_info_reply
|
||||
{
|
||||
struct rbug_header header;
|
||||
uint32_t serial;
|
||||
uint32_t *original;
|
||||
uint32_t original_len;
|
||||
uint32_t *replaced;
|
||||
uint32_t replaced_len;
|
||||
uint8_t disabled;
|
||||
};
|
||||
|
||||
int rbug_send_shader_list(struct rbug_connection *__con,
|
||||
rbug_context_t context,
|
||||
uint32_t *__serial);
|
||||
|
||||
int rbug_send_shader_info(struct rbug_connection *__con,
|
||||
rbug_context_t context,
|
||||
rbug_shader_t shader,
|
||||
uint32_t *__serial);
|
||||
|
||||
int rbug_send_shader_disable(struct rbug_connection *__con,
|
||||
rbug_context_t context,
|
||||
rbug_shader_t shader,
|
||||
uint8_t disable,
|
||||
uint32_t *__serial);
|
||||
|
||||
int rbug_send_shader_replace(struct rbug_connection *__con,
|
||||
rbug_context_t context,
|
||||
rbug_shader_t shader,
|
||||
uint32_t *tokens,
|
||||
uint32_t tokens_len,
|
||||
uint32_t *__serial);
|
||||
|
||||
int rbug_send_shader_list_reply(struct rbug_connection *__con,
|
||||
uint32_t serial,
|
||||
rbug_shader_t *shaders,
|
||||
uint32_t shaders_len,
|
||||
uint32_t *__serial);
|
||||
|
||||
int rbug_send_shader_info_reply(struct rbug_connection *__con,
|
||||
uint32_t serial,
|
||||
uint32_t *original,
|
||||
uint32_t original_len,
|
||||
uint32_t *replaced,
|
||||
uint32_t replaced_len,
|
||||
uint8_t disabled,
|
||||
uint32_t *__serial);
|
||||
|
||||
struct rbug_proto_shader_list * rbug_demarshal_shader_list(struct rbug_proto_header *header);
|
||||
|
||||
struct rbug_proto_shader_info * rbug_demarshal_shader_info(struct rbug_proto_header *header);
|
||||
|
||||
struct rbug_proto_shader_disable * rbug_demarshal_shader_disable(struct rbug_proto_header *header);
|
||||
|
||||
struct rbug_proto_shader_replace * rbug_demarshal_shader_replace(struct rbug_proto_header *header);
|
||||
|
||||
struct rbug_proto_shader_list_reply * rbug_demarshal_shader_list_reply(struct rbug_proto_header *header);
|
||||
|
||||
struct rbug_proto_shader_info_reply * rbug_demarshal_shader_info_reply(struct rbug_proto_header *header);
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,631 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* This file holds the function implementation for one of the rbug extensions.
|
||||
* Prototypes and declerations of functions and structs is in the same folder
|
||||
* in the header file matching this file's name.
|
||||
*
|
||||
* The functions starting rbug_send_* encodes a call to the write format and
|
||||
* sends that to the supplied connection, while functions starting with
|
||||
* rbug_demarshal_* demarshal data in the wire protocol.
|
||||
*
|
||||
* Functions ending with _reply are replies to requests.
|
||||
*/
|
||||
|
||||
#include "rbug_internal.h"
|
||||
#include "rbug/rbug_texture.h"
|
||||
|
||||
int rbug_send_texture_list(struct rbug_connection *__con,
|
||||
uint32_t *__serial)
|
||||
{
|
||||
uint32_t __len = 0;
|
||||
uint32_t __pos = 0;
|
||||
uint8_t *__data = NULL;
|
||||
int __ret = 0;
|
||||
|
||||
LEN(8); /* header */
|
||||
|
||||
/* align */
|
||||
PAD(__len, 8);
|
||||
|
||||
__data = (uint8_t*)MALLOC(__len);
|
||||
if (!__data)
|
||||
return -ENOMEM;
|
||||
|
||||
WRITE(4, int32_t, ((int32_t)RBUG_OP_TEXTURE_LIST));
|
||||
WRITE(4, uint32_t, ((uint32_t)(__len / 4)));
|
||||
|
||||
/* final pad */
|
||||
PAD(__pos, 8);
|
||||
|
||||
if (__pos != __len) {
|
||||
__ret = -EINVAL;
|
||||
} else {
|
||||
rbug_connection_send_start(__con, RBUG_OP_TEXTURE_LIST, __len);
|
||||
rbug_connection_write(__con, __data, __len);
|
||||
__ret = rbug_connection_send_finish(__con, __serial);
|
||||
}
|
||||
|
||||
FREE(__data);
|
||||
return __ret;
|
||||
}
|
||||
|
||||
int rbug_send_texture_info(struct rbug_connection *__con,
|
||||
rbug_texture_t texture,
|
||||
uint32_t *__serial)
|
||||
{
|
||||
uint32_t __len = 0;
|
||||
uint32_t __pos = 0;
|
||||
uint8_t *__data = NULL;
|
||||
int __ret = 0;
|
||||
|
||||
LEN(8); /* header */
|
||||
LEN(8); /* texture */
|
||||
|
||||
/* align */
|
||||
PAD(__len, 8);
|
||||
|
||||
__data = (uint8_t*)MALLOC(__len);
|
||||
if (!__data)
|
||||
return -ENOMEM;
|
||||
|
||||
WRITE(4, int32_t, ((int32_t)RBUG_OP_TEXTURE_INFO));
|
||||
WRITE(4, uint32_t, ((uint32_t)(__len / 4)));
|
||||
WRITE(8, rbug_texture_t, texture); /* texture */
|
||||
|
||||
/* final pad */
|
||||
PAD(__pos, 8);
|
||||
|
||||
if (__pos != __len) {
|
||||
__ret = -EINVAL;
|
||||
} else {
|
||||
rbug_connection_send_start(__con, RBUG_OP_TEXTURE_INFO, __len);
|
||||
rbug_connection_write(__con, __data, __len);
|
||||
__ret = rbug_connection_send_finish(__con, __serial);
|
||||
}
|
||||
|
||||
FREE(__data);
|
||||
return __ret;
|
||||
}
|
||||
|
||||
int rbug_send_texture_write(struct rbug_connection *__con,
|
||||
rbug_texture_t texture,
|
||||
uint32_t face,
|
||||
uint32_t level,
|
||||
uint32_t zslice,
|
||||
uint32_t x,
|
||||
uint32_t y,
|
||||
uint32_t w,
|
||||
uint32_t h,
|
||||
uint8_t *data,
|
||||
uint32_t data_len,
|
||||
uint32_t stride,
|
||||
uint32_t *__serial)
|
||||
{
|
||||
uint32_t __len = 0;
|
||||
uint32_t __pos = 0;
|
||||
uint8_t *__data = NULL;
|
||||
int __ret = 0;
|
||||
|
||||
LEN(8); /* header */
|
||||
LEN(8); /* texture */
|
||||
LEN(4); /* face */
|
||||
LEN(4); /* level */
|
||||
LEN(4); /* zslice */
|
||||
LEN(4); /* x */
|
||||
LEN(4); /* y */
|
||||
LEN(4); /* w */
|
||||
LEN(4); /* h */
|
||||
LEN_ARRAY(1, data); /* data */
|
||||
LEN(4); /* stride */
|
||||
|
||||
/* align */
|
||||
PAD(__len, 8);
|
||||
|
||||
__data = (uint8_t*)MALLOC(__len);
|
||||
if (!__data)
|
||||
return -ENOMEM;
|
||||
|
||||
WRITE(4, int32_t, ((int32_t)RBUG_OP_TEXTURE_WRITE));
|
||||
WRITE(4, uint32_t, ((uint32_t)(__len / 4)));
|
||||
WRITE(8, rbug_texture_t, texture); /* texture */
|
||||
WRITE(4, uint32_t, face); /* face */
|
||||
WRITE(4, uint32_t, level); /* level */
|
||||
WRITE(4, uint32_t, zslice); /* zslice */
|
||||
WRITE(4, uint32_t, x); /* x */
|
||||
WRITE(4, uint32_t, y); /* y */
|
||||
WRITE(4, uint32_t, w); /* w */
|
||||
WRITE(4, uint32_t, h); /* h */
|
||||
WRITE_ARRAY(1, uint8_t, data); /* data */
|
||||
WRITE(4, uint32_t, stride); /* stride */
|
||||
|
||||
/* final pad */
|
||||
PAD(__pos, 8);
|
||||
|
||||
if (__pos != __len) {
|
||||
__ret = -EINVAL;
|
||||
} else {
|
||||
rbug_connection_send_start(__con, RBUG_OP_TEXTURE_WRITE, __len);
|
||||
rbug_connection_write(__con, __data, __len);
|
||||
__ret = rbug_connection_send_finish(__con, __serial);
|
||||
}
|
||||
|
||||
FREE(__data);
|
||||
return __ret;
|
||||
}
|
||||
|
||||
int rbug_send_texture_read(struct rbug_connection *__con,
|
||||
rbug_texture_t texture,
|
||||
uint32_t face,
|
||||
uint32_t level,
|
||||
uint32_t zslice,
|
||||
uint32_t x,
|
||||
uint32_t y,
|
||||
uint32_t w,
|
||||
uint32_t h,
|
||||
uint32_t *__serial)
|
||||
{
|
||||
uint32_t __len = 0;
|
||||
uint32_t __pos = 0;
|
||||
uint8_t *__data = NULL;
|
||||
int __ret = 0;
|
||||
|
||||
LEN(8); /* header */
|
||||
LEN(8); /* texture */
|
||||
LEN(4); /* face */
|
||||
LEN(4); /* level */
|
||||
LEN(4); /* zslice */
|
||||
LEN(4); /* x */
|
||||
LEN(4); /* y */
|
||||
LEN(4); /* w */
|
||||
LEN(4); /* h */
|
||||
|
||||
/* align */
|
||||
PAD(__len, 8);
|
||||
|
||||
__data = (uint8_t*)MALLOC(__len);
|
||||
if (!__data)
|
||||
return -ENOMEM;
|
||||
|
||||
WRITE(4, int32_t, ((int32_t)RBUG_OP_TEXTURE_READ));
|
||||
WRITE(4, uint32_t, ((uint32_t)(__len / 4)));
|
||||
WRITE(8, rbug_texture_t, texture); /* texture */
|
||||
WRITE(4, uint32_t, face); /* face */
|
||||
WRITE(4, uint32_t, level); /* level */
|
||||
WRITE(4, uint32_t, zslice); /* zslice */
|
||||
WRITE(4, uint32_t, x); /* x */
|
||||
WRITE(4, uint32_t, y); /* y */
|
||||
WRITE(4, uint32_t, w); /* w */
|
||||
WRITE(4, uint32_t, h); /* h */
|
||||
|
||||
/* final pad */
|
||||
PAD(__pos, 8);
|
||||
|
||||
if (__pos != __len) {
|
||||
__ret = -EINVAL;
|
||||
} else {
|
||||
rbug_connection_send_start(__con, RBUG_OP_TEXTURE_READ, __len);
|
||||
rbug_connection_write(__con, __data, __len);
|
||||
__ret = rbug_connection_send_finish(__con, __serial);
|
||||
}
|
||||
|
||||
FREE(__data);
|
||||
return __ret;
|
||||
}
|
||||
|
||||
int rbug_send_texture_list_reply(struct rbug_connection *__con,
|
||||
uint32_t serial,
|
||||
rbug_texture_t *textures,
|
||||
uint32_t textures_len,
|
||||
uint32_t *__serial)
|
||||
{
|
||||
uint32_t __len = 0;
|
||||
uint32_t __pos = 0;
|
||||
uint8_t *__data = NULL;
|
||||
int __ret = 0;
|
||||
|
||||
LEN(8); /* header */
|
||||
LEN(4); /* serial */
|
||||
LEN_ARRAY(8, textures); /* textures */
|
||||
|
||||
/* align */
|
||||
PAD(__len, 8);
|
||||
|
||||
__data = (uint8_t*)MALLOC(__len);
|
||||
if (!__data)
|
||||
return -ENOMEM;
|
||||
|
||||
WRITE(4, int32_t, ((int32_t)RBUG_OP_TEXTURE_LIST_REPLY));
|
||||
WRITE(4, uint32_t, ((uint32_t)(__len / 4)));
|
||||
WRITE(4, uint32_t, serial); /* serial */
|
||||
WRITE_ARRAY(8, rbug_texture_t, textures); /* textures */
|
||||
|
||||
/* final pad */
|
||||
PAD(__pos, 8);
|
||||
|
||||
if (__pos != __len) {
|
||||
__ret = -EINVAL;
|
||||
} else {
|
||||
rbug_connection_send_start(__con, RBUG_OP_TEXTURE_LIST_REPLY, __len);
|
||||
rbug_connection_write(__con, __data, __len);
|
||||
__ret = rbug_connection_send_finish(__con, __serial);
|
||||
}
|
||||
|
||||
FREE(__data);
|
||||
return __ret;
|
||||
}
|
||||
|
||||
int rbug_send_texture_info_reply(struct rbug_connection *__con,
|
||||
uint32_t serial,
|
||||
uint32_t target,
|
||||
uint32_t format,
|
||||
uint32_t *width,
|
||||
uint32_t width_len,
|
||||
uint32_t *height,
|
||||
uint32_t height_len,
|
||||
uint32_t *depth,
|
||||
uint32_t depth_len,
|
||||
uint32_t blockw,
|
||||
uint32_t blockh,
|
||||
uint32_t blocksize,
|
||||
uint32_t last_level,
|
||||
uint32_t nr_samples,
|
||||
uint32_t tex_usage,
|
||||
uint32_t *__serial)
|
||||
{
|
||||
uint32_t __len = 0;
|
||||
uint32_t __pos = 0;
|
||||
uint8_t *__data = NULL;
|
||||
int __ret = 0;
|
||||
|
||||
LEN(8); /* header */
|
||||
LEN(4); /* serial */
|
||||
LEN(4); /* target */
|
||||
LEN(4); /* format */
|
||||
LEN_ARRAY(4, width); /* width */
|
||||
LEN_ARRAY(4, height); /* height */
|
||||
LEN_ARRAY(4, depth); /* depth */
|
||||
LEN(4); /* blockw */
|
||||
LEN(4); /* blockh */
|
||||
LEN(4); /* blocksize */
|
||||
LEN(4); /* last_level */
|
||||
LEN(4); /* nr_samples */
|
||||
LEN(4); /* tex_usage */
|
||||
|
||||
/* align */
|
||||
PAD(__len, 8);
|
||||
|
||||
__data = (uint8_t*)MALLOC(__len);
|
||||
if (!__data)
|
||||
return -ENOMEM;
|
||||
|
||||
WRITE(4, int32_t, ((int32_t)RBUG_OP_TEXTURE_INFO_REPLY));
|
||||
WRITE(4, uint32_t, ((uint32_t)(__len / 4)));
|
||||
WRITE(4, uint32_t, serial); /* serial */
|
||||
WRITE(4, uint32_t, target); /* target */
|
||||
WRITE(4, uint32_t, format); /* format */
|
||||
WRITE_ARRAY(4, uint32_t, width); /* width */
|
||||
WRITE_ARRAY(4, uint32_t, height); /* height */
|
||||
WRITE_ARRAY(4, uint32_t, depth); /* depth */
|
||||
WRITE(4, uint32_t, blockw); /* blockw */
|
||||
WRITE(4, uint32_t, blockh); /* blockh */
|
||||
WRITE(4, uint32_t, blocksize); /* blocksize */
|
||||
WRITE(4, uint32_t, last_level); /* last_level */
|
||||
WRITE(4, uint32_t, nr_samples); /* nr_samples */
|
||||
WRITE(4, uint32_t, tex_usage); /* tex_usage */
|
||||
|
||||
/* final pad */
|
||||
PAD(__pos, 8);
|
||||
|
||||
if (__pos != __len) {
|
||||
__ret = -EINVAL;
|
||||
} else {
|
||||
rbug_connection_send_start(__con, RBUG_OP_TEXTURE_INFO_REPLY, __len);
|
||||
rbug_connection_write(__con, __data, __len);
|
||||
__ret = rbug_connection_send_finish(__con, __serial);
|
||||
}
|
||||
|
||||
FREE(__data);
|
||||
return __ret;
|
||||
}
|
||||
|
||||
int rbug_send_texture_read_reply(struct rbug_connection *__con,
|
||||
uint32_t serial,
|
||||
uint32_t format,
|
||||
uint32_t blockw,
|
||||
uint32_t blockh,
|
||||
uint32_t blocksize,
|
||||
uint8_t *data,
|
||||
uint32_t data_len,
|
||||
uint32_t stride,
|
||||
uint32_t *__serial)
|
||||
{
|
||||
uint32_t __len = 0;
|
||||
uint32_t __pos = 0;
|
||||
uint8_t *__data = NULL;
|
||||
int __ret = 0;
|
||||
|
||||
LEN(8); /* header */
|
||||
LEN(4); /* serial */
|
||||
LEN(4); /* format */
|
||||
LEN(4); /* blockw */
|
||||
LEN(4); /* blockh */
|
||||
LEN(4); /* blocksize */
|
||||
LEN_ARRAY(1, data); /* data */
|
||||
LEN(4); /* stride */
|
||||
|
||||
/* align */
|
||||
PAD(__len, 8);
|
||||
|
||||
__data = (uint8_t*)MALLOC(__len);
|
||||
if (!__data)
|
||||
return -ENOMEM;
|
||||
|
||||
WRITE(4, int32_t, ((int32_t)RBUG_OP_TEXTURE_READ_REPLY));
|
||||
WRITE(4, uint32_t, ((uint32_t)(__len / 4)));
|
||||
WRITE(4, uint32_t, serial); /* serial */
|
||||
WRITE(4, uint32_t, format); /* format */
|
||||
WRITE(4, uint32_t, blockw); /* blockw */
|
||||
WRITE(4, uint32_t, blockh); /* blockh */
|
||||
WRITE(4, uint32_t, blocksize); /* blocksize */
|
||||
WRITE_ARRAY(1, uint8_t, data); /* data */
|
||||
WRITE(4, uint32_t, stride); /* stride */
|
||||
|
||||
/* final pad */
|
||||
PAD(__pos, 8);
|
||||
|
||||
if (__pos != __len) {
|
||||
__ret = -EINVAL;
|
||||
} else {
|
||||
rbug_connection_send_start(__con, RBUG_OP_TEXTURE_READ_REPLY, __len);
|
||||
rbug_connection_write(__con, __data, __len);
|
||||
__ret = rbug_connection_send_finish(__con, __serial);
|
||||
}
|
||||
|
||||
FREE(__data);
|
||||
return __ret;
|
||||
}
|
||||
|
||||
struct rbug_proto_texture_list * rbug_demarshal_texture_list(struct rbug_proto_header *header)
|
||||
{
|
||||
uint32_t len = 0;
|
||||
uint32_t pos = 0;
|
||||
uint8_t *data = NULL;
|
||||
struct rbug_proto_texture_list *ret;
|
||||
|
||||
if (!header)
|
||||
return NULL;
|
||||
if (header->opcode != (int16_t)RBUG_OP_TEXTURE_LIST)
|
||||
return NULL;
|
||||
|
||||
pos = 0;
|
||||
len = header->length * 4;
|
||||
data = (uint8_t*)&header[1];
|
||||
ret = MALLOC(sizeof(*ret));
|
||||
if (!ret)
|
||||
return NULL;
|
||||
|
||||
ret->header.__message = header;
|
||||
ret->header.opcode = header->opcode;
|
||||
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
struct rbug_proto_texture_info * rbug_demarshal_texture_info(struct rbug_proto_header *header)
|
||||
{
|
||||
uint32_t len = 0;
|
||||
uint32_t pos = 0;
|
||||
uint8_t *data = NULL;
|
||||
struct rbug_proto_texture_info *ret;
|
||||
|
||||
if (!header)
|
||||
return NULL;
|
||||
if (header->opcode != (int16_t)RBUG_OP_TEXTURE_INFO)
|
||||
return NULL;
|
||||
|
||||
pos = 0;
|
||||
len = header->length * 4;
|
||||
data = (uint8_t*)&header[1];
|
||||
ret = MALLOC(sizeof(*ret));
|
||||
if (!ret)
|
||||
return NULL;
|
||||
|
||||
ret->header.__message = header;
|
||||
ret->header.opcode = header->opcode;
|
||||
|
||||
READ(8, rbug_texture_t, texture); /* texture */
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
struct rbug_proto_texture_write * rbug_demarshal_texture_write(struct rbug_proto_header *header)
|
||||
{
|
||||
uint32_t len = 0;
|
||||
uint32_t pos = 0;
|
||||
uint8_t *data = NULL;
|
||||
struct rbug_proto_texture_write *ret;
|
||||
|
||||
if (!header)
|
||||
return NULL;
|
||||
if (header->opcode != (int16_t)RBUG_OP_TEXTURE_WRITE)
|
||||
return NULL;
|
||||
|
||||
pos = 0;
|
||||
len = header->length * 4;
|
||||
data = (uint8_t*)&header[1];
|
||||
ret = MALLOC(sizeof(*ret));
|
||||
if (!ret)
|
||||
return NULL;
|
||||
|
||||
ret->header.__message = header;
|
||||
ret->header.opcode = header->opcode;
|
||||
|
||||
READ(8, rbug_texture_t, texture); /* texture */
|
||||
READ(4, uint32_t, face); /* face */
|
||||
READ(4, uint32_t, level); /* level */
|
||||
READ(4, uint32_t, zslice); /* zslice */
|
||||
READ(4, uint32_t, x); /* x */
|
||||
READ(4, uint32_t, y); /* y */
|
||||
READ(4, uint32_t, w); /* w */
|
||||
READ(4, uint32_t, h); /* h */
|
||||
READ_ARRAY(1, uint8_t, data); /* data */
|
||||
READ(4, uint32_t, stride); /* stride */
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
struct rbug_proto_texture_read * rbug_demarshal_texture_read(struct rbug_proto_header *header)
|
||||
{
|
||||
uint32_t len = 0;
|
||||
uint32_t pos = 0;
|
||||
uint8_t *data = NULL;
|
||||
struct rbug_proto_texture_read *ret;
|
||||
|
||||
if (!header)
|
||||
return NULL;
|
||||
if (header->opcode != (int16_t)RBUG_OP_TEXTURE_READ)
|
||||
return NULL;
|
||||
|
||||
pos = 0;
|
||||
len = header->length * 4;
|
||||
data = (uint8_t*)&header[1];
|
||||
ret = MALLOC(sizeof(*ret));
|
||||
if (!ret)
|
||||
return NULL;
|
||||
|
||||
ret->header.__message = header;
|
||||
ret->header.opcode = header->opcode;
|
||||
|
||||
READ(8, rbug_texture_t, texture); /* texture */
|
||||
READ(4, uint32_t, face); /* face */
|
||||
READ(4, uint32_t, level); /* level */
|
||||
READ(4, uint32_t, zslice); /* zslice */
|
||||
READ(4, uint32_t, x); /* x */
|
||||
READ(4, uint32_t, y); /* y */
|
||||
READ(4, uint32_t, w); /* w */
|
||||
READ(4, uint32_t, h); /* h */
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
struct rbug_proto_texture_list_reply * rbug_demarshal_texture_list_reply(struct rbug_proto_header *header)
|
||||
{
|
||||
uint32_t len = 0;
|
||||
uint32_t pos = 0;
|
||||
uint8_t *data = NULL;
|
||||
struct rbug_proto_texture_list_reply *ret;
|
||||
|
||||
if (!header)
|
||||
return NULL;
|
||||
if (header->opcode != (int16_t)RBUG_OP_TEXTURE_LIST_REPLY)
|
||||
return NULL;
|
||||
|
||||
pos = 0;
|
||||
len = header->length * 4;
|
||||
data = (uint8_t*)&header[1];
|
||||
ret = MALLOC(sizeof(*ret));
|
||||
if (!ret)
|
||||
return NULL;
|
||||
|
||||
ret->header.__message = header;
|
||||
ret->header.opcode = header->opcode;
|
||||
|
||||
READ(4, uint32_t, serial); /* serial */
|
||||
READ_ARRAY(8, rbug_texture_t, textures); /* textures */
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
struct rbug_proto_texture_info_reply * rbug_demarshal_texture_info_reply(struct rbug_proto_header *header)
|
||||
{
|
||||
uint32_t len = 0;
|
||||
uint32_t pos = 0;
|
||||
uint8_t *data = NULL;
|
||||
struct rbug_proto_texture_info_reply *ret;
|
||||
|
||||
if (!header)
|
||||
return NULL;
|
||||
if (header->opcode != (int16_t)RBUG_OP_TEXTURE_INFO_REPLY)
|
||||
return NULL;
|
||||
|
||||
pos = 0;
|
||||
len = header->length * 4;
|
||||
data = (uint8_t*)&header[1];
|
||||
ret = MALLOC(sizeof(*ret));
|
||||
if (!ret)
|
||||
return NULL;
|
||||
|
||||
ret->header.__message = header;
|
||||
ret->header.opcode = header->opcode;
|
||||
|
||||
READ(4, uint32_t, serial); /* serial */
|
||||
READ(4, uint32_t, target); /* target */
|
||||
READ(4, uint32_t, format); /* format */
|
||||
READ_ARRAY(4, uint32_t, width); /* width */
|
||||
READ_ARRAY(4, uint32_t, height); /* height */
|
||||
READ_ARRAY(4, uint32_t, depth); /* depth */
|
||||
READ(4, uint32_t, blockw); /* blockw */
|
||||
READ(4, uint32_t, blockh); /* blockh */
|
||||
READ(4, uint32_t, blocksize); /* blocksize */
|
||||
READ(4, uint32_t, last_level); /* last_level */
|
||||
READ(4, uint32_t, nr_samples); /* nr_samples */
|
||||
READ(4, uint32_t, tex_usage); /* tex_usage */
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
struct rbug_proto_texture_read_reply * rbug_demarshal_texture_read_reply(struct rbug_proto_header *header)
|
||||
{
|
||||
uint32_t len = 0;
|
||||
uint32_t pos = 0;
|
||||
uint8_t *data = NULL;
|
||||
struct rbug_proto_texture_read_reply *ret;
|
||||
|
||||
if (!header)
|
||||
return NULL;
|
||||
if (header->opcode != (int16_t)RBUG_OP_TEXTURE_READ_REPLY)
|
||||
return NULL;
|
||||
|
||||
pos = 0;
|
||||
len = header->length * 4;
|
||||
data = (uint8_t*)&header[1];
|
||||
ret = MALLOC(sizeof(*ret));
|
||||
if (!ret)
|
||||
return NULL;
|
||||
|
||||
ret->header.__message = header;
|
||||
ret->header.opcode = header->opcode;
|
||||
|
||||
READ(4, uint32_t, serial); /* serial */
|
||||
READ(4, uint32_t, format); /* format */
|
||||
READ(4, uint32_t, blockw); /* blockw */
|
||||
READ(4, uint32_t, blockh); /* blockh */
|
||||
READ(4, uint32_t, blocksize); /* blocksize */
|
||||
READ_ARRAY(1, uint8_t, data); /* data */
|
||||
READ(4, uint32_t, stride); /* stride */
|
||||
|
||||
return ret;
|
||||
}
|
||||
@@ -0,0 +1,206 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* This file holds structs decelerations and function prototypes for one of
|
||||
* the rbug extensions. Implementation of the functions is in the same folder
|
||||
* in the c file matching this file's name.
|
||||
*
|
||||
* The structs what is returned from the demarshal functions. The functions
|
||||
* starting rbug_send_* encodes a call to the write format and sends that to
|
||||
* the supplied connection, while functions starting with rbug_demarshal_*
|
||||
* demarshal data from the wire protocol.
|
||||
*
|
||||
* Structs and functions ending with _reply are replies to requests.
|
||||
*/
|
||||
|
||||
#ifndef _RBUG_PROTO_TEXTURE_H_
|
||||
#define _RBUG_PROTO_TEXTURE_H_
|
||||
|
||||
#include "rbug/rbug_proto.h"
|
||||
#include "rbug/rbug_core.h"
|
||||
|
||||
struct rbug_proto_texture_list
|
||||
{
|
||||
struct rbug_header header;
|
||||
};
|
||||
|
||||
struct rbug_proto_texture_info
|
||||
{
|
||||
struct rbug_header header;
|
||||
rbug_texture_t texture;
|
||||
};
|
||||
|
||||
struct rbug_proto_texture_write
|
||||
{
|
||||
struct rbug_header header;
|
||||
rbug_texture_t texture;
|
||||
uint32_t face;
|
||||
uint32_t level;
|
||||
uint32_t zslice;
|
||||
uint32_t x;
|
||||
uint32_t y;
|
||||
uint32_t w;
|
||||
uint32_t h;
|
||||
uint8_t *data;
|
||||
uint32_t data_len;
|
||||
uint32_t stride;
|
||||
};
|
||||
|
||||
struct rbug_proto_texture_read
|
||||
{
|
||||
struct rbug_header header;
|
||||
rbug_texture_t texture;
|
||||
uint32_t face;
|
||||
uint32_t level;
|
||||
uint32_t zslice;
|
||||
uint32_t x;
|
||||
uint32_t y;
|
||||
uint32_t w;
|
||||
uint32_t h;
|
||||
};
|
||||
|
||||
struct rbug_proto_texture_list_reply
|
||||
{
|
||||
struct rbug_header header;
|
||||
uint32_t serial;
|
||||
rbug_texture_t *textures;
|
||||
uint32_t textures_len;
|
||||
};
|
||||
|
||||
struct rbug_proto_texture_info_reply
|
||||
{
|
||||
struct rbug_header header;
|
||||
uint32_t serial;
|
||||
uint32_t target;
|
||||
uint32_t format;
|
||||
uint32_t *width;
|
||||
uint32_t width_len;
|
||||
uint32_t *height;
|
||||
uint32_t height_len;
|
||||
uint32_t *depth;
|
||||
uint32_t depth_len;
|
||||
uint32_t blockw;
|
||||
uint32_t blockh;
|
||||
uint32_t blocksize;
|
||||
uint32_t last_level;
|
||||
uint32_t nr_samples;
|
||||
uint32_t tex_usage;
|
||||
};
|
||||
|
||||
struct rbug_proto_texture_read_reply
|
||||
{
|
||||
struct rbug_header header;
|
||||
uint32_t serial;
|
||||
uint32_t format;
|
||||
uint32_t blockw;
|
||||
uint32_t blockh;
|
||||
uint32_t blocksize;
|
||||
uint8_t *data;
|
||||
uint32_t data_len;
|
||||
uint32_t stride;
|
||||
};
|
||||
|
||||
int rbug_send_texture_list(struct rbug_connection *__con,
|
||||
uint32_t *__serial);
|
||||
|
||||
int rbug_send_texture_info(struct rbug_connection *__con,
|
||||
rbug_texture_t texture,
|
||||
uint32_t *__serial);
|
||||
|
||||
int rbug_send_texture_write(struct rbug_connection *__con,
|
||||
rbug_texture_t texture,
|
||||
uint32_t face,
|
||||
uint32_t level,
|
||||
uint32_t zslice,
|
||||
uint32_t x,
|
||||
uint32_t y,
|
||||
uint32_t w,
|
||||
uint32_t h,
|
||||
uint8_t *data,
|
||||
uint32_t data_len,
|
||||
uint32_t stride,
|
||||
uint32_t *__serial);
|
||||
|
||||
int rbug_send_texture_read(struct rbug_connection *__con,
|
||||
rbug_texture_t texture,
|
||||
uint32_t face,
|
||||
uint32_t level,
|
||||
uint32_t zslice,
|
||||
uint32_t x,
|
||||
uint32_t y,
|
||||
uint32_t w,
|
||||
uint32_t h,
|
||||
uint32_t *__serial);
|
||||
|
||||
int rbug_send_texture_list_reply(struct rbug_connection *__con,
|
||||
uint32_t serial,
|
||||
rbug_texture_t *textures,
|
||||
uint32_t textures_len,
|
||||
uint32_t *__serial);
|
||||
|
||||
int rbug_send_texture_info_reply(struct rbug_connection *__con,
|
||||
uint32_t serial,
|
||||
uint32_t target,
|
||||
uint32_t format,
|
||||
uint32_t *width,
|
||||
uint32_t width_len,
|
||||
uint32_t *height,
|
||||
uint32_t height_len,
|
||||
uint32_t *depth,
|
||||
uint32_t depth_len,
|
||||
uint32_t blockw,
|
||||
uint32_t blockh,
|
||||
uint32_t blocksize,
|
||||
uint32_t last_level,
|
||||
uint32_t nr_samples,
|
||||
uint32_t tex_usage,
|
||||
uint32_t *__serial);
|
||||
|
||||
int rbug_send_texture_read_reply(struct rbug_connection *__con,
|
||||
uint32_t serial,
|
||||
uint32_t format,
|
||||
uint32_t blockw,
|
||||
uint32_t blockh,
|
||||
uint32_t blocksize,
|
||||
uint8_t *data,
|
||||
uint32_t data_len,
|
||||
uint32_t stride,
|
||||
uint32_t *__serial);
|
||||
|
||||
struct rbug_proto_texture_list * rbug_demarshal_texture_list(struct rbug_proto_header *header);
|
||||
|
||||
struct rbug_proto_texture_info * rbug_demarshal_texture_info(struct rbug_proto_header *header);
|
||||
|
||||
struct rbug_proto_texture_write * rbug_demarshal_texture_write(struct rbug_proto_header *header);
|
||||
|
||||
struct rbug_proto_texture_read * rbug_demarshal_texture_read(struct rbug_proto_header *header);
|
||||
|
||||
struct rbug_proto_texture_list_reply * rbug_demarshal_texture_list_reply(struct rbug_proto_header *header);
|
||||
|
||||
struct rbug_proto_texture_info_reply * rbug_demarshal_texture_info_reply(struct rbug_proto_header *header);
|
||||
|
||||
struct rbug_proto_texture_read_reply * rbug_demarshal_texture_read_reply(struct rbug_proto_header *header);
|
||||
|
||||
#endif
|
||||
@@ -34,7 +34,7 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define MAX_LABELS 1024
|
||||
#define MAX_LABELS (4 * 1024) /**< basically, max instructions */
|
||||
|
||||
#define NUM_CHANNELS 4 /* R,G,B,A */
|
||||
#define QUAD_SIZE 4 /* 4 pixel/quad */
|
||||
|
||||
@@ -16,6 +16,7 @@ C_SOURCES = \
|
||||
u_hash.c \
|
||||
u_keymap.c \
|
||||
u_linear.c \
|
||||
u_network.c \
|
||||
u_math.c \
|
||||
u_mm.c \
|
||||
u_rect.c \
|
||||
|
||||
@@ -17,6 +17,7 @@ util = env.ConvenienceLibrary(
|
||||
'u_hash.c',
|
||||
'u_hash_table.c',
|
||||
'u_keymap.c',
|
||||
'u_network.c',
|
||||
'u_math.c',
|
||||
'u_mm.c',
|
||||
'u_rect.c',
|
||||
|
||||
@@ -0,0 +1,188 @@
|
||||
|
||||
#include "pipe/p_compiler.h"
|
||||
#include "util/u_network.h"
|
||||
#include "util/u_debug.h"
|
||||
|
||||
#if defined(PIPE_SUBSYSTEM_WINDOWS_USER)
|
||||
# include <winsock2.h>
|
||||
# include <windows.h>
|
||||
#elif defined(PIPE_OS_LINUX)
|
||||
# include <sys/socket.h>
|
||||
# include <netinet/in.h>
|
||||
# include <unistd.h>
|
||||
# include <fcntl.h>
|
||||
# include <netdb.h>
|
||||
#else
|
||||
# warning "No socket implementation"
|
||||
#endif
|
||||
|
||||
boolean
|
||||
u_socket_init()
|
||||
{
|
||||
#if defined(PIPE_SUBSYSTEM_WINDOWS_USER)
|
||||
WORD wVersionRequested;
|
||||
WSADATA wsaData;
|
||||
int err;
|
||||
|
||||
/* Use the MAKEWORD(lowbyte, highbyte) macro declared in Windef.h */
|
||||
wVersionRequested = MAKEWORD(1, 1);
|
||||
|
||||
err = WSAStartup(wVersionRequested, &wsaData);
|
||||
if (err != 0) {
|
||||
debug_printf("WSAStartup failed with error: %d\n", err);
|
||||
return FALSE;
|
||||
}
|
||||
return TRUE;
|
||||
#elif defined(PIPE_HAVE_SOCKETS)
|
||||
return TRUE;
|
||||
#else
|
||||
return FALSE;
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
u_socket_stop()
|
||||
{
|
||||
#if defined(PIPE_SUBSYSTEM_WINDOWS_USER)
|
||||
WSACleanup();
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
u_socket_close(int s)
|
||||
{
|
||||
if (s < 0)
|
||||
return;
|
||||
|
||||
#if defined(PIPE_OS_LINUX)
|
||||
shutdown(s, SHUT_RDWR);
|
||||
close(s);
|
||||
#elif defined(PIPE_SUBSYSTEM_WINDOWS_USER)
|
||||
shutdown(s, SD_BOTH);
|
||||
closesocket(s);
|
||||
#else
|
||||
assert(0);
|
||||
#endif
|
||||
}
|
||||
|
||||
int u_socket_accept(int s)
|
||||
{
|
||||
#if defined(PIPE_HAVE_SOCKETS)
|
||||
return accept(s, NULL, NULL);
|
||||
#else
|
||||
return -1;
|
||||
#endif
|
||||
}
|
||||
|
||||
int
|
||||
u_socket_send(int s, void *data, size_t size)
|
||||
{
|
||||
#if defined(PIPE_HAVE_SOCKETS)
|
||||
return send(s, data, size, 0);
|
||||
#else
|
||||
return -1;
|
||||
#endif
|
||||
}
|
||||
|
||||
int
|
||||
u_socket_peek(int s, void *data, size_t size)
|
||||
{
|
||||
#if defined(PIPE_HAVE_SOCKETS)
|
||||
return recv(s, data, size, MSG_PEEK);
|
||||
#else
|
||||
return -1;
|
||||
#endif
|
||||
}
|
||||
|
||||
int
|
||||
u_socket_recv(int s, void *data, size_t size)
|
||||
{
|
||||
#if defined(PIPE_HAVE_SOCKETS)
|
||||
return recv(s, data, size, 0);
|
||||
#else
|
||||
return -1;
|
||||
#endif
|
||||
}
|
||||
|
||||
int
|
||||
u_socket_connect(const char *hostname, uint16_t port)
|
||||
{
|
||||
#if defined(PIPE_HAVE_SOCKETS)
|
||||
int s;
|
||||
struct sockaddr_in sa;
|
||||
struct hostent *host = NULL;
|
||||
|
||||
memset(&sa, 0, sizeof(struct sockaddr_in));
|
||||
host = gethostbyname(hostname);
|
||||
if (!host)
|
||||
return -1;
|
||||
|
||||
memcpy((char *)&sa.sin_addr,host->h_addr,host->h_length);
|
||||
sa.sin_family= host->h_addrtype;
|
||||
sa.sin_port = htons(port);
|
||||
|
||||
s = socket(host->h_addrtype, SOCK_STREAM, IPPROTO_TCP);
|
||||
if (s < 0)
|
||||
return -1;
|
||||
|
||||
if (connect(s, (struct sockaddr *)&sa, sizeof(sa))) {
|
||||
u_socket_close(s);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return s;
|
||||
#else
|
||||
assert(0);
|
||||
return -1;
|
||||
#endif
|
||||
}
|
||||
|
||||
int
|
||||
u_socket_listen_on_port(uint16_t portnum)
|
||||
{
|
||||
#if defined(PIPE_HAVE_SOCKETS)
|
||||
int s;
|
||||
struct sockaddr_in sa;
|
||||
memset(&sa, 0, sizeof(struct sockaddr_in));
|
||||
|
||||
sa.sin_family = AF_INET;
|
||||
sa.sin_port = htons(portnum);
|
||||
|
||||
s = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
|
||||
if (s < 0)
|
||||
return -1;
|
||||
|
||||
if (bind(s, (struct sockaddr *)&sa, sizeof(struct sockaddr_in)) == -1) {
|
||||
u_socket_close(s);
|
||||
return -1;
|
||||
}
|
||||
|
||||
listen(s, 0);
|
||||
|
||||
return s;
|
||||
#else
|
||||
assert(0);
|
||||
return -1;
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
u_socket_block(int s, boolean block)
|
||||
{
|
||||
#if defined(PIPE_OS_LINUX)
|
||||
int old = fcntl(s, F_GETFL, 0);
|
||||
if (old == -1)
|
||||
return;
|
||||
|
||||
/* TODO obey block */
|
||||
if (block)
|
||||
fcntl(s, F_SETFL, old & ~O_NONBLOCK);
|
||||
else
|
||||
fcntl(s, F_SETFL, old | O_NONBLOCK);
|
||||
#elif defined(PIPE_SUBSYSTEM_WINDOWS_USER)
|
||||
u_long iMode = block ? 0 : 1;
|
||||
ioctlsocket(s, FIONBIO, &iMode);
|
||||
#else
|
||||
assert(0);
|
||||
#endif
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
|
||||
#ifndef _U_NETWORK_H_
|
||||
#define _U_NETWORK_H_
|
||||
|
||||
#include "pipe/p_compiler.h"
|
||||
|
||||
#if defined(PIPE_SUBSYSTEM_WINDOWS_USER)
|
||||
# define PIPE_HAVE_SOCKETS
|
||||
#elif defined(PIPE_OS_LINUX)
|
||||
# define PIPE_HAVE_SOCKETS
|
||||
#endif
|
||||
|
||||
boolean u_socket_init(void);
|
||||
void u_socket_stop(void);
|
||||
void u_socket_close(int s);
|
||||
int u_socket_listen_on_port(uint16_t portnum);
|
||||
int u_socket_accept(int s);
|
||||
int u_socket_connect(const char *host, uint16_t port);
|
||||
int u_socket_send(int s, void *data, size_t size);
|
||||
int u_socket_peek(int s, void *data, size_t size);
|
||||
int u_socket_recv(int s, void *data, size_t size);
|
||||
void u_socket_block(int s, boolean block);
|
||||
|
||||
#endif
|
||||
@@ -1126,7 +1126,22 @@ pipe_get_tile_z(struct pipe_transfer *pt,
|
||||
for (i = 0; i < h; i++) {
|
||||
for (j = 0; j < w; j++) {
|
||||
/* convert 24-bit Z to 32-bit Z */
|
||||
pDest[j] = (ptrc[j] << 8) | (ptrc[j] & 0xff);
|
||||
pDest[j] = (ptrc[j] << 8) | ((ptrc[j] >> 16) & 0xff);
|
||||
}
|
||||
pDest += dstStride;
|
||||
ptrc += pt->stride/4;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case PIPE_FORMAT_Z24S8_UNORM:
|
||||
case PIPE_FORMAT_Z24X8_UNORM:
|
||||
{
|
||||
const uint *ptrc
|
||||
= (const uint *)(map + y * pt->stride + x*4);
|
||||
for (i = 0; i < h; i++) {
|
||||
for (j = 0; j < w; j++) {
|
||||
/* convert 24-bit Z to 32-bit Z */
|
||||
pDest[j] = (ptrc[j] & 0xffffff00) | ((ptrc[j] >> 24) & 0xff);
|
||||
}
|
||||
pDest += dstStride;
|
||||
ptrc += pt->stride/4;
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
|
||||
#include "spu_main.h"
|
||||
#include "spu_render.h"
|
||||
#include "spu_shuffle.h"
|
||||
#include "spu_tri.h"
|
||||
#include "spu_tile.h"
|
||||
#include "cell/common.h"
|
||||
@@ -267,15 +268,75 @@ cmd_render(const struct cell_command_render *render, uint *pos_incr)
|
||||
|
||||
uint drawn = 0;
|
||||
|
||||
/* loop over tris */
|
||||
for (j = 0; j < render->num_indexes; j += 3) {
|
||||
const float *v0, *v1, *v2;
|
||||
const qword vertex_sizes = (qword)spu_splats(vertex_size);
|
||||
const qword verticess = (qword)spu_splats((uint)vertices);
|
||||
|
||||
v0 = (const float *) (vertices + indexes[j+0] * vertex_size);
|
||||
v1 = (const float *) (vertices + indexes[j+1] * vertex_size);
|
||||
v2 = (const float *) (vertices + indexes[j+2] * vertex_size);
|
||||
ASSERT_ALIGN16(&indexes[0]);
|
||||
|
||||
drawn += tri_draw(v0, v1, v2, tx, ty);
|
||||
const uint num_indexes = render->num_indexes;
|
||||
|
||||
/* loop over tris
|
||||
* &indexes[0] will be 16 byte aligned. This loop is heavily unrolled
|
||||
* avoiding variable rotates when extracting vertex indices.
|
||||
*/
|
||||
for (j = 0; j < num_indexes; j += 24) {
|
||||
/* Load three vectors, containing 24 ushort indices */
|
||||
const qword* lower_qword = (qword*)&indexes[j];
|
||||
const qword indices0 = lower_qword[0];
|
||||
const qword indices1 = lower_qword[1];
|
||||
const qword indices2 = lower_qword[2];
|
||||
|
||||
/* stores three indices for each tri n in slots 0, 1 and 2 of vsn */
|
||||
/* Straightforward rotates for these */
|
||||
qword vs0 = indices0;
|
||||
qword vs1 = si_shlqbyi(indices0, 6);
|
||||
qword vs3 = si_shlqbyi(indices1, 2);
|
||||
qword vs4 = si_shlqbyi(indices1, 8);
|
||||
qword vs6 = si_shlqbyi(indices2, 4);
|
||||
qword vs7 = si_shlqbyi(indices2, 10);
|
||||
|
||||
/* For tri 2 and 5, the three indices are split across two machine
|
||||
* words - rotate and combine */
|
||||
const qword tmp2a = si_shlqbyi(indices0, 12);
|
||||
const qword tmp2b = si_rotqmbyi(indices1, 12|16);
|
||||
qword vs2 = si_selb(tmp2a, tmp2b, si_fsmh(si_from_uint(0x20)));
|
||||
|
||||
const qword tmp5a = si_shlqbyi(indices1, 14);
|
||||
const qword tmp5b = si_rotqmbyi(indices2, 14|16);
|
||||
qword vs5 = si_selb(tmp5a, tmp5b, si_fsmh(si_from_uint(0x60)));
|
||||
|
||||
/* unpack indices from halfword slots to word slots */
|
||||
vs0 = si_shufb(vs0, vs0, SHUFB8(0,A,0,B,0,C,0,0));
|
||||
vs1 = si_shufb(vs1, vs1, SHUFB8(0,A,0,B,0,C,0,0));
|
||||
vs2 = si_shufb(vs2, vs2, SHUFB8(0,A,0,B,0,C,0,0));
|
||||
vs3 = si_shufb(vs3, vs3, SHUFB8(0,A,0,B,0,C,0,0));
|
||||
vs4 = si_shufb(vs4, vs4, SHUFB8(0,A,0,B,0,C,0,0));
|
||||
vs5 = si_shufb(vs5, vs5, SHUFB8(0,A,0,B,0,C,0,0));
|
||||
vs6 = si_shufb(vs6, vs6, SHUFB8(0,A,0,B,0,C,0,0));
|
||||
vs7 = si_shufb(vs7, vs7, SHUFB8(0,A,0,B,0,C,0,0));
|
||||
|
||||
/* Calculate address of vertex in vertices[] */
|
||||
vs0 = si_mpya(vs0, vertex_sizes, verticess);
|
||||
vs1 = si_mpya(vs1, vertex_sizes, verticess);
|
||||
vs2 = si_mpya(vs2, vertex_sizes, verticess);
|
||||
vs3 = si_mpya(vs3, vertex_sizes, verticess);
|
||||
vs4 = si_mpya(vs4, vertex_sizes, verticess);
|
||||
vs5 = si_mpya(vs5, vertex_sizes, verticess);
|
||||
vs6 = si_mpya(vs6, vertex_sizes, verticess);
|
||||
vs7 = si_mpya(vs7, vertex_sizes, verticess);
|
||||
|
||||
/* Select the appropriate call based on the number of vertices
|
||||
* remaining */
|
||||
switch(num_indexes - j) {
|
||||
default: drawn += tri_draw(vs7, tx, ty);
|
||||
case 21: drawn += tri_draw(vs6, tx, ty);
|
||||
case 18: drawn += tri_draw(vs5, tx, ty);
|
||||
case 15: drawn += tri_draw(vs4, tx, ty);
|
||||
case 12: drawn += tri_draw(vs3, tx, ty);
|
||||
case 9: drawn += tri_draw(vs2, tx, ty);
|
||||
case 6: drawn += tri_draw(vs1, tx, ty);
|
||||
case 3: drawn += tri_draw(vs0, tx, ty);
|
||||
}
|
||||
}
|
||||
|
||||
//printf("SPU %u: drew %u of %u\n", spu.init.id, drawn, render->num_indexes/3);
|
||||
|
||||
@@ -133,7 +133,15 @@ struct setup_stage {
|
||||
|
||||
uint tx, ty; /**< position of current tile (x, y) */
|
||||
|
||||
int cliprect_minx, cliprect_maxx, cliprect_miny, cliprect_maxy;
|
||||
union {
|
||||
struct {
|
||||
int cliprect_minx;
|
||||
int cliprect_miny;
|
||||
int cliprect_maxx;
|
||||
int cliprect_maxy;
|
||||
};
|
||||
qword cliprect;
|
||||
};
|
||||
|
||||
struct interp_coef coef[PIPE_MAX_SHADER_INPUTS];
|
||||
|
||||
@@ -432,6 +440,41 @@ print_vertex(const struct vertex_header *v)
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Returns the minimum of each slot of two vec_float4s as qwords.
|
||||
* i.e. return[n] = min(q0[n],q1[n]);
|
||||
*/
|
||||
static qword
|
||||
minfq(qword q0, qword q1)
|
||||
{
|
||||
const qword q0q1m = si_fcgt(q0, q1);
|
||||
return si_selb(q0, q1, q0q1m);
|
||||
}
|
||||
|
||||
/* Returns the minimum of each slot of three vec_float4s as qwords.
|
||||
* i.e. return[n] = min(q0[n],q1[n],q2[n]);
|
||||
*/
|
||||
static qword
|
||||
min3fq(qword q0, qword q1, qword q2)
|
||||
{
|
||||
return minfq(minfq(q0, q1), q2);
|
||||
}
|
||||
|
||||
/* Returns the maximum of each slot of two vec_float4s as qwords.
|
||||
* i.e. return[n] = min(q0[n],q1[n],q2[n]);
|
||||
*/
|
||||
static qword
|
||||
maxfq(qword q0, qword q1) {
|
||||
const qword q0q1m = si_fcgt(q0, q1);
|
||||
return si_selb(q1, q0, q0q1m);
|
||||
}
|
||||
|
||||
/* Returns the maximum of each slot of three vec_float4s as qwords.
|
||||
* i.e. return[n] = min(q0[n],q1[n],q2[n]);
|
||||
*/
|
||||
static qword
|
||||
max3fq(qword q0, qword q1, qword q2) {
|
||||
return maxfq(maxfq(q0, q1), q2);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sort vertices from top to bottom.
|
||||
@@ -440,9 +483,7 @@ print_vertex(const struct vertex_header *v)
|
||||
* \return FALSE if tri is totally outside tile, TRUE otherwise
|
||||
*/
|
||||
static boolean
|
||||
setup_sort_vertices(const struct vertex_header *v0,
|
||||
const struct vertex_header *v1,
|
||||
const struct vertex_header *v2)
|
||||
setup_sort_vertices(const qword vs)
|
||||
{
|
||||
float area, sign;
|
||||
|
||||
@@ -455,57 +496,57 @@ setup_sort_vertices(const struct vertex_header *v0,
|
||||
}
|
||||
#endif
|
||||
|
||||
/* determine bottom to top order of vertices */
|
||||
{
|
||||
/* Load the float values for various processing... */
|
||||
const qword f0 = (qword)(((const struct vertex_header*)si_to_ptr(vs))->data[0]);
|
||||
const qword f1 = (qword)(((const struct vertex_header*)si_to_ptr(si_rotqbyi(vs, 4)))->data[0]);
|
||||
const qword f2 = (qword)(((const struct vertex_header*)si_to_ptr(si_rotqbyi(vs, 8)))->data[0]);
|
||||
|
||||
/* Check if triangle is completely outside the tile bounds
|
||||
* Find the min and max x and y positions of the three poits */
|
||||
const qword minf = min3fq(f0, f1, f2);
|
||||
const qword maxf = max3fq(f0, f1, f2);
|
||||
|
||||
/* Compare min and max against cliprect vals */
|
||||
const qword maxsmins = si_shufb(maxf, minf, SHUFB4(A,B,a,b));
|
||||
const qword outside = si_fcgt(maxsmins, si_csflt(setup.cliprect, 0));
|
||||
|
||||
/* Use a little magic to work out of the tri is visible or not */
|
||||
if(si_to_uint(si_xori(si_gb(outside), 0xc))) return FALSE;
|
||||
|
||||
/* determine bottom to top order of vertices */
|
||||
/* A table of shuffle patterns for putting vertex_header pointers into
|
||||
correct order. Quite magical. */
|
||||
const vec_uchar16 sort_order_patterns[] = {
|
||||
SHUFFLE4(A,B,C,C),
|
||||
SHUFFLE4(C,A,B,C),
|
||||
SHUFFLE4(A,C,B,C),
|
||||
SHUFFLE4(B,C,A,C),
|
||||
SHUFFLE4(B,A,C,C),
|
||||
SHUFFLE4(C,B,A,C) };
|
||||
|
||||
/* The vertex_header pointers, packed for easy shuffling later */
|
||||
const vec_uint4 vs = {(unsigned)v0, (unsigned)v1, (unsigned)v2};
|
||||
const qword sort_order_patterns[] = {
|
||||
SHUFB4(A,B,C,C),
|
||||
SHUFB4(C,A,B,C),
|
||||
SHUFB4(A,C,B,C),
|
||||
SHUFB4(B,C,A,C),
|
||||
SHUFB4(B,A,C,C),
|
||||
SHUFB4(C,B,A,C) };
|
||||
|
||||
/* Collate y values into two vectors for comparison.
|
||||
Using only one shuffle constant! ;) */
|
||||
const vec_float4 y_02_ = spu_shuffle(v0->data[0], v2->data[0], SHUFFLE4(0,B,b,C));
|
||||
const vec_float4 y_10_ = spu_shuffle(v1->data[0], v0->data[0], SHUFFLE4(0,B,b,C));
|
||||
const vec_float4 y_012 = spu_shuffle(y_02_, v1->data[0], SHUFFLE4(0,B,b,C));
|
||||
const vec_float4 y_120 = spu_shuffle(y_10_, v2->data[0], SHUFFLE4(0,B,b,C));
|
||||
const qword y_02_ = si_shufb(f0, f2, SHUFB4(0,B,b,C));
|
||||
const qword y_10_ = si_shufb(f1, f0, SHUFB4(0,B,b,C));
|
||||
const qword y_012 = si_shufb(y_02_, f1, SHUFB4(0,B,b,C));
|
||||
const qword y_120 = si_shufb(y_10_, f2, SHUFB4(0,B,b,C));
|
||||
|
||||
/* Perform comparison: {y0,y1,y2} > {y1,y2,y0} */
|
||||
const vec_uint4 compare = spu_cmpgt(y_012, y_120);
|
||||
const qword compare = si_fcgt(y_012, y_120);
|
||||
/* Compress the result of the comparison into 4 bits */
|
||||
const vec_uint4 gather = spu_gather(compare);
|
||||
const qword gather = si_gb(compare);
|
||||
/* Subtract one to attain the index into the LUT. Magical. */
|
||||
const unsigned int index = spu_extract(gather, 0) - 1;
|
||||
const unsigned int index = si_to_uint(gather) - 1;
|
||||
|
||||
/* Load the appropriate pattern and construct the desired vector. */
|
||||
setup.vertex_headers = (qword)spu_shuffle(vs, vs, sort_order_patterns[index]);
|
||||
setup.vertex_headers = si_shufb(vs, vs, sort_order_patterns[index]);
|
||||
|
||||
/* Using the result of the comparison, set sign.
|
||||
Very magical. */
|
||||
sign = ((si_to_uint(si_cntb((qword)gather)) == 2) ? 1.0f : -1.0f);
|
||||
sign = ((si_to_uint(si_cntb(gather)) == 2) ? 1.0f : -1.0f);
|
||||
}
|
||||
|
||||
/* Check if triangle is completely outside the tile bounds */
|
||||
if (spu_extract(setup.vmin->data[0], 1) > setup.cliprect_maxy)
|
||||
return FALSE;
|
||||
if (spu_extract(setup.vmax->data[0], 1) < setup.cliprect_miny)
|
||||
return FALSE;
|
||||
if (spu_extract(setup.vmin->data[0], 0) < setup.cliprect_minx &&
|
||||
spu_extract(setup.vmid->data[0], 0) < setup.cliprect_minx &&
|
||||
spu_extract(setup.vmax->data[0], 0) < setup.cliprect_minx)
|
||||
return FALSE;
|
||||
if (spu_extract(setup.vmin->data[0], 0) > setup.cliprect_maxx &&
|
||||
spu_extract(setup.vmid->data[0], 0) > setup.cliprect_maxx &&
|
||||
spu_extract(setup.vmax->data[0], 0) > setup.cliprect_maxx)
|
||||
return FALSE;
|
||||
|
||||
setup.ebot.ds = spu_sub(setup.vmid->data[0], setup.vmin->data[0]);
|
||||
setup.emaj.ds = spu_sub(setup.vmax->data[0], setup.vmin->data[0]);
|
||||
setup.etop.ds = spu_sub(setup.vmax->data[0], setup.vmid->data[0]);
|
||||
@@ -761,21 +802,19 @@ subtriangle(struct edge *eleft, struct edge *eright, unsigned lines)
|
||||
* The tile data should have already been fetched.
|
||||
*/
|
||||
boolean
|
||||
tri_draw(const float *v0, const float *v1, const float *v2,
|
||||
tri_draw(const qword vs,
|
||||
uint tx, uint ty)
|
||||
{
|
||||
setup.tx = tx;
|
||||
setup.ty = ty;
|
||||
|
||||
/* set clipping bounds to tile bounds */
|
||||
setup.cliprect_minx = tx * TILE_SIZE;
|
||||
setup.cliprect_miny = ty * TILE_SIZE;
|
||||
setup.cliprect_maxx = (tx + 1) * TILE_SIZE;
|
||||
setup.cliprect_maxy = (ty + 1) * TILE_SIZE;
|
||||
const qword clipbase = (qword)((vec_uint4){tx, ty});
|
||||
const qword clipmin = si_mpyui(clipbase, TILE_SIZE);
|
||||
const qword clipmax = si_ai(clipmin, TILE_SIZE);
|
||||
setup.cliprect = si_shufb(clipmin, clipmax, SHUFB4(A,B,a,b));
|
||||
|
||||
if (!setup_sort_vertices((struct vertex_header *) v0,
|
||||
(struct vertex_header *) v1,
|
||||
(struct vertex_header *) v2)) {
|
||||
if(!setup_sort_vertices(vs)) {
|
||||
return FALSE; /* totally clipped */
|
||||
}
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
|
||||
|
||||
extern boolean
|
||||
tri_draw(const float *v0, const float *v1, const float *v2, uint tx, uint ty);
|
||||
tri_draw(const qword vs, uint tx, uint ty);
|
||||
|
||||
|
||||
#endif /* SPU_TRI_H */
|
||||
|
||||
@@ -9,13 +9,13 @@
|
||||
|
||||
#define OUT_RING(data) do { \
|
||||
NOUVEAU_PUSH_CONTEXT(pc); \
|
||||
(*pc->nvws->channel->pushbuf->cur++) = (data); \
|
||||
(*pc->base.channel->pushbuf->cur++) = (data); \
|
||||
} while(0)
|
||||
|
||||
#define OUT_RINGp(src,size) do { \
|
||||
NOUVEAU_PUSH_CONTEXT(pc); \
|
||||
memcpy(pc->nvws->channel->pushbuf->cur, (src), (size) * 4); \
|
||||
pc->nvws->channel->pushbuf->cur += (size); \
|
||||
memcpy(pc->base.channel->pushbuf->cur, (src), (size) * 4); \
|
||||
pc->base.channel->pushbuf->cur += (size); \
|
||||
} while(0)
|
||||
|
||||
#define OUT_RINGf(data) do { \
|
||||
@@ -26,25 +26,35 @@
|
||||
|
||||
#define BEGIN_RING(obj,mthd,size) do { \
|
||||
NOUVEAU_PUSH_CONTEXT(pc); \
|
||||
if (pc->nvws->channel->pushbuf->remaining < ((size) + 1)) \
|
||||
pc->nvws->push_flush(pc->nvws, ((size) + 1), NULL); \
|
||||
struct nouveau_channel *chan = pc->base.channel; \
|
||||
if (chan->pushbuf->remaining < ((size) + 1)) \
|
||||
nouveau_pushbuf_flush(chan, ((size) + 1)); \
|
||||
OUT_RING((pc->obj->subc << 13) | ((size) << 18) | (mthd)); \
|
||||
pc->nvws->channel->pushbuf->remaining -= ((size) + 1); \
|
||||
chan->pushbuf->remaining -= ((size) + 1); \
|
||||
} while(0)
|
||||
|
||||
#define BEGIN_RING_NI(obj,mthd,size) do { \
|
||||
BEGIN_RING(obj, (mthd) | 0x40000000, (size)); \
|
||||
} while(0)
|
||||
|
||||
static inline void
|
||||
DO_FIRE_RING(struct nouveau_channel *chan, struct pipe_fence_handle **fence)
|
||||
{
|
||||
nouveau_pushbuf_flush(chan, 0);
|
||||
if (fence)
|
||||
*fence = NULL;
|
||||
}
|
||||
|
||||
#define FIRE_RING(fence) do { \
|
||||
NOUVEAU_PUSH_CONTEXT(pc); \
|
||||
pc->nvws->push_flush(pc->nvws, 0, fence); \
|
||||
DO_FIRE_RING(pc->base.channel, fence); \
|
||||
} while(0)
|
||||
|
||||
#define OUT_RELOC(bo,data,flags,vor,tor) do { \
|
||||
NOUVEAU_PUSH_CONTEXT(pc); \
|
||||
pc->nvws->push_reloc(pc->nvws, pc->nvws->channel->pushbuf->cur++, \
|
||||
(bo), (data), (flags), (vor), (tor)); \
|
||||
struct nouveau_channel *chan = pc->base.channel; \
|
||||
nouveau_pushbuf_emit_reloc(chan, chan->pushbuf->cur++, nouveau_bo(bo), \
|
||||
(data), 0, (flags), (vor), (tor)); \
|
||||
} while(0)
|
||||
|
||||
/* Raw data + flags depending on FB/TT buffer */
|
||||
@@ -55,8 +65,8 @@
|
||||
/* FB/TT object handle */
|
||||
#define OUT_RELOCo(bo,flags) do { \
|
||||
OUT_RELOC((bo), 0, (flags) | NOUVEAU_BO_OR, \
|
||||
pc->nvws->channel->vram->handle, \
|
||||
pc->nvws->channel->gart->handle); \
|
||||
pc->base.channel->vram->handle, \
|
||||
pc->base.channel->gart->handle); \
|
||||
} while(0)
|
||||
|
||||
/* Low 32-bits of offset */
|
||||
@@ -72,11 +82,12 @@
|
||||
/* A reloc which'll recombine into a NV_DMA_METHOD packet header */
|
||||
#define OUT_RELOCm(bo, flags, obj, mthd, size) do { \
|
||||
NOUVEAU_PUSH_CONTEXT(pc); \
|
||||
if (pc->nvws->channel->pushbuf->remaining < ((size) + 1)) \
|
||||
pc->nvws->push_flush(pc->nvws->channel, ((size) + 1), NULL); \
|
||||
struct nouveau_channel *chan = pc->base.channel; \
|
||||
if (chan->pushbuf->remaining < ((size) + 1)) \
|
||||
nouveau_pushbuf_flush(chan, ((size) + 1)); \
|
||||
OUT_RELOCd((bo), (pc->obj->subc << 13) | ((size) << 18) | (mthd), \
|
||||
(flags), 0, 0); \
|
||||
pc->nvws->channel->pushbuf->remaining -= ((size) + 1); \
|
||||
chan->pushbuf->remaining -= ((size) + 1); \
|
||||
} while(0)
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,240 @@
|
||||
#include <pipe/p_defines.h>
|
||||
#include <pipe/p_screen.h>
|
||||
#include <pipe/p_state.h>
|
||||
|
||||
#include <util/u_memory.h>
|
||||
|
||||
#include "nouveau/nouveau_bo.h"
|
||||
#include "nouveau_winsys.h"
|
||||
#include "nouveau_screen.h"
|
||||
|
||||
static const char *
|
||||
nouveau_screen_get_name(struct pipe_screen *pscreen)
|
||||
{
|
||||
struct nouveau_device *dev = nouveau_screen(pscreen)->device;
|
||||
static char buffer[128];
|
||||
|
||||
snprintf(buffer, sizeof(buffer), "NV%02X", dev->chipset);
|
||||
return buffer;
|
||||
}
|
||||
|
||||
static const char *
|
||||
nouveau_screen_get_vendor(struct pipe_screen *pscreen)
|
||||
{
|
||||
return "nouveau";
|
||||
}
|
||||
|
||||
static struct pipe_buffer *
|
||||
nouveau_screen_bo_skel(struct pipe_screen *pscreen, struct nouveau_bo *bo,
|
||||
unsigned alignment, unsigned usage, unsigned size)
|
||||
{
|
||||
struct pipe_buffer *pb;
|
||||
|
||||
pb = CALLOC(1, sizeof(struct pipe_buffer)+sizeof(struct nouveau_bo *));
|
||||
if (!pb) {
|
||||
nouveau_bo_ref(NULL, &bo);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
pipe_reference_init(&pb->reference, 1);
|
||||
pb->screen = pscreen;
|
||||
pb->alignment = alignment;
|
||||
pb->usage = usage;
|
||||
pb->size = size;
|
||||
*(struct nouveau_bo **)(pb + 1) = bo;
|
||||
return pb;
|
||||
}
|
||||
|
||||
static struct pipe_buffer *
|
||||
nouveau_screen_bo_new(struct pipe_screen *pscreen, unsigned alignment,
|
||||
unsigned usage, unsigned size)
|
||||
{
|
||||
struct nouveau_device *dev = nouveau_screen(pscreen)->device;
|
||||
struct nouveau_bo *bo = NULL;
|
||||
uint32_t flags = NOUVEAU_BO_MAP;
|
||||
int ret;
|
||||
|
||||
if (usage & NOUVEAU_BUFFER_USAGE_TRANSFER)
|
||||
flags |= NOUVEAU_BO_GART;
|
||||
else
|
||||
if (usage & PIPE_BUFFER_USAGE_VERTEX) {
|
||||
if (pscreen->get_param(pscreen, NOUVEAU_CAP_HW_VTXBUF))
|
||||
flags |= NOUVEAU_BO_GART;
|
||||
} else
|
||||
if (usage & PIPE_BUFFER_USAGE_INDEX) {
|
||||
if (pscreen->get_param(pscreen, NOUVEAU_CAP_HW_IDXBUF))
|
||||
flags |= NOUVEAU_BO_GART;
|
||||
}
|
||||
|
||||
if (usage & PIPE_BUFFER_USAGE_PIXEL) {
|
||||
if (usage & NOUVEAU_BUFFER_USAGE_TEXTURE)
|
||||
flags |= NOUVEAU_BO_GART;
|
||||
if (!(usage & PIPE_BUFFER_USAGE_CPU_READ_WRITE))
|
||||
flags |= NOUVEAU_BO_VRAM;
|
||||
|
||||
if (dev->chipset == 0x50 || dev->chipset >= 0x80) {
|
||||
flags |= NOUVEAU_BO_TILED;
|
||||
if (usage & NOUVEAU_BUFFER_USAGE_ZETA)
|
||||
flags |= NOUVEAU_BO_ZTILE;
|
||||
}
|
||||
}
|
||||
|
||||
ret = nouveau_bo_new(dev, flags, alignment, size, &bo);
|
||||
if (ret)
|
||||
return NULL;
|
||||
|
||||
return nouveau_screen_bo_skel(pscreen, bo, alignment, usage, size);
|
||||
}
|
||||
|
||||
static struct pipe_buffer *
|
||||
nouveau_screen_bo_user(struct pipe_screen *pscreen, void *ptr, unsigned bytes)
|
||||
{
|
||||
struct nouveau_device *dev = nouveau_screen(pscreen)->device;
|
||||
struct nouveau_bo *bo = NULL;
|
||||
int ret;
|
||||
|
||||
ret = nouveau_bo_user(dev, ptr, bytes, &bo);
|
||||
if (ret)
|
||||
return NULL;
|
||||
|
||||
return nouveau_screen_bo_skel(pscreen, bo, 0, 0, bytes);
|
||||
}
|
||||
|
||||
static inline uint32_t
|
||||
nouveau_screen_map_flags(unsigned pipe)
|
||||
{
|
||||
uint32_t flags = 0;
|
||||
|
||||
if (pipe & PIPE_BUFFER_USAGE_CPU_READ)
|
||||
flags |= NOUVEAU_BO_RD;
|
||||
if (pipe & PIPE_BUFFER_USAGE_CPU_WRITE)
|
||||
flags |= NOUVEAU_BO_WR;
|
||||
if (pipe & PIPE_BUFFER_USAGE_DISCARD)
|
||||
flags |= NOUVEAU_BO_INVAL;
|
||||
if (pipe & PIPE_BUFFER_USAGE_DONTBLOCK)
|
||||
flags |= NOUVEAU_BO_NOWAIT;
|
||||
else
|
||||
if (pipe & 0 /*PIPE_BUFFER_USAGE_UNSYNCHRONIZED*/)
|
||||
flags |= NOUVEAU_BO_NOSYNC;
|
||||
|
||||
return flags;
|
||||
}
|
||||
|
||||
static void *
|
||||
nouveau_screen_bo_map(struct pipe_screen *pscreen, struct pipe_buffer *pb,
|
||||
unsigned usage)
|
||||
{
|
||||
struct nouveau_bo *bo = nouveau_bo(pb);
|
||||
int ret;
|
||||
|
||||
ret = nouveau_bo_map(bo, nouveau_screen_map_flags(usage));
|
||||
if (ret) {
|
||||
debug_printf("map failed: %d\n", ret);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return bo->map;
|
||||
}
|
||||
|
||||
static void *
|
||||
nouveau_screen_bo_map_range(struct pipe_screen *pscreen, struct pipe_buffer *pb,
|
||||
unsigned offset, unsigned length, unsigned usage)
|
||||
{
|
||||
struct nouveau_bo *bo = nouveau_bo(pb);
|
||||
int ret;
|
||||
|
||||
ret = nouveau_bo_map_range(bo, offset, length,
|
||||
nouveau_screen_map_flags(usage));
|
||||
if (ret) {
|
||||
debug_printf("map_range failed: %d\n", ret);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return (char *)bo->map - offset; /* why gallium? why? */
|
||||
}
|
||||
|
||||
static void
|
||||
nouveau_screen_bo_map_flush(struct pipe_screen *pscreen, struct pipe_buffer *pb,
|
||||
unsigned offset, unsigned length)
|
||||
{
|
||||
struct nouveau_bo *bo = nouveau_bo(pb);
|
||||
|
||||
nouveau_bo_map_flush(bo, offset, length);
|
||||
}
|
||||
|
||||
static void
|
||||
nouveau_screen_bo_unmap(struct pipe_screen *pscreen, struct pipe_buffer *pb)
|
||||
{
|
||||
struct nouveau_bo *bo = nouveau_bo(pb);
|
||||
|
||||
nouveau_bo_unmap(bo);
|
||||
}
|
||||
|
||||
static void
|
||||
nouveau_screen_bo_del(struct pipe_buffer *pb)
|
||||
{
|
||||
struct nouveau_bo *bo = nouveau_bo(pb);
|
||||
|
||||
nouveau_bo_ref(NULL, &bo);
|
||||
FREE(pb);
|
||||
}
|
||||
|
||||
static void
|
||||
nouveau_screen_fence_ref(struct pipe_screen *pscreen,
|
||||
struct pipe_fence_handle **ptr,
|
||||
struct pipe_fence_handle *pfence)
|
||||
{
|
||||
*ptr = pfence;
|
||||
}
|
||||
|
||||
static int
|
||||
nouveau_screen_fence_signalled(struct pipe_screen *screen,
|
||||
struct pipe_fence_handle *pfence,
|
||||
unsigned flags)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
nouveau_screen_fence_finish(struct pipe_screen *screen,
|
||||
struct pipe_fence_handle *pfence,
|
||||
unsigned flags)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
nouveau_screen_init(struct nouveau_screen *screen, struct nouveau_device *dev)
|
||||
{
|
||||
struct pipe_screen *pscreen = &screen->base;
|
||||
int ret;
|
||||
|
||||
ret = nouveau_channel_alloc(dev, 0xbeef0201, 0xbeef0202,
|
||||
&screen->channel);
|
||||
if (ret)
|
||||
return ret;
|
||||
screen->device = dev;
|
||||
|
||||
pscreen->get_name = nouveau_screen_get_name;
|
||||
pscreen->get_vendor = nouveau_screen_get_vendor;
|
||||
|
||||
pscreen->buffer_create = nouveau_screen_bo_new;
|
||||
pscreen->user_buffer_create = nouveau_screen_bo_user;
|
||||
pscreen->buffer_map = nouveau_screen_bo_map;
|
||||
pscreen->buffer_map_range = nouveau_screen_bo_map_range;
|
||||
pscreen->buffer_flush_mapped_range = nouveau_screen_bo_map_flush;
|
||||
pscreen->buffer_unmap = nouveau_screen_bo_unmap;
|
||||
pscreen->buffer_destroy = nouveau_screen_bo_del;
|
||||
|
||||
pscreen->fence_reference = nouveau_screen_fence_ref;
|
||||
pscreen->fence_signalled = nouveau_screen_fence_signalled;
|
||||
pscreen->fence_finish = nouveau_screen_fence_finish;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
nouveau_screen_fini(struct nouveau_screen *screen)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
#ifndef __NOUVEAU_SCREEN_H__
|
||||
#define __NOUVEAU_SCREEN_H__
|
||||
|
||||
struct nouveau_screen {
|
||||
struct pipe_screen base;
|
||||
struct nouveau_device *device;
|
||||
struct nouveau_channel *channel;
|
||||
};
|
||||
|
||||
static inline struct nouveau_screen *
|
||||
nouveau_screen(struct pipe_screen *pscreen)
|
||||
{
|
||||
return (struct nouveau_screen *)pscreen;
|
||||
}
|
||||
|
||||
static inline struct nouveau_bo *
|
||||
nouveau_bo(struct pipe_buffer *pb)
|
||||
{
|
||||
return pb ? *(struct nouveau_bo **)(pb + 1) : NULL;
|
||||
}
|
||||
|
||||
int nouveau_screen_init(struct nouveau_screen *, struct nouveau_device *);
|
||||
void nouveau_screen_fini(struct nouveau_screen *);
|
||||
|
||||
#endif
|
||||
@@ -4,7 +4,7 @@
|
||||
#include "util/u_debug.h"
|
||||
|
||||
struct nouveau_stateobj_reloc {
|
||||
struct pipe_buffer *bo;
|
||||
struct nouveau_bo *bo;
|
||||
|
||||
unsigned offset;
|
||||
unsigned packet;
|
||||
@@ -51,7 +51,7 @@ so_ref(struct nouveau_stateobj *ref, struct nouveau_stateobj **pso)
|
||||
if (pipe_reference((struct pipe_reference**)pso, &ref->reference)) {
|
||||
free(so->push);
|
||||
for (i = 0; i < so->cur_reloc; i++)
|
||||
pipe_buffer_reference(&so->reloc[i].bo, NULL);
|
||||
nouveau_bo_ref(NULL, &so->reloc[i].bo);
|
||||
free(so->reloc);
|
||||
free(so);
|
||||
}
|
||||
@@ -81,13 +81,13 @@ so_method(struct nouveau_stateobj *so, struct nouveau_grobj *gr,
|
||||
}
|
||||
|
||||
static INLINE void
|
||||
so_reloc(struct nouveau_stateobj *so, struct pipe_buffer *bo,
|
||||
so_reloc(struct nouveau_stateobj *so, struct nouveau_bo *bo,
|
||||
unsigned data, unsigned flags, unsigned vor, unsigned tor)
|
||||
{
|
||||
struct nouveau_stateobj_reloc *r = &so->reloc[so->cur_reloc++];
|
||||
|
||||
r->bo = NULL;
|
||||
pipe_buffer_reference(&r->bo, bo);
|
||||
nouveau_bo_ref(bo, &r->bo);
|
||||
r->offset = so->cur - so->push;
|
||||
r->packet = so->cur_packet;
|
||||
r->data = data;
|
||||
@@ -107,50 +107,52 @@ so_dump(struct nouveau_stateobj *so)
|
||||
}
|
||||
|
||||
static INLINE void
|
||||
so_emit(struct nouveau_winsys *nvws, struct nouveau_stateobj *so)
|
||||
so_emit(struct nouveau_channel *chan, struct nouveau_stateobj *so)
|
||||
{
|
||||
struct nouveau_pushbuf *pb = nvws->channel->pushbuf;
|
||||
struct nouveau_pushbuf *pb = chan->pushbuf;
|
||||
unsigned nr, i;
|
||||
|
||||
nr = so->cur - so->push;
|
||||
if (pb->remaining < nr)
|
||||
nvws->push_flush(nvws, nr, NULL);
|
||||
nouveau_pushbuf_flush(chan, nr);
|
||||
pb->remaining -= nr;
|
||||
|
||||
memcpy(pb->cur, so->push, nr * 4);
|
||||
for (i = 0; i < so->cur_reloc; i++) {
|
||||
struct nouveau_stateobj_reloc *r = &so->reloc[i];
|
||||
|
||||
nvws->push_reloc(nvws, pb->cur + r->offset, r->bo,
|
||||
r->data, r->flags, r->vor, r->tor);
|
||||
nouveau_pushbuf_emit_reloc(chan, pb->cur + r->offset,
|
||||
r->bo, r->data, 0, r->flags,
|
||||
r->vor, r->tor);
|
||||
}
|
||||
pb->cur += nr;
|
||||
}
|
||||
|
||||
static INLINE void
|
||||
so_emit_reloc_markers(struct nouveau_winsys *nvws, struct nouveau_stateobj *so)
|
||||
so_emit_reloc_markers(struct nouveau_channel *chan, struct nouveau_stateobj *so)
|
||||
{
|
||||
struct nouveau_pushbuf *pb = nvws->channel->pushbuf;
|
||||
struct nouveau_pushbuf *pb = chan->pushbuf;
|
||||
unsigned i;
|
||||
|
||||
if (!so)
|
||||
return;
|
||||
|
||||
i = so->cur_reloc << 1;
|
||||
if (nvws->channel->pushbuf->remaining < i)
|
||||
nvws->push_flush(nvws, i, NULL);
|
||||
nvws->channel->pushbuf->remaining -= i;
|
||||
if (pb->remaining < i)
|
||||
nouveau_pushbuf_flush(chan, i);
|
||||
pb->remaining -= i;
|
||||
|
||||
for (i = 0; i < so->cur_reloc; i++) {
|
||||
struct nouveau_stateobj_reloc *r = &so->reloc[i];
|
||||
|
||||
nvws->push_reloc(nvws, pb->cur++, r->bo, r->packet,
|
||||
(r->flags & (NOUVEAU_BO_VRAM |
|
||||
NOUVEAU_BO_GART |
|
||||
NOUVEAU_BO_RDWR)) |
|
||||
NOUVEAU_BO_DUMMY, 0, 0);
|
||||
nvws->push_reloc(nvws, pb->cur++, r->bo, r->data,
|
||||
r->flags | NOUVEAU_BO_DUMMY, r->vor, r->tor);
|
||||
nouveau_pushbuf_emit_reloc(chan, pb->cur++, r->bo, r->packet, 0,
|
||||
(r->flags & (NOUVEAU_BO_VRAM |
|
||||
NOUVEAU_BO_GART |
|
||||
NOUVEAU_BO_RDWR)) |
|
||||
NOUVEAU_BO_DUMMY, 0, 0);
|
||||
nouveau_pushbuf_emit_reloc(chan, pb->cur++, r->bo, r->data, 0,
|
||||
r->flags | NOUVEAU_BO_DUMMY,
|
||||
r->vor, r->tor);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -23,77 +23,38 @@
|
||||
#define NOUVEAU_BUFFER_USAGE_ZETA (1 << 17)
|
||||
#define NOUVEAU_BUFFER_USAGE_TRANSFER (1 << 18)
|
||||
|
||||
struct nouveau_winsys {
|
||||
struct pipe_winsys *ws;
|
||||
|
||||
struct nouveau_channel *channel;
|
||||
|
||||
int (*res_init)(struct nouveau_resource **heap, unsigned start,
|
||||
unsigned size);
|
||||
int (*res_alloc)(struct nouveau_resource *heap, int size, void *priv,
|
||||
struct nouveau_resource **);
|
||||
void (*res_free)(struct nouveau_resource **);
|
||||
|
||||
int (*push_reloc)(struct nouveau_winsys *, void *ptr,
|
||||
struct pipe_buffer *, uint32_t data,
|
||||
uint32_t flags, uint32_t vor, uint32_t tor);
|
||||
int (*push_flush)(struct nouveau_winsys *, unsigned size,
|
||||
struct pipe_fence_handle **fence);
|
||||
|
||||
int (*grobj_alloc)(struct nouveau_winsys *, int grclass,
|
||||
struct nouveau_grobj **);
|
||||
void (*grobj_free)(struct nouveau_grobj **);
|
||||
|
||||
int (*notifier_alloc)(struct nouveau_winsys *, int count,
|
||||
struct nouveau_notifier **);
|
||||
void (*notifier_free)(struct nouveau_notifier **);
|
||||
void (*notifier_reset)(struct nouveau_notifier *, int id);
|
||||
uint32_t (*notifier_status)(struct nouveau_notifier *, int id);
|
||||
uint32_t (*notifier_retval)(struct nouveau_notifier *, int id);
|
||||
int (*notifier_wait)(struct nouveau_notifier *, int id,
|
||||
int status, double timeout);
|
||||
|
||||
int (*surface_copy)(struct nouveau_winsys *, struct pipe_surface *,
|
||||
unsigned, unsigned, struct pipe_surface *,
|
||||
unsigned, unsigned, unsigned, unsigned);
|
||||
int (*surface_fill)(struct nouveau_winsys *, struct pipe_surface *,
|
||||
unsigned, unsigned, unsigned, unsigned, unsigned);
|
||||
|
||||
struct nouveau_bo *(*get_bo)(struct pipe_buffer *);
|
||||
};
|
||||
|
||||
extern struct pipe_screen *
|
||||
nv04_screen_create(struct pipe_winsys *ws, struct nouveau_winsys *);
|
||||
nv04_screen_create(struct pipe_winsys *ws, struct nouveau_device *);
|
||||
|
||||
extern struct pipe_context *
|
||||
nv04_create(struct pipe_screen *, unsigned pctx_id);
|
||||
|
||||
extern struct pipe_screen *
|
||||
nv10_screen_create(struct pipe_winsys *ws, struct nouveau_winsys *);
|
||||
nv10_screen_create(struct pipe_winsys *ws, struct nouveau_device *);
|
||||
|
||||
extern struct pipe_context *
|
||||
nv10_create(struct pipe_screen *, unsigned pctx_id);
|
||||
|
||||
extern struct pipe_screen *
|
||||
nv20_screen_create(struct pipe_winsys *ws, struct nouveau_winsys *);
|
||||
nv20_screen_create(struct pipe_winsys *ws, struct nouveau_device *);
|
||||
|
||||
extern struct pipe_context *
|
||||
nv20_create(struct pipe_screen *, unsigned pctx_id);
|
||||
|
||||
extern struct pipe_screen *
|
||||
nv30_screen_create(struct pipe_winsys *ws, struct nouveau_winsys *);
|
||||
nv30_screen_create(struct pipe_winsys *ws, struct nouveau_device *);
|
||||
|
||||
extern struct pipe_context *
|
||||
nv30_create(struct pipe_screen *, unsigned pctx_id);
|
||||
|
||||
extern struct pipe_screen *
|
||||
nv40_screen_create(struct pipe_winsys *ws, struct nouveau_winsys *);
|
||||
nv40_screen_create(struct pipe_winsys *ws, struct nouveau_device *);
|
||||
|
||||
extern struct pipe_context *
|
||||
nv40_create(struct pipe_screen *, unsigned pctx_id);
|
||||
|
||||
extern struct pipe_screen *
|
||||
nv50_screen_create(struct pipe_winsys *ws, struct nouveau_winsys *);
|
||||
nv50_screen_create(struct pipe_winsys *ws, struct nouveau_device *);
|
||||
|
||||
extern struct pipe_context *
|
||||
nv50_create(struct pipe_screen *, unsigned pctx_id);
|
||||
|
||||
@@ -1,27 +1,9 @@
|
||||
#include "pipe/p_screen.h"
|
||||
#include "pipe/p_inlines.h"
|
||||
#include "util/u_simple_screen.h"
|
||||
|
||||
#include "nv04_context.h"
|
||||
#include "nv04_screen.h"
|
||||
|
||||
static const char *
|
||||
nv04_screen_get_name(struct pipe_screen *screen)
|
||||
{
|
||||
struct nv04_screen *nv04screen = nv04_screen(screen);
|
||||
struct nouveau_device *dev = nv04screen->nvws->channel->device;
|
||||
static char buffer[128];
|
||||
|
||||
snprintf(buffer, sizeof(buffer), "NV%02X", dev->chipset);
|
||||
return buffer;
|
||||
}
|
||||
|
||||
static const char *
|
||||
nv04_screen_get_vendor(struct pipe_screen *screen)
|
||||
{
|
||||
return "nouveau";
|
||||
}
|
||||
|
||||
static int
|
||||
nv04_screen_get_param(struct pipe_screen *screen, int param)
|
||||
{
|
||||
@@ -123,10 +105,9 @@ static void
|
||||
nv04_screen_destroy(struct pipe_screen *pscreen)
|
||||
{
|
||||
struct nv04_screen *screen = nv04_screen(pscreen);
|
||||
struct nouveau_winsys *nvws = screen->nvws;
|
||||
|
||||
nvws->notifier_free(&screen->sync);
|
||||
nvws->grobj_free(&screen->fahrenheit);
|
||||
nouveau_notifier_free(&screen->sync);
|
||||
nouveau_grobj_free(&screen->fahrenheit);
|
||||
nv04_surface_2d_takedown(&screen->eng2d);
|
||||
|
||||
FREE(pscreen);
|
||||
@@ -141,21 +122,38 @@ nv04_surface_buffer(struct pipe_surface *surf)
|
||||
}
|
||||
|
||||
struct pipe_screen *
|
||||
nv04_screen_create(struct pipe_winsys *ws, struct nouveau_winsys *nvws)
|
||||
nv04_screen_create(struct pipe_winsys *ws, struct nouveau_device *dev)
|
||||
{
|
||||
struct nv04_screen *screen = CALLOC_STRUCT(nv04_screen);
|
||||
struct nouveau_channel *chan;
|
||||
struct pipe_screen *pscreen;
|
||||
unsigned fahrenheit_class = 0, sub3d_class = 0;
|
||||
unsigned chipset = nvws->channel->device->chipset;
|
||||
int ret;
|
||||
|
||||
if (!screen)
|
||||
return NULL;
|
||||
screen->nvws = nvws;
|
||||
pscreen = &screen->base.base;
|
||||
|
||||
if (chipset>=0x20) {
|
||||
ret = nouveau_screen_init(&screen->base, dev);
|
||||
if (ret) {
|
||||
nv04_screen_destroy(pscreen);
|
||||
return NULL;
|
||||
}
|
||||
chan = screen->base.channel;
|
||||
|
||||
pscreen->winsys = ws;
|
||||
pscreen->destroy = nv04_screen_destroy;
|
||||
pscreen->get_param = nv04_screen_get_param;
|
||||
pscreen->get_paramf = nv04_screen_get_paramf;
|
||||
pscreen->is_format_supported = nv04_screen_is_format_supported;
|
||||
|
||||
nv04_screen_init_miptree_functions(pscreen);
|
||||
nv04_screen_init_transfer_functions(pscreen);
|
||||
|
||||
if (dev->chipset >= 0x20) {
|
||||
fahrenheit_class = 0;
|
||||
sub3d_class = 0;
|
||||
} else if (chipset>=0x10) {
|
||||
} else if (dev->chipset >= 0x10) {
|
||||
fahrenheit_class = NV10_DX5_TEXTURED_TRIANGLE;
|
||||
sub3d_class = NV10_CONTEXT_SURFACES_3D;
|
||||
} else {
|
||||
@@ -164,50 +162,40 @@ nv04_screen_create(struct pipe_winsys *ws, struct nouveau_winsys *nvws)
|
||||
}
|
||||
|
||||
if (!fahrenheit_class) {
|
||||
NOUVEAU_ERR("Unknown nv04 chipset: nv%02x\n", chipset);
|
||||
NOUVEAU_ERR("Unknown nv04 chipset: nv%02x\n", dev->chipset);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* 2D engine setup */
|
||||
screen->eng2d = nv04_surface_2d_init(nvws);
|
||||
screen->eng2d->buf = nv04_surface_buffer;
|
||||
|
||||
/* 3D object */
|
||||
ret = nvws->grobj_alloc(nvws, fahrenheit_class, &screen->fahrenheit);
|
||||
ret = nouveau_grobj_alloc(chan, 0xbeef0001, fahrenheit_class,
|
||||
&screen->fahrenheit);
|
||||
if (ret) {
|
||||
NOUVEAU_ERR("Error creating 3D object: %d\n", ret);
|
||||
return NULL;
|
||||
}
|
||||
BIND_RING(chan, screen->fahrenheit, 7);
|
||||
|
||||
/* 3D surface object */
|
||||
ret = nvws->grobj_alloc(nvws, sub3d_class, &screen->context_surfaces_3d);
|
||||
ret = nouveau_grobj_alloc(chan, 0xbeef0002, sub3d_class,
|
||||
&screen->context_surfaces_3d);
|
||||
if (ret) {
|
||||
NOUVEAU_ERR("Error creating 3D surface object: %d\n", ret);
|
||||
return NULL;
|
||||
}
|
||||
BIND_RING(chan, screen->context_surfaces_3d, 6);
|
||||
|
||||
/* 2D engine setup */
|
||||
screen->eng2d = nv04_surface_2d_init(&screen->base);
|
||||
screen->eng2d->buf = nv04_surface_buffer;
|
||||
|
||||
/* Notifier for sync purposes */
|
||||
ret = nvws->notifier_alloc(nvws, 1, &screen->sync);
|
||||
ret = nouveau_notifier_alloc(chan, 0xbeef0301, 1, &screen->sync);
|
||||
if (ret) {
|
||||
NOUVEAU_ERR("Error creating notifier object: %d\n", ret);
|
||||
nv04_screen_destroy(&screen->pipe);
|
||||
nv04_screen_destroy(pscreen);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
screen->pipe.winsys = ws;
|
||||
screen->pipe.destroy = nv04_screen_destroy;
|
||||
|
||||
screen->pipe.get_name = nv04_screen_get_name;
|
||||
screen->pipe.get_vendor = nv04_screen_get_vendor;
|
||||
screen->pipe.get_param = nv04_screen_get_param;
|
||||
screen->pipe.get_paramf = nv04_screen_get_paramf;
|
||||
|
||||
screen->pipe.is_format_supported = nv04_screen_is_format_supported;
|
||||
|
||||
nv04_screen_init_miptree_functions(&screen->pipe);
|
||||
nv04_screen_init_transfer_functions(&screen->pipe);
|
||||
u_simple_screen_init(&screen->pipe);
|
||||
|
||||
return &screen->pipe;
|
||||
return pscreen;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
#ifndef __NV04_SCREEN_H__
|
||||
#define __NV04_SCREEN_H__
|
||||
|
||||
#include "pipe/p_screen.h"
|
||||
#include "nouveau/nouveau_screen.h"
|
||||
#include "nv04_surface_2d.h"
|
||||
|
||||
struct nv04_screen {
|
||||
struct pipe_screen pipe;
|
||||
struct nouveau_screen base;
|
||||
|
||||
struct nouveau_winsys *nvws;
|
||||
unsigned chipset;
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#include "pipe/p_state.h"
|
||||
#include "pipe/p_defines.h"
|
||||
#include "pipe/p_shader_tokens.h"
|
||||
#include "pipe/p_inlines.h"
|
||||
|
||||
#include "tgsi/tgsi_parse.h"
|
||||
|
||||
@@ -334,7 +335,7 @@ nv04_set_constant_buffer(struct pipe_context *pipe, uint shader, uint index,
|
||||
const struct pipe_constant_buffer *buf )
|
||||
{
|
||||
struct nv04_context *nv04 = nv04_context(pipe);
|
||||
struct pipe_winsys *ws = pipe->winsys;
|
||||
struct pipe_screen *pscreen = pipe->screen;
|
||||
|
||||
assert(shader < PIPE_SHADER_TYPES);
|
||||
assert(index == 0);
|
||||
@@ -342,12 +343,12 @@ nv04_set_constant_buffer(struct pipe_context *pipe, uint shader, uint index,
|
||||
if (buf) {
|
||||
void *mapped;
|
||||
if (buf->buffer && buf->buffer->size &&
|
||||
(mapped = ws->buffer_map(ws, buf->buffer, PIPE_BUFFER_USAGE_CPU_READ)))
|
||||
(mapped = pipe_buffer_map(pscreen, buf->buffer, PIPE_BUFFER_USAGE_CPU_READ)))
|
||||
{
|
||||
memcpy(nv04->constbuf[shader], mapped, buf->buffer->size);
|
||||
nv04->constbuf_nr[shader] =
|
||||
buf->buffer->size / (4 * sizeof(float));
|
||||
ws->buffer_unmap(ws, buf->buffer);
|
||||
pipe_buffer_unmap(pscreen, buf->buffer);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
|
||||
#include "nouveau/nouveau_winsys.h"
|
||||
#include "nouveau/nouveau_util.h"
|
||||
#include "nouveau/nouveau_screen.h"
|
||||
#include "nv04_surface_2d.h"
|
||||
|
||||
static INLINE int
|
||||
@@ -96,11 +97,11 @@ nv04_surface_copy_swizzle(struct nv04_surface_2d *ctx,
|
||||
struct pipe_surface *src, int sx, int sy,
|
||||
int w, int h)
|
||||
{
|
||||
struct nouveau_channel *chan = ctx->nvws->channel;
|
||||
struct nouveau_channel *chan = ctx->swzsurf->channel;
|
||||
struct nouveau_grobj *swzsurf = ctx->swzsurf;
|
||||
struct nouveau_grobj *sifm = ctx->sifm;
|
||||
struct nouveau_bo *src_bo = ctx->nvws->get_bo(ctx->buf(src));
|
||||
struct nouveau_bo *dst_bo = ctx->nvws->get_bo(ctx->buf(dst));
|
||||
struct nouveau_bo *src_bo = nouveau_bo(ctx->buf(src));
|
||||
struct nouveau_bo *dst_bo = nouveau_bo(ctx->buf(dst));
|
||||
const unsigned src_pitch = ((struct nv04_surface *)src)->pitch;
|
||||
const unsigned max_w = 1024;
|
||||
const unsigned max_h = 1024;
|
||||
@@ -167,10 +168,10 @@ nv04_surface_copy_m2mf(struct nv04_surface_2d *ctx,
|
||||
struct pipe_surface *dst, int dx, int dy,
|
||||
struct pipe_surface *src, int sx, int sy, int w, int h)
|
||||
{
|
||||
struct nouveau_channel *chan = ctx->nvws->channel;
|
||||
struct nouveau_channel *chan = ctx->m2mf->channel;
|
||||
struct nouveau_grobj *m2mf = ctx->m2mf;
|
||||
struct nouveau_bo *src_bo = ctx->nvws->get_bo(ctx->buf(src));
|
||||
struct nouveau_bo *dst_bo = ctx->nvws->get_bo(ctx->buf(dst));
|
||||
struct nouveau_bo *src_bo = nouveau_bo(ctx->buf(src));
|
||||
struct nouveau_bo *dst_bo = nouveau_bo(ctx->buf(dst));
|
||||
unsigned src_pitch = ((struct nv04_surface *)src)->pitch;
|
||||
unsigned dst_pitch = ((struct nv04_surface *)dst)->pitch;
|
||||
unsigned dst_offset = dst->offset + dy * dst_pitch +
|
||||
@@ -213,11 +214,11 @@ nv04_surface_copy_blit(struct nv04_surface_2d *ctx, struct pipe_surface *dst,
|
||||
int dx, int dy, struct pipe_surface *src, int sx, int sy,
|
||||
int w, int h)
|
||||
{
|
||||
struct nouveau_channel *chan = ctx->nvws->channel;
|
||||
struct nouveau_channel *chan = ctx->surf2d->channel;
|
||||
struct nouveau_grobj *surf2d = ctx->surf2d;
|
||||
struct nouveau_grobj *blit = ctx->blit;
|
||||
struct nouveau_bo *src_bo = ctx->nvws->get_bo(ctx->buf(src));
|
||||
struct nouveau_bo *dst_bo = ctx->nvws->get_bo(ctx->buf(dst));
|
||||
struct nouveau_bo *src_bo = nouveau_bo(ctx->buf(src));
|
||||
struct nouveau_bo *dst_bo = nouveau_bo(ctx->buf(dst));
|
||||
unsigned src_pitch = ((struct nv04_surface *)src)->pitch;
|
||||
unsigned dst_pitch = ((struct nv04_surface *)dst)->pitch;
|
||||
int format;
|
||||
@@ -279,10 +280,10 @@ static void
|
||||
nv04_surface_fill(struct nv04_surface_2d *ctx, struct pipe_surface *dst,
|
||||
int dx, int dy, int w, int h, unsigned value)
|
||||
{
|
||||
struct nouveau_channel *chan = ctx->nvws->channel;
|
||||
struct nouveau_channel *chan = ctx->surf2d->channel;
|
||||
struct nouveau_grobj *surf2d = ctx->surf2d;
|
||||
struct nouveau_grobj *rect = ctx->rect;
|
||||
struct nouveau_bo *dst_bo = ctx->nvws->get_bo(ctx->buf(dst));
|
||||
struct nouveau_bo *dst_bo = nouveau_bo(ctx->buf(dst));
|
||||
unsigned dst_pitch = ((struct nv04_surface *)dst)->pitch;
|
||||
int cs2d_format, gdirect_format;
|
||||
|
||||
@@ -334,10 +335,10 @@ nv04_surface_2d_takedown(struct nv04_surface_2d **pctx)
|
||||
}
|
||||
|
||||
struct nv04_surface_2d *
|
||||
nv04_surface_2d_init(struct nouveau_winsys *nvws)
|
||||
nv04_surface_2d_init(struct nouveau_screen *screen)
|
||||
{
|
||||
struct nv04_surface_2d *ctx = CALLOC_STRUCT(nv04_surface_2d);
|
||||
struct nouveau_channel *chan = nvws->channel;
|
||||
struct nouveau_channel *chan = screen->channel;
|
||||
unsigned handle = 0x88000000, class;
|
||||
int ret;
|
||||
|
||||
@@ -460,7 +461,6 @@ nv04_surface_2d_init(struct nouveau_winsys *nvws)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ctx->nvws = nvws;
|
||||
ctx->copy = nv04_surface_copy;
|
||||
ctx->fill = nv04_surface_fill;
|
||||
return ctx;
|
||||
|
||||
@@ -7,7 +7,6 @@ struct nv04_surface {
|
||||
};
|
||||
|
||||
struct nv04_surface_2d {
|
||||
struct nouveau_winsys *nvws;
|
||||
struct nouveau_notifier *ntfy;
|
||||
struct nouveau_grobj *surf2d;
|
||||
struct nouveau_grobj *swzsurf;
|
||||
@@ -26,7 +25,7 @@ struct nv04_surface_2d {
|
||||
};
|
||||
|
||||
struct nv04_surface_2d *
|
||||
nv04_surface_2d_init(struct nouveau_winsys *nvws);
|
||||
nv04_surface_2d_init(struct nouveau_screen *screen);
|
||||
|
||||
void
|
||||
nv04_surface_2d_takedown(struct nv04_surface_2d **);
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#include "draw/draw_context.h"
|
||||
#include "pipe/p_context.h"
|
||||
#include "pipe/p_state.h"
|
||||
#include "pipe/p_inlines.h"
|
||||
|
||||
#include "nv04_context.h"
|
||||
#include "nv04_state.h"
|
||||
@@ -13,6 +14,7 @@ boolean nv04_draw_elements( struct pipe_context *pipe,
|
||||
unsigned indexSize,
|
||||
unsigned prim, unsigned start, unsigned count)
|
||||
{
|
||||
struct pipe_screen *pscreen = pipe->screen;
|
||||
struct nv04_context *nv04 = nv04_context( pipe );
|
||||
struct draw_context *draw = nv04->draw;
|
||||
unsigned i;
|
||||
@@ -25,17 +27,17 @@ boolean nv04_draw_elements( struct pipe_context *pipe,
|
||||
for (i = 0; i < PIPE_MAX_ATTRIBS; i++) {
|
||||
if (nv04->vtxbuf[i].buffer) {
|
||||
void *buf
|
||||
= pipe->winsys->buffer_map(pipe->winsys,
|
||||
nv04->vtxbuf[i].buffer,
|
||||
PIPE_BUFFER_USAGE_CPU_READ);
|
||||
= pipe_buffer_map(pscreen,
|
||||
nv04->vtxbuf[i].buffer,
|
||||
PIPE_BUFFER_USAGE_CPU_READ);
|
||||
draw_set_mapped_vertex_buffer(draw, i, buf);
|
||||
}
|
||||
}
|
||||
/* Map index buffer, if present */
|
||||
if (indexBuffer) {
|
||||
void *mapped_indexes
|
||||
= pipe->winsys->buffer_map(pipe->winsys, indexBuffer,
|
||||
PIPE_BUFFER_USAGE_CPU_READ);
|
||||
= pipe_buffer_map(pscreen, indexBuffer,
|
||||
PIPE_BUFFER_USAGE_CPU_READ);
|
||||
draw_set_mapped_element_buffer(draw, indexSize, mapped_indexes);
|
||||
}
|
||||
else {
|
||||
@@ -55,12 +57,12 @@ boolean nv04_draw_elements( struct pipe_context *pipe,
|
||||
*/
|
||||
for (i = 0; i < PIPE_MAX_ATTRIBS; i++) {
|
||||
if (nv04->vtxbuf[i].buffer) {
|
||||
pipe->winsys->buffer_unmap(pipe->winsys, nv04->vtxbuf[i].buffer);
|
||||
pipe_buffer_unmap(pscreen, nv04->vtxbuf[i].buffer);
|
||||
draw_set_mapped_vertex_buffer(draw, i, NULL);
|
||||
}
|
||||
}
|
||||
if (indexBuffer) {
|
||||
pipe->winsys->buffer_unmap(pipe->winsys, indexBuffer);
|
||||
pipe_buffer_unmap(pscreen, indexBuffer);
|
||||
draw_set_mapped_element_buffer(draw, 0, NULL);
|
||||
}
|
||||
|
||||
|
||||
@@ -30,18 +30,18 @@ nv10_destroy(struct pipe_context *pipe)
|
||||
static void nv10_init_hwctx(struct nv10_context *nv10)
|
||||
{
|
||||
struct nv10_screen *screen = nv10->screen;
|
||||
struct nouveau_winsys *nvws = screen->nvws;
|
||||
struct nouveau_channel *chan = screen->base.channel;
|
||||
int i;
|
||||
float projectionmatrix[16];
|
||||
|
||||
BEGIN_RING(celsius, NV10TCL_DMA_NOTIFY, 1);
|
||||
OUT_RING (screen->sync->handle);
|
||||
BEGIN_RING(celsius, NV10TCL_DMA_IN_MEMORY0, 2);
|
||||
OUT_RING (nvws->channel->vram->handle);
|
||||
OUT_RING (nvws->channel->gart->handle);
|
||||
OUT_RING (chan->vram->handle);
|
||||
OUT_RING (chan->gart->handle);
|
||||
BEGIN_RING(celsius, NV10TCL_DMA_IN_MEMORY2, 2);
|
||||
OUT_RING (nvws->channel->vram->handle);
|
||||
OUT_RING (nvws->channel->vram->handle);
|
||||
OUT_RING (chan->vram->handle);
|
||||
OUT_RING (chan->vram->handle);
|
||||
|
||||
BEGIN_RING(celsius, NV10TCL_NOP, 1);
|
||||
OUT_RING (0);
|
||||
|
||||
@@ -40,7 +40,6 @@
|
||||
|
||||
#include "util/u_debug.h"
|
||||
#include "pipe/p_inlines.h"
|
||||
#include "pipe/internal/p_winsys_screen.h"
|
||||
|
||||
#include "nv10_context.h"
|
||||
#include "nv10_state.h"
|
||||
@@ -124,11 +123,10 @@ nv10_vbuf_render_map_vertices( struct vbuf_render *render )
|
||||
{
|
||||
struct nv10_vbuf_render *nv10_render = nv10_vbuf_render(render);
|
||||
struct nv10_context *nv10 = nv10_render->nv10;
|
||||
struct pipe_winsys *winsys = nv10->pipe.winsys;
|
||||
struct pipe_screen *pscreen = nv10->pipe.screen;
|
||||
|
||||
return winsys->buffer_map(winsys,
|
||||
nv10_render->buffer,
|
||||
PIPE_BUFFER_USAGE_CPU_WRITE);
|
||||
return pipe_buffer_map(pscreen, nv10_render->buffer,
|
||||
PIPE_BUFFER_USAGE_CPU_WRITE);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -138,10 +136,10 @@ nv10_vbuf_render_unmap_vertices( struct vbuf_render *render,
|
||||
{
|
||||
struct nv10_vbuf_render *nv10_render = nv10_vbuf_render(render);
|
||||
struct nv10_context *nv10 = nv10_render->nv10;
|
||||
struct pipe_winsys *winsys = nv10->pipe.winsys;
|
||||
struct pipe_screen *pscreen = nv10->pipe.screen;
|
||||
|
||||
assert(!nv10_render->buffer);
|
||||
winsys->buffer_unmap(winsys, nv10_render->buffer);
|
||||
pipe_buffer_unmap(pscreen, nv10_render->buffer);
|
||||
}
|
||||
|
||||
static boolean
|
||||
@@ -202,8 +200,6 @@ static void
|
||||
nv10_vbuf_render_release_vertices( struct vbuf_render *render )
|
||||
{
|
||||
struct nv10_vbuf_render *nv10_render = nv10_vbuf_render(render);
|
||||
struct nv10_context *nv10 = nv10_render->nv10;
|
||||
struct pipe_screen *pscreen = &nv10->screen->pipe;
|
||||
|
||||
assert(nv10_render->buffer);
|
||||
pipe_buffer_reference(&nv10_render->buffer, NULL);
|
||||
|
||||
@@ -1,26 +1,8 @@
|
||||
#include "pipe/p_screen.h"
|
||||
#include "util/u_simple_screen.h"
|
||||
|
||||
#include "nv10_context.h"
|
||||
#include "nv10_screen.h"
|
||||
|
||||
static const char *
|
||||
nv10_screen_get_name(struct pipe_screen *screen)
|
||||
{
|
||||
struct nv10_screen *nv10screen = nv10_screen(screen);
|
||||
struct nouveau_device *dev = nv10screen->nvws->channel->device;
|
||||
static char buffer[128];
|
||||
|
||||
snprintf(buffer, sizeof(buffer), "NV%02X", dev->chipset);
|
||||
return buffer;
|
||||
}
|
||||
|
||||
static const char *
|
||||
nv10_screen_get_vendor(struct pipe_screen *screen)
|
||||
{
|
||||
return "nouveau";
|
||||
}
|
||||
|
||||
static int
|
||||
nv10_screen_get_param(struct pipe_screen *screen, int param)
|
||||
{
|
||||
@@ -120,10 +102,9 @@ static void
|
||||
nv10_screen_destroy(struct pipe_screen *pscreen)
|
||||
{
|
||||
struct nv10_screen *screen = nv10_screen(pscreen);
|
||||
struct nouveau_winsys *nvws = screen->nvws;
|
||||
|
||||
nvws->notifier_free(&screen->sync);
|
||||
nvws->grobj_free(&screen->celsius);
|
||||
nouveau_notifier_free(&screen->sync);
|
||||
nouveau_grobj_free(&screen->celsius);
|
||||
|
||||
FREE(pscreen);
|
||||
}
|
||||
@@ -137,64 +118,69 @@ nv10_surface_buffer(struct pipe_surface *surf)
|
||||
}
|
||||
|
||||
struct pipe_screen *
|
||||
nv10_screen_create(struct pipe_winsys *ws, struct nouveau_winsys *nvws)
|
||||
nv10_screen_create(struct pipe_winsys *ws, struct nouveau_device *dev)
|
||||
{
|
||||
struct nv10_screen *screen = CALLOC_STRUCT(nv10_screen);
|
||||
struct nouveau_channel *chan;
|
||||
struct pipe_screen *pscreen;
|
||||
unsigned celsius_class;
|
||||
unsigned chipset = nvws->channel->device->chipset;
|
||||
int ret;
|
||||
|
||||
if (!screen)
|
||||
return NULL;
|
||||
screen->nvws = nvws;
|
||||
pscreen = &screen->base.base;
|
||||
|
||||
/* 2D engine setup */
|
||||
screen->eng2d = nv04_surface_2d_init(nvws);
|
||||
screen->eng2d->buf = nv10_surface_buffer;
|
||||
ret = nouveau_screen_init(&screen->base, dev);
|
||||
if (ret) {
|
||||
nv10_screen_destroy(pscreen);
|
||||
return NULL;
|
||||
}
|
||||
chan = screen->base.channel;
|
||||
|
||||
pscreen->winsys = ws;
|
||||
pscreen->destroy = nv10_screen_destroy;
|
||||
pscreen->get_param = nv10_screen_get_param;
|
||||
pscreen->get_paramf = nv10_screen_get_paramf;
|
||||
pscreen->is_format_supported = nv10_screen_is_format_supported;
|
||||
|
||||
nv10_screen_init_miptree_functions(pscreen);
|
||||
nv10_screen_init_transfer_functions(pscreen);
|
||||
|
||||
/* 3D object */
|
||||
if (chipset>=0x20)
|
||||
celsius_class=NV11TCL;
|
||||
else if (chipset>=0x17)
|
||||
celsius_class=NV17TCL;
|
||||
else if (chipset>=0x11)
|
||||
celsius_class=NV11TCL;
|
||||
if (dev->chipset >= 0x20)
|
||||
celsius_class = NV11TCL;
|
||||
else if (dev->chipset >= 0x17)
|
||||
celsius_class = NV17TCL;
|
||||
else if (dev->chipset >= 0x11)
|
||||
celsius_class = NV11TCL;
|
||||
else
|
||||
celsius_class=NV10TCL;
|
||||
celsius_class = NV10TCL;
|
||||
|
||||
if (!celsius_class) {
|
||||
NOUVEAU_ERR("Unknown nv1x chipset: nv%02x\n", chipset);
|
||||
NOUVEAU_ERR("Unknown nv1x chipset: nv%02x\n", dev->chipset);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ret = nvws->grobj_alloc(nvws, celsius_class, &screen->celsius);
|
||||
ret = nouveau_grobj_alloc(chan, 0xbeef0001, celsius_class,
|
||||
&screen->celsius);
|
||||
if (ret) {
|
||||
NOUVEAU_ERR("Error creating 3D object: %d\n", ret);
|
||||
return FALSE;
|
||||
}
|
||||
BIND_RING(chan, screen->celsius, 7);
|
||||
|
||||
/* 2D engine setup */
|
||||
screen->eng2d = nv04_surface_2d_init(&screen->base);
|
||||
screen->eng2d->buf = nv10_surface_buffer;
|
||||
|
||||
/* Notifier for sync purposes */
|
||||
ret = nvws->notifier_alloc(nvws, 1, &screen->sync);
|
||||
ret = nouveau_notifier_alloc(chan, 0xbeef0301, 1, &screen->sync);
|
||||
if (ret) {
|
||||
NOUVEAU_ERR("Error creating notifier object: %d\n", ret);
|
||||
nv10_screen_destroy(&screen->pipe);
|
||||
nv10_screen_destroy(pscreen);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
screen->pipe.winsys = ws;
|
||||
screen->pipe.destroy = nv10_screen_destroy;
|
||||
|
||||
screen->pipe.get_name = nv10_screen_get_name;
|
||||
screen->pipe.get_vendor = nv10_screen_get_vendor;
|
||||
screen->pipe.get_param = nv10_screen_get_param;
|
||||
screen->pipe.get_paramf = nv10_screen_get_paramf;
|
||||
|
||||
screen->pipe.is_format_supported = nv10_screen_is_format_supported;
|
||||
|
||||
nv10_screen_init_miptree_functions(&screen->pipe);
|
||||
nv10_screen_init_transfer_functions(&screen->pipe);
|
||||
u_simple_screen_init(&screen->pipe);
|
||||
|
||||
return &screen->pipe;
|
||||
return pscreen;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
#ifndef __NV10_SCREEN_H__
|
||||
#define __NV10_SCREEN_H__
|
||||
|
||||
#include "pipe/p_screen.h"
|
||||
#include "nouveau/nouveau_screen.h"
|
||||
#include "nv04/nv04_surface_2d.h"
|
||||
|
||||
struct nv10_screen {
|
||||
struct pipe_screen pipe;
|
||||
struct nouveau_screen base;
|
||||
|
||||
struct nouveau_winsys *nvws;
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#include "pipe/p_state.h"
|
||||
#include "pipe/p_defines.h"
|
||||
#include "pipe/p_shader_tokens.h"
|
||||
#include "pipe/p_inlines.h"
|
||||
|
||||
#include "tgsi/tgsi_parse.h"
|
||||
|
||||
@@ -460,7 +461,7 @@ nv10_set_constant_buffer(struct pipe_context *pipe, uint shader, uint index,
|
||||
const struct pipe_constant_buffer *buf )
|
||||
{
|
||||
struct nv10_context *nv10 = nv10_context(pipe);
|
||||
struct pipe_winsys *ws = pipe->winsys;
|
||||
struct pipe_screen *pscreen = pipe->screen;
|
||||
|
||||
assert(shader < PIPE_SHADER_TYPES);
|
||||
assert(index == 0);
|
||||
@@ -468,12 +469,12 @@ nv10_set_constant_buffer(struct pipe_context *pipe, uint shader, uint index,
|
||||
if (buf) {
|
||||
void *mapped;
|
||||
if (buf->buffer && buf->buffer->size &&
|
||||
(mapped = ws->buffer_map(ws, buf->buffer, PIPE_BUFFER_USAGE_CPU_READ)))
|
||||
(mapped = pipe_buffer_map(pscreen, buf->buffer, PIPE_BUFFER_USAGE_CPU_READ)))
|
||||
{
|
||||
memcpy(nv10->constbuf[shader], mapped, buf->buffer->size);
|
||||
nv10->constbuf_nr[shader] =
|
||||
buf->buffer->size / (4 * sizeof(float));
|
||||
ws->buffer_unmap(ws, buf->buffer);
|
||||
pipe_buffer_unmap(pscreen, buf->buffer);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#include "draw/draw_context.h"
|
||||
#include "pipe/p_context.h"
|
||||
#include "pipe/p_state.h"
|
||||
#include "pipe/p_inlines.h"
|
||||
|
||||
#include "nv10_context.h"
|
||||
#include "nv10_state.h"
|
||||
@@ -15,6 +16,7 @@ boolean nv10_draw_elements( struct pipe_context *pipe,
|
||||
{
|
||||
struct nv10_context *nv10 = nv10_context( pipe );
|
||||
struct draw_context *draw = nv10->draw;
|
||||
struct pipe_screen *pscreen = pipe->screen;
|
||||
unsigned i;
|
||||
|
||||
nv10_emit_hw_state(nv10);
|
||||
@@ -24,9 +26,8 @@ boolean nv10_draw_elements( struct pipe_context *pipe,
|
||||
*/
|
||||
for (i = 0; i < PIPE_MAX_ATTRIBS; i++) {
|
||||
if (nv10->vtxbuf[i].buffer) {
|
||||
void *buf
|
||||
= pipe->winsys->buffer_map(pipe->winsys,
|
||||
nv10->vtxbuf[i].buffer,
|
||||
void *buf =
|
||||
pipe_buffer_map(pscreen, nv10->vtxbuf[i].buffer,
|
||||
PIPE_BUFFER_USAGE_CPU_READ);
|
||||
draw_set_mapped_vertex_buffer(draw, i, buf);
|
||||
}
|
||||
@@ -34,8 +35,8 @@ boolean nv10_draw_elements( struct pipe_context *pipe,
|
||||
/* Map index buffer, if present */
|
||||
if (indexBuffer) {
|
||||
void *mapped_indexes
|
||||
= pipe->winsys->buffer_map(pipe->winsys, indexBuffer,
|
||||
PIPE_BUFFER_USAGE_CPU_READ);
|
||||
= pipe_buffer_map(pscreen, indexBuffer,
|
||||
PIPE_BUFFER_USAGE_CPU_READ);
|
||||
draw_set_mapped_element_buffer(draw, indexSize, mapped_indexes);
|
||||
}
|
||||
else {
|
||||
@@ -55,12 +56,12 @@ boolean nv10_draw_elements( struct pipe_context *pipe,
|
||||
*/
|
||||
for (i = 0; i < PIPE_MAX_ATTRIBS; i++) {
|
||||
if (nv10->vtxbuf[i].buffer) {
|
||||
pipe->winsys->buffer_unmap(pipe->winsys, nv10->vtxbuf[i].buffer);
|
||||
pipe_buffer_unmap(pscreen, nv10->vtxbuf[i].buffer);
|
||||
draw_set_mapped_vertex_buffer(draw, i, NULL);
|
||||
}
|
||||
}
|
||||
if (indexBuffer) {
|
||||
pipe->winsys->buffer_unmap(pipe->winsys, indexBuffer);
|
||||
pipe_buffer_unmap(pscreen, indexBuffer);
|
||||
draw_set_mapped_element_buffer(draw, 0, NULL);
|
||||
}
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ nv20_destroy(struct pipe_context *pipe)
|
||||
static void nv20_init_hwctx(struct nv20_context *nv20)
|
||||
{
|
||||
struct nv20_screen *screen = nv20->screen;
|
||||
struct nouveau_winsys *nvws = screen->nvws;
|
||||
struct nouveau_channel *chan = screen->base.channel;
|
||||
int i;
|
||||
float projectionmatrix[16];
|
||||
const boolean is_nv25tcl = (nv20->screen->kelvin->grclass == NV25TCL);
|
||||
@@ -38,11 +38,11 @@ static void nv20_init_hwctx(struct nv20_context *nv20)
|
||||
BEGIN_RING(kelvin, NV20TCL_DMA_NOTIFY, 1);
|
||||
OUT_RING (screen->sync->handle);
|
||||
BEGIN_RING(kelvin, NV20TCL_DMA_TEXTURE0, 2);
|
||||
OUT_RING (nvws->channel->vram->handle);
|
||||
OUT_RING (nvws->channel->gart->handle); /* TEXTURE1 */
|
||||
OUT_RING (chan->vram->handle);
|
||||
OUT_RING (chan->gart->handle); /* TEXTURE1 */
|
||||
BEGIN_RING(kelvin, NV20TCL_DMA_COLOR, 2);
|
||||
OUT_RING (nvws->channel->vram->handle);
|
||||
OUT_RING (nvws->channel->vram->handle); /* ZETA */
|
||||
OUT_RING (chan->vram->handle);
|
||||
OUT_RING (chan->vram->handle); /* ZETA */
|
||||
|
||||
BEGIN_RING(kelvin, NV20TCL_DMA_QUERY, 1);
|
||||
OUT_RING (0); /* renouveau: beef0351, unique */
|
||||
@@ -99,9 +99,9 @@ static void nv20_init_hwctx(struct nv20_context *nv20)
|
||||
OUT_RING (3);
|
||||
|
||||
BEGIN_RING(kelvin, NV25TCL_DMA_IN_MEMORY9, 1);
|
||||
OUT_RING (nvws->channel->vram->handle);
|
||||
OUT_RING (chan->vram->handle);
|
||||
BEGIN_RING(kelvin, NV25TCL_DMA_IN_MEMORY8, 1);
|
||||
OUT_RING (nvws->channel->vram->handle);
|
||||
OUT_RING (chan->vram->handle);
|
||||
}
|
||||
BEGIN_RING(kelvin, NV20TCL_DMA_FENCE, 1);
|
||||
OUT_RING (0); /* renouveau: beef1e10 */
|
||||
|
||||
@@ -152,12 +152,11 @@ static void *
|
||||
nv20_vbuf_render_map_vertices( struct vbuf_render *render )
|
||||
{
|
||||
struct nv20_vbuf_render *nv20_render = nv20_vbuf_render(render);
|
||||
struct pipe_winsys *winsys = nv20_render->nv20->pipe.winsys;
|
||||
struct pipe_screen *pscreen = nv20_render->nv20->pipe.screen;
|
||||
|
||||
if (nv20_render->pbuffer) {
|
||||
return winsys->buffer_map(winsys,
|
||||
nv20_render->pbuffer,
|
||||
PIPE_BUFFER_USAGE_CPU_WRITE);
|
||||
return pipe_buffer_map(pscreen, nv20_render->pbuffer,
|
||||
PIPE_BUFFER_USAGE_CPU_WRITE);
|
||||
} else if (nv20_render->mbuffer) {
|
||||
return nv20_render->mbuffer;
|
||||
} else
|
||||
@@ -173,10 +172,10 @@ nv20_vbuf_render_unmap_vertices( struct vbuf_render *render,
|
||||
ushort max_index )
|
||||
{
|
||||
struct nv20_vbuf_render *nv20_render = nv20_vbuf_render(render);
|
||||
struct pipe_winsys *winsys = nv20_render->nv20->pipe.winsys;
|
||||
struct pipe_screen *pscreen = nv20_render->nv20->pipe.screen;
|
||||
|
||||
if (nv20_render->pbuffer)
|
||||
winsys->buffer_unmap(winsys, nv20_render->pbuffer);
|
||||
pipe_buffer_unmap(pscreen, nv20_render->pbuffer);
|
||||
}
|
||||
|
||||
static boolean
|
||||
@@ -358,7 +357,6 @@ nv20_vbuf_render_release_vertices( struct vbuf_render *render )
|
||||
{
|
||||
struct nv20_vbuf_render *nv20_render = nv20_vbuf_render(render);
|
||||
struct nv20_context *nv20 = nv20_render->nv20;
|
||||
struct pipe_screen *pscreen = &nv20->screen->pipe;
|
||||
|
||||
if (nv20_render->pbuffer) {
|
||||
pipe_buffer_reference(&nv20_render->pbuffer, NULL);
|
||||
|
||||
@@ -1,26 +1,8 @@
|
||||
#include "pipe/p_screen.h"
|
||||
#include "util/u_simple_screen.h"
|
||||
|
||||
#include "nv20_context.h"
|
||||
#include "nv20_screen.h"
|
||||
|
||||
static const char *
|
||||
nv20_screen_get_name(struct pipe_screen *screen)
|
||||
{
|
||||
struct nv20_screen *nv20screen = nv20_screen(screen);
|
||||
struct nouveau_device *dev = nv20screen->nvws->channel->device;
|
||||
static char buffer[128];
|
||||
|
||||
snprintf(buffer, sizeof(buffer), "NV%02X", dev->chipset);
|
||||
return buffer;
|
||||
}
|
||||
|
||||
static const char *
|
||||
nv20_screen_get_vendor(struct pipe_screen *screen)
|
||||
{
|
||||
return "nouveau";
|
||||
}
|
||||
|
||||
static int
|
||||
nv20_screen_get_param(struct pipe_screen *screen, int param)
|
||||
{
|
||||
@@ -120,10 +102,9 @@ static void
|
||||
nv20_screen_destroy(struct pipe_screen *pscreen)
|
||||
{
|
||||
struct nv20_screen *screen = nv20_screen(pscreen);
|
||||
struct nouveau_winsys *nvws = screen->nvws;
|
||||
|
||||
nvws->notifier_free(&screen->sync);
|
||||
nvws->grobj_free(&screen->kelvin);
|
||||
nouveau_notifier_free(&screen->sync);
|
||||
nouveau_grobj_free(&screen->kelvin);
|
||||
|
||||
FREE(pscreen);
|
||||
}
|
||||
@@ -137,60 +118,65 @@ nv20_surface_buffer(struct pipe_surface *surf)
|
||||
}
|
||||
|
||||
struct pipe_screen *
|
||||
nv20_screen_create(struct pipe_winsys *ws, struct nouveau_winsys *nvws)
|
||||
nv20_screen_create(struct pipe_winsys *ws, struct nouveau_device *dev)
|
||||
{
|
||||
struct nv20_screen *screen = CALLOC_STRUCT(nv20_screen);
|
||||
struct nouveau_channel *chan;
|
||||
struct pipe_screen *pscreen;
|
||||
unsigned kelvin_class = 0;
|
||||
unsigned chipset = nvws->channel->device->chipset;
|
||||
int ret;
|
||||
|
||||
if (!screen)
|
||||
return NULL;
|
||||
screen->nvws = nvws;
|
||||
pscreen = &screen->base.base;
|
||||
|
||||
/* 2D engine setup */
|
||||
screen->eng2d = nv04_surface_2d_init(nvws);
|
||||
screen->eng2d->buf = nv20_surface_buffer;
|
||||
ret = nouveau_screen_init(&screen->base, dev);
|
||||
if (ret) {
|
||||
nv20_screen_destroy(pscreen);
|
||||
return NULL;
|
||||
}
|
||||
chan = screen->base.channel;
|
||||
|
||||
pscreen->winsys = ws;
|
||||
pscreen->destroy = nv20_screen_destroy;
|
||||
pscreen->get_param = nv20_screen_get_param;
|
||||
pscreen->get_paramf = nv20_screen_get_paramf;
|
||||
pscreen->is_format_supported = nv20_screen_is_format_supported;
|
||||
|
||||
nv20_screen_init_miptree_functions(pscreen);
|
||||
nv20_screen_init_transfer_functions(pscreen);
|
||||
|
||||
/* 3D object */
|
||||
if (chipset >= 0x25)
|
||||
if (dev->chipset >= 0x25)
|
||||
kelvin_class = NV25TCL;
|
||||
else if (chipset >= 0x20)
|
||||
else if (dev->chipset >= 0x20)
|
||||
kelvin_class = NV20TCL;
|
||||
|
||||
if (!kelvin_class || chipset >= 0x30) {
|
||||
NOUVEAU_ERR("Unknown nv2x chipset: nv%02x\n", chipset);
|
||||
if (!kelvin_class || dev->chipset >= 0x30) {
|
||||
NOUVEAU_ERR("Unknown nv2x chipset: nv%02x\n", dev->chipset);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ret = nvws->grobj_alloc(nvws, kelvin_class, &screen->kelvin);
|
||||
ret = nouveau_grobj_alloc(chan, 0xbeef0097, kelvin_class,
|
||||
&screen->kelvin);
|
||||
if (ret) {
|
||||
NOUVEAU_ERR("Error creating 3D object: %d\n", ret);
|
||||
return FALSE;
|
||||
}
|
||||
BIND_RING(chan, screen->kelvin, 7);
|
||||
|
||||
/* 2D engine setup */
|
||||
screen->eng2d = nv04_surface_2d_init(&screen->base);
|
||||
screen->eng2d->buf = nv20_surface_buffer;
|
||||
|
||||
/* Notifier for sync purposes */
|
||||
ret = nvws->notifier_alloc(nvws, 1, &screen->sync);
|
||||
ret = nouveau_notifier_alloc(chan, 0xbeef0301, 1, &screen->sync);
|
||||
if (ret) {
|
||||
NOUVEAU_ERR("Error creating notifier object: %d\n", ret);
|
||||
nv20_screen_destroy(&screen->pipe);
|
||||
nv20_screen_destroy(pscreen);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
screen->pipe.winsys = ws;
|
||||
screen->pipe.destroy = nv20_screen_destroy;
|
||||
|
||||
screen->pipe.get_name = nv20_screen_get_name;
|
||||
screen->pipe.get_vendor = nv20_screen_get_vendor;
|
||||
screen->pipe.get_param = nv20_screen_get_param;
|
||||
screen->pipe.get_paramf = nv20_screen_get_paramf;
|
||||
|
||||
screen->pipe.is_format_supported = nv20_screen_is_format_supported;
|
||||
|
||||
nv20_screen_init_miptree_functions(&screen->pipe);
|
||||
nv20_screen_init_transfer_functions(&screen->pipe);
|
||||
u_simple_screen_init(&screen->pipe);
|
||||
|
||||
return &screen->pipe;
|
||||
return pscreen;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
#ifndef __NV20_SCREEN_H__
|
||||
#define __NV20_SCREEN_H__
|
||||
|
||||
#include "pipe/p_screen.h"
|
||||
#include "nouveau/nouveau_screen.h"
|
||||
#include "nv04/nv04_surface_2d.h"
|
||||
|
||||
struct nv20_screen {
|
||||
struct pipe_screen pipe;
|
||||
struct nouveau_screen base;
|
||||
|
||||
struct nouveau_winsys *nvws;
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#include "pipe/p_state.h"
|
||||
#include "pipe/p_defines.h"
|
||||
#include "pipe/p_shader_tokens.h"
|
||||
#include "pipe/p_inlines.h"
|
||||
|
||||
#include "tgsi/tgsi_parse.h"
|
||||
|
||||
@@ -453,7 +454,7 @@ nv20_set_constant_buffer(struct pipe_context *pipe, uint shader, uint index,
|
||||
const struct pipe_constant_buffer *buf )
|
||||
{
|
||||
struct nv20_context *nv20 = nv20_context(pipe);
|
||||
struct pipe_winsys *ws = pipe->winsys;
|
||||
struct pipe_screen *pscreen = pipe->screen;
|
||||
|
||||
assert(shader < PIPE_SHADER_TYPES);
|
||||
assert(index == 0);
|
||||
@@ -461,12 +462,12 @@ nv20_set_constant_buffer(struct pipe_context *pipe, uint shader, uint index,
|
||||
if (buf) {
|
||||
void *mapped;
|
||||
if (buf->buffer && buf->buffer->size &&
|
||||
(mapped = ws->buffer_map(ws, buf->buffer, PIPE_BUFFER_USAGE_CPU_READ)))
|
||||
(mapped = pipe_buffer_map(pscreen, buf->buffer, PIPE_BUFFER_USAGE_CPU_READ)))
|
||||
{
|
||||
memcpy(nv20->constbuf[shader], mapped, buf->buffer->size);
|
||||
nv20->constbuf_nr[shader] =
|
||||
buf->buffer->size / (4 * sizeof(float));
|
||||
ws->buffer_unmap(ws, buf->buffer);
|
||||
pipe_buffer_unmap(pscreen, buf->buffer);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#include "draw/draw_context.h"
|
||||
#include "pipe/p_context.h"
|
||||
#include "pipe/p_state.h"
|
||||
#include "pipe/p_inlines.h"
|
||||
|
||||
#include "nv20_context.h"
|
||||
#include "nv20_state.h"
|
||||
@@ -13,6 +14,7 @@ boolean nv20_draw_elements( struct pipe_context *pipe,
|
||||
unsigned indexSize,
|
||||
unsigned prim, unsigned start, unsigned count)
|
||||
{
|
||||
struct pipe_screen *pscreen = pipe->screen;
|
||||
struct nv20_context *nv20 = nv20_context( pipe );
|
||||
struct draw_context *draw = nv20->draw;
|
||||
unsigned i;
|
||||
@@ -25,17 +27,17 @@ boolean nv20_draw_elements( struct pipe_context *pipe,
|
||||
for (i = 0; i < PIPE_MAX_ATTRIBS; i++) {
|
||||
if (nv20->vtxbuf[i].buffer) {
|
||||
void *buf
|
||||
= pipe->winsys->buffer_map(pipe->winsys,
|
||||
nv20->vtxbuf[i].buffer,
|
||||
PIPE_BUFFER_USAGE_CPU_READ);
|
||||
= pipe_buffer_map(pscreen,
|
||||
nv20->vtxbuf[i].buffer,
|
||||
PIPE_BUFFER_USAGE_CPU_READ);
|
||||
draw_set_mapped_vertex_buffer(draw, i, buf);
|
||||
}
|
||||
}
|
||||
/* Map index buffer, if present */
|
||||
if (indexBuffer) {
|
||||
void *mapped_indexes
|
||||
= pipe->winsys->buffer_map(pipe->winsys, indexBuffer,
|
||||
PIPE_BUFFER_USAGE_CPU_READ);
|
||||
= pipe_buffer_map(pscreen, indexBuffer,
|
||||
PIPE_BUFFER_USAGE_CPU_READ);
|
||||
draw_set_mapped_element_buffer(draw, indexSize, mapped_indexes);
|
||||
}
|
||||
else {
|
||||
@@ -55,12 +57,12 @@ boolean nv20_draw_elements( struct pipe_context *pipe,
|
||||
*/
|
||||
for (i = 0; i < PIPE_MAX_ATTRIBS; i++) {
|
||||
if (nv20->vtxbuf[i].buffer) {
|
||||
pipe->winsys->buffer_unmap(pipe->winsys, nv20->vtxbuf[i].buffer);
|
||||
pipe_buffer_unmap(pscreen, nv20->vtxbuf[i].buffer);
|
||||
draw_set_mapped_vertex_buffer(draw, i, NULL);
|
||||
}
|
||||
}
|
||||
if (indexBuffer) {
|
||||
pipe->winsys->buffer_unmap(pipe->winsys, indexBuffer);
|
||||
pipe_buffer_unmap(pscreen, indexBuffer);
|
||||
draw_set_mapped_element_buffer(draw, 0, NULL);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#include "pipe/p_context.h"
|
||||
#include "pipe/p_defines.h"
|
||||
#include "pipe/p_state.h"
|
||||
#include "pipe/p_inlines.h"
|
||||
|
||||
#include "pipe/p_shader_tokens.h"
|
||||
#include "tgsi/tgsi_parse.h"
|
||||
@@ -645,8 +646,8 @@ out_err:
|
||||
static boolean
|
||||
nv20_vertprog_validate(struct nv20_context *nv20)
|
||||
{
|
||||
struct pipe_screen *pscreen = nv20->pipe.screen;
|
||||
struct nouveau_winsys *nvws = nv20->nvws;
|
||||
struct pipe_winsys *ws = nv20->pipe.winsys;
|
||||
struct nouveau_grobj *rankine = nv20->screen->rankine;
|
||||
struct nv20_vertex_program *vp;
|
||||
struct pipe_buffer *constbuf;
|
||||
@@ -749,8 +750,8 @@ nv20_vertprog_validate(struct nv20_context *nv20)
|
||||
float *map = NULL;
|
||||
|
||||
if (constbuf) {
|
||||
map = ws->buffer_map(ws, constbuf,
|
||||
PIPE_BUFFER_USAGE_CPU_READ);
|
||||
map = pipe_buffer_map(pscreen, constbuf,
|
||||
PIPE_BUFFER_USAGE_CPU_READ);
|
||||
}
|
||||
|
||||
for (i = 0; i < vp->nr_consts; i++) {
|
||||
@@ -770,9 +771,8 @@ nv20_vertprog_validate(struct nv20_context *nv20)
|
||||
OUT_RINGp ((uint32_t *)vpd->value, 4);
|
||||
}
|
||||
|
||||
if (constbuf) {
|
||||
ws->buffer_unmap(ws, constbuf);
|
||||
}
|
||||
if (constbuf)
|
||||
pipe_buffer_unmap(pscreen, constbuf);
|
||||
}
|
||||
|
||||
/* Upload vtxprog */
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#include "pipe/p_context.h"
|
||||
#include "pipe/p_defines.h"
|
||||
#include "pipe/p_state.h"
|
||||
#include "pipe/p_inlines.h"
|
||||
|
||||
#include "pipe/p_shader_tokens.h"
|
||||
#include "tgsi/tgsi_parse.h"
|
||||
@@ -798,12 +799,12 @@ static void
|
||||
nv30_fragprog_upload(struct nv30_context *nv30,
|
||||
struct nv30_fragment_program *fp)
|
||||
{
|
||||
struct pipe_winsys *ws = nv30->pipe.winsys;
|
||||
struct pipe_screen *pscreen = nv30->pipe.screen;
|
||||
const uint32_t le = 1;
|
||||
uint32_t *map;
|
||||
int i;
|
||||
|
||||
map = ws->buffer_map(ws, fp->buffer, PIPE_BUFFER_USAGE_CPU_WRITE);
|
||||
map = pipe_buffer_map(pscreen, fp->buffer, PIPE_BUFFER_USAGE_CPU_WRITE);
|
||||
|
||||
#if 0
|
||||
for (i = 0; i < fp->insn_len; i++) {
|
||||
@@ -825,7 +826,7 @@ nv30_fragprog_upload(struct nv30_context *nv30,
|
||||
}
|
||||
}
|
||||
|
||||
ws->buffer_unmap(ws, fp->buffer);
|
||||
pipe_buffer_unmap(pscreen, fp->buffer);
|
||||
}
|
||||
|
||||
static boolean
|
||||
@@ -834,8 +835,7 @@ nv30_fragprog_validate(struct nv30_context *nv30)
|
||||
struct nv30_fragment_program *fp = nv30->fragprog;
|
||||
struct pipe_buffer *constbuf =
|
||||
nv30->constbuf[PIPE_SHADER_FRAGMENT];
|
||||
struct pipe_screen *screen = nv30->pipe.screen;
|
||||
struct pipe_winsys *ws = nv30->pipe.winsys;
|
||||
struct pipe_screen *pscreen = nv30->pipe.screen;
|
||||
struct nouveau_stateobj *so;
|
||||
boolean new_consts = FALSE;
|
||||
int i;
|
||||
@@ -850,14 +850,15 @@ nv30_fragprog_validate(struct nv30_context *nv30)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
fp->buffer = screen->buffer_create(screen, 0x100, 0, fp->insn_len * 4);
|
||||
fp->buffer = pscreen->buffer_create(pscreen, 0x100, 0, fp->insn_len * 4);
|
||||
nv30_fragprog_upload(nv30, fp);
|
||||
|
||||
so = so_new(8, 1);
|
||||
so_method(so, nv30->screen->rankine, NV34TCL_FP_ACTIVE_PROGRAM, 1);
|
||||
so_reloc (so, fp->buffer, 0, NOUVEAU_BO_VRAM | NOUVEAU_BO_GART |
|
||||
NOUVEAU_BO_RD | NOUVEAU_BO_LOW | NOUVEAU_BO_OR,
|
||||
NV34TCL_FP_ACTIVE_PROGRAM_DMA0, NV34TCL_FP_ACTIVE_PROGRAM_DMA1);
|
||||
so_reloc (so, nouveau_bo(fp->buffer), 0, NOUVEAU_BO_VRAM |
|
||||
NOUVEAU_BO_GART | NOUVEAU_BO_RD | NOUVEAU_BO_LOW |
|
||||
NOUVEAU_BO_OR, NV34TCL_FP_ACTIVE_PROGRAM_DMA0,
|
||||
NV34TCL_FP_ACTIVE_PROGRAM_DMA1);
|
||||
so_method(so, nv30->screen->rankine, NV34TCL_FP_CONTROL, 1);
|
||||
so_data (so, fp->fp_control);
|
||||
so_method(so, nv30->screen->rankine, NV34TCL_FP_REG_CONTROL, 1);
|
||||
@@ -871,7 +872,8 @@ update_constants:
|
||||
if (fp->nr_consts) {
|
||||
float *map;
|
||||
|
||||
map = ws->buffer_map(ws, constbuf, PIPE_BUFFER_USAGE_CPU_READ);
|
||||
map = pipe_buffer_map(pscreen, constbuf,
|
||||
PIPE_BUFFER_USAGE_CPU_READ);
|
||||
for (i = 0; i < fp->nr_consts; i++) {
|
||||
struct nv30_fragment_program_data *fpd = &fp->consts[i];
|
||||
uint32_t *p = &fp->insn[fpd->offset];
|
||||
@@ -882,7 +884,7 @@ update_constants:
|
||||
memcpy(p, cb, 4 * sizeof(float));
|
||||
new_consts = TRUE;
|
||||
}
|
||||
ws->buffer_unmap(ws, constbuf);
|
||||
pipe_buffer_unmap(pscreen, constbuf);
|
||||
|
||||
if (new_consts)
|
||||
nv30_fragprog_upload(nv30, fp);
|
||||
|
||||
@@ -61,6 +61,7 @@ nv30_fragtex_build(struct nv30_context *nv30, int unit)
|
||||
struct nv30_sampler_state *ps = nv30->tex_sampler[unit];
|
||||
struct nv30_miptree *nv30mt = nv30->tex_miptree[unit];
|
||||
struct pipe_texture *pt = &nv30mt->base;
|
||||
struct nouveau_bo *bo = nouveau_bo(nv30mt->buffer);
|
||||
struct nv30_texture_format *tf;
|
||||
struct nouveau_stateobj *so;
|
||||
uint32_t txf, txs , txp;
|
||||
@@ -106,9 +107,9 @@ nv30_fragtex_build(struct nv30_context *nv30, int unit)
|
||||
|
||||
so = so_new(16, 2);
|
||||
so_method(so, nv30->screen->rankine, NV34TCL_TX_OFFSET(unit), 8);
|
||||
so_reloc (so, nv30mt->buffer, 0, tex_flags | NOUVEAU_BO_LOW, 0, 0);
|
||||
so_reloc (so, nv30mt->buffer, txf, tex_flags | NOUVEAU_BO_OR,
|
||||
NV34TCL_TX_FORMAT_DMA0, NV34TCL_TX_FORMAT_DMA1);
|
||||
so_reloc (so, bo, 0, tex_flags | NOUVEAU_BO_LOW, 0, 0);
|
||||
so_reloc (so, bo, txf, tex_flags | NOUVEAU_BO_OR,
|
||||
NV34TCL_TX_FORMAT_DMA0, NV34TCL_TX_FORMAT_DMA1);
|
||||
so_data (so, ps->wrap);
|
||||
so_data (so, NV34TCL_TX_ENABLE_ENABLE | ps->en);
|
||||
so_data (so, txs);
|
||||
|
||||
@@ -29,11 +29,10 @@ nv30_query_create(struct pipe_context *pipe, unsigned query_type)
|
||||
static void
|
||||
nv30_query_destroy(struct pipe_context *pipe, struct pipe_query *pq)
|
||||
{
|
||||
struct nv30_context *nv30 = nv30_context(pipe);
|
||||
struct nv30_query *q = nv30_query(pq);
|
||||
|
||||
if (q->object)
|
||||
nv30->nvws->res_free(&q->object);
|
||||
nouveau_resource_free(&q->object);
|
||||
FREE(q);
|
||||
}
|
||||
|
||||
@@ -54,9 +53,9 @@ nv30_query_begin(struct pipe_context *pipe, struct pipe_query *pq)
|
||||
pipe->get_query_result(pipe, pq, 1, &tmp);
|
||||
}
|
||||
|
||||
if (nv30->nvws->res_alloc(nv30->screen->query_heap, 1, NULL, &q->object))
|
||||
if (nouveau_resource_alloc(nv30->screen->query_heap, 1, NULL, &q->object))
|
||||
assert(0);
|
||||
nv30->nvws->notifier_reset(nv30->screen->query, q->object->start);
|
||||
nouveau_notifier_reset(nv30->screen->query, q->object->start);
|
||||
|
||||
BEGIN_RING(rankine, NV34TCL_QUERY_RESET, 1);
|
||||
OUT_RING (1);
|
||||
@@ -84,27 +83,27 @@ nv30_query_result(struct pipe_context *pipe, struct pipe_query *pq,
|
||||
{
|
||||
struct nv30_context *nv30 = nv30_context(pipe);
|
||||
struct nv30_query *q = nv30_query(pq);
|
||||
struct nouveau_winsys *nvws = nv30->nvws;
|
||||
|
||||
assert(q->object && q->type == PIPE_QUERY_OCCLUSION_COUNTER);
|
||||
|
||||
if (!q->ready) {
|
||||
unsigned status;
|
||||
|
||||
status = nvws->notifier_status(nv30->screen->query,
|
||||
q->object->start);
|
||||
status = nouveau_notifier_status(nv30->screen->query,
|
||||
q->object->start);
|
||||
if (status != NV_NOTIFY_STATE_STATUS_COMPLETED) {
|
||||
if (wait == FALSE)
|
||||
return FALSE;
|
||||
nvws->notifier_wait(nv30->screen->query, q->object->start,
|
||||
NV_NOTIFY_STATE_STATUS_COMPLETED,
|
||||
0);
|
||||
|
||||
nouveau_notifier_wait_status(nv30->screen->query,
|
||||
q->object->start,
|
||||
NV_NOTIFY_STATE_STATUS_COMPLETED, 0);
|
||||
}
|
||||
|
||||
q->result = nvws->notifier_retval(nv30->screen->query,
|
||||
q->object->start);
|
||||
q->result = nouveau_notifier_return_val(nv30->screen->query,
|
||||
q->object->start);
|
||||
q->ready = TRUE;
|
||||
nvws->res_free(&q->object);
|
||||
nouveau_resource_free(&q->object);
|
||||
}
|
||||
|
||||
*result = q->result;
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
#include "pipe/p_screen.h"
|
||||
#include "util/u_simple_screen.h"
|
||||
#include "pipe/p_state.h"
|
||||
|
||||
#include "nouveau/nouveau_screen.h"
|
||||
|
||||
#include "nv30_context.h"
|
||||
#include "nv30_screen.h"
|
||||
@@ -8,23 +10,6 @@
|
||||
#define NV34TCL_CHIPSET_3X_MASK 0x00000010
|
||||
#define NV35TCL_CHIPSET_3X_MASK 0x000001e0
|
||||
|
||||
static const char *
|
||||
nv30_screen_get_name(struct pipe_screen *pscreen)
|
||||
{
|
||||
struct nv30_screen *screen = nv30_screen(pscreen);
|
||||
struct nouveau_device *dev = screen->nvws->channel->device;
|
||||
static char buffer[128];
|
||||
|
||||
snprintf(buffer, sizeof(buffer), "NV%02X", dev->chipset);
|
||||
return buffer;
|
||||
}
|
||||
|
||||
static const char *
|
||||
nv30_screen_get_vendor(struct pipe_screen *pscreen)
|
||||
{
|
||||
return "nouveau";
|
||||
}
|
||||
|
||||
static int
|
||||
nv30_screen_get_param(struct pipe_screen *pscreen, int param)
|
||||
{
|
||||
@@ -139,45 +124,57 @@ static void
|
||||
nv30_screen_destroy(struct pipe_screen *pscreen)
|
||||
{
|
||||
struct nv30_screen *screen = nv30_screen(pscreen);
|
||||
struct nouveau_winsys *nvws = screen->nvws;
|
||||
|
||||
nvws->res_free(&screen->vp_exec_heap);
|
||||
nvws->res_free(&screen->vp_data_heap);
|
||||
nvws->res_free(&screen->query_heap);
|
||||
nvws->notifier_free(&screen->query);
|
||||
nvws->notifier_free(&screen->sync);
|
||||
nvws->grobj_free(&screen->rankine);
|
||||
nouveau_resource_free(&screen->vp_exec_heap);
|
||||
nouveau_resource_free(&screen->vp_data_heap);
|
||||
nouveau_resource_free(&screen->query_heap);
|
||||
nouveau_notifier_free(&screen->query);
|
||||
nouveau_notifier_free(&screen->sync);
|
||||
nouveau_grobj_free(&screen->rankine);
|
||||
|
||||
FREE(pscreen);
|
||||
}
|
||||
|
||||
struct pipe_screen *
|
||||
nv30_screen_create(struct pipe_winsys *ws, struct nouveau_winsys *nvws)
|
||||
nv30_screen_create(struct pipe_winsys *ws, struct nouveau_device *dev)
|
||||
{
|
||||
struct nv30_screen *screen = CALLOC_STRUCT(nv30_screen);
|
||||
struct nouveau_channel *chan;
|
||||
struct pipe_screen *pscreen;
|
||||
struct nouveau_stateobj *so;
|
||||
unsigned rankine_class = 0;
|
||||
unsigned chipset = nvws->channel->device->chipset;
|
||||
int ret, i;
|
||||
|
||||
if (!screen)
|
||||
return NULL;
|
||||
screen->nvws = nvws;
|
||||
pscreen = &screen->base.base;
|
||||
|
||||
/* 2D engine setup */
|
||||
screen->eng2d = nv04_surface_2d_init(nvws);
|
||||
screen->eng2d->buf = nv30_surface_buffer;
|
||||
ret = nouveau_screen_init(&screen->base, dev);
|
||||
if (ret) {
|
||||
nv30_screen_destroy(pscreen);
|
||||
return NULL;
|
||||
}
|
||||
chan = screen->base.channel;
|
||||
|
||||
pscreen->winsys = ws;
|
||||
pscreen->destroy = nv30_screen_destroy;
|
||||
pscreen->get_param = nv30_screen_get_param;
|
||||
pscreen->get_paramf = nv30_screen_get_paramf;
|
||||
pscreen->is_format_supported = nv30_screen_surface_format_supported;
|
||||
|
||||
nv30_screen_init_miptree_functions(pscreen);
|
||||
nv30_screen_init_transfer_functions(pscreen);
|
||||
|
||||
/* 3D object */
|
||||
switch (chipset & 0xf0) {
|
||||
switch (dev->chipset & 0xf0) {
|
||||
case 0x30:
|
||||
if (NV30TCL_CHIPSET_3X_MASK & (1 << (chipset & 0x0f)))
|
||||
if (NV30TCL_CHIPSET_3X_MASK & (1 << (dev->chipset & 0x0f)))
|
||||
rankine_class = 0x0397;
|
||||
else
|
||||
if (NV34TCL_CHIPSET_3X_MASK & (1 << (chipset & 0x0f)))
|
||||
if (NV34TCL_CHIPSET_3X_MASK & (1 << (dev->chipset & 0x0f)))
|
||||
rankine_class = 0x0697;
|
||||
else
|
||||
if (NV35TCL_CHIPSET_3X_MASK & (1 << (chipset & 0x0f)))
|
||||
if (NV35TCL_CHIPSET_3X_MASK & (1 << (dev->chipset & 0x0f)))
|
||||
rankine_class = 0x0497;
|
||||
break;
|
||||
default:
|
||||
@@ -185,43 +182,49 @@ nv30_screen_create(struct pipe_winsys *ws, struct nouveau_winsys *nvws)
|
||||
}
|
||||
|
||||
if (!rankine_class) {
|
||||
NOUVEAU_ERR("Unknown nv3x chipset: nv%02x\n", chipset);
|
||||
NOUVEAU_ERR("Unknown nv3x chipset: nv%02x\n", dev->chipset);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ret = nvws->grobj_alloc(nvws, rankine_class, &screen->rankine);
|
||||
ret = nouveau_grobj_alloc(chan, 0xbeef3097, rankine_class,
|
||||
&screen->rankine);
|
||||
if (ret) {
|
||||
NOUVEAU_ERR("Error creating 3D object: %d\n", ret);
|
||||
return FALSE;
|
||||
}
|
||||
BIND_RING(chan, screen->rankine, 7);
|
||||
|
||||
/* 2D engine setup */
|
||||
screen->eng2d = nv04_surface_2d_init(&screen->base);
|
||||
screen->eng2d->buf = nv30_surface_buffer;
|
||||
|
||||
/* Notifier for sync purposes */
|
||||
ret = nvws->notifier_alloc(nvws, 1, &screen->sync);
|
||||
ret = nouveau_notifier_alloc(chan, 0xbeef0301, 1, &screen->sync);
|
||||
if (ret) {
|
||||
NOUVEAU_ERR("Error creating notifier object: %d\n", ret);
|
||||
nv30_screen_destroy(&screen->pipe);
|
||||
nv30_screen_destroy(pscreen);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Query objects */
|
||||
ret = nvws->notifier_alloc(nvws, 32, &screen->query);
|
||||
ret = nouveau_notifier_alloc(chan, 0xbeef0302, 32, &screen->query);
|
||||
if (ret) {
|
||||
NOUVEAU_ERR("Error initialising query objects: %d\n", ret);
|
||||
nv30_screen_destroy(&screen->pipe);
|
||||
nv30_screen_destroy(pscreen);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ret = nvws->res_init(&screen->query_heap, 0, 32);
|
||||
ret = nouveau_resource_init(&screen->query_heap, 0, 32);
|
||||
if (ret) {
|
||||
NOUVEAU_ERR("Error initialising query object heap: %d\n", ret);
|
||||
nv30_screen_destroy(&screen->pipe);
|
||||
nv30_screen_destroy(pscreen);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Vtxprog resources */
|
||||
if (nvws->res_init(&screen->vp_exec_heap, 0, 256) ||
|
||||
nvws->res_init(&screen->vp_data_heap, 0, 256)) {
|
||||
nv30_screen_destroy(&screen->pipe);
|
||||
if (nouveau_resource_init(&screen->vp_exec_heap, 0, 256) ||
|
||||
nouveau_resource_init(&screen->vp_data_heap, 0, 256)) {
|
||||
nv30_screen_destroy(pscreen);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -230,23 +233,23 @@ nv30_screen_create(struct pipe_winsys *ws, struct nouveau_winsys *nvws)
|
||||
so_method(so, screen->rankine, NV34TCL_DMA_NOTIFY, 1);
|
||||
so_data (so, screen->sync->handle);
|
||||
so_method(so, screen->rankine, NV34TCL_DMA_TEXTURE0, 2);
|
||||
so_data (so, nvws->channel->vram->handle);
|
||||
so_data (so, nvws->channel->gart->handle);
|
||||
so_data (so, chan->vram->handle);
|
||||
so_data (so, chan->gart->handle);
|
||||
so_method(so, screen->rankine, NV34TCL_DMA_COLOR1, 1);
|
||||
so_data (so, nvws->channel->vram->handle);
|
||||
so_data (so, chan->vram->handle);
|
||||
so_method(so, screen->rankine, NV34TCL_DMA_COLOR0, 2);
|
||||
so_data (so, nvws->channel->vram->handle);
|
||||
so_data (so, nvws->channel->vram->handle);
|
||||
so_data (so, chan->vram->handle);
|
||||
so_data (so, chan->vram->handle);
|
||||
so_method(so, screen->rankine, NV34TCL_DMA_VTXBUF0, 2);
|
||||
so_data (so, nvws->channel->vram->handle);
|
||||
so_data (so, nvws->channel->gart->handle);
|
||||
so_data (so, chan->vram->handle);
|
||||
so_data (so, chan->gart->handle);
|
||||
/* so_method(so, screen->rankine, NV34TCL_DMA_FENCE, 2);
|
||||
so_data (so, 0);
|
||||
so_data (so, screen->query->handle);*/
|
||||
so_method(so, screen->rankine, NV34TCL_DMA_IN_MEMORY7, 1);
|
||||
so_data (so, nvws->channel->vram->handle);
|
||||
so_data (so, chan->vram->handle);
|
||||
so_method(so, screen->rankine, NV34TCL_DMA_IN_MEMORY8, 1);
|
||||
so_data (so, nvws->channel->vram->handle);
|
||||
so_data (so, chan->vram->handle);
|
||||
|
||||
for (i=1; i<8; i++) {
|
||||
so_method(so, screen->rankine, NV34TCL_VIEWPORT_CLIP_HORIZ(i), 1);
|
||||
@@ -301,23 +304,9 @@ nv30_screen_create(struct pipe_winsys *ws, struct nouveau_winsys *nvws)
|
||||
so_method(so, screen->rankine, 0x1e94, 1);
|
||||
so_data (so, 0x13);
|
||||
|
||||
so_emit(nvws, so);
|
||||
so_emit(chan, so);
|
||||
so_ref(NULL, &so);
|
||||
nvws->push_flush(nvws, 0, NULL);
|
||||
nouveau_pushbuf_flush(chan, 0);
|
||||
|
||||
screen->pipe.winsys = ws;
|
||||
screen->pipe.destroy = nv30_screen_destroy;
|
||||
|
||||
screen->pipe.get_name = nv30_screen_get_name;
|
||||
screen->pipe.get_vendor = nv30_screen_get_vendor;
|
||||
screen->pipe.get_param = nv30_screen_get_param;
|
||||
screen->pipe.get_paramf = nv30_screen_get_paramf;
|
||||
|
||||
screen->pipe.is_format_supported = nv30_screen_surface_format_supported;
|
||||
|
||||
nv30_screen_init_miptree_functions(&screen->pipe);
|
||||
nv30_screen_init_transfer_functions(&screen->pipe);
|
||||
u_simple_screen_init(&screen->pipe);
|
||||
|
||||
return &screen->pipe;
|
||||
return pscreen;
|
||||
}
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
#ifndef __NV30_SCREEN_H__
|
||||
#define __NV30_SCREEN_H__
|
||||
|
||||
#include "pipe/p_screen.h"
|
||||
#include "nouveau/nouveau_screen.h"
|
||||
|
||||
#include "nv04/nv04_surface_2d.h"
|
||||
|
||||
struct nv30_screen {
|
||||
struct pipe_screen pipe;
|
||||
struct nouveau_screen base;
|
||||
|
||||
struct nouveau_winsys *nvws;
|
||||
|
||||
|
||||
@@ -38,6 +38,7 @@ nv30_state_do_validate(struct nv30_context *nv30,
|
||||
void
|
||||
nv30_state_emit(struct nv30_context *nv30)
|
||||
{
|
||||
struct nouveau_channel *chan = nv30->screen->base.channel;
|
||||
struct nv30_state *state = &nv30->state;
|
||||
struct nv30_screen *screen = nv30->screen;
|
||||
unsigned i, samplers;
|
||||
@@ -57,23 +58,23 @@ nv30_state_emit(struct nv30_context *nv30)
|
||||
continue;
|
||||
so_ref (state->hw[i], &nv30->screen->state[i]);
|
||||
if (state->hw[i])
|
||||
so_emit(nv30->nvws, nv30->screen->state[i]);
|
||||
so_emit(chan, nv30->screen->state[i]);
|
||||
states &= ~(1ULL << i);
|
||||
}
|
||||
|
||||
state->dirty = 0;
|
||||
|
||||
so_emit_reloc_markers(nv30->nvws, state->hw[NV30_STATE_FB]);
|
||||
so_emit_reloc_markers(chan, state->hw[NV30_STATE_FB]);
|
||||
for (i = 0, samplers = state->fp_samplers; i < 16 && samplers; i++) {
|
||||
if (!(samplers & (1 << i)))
|
||||
continue;
|
||||
so_emit_reloc_markers(nv30->nvws,
|
||||
so_emit_reloc_markers(chan,
|
||||
state->hw[NV30_STATE_FRAGTEX0+i]);
|
||||
samplers &= ~(1ULL << i);
|
||||
}
|
||||
so_emit_reloc_markers(nv30->nvws, state->hw[NV30_STATE_FRAGPROG]);
|
||||
so_emit_reloc_markers(chan, state->hw[NV30_STATE_FRAGPROG]);
|
||||
if (state->hw[NV30_STATE_VTXBUF] /*&& nv30->render_mode == HW*/)
|
||||
so_emit_reloc_markers(nv30->nvws, state->hw[NV30_STATE_VTXBUF]);
|
||||
so_emit_reloc_markers(chan, state->hw[NV30_STATE_VTXBUF]);
|
||||
}
|
||||
|
||||
boolean
|
||||
|
||||
@@ -5,6 +5,8 @@ static boolean
|
||||
nv30_state_framebuffer_validate(struct nv30_context *nv30)
|
||||
{
|
||||
struct pipe_framebuffer_state *fb = &nv30->framebuffer;
|
||||
struct nouveau_channel *chan = nv30->screen->base.channel;
|
||||
struct nouveau_grobj *rankine = nv30->screen->rankine;
|
||||
struct nv04_surface *rt[2], *zeta = NULL;
|
||||
uint32_t rt_enable, rt_format;
|
||||
int i, colour_format = 0, zeta_format = 0;
|
||||
@@ -79,56 +81,53 @@ nv30_state_framebuffer_validate(struct nv30_context *nv30)
|
||||
}
|
||||
|
||||
nv30mt = (struct nv30_miptree *)rt[0]->base.texture;
|
||||
so_method(so, nv30->screen->rankine, NV34TCL_DMA_COLOR0, 1);
|
||||
so_reloc (so, nv30mt->buffer, 0, rt_flags | NOUVEAU_BO_OR,
|
||||
nv30->nvws->channel->vram->handle,
|
||||
nv30->nvws->channel->gart->handle);
|
||||
so_method(so, nv30->screen->rankine, NV34TCL_COLOR0_PITCH, 2);
|
||||
so_method(so, rankine, NV34TCL_DMA_COLOR0, 1);
|
||||
so_reloc (so, nouveau_bo(nv30mt->buffer), 0, rt_flags | NOUVEAU_BO_OR,
|
||||
chan->vram->handle, chan->gart->handle);
|
||||
so_method(so, rankine, NV34TCL_COLOR0_PITCH, 2);
|
||||
so_data (so, pitch);
|
||||
so_reloc (so, nv30mt->buffer, rt[0]->base.offset, rt_flags |
|
||||
NOUVEAU_BO_LOW, 0, 0);
|
||||
so_reloc (so, nouveau_bo(nv30mt->buffer), rt[0]->base.offset,
|
||||
rt_flags | NOUVEAU_BO_LOW, 0, 0);
|
||||
}
|
||||
|
||||
if (rt_enable & NV34TCL_RT_ENABLE_COLOR1) {
|
||||
nv30mt = (struct nv30_miptree *)rt[1]->base.texture;
|
||||
so_method(so, nv30->screen->rankine, NV34TCL_DMA_COLOR1, 1);
|
||||
so_reloc (so, nv30mt->buffer, 0, rt_flags | NOUVEAU_BO_OR,
|
||||
nv30->nvws->channel->vram->handle,
|
||||
nv30->nvws->channel->gart->handle);
|
||||
so_method(so, nv30->screen->rankine, NV34TCL_COLOR1_OFFSET, 2);
|
||||
so_reloc (so, nv30mt->buffer, rt[1]->base.offset, rt_flags |
|
||||
NOUVEAU_BO_LOW, 0, 0);
|
||||
so_method(so, rankine, NV34TCL_DMA_COLOR1, 1);
|
||||
so_reloc (so, nouveau_bo(nv30mt->buffer), 0, rt_flags | NOUVEAU_BO_OR,
|
||||
chan->vram->handle, chan->gart->handle);
|
||||
so_method(so, rankine, NV34TCL_COLOR1_OFFSET, 2);
|
||||
so_reloc (so, nouveau_bo(nv30mt->buffer), rt[1]->base.offset,
|
||||
rt_flags | NOUVEAU_BO_LOW, 0, 0);
|
||||
so_data (so, rt[1]->pitch);
|
||||
}
|
||||
|
||||
if (zeta_format) {
|
||||
nv30mt = (struct nv30_miptree *)zeta->base.texture;
|
||||
so_method(so, nv30->screen->rankine, NV34TCL_DMA_ZETA, 1);
|
||||
so_reloc (so, nv30mt->buffer, 0, rt_flags | NOUVEAU_BO_OR,
|
||||
nv30->nvws->channel->vram->handle,
|
||||
nv30->nvws->channel->gart->handle);
|
||||
so_method(so, nv30->screen->rankine, NV34TCL_ZETA_OFFSET, 1);
|
||||
so_reloc (so, nv30mt->buffer, zeta->base.offset, rt_flags |
|
||||
NOUVEAU_BO_LOW, 0, 0);
|
||||
so_method(so, rankine, NV34TCL_DMA_ZETA, 1);
|
||||
so_reloc (so, nouveau_bo(nv30mt->buffer), 0, rt_flags | NOUVEAU_BO_OR,
|
||||
chan->vram->handle, chan->gart->handle);
|
||||
so_method(so, rankine, NV34TCL_ZETA_OFFSET, 1);
|
||||
so_reloc (so, nouveau_bo(nv30mt->buffer), zeta->base.offset,
|
||||
rt_flags | NOUVEAU_BO_LOW, 0, 0);
|
||||
/* TODO: allocate LMA depth buffer */
|
||||
}
|
||||
|
||||
so_method(so, nv30->screen->rankine, NV34TCL_RT_ENABLE, 1);
|
||||
so_method(so, rankine, NV34TCL_RT_ENABLE, 1);
|
||||
so_data (so, rt_enable);
|
||||
so_method(so, nv30->screen->rankine, NV34TCL_RT_HORIZ, 3);
|
||||
so_method(so, rankine, NV34TCL_RT_HORIZ, 3);
|
||||
so_data (so, (w << 16) | 0);
|
||||
so_data (so, (h << 16) | 0);
|
||||
so_data (so, rt_format);
|
||||
so_method(so, nv30->screen->rankine, NV34TCL_VIEWPORT_HORIZ, 2);
|
||||
so_method(so, rankine, NV34TCL_VIEWPORT_HORIZ, 2);
|
||||
so_data (so, (w << 16) | 0);
|
||||
so_data (so, (h << 16) | 0);
|
||||
so_method(so, nv30->screen->rankine, NV34TCL_VIEWPORT_CLIP_HORIZ(0), 2);
|
||||
so_method(so, rankine, NV34TCL_VIEWPORT_CLIP_HORIZ(0), 2);
|
||||
so_data (so, ((w - 1) << 16) | 0);
|
||||
so_data (so, ((h - 1) << 16) | 0);
|
||||
so_method(so, nv30->screen->rankine, 0x1d88, 1);
|
||||
so_method(so, rankine, 0x1d88, 1);
|
||||
so_data (so, (1 << 12) | h);
|
||||
/* Wonder why this is needed, context should all be set to zero on init */
|
||||
so_method(so, nv30->screen->rankine, NV34TCL_VIEWPORT_TX_ORIGIN, 1);
|
||||
so_method(so, rankine, NV34TCL_VIEWPORT_TX_ORIGIN, 1);
|
||||
so_data (so, 0);
|
||||
|
||||
so_ref(so, &nv30->state.hw[NV30_STATE_FB]);
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#include "pipe/p_context.h"
|
||||
#include "pipe/p_state.h"
|
||||
#include "pipe/p_inlines.h"
|
||||
|
||||
#include "nv30_context.h"
|
||||
#include "nv30_state.h"
|
||||
@@ -70,7 +71,7 @@ static boolean
|
||||
nv30_vbo_set_idxbuf(struct nv30_context *nv30, struct pipe_buffer *ib,
|
||||
unsigned ib_size)
|
||||
{
|
||||
struct pipe_screen *pscreen = &nv30->screen->pipe;
|
||||
struct pipe_screen *pscreen = &nv30->screen->base.base;
|
||||
unsigned type;
|
||||
|
||||
if (!ib) {
|
||||
@@ -108,7 +109,7 @@ nv30_vbo_static_attrib(struct nv30_context *nv30, struct nouveau_stateobj *so,
|
||||
int attrib, struct pipe_vertex_element *ve,
|
||||
struct pipe_vertex_buffer *vb)
|
||||
{
|
||||
struct pipe_winsys *ws = nv30->pipe.winsys;
|
||||
struct pipe_screen *pscreen = nv30->pipe.screen;
|
||||
struct nouveau_grobj *rankine = nv30->screen->rankine;
|
||||
unsigned type, ncomp;
|
||||
void *map;
|
||||
@@ -116,7 +117,7 @@ nv30_vbo_static_attrib(struct nv30_context *nv30, struct nouveau_stateobj *so,
|
||||
if (nv30_vbo_format_to_hw(ve->src_format, &type, &ncomp))
|
||||
return FALSE;
|
||||
|
||||
map = ws->buffer_map(ws, vb->buffer, PIPE_BUFFER_USAGE_CPU_READ);
|
||||
map = pipe_buffer_map(pscreen, vb->buffer, PIPE_BUFFER_USAGE_CPU_READ);
|
||||
map += vb->buffer_offset + ve->src_offset;
|
||||
|
||||
switch (type) {
|
||||
@@ -148,18 +149,17 @@ nv30_vbo_static_attrib(struct nv30_context *nv30, struct nouveau_stateobj *so,
|
||||
so_data (so, fui(v[0]));
|
||||
break;
|
||||
default:
|
||||
ws->buffer_unmap(ws, vb->buffer);
|
||||
pipe_buffer_unmap(pscreen, vb->buffer);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
ws->buffer_unmap(ws, vb->buffer);
|
||||
pipe_buffer_unmap(pscreen, vb->buffer);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
ws->buffer_unmap(ws, vb->buffer);
|
||||
|
||||
pipe_buffer_unmap(pscreen, vb->buffer);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -168,7 +168,7 @@ nv30_draw_arrays(struct pipe_context *pipe,
|
||||
unsigned mode, unsigned start, unsigned count)
|
||||
{
|
||||
struct nv30_context *nv30 = nv30_context(pipe);
|
||||
struct nouveau_channel *chan = nv30->nvws->channel;
|
||||
struct nouveau_channel *chan = nv30->screen->base.channel;
|
||||
unsigned restart = 0;
|
||||
|
||||
nv30_vbo_set_idxbuf(nv30, NULL, 0);
|
||||
@@ -228,7 +228,7 @@ static INLINE void
|
||||
nv30_draw_elements_u08(struct nv30_context *nv30, void *ib,
|
||||
unsigned mode, unsigned start, unsigned count)
|
||||
{
|
||||
struct nouveau_channel *chan = nv30->nvws->channel;
|
||||
struct nouveau_channel *chan = nv30->screen->base.channel;
|
||||
|
||||
while (count) {
|
||||
uint8_t *elts = (uint8_t *)ib + start;
|
||||
@@ -277,7 +277,7 @@ static INLINE void
|
||||
nv30_draw_elements_u16(struct nv30_context *nv30, void *ib,
|
||||
unsigned mode, unsigned start, unsigned count)
|
||||
{
|
||||
struct nouveau_channel *chan = nv30->nvws->channel;
|
||||
struct nouveau_channel *chan = nv30->screen->base.channel;
|
||||
|
||||
while (count) {
|
||||
uint16_t *elts = (uint16_t *)ib + start;
|
||||
@@ -326,7 +326,7 @@ static INLINE void
|
||||
nv30_draw_elements_u32(struct nv30_context *nv30, void *ib,
|
||||
unsigned mode, unsigned start, unsigned count)
|
||||
{
|
||||
struct nouveau_channel *chan = nv30->nvws->channel;
|
||||
struct nouveau_channel *chan = nv30->screen->base.channel;
|
||||
|
||||
while (count) {
|
||||
uint32_t *elts = (uint32_t *)ib + start;
|
||||
@@ -368,10 +368,10 @@ nv30_draw_elements_inline(struct pipe_context *pipe,
|
||||
unsigned mode, unsigned start, unsigned count)
|
||||
{
|
||||
struct nv30_context *nv30 = nv30_context(pipe);
|
||||
struct pipe_winsys *ws = pipe->winsys;
|
||||
struct pipe_screen *pscreen = pipe->screen;
|
||||
void *map;
|
||||
|
||||
map = ws->buffer_map(ws, ib, PIPE_BUFFER_USAGE_CPU_READ);
|
||||
map = pipe_buffer_map(pscreen, ib, PIPE_BUFFER_USAGE_CPU_READ);
|
||||
if (!ib) {
|
||||
NOUVEAU_ERR("failed mapping ib\n");
|
||||
return FALSE;
|
||||
@@ -392,7 +392,7 @@ nv30_draw_elements_inline(struct pipe_context *pipe,
|
||||
break;
|
||||
}
|
||||
|
||||
ws->buffer_unmap(ws, ib);
|
||||
pipe_buffer_unmap(pscreen, ib);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -401,7 +401,7 @@ nv30_draw_elements_vbo(struct pipe_context *pipe,
|
||||
unsigned mode, unsigned start, unsigned count)
|
||||
{
|
||||
struct nv30_context *nv30 = nv30_context(pipe);
|
||||
struct nouveau_channel *chan = nv30->nvws->channel;
|
||||
struct nouveau_channel *chan = nv30->screen->base.channel;
|
||||
unsigned restart = 0;
|
||||
|
||||
while (count) {
|
||||
@@ -521,18 +521,20 @@ nv30_vbo_validate(struct nv30_context *nv30)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
so_reloc(vtxbuf, vb->buffer, vb->buffer_offset + ve->src_offset,
|
||||
vb_flags | NOUVEAU_BO_LOW | NOUVEAU_BO_OR,
|
||||
0, NV34TCL_VTXBUF_ADDRESS_DMA1);
|
||||
so_reloc(vtxbuf, nouveau_bo(vb->buffer), vb->buffer_offset +
|
||||
ve->src_offset, vb_flags | NOUVEAU_BO_LOW |
|
||||
NOUVEAU_BO_OR, 0, NV34TCL_VTXBUF_ADDRESS_DMA1);
|
||||
so_data (vtxfmt, ((vb->stride << NV34TCL_VTXFMT_STRIDE_SHIFT) |
|
||||
(ncomp << NV34TCL_VTXFMT_SIZE_SHIFT) | type));
|
||||
}
|
||||
|
||||
if (ib) {
|
||||
struct nouveau_bo *bo = nouveau_bo(ib);
|
||||
|
||||
so_method(vtxbuf, rankine, NV34TCL_IDXBUF_ADDRESS, 2);
|
||||
so_reloc (vtxbuf, ib, 0, vb_flags | NOUVEAU_BO_LOW, 0, 0);
|
||||
so_reloc (vtxbuf, ib, ib_format, vb_flags | NOUVEAU_BO_OR,
|
||||
0, NV34TCL_IDXBUF_FORMAT_DMA1);
|
||||
so_reloc (vtxbuf, bo, 0, vb_flags | NOUVEAU_BO_LOW, 0, 0);
|
||||
so_reloc (vtxbuf, bo, ib_format, vb_flags | NOUVEAU_BO_OR,
|
||||
0, NV34TCL_IDXBUF_FORMAT_DMA1);
|
||||
}
|
||||
|
||||
so_method(vtxbuf, rankine, 0x1710, 1);
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#include "pipe/p_context.h"
|
||||
#include "pipe/p_defines.h"
|
||||
#include "pipe/p_state.h"
|
||||
#include "pipe/p_inlines.h"
|
||||
|
||||
#include "pipe/p_shader_tokens.h"
|
||||
#include "tgsi/tgsi_parse.h"
|
||||
@@ -645,8 +646,7 @@ out_err:
|
||||
static boolean
|
||||
nv30_vertprog_validate(struct nv30_context *nv30)
|
||||
{
|
||||
struct nouveau_winsys *nvws = nv30->nvws;
|
||||
struct pipe_winsys *ws = nv30->pipe.winsys;
|
||||
struct pipe_screen *pscreen = nv30->pipe.screen;
|
||||
struct nouveau_grobj *rankine = nv30->screen->rankine;
|
||||
struct nv30_vertex_program *vp;
|
||||
struct pipe_buffer *constbuf;
|
||||
@@ -669,15 +669,15 @@ nv30_vertprog_validate(struct nv30_context *nv30)
|
||||
struct nouveau_stateobj *so;
|
||||
uint vplen = vp->nr_insns;
|
||||
|
||||
if (nvws->res_alloc(heap, vplen, vp, &vp->exec)) {
|
||||
if (nouveau_resource_alloc(heap, vplen, vp, &vp->exec)) {
|
||||
while (heap->next && heap->size < vplen) {
|
||||
struct nv30_vertex_program *evict;
|
||||
|
||||
evict = heap->next->priv;
|
||||
nvws->res_free(&evict->exec);
|
||||
nouveau_resource_free(&evict->exec);
|
||||
}
|
||||
|
||||
if (nvws->res_alloc(heap, vplen, vp, &vp->exec))
|
||||
if (nouveau_resource_alloc(heap, vplen, vp, &vp->exec))
|
||||
assert(0);
|
||||
}
|
||||
|
||||
@@ -694,15 +694,16 @@ nv30_vertprog_validate(struct nv30_context *nv30)
|
||||
if (vp->nr_consts && !vp->data) {
|
||||
struct nouveau_resource *heap = nv30->screen->vp_data_heap;
|
||||
|
||||
if (nvws->res_alloc(heap, vp->nr_consts, vp, &vp->data)) {
|
||||
if (nouveau_resource_alloc(heap, vp->nr_consts, vp, &vp->data)) {
|
||||
while (heap->next && heap->size < vp->nr_consts) {
|
||||
struct nv30_vertex_program *evict;
|
||||
|
||||
evict = heap->next->priv;
|
||||
nvws->res_free(&evict->data);
|
||||
nouveau_resource_free(&evict->data);
|
||||
}
|
||||
|
||||
if (nvws->res_alloc(heap, vp->nr_consts, vp, &vp->data))
|
||||
if (nouveau_resource_alloc(heap, vp->nr_consts, vp,
|
||||
&vp->data))
|
||||
assert(0);
|
||||
}
|
||||
|
||||
@@ -750,8 +751,8 @@ nv30_vertprog_validate(struct nv30_context *nv30)
|
||||
float *map = NULL;
|
||||
|
||||
if (constbuf) {
|
||||
map = ws->buffer_map(ws, constbuf,
|
||||
PIPE_BUFFER_USAGE_CPU_READ);
|
||||
map = pipe_buffer_map(pscreen, constbuf,
|
||||
PIPE_BUFFER_USAGE_CPU_READ);
|
||||
}
|
||||
|
||||
for (i = 0; i < vp->nr_consts; i++) {
|
||||
@@ -771,9 +772,8 @@ nv30_vertprog_validate(struct nv30_context *nv30)
|
||||
OUT_RINGp ((uint32_t *)vpd->value, 4);
|
||||
}
|
||||
|
||||
if (constbuf) {
|
||||
ws->buffer_unmap(ws, constbuf);
|
||||
}
|
||||
if (constbuf)
|
||||
pipe_buffer_unmap(pscreen, constbuf);
|
||||
}
|
||||
|
||||
/* Upload vtxprog */
|
||||
@@ -804,8 +804,6 @@ nv30_vertprog_validate(struct nv30_context *nv30)
|
||||
void
|
||||
nv30_vertprog_destroy(struct nv30_context *nv30, struct nv30_vertex_program *vp)
|
||||
{
|
||||
struct nouveau_winsys *nvws = nv30->screen->nvws;
|
||||
|
||||
vp->translated = FALSE;
|
||||
|
||||
if (vp->nr_insns) {
|
||||
@@ -820,9 +818,9 @@ nv30_vertprog_destroy(struct nv30_context *nv30, struct nv30_vertex_program *vp)
|
||||
vp->nr_consts = 0;
|
||||
}
|
||||
|
||||
nvws->res_free(&vp->exec);
|
||||
nouveau_resource_free(&vp->exec);
|
||||
vp->exec_start = 0;
|
||||
nvws->res_free(&vp->data);
|
||||
nouveau_resource_free(&vp->data);
|
||||
vp->data_start = 0;
|
||||
vp->data_start_min = 0;
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#include "pipe/p_shader_tokens.h"
|
||||
#include "pipe/p_inlines.h"
|
||||
|
||||
#include "util/u_pack_color.h"
|
||||
|
||||
@@ -81,7 +82,7 @@ nv40_render_prim(struct draw_stage *stage, struct prim_header *prim,
|
||||
{
|
||||
struct nv40_render_stage *rs = nv40_render_stage(stage);
|
||||
struct nv40_context *nv40 = rs->nv40;
|
||||
struct nouveau_pushbuf *pb = nv40->nvws->channel->pushbuf;
|
||||
struct nouveau_pushbuf *pb = nv40->screen->base.channel->pushbuf;
|
||||
unsigned i;
|
||||
|
||||
/* Ensure there's room for 4xfloat32 + potentially 3 begin/end */
|
||||
@@ -231,7 +232,7 @@ nv40_draw_elements_swtnl(struct pipe_context *pipe,
|
||||
unsigned mode, unsigned start, unsigned count)
|
||||
{
|
||||
struct nv40_context *nv40 = nv40_context(pipe);
|
||||
struct pipe_winsys *ws = pipe->winsys;
|
||||
struct pipe_screen *pscreen = pipe->screen;
|
||||
unsigned i;
|
||||
void *map;
|
||||
|
||||
@@ -241,13 +242,14 @@ nv40_draw_elements_swtnl(struct pipe_context *pipe,
|
||||
nv40_state_emit(nv40);
|
||||
|
||||
for (i = 0; i < nv40->vtxbuf_nr; i++) {
|
||||
map = ws->buffer_map(ws, nv40->vtxbuf[i].buffer,
|
||||
map = pipe_buffer_map(pscreen, nv40->vtxbuf[i].buffer,
|
||||
PIPE_BUFFER_USAGE_CPU_READ);
|
||||
draw_set_mapped_vertex_buffer(nv40->draw, i, map);
|
||||
}
|
||||
|
||||
if (idxbuf) {
|
||||
map = ws->buffer_map(ws, idxbuf, PIPE_BUFFER_USAGE_CPU_READ);
|
||||
map = pipe_buffer_map(pscreen, idxbuf,
|
||||
PIPE_BUFFER_USAGE_CPU_READ);
|
||||
draw_set_mapped_element_buffer(nv40->draw, idxbuf_size, map);
|
||||
} else {
|
||||
draw_set_mapped_element_buffer(nv40->draw, 0, NULL);
|
||||
@@ -256,21 +258,22 @@ nv40_draw_elements_swtnl(struct pipe_context *pipe,
|
||||
if (nv40->constbuf[PIPE_SHADER_VERTEX]) {
|
||||
const unsigned nr = nv40->constbuf_nr[PIPE_SHADER_VERTEX];
|
||||
|
||||
map = ws->buffer_map(ws, nv40->constbuf[PIPE_SHADER_VERTEX],
|
||||
PIPE_BUFFER_USAGE_CPU_READ);
|
||||
map = pipe_buffer_map(pscreen,
|
||||
nv40->constbuf[PIPE_SHADER_VERTEX],
|
||||
PIPE_BUFFER_USAGE_CPU_READ);
|
||||
draw_set_mapped_constant_buffer(nv40->draw, map, nr);
|
||||
}
|
||||
|
||||
draw_arrays(nv40->draw, mode, start, count);
|
||||
|
||||
for (i = 0; i < nv40->vtxbuf_nr; i++)
|
||||
ws->buffer_unmap(ws, nv40->vtxbuf[i].buffer);
|
||||
pipe_buffer_unmap(pscreen, nv40->vtxbuf[i].buffer);
|
||||
|
||||
if (idxbuf)
|
||||
ws->buffer_unmap(ws, idxbuf);
|
||||
pipe_buffer_unmap(pscreen, idxbuf);
|
||||
|
||||
if (nv40->constbuf[PIPE_SHADER_VERTEX])
|
||||
ws->buffer_unmap(ws, nv40->constbuf[PIPE_SHADER_VERTEX]);
|
||||
pipe_buffer_unmap(pscreen, nv40->constbuf[PIPE_SHADER_VERTEX]);
|
||||
|
||||
draw_flush(nv40->draw);
|
||||
pipe->flush(pipe, 0, NULL);
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user