diff options
Diffstat (limited to 'src/mesa/state_tracker')
22 files changed, 88 insertions, 70 deletions
diff --git a/src/mesa/state_tracker/st_atom_texture.c b/src/mesa/state_tracker/st_atom_texture.c index 18ffc08c6b..21f7321f97 100644 --- a/src/mesa/state_tracker/st_atom_texture.c +++ b/src/mesa/state_tracker/st_atom_texture.c @@ -53,7 +53,7 @@ update_textures(struct st_context *st) st->state.num_textures = 0; /* loop over sampler units (aka tex image units) */ - for (su = 0; su < st->ctx->Const.MaxTextureCoordUnits; su++) { + for (su = 0; su < st->ctx->Const.MaxTextureImageUnits; su++) { struct pipe_texture *pt = NULL; if (samplersUsed & (1 << su)) { diff --git a/src/mesa/state_tracker/st_cb_rasterpos.c b/src/mesa/state_tracker/st_cb_rasterpos.c index 3eaccb74e1..8867ca5652 100644 --- a/src/mesa/state_tracker/st_cb_rasterpos.c +++ b/src/mesa/state_tracker/st_cb_rasterpos.c @@ -162,7 +162,7 @@ rastpos_point(struct draw_stage *stage, struct prim_header *prim) ctx->Current.RasterSecondaryColor, VERT_RESULT_COL1, VERT_ATTRIB_COLOR1); - for (i = 0; i < MAX_TEXTURE_UNITS; i++) { + for (i = 0; i < ctx->Const.MaxTextureCoordUnits; i++) { update_attrib(ctx, outputMapping, prim->v[0], ctx->Current.RasterTexCoords[i], VERT_RESULT_TEX0 + i, VERT_ATTRIB_TEX0 + i); diff --git a/src/mesa/state_tracker/st_extensions.c b/src/mesa/state_tracker/st_extensions.c index 5ff0c61147..8ec2113f07 100644 --- a/src/mesa/state_tracker/st_extensions.c +++ b/src/mesa/state_tracker/st_extensions.c @@ -84,14 +84,18 @@ void st_init_limits(struct st_context *st) c->MaxTextureRectSize = _min(1 << (c->MaxTextureLevels - 1), MAX_TEXTURE_RECT_SIZE); - c->MaxTextureUnits - = c->MaxTextureImageUnits - = c->MaxTextureCoordUnits + c->MaxTextureImageUnits = _min(screen->get_param(screen, PIPE_CAP_MAX_TEXTURE_IMAGE_UNITS), MAX_TEXTURE_IMAGE_UNITS); c->MaxVertexTextureImageUnits - = screen->get_param(screen, PIPE_CAP_MAX_VERTEX_TEXTURE_UNITS); + = _min(screen->get_param(screen, PIPE_CAP_MAX_VERTEX_TEXTURE_UNITS), + MAX_VERTEX_TEXTURE_IMAGE_UNITS); + + c->MaxTextureCoordUnits + = _min(c->MaxTextureImageUnits, MAX_TEXTURE_COORD_UNITS); + + c->MaxTextureUnits = _min(c->MaxTextureImageUnits, c->MaxTextureCoordUnits); c->MaxDrawBuffers = _clamp(screen->get_param(screen, PIPE_CAP_MAX_RENDER_TARGETS), diff --git a/src/mesa/state_tracker/st_framebuffer.c b/src/mesa/state_tracker/st_framebuffer.c index 43ac195e67..ea22a94303 100644 --- a/src/mesa/state_tracker/st_framebuffer.c +++ b/src/mesa/state_tracker/st_framebuffer.c @@ -170,7 +170,6 @@ st_set_framebuffer_surface(struct st_framebuffer *stfb, uint surfIndex, struct pipe_surface *surf) { GET_CURRENT_CONTEXT(ctx); - struct st_context *st; static const GLuint invalid_size = 9999999; struct st_renderbuffer *strb; GLuint width, height, i; diff --git a/src/mesa/state_tracker/st_mesa_to_tgsi.c b/src/mesa/state_tracker/st_mesa_to_tgsi.c index ce8b441194..5b5707fa1c 100644 --- a/src/mesa/state_tracker/st_mesa_to_tgsi.c +++ b/src/mesa/state_tracker/st_mesa_to_tgsi.c @@ -745,6 +745,7 @@ find_temporaries(const struct gl_program *program, */ GLuint st_translate_mesa_program( + GLcontext *ctx, uint procType, const struct gl_program *program, GLuint numInputs, @@ -992,7 +993,7 @@ st_translate_mesa_program( } /* texture samplers */ - for (i = 0; i < 8; i++) { + for (i = 0; i < ctx->Const.MaxTextureImageUnits; i++) { if (program->SamplersUsed & (1 << i)) { struct tgsi_full_declaration fulldecl; diff --git a/src/mesa/state_tracker/st_mesa_to_tgsi.h b/src/mesa/state_tracker/st_mesa_to_tgsi.h index 7b2bee1ab7..b465b3bddc 100644 --- a/src/mesa/state_tracker/st_mesa_to_tgsi.h +++ b/src/mesa/state_tracker/st_mesa_to_tgsi.h @@ -41,6 +41,7 @@ struct gl_program; GLuint st_translate_mesa_program( + GLcontext *ctx, uint procType, const struct gl_program *program, GLuint numInputs, diff --git a/src/mesa/state_tracker/st_program.c b/src/mesa/state_tracker/st_program.c index cf4b39cee4..442eeed147 100644 --- a/src/mesa/state_tracker/st_program.c +++ b/src/mesa/state_tracker/st_program.c @@ -317,7 +317,8 @@ st_translate_vertex_program(struct st_context *st, /* XXX: fix static allocation of tokens: */ - num_tokens = st_translate_mesa_program(TGSI_PROCESSOR_VERTEX, + num_tokens = st_translate_mesa_program(st->ctx, + TGSI_PROCESSOR_VERTEX, &stvp->Base.Base, /* inputs */ vs_num_inputs, @@ -503,7 +504,8 @@ st_translate_fragment_program(struct st_context *st, /* XXX: fix static allocation of tokens: */ - num_tokens = st_translate_mesa_program(TGSI_PROCESSOR_FRAGMENT, + num_tokens = st_translate_mesa_program(st->ctx, + TGSI_PROCESSOR_FRAGMENT, &stfp->Base.Base, /* inputs */ fs_num_inputs, diff --git a/src/mesa/state_tracker/wgl/SConscript b/src/mesa/state_tracker/wgl/SConscript index cceb8264ea..bb579930f5 100644 --- a/src/mesa/state_tracker/wgl/SConscript +++ b/src/mesa/state_tracker/wgl/SConscript @@ -11,8 +11,9 @@ if env['platform'] in ['windows']: ]) env.Append(CPPDEFINES = [ + '_GDI32_', # prevent wgl* being declared __declspec(dllimport) + 'BUILD_GL32', # declare gl* as __declspec(dllexport) in Mesa headers '__GL_EXPORTS', - 'BUILD_GL32', '_GNU_H_WINDOWS32_DEFINES', ]) diff --git a/src/mesa/state_tracker/wgl/stw_device.c b/src/mesa/state_tracker/wgl/stw_device.c index 52907f1a79..e2a17d83ac 100644 --- a/src/mesa/state_tracker/wgl/stw_device.c +++ b/src/mesa/state_tracker/wgl/stw_device.c @@ -37,8 +37,8 @@ struct stw_device *stw_dev = NULL; -static BOOL -st_init(void) +boolean +st_init(const struct stw_winsys *stw_winsys) { static struct stw_device stw_dev_storage; @@ -47,7 +47,9 @@ st_init(void) stw_dev = &stw_dev_storage; memset(stw_dev, 0, sizeof(*stw_dev)); - stw_dev->screen = stw_winsys.create_screen(); + stw_dev->stw_winsys = stw_winsys; + + stw_dev->screen = stw_winsys->create_screen(); if(!stw_dev->screen) goto error1; @@ -61,7 +63,7 @@ error1: } -static void +void st_cleanup(void) { DHGLRC dhglrc; @@ -76,18 +78,3 @@ st_cleanup(void) stw_dev = NULL; } - - -BOOL WINAPI -DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpReserved) -{ - switch (fdwReason) { - case DLL_PROCESS_ATTACH: - return st_init(); - - case DLL_PROCESS_DETACH: - st_cleanup(); - break; - } - return TRUE; -} diff --git a/src/mesa/state_tracker/wgl/stw_device.h b/src/mesa/state_tracker/wgl/stw_device.h index 49f79ac9c7..e2020bf055 100644 --- a/src/mesa/state_tracker/wgl/stw_device.h +++ b/src/mesa/state_tracker/wgl/stw_device.h @@ -44,6 +44,8 @@ struct drv_context struct stw_device { + const struct stw_winsys *stw_winsys; + struct pipe_screen *screen; struct drv_context ctx_array[DRV_CONTEXT_MAX]; diff --git a/src/mesa/state_tracker/wgl/stw_framebuffer.c b/src/mesa/state_tracker/wgl/stw_framebuffer.c index 57b89eee96..1ecafa451e 100644 --- a/src/mesa/state_tracker/wgl/stw_framebuffer.c +++ b/src/mesa/state_tracker/wgl/stw_framebuffer.c @@ -25,9 +25,8 @@ * **************************************************************************/ -#define _GDI32_ - #include <windows.h> + #include "main/context.h" #include "pipe/p_format.h" #include "state_tracker/st_context.h" diff --git a/src/mesa/state_tracker/wgl/stw_icd.c b/src/mesa/state_tracker/wgl/stw_icd.c index 17bdbd15fa..1dddc24209 100644 --- a/src/mesa/state_tracker/wgl/stw_icd.c +++ b/src/mesa/state_tracker/wgl/stw_icd.c @@ -29,12 +29,12 @@ #include <stdio.h> #include "GL/gl.h" -#include "GL/mesa_wgl.h" #include "pipe/p_debug.h" #include "stw_device.h" #include "stw_icd.h" +#include "stw_wgl.h" static HGLRC diff --git a/src/mesa/state_tracker/wgl/stw_icd.h b/src/mesa/state_tracker/wgl/stw_icd.h index 7e2edca16e..8e676fb5b7 100644 --- a/src/mesa/state_tracker/wgl/stw_icd.h +++ b/src/mesa/state_tracker/wgl/stw_icd.h @@ -31,9 +31,7 @@ #include <windows.h> - #include "GL/gl.h" -#include "GL/mesa_wgl.h" typedef ULONG DHGLRC; diff --git a/src/mesa/state_tracker/wgl/stw_wgl.c b/src/mesa/state_tracker/wgl/stw_wgl.c index 6cace95745..0528c369fc 100644 --- a/src/mesa/state_tracker/wgl/stw_wgl.c +++ b/src/mesa/state_tracker/wgl/stw_wgl.c @@ -25,8 +25,6 @@ * **************************************************************************/ -#define _GDI32_ - #include <windows.h> #include "pipe/p_debug.h" diff --git a/src/mesa/state_tracker/wgl/stw_wgl_pixelformat.h b/src/mesa/state_tracker/wgl/stw_wgl.h index ee875c7a1d..b86cc240f2 100644 --- a/src/mesa/state_tracker/wgl/stw_wgl_pixelformat.h +++ b/src/mesa/state_tracker/wgl/stw_wgl.h @@ -1,8 +1,8 @@ /************************************************************************** - * - * Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas. + * + * 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 @@ -10,26 +10,54 @@ * distribute, sub license, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: - * + * * The above copyright notice and this permission notice (including the * next paragraph) shall be included in all copies or substantial portions * of the Software. - * + * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. - * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR + * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * + * **************************************************************************/ -#ifndef WGL_PIXELFORMAT_H -#define WGL_PIXELFORMAT_H +#ifndef STW_WGL_H_ +#define STW_WGL_H_ -WINGDIAPI int APIENTRY -wglGetPixelFormat( - HDC hdc ); -#endif /* WGL_PIXELFORMAT_H */ +#include <windows.h> + +#include "GL/gl.h" + + +/* + * Undeclared APIs exported by opengl32.dll + */ + +WINGDIAPI BOOL WINAPI +wglSwapBuffers(HDC hdc); + +WINGDIAPI int WINAPI +wglChoosePixelFormat(HDC hdc, + CONST PIXELFORMATDESCRIPTOR *ppfd); + +WINGDIAPI int WINAPI +wglDescribePixelFormat(HDC hdc, + int iPixelFormat, + UINT nBytes, + LPPIXELFORMATDESCRIPTOR ppfd); + +WINGDIAPI int WINAPI +wglGetPixelFormat(HDC hdc); + +WINGDIAPI BOOL WINAPI +wglSetPixelFormat(HDC hdc, + int iPixelFormat, + CONST PIXELFORMATDESCRIPTOR *ppfd); + + +#endif /* STW_WGL_H_ */ diff --git a/src/mesa/state_tracker/wgl/stw_wgl_arbextensionsstring.c b/src/mesa/state_tracker/wgl/stw_wgl_arbextensionsstring.c index fe3a3c1daa..04865796ec 100644 --- a/src/mesa/state_tracker/wgl/stw_wgl_arbextensionsstring.c +++ b/src/mesa/state_tracker/wgl/stw_wgl_arbextensionsstring.c @@ -25,9 +25,8 @@ * **************************************************************************/ -#define _GDI32_ - #include <windows.h> + #include "stw_wgl_arbextensionsstring.h" WINGDIAPI const char * APIENTRY diff --git a/src/mesa/state_tracker/wgl/stw_wgl_arbpixelformat.c b/src/mesa/state_tracker/wgl/stw_wgl_arbpixelformat.c index 14a7c5e1e0..344bb15d3c 100644 --- a/src/mesa/state_tracker/wgl/stw_wgl_arbpixelformat.c +++ b/src/mesa/state_tracker/wgl/stw_wgl_arbpixelformat.c @@ -25,8 +25,6 @@ * **************************************************************************/ -#define _GDI32_ - #include <windows.h> #include "pipe/p_compiler.h" diff --git a/src/mesa/state_tracker/wgl/stw_wgl_context.c b/src/mesa/state_tracker/wgl/stw_wgl_context.c index 59b47200be..0c13c6b68a 100644 --- a/src/mesa/state_tracker/wgl/stw_wgl_context.c +++ b/src/mesa/state_tracker/wgl/stw_wgl_context.c @@ -25,8 +25,6 @@ * **************************************************************************/ -#define _GDI32_ - #include <windows.h> #include "main/mtypes.h" @@ -41,7 +39,7 @@ #include "stw_pixelformat.h" #include "stw_wgl_arbmultisample.h" #include "stw_wgl_context.h" -#include "stw_wgl_pixelformat.h" +#include "stw_wgl.h" static struct wgl_context *ctx_head = NULL; @@ -107,7 +105,7 @@ wglCreateContext( return NULL; } - pipe = stw_winsys.create_context( stw_dev->screen ); + pipe = stw_dev->stw_winsys->create_context( stw_dev->screen ); if (!pipe) { _mesa_destroy_visual( visual ); FREE( ctx ); diff --git a/src/mesa/state_tracker/wgl/stw_wgl_getprocaddress.c b/src/mesa/state_tracker/wgl/stw_wgl_getprocaddress.c index ec4f1513cb..ec92d2dfce 100644 --- a/src/mesa/state_tracker/wgl/stw_wgl_getprocaddress.c +++ b/src/mesa/state_tracker/wgl/stw_wgl_getprocaddress.c @@ -25,9 +25,8 @@ * **************************************************************************/ -#define _GDI32_ - #include <windows.h> + #include "glapi/glapi.h" #include "stw_wgl_arbextensionsstring.h" #include "stw_wgl_arbpixelformat.h" diff --git a/src/mesa/state_tracker/wgl/stw_wgl_pixelformat.c b/src/mesa/state_tracker/wgl/stw_wgl_pixelformat.c index bfc085093a..7a8a2e22e4 100644 --- a/src/mesa/state_tracker/wgl/stw_wgl_pixelformat.c +++ b/src/mesa/state_tracker/wgl/stw_wgl_pixelformat.c @@ -25,14 +25,12 @@ * **************************************************************************/ -#define _GDI32_ - #include <windows.h> #include "pipe/p_compiler.h" #include "pipe/p_debug.h" #include "stw_pixelformat.h" -#include "stw_wgl_pixelformat.h" +#include "stw_wgl.h" static uint currentpixelformat = 0; diff --git a/src/mesa/state_tracker/wgl/stw_wgl_swapbuffers.c b/src/mesa/state_tracker/wgl/stw_wgl_swapbuffers.c index a4dffc5fa0..bd86501ac0 100644 --- a/src/mesa/state_tracker/wgl/stw_wgl_swapbuffers.c +++ b/src/mesa/state_tracker/wgl/stw_wgl_swapbuffers.c @@ -25,9 +25,8 @@ * **************************************************************************/ -#define _GDI32_ - #include <windows.h> + #include "pipe/p_winsys.h" #include "pipe/p_screen.h" #include "pipe/p_context.h" @@ -36,7 +35,7 @@ #include "stw_winsys.h" #include "stw_device.h" #include "stw_framebuffer.h" -#include "stw_wgl_context.h" +#include "stw_wgl.h" WINGDIAPI BOOL APIENTRY wglSwapBuffers( @@ -56,9 +55,9 @@ wglSwapBuffers( surf = st_get_framebuffer_surface( fb->stfb, ST_SURFACE_BACK_LEFT ); - stw_winsys.flush_frontbuffer(stw_dev->screen->winsys, - surf, - hdc ); + stw_dev->stw_winsys->flush_frontbuffer(stw_dev->screen->winsys, + surf, + hdc ); return TRUE; } diff --git a/src/mesa/state_tracker/wgl/stw_winsys.h b/src/mesa/state_tracker/wgl/stw_winsys.h index 68f1c7b16b..8557327ccd 100644 --- a/src/mesa/state_tracker/wgl/stw_winsys.h +++ b/src/mesa/state_tracker/wgl/stw_winsys.h @@ -30,9 +30,12 @@ #include <windows.h> /* for HDC */ +#include "pipe/p_compiler.h" + struct pipe_screen; struct pipe_context; struct pipe_winsys; +struct pipe_surface; struct stw_winsys { @@ -48,6 +51,10 @@ struct stw_winsys HDC hDC ); }; -extern const struct stw_winsys stw_winsys; +boolean +st_init(const struct stw_winsys *stw_winsys); + +void +st_cleanup(void); #endif /* STW_WINSYS_H */ |