Merge branch 'mesa_7_0_branch' of git+ssh://brianp@git.freedesktop.org/git/mesa/mesa into mesa_7_0_branch

This commit is contained in:
Brian 2007-08-07 08:21:50 +01:00
commit 2f57e0f71d
70 changed files with 1103 additions and 256 deletions

View file

@ -1,5 +1,7 @@
# Top-level Mesa makefile
SHELL = /bin/bash
TOP = .
SUBDIRS = src progs
@ -67,6 +69,7 @@ aix-64-static \
aix-gcc \
aix-static \
beos \
bluegene-osmesa \
darwin \
darwin-static \
darwin-static-x86ppc \
@ -151,6 +154,7 @@ sunos5-v8 \
sunos5-v8-static \
sunos5-v9 \
sunos5-v9-static \
sunos5-v9-cc-g++ \
ultrix-gcc:
@ if [ -e configs/current ] ; then \
echo "Please run 'make realclean' before changing configs" ; \
@ -288,17 +292,6 @@ MAIN_FILES = \
$(DIRECTORY)/vms/analyze_map.com \
$(DIRECTORY)/vms/xlib.opt \
$(DIRECTORY)/vms/xlib_share.opt \
$(DIRECTORY)/windows/VC6/mesa/gdi/gdi.dsp \
$(DIRECTORY)/windows/VC6/mesa/glu/*.txt \
$(DIRECTORY)/windows/VC6/mesa/glu/glu.dsp \
$(DIRECTORY)/windows/VC6/mesa/mesa.dsw \
$(DIRECTORY)/windows/VC6/mesa/mesa/mesa.dsp \
$(DIRECTORY)/windows/VC6/mesa/osmesa/osmesa.dsp \
$(DIRECTORY)/windows/VC7/mesa/gdi/gdi.vcproj \
$(DIRECTORY)/windows/VC7/mesa/glu/glu.vcproj \
$(DIRECTORY)/windows/VC7/mesa/mesa.sln \
$(DIRECTORY)/windows/VC7/mesa/mesa/mesa.vcproj \
$(DIRECTORY)/windows/VC7/mesa/osmesa/osmesa.vcproj \
$(DIRECTORY)/windows/VC8/mesa/mesa.sln \
$(DIRECTORY)/windows/VC8/mesa/gdi/gdi.vcproj \
$(DIRECTORY)/windows/VC8/mesa/glu/glu.vcproj \
@ -328,6 +321,7 @@ SGI_GLU_FILES = \
$(DIRECTORY)/src/glu/Makefile \
$(DIRECTORY)/src/glu/descrip.mms \
$(DIRECTORY)/src/glu/sgi/Makefile \
$(DIRECTORY)/src/glu/sgi/Makefile.mgw \
$(DIRECTORY)/src/glu/sgi/Makefile.win \
$(DIRECTORY)/src/glu/sgi/Makefile.DJ \
$(DIRECTORY)/src/glu/sgi/glu.def \

View file

@ -53,11 +53,13 @@
# MinGW core makefile updated for Mesa 7.0
#
# updated : by Heromyth, 2007-6-25
# Updated : by Heromyth, on 2007-7-21
# Email : zxpmyth@yahoo.com.cn
# Bug : All the default settings work fine. But the setting X86=1 can't work.
# Bugs : 1) All the default settings work fine. But the setting X86=1 can't work.
# The others havn't been tested yet.
# 2) The generated DLLs are *not* compatible with the ones built
# with the other compilers like VC8, especially for GLUT.
# 3) MAlthough more tests are needed, it can be used individually!
.PHONY : all libgl clean realclean
@ -73,13 +75,14 @@ CFLAGS += -O2 -ffast-math
export CFLAGS
ifeq ($(wildcard $(addsuffix /rm.exe,$(subst ;, ,$(PATH)))),)
UNLINK = del $(subst /,\,$(1))
else
UNLINK = $(RM) $(1)
endif
all: libgl libglu libglut
all: libgl libglu libglut example
libgl: lib
$(MAKE) -f Makefile.mgw -C src/mesa

29
configs/bluegene-osmesa Normal file
View file

@ -0,0 +1,29 @@
# Configuration for building only libOSMesa on BlueGene, no Xlib driver
# This doesn't really have a lot of dependencies, so it should be usable
# on other (gcc-based) systems too.
# It uses static linking and disables multithreading.
include $(TOP)/configs/default
CONFIG_NAME = bluegene-osmesa
# Compiler and flags
CC = /bgl/BlueLight/ppcfloor/blrts-gnu/bin/powerpc-bgl-blrts-gnu-gcc
CXX = /bgl/BlueLight/ppcfloor/blrts-gnu/bin/powerpc-bgl-blrts-gnu-g++
CFLAGS = -O3 -ansi -pedantic -fPIC -ffast-math -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_SVID_SOURCE -D_BSD_SOURCE
CXXFLAGS = -O3 -ansi -pedantic -fPIC -ffast-math -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_SVID_SOURCE -D_BSD_SOURC
MKLIB_OPTIONS = -static
OSMESA_LIB_NAME = libOSMesa.a
# Directories
SRC_DIRS = mesa glu
DRIVER_DIRS = osmesa
PROGRAM_DIRS = osdemos
# Dependencies
OSMESA_LIB_DEPS = -lm
GLU_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(OSMESA_LIB)
APP_LIB_DEPS = -lOSMesa -lGLU -lm

View file

@ -13,7 +13,7 @@ OPT_FLAGS = -O2
PIC_FLAGS = -fPIC
DEFINES = -D_POSIX_SOURCE -D_POSIX_C_SOURCE=199309L -D_BSD_SOURCE -DUSE_XSHM \
-DHZ=100 -DHAVE_POSIX_MEMALIGN
-DHZ=100
X11_INCLUDES = -I/usr/X11R6/include

View file

@ -15,7 +15,7 @@ EXPAT_INCLUDES = -I/usr/local/include
X11_INCLUDES = -I/usr/X11R6/include
DEFINES = -DPTHREADS -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER \
-DGLX_DIRECT_RENDERING -DGLX_INDIRECT_RENDERING \
-DHAVE_ALIAS -DHAVE_POSIX_MEMALIGN
-DHAVE_ALIAS
CFLAGS = $(WARN_FLAGS) $(OPT_FLAGS) $(PIC_FLAGS) -Wmissing-prototypes -std=c99 -Wundef -ffast-math \
$(ASM_FLAGS) $(X11_INCLUDES) $(DEFINES)

32
configs/sunos5-v9-cc-g++ Normal file
View file

@ -0,0 +1,32 @@
# Configuration for SunOS 5, SPARC V9 and cc/g++ (for C and C++ sources)
include $(TOP)/configs/default
CONFIG_NAME = sunos5-v9-cc-g++
MKLIB_OPTIONS = -cplusplus
LIB_DIR = lib64
# Compiler and flags
CC = cc
CXX = g++
CXX_WARN_FLAGS = -Wall
CXX_PIC_FLAGS = -fPIC
CXX_OPT_FLAGS = -O3 -m64 -mcpu=ultrasparc -mv8plus -mvis -g -fomit-frame-pointer -pipe
CXX_ARCH_FLAGS = -m64
CXXFLAGS = $(CXX_WARN_FLAGS) $(CXX_OPT_FLAGS) $(CXX_PIC_FLAGS) $(CXX_ARCH_FLAGS) $(DEFINES) \
-I/usr/openwin/include
CFLAGS = -xarch=v9 -KPIC -O -I/usr/openwin/include -I/usr/dt/include -DUSE_XSHM -DPTHREADS
#CXXFLAGS = -xarch=v9 -KPIC -O -I/usr/openwin/include -I/usr/dt/include -DPTHREADS
GLUT_CFLAGS = -DSOLARIS_2_4_BUG
GL_LIB_DEPS = -L/usr/openwin/lib -L/usr/dt/lib -lX11 -lXext -lXmu -lXi -lm -lpthread
GLU_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GL_LIB) -lm -lCstd -lCrun
GLUT_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GLU_LIB) -l$(GL_LIB) -lm
GLW_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -l$(GL_LIB) -L/usr/openwin/lib -lXt -lX11
APP_LIB_DEPS = -L$(TOP)/$(LIB_DIR) -lX11 -l$(GLUT_LIB) -l$(GLU_LIB) -l$(GL_LIB) -lm

View file

@ -88,3 +88,66 @@ Running the Build:
Paul G. <pgarceau@users.sourceforge.net>
Daniel Borca <dborca@users.sourceforge.net>
******This section is added by Heromyth <zxpmyth@yahoo.com.cn>*************
====================
Updated on 2007-7-21
====================
Notice:
1) The generated DLLs are *not* compatible with the ones built
with the other compilers like VC8, especially for GLUT.
2) Although more tests are needed, it can be used individually!
3) You can set the options about whether using STDCALL to build MESA. The
config file is <Mesa3D-root>\configs\config.mgw. The default setting is that:
ALL_USING_STDCALL = 1
, which means using STDCALL to build MESA.
4) Of course, you can MESA without using STDCALL,I like this:)
The setting is :
ALL_USING_STDCALL = 0
To do this, however, you must modify wingdi.h which is in MingW's include dir.
For example, run:
notepad C:\MingW\include\wingdi.h
, and delete all the lines where all the wgl*() functions are. Because they would
be conflicted with the ones in <Mesa3D-root>\include\GL\mesa_wgl.h.
>>>>>>>>>> Conflicted Functions List >>>>>>>>>>
WINGDIAPI BOOL WINAPI wglCopyContext(HGLRC,HGLRC,UINT);
WINGDIAPI HGLRC WINAPI wglCreateContext(HDC);
WINGDIAPI HGLRC WINAPI wglCreateLayerContext(HDC,int);
WINGDIAPI BOOL WINAPI wglDeleteContext(HGLRC);
WINGDIAPI BOOL WINAPI wglDescribeLayerPlane(HDC,int,int,UINT,LPLAYERPLANEDESCRIPTOR);
WINGDIAPI HGLRC WINAPI wglGetCurrentContext(void);
WINGDIAPI HDC WINAPI wglGetCurrentDC(void);
WINGDIAPI int WINAPI wglGetLayerPaletteEntries(HDC,int,int,int,COLORREF*);
WINGDIAPI PROC WINAPI wglGetProcAddress(LPCSTR);
WINGDIAPI BOOL WINAPI wglMakeCurrent(HDC,HGLRC);
WINGDIAPI BOOL WINAPI wglRealizeLayerPalette(HDC,int,BOOL);
WINGDIAPI int WINAPI wglSetLayerPaletteEntries(HDC,int,int,int,const COLORREF*);
WINGDIAPI BOOL WINAPI wglShareLists(HGLRC,HGLRC);
WINGDIAPI BOOL WINAPI wglSwapLayerBuffers(HDC,UINT);
WINGDIAPI BOOL WINAPI wglUseFontBitmapsA(HDC,DWORD,DWORD,DWORD);
WINGDIAPI BOOL WINAPI wglUseFontBitmapsW(HDC,DWORD,DWORD,DWORD);
WINGDIAPI BOOL WINAPI wglUseFontOutlinesA(HDC,DWORD,DWORD,DWORD,FLOAT,FLOAT,int,LPGLYPHMETRICSFLOAT);
WINGDIAPI BOOL WINAPI wglUseFontOutlinesW(HDC,DWORD,DWORD,DWORD,FLOAT,FLOAT,int,LPGLYPHMETRICSFLOAT);
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
====================
Updated on 2007-7-22
====================
I havn't thought that I would find a better way to solve my problems so soon.
I changed the method in which the import-libs and DLLs are made. After this update,
the DLLs of MESA are more optimized and more compatible.
It seems that there is no need to keep the building way of 'NO-STDCALL'.The
way of USING_STDCALL is so nice! The file <Mesa3D-root>\configs\config.mgw is
also not needed, and can be deleted safely!
*********************************************************************************

View file

@ -9,7 +9,7 @@
<H1>Downloading</H1>
<p>
Last stable release: <b>7.0</b>
Last stable release: <b>7.0.1</b>
</p>
<p>

View file

@ -11,6 +11,13 @@
<H1>News</H1>
<h2>August 3, 2007</h2>
<p>
<a href="relnotes-7.0.html">Mesa 7.0.1</a> is released.
This is a bug-fix release.
</p>
<h2>June 22, 2007</h2>
<p>
<a href="relnotes-7.0.html">Mesa 7.0</a> is released.

View file

@ -8,7 +8,7 @@
<body bgcolor="#eeeeee">
<H1>Mesa 7.0.1 Release Notes / (date), 2007</H1>
<H1>Mesa 7.0.1 Release Notes / August 3, 2007</H1>
<p>
Mesa 7.0.1 is a stable release with bug fixes since version 7.0.
@ -17,11 +17,21 @@ Mesa 7.0.1 is a stable release with bug fixes since version 7.0.
<h2>MD5 checksums</h2>
<pre>
db55141a44b902fcc61d9265b7862c06 MesaLib-7.0.1.tar.gz
c056abd763e899114bf745c9eedbf9ad MesaLib-7.0.1.tar.bz2
ecc2637547fae2b38271ae362d013afa MesaLib-7.0.1.zip
b85a4a5be4e829f4a1165e4514b13183 MesaDemos-7.0.1.tar.gz
3b66b3268df12ca8a6c4e0c4c457912c MesaDemos-7.0.1.tar.bz2
b1c18006f16e44e80fea66774c59b391 MesaDemos-7.0.1.zip
b87a69986839ae43ce12fc8e3dc1ebb4 MesaGLUT-7.0.1.tar.gz
25f30d0c1651997b4412366ba0572f7f MesaGLUT-7.0.1.tar.bz2
676ee6682a6ce78a5540554fd975c03e MesaGLUT-7.0.1.zip
</pre>
<h2>New features</h2>
<ul>
<li>Added a bluegene-osmesa build config
</ul>
<h2>Bug fixes</h2>
@ -41,14 +51,22 @@ Mesa 7.0.1 is a stable release with bug fixes since version 7.0.
<li>Stencil pixel map didn't always work for glDrawPixels (bug 11475)
<li>Fixed polygon stipple bug in i915 driver
<li>Binding a zero-sized texture didn't disable texturing (bug 11309)
<li>Queries of GL_INFO_LOG_LENGTH, GL_SHADER_SOURCE_LENGTH didn't include
the terminating zero (bug 11588)
<li>glXChooseFBConfig() in Xlib driver didn't handle GLX_STEREO flag properly
<li>Fixed a GLSL function call bug (#11731)
<li>glPointParameteriv(GL_DISTANCE_ATTENUATION_EXT) didn't work (bug 11754)
<li>glGetAttribLocation() always returned 1 (bug 11774)
<li>Fixed a few memory-related bugs in GLU library
</ul>
<h2>Change</h2>
<h2>Changes</h2>
<ul>
<li>The libOSMesa library version has been reverted to 6.5.3 (soname=6)
in order to avoid application linking issues. Otherwise, applications
previously linked with libOSMesa.so.6 would no longer link with libOSMesa.so.7
<li>Dropped obsolete, unmaintained Windows project files for VC6 and VC7.
</ul>

View file

@ -84,7 +84,8 @@
#include <windows.h>
#endif
#if defined(_WIN32) && !defined(_WINGDI_) && !defined(_GNU_H_WINDOWS32_DEFINES) && !defined(OPENSTEP) && !defined(__CYGWIN__)
#if defined(_WIN32) && !defined(_WINGDI_) && !defined(_GNU_H_WINDOWS32_DEFINES) \
&& !defined(OPENSTEP) && !defined(__CYGWIN__) || defined(__MINGW32__)
#include <GL/mesa_wgl.h>
#endif
@ -2161,11 +2162,11 @@ typedef void (APIENTRYP PFNGLMULTITEXCOORD4SVARBPROC) (GLenum target, const GLsh
#define GL_DEBUG_PRINT_MESA 0x875A
#define GL_DEBUG_ASSERT_MESA 0x875B
GLAPI GLhandleARB APIENTRY glCreateDebugObjectMESA (void);
GLAPI void APIENTRY glClearDebugLogMESA (GLhandleARB obj, GLenum logType, GLenum shaderType);
GLAPI void APIENTRY glGetDebugLogMESA (GLhandleARB obj, GLenum logType, GLenum shaderType, GLsizei maxLength,
GLAPI GLhandleARB GLAPIENTRY glCreateDebugObjectMESA (void);
GLAPI void GLAPIENTRY glClearDebugLogMESA (GLhandleARB obj, GLenum logType, GLenum shaderType);
GLAPI void GLAPIENTRY glGetDebugLogMESA (GLhandleARB obj, GLenum logType, GLenum shaderType, GLsizei maxLength,
GLsizei *length, GLcharARB *debugLog);
GLAPI GLsizei APIENTRY glGetDebugLogLengthMESA (GLhandleARB obj, GLenum logType, GLenum shaderType);
GLAPI GLsizei GLAPIENTRY glGetDebugLogLengthMESA (GLhandleARB obj, GLenum logType, GLenum shaderType);
#endif /* GL_MESA_shader_debug */

View file

@ -10,6 +10,10 @@
#include <GL/gl.h>
#include <GL/glu.h>
#if defined(__MINGW32__)
#include <GL/mesa_wgl.h>
#endif
#ifdef __cplusplus
extern "C" {
#endif
@ -130,8 +134,9 @@ extern _CRTIMP void __cdecl exit(int);
# pragma message( "----: being multiply defined you should include WINDOWS.H priot to gl/glut.h" )
# endif
# define CALLBACK __stdcall
typedef int (GLUTAPIENTRY *PROC)();
#if !defined(__MINGW32__)
typedef int (GLUTAPIENTRY *PROC)();
typedef void *HGLRC;
typedef void *HDC;
#endif

View file

@ -361,6 +361,18 @@ struct __DRIscreenRec {
void * (*createNewContext)(__DRInativeDisplay *dpy, const __GLcontextModes *modes,
int render_type,
void *sharedPrivate, __DRIcontext *pctx);
/**
* Method to override base texture image with a driver specific 'offset'.
* The depth passed in allows e.g. to ignore the alpha channel of texture
* images where the non-alpha components don't occupy a whole texel.
*
* For GLX_EXT_texture_from_pixmap with AIGLX.
*
* \since Internal API version 20070121.
*/
void (*setTexOffset)(__DRIcontext *pDRICtx, GLint texname,
unsigned long long offset, GLint depth, GLuint pitch);
};
/**

View file

@ -26,11 +26,12 @@
/* prototypes for the Mesa WGL functions */
/* relocated here so that I could make GLUT get them properly */
#define _mesa_wgl_h_
#ifndef _mesa_wgl_h_
#define _mesa_wgl_h_
#if defined(__MINGW32__)
# define __W32API_USE_DLLIMPORT__
#endif
#include <GL/gl.h>
@ -39,23 +40,16 @@ extern "C" {
#endif
#if !defined(OPENSTEP) && (defined(__WIN32__) || defined(__CYGWIN32__))
# if (defined(_MSC_VER) || defined(__MINGW32__)) && defined(BUILD_GL32) /* tag specify we're building mesa as a DLL */
# define GLAPI __declspec(dllexport)
# define WGLAPI __declspec(dllexport)
# elif (defined(_MSC_VER) || defined(__MINGW32__)) && defined(_DLL) /* tag specifying we're building for DLL runtime support */
# define GLAPI __declspec(dllimport)
# define WGLAPI __declspec(dllimport)
# else /* for use with static link lib build of Win32 edition only */
# define GLAPI extern
# define WGLAPI __declspec(dllimport)
# endif /* _STATIC_MESA support */
# define GLAPIENTRY __stdcall
#else
/* non-Windows compilation */
# define GLAPI extern
# define GLAPIENTRY
#endif /* WIN32 / CYGWIN32 bracket */
#ifndef WGLAPI
#define WGLAPI GLAPI
#endif
#if defined(__MINGW32__)
# ifndef WIN32_LEAN_AND_MEAN
# define WIN32_LEAN_AND_MEAN 1
# endif
# include <windows.h>
#endif
#if defined(_WIN32) && !defined(_WINGDI_) && !defined(_GNU_H_WINDOWS32_DEFINES) && !defined(OPENSTEP)
@ -80,23 +74,23 @@ typedef struct tagPIXELFORMATDESCRIPTOR PIXELFORMATDESCRIPTOR, *PPIXELFORMATDESC
# pragma warning( disable : 4273 ) /* 'function' : inconsistent DLL linkage. dllexport assumed. */
#endif
WGLAPI int GLAPIENTRY wglDeleteContext(HGLRC);
WGLAPI int GLAPIENTRY wglMakeCurrent(HDC,HGLRC);
WGLAPI int GLAPIENTRY wglSetPixelFormat(HDC, int, const PIXELFORMATDESCRIPTOR *);
WGLAPI int GLAPIENTRY wglSwapBuffers(HDC hdc);
WGLAPI HDC GLAPIENTRY wglGetCurrentDC(void);
WGLAPI int GLAPIENTRY wglChoosePixelFormat(HDC, const PIXELFORMATDESCRIPTOR *);
WGLAPI int GLAPIENTRY wglDescribePixelFormat(HDC,int, unsigned int, LPPIXELFORMATDESCRIPTOR);
WGLAPI int GLAPIENTRY wglGetPixelFormat(HDC hdc);
WGLAPI int GLAPIENTRY wglCopyContext(HGLRC, HGLRC, unsigned int);
WGLAPI HGLRC GLAPIENTRY wglCreateContext(HDC);
WGLAPI HGLRC GLAPIENTRY wglCreateLayerContext(HDC,int);
WGLAPI HGLRC GLAPIENTRY wglGetCurrentContext(void);
WGLAPI PROC GLAPIENTRY wglGetProcAddress(const char*);
WGLAPI int GLAPIENTRY wglChoosePixelFormat(HDC, const PIXELFORMATDESCRIPTOR *);
WGLAPI int GLAPIENTRY wglCopyContext(HGLRC, HGLRC, unsigned int);
WGLAPI int GLAPIENTRY wglDeleteContext(HGLRC);
WGLAPI int GLAPIENTRY wglDescribeLayerPlane(HDC, int, int, unsigned int,LPLAYERPLANEDESCRIPTOR);
WGLAPI int GLAPIENTRY wglDescribePixelFormat(HDC,int, unsigned int, LPPIXELFORMATDESCRIPTOR);
WGLAPI HGLRC GLAPIENTRY wglGetCurrentContext(void);
WGLAPI HDC GLAPIENTRY wglGetCurrentDC(void);
WGLAPI int GLAPIENTRY wglGetLayerPaletteEntries(HDC, int, int, int,COLORREF *);
WGLAPI int GLAPIENTRY wglGetPixelFormat(HDC hdc);
WGLAPI int GLAPIENTRY wglMakeCurrent(HDC, HGLRC);
WGLAPI PROC GLAPIENTRY wglGetProcAddress(const char*);
WGLAPI int GLAPIENTRY wglMakeCurrent(HDC,HGLRC);
WGLAPI int GLAPIENTRY wglRealizeLayerPalette(HDC, int, int);
WGLAPI int GLAPIENTRY wglSetLayerPaletteEntries(HDC, int, int, int,const COLORREF *);
WGLAPI int GLAPIENTRY wglShareLists(HGLRC, HGLRC);
@ -105,12 +99,14 @@ WGLAPI int GLAPIENTRY wglUseFontBitmapsA(HDC, unsigned long, unsigned long, un
WGLAPI int GLAPIENTRY wglUseFontBitmapsW(HDC, unsigned long, unsigned long, unsigned long);
WGLAPI int GLAPIENTRY wglUseFontOutlinesA(HDC, unsigned long, unsigned long, unsigned long, float,float, int, LPGLYPHMETRICSFLOAT);
WGLAPI int GLAPIENTRY wglUseFontOutlinesW(HDC, unsigned long, unsigned long, unsigned long, float,float, int, LPGLYPHMETRICSFLOAT);
#ifndef __MINGW32__
WGLAPI int GLAPIENTRY SwapBuffers(HDC);
WGLAPI int GLAPIENTRY ChoosePixelFormat(HDC,const PIXELFORMATDESCRIPTOR *);
WGLAPI int GLAPIENTRY DescribePixelFormat(HDC,int,unsigned int,LPPIXELFORMATDESCRIPTOR);
WGLAPI int GLAPIENTRY GetPixelFormat(HDC);
WGLAPI int GLAPIENTRY SetPixelFormat(HDC,int,const PIXELFORMATDESCRIPTOR *);
#endif
#ifndef WGL_ARB_extensions_string
#define WGL_ARB_extensions_string 1

View file

@ -409,6 +409,8 @@ test(GLenum type, GLint bits, const char *filename)
printf("Rendering %d bit/channel image: %s\n", bits, filename);
OSMesaColorClamp(GL_TRUE);
init_context();
render_image();
if (Gradient)
@ -421,7 +423,7 @@ test(GLenum type, GLint bits, const char *filename)
if (WriteFiles && filename != NULL) {
if (type == GL_UNSIGNED_SHORT) {
GLushort *buffer16 = (GLushort *) buffer;
GLubyte *buffer8 = malloc(WIDTH * HEIGHT * 4);
GLubyte *buffer8 = (GLubyte *) malloc(WIDTH * HEIGHT * 4);
int i;
for (i = 0; i < WIDTH * HEIGHT * 4; i++)
buffer8[i] = buffer16[i] >> 8;
@ -430,8 +432,9 @@ test(GLenum type, GLint bits, const char *filename)
}
else if (type == GL_FLOAT) {
GLfloat *buffer32 = (GLfloat *) buffer;
GLubyte *buffer8 = malloc(WIDTH * HEIGHT * 4);
GLubyte *buffer8 = (GLubyte *) malloc(WIDTH * HEIGHT * 4);
int i;
/* colors may be outside [0,1] so we need to clamp */
for (i = 0; i < WIDTH * HEIGHT * 4; i++)
buffer8[i] = (GLubyte) (buffer32[i] * 255.0);
write_ppm(filename, buffer8, WIDTH, HEIGHT);

View file

@ -26,6 +26,15 @@
# Email : dborca@users.sourceforge.net
# Web : http://www.geocities.com/dborca
# MinGW samples makefile updated for Mesa 7.0
#
# Updated : by Heromyth, on 2007-7-21
# Email : zxpmyth@yahoo.com.cn
# Bugs : 1) All the default settings work fine. But the setting X86=1 can't work.
# The others havn't been tested yet.
# 2) The generated DLLs are *not* compatible with the ones built
# with the other compilers like VC8, especially for GLUT.
# 3) Although more tests are needed, it can be used individually!
#
# Available options:
@ -45,14 +54,14 @@
TOP = ../..
CC = mingw32-gcc
CFLAGS = -Wall -W -pedantic
CFLAGS += -O2 -ffast-math
CFLAGS = -Wall -pedantic
CFLAGS += -O2 -ffast-math -D_DLL
CFLAGS += -I$(TOP)/include -I../util
ifeq ($(FX),1)
CFLAGS += -DFX
CFLAGS += -DFX
endif
CFLAGS += -DGLUT_DISABLE_ATEXIT_HACK -D_STDCALL_SUPPORTED
CFLAGS += -D_WINDEF_ -D_WINGDI_
CFLAGS += -DGLUT_DISABLE_ATEXIT_HACK
LD = mingw32-g++
LDFLAGS = -s -L$(TOP)/lib
@ -62,7 +71,8 @@ LDLIBS = -lglut32 -lglu32 -lopengl32
.c.o:
$(CC) -o $@ $(CFLAGS) -c $<
%.exe: ../util/readtex.o ../util/showbuffer.o %.o
$(LD) -o $@ $(LDFLAGS) $^ $(LDLIBS)
$(LD) -o $@ $(LDFLAGS) $(LDLIBS) $^
all:
$(error Must specify <filename.exe> to build)

View file

@ -93,7 +93,7 @@ MakePbuffer( Display *dpy, int screen, int width, int height )
None
},
{
/* Single bufferd, without depth buffer */
/* Single buffered, without depth buffer */
GLX_RENDER_TYPE, GLX_RGBA_BIT,
GLX_DRAWABLE_TYPE, GLX_PBUFFER_BIT,
GLX_RED_SIZE, 1,
@ -105,7 +105,7 @@ MakePbuffer( Display *dpy, int screen, int width, int height )
None
},
{
/* Double bufferd, without depth buffer */
/* Double buffered, without depth buffer */
GLX_RENDER_TYPE, GLX_RGBA_BIT,
GLX_DRAWABLE_TYPE, GLX_PBUFFER_BIT,
GLX_RED_SIZE, 1,
@ -130,9 +130,8 @@ MakePbuffer( Display *dpy, int screen, int width, int height )
/* Get list of possible frame buffer configurations */
fbConfigs = ChooseFBConfig(dpy, screen, fbAttribs[attempt], &nConfigs);
if (nConfigs==0 || !fbConfigs) {
printf("Error: glXChooseFBConfig failed\n");
XCloseDisplay(dpy);
return 0;
printf("Note: glXChooseFBConfig(%s) failed\n", fbString[attempt]);
continue;
}
#if 0 /*DEBUG*/

230
src/glu/sgi/Makefile.mgw Normal file
View file

@ -0,0 +1,230 @@
# Mesa 3-D graphics library
# Version: 5.1
#
# Copyright (C) 1999-2003 Brian Paul All Rights Reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# the rights to use, copy, modify, merge, publish, distribute, sublicense,
# 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 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 NONINFRINGEMENT. IN NO EVENT SHALL
# BRIAN PAUL 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.
# MinGW core makefile v1.4 for Mesa
#
# Copyright (C) 2002 - Daniel Borca
# Email : dborca@users.sourceforge.net
# Web : http://www.geocities.com/dborca
# MinGW core-glu makefile updated for Mesa 7.0
#
# Updated : by Heromyth, on 2007-7-21
# Email : zxpmyth@yahoo.com.cn
# Bugs : 1) All the default settings work fine. But the setting X86=1 can't work.
# The others havn't been tested yet.
# 2) The generated DLLs are *not* compatible with the ones built
# with the other compilers like VC8, especially for GLUT.
# 3) Although more tests are needed, it can be used individually!
#
# Available options:
#
# Environment variables:
# CFLAGS
#
# GLIDE path to Glide3 SDK; used with FX.
# default = $(TOP)/glide3
# FX=1 build for 3dfx Glide3. Note that this disables
# compilation of most WMesa code and requires fxMesa.
# As a consequence, you'll need the Win32 Glide3
# library to build any application.
# default = no
# ICD=1 build the installable client driver interface
# (windows opengl driver interface)
# default = no
# X86=1 optimize for x86 (if possible, use MMX, SSE, 3DNow).
# default = no
#
# Targets:
# all: build GL
# clean: remove object files
#
.PHONY: all clean
.INTERMEDIATE: x86/gen_matypes.exe
.SUFFIXES: .rc .res
# Set this to the prefix of your build tools, i.e. mingw32-
TOOLS_PREFIX = mingw32-
TOP = ../../..
LIBDIR = $(TOP)/lib
LIB_NAME = glu32
DLL_EXT = .dll
IMP_EXT = .a
LIB_PRE = lib
STRIP = -s
AR = ar
ARFLAGS = crus
DLLTOOL = dlltool
GLU_DLL = $(LIB_NAME)$(DLL_EXT)
GLU_IMP = $(LIB_PRE)$(LIB_NAME)$(IMP_EXT)
GLU_DEF = $(LIB_NAME).def
LDLIBS = -L$(LIBDIR) -lopengl32
LDFLAGS = $(STRIP) -shared -fPIC -Wl,--kill-at
CFLAGS += -DBUILD_GLU32 -D_DLL
CC = $(TOOLS_PREFIX)gcc
CFLAGS += -DNDEBUG -DLIBRARYBUILD -I$(TOP)/include -Iinclude
CXX = $(TOOLS_PREFIX)g++
CXXFLAGS = $(CFLAGS) -Ilibnurbs/internals -Ilibnurbs/interface -Ilibnurbs/nurbtess
AR = ar
ARFLAGS = crus
UNLINK = del $(subst /,\,$(1))
ifneq ($(wildcard $(addsuffix /rm.exe,$(subst ;, ,$(PATH)))),)
UNLINK = $(RM) $(1)
endif
ifneq ($(wildcard $(addsuffix /rm,$(subst :, ,$(PATH)))),)
UNLINK = $(RM) $(1)
endif
C_SOURCES = \
libutil/error.c \
libutil/glue.c \
libutil/mipmap.c \
libutil/project.c \
libutil/quad.c \
libutil/registry.c \
libtess/dict.c \
libtess/geom.c \
libtess/memalloc.c \
libtess/mesh.c \
libtess/normal.c \
libtess/priorityq.c \
libtess/render.c \
libtess/sweep.c \
libtess/tess.c \
libtess/tessmono.c
CC_SOURCES = \
libnurbs/interface/bezierEval.cc \
libnurbs/interface/bezierPatch.cc \
libnurbs/interface/bezierPatchMesh.cc \
libnurbs/interface/glcurveval.cc \
libnurbs/interface/glinterface.cc \
libnurbs/interface/glrenderer.cc \
libnurbs/interface/glsurfeval.cc \
libnurbs/interface/incurveeval.cc \
libnurbs/interface/insurfeval.cc \
libnurbs/internals/arc.cc \
libnurbs/internals/arcsorter.cc \
libnurbs/internals/arctess.cc \
libnurbs/internals/backend.cc \
libnurbs/internals/basiccrveval.cc \
libnurbs/internals/basicsurfeval.cc \
libnurbs/internals/bin.cc \
libnurbs/internals/bufpool.cc \
libnurbs/internals/cachingeval.cc \
libnurbs/internals/ccw.cc \
libnurbs/internals/coveandtiler.cc \
libnurbs/internals/curve.cc \
libnurbs/internals/curvelist.cc \
libnurbs/internals/curvesub.cc \
libnurbs/internals/dataTransform.cc \
libnurbs/internals/displaylist.cc \
libnurbs/internals/flist.cc \
libnurbs/internals/flistsorter.cc \
libnurbs/internals/hull.cc \
libnurbs/internals/intersect.cc \
libnurbs/internals/knotvector.cc \
libnurbs/internals/mapdesc.cc \
libnurbs/internals/mapdescv.cc \
libnurbs/internals/maplist.cc \
libnurbs/internals/mesher.cc \
libnurbs/internals/monoTriangulationBackend.cc \
libnurbs/internals/monotonizer.cc \
libnurbs/internals/mycode.cc \
libnurbs/internals/nurbsinterfac.cc \
libnurbs/internals/nurbstess.cc \
libnurbs/internals/patch.cc \
libnurbs/internals/patchlist.cc \
libnurbs/internals/quilt.cc \
libnurbs/internals/reader.cc \
libnurbs/internals/renderhints.cc \
libnurbs/internals/slicer.cc \
libnurbs/internals/sorter.cc \
libnurbs/internals/splitarcs.cc \
libnurbs/internals/subdivider.cc \
libnurbs/internals/tobezier.cc \
libnurbs/internals/trimline.cc \
libnurbs/internals/trimregion.cc \
libnurbs/internals/trimvertpool.cc \
libnurbs/internals/uarray.cc \
libnurbs/internals/varray.cc \
libnurbs/nurbtess/directedLine.cc \
libnurbs/nurbtess/gridWrap.cc \
libnurbs/nurbtess/monoChain.cc \
libnurbs/nurbtess/monoPolyPart.cc \
libnurbs/nurbtess/monoTriangulation.cc \
libnurbs/nurbtess/partitionX.cc \
libnurbs/nurbtess/partitionY.cc \
libnurbs/nurbtess/polyDBG.cc \
libnurbs/nurbtess/polyUtil.cc \
libnurbs/nurbtess/primitiveStream.cc \
libnurbs/nurbtess/quicksort.cc \
libnurbs/nurbtess/rectBlock.cc \
libnurbs/nurbtess/sampleComp.cc \
libnurbs/nurbtess/sampleCompBot.cc \
libnurbs/nurbtess/sampleCompRight.cc \
libnurbs/nurbtess/sampleCompTop.cc \
libnurbs/nurbtess/sampleMonoPoly.cc \
libnurbs/nurbtess/sampledLine.cc \
libnurbs/nurbtess/searchTree.cc
SOURCES = $(C_SOURCES) $(CC_SOURCES)
OBJECTS = $(addsuffix .o,$(basename $(SOURCES)))
.c.o:
$(CC) -o $@ $(CFLAGS) -c $<
.cc.o:
$(CXX) -o $@ $(CXXFLAGS) -c $<
all: $(LIBDIR) $(LIBDIR)/$(GLU_DLL) $(LIBDIR)/$(GLU_IMP)
$(LIBDIR):
mkdir -p $(LIBDIR)
$(LIBDIR)/$(GLU_DLL) $(LIBDIR)/$(GLU_IMP): $(OBJECTS)
$(CXX) $(LDFLAGS) -o $(LIBDIR)/$(GLU_DLL) $^ $(LDLIBS)
$(DLLTOOL) --as=as --dllname $(LIB_NAME) --output-def $(LIBDIR)/$(GLU_DEF) $^
$(DLLTOOL) --as=as -k --dllname $(LIB_NAME) --output-lib $(LIBDIR)/$(GLU_IMP) --def $(LIBDIR)/$(GLU_DEF)
clean:
-$(call UNLINK,libutil/*.o)
-$(call UNLINK,libtess/*.o)
-$(call UNLINK,libnurbs/interface/*.o)
-$(call UNLINK,libnurbs/internals/*.o)
-$(call UNLINK,libnurbs/nurbtess/*.o)

View file

@ -111,8 +111,11 @@ void bezierPatchDelete(bezierPatch *b)
void bezierPatchDeleteList(bezierPatch *b)
{
bezierPatch *temp;
for(temp = b; temp != NULL; temp = temp->next)
bezierPatchDelete(temp);
while (b != NULL) {
temp = b;
b = b->next;
bezierPatchDelete(temp);
}
}
bezierPatch* bezierPatchInsert(bezierPatch *list, bezierPatch *b)

View file

@ -93,7 +93,7 @@ public:
output_triangles = flag;
}
#ifdef _WIN32
void putCallBack(GLenum which, void (APIENTRY *fn)() );
void putCallBack(GLenum which, void (GLAPIENTRY *fn)() );
#else
void putCallBack(GLenum which, _GLUfuncptr fn );
#endif

View file

@ -1184,8 +1184,11 @@ return;
}
void
OpenGLSurfaceEvaluator::putCallBack(GLenum which, _GLUfuncptr fn )
#ifdef _WIN32
void OpenGLSurfaceEvaluator::putCallBack(GLenum which, void (GLAPIENTRY *fn)() )
#else
void OpenGLSurfaceEvaluator::putCallBack(GLenum which, _GLUfuncptr fn )
#endif
{
switch(which)
{

View file

@ -145,7 +145,7 @@ public:
void newtmeshvert( long, long );
#ifdef _WIN32
void putCallBack(GLenum which, void (APIENTRY *fn)() );
void putCallBack(GLenum which, void (GLAPIENTRY *fn)() );
#else
void putCallBack(GLenum which, _GLUfuncptr fn );
#endif

View file

@ -1533,8 +1533,8 @@ void OpenGLSurfaceEvaluator::inEvalVStrip(int n_left, REAL u_left, REAL* left_va
}
//clean up
free(leftXYZ);
free(leftXYZ);
free(rightNormal);
free(rightXYZ);
free(leftNormal);
free(rightNormal);
}

View file

@ -82,7 +82,7 @@ gluErrorString(GLenum errorCode)
if ((errorCode >= GLU_NURBS_ERROR1) && (errorCode <= GLU_NURBS_ERROR37)) {
return (const GLubyte *) __gluNURBSErrorString(errorCode - (GLU_NURBS_ERROR1 - 1));
}
if ((errorCode >= GLU_TESS_ERROR1) && (errorCode <= GLU_TESS_ERROR8)) {
if ((errorCode >= GLU_TESS_ERROR1) && (errorCode <= GLU_TESS_ERROR6)) {
return (const GLubyte *) __gluTessErrorString(errorCode - (GLU_TESS_ERROR1 - 1));
}
return (const GLubyte *) 0;

191
src/glut/glx/Makefile.mgw Normal file
View file

@ -0,0 +1,191 @@
# Mesa 3-D graphics library
# Version: 5.1
#
# Copyright (C) 1999-2003 Brian Paul All Rights Reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# the rights to use, copy, modify, merge, publish, distribute, sublicense,
# 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 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 NONINFRINGEMENT. IN NO EVENT SHALL
# BRIAN PAUL 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.
# MinGW core makefile v1.4 for Mesa
#
# Copyright (C) 2002 - Daniel Borca
# Email : dborca@users.sourceforge.net
# Web : http://www.geocities.com/dborca
# MinGW core-glut makefile updated for Mesa 7.0
#
# Updated : by Heromyth, on 2007-7-21
# Email : zxpmyth@yahoo.com.cn
# Bugs : 1) All the default settings work fine. But the setting X86=1 can't work.
# The others havn't been tested yet.
# 2) The generated DLLs are *not* compatible with the ones built
# with the other compilers like VC8, especially for GLUT.
# 3) Although more tests are needed, it can be used individually!
#
# Available options:
#
# Environment variables:
# CFLAGS
#
# GLIDE path to Glide3 SDK; used with FX.
# default = $(TOP)/glide3
# FX=1 build for 3dfx Glide3. Note that this disables
# compilation of most WMesa code and requires fxMesa.
# As a consequence, you'll need the Win32 Glide3
# library to build any application.
# default = no
# ICD=1 build the installable client driver interface
# (windows opengl driver interface)
# default = no
# X86=1 optimize for x86 (if possible, use MMX, SSE, 3DNow).
# default = no
#
# Targets:
# all: build GL
# clean: remove object files
#
.PHONY: all clean
.INTERMEDIATE: x86/gen_matypes.exe
.SUFFIXES: .rc .res
# Set this to the prefix of your build tools, i.e. mingw32-
TOOLS_PREFIX = mingw32-
TOP = ../../..
LIBDIR = $(TOP)/lib
LIB_NAME = glut32
DLL_EXT = .dll
IMP_EXT = .a
LIB_PRE = lib
STRIP = -s
AR = ar
ARFLAGS = crus
DLLTOOL = dlltool
GLUT_DLL = $(LIB_NAME)$(DLL_EXT)
GLUT_IMP = $(LIB_PRE)$(LIB_NAME)$(IMP_EXT)
GLUT_DEF = $(LIB_NAME).def
LDLIBS = -L$(LIBDIR) -lwinmm -lgdi32 -luser32 -lopengl32 -lglu32
LDFLAGS = $(STRIP) -shared -fPIC -Wl,--kill-at
CFLAGS += -DBUILD_GLUT32 -DGLUT_BUILDING_LIB -DMESA -D_DLL
CFLAGS += -DNDEBUG -DLIBRARYBUILD -I$(TOP)/include
CC = $(TOOLS_PREFIX)gcc
CXX = $(TOOLS_PREFIX)g++
CXXFLAGS = $(CFLAGS)
AR = ar
ARFLAGS = crus
UNLINK = del $(subst /,\,$(1))
ifneq ($(wildcard $(addsuffix /rm.exe,$(subst ;, ,$(PATH)))),)
UNLINK = $(RM) $(1)
endif
ifneq ($(wildcard $(addsuffix /rm,$(subst :, ,$(PATH)))),)
UNLINK = $(RM) $(1)
endif
HDRS = glutint.h glutstroke.h glutbitmap.h glutwin32.h stroke.h win32_glx.h win32_x11.h
SRCS = \
glut_bitmap.c \
glut_bwidth.c \
glut_cindex.c \
glut_cmap.c \
glut_cursor.c \
glut_dials.c \
glut_dstr.c \
glut_event.c \
glut_ext.c \
glut_fbc.c \
glut_fullscrn.c \
glut_gamemode.c \
glut_get.c \
glut_init.c \
glut_input.c \
glut_joy.c \
glut_key.c \
glut_keyctrl.c \
glut_keyup.c \
glut_mesa.c \
glut_modifier.c \
glut_overlay.c \
glut_shapes.c \
glut_space.c \
glut_stroke.c \
glut_swap.c \
glut_swidth.c \
glut_tablet.c \
glut_teapot.c \
glut_util.c \
glut_vidresize.c \
glut_warp.c \
glut_win.c \
glut_winmisc.c \
win32_glx.c \
win32_menu.c \
win32_util.c \
win32_winproc.c \
win32_x11.c
SRCSSEMIGENS = \
glut_8x13.c \
glut_9x15.c \
glut_hel10.c \
glut_hel12.c \
glut_hel18.c \
glut_mroman.c \
glut_roman.c \
glut_tr10.c \
glut_tr24.c
SOURCES = $(SRCS) $(SRCSSEMIGENS)
OBJECTS = $(addsuffix .o,$(basename $(SOURCES)))
.c.o:
$(CC) -o $@ $(CFLAGS) -c $<
.cc.o:
$(CXX) -o $@ $(CXXFLAGS) -c $<
all: $(LIBDIR) $(LIBDIR)/$(GLUT_DLL) $(LIBDIR)/$(GLUT_IMP)
$(LIBDIR):
mkdir -p $(LIBDIR)
$(LIBDIR)/$(GLUT_DLL) $(LIBDIR)/$(GLUT_IMP): $(OBJECTS)
$(CXX) $(LDFLAGS) -o $(LIBDIR)/$(GLUT_DLL) $^ $(LDLIBS)
$(DLLTOOL) --as=as --dllname $(LIB_NAME) --output-def $(LIBDIR)/$(GLUT_DEF) $^
$(DLLTOOL) --as=as -k --dllname $(LIB_NAME) --output-lib $(LIBDIR)/$(GLUT_IMP) --def $(LIBDIR)/$(GLUT_DEF)
clean:
-$(call UNLINK,*.o)

View file

@ -291,6 +291,7 @@ loadVisuals(int *nitems_return)
fbmodes = (FrameBufferMode *) malloc(n * sizeof(FrameBufferMode));
if (fbmodes == NULL) {
*nitems_return = -1;
free(vlist);
return NULL;
}
for (i = 0; i < n; i++) {

View file

@ -24,7 +24,7 @@
# ifdef __sgi
# include <bstring.h> /* prototype for bzero used by FD_ZERO */
# endif
# if (defined(SVR4) || defined(CRAY) || defined(AIXV3)) && !defined(FD_SETSIZE)
# if (defined(__FreeBSD__) || defined(SVR4) || defined(CRAY) || defined(AIXV3)) && !defined(FD_SETSIZE)
# include <sys/select.h> /* select system call interface */
# ifdef luna
# include <sysent.h>

View file

@ -18,7 +18,7 @@
/* Set a Fortran callback function. */
void GLUTAPIENTRY
void APIENTRY
__glutSetFCB(int which, void *func)
{
#ifdef SUPPORT_FORTRAN
@ -100,7 +100,7 @@ __glutSetFCB(int which, void *func)
/* Get a Fortran callback function. */
void* GLUTAPIENTRY
void* APIENTRY
__glutGetFCB(int which)
{
#ifdef SUPPORT_FORTRAN

View file

@ -26,7 +26,10 @@
#include <GL/glx.h>
#endif
#ifndef GLUT_BUILDING_LIB
#define GLUT_BUILDING_LIB /* Building the GLUT library itself. */
#endif
#include <GL/glut.h>
#if defined(MESA) && defined(_WIN32) && !defined(__CYGWIN32__)

View file

@ -9,6 +9,9 @@
#include "glutint.h"
#include <sys/timeb.h>
#ifdef __MINGW32__
#include <ctype.h>
#endif
#if defined(_WIN32) && !defined(__CYGWIN32__)
#include <mmsystem.h> /* Win32 Multimedia API header. */

View file

@ -1,5 +1,5 @@
# Mesa 3-D graphics library
# Version: 5.1
# Version: 7.0
#
# Copyright (C) 1999-2003 Brian Paul All Rights Reserved.
#
@ -26,6 +26,16 @@
# Email : dborca@users.sourceforge.net
# Web : http://www.geocities.com/dborca
# MinGW core-gl makefile updated for Mesa 7.0
#
# updated : by Heromyth, on 2007-7-21
# Email : zxpmyth@yahoo.com.cn
# Bugs : 1) All the default settings work fine. But the setting X86=1 can't work.
# The others havn't been tested yet.
# 2) The generated DLLs are *not* compatible with the ones built
# with the other compilers like VC8, especially for GLUT.
# 3) Although more tests are needed, it can be used individually!
#
# Available options:
@ -52,7 +62,6 @@
#
.PHONY: all clean
.INTERMEDIATE: x86/gen_matypes.exe
.SUFFIXES: .rc .res
@ -60,23 +69,37 @@
# Set this to the prefix of your build tools, i.e. mingw32-
TOOLS_PREFIX = mingw32-
ifeq ($(ICD),1)
LIB_NAME = mesa32
else
LIB_NAME = opengl32
endif
DLL_EXT = .dll
IMP_EXT = .a
LIB_PRE = lib
STRIP = -s
AR = ar
ARFLAGS = crus
DLLTOOL = dlltool
TOP = ../..
GLIDE ?= $(TOP)/glide3
LIBDIR = $(TOP)/lib
ifeq ($(ICD),1)
GL_DLL = mesa32.dll
GL_IMP = libmesa32.a
else
GL_DLL = opengl32.dll
GL_IMP = libopengl32.a
endif
LDLIBS = -lgdi32
GL_DLL = $(LIB_NAME)$(DLL_EXT)
GL_IMP = $(LIB_PRE)$(LIB_NAME)$(IMP_EXT)
MESA_LIB = libmesa.a
CC = $(TOOLS_PREFIX)gcc
CFLAGS += -DBUILD_GL32 -D_OPENGL32_
CFLAGS += $(INCLUDE_DIRS)
CFLAGS += -DUSE_EXTERNAL_DXTN_LIB=1
LDLIBS = -lgdi32 -luser32 -liberty
LDFLAGS = $(STRIP) -shared -fPIC -Wl,--kill-at
CFLAGS += -DBUILD_GL32 -D_DLL -DMESA_MINWARN
CFLAGS += -DNDEBUG -DUSE_EXTERNAL_DXTN_LIB=1
ifeq ($(FX),1)
CFLAGS += -I$(GLIDE)/include -DFX
LDLIBS += -L$(GLIDE)/lib -lglide3x
@ -87,12 +110,11 @@ else
CFLAGS += -DUSE_MGL_NAMESPACE
GL_DEF = drivers/windows/icd/mesa.def
else
GL_DEF = drivers/windows/gdi/mesa.def
GL_DEF = $(LIB_NAME).def
endif
endif
AR = ar
ARFLAGS = crus
UNLINK = del $(subst /,\,$(1))
ifneq ($(wildcard $(addsuffix /rm.exe,$(subst ;, ,$(PATH)))),)
@ -104,6 +126,8 @@ endif
include sources
CFLAGS += $(INCLUDE_DIRS)
ifeq ($(X86),1)
CFLAGS += -DUSE_X86_ASM
CFLAGS += -DUSE_MMX_ASM
@ -140,22 +164,23 @@ RESOURCE = $(GL_RES:.rc=.res)
.c.o:
$(CC) -o $@ $(CFLAGS) -c $<
.S.o:
$(CC) -o $@ $(CFLAGS) -c $<
.s.o:
$(CC) -o $@ $(CFLAGS) -x assembler-with-cpp -c $<
.rc.res:
windres -o $@ -Irc -Ocoff $<
all: $(LIBDIR) $(LIBDIR)/$(GL_DLL) $(LIBDIR)/$(GL_IMP)
$(LIBDIR):
mkdir -p $(LIBDIR)
$(LIBDIR)/$(GL_DLL) $(LIBDIR)/$(GL_IMP): $(OBJECTS) $(RESOURCE)
$(TOOLS_PREFIX)dllwrap -o $(LIBDIR)/$(GL_DLL) --output-lib $(LIBDIR)/$(GL_IMP) \
--target i386-mingw32 --def $(GL_DEF) -Wl,-enable-stdcall-fixup \
$^ $(LDLIBS)
$(CC) $(LDFLAGS) -o $(LIBDIR)/$(GL_DLL) $^ $(LDLIBS)
$(DLLTOOL) --as=as --dllname $(LIB_NAME) --output-def $(LIBDIR)/$(GL_DEF) $^
$(DLLTOOL) --as=as -k --dllname $(LIB_NAME) --output-lib $(LIBDIR)/$(GL_IMP) --def $(LIBDIR)/$(GL_DEF)
$(X86_OBJECTS): x86/matypes.h
@ -187,17 +212,21 @@ tnl/t_vtx_x86_gcc.o: tnl/t_vtx_x86_gcc.S
$(CC) -o $@ $(CFLAGS) -DSTDCALL_API -c $<
clean:
-$(call UNLINK,array_cache/*.o)
-$(call UNLINK,glapi/*.o)
-$(call UNLINK,main/*.o)
-$(call UNLINK,math/*.o)
-$(call UNLINK,vbo/*.o)
-$(call UNLINK,shader/*.o)
-$(call UNLINK,shader/slang/*.o)
-$(call UNLINK,shader/grammar/*.o)
-$(call UNLINK,sparc/*.o)
-$(call UNLINK,ppc/*.o)
-$(call UNLINK,swrast/*.o)
-$(call UNLINK,swrast_setup/*.o)
-$(call UNLINK,tnl/*.o)
-$(call UNLINK,x86/*.o)
-$(call UNLINK,x86/rtasm/*.o)
-$(call UNLINK,x86-64/*.o)
-$(call UNLINK,drivers/common/*.o)
-$(call UNLINK,drivers/glide/*.o)
-$(call UNLINK,drivers/windows/fx/*.o)

View file

@ -51,6 +51,7 @@ pool_create(struct _DriBufferPool *pool,
return NULL;
if ((alignment > pageSize) && (alignment % pageSize)) {
free(buf);
return NULL;
}

View file

@ -997,6 +997,9 @@ __driUtilCreateNewScreen(__DRInativeDisplay *dpy, int scrn, __DRIscreen *psc,
psc->getMSC = driGetMSC;
psc->createNewContext = driCreateNewContext;
if (internal_api_version >= 20070121)
psc->setTexOffset = psp->DriverAPI.setTexOffset;
if ( (psp->DriverAPI.InitDriver != NULL)
&& !(*psp->DriverAPI.InitDriver)(psp) ) {
_mesa_free( psp );

View file

@ -189,6 +189,12 @@ struct __DriverAPIRec {
/*@}*/
void (*CopySubBuffer)(__DRIdrawablePrivate *driDrawPriv,
int x, int y, int w, int h);
/**
* See corresponding field in \c __DRIscreenRec.
*/
void (*setTexOffset)(__DRIcontext *pDRICtx, GLint texname,
unsigned long long offset, GLint depth, GLuint pitch);
};

View file

@ -575,6 +575,7 @@
#define MT_16BIT_DIB_RGB565_8888 (7<<3)
#define MT_32BIT_ARGB8888 (0<<3) /* SURFACE_32BIT */
#define MT_32BIT_ABGR8888 (1<<3)
#define MT_32BIT_XRGB8888 (2<<3) /* XXX: Guess from i915_reg.h */
#define MT_32BIT_BUMP_XLDVDU_8888 (6<<3)
#define MT_32BIT_DIB_8888 (7<<3)
#define MT_411_YUV411 (0<<3) /* SURFACE_411 */

View file

@ -117,7 +117,7 @@ i830_update_tex_unit(struct intel_context *intel, GLuint unit, GLuint ss3)
struct gl_texture_object *tObj = ctx->Texture.Unit[unit]._Current;
struct intel_texture_object *intelObj = intel_texture_object(tObj);
struct gl_texture_image *firstImage;
GLuint *state = i830->state.Tex[unit];
GLuint *state = i830->state.Tex[unit], format, pitch;
memset(state, 0, sizeof(state));
@ -128,7 +128,7 @@ i830_update_tex_unit(struct intel_context *intel, GLuint unit, GLuint ss3)
i830->state.tex_buffer[unit] = NULL;
}
if (!intel_finalize_mipmap_tree(intel, unit))
if (!intelObj->imageOverride && !intel_finalize_mipmap_tree(intel, unit))
return GL_FALSE;
/* Get first image here, since intelObj->firstLevel will get set in
@ -136,11 +136,34 @@ i830_update_tex_unit(struct intel_context *intel, GLuint unit, GLuint ss3)
*/
firstImage = tObj->Image[0][intelObj->firstLevel];
i830->state.tex_buffer[unit] = driBOReference(intelObj->mt->region->buffer);
i830->state.tex_offset[unit] = intel_miptree_image_offset(intelObj->mt, 0,
intelObj->
firstLevel);
if (intelObj->imageOverride) {
i830->state.tex_buffer[unit] = NULL;
i830->state.tex_offset[unit] = intelObj->textureOffset;
switch (intelObj->depthOverride) {
case 32:
format = MAPSURF_32BIT | MT_32BIT_ARGB8888;
break;
case 24:
default:
format = MAPSURF_32BIT | MT_32BIT_XRGB8888;
break;
case 16:
format = MAPSURF_16BIT | MT_16BIT_RGB565;
break;
}
pitch = intelObj->pitchOverride;
} else {
i830->state.tex_buffer[unit] = driBOReference(intelObj->mt->region->
buffer);
i830->state.tex_offset[unit] = intel_miptree_image_offset(intelObj->mt,
0, intelObj->
firstLevel);
format = translate_texture_format(firstImage->TexFormat->MesaFormat);
pitch = intelObj->mt->pitch * intelObj->mt->cpp;
}
state[I830_TEXREG_TM0LI] = (_3DSTATE_LOAD_STATE_IMMEDIATE_2 |
(LOAD_TEXTURE_MAP0 << unit) | 4);
@ -151,12 +174,10 @@ i830_update_tex_unit(struct intel_context *intel, GLuint unit, GLuint ss3)
state[I830_TEXREG_TM0S1] =
(((firstImage->Height - 1) << TM0S1_HEIGHT_SHIFT) |
((firstImage->Width - 1) << TM0S1_WIDTH_SHIFT) |
translate_texture_format(firstImage->TexFormat->MesaFormat));
((firstImage->Width - 1) << TM0S1_WIDTH_SHIFT) | format);
state[I830_TEXREG_TM0S2] =
(((((intelObj->mt->pitch * intelObj->mt->cpp) / 4) -
1) << TM0S2_PITCH_SHIFT) | TM0S2_CUBE_FACE_ENA_MASK);
((((pitch / 4) - 1) << TM0S2_PITCH_SHIFT) | TM0S2_CUBE_FACE_ENA_MASK);
{
if (tObj->Target == GL_TEXTURE_CUBE_MAP)

View file

@ -490,11 +490,13 @@ i830_emit_state(struct intel_context *intel)
DRM_BO_MASK_MEM | DRM_BO_FLAG_READ,
state->tex_offset[i] | TM0S0_USE_FENCE);
}
else {
assert(i == 0);
assert(state == &i830->meta);
OUT_BATCH(0);
}
else if (state == &i830->meta) {
assert(i == 0);
OUT_BATCH(0);
}
else {
OUT_BATCH(state->tex_offset[i]);
}
OUT_BATCH(state->Tex[i][I830_TEXREG_TM0S1]);
OUT_BATCH(state->Tex[i][I830_TEXREG_TM0S2]);

View file

@ -122,7 +122,7 @@ i915_update_tex_unit(struct intel_context *intel, GLuint unit, GLuint ss3)
struct gl_texture_object *tObj = ctx->Texture.Unit[unit]._Current;
struct intel_texture_object *intelObj = intel_texture_object(tObj);
struct gl_texture_image *firstImage;
GLuint *state = i915->state.Tex[unit];
GLuint *state = i915->state.Tex[unit], format, pitch;
memset(state, 0, sizeof(state));
@ -133,7 +133,7 @@ i915_update_tex_unit(struct intel_context *intel, GLuint unit, GLuint ss3)
i915->state.tex_buffer[unit] = NULL;
}
if (!intel_finalize_mipmap_tree(intel, unit))
if (!intelObj->imageOverride && !intel_finalize_mipmap_tree(intel, unit))
return GL_FALSE;
/* Get first image here, since intelObj->firstLevel will get set in
@ -141,24 +141,45 @@ i915_update_tex_unit(struct intel_context *intel, GLuint unit, GLuint ss3)
*/
firstImage = tObj->Image[0][intelObj->firstLevel];
i915->state.tex_buffer[unit] = driBOReference(intelObj->mt->region->buffer);
i915->state.tex_offset[unit] = intel_miptree_image_offset(intelObj->mt, 0,
intelObj->
firstLevel);
if (intelObj->imageOverride) {
i915->state.tex_buffer[unit] = NULL;
i915->state.tex_offset[unit] = intelObj->textureOffset;
switch (intelObj->depthOverride) {
case 32:
format = MAPSURF_32BIT | MT_32BIT_ARGB8888;
break;
case 24:
default:
format = MAPSURF_32BIT | MT_32BIT_XRGB8888;
break;
case 16:
format = MAPSURF_16BIT | MT_16BIT_RGB565;
break;
}
pitch = intelObj->pitchOverride;
} else {
i915->state.tex_buffer[unit] = driBOReference(intelObj->mt->region->
buffer);
i915->state.tex_offset[unit] = intel_miptree_image_offset(intelObj->mt,
0, intelObj->
firstLevel);
format = translate_texture_format(firstImage->TexFormat->MesaFormat);
pitch = intelObj->mt->pitch * intelObj->mt->cpp;
}
state[I915_TEXREG_MS3] =
(((firstImage->Height - 1) << MS3_HEIGHT_SHIFT) |
((firstImage->Width - 1) << MS3_WIDTH_SHIFT) |
translate_texture_format(firstImage->TexFormat->MesaFormat) |
((firstImage->Width - 1) << MS3_WIDTH_SHIFT) | format |
MS3_USE_FENCE_REGS);
state[I915_TEXREG_MS4] =
(((((intelObj->mt->pitch * intelObj->mt->cpp) / 4) -
1) << MS4_PITCH_SHIFT) | MS4_CUBE_FACE_ENA_MASK |
((((intelObj->lastLevel -
intelObj->firstLevel) *
4)) << MS4_MAX_LOD_SHIFT) | ((firstImage->Depth -
1) << MS4_VOLUME_DEPTH_SHIFT));
((((pitch / 4) - 1) << MS4_PITCH_SHIFT) | MS4_CUBE_FACE_ENA_MASK |
((((intelObj->lastLevel - intelObj->firstLevel) * 4)) <<
MS4_MAX_LOD_SHIFT) | ((firstImage->Depth - 1) <<
MS4_VOLUME_DEPTH_SHIFT));
{

View file

@ -382,11 +382,13 @@ i915_emit_state(struct intel_context *intel)
DRM_BO_MASK_MEM | DRM_BO_FLAG_READ,
state->tex_offset[i]);
}
else {
else if (state == &i915->meta) {
assert(i == 0);
assert(state == &i915->meta);
OUT_BATCH(0);
}
else {
OUT_BATCH(state->tex_offset[i]);
}
OUT_BATCH(state->Tex[i][I915_TEXREG_MS3]);
OUT_BATCH(state->Tex[i][I915_TEXREG_MS4]);

View file

@ -92,6 +92,10 @@ struct intel_texture_object
* regions will be copied to this region and the old storage freed.
*/
struct intel_mipmap_tree *mt;
GLboolean imageOverride;
GLint depthOverride;
GLuint pitchOverride;
};

View file

@ -776,7 +776,8 @@ static const struct __DriverAPIRec intelAPI = {
.WaitForMSC = driWaitForMSC32,
.WaitForSBC = NULL,
.SwapBuffersMSC = NULL,
.CopySubBuffer = intelCopySubBuffer
.CopySubBuffer = intelCopySubBuffer,
.setTexOffset = intelSetTexOffset,
};

View file

@ -135,6 +135,9 @@ void intelGetCompressedTexImage(GLcontext *ctx, GLenum target, GLint level,
const struct gl_texture_object *texObj,
const struct gl_texture_image *texImage);
void intelSetTexOffset(__DRIcontext *pDRICtx, GLint texname,
unsigned long long offset, GLint depth, GLuint pitch);
GLuint intel_finalize_mipmap_tree(struct intel_context *intel, GLuint unit);
void intel_tex_map_images(struct intel_context *intel,

View file

@ -385,7 +385,6 @@ intelTexImage(GLcontext * ctx,
}
}
assert(!intelImage->mt);
if (intelObj->mt &&
@ -667,3 +666,26 @@ intelGetCompressedTexImage(GLcontext *ctx, GLenum target, GLint level,
texObj, texImage, 1);
}
void
intelSetTexOffset(__DRIcontext *pDRICtx, GLint texname,
unsigned long long offset, GLint depth, GLuint pitch)
{
struct intel_context *intel = (struct intel_context*)
((__DRIcontextPrivate*)pDRICtx->private)->driverPrivate;
struct gl_texture_object *tObj = _mesa_lookup_texture(&intel->ctx, texname);
struct intel_texture_object *intelObj = intel_texture_object(tObj);
if (!intelObj)
return;
if (intelObj->mt)
intel_miptree_release(intel, &intelObj->mt);
intelObj->imageOverride = GL_TRUE;
intelObj->depthOverride = depth;
intelObj->pitchOverride = pitch;
if (offset)
intelObj->textureOffset = offset;
}

View file

@ -191,6 +191,8 @@ struct r300_tex_obj {
drm_radeon_tex_image_t image[6][RADEON_MAX_TEXTURE_LEVELS];
/* Six, for the cube faces */
GLboolean image_override; /* Image overridden by GLX_EXT_tfp */
GLuint pitch; /* this isn't sent to hardware just used in calculations */
/* hardware register values */
/* Note that R200 has 8 registers per texture and R300 only 7 */

View file

@ -35,6 +35,10 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#ifndef __r300_TEX_H__
#define __r300_TEX_H__
extern void r300SetTexOffset(__DRIcontext *pDRICtx, GLint texname,
unsigned long long offset, GLint depth,
GLuint pitch);
extern void r300UpdateTextureState(GLcontext * ctx);
extern int r300UploadTexImages(r300ContextPtr rmesa, r300TexObjPtr t,

View file

@ -508,6 +508,9 @@ int r300UploadTexImages(r300ContextPtr rmesa, r300TexObjPtr t, GLuint face)
{
const int numLevels = t->base.lastLevel - t->base.firstLevel + 1;
if (t->image_override)
return 0;
if (RADEON_DEBUG & (DEBUG_TEXTURE | DEBUG_IOCTL)) {
fprintf(stderr, "%s( %p, %p ) sz=%d lvls=%d-%d\n", __FUNCTION__,
(void *)rmesa->radeon.glCtx, (void *)t->base.tObj,

View file

@ -40,6 +40,8 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "context.h"
#include "macros.h"
#include "texformat.h"
#include "teximage.h"
#include "texobj.h"
#include "enums.h"
#include "r300_context.h"
@ -66,7 +68,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
* identically. -- paulus
*/
static const struct {
static const struct tx_table {
GLuint format, filter, flag;
} tx_table_be[] = {
/* *INDENT-OFF* */
@ -109,15 +111,13 @@ static const struct {
/* *INDENT-ON* */
};
static const struct {
GLuint format, filter, flag;
} tx_table_le[] = {
static const struct tx_table tx_table_le[] = {
/* *INDENT-OFF* */
_ASSIGN(RGBA8888, R300_EASY_TX_FORMAT(Y, Z, W, X, W8Z8Y8X8)),
_ASSIGN(RGBA8888_REV, R300_EASY_TX_FORMAT(Z, Y, X, W, W8Z8Y8X8)),
_ASSIGN(ARGB8888, R300_EASY_TX_FORMAT(X, Y, Z, W, W8Z8Y8X8)),
_ASSIGN(ARGB8888_REV, R300_EASY_TX_FORMAT(W, Z, Y, X, W8Z8Y8X8)),
_ASSIGN(RGB888, 0xffffffff),
_ASSIGN(RGB888, R300_EASY_TX_FORMAT(X, Y, Z, ONE, W8Z8Y8X8)),
_ASSIGN(RGB565, R300_EASY_TX_FORMAT(X, Y, Z, ONE, Z5Y6X5)),
_ASSIGN(RGB565_REV, R300_EASY_TX_FORMAT(X, Y, Z, ONE, Z5Y6X5)),
_ASSIGN(ARGB4444, R300_EASY_TX_FORMAT(X, Y, Z, W, W4Z4Y4X4)),
@ -178,7 +178,7 @@ static void r300SetTexImages(r300ContextPtr rmesa,
/* Set the hardware texture format
*/
if (VALID_FORMAT(baseImage->TexFormat->MesaFormat)) {
if (!t->image_override && VALID_FORMAT(baseImage->TexFormat->MesaFormat)) {
if (_mesa_little_endian()) {
t->format =
tx_table_le[baseImage->TexFormat->MesaFormat].
@ -194,7 +194,7 @@ static void r300SetTexImages(r300ContextPtr rmesa,
tx_table_be[baseImage->TexFormat->MesaFormat].
filter;
}
} else {
} else if (!t->image_override) {
_mesa_problem(NULL, "unexpected texture format in %s",
__FUNCTION__);
return;
@ -382,9 +382,10 @@ static void r300SetTexImages(r300ContextPtr rmesa,
t->pitch = ((tObj->Image[0][t->base.firstLevel]->Width *
texelBytes) + 63) & ~(63);
t->size |= R300_TX_SIZE_TXPITCH_EN;
t->pitch_reg =
(((tObj->Image[0][t->base.firstLevel]->Width) +
align) & ~align) - 1;
if (!t->image_override)
t->pitch_reg =
(((tObj->Image[0][t->base.firstLevel]->Width) +
align) & ~align) - 1;
} else {
t->pitch =
((tObj->Image[0][t->base.firstLevel]->Width *
@ -411,9 +412,10 @@ static GLboolean r300EnableTexture2D(GLcontext * ctx, int unit)
if (t->base.dirty_images[0]) {
R300_FIREVERTICES(rmesa);
r300SetTexImages(rmesa, tObj);
r300UploadTexImages(rmesa, (r300TexObjPtr) tObj->DriverData, 0);
if (!t->base.memBlock)
if (!t->base.memBlock && !t->image_override)
return GL_FALSE;
}
@ -492,9 +494,11 @@ static GLboolean r300EnableTextureRect(GLcontext * ctx, int unit)
if (t->base.dirty_images[0]) {
R300_FIREVERTICES(rmesa);
r300SetTexImages(rmesa, tObj);
r300UploadTexImages(rmesa, (r300TexObjPtr) tObj->DriverData, 0);
if (!t->base.memBlock && !rmesa->prefer_gart_client_texturing)
if (!t->base.memBlock && !t->image_override &&
!rmesa->prefer_gart_client_texturing)
return GL_FALSE;
}
@ -534,6 +538,51 @@ static GLboolean r300UpdateTexture(GLcontext * ctx, int unit)
return !t->border_fallback;
}
void r300SetTexOffset(__DRIcontext *pDRICtx, GLint texname,
unsigned long long offset, GLint depth, GLuint pitch)
{
r300ContextPtr rmesa =
(r300ContextPtr)((__DRIcontextPrivate*)pDRICtx->private)->driverPrivate;
struct gl_texture_object *tObj =
_mesa_lookup_texture(rmesa->radeon.glCtx, texname);
r300TexObjPtr t;
int idx;
if (!tObj)
return;
t = (r300TexObjPtr) tObj->DriverData;
t->image_override = GL_TRUE;
if (!offset)
return;
t->offset = offset;
t->pitch_reg = pitch;
switch (depth) {
case 32:
idx = 2;
t->pitch_reg /= 4;
break;
case 24:
default:
idx = 4;
t->pitch_reg /= 4;
break;
case 16:
idx = 5;
t->pitch_reg /= 2;
break;
}
t->pitch_reg--;
t->format = tx_table_le[idx].format;
t->filter |= tx_table_le[idx].filter;
}
static GLboolean r300UpdateTextureUnit(GLcontext * ctx, int unit)
{
struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];

View file

@ -56,6 +56,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#elif RADEON_COMMON && defined(RADEON_COMMON_FOR_R300)
#include "r300_context.h"
#include "r300_fragprog.h"
#include "r300_tex.h"
#include "radeon_span.h"
#endif
@ -952,6 +953,9 @@ static struct __DriverAPIRec radeonAPI = {
.WaitForSBC = NULL,
.SwapBuffersMSC = NULL,
.CopySubBuffer = radeonCopySubBuffer,
#if RADEON_COMMON && defined(RADEON_COMMON_FOR_R300)
.setTexOffset = r300SetTexOffset,
#endif
};
#else
static const struct __DriverAPIRec r200API = {

View file

@ -130,6 +130,8 @@ sisAllocTexImage( sisContextPtr smesa, sisTexObjPtr t, int level,
static void
sisFreeTexImage( sisContextPtr smesa, sisTexObjPtr t, int level )
{
assert(level >= 0);
assert(level < SIS_MAX_TEXTURE_LEVELS);
if (t->image[level].Data == NULL)
return;
@ -213,7 +215,7 @@ sisDeleteTexture( GLcontext * ctx, struct gl_texture_object *texObj )
*/
return;
}
for (i = 0; i < MAX_TEXTURE_LEVELS; i++) {
for (i = 0; i < SIS_MAX_TEXTURE_LEVELS; i++) {
sisFreeTexImage( smesa, t, i );
}

View file

@ -33,15 +33,30 @@
/* We're essentially building part of GDI here, so define this so that
* we get the right export linkage. */
#ifdef __MINGW32__
#include <GL/gl.h>
#include <stdarg.h>
#include <windef.h>
#include <wincon.h>
#include <winbase.h>
# if defined(BUILD_GL32)
# define WINGDIAPI __declspec(dllexport)
# else
# define __W32API_USE_DLLIMPORT__
# endif
#include <wingdi.h>
#include "GL/mesa_wgl.h"
#include <stdlib.h>
#else
#define _GDI32_
#endif
#include <windows.h>
#include "glapi.h"
#endif
#include "glapi.h"
#include "GL/wmesa.h" /* protos for wmesa* functions */
/*
@ -339,7 +354,7 @@ WINGDIAPI int GLAPIENTRY wglGetPixelFormat(HDC hdc)
}
WINGDIAPI BOOL GLAPIENTRY wglSetPixelFormat(HDC hdc,int iPixelFormat,
const PIXELFORMATDESCRIPTOR *ppfd)
const PIXELFORMATDESCRIPTOR *ppfd)
{
(void) hdc;
@ -392,12 +407,12 @@ static BOOL wglUseFontBitmaps_FX(HDC fontDevice, DWORD firstChar,
bitDevice = CreateCompatibleDC(fontDevice);
// Swap fore and back colors so the bitmap has the right polarity
/* Swap fore and back colors so the bitmap has the right polarity */
tempColor = GetBkColor(bitDevice);
SetBkColor(bitDevice, GetTextColor(bitDevice));
SetTextColor(bitDevice, tempColor);
// Place chars based on base line
/* Place chars based on base line */
VERIFY(SetTextAlign(bitDevice, TA_BASELINE) != GDI_ERROR ? 1 : 0);
for(i = 0; i < (int)numChars; i++) {
@ -410,36 +425,36 @@ static BOOL wglUseFontBitmaps_FX(HDC fontDevice, DWORD firstChar,
curChar = (char)(i + firstChar);
// Find how high/wide this character is
/* Find how high/wide this character is */
VERIFY(GetTextExtentPoint32(bitDevice, &curChar, 1, &size));
// Create the output bitmap
/* Create the output bitmap */
charWidth = size.cx;
charHeight = size.cy;
// Round up to the next multiple of 32 bits
/* Round up to the next multiple of 32 bits */
bmapWidth = ((charWidth + 31) / 32) * 32;
bmapHeight = charHeight;
bitObject = CreateCompatibleBitmap(bitDevice,
bmapWidth,
bmapHeight);
//VERIFY(bitObject);
/* VERIFY(bitObject); */
// Assign the output bitmap to the device
/* Assign the output bitmap to the device */
origBmap = SelectObject(bitDevice, bitObject);
(void) VERIFY(origBmap);
VERIFY( PatBlt( bitDevice, 0, 0, bmapWidth, bmapHeight,BLACKNESS ) );
// Use our source font on the device
/* Use our source font on the device */
VERIFY(SelectObject(bitDevice, GetCurrentObject(fontDevice,OBJ_FONT)));
// Draw the character
/* Draw the character */
VERIFY(TextOut(bitDevice, 0, metric.tmAscent, &curChar, 1));
// Unselect our bmap object
/* Unselect our bmap object */
VERIFY(SelectObject(bitDevice, origBmap));
// Convert the display dependant representation to a 1 bit deep DIB
/* Convert the display dependant representation to a 1 bit deep DIB */
numBytes = (bmapWidth * bmapHeight) / 8;
bmap = malloc(numBytes);
dibInfo->bmiHeader.biWidth = bmapWidth;
@ -447,24 +462,24 @@ static BOOL wglUseFontBitmaps_FX(HDC fontDevice, DWORD firstChar,
res = GetDIBits(bitDevice, bitObject, 0, bmapHeight, bmap,
dibInfo,
DIB_RGB_COLORS);
//VERIFY(res);
/* VERIFY(res); */
// Create the GL object
/* Create the GL object */
glNewList(i + listBase, GL_COMPILE);
glBitmap(bmapWidth, bmapHeight, 0.0, (GLfloat)metric.tmDescent,
(GLfloat)charWidth, 0.0,
bmap);
glEndList();
// CheckGL();
/* CheckGL(); */
// Destroy the bmap object
/* Destroy the bmap object */
DeleteObject(bitObject);
// Deallocate the bitmap data
/* Deallocate the bitmap data */
free(bmap);
}
// Destroy the DC
/* Destroy the DC */
VERIFY(DeleteDC(bitDevice));
free(dibInfo);

View file

@ -6,6 +6,7 @@
#include "wmesadef.h"
#include "colors.h"
#include <GL/wmesa.h>
#include <winuser.h>
#include "context.h"
#include "extensions.h"
#include "framebuffer.h"
@ -114,7 +115,7 @@ static void wmSetPixelFormat(WMesaFramebuffer pwfb, HDC hDC)
{
pwfb->cColorBits = GetDeviceCaps(hDC, BITSPIXEL);
// Only 16 and 32 bit targets are supported now
/* Only 16 and 32 bit targets are supported now */
assert(pwfb->cColorBits == 0 ||
pwfb->cColorBits == 16 ||
pwfb->cColorBits == 32);
@ -1171,7 +1172,7 @@ WMesaContext WMesaCreateContext(HDC hDC,
/* I do not understand this contributed code */
/* Support memory and device contexts */
if(WindowFromDC(hDC) != NULL) {
c->hDC = GetDC(WindowFromDC(hDC)); // huh ????
c->hDC = GetDC(WindowFromDC(hDC)); /* huh ???? */
}
else {
c->hDC = hDC;
@ -1404,6 +1405,7 @@ void WMesaSwapBuffers( HDC hdc )
* table entries. Hopefully, I'll find a better solution. The
* dispatch table generation scripts ought to be making these dummy
* stubs as well. */
#if !defined(__MINGW32__) || !defined(GL_NO_STDCALL)
void gl_dispatch_stub_543(void){}
void gl_dispatch_stub_544(void){}
void gl_dispatch_stub_545(void){}
@ -1471,3 +1473,4 @@ void gl_dispatch_stub_769(void){}
void gl_dispatch_stub_770(void){}
void gl_dispatch_stub_771(void){}
#endif

View file

@ -1,6 +1,8 @@
#ifndef WMESADEF_H
#define WMESADEF_H
#ifdef __MINGW32__
#include <windows.h>
#endif
#include "context.h"

View file

@ -1,8 +1,8 @@
/*
* Mesa 3-D graphics library
* Version: 6.5.2
* Version: 7.0.1
*
* Copyright (C) 1999-2006 Brian Paul All Rights Reserved.
* Copyright (C) 1999-2007 Brian Paul 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"),
@ -295,6 +295,11 @@ save_glx_visual( Display *dpy, XVisualInfo *vinfo,
}
}
if (stereoFlag) {
/* stereo not supported */
return NULL;
}
/* Comparing IDs uses less memory but sometimes fails. */
/* XXX revisit this after 3.0 is finished. */
if (_mesa_getenv("MESA_GLX_VISUAL_HACK"))
@ -1078,7 +1083,7 @@ choose_visual( Display *dpy, int screen, const int *list, GLboolean fbConfig )
else {
stereo_flag = GL_TRUE;
}
return NULL; /* stereo not supported */
break;
case GLX_AUX_BUFFERS:
parselist++;
numAux = *parselist++;

View file

@ -1,8 +1,8 @@
/*
* Mesa 3-D graphics library
* Version: 6.5.1
* Version: 7.0.1
*
* Copyright (C) 1999-2006 Brian Paul All Rights Reserved.
* Copyright (C) 1999-2007 Brian Paul 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"),
@ -2716,21 +2716,20 @@ save_PolygonMode(GLenum face, GLenum mode)
}
/*
* Polygon stipple must have been upacked already!
*/
static void GLAPIENTRY
save_PolygonStipple(const GLubyte * pattern)
{
GET_CURRENT_CONTEXT(ctx);
GLvoid *image = unpack_image(2, 32, 32, 1, GL_COLOR_INDEX, GL_BITMAP,
pattern, &ctx->Unpack);
Node *n;
ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx);
n = ALLOC_INSTRUCTION(ctx, OPCODE_POLYGON_STIPPLE, 1);
if (n) {
void *data;
n[1].data = _mesa_malloc(32 * 4);
data = n[1].data; /* This needed for Acorn compiler */
MEMCPY(data, pattern, 32 * 4);
n[1].data = image;
}
else if (image) {
_mesa_free(image);
}
if (ctx->ExecuteFlag) {
CALL_PolygonStipple(ctx->Exec, ((GLubyte *) pattern));
@ -6169,7 +6168,12 @@ execute_list(GLcontext *ctx, GLuint list)
CALL_PolygonMode(ctx->Exec, (n[1].e, n[2].e));
break;
case OPCODE_POLYGON_STIPPLE:
CALL_PolygonStipple(ctx->Exec, ((GLubyte *) n[1].data));
{
const struct gl_pixelstore_attrib save = ctx->Unpack;
ctx->Unpack = ctx->DefaultPacking;
CALL_PolygonStipple(ctx->Exec, ((GLubyte *) n[1].data));
ctx->Unpack = save; /* restore */
}
break;
case OPCODE_POLYGON_OFFSET:
CALL_PolygonOffset(ctx->Exec, (n[1].f, n[2].f));

View file

@ -92,7 +92,7 @@
#endif
#ifdef WGLAPI
#undef WGLAPI
# undef WGLAPI
#endif
#if !defined(OPENSTEP) && (defined(__WIN32__) && !defined(__CYGWIN__)) && !defined(BUILD_FOR_SNAP)

View file

@ -1,6 +1,6 @@
/*
* Mesa 3-D graphics library
* Version: 7.1
* Version: 7.0.1
*
* Copyright (C) 1999-2007 Brian Paul All Rights Reserved.
*
@ -850,7 +850,7 @@ _mesa_unpack_bitmap( GLint width, GLint height, const GLubyte *pixels,
return NULL;
}
if (packing->SkipPixels == 0) {
if ((packing->SkipPixels & 7) == 0) {
_mesa_memcpy( dst, src, width_in_bytes );
if (packing->LsbFirst) {
flip_bytes( dst, width_in_bytes );
@ -942,7 +942,7 @@ _mesa_pack_bitmap( GLint width, GLint height, const GLubyte *source,
if (!dst)
return;
if (packing->SkipPixels == 0) {
if ((packing->SkipPixels & 7) == 0) {
_mesa_memcpy( dst, src, width_in_bytes );
if (packing->LsbFirst) {
flip_bytes( dst, width_in_bytes );
@ -961,20 +961,20 @@ _mesa_pack_bitmap( GLint width, GLint height, const GLubyte *source,
if (*s & srcMask) {
*d |= dstMask;
}
if (srcMask == 128) {
srcMask = 1;
if (srcMask == 1) {
srcMask = 128;
s++;
}
else {
srcMask = srcMask << 1;
srcMask = srcMask >> 1;
}
if (dstMask == 1) {
dstMask = 128;
if (dstMask == 128) {
dstMask = 1;
d++;
*d = 0;
}
else {
dstMask = dstMask >> 1;
dstMask = dstMask << 1;
}
}
}
@ -3733,7 +3733,7 @@ _mesa_pack_stencil_span( const GLcontext *ctx, GLuint n,
switch (dstType) {
case GL_UNSIGNED_BYTE:
if (sizeof(GLstencil) == 8) {
if (sizeof(GLstencil) == 1) {
_mesa_memcpy( dest, source, n );
}
else {
@ -3745,14 +3745,11 @@ _mesa_pack_stencil_span( const GLcontext *ctx, GLuint n,
}
break;
case GL_BYTE:
if (sizeof(GLstencil) == 8) {
_mesa_memcpy( dest, source, n );
}
else {
{
GLbyte *dst = (GLbyte *) dest;
GLuint i;
for (i=0;i<n;i++) {
dst[i] = (GLbyte) source[i];
dst[i] = (GLbyte) (source[i] & 0x7f);
}
}
break;

View file

@ -575,7 +575,11 @@ _mesa_ffs(int i)
* if no bits set.
*/
int
#ifdef __MINGW32__
_mesa_ffsll(long val)
#else
_mesa_ffsll(long long val)
#endif
{
#ifdef ffsll
return ffsll(val);

View file

@ -700,7 +700,11 @@ extern int
_mesa_ffs(int i);
extern int
#ifdef __MINGW32__
_mesa_ffsll(long i);
#else
_mesa_ffsll(long long i);
#endif
extern unsigned int
_mesa_bitcount(unsigned int n);

View file

@ -5,7 +5,7 @@
/*
* Mesa 3-D graphics library
* Version: 7.0
* Version: 7.0.1
*
* Copyright (C) 1999-2007 Brian Paul All Rights Reserved.
*
@ -85,8 +85,13 @@ _mesa_PointParameteriNV( GLenum pname, GLint param )
void GLAPIENTRY
_mesa_PointParameterivNV( GLenum pname, const GLint *params )
{
const GLfloat value = (GLfloat) params[0];
_mesa_PointParameterfvEXT(pname, &value);
GLfloat p[3];
p[0] = (GLfloat) params[0];
if (pname == GL_DISTANCE_ATTENUATION_EXT) {
p[1] = (GLfloat) params[1];
p[2] = (GLfloat) params[2];
}
_mesa_PointParameterfvEXT(pname, p);
}

View file

@ -83,7 +83,7 @@ _mesa_CreateShader(GLenum type)
}
GLhandleARB APIENTRY
GLhandleARB GLAPIENTRY
_mesa_CreateShaderObjectARB(GLenum type)
{
GET_CURRENT_CONTEXT(ctx);
@ -99,7 +99,7 @@ _mesa_CreateProgram(void)
}
GLhandleARB APIENTRY
GLhandleARB GLAPIENTRY
_mesa_CreateProgramObjectARB(void)
{
GET_CURRENT_CONTEXT(ctx);
@ -319,7 +319,7 @@ _mesa_GetUniformivARB(GLhandleARB program, GLint location, GLint * params)
#if 0
GLint APIENTRY
GLint GLAPIENTRY
_mesa_GetUniformLocation(GLuint program, const GLcharARB *name)
{
GET_CURRENT_CONTEXT(ctx);
@ -336,7 +336,7 @@ _mesa_GetHandleARB(GLenum pname)
}
GLint APIENTRY
GLint GLAPIENTRY
_mesa_GetUniformLocationARB(GLhandleARB programObj, const GLcharARB *name)
{
GET_CURRENT_CONTEXT(ctx);

View file

@ -302,7 +302,12 @@ const struct gl_texture_format _mesa_texformat_rgba_fxt1 = {
#define FX64_NATIVE 1
#ifdef __MINGW32__
typedef unsigned long Fx64;
#else
typedef unsigned long long Fx64;
#endif
#define FX64_MOV32(a, b) a = b
#define FX64_OR32(a, b) a |= b

View file

@ -1386,7 +1386,7 @@ texture_error_check( GLcontext *ctx, GLenum target,
if (target == GL_PROXY_TEXTURE_1D || target == GL_TEXTURE_1D) {
proxy_target = GL_PROXY_TEXTURE_1D;
height = 1;
width = 1;
depth = 1;
}
else {
_mesa_error( ctx, GL_INVALID_ENUM, "glTexImage1D(target)" );

View file

@ -333,7 +333,7 @@ _mesa_clone_program(GLcontext *ctx, const struct gl_program *prog)
{
struct gl_program *clone;
clone = _mesa_new_program(ctx, prog->Target, prog->Id);
clone = ctx->Driver.NewProgram(ctx, prog->Target, prog->Id);
if (!clone)
return NULL;

View file

@ -780,7 +780,7 @@ _mesa_get_programiv(GLcontext *ctx, GLuint program,
*params = shProg->Validated;
break;
case GL_INFO_LOG_LENGTH:
*params = shProg->InfoLog ? strlen(shProg->InfoLog) : 0;
*params = shProg->InfoLog ? strlen(shProg->InfoLog) + 1 : 0;
break;
case GL_ATTACHED_SHADERS:
*params = shProg->NumShaders;
@ -832,10 +832,10 @@ _mesa_get_shaderiv(GLcontext *ctx, GLuint name, GLenum pname, GLint *params)
*params = shader->CompileStatus;
break;
case GL_INFO_LOG_LENGTH:
*params = shader->InfoLog ? strlen(shader->InfoLog) : 0;
*params = shader->InfoLog ? strlen(shader->InfoLog) + 1 : 0;
break;
case GL_SHADER_SOURCE_LENGTH:
*params = shader->Source ? strlen((char *) shader->Source) : 0;
*params = shader->Source ? strlen((char *) shader->Source) + 1 : 0;
break;
default:
_mesa_error(ctx, GL_INVALID_ENUM, "glGetShaderiv(pname)");

View file

@ -1,6 +1,6 @@
/*
* Mesa 3-D graphics library
* Version: 7.0.1
* Version: 7.1
*
* Copyright (C) 2005-2007 Brian Paul All Rights Reserved.
*
@ -37,13 +37,13 @@
#include "imports.h"
#include "macros.h"
#include "mtypes.h"
#include "program.h"
#include "prog_instruction.h"
#include "prog_parameter.h"
#include "prog_statevars.h"
#include "main/imports.h"
#include "main/macros.h"
#include "main/mtypes.h"
#include "shader/program.h"
#include "shader/prog_instruction.h"
#include "shader/prog_parameter.h"
#include "shader/prog_statevars.h"
#include "slang_typeinfo.h"
#include "slang_codegen.h"
#include "slang_compile.h"
@ -536,7 +536,7 @@ new_not(slang_ir_node *n)
static slang_ir_node *
new_inlined_function_call(slang_ir_node *code, slang_label *name)
{
slang_ir_node *n = new_node1(IR_FUNC, code);
slang_ir_node *n = new_node1(IR_CALL, code);
assert(name);
if (n)
n->Label = name;
@ -1202,17 +1202,29 @@ _slang_gen_function_call(slang_assemble_ctx *A, slang_function *fun,
/* non-assembly function */
inlined = slang_inline_function_call(A, fun, oper, dest);
if (inlined && _slang_find_node_type(inlined, SLANG_OPER_RETURN)) {
/* This inlined function has one or more 'return' statements.
slang_operation *callOper;
/* The function we're calling has one or more 'return' statements.
* So, we can't truly inline this function because we need to
* implement 'return' with RET (and CAL).
* Nevertheless, we performed "inlining" to make a new instance
* of the function body to deal with static register allocation.
*
* XXX check if there's one 'return' and if it's the very last
* statement in the function - we can optimize that case.
*/
assert(inlined->type == SLANG_OPER_BLOCK_NEW_SCOPE ||
inlined->type == SLANG_OPER_SEQUENCE);
inlined->type = SLANG_OPER_INLINED_CALL;
inlined->fun = fun;
inlined->label = _slang_label_new_unique((char*) fun->header.a_name);
if (_slang_function_has_return_value(fun) && !dest) {
assert(inlined->children[0].type == SLANG_OPER_VARIABLE_DECL);
assert(inlined->children[2].type == SLANG_OPER_IDENTIFIER);
callOper = &inlined->children[1];
}
else {
callOper = inlined;
}
callOper->type = SLANG_OPER_INLINED_CALL;
callOper->fun = fun;
callOper->label = _slang_label_new_unique((char*) fun->header.a_name);
}
}
@ -1949,8 +1961,7 @@ static slang_ir_node *
_slang_gen_return(slang_assemble_ctx * A, slang_operation *oper)
{
const GLboolean haveReturnValue
= (oper->num_children == 1 &&
oper->children[0].type != SLANG_OPER_VOID);
= (oper->num_children == 1 && oper->children[0].type != SLANG_OPER_VOID);
/* error checking */
assert(A->CurFunction);
@ -1960,7 +1971,7 @@ _slang_gen_return(slang_assemble_ctx * A, slang_operation *oper)
return NULL;
}
else if (!haveReturnValue &&
A->CurFunction->header.type.specifier.type != SLANG_SPEC_VOID) {
A->CurFunction->header.type.specifier.type != SLANG_SPEC_VOID) {
slang_info_log_error(A->log, "return statement requires an expression");
return NULL;
}
@ -2045,7 +2056,8 @@ _slang_gen_declaration(slang_assemble_ctx *A, slang_operation *oper)
}
/* XXX make copy of this initializer? */
rhs = _slang_gen_operation(A, &oper->children[0]);
assert(rhs);
if (!rhs)
return NULL; /* must have found an error */
init = new_node2(IR_MOVE, var, rhs);
/*assert(rhs->Opcode != IR_SEQ);*/
n = new_seq(varDecl, init);
@ -2236,7 +2248,9 @@ _slang_gen_assignment(slang_assemble_ctx * A, slang_operation *oper)
}
if (var->type.qualifier == SLANG_QUAL_CONST ||
var->type.qualifier == SLANG_QUAL_ATTRIBUTE ||
var->type.qualifier == SLANG_QUAL_UNIFORM) {
var->type.qualifier == SLANG_QUAL_UNIFORM ||
(var->type.qualifier == SLANG_QUAL_VARYING &&
A->program->Target == GL_FRAGMENT_PROGRAM_ARB)) {
slang_info_log_error(A->log,
"illegal assignment to read-only variable '%s'",
(char *) oper->children[0].a_id);
@ -2264,10 +2278,11 @@ _slang_gen_assignment(slang_assemble_ctx * A, slang_operation *oper)
lhs = _slang_gen_operation(A, &oper->children[0]);
if (lhs) {
if (lhs->Store->File != PROGRAM_OUTPUT &&
lhs->Store->File != PROGRAM_TEMPORARY &&
lhs->Store->File != PROGRAM_VARYING &&
lhs->Store->File != PROGRAM_UNDEFINED) {
if (!(lhs->Store->File == PROGRAM_OUTPUT ||
lhs->Store->File == PROGRAM_TEMPORARY ||
(lhs->Store->File == PROGRAM_VARYING &&
A->program->Target == GL_VERTEX_PROGRAM_ARB) ||
lhs->Store->File == PROGRAM_UNDEFINED)) {
slang_info_log_error(A->log,
"illegal assignment to read-only l-value");
return NULL;

View file

@ -2135,7 +2135,7 @@ _slang_compile(GLcontext *ctx, struct gl_shader *shader)
progTarget = GL_FRAGMENT_PROGRAM_ARB;
shader->Programs
= (struct gl_program **) malloc(sizeof(struct gl_program*));
shader->Programs[0] = _mesa_new_program(ctx, progTarget, 1);
shader->Programs[0] = ctx->Driver.NewProgram(ctx, progTarget, 1);
shader->NumPrograms = 1;
shader->Programs[0]->Parameters = _mesa_new_parameter_list();

View file

@ -36,13 +36,13 @@
***/
#include "imports.h"
#include "context.h"
#include "macros.h"
#include "program.h"
#include "prog_instruction.h"
#include "prog_parameter.h"
#include "prog_print.h"
#include "main/imports.h"
#include "main/context.h"
#include "main/macros.h"
#include "shader/program.h"
#include "shader/prog_instruction.h"
#include "shader/prog_parameter.h"
#include "shader/prog_print.h"
#include "slang_builtin.h"
#include "slang_emit.h"
#include "slang_mem.h"
@ -780,16 +780,18 @@ emit_label(slang_emit_info *emitInfo, const slang_ir_node *n)
/**
* Emit code for an inlined function call (subroutine).
* Emit code for a function call.
* Note that for each time a function is called, we emit the function's
* body code again because the set of available registers may be different.
*/
static struct prog_instruction *
emit_func(slang_emit_info *emitInfo, slang_ir_node *n)
emit_fcall(slang_emit_info *emitInfo, slang_ir_node *n)
{
struct gl_program *progSave;
struct prog_instruction *inst;
GLuint subroutineId;
assert(n->Opcode == IR_FUNC);
assert(n->Opcode == IR_CALL);
assert(n->Label);
/* save/push cur program */
@ -1687,10 +1689,10 @@ emit(slang_emit_info *emitInfo, slang_ir_node *n)
case IR_KILL:
return emit_kill(emitInfo);
case IR_FUNC:
/* new variable scope for subroutines/function calls*/
case IR_CALL:
/* new variable scope for subroutines/function calls */
_slang_push_var_table(emitInfo->vt);
inst = emit_func(emitInfo, n);
inst = emit_fcall(emitInfo, n);
_slang_pop_var_table(emitInfo->vt);
return inst;
@ -1782,7 +1784,7 @@ _slang_resolve_subroutines(slang_emit_info *emitInfo)
emitInfo->NumSubroutines = 0;
/* Examine CAL instructions.
* At this point, the BranchTarget field of the CAL instructions is
* At this point, the BranchTarget field of the CAL instruction is
* the number/id of the subroutine to call (an index into the
* emitInfo->Subroutines list).
* Translate that into an actual instruction location now.

View file

@ -27,7 +27,7 @@
#include "context.h"
#include "slang_ir.h"
#include "slang_mem.h"
#include "prog_print.h"
#include "shader/prog_print.h"
static const slang_ir_info IrInfo[] = {
@ -311,7 +311,7 @@ _slang_print_ir_tree(const slang_ir_node *n, int indent)
printf("RETURN\n");
break;
case IR_CALL:
printf("CALL\n");
printf("CALL %s\n", n->Label->Name);
break;
case IR_LOOP:

View file

@ -62,8 +62,6 @@ typedef enum
IR_RETURN, /* return from subroutine */
IR_CALL, /* call subroutine */
IR_FUNC, /* inlined function code */
IR_LOOP, /* high-level loop-begin / loop-end */
/* Children[0] = loop body */
/* Children[1] = loop tail code, or NULL */

View file

@ -329,8 +329,10 @@ _slang_resolve_attributes(struct gl_shader_program *shProg,
* glVertex/position.
*/
for (attr = 1; attr < MAX_VERTEX_ATTRIBS; attr++) {
if (((1 << attr) & usedAttributes) == 0)
if (((1 << attr) & usedAttributes) == 0) {
usedAttributes |= (1 << attr);
break;
}
}
if (attr == MAX_VERTEX_ATTRIBS) {
/* too many! XXX record error log */