[PATCH 2/5] wined3d: Introduce a separate structure for various OpenGL implementation limits.

Henri Verbeet hverbeet at codeweavers.com
Thu Oct 29 04:37:10 CDT 2009


---
 dlls/wined3d/arb_program_shader.c    |   34 +++---
 dlls/wined3d/ati_fragment_shader.c   |    8 +-
 dlls/wined3d/context.c               |   28 ++--
 dlls/wined3d/device.c                |   28 ++--
 dlls/wined3d/directx.c               |  216 ++++++++++++++++++----------------
 dlls/wined3d/drawprim.c              |    6 +-
 dlls/wined3d/glsl_shader.c           |   49 ++++----
 dlls/wined3d/nvidia_texture_shader.c |   12 +-
 dlls/wined3d/pixelshader.c           |    6 +-
 dlls/wined3d/state.c                 |   74 ++++++------
 dlls/wined3d/stateblock.c            |    4 +-
 dlls/wined3d/surface.c               |    2 +-
 dlls/wined3d/utils.c                 |   13 +-
 dlls/wined3d/wined3d_gl.h            |   69 ++++++-----
 14 files changed, 284 insertions(+), 265 deletions(-)

diff --git a/dlls/wined3d/arb_program_shader.c b/dlls/wined3d/arb_program_shader.c
index ec2b005..49df9cb 100644
--- a/dlls/wined3d/arb_program_shader.c
+++ b/dlls/wined3d/arb_program_shader.c
@@ -629,13 +629,13 @@ static DWORD shader_generate_arb_declarations(IWineD3DBaseShader *iface, const s
      */
     if (pshader)
     {
-        max_constantsF = gl_info->max_ps_arb_native_constants;
+        max_constantsF = gl_info->limits.arb_ps_native_constants;
     }
     else
     {
         if(This->baseShader.reg_maps.usesrelconstF) {
             DWORD highest_constf = 0, clip_limit;
-            max_constantsF = gl_info->max_vs_arb_native_constants - reserved_vs_const(iface, gl_info);
+            max_constantsF = gl_info->limits.arb_vs_native_constants - reserved_vs_const(iface, gl_info);
             max_constantsF -= count_bits(This->baseShader.reg_maps.integer_constants);
 
             for(i = 0; i < This->baseShader.limits.constant_float; i++)
@@ -647,7 +647,7 @@ static DWORD shader_generate_arb_declarations(IWineD3DBaseShader *iface, const s
 
             if(use_nv_clip(gl_info) && ctx->target_version >= NV2)
             {
-                clip_limit = gl_info->max_clipplanes;
+                clip_limit = gl_info->limits.clipplanes;
             }
             else
             {
@@ -658,14 +658,14 @@ static DWORD shader_generate_arb_declarations(IWineD3DBaseShader *iface, const s
             max_constantsF -= *num_clipplanes;
             if(*num_clipplanes < clip_limit)
             {
-                WARN("Only %u clipplanes out of %u enabled\n", *num_clipplanes, gl_info->max_clipplanes);
+                WARN("Only %u clipplanes out of %u enabled\n", *num_clipplanes, gl_info->limits.clipplanes);
             }
         }
         else
         {
-            if (ctx->target_version >= NV2) *num_clipplanes = gl_info->max_clipplanes;
-            else *num_clipplanes = min(gl_info->max_clipplanes, 4);
-            max_constantsF = gl_info->max_vs_arb_native_constants;
+            if (ctx->target_version >= NV2) *num_clipplanes = gl_info->limits.clipplanes;
+            else *num_clipplanes = min(gl_info->limits.clipplanes, 4);
+            max_constantsF = gl_info->limits.arb_vs_native_constants;
         }
     }
 
@@ -703,11 +703,11 @@ static DWORD shader_generate_arb_declarations(IWineD3DBaseShader *iface, const s
      */
     if(pshader)
     {
-        max_constantsF = min(max_constantsF, gl_info->max_ps_arb_constantsF);
+        max_constantsF = min(max_constantsF, gl_info->limits.arb_ps_float_constants);
     }
     else
     {
-        max_constantsF = min(max_constantsF, gl_info->max_vs_arb_constantsF);
+        max_constantsF = min(max_constantsF, gl_info->limits.arb_vs_float_constants);
     }
 
     /* Avoid declaring more constants than needed */
@@ -2951,7 +2951,7 @@ static void vshader_add_footer(IWineD3DVertexShaderImpl *This, struct wined3d_sh
         unsigned int cur_clip = 0;
         char component[4] = {'x', 'y', 'z', 'w'};
 
-        for (i = 0; i < gl_info->max_clipplanes; ++i)
+        for (i = 0; i < gl_info->limits.clipplanes; ++i)
         {
             if(args->boolclip.clipplane_mask & (1 << i))
             {
@@ -3493,7 +3493,7 @@ static GLuint shader_arb_generate_pshader(IWineD3DPixelShaderImpl *This, struct
 
         struct arb_ps_np2fixup_info* const fixup = priv_ctx.cur_np2fixup_info;
         const WORD map = priv_ctx.cur_ps_args->super.np2_fixup;
-        const UINT max_lconsts = gl_info->max_ps_arb_local_constants;
+        const UINT max_lconsts = gl_info->limits.arb_ps_local_constants;
 
         fixup->offset = next_local;
         fixup->super.active = 0;
@@ -4010,7 +4010,7 @@ static struct arb_ps_compiled_shader *find_arb_pshader(IWineD3DPixelShaderImpl *
 
         if (!device->vs_clipping)
             shader_data->clipplane_emulation = shader_find_free_input_register(&shader->baseShader.reg_maps,
-                    gl_info->max_texture_stages - 1);
+                    gl_info->limits.texture_stages - 1);
         else
             shader_data->clipplane_emulation = ~0U;
     }
@@ -4219,7 +4219,7 @@ static inline void find_arb_vs_compile_args(IWineD3DVertexShaderImpl *shader, IW
         args->ps_signature = ~0;
         if(!dev->vs_clipping)
         {
-            args->boolclip.clip_texcoord = ffp_clip_emul(stateblock) ? gl_info->max_texture_stages : 0;
+            args->boolclip.clip_texcoord = ffp_clip_emul(stateblock) ? gl_info->limits.texture_stages : 0;
         }
         /* Otherwise: Setting boolclip_compare set clip_texcoord to 0 */
     }
@@ -4542,8 +4542,8 @@ static BOOL shader_arb_dirty_const(IWineD3DDevice *iface) {
 static void shader_arb_get_caps(WINED3DDEVTYPE devtype, const struct wined3d_gl_info *gl_info,
         struct shader_caps *pCaps)
 {
-    DWORD vs_consts = min(gl_info->max_vs_arb_constantsF, gl_info->max_vs_arb_native_constants);
-    DWORD ps_consts = min(gl_info->max_ps_arb_constantsF, gl_info->max_ps_arb_native_constants);
+    DWORD vs_consts = min(gl_info->limits.arb_vs_float_constants, gl_info->limits.arb_vs_native_constants);
+    DWORD ps_consts = min(gl_info->limits.arb_ps_float_constants, gl_info->limits.arb_ps_native_constants);
 
     /* We don't have an ARB fixed function pipeline yet, so let the none backend set its caps,
      * then overwrite the shader specific ones
@@ -5232,7 +5232,7 @@ static void arbfp_get_caps(WINED3DDEVTYPE devtype, const struct wined3d_gl_info
     /* TODO: Implement WINED3DTEXOPCAPS_PREMODULATE */
 
     caps->MaxTextureBlendStages   = 8;
-    caps->MaxSimultaneousTextures = min(gl_info->max_fragment_samplers, 8);
+    caps->MaxSimultaneousTextures = min(gl_info->limits.fragment_samplers, 8);
 
     caps->PrimitiveMiscCaps |= WINED3DPMISCCAPS_TSSARGTEMP;
 }
@@ -5886,7 +5886,7 @@ static void fragment_prog_arbfp(DWORD state, IWineD3DStateBlockImpl *stateblock,
                 return;
             }
             new_desc->num_textures_used = 0;
-            for (i = 0; i < context->gl_info->max_texture_stages; ++i)
+            for (i = 0; i < context->gl_info->limits.texture_stages; ++i)
             {
                 if(settings.op[i].cop == WINED3DTOP_DISABLE) break;
                 new_desc->num_textures_used = i;
diff --git a/dlls/wined3d/ati_fragment_shader.c b/dlls/wined3d/ati_fragment_shader.c
index 50d288f..014bf1d 100644
--- a/dlls/wined3d/ati_fragment_shader.c
+++ b/dlls/wined3d/ati_fragment_shader.c
@@ -402,7 +402,7 @@ static GLuint gen_ati_shader(const struct texture_stage_op op[MAX_TEXTURES], con
     checkGLcall("GL_EXTCALL(glBeginFragmentShaderATI())");
 
     /* Pass 1: Generate sampling instructions for perturbation maps */
-    for (stage = 0; stage < gl_info->max_textures; ++stage)
+    for (stage = 0; stage < gl_info->limits.textures; ++stage)
     {
         if(op[stage].cop == WINED3DTOP_DISABLE) break;
         if(op[stage].cop != WINED3DTOP_BUMPENVMAP &&
@@ -428,7 +428,7 @@ static GLuint gen_ati_shader(const struct texture_stage_op op[MAX_TEXTURES], con
     }
 
     /* Pass 2: Generate perturbation calculations */
-    for (stage = 0; stage < gl_info->max_textures; ++stage)
+    for (stage = 0; stage < gl_info->limits.textures; ++stage)
     {
         GLuint argmodextra_x, argmodextra_y;
         struct color_fixup_desc fixup;
@@ -477,7 +477,7 @@ static GLuint gen_ati_shader(const struct texture_stage_op op[MAX_TEXTURES], con
     }
 
     /* Pass 3: Generate sampling instructions for regular textures */
-    for (stage = 0; stage < gl_info->max_textures; ++stage)
+    for (stage = 0; stage < gl_info->limits.textures; ++stage)
     {
         if(op[stage].cop == WINED3DTOP_DISABLE) {
             break;
@@ -818,7 +818,7 @@ static void set_tex_op_atifs(DWORD state, IWineD3DStateBlockImpl *stateblock, st
             return;
         }
         new_desc->num_textures_used = 0;
-        for (i = 0; i < context->gl_info->max_texture_stages; ++i)
+        for (i = 0; i < context->gl_info->limits.texture_stages; ++i)
         {
             if(settings.op[i].cop == WINED3DTOP_DISABLE) break;
             new_desc->num_textures_used = i;
diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c
index 7dc7c0e..3b5eea5 100644
--- a/dlls/wined3d/context.c
+++ b/dlls/wined3d/context.c
@@ -88,7 +88,7 @@ static void context_clean_fbo_attachments(const struct wined3d_gl_info *gl_info)
 {
     unsigned int i;
 
-    for (i = 0; i < gl_info->max_buffers; ++i)
+    for (i = 0; i < gl_info->limits.buffers; ++i)
     {
         gl_info->fbo_ops.glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0 + i, GL_TEXTURE_2D, 0, 0);
         checkGLcall("glFramebufferTexture2D()");
@@ -295,7 +295,7 @@ static void context_check_fbo_status(struct wined3d_context *context)
         }
 
         /* Dump the FBO attachments */
-        for (i = 0; i < gl_info->max_buffers; ++i)
+        for (i = 0; i < gl_info->limits.buffers; ++i)
         {
             attachment = (IWineD3DSurfaceImpl *)context->current_fbo->render_targets[i];
             if (attachment)
@@ -322,8 +322,8 @@ static struct fbo_entry *context_create_fbo_entry(struct wined3d_context *contex
     struct fbo_entry *entry;
 
     entry = HeapAlloc(GetProcessHeap(), 0, sizeof(*entry));
-    entry->render_targets = HeapAlloc(GetProcessHeap(), 0, gl_info->max_buffers * sizeof(*entry->render_targets));
-    memcpy(entry->render_targets, device->render_targets, gl_info->max_buffers * sizeof(*entry->render_targets));
+    entry->render_targets = HeapAlloc(GetProcessHeap(), 0, gl_info->limits.buffers * sizeof(*entry->render_targets));
+    memcpy(entry->render_targets, device->render_targets, gl_info->limits.buffers * sizeof(*entry->render_targets));
     entry->depth_stencil = device->stencilBufferTarget;
     entry->attached = FALSE;
     entry->id = 0;
@@ -340,7 +340,7 @@ static void context_reuse_fbo_entry(struct wined3d_context *context, struct fbo_
     context_bind_fbo(context, GL_FRAMEBUFFER, &entry->id);
     context_clean_fbo_attachments(gl_info);
 
-    memcpy(entry->render_targets, device->render_targets, gl_info->max_buffers * sizeof(*entry->render_targets));
+    memcpy(entry->render_targets, device->render_targets, gl_info->limits.buffers * sizeof(*entry->render_targets));
     entry->depth_stencil = device->stencilBufferTarget;
     entry->attached = FALSE;
 }
@@ -370,7 +370,7 @@ static struct fbo_entry *context_find_fbo_entry(struct wined3d_context *context)
     LIST_FOR_EACH_ENTRY(entry, &context->fbo_list, struct fbo_entry, entry)
     {
         if (!memcmp(entry->render_targets,
-                device->render_targets, gl_info->max_buffers * sizeof(*entry->render_targets))
+                device->render_targets, gl_info->limits.buffers * sizeof(*entry->render_targets))
                 && entry->depth_stencil == device->stencilBufferTarget)
         {
             list_remove(&entry->entry);
@@ -408,7 +408,7 @@ static void context_apply_fbo_entry(struct wined3d_context *context, struct fbo_
     if (!entry->attached)
     {
         /* Apply render targets */
-        for (i = 0; i < gl_info->max_buffers; ++i)
+        for (i = 0; i < gl_info->limits.buffers; ++i)
         {
             IWineD3DSurface *render_target = device->render_targets[i];
             context_attach_surface_fbo(context, GL_FRAMEBUFFER, i, render_target);
@@ -428,7 +428,7 @@ static void context_apply_fbo_entry(struct wined3d_context *context, struct fbo_
     }
     else
     {
-        for (i = 0; i < gl_info->max_buffers; ++i)
+        for (i = 0; i < gl_info->limits.buffers; ++i)
         {
             if (device->render_targets[i])
                 context_apply_attachment_filter_states(device->render_targets[i], FALSE);
@@ -437,7 +437,7 @@ static void context_apply_fbo_entry(struct wined3d_context *context, struct fbo_
             context_apply_attachment_filter_states(device->stencilBufferTarget, FALSE);
     }
 
-    for (i = 0; i < gl_info->max_buffers; ++i)
+    for (i = 0; i < gl_info->limits.buffers; ++i)
     {
         if (device->render_targets[i])
             device->draw_buffers[i] = GL_COLOR_ATTACHMENT0 + i;
@@ -621,7 +621,7 @@ void context_resource_released(IWineD3DDevice *iface, IWineD3DResource *resource
                         continue;
                     }
 
-                    for (j = 0; j < gl_info->max_buffers; ++j)
+                    for (j = 0; j < gl_info->limits.buffers; ++j)
                     {
                         if (entry->render_targets[j] == (IWineD3DSurface *)resource)
                         {
@@ -1434,7 +1434,7 @@ struct wined3d_context *context_create(IWineD3DDeviceImpl *This, IWineD3DSurface
         /* Set up the previous texture input for all shader units. This applies to bump mapping, and in d3d
          * the previous texture where to source the offset from is always unit - 1.
          */
-        for (s = 1; s < gl_info->max_textures; ++s)
+        for (s = 1; s < gl_info->limits.textures; ++s)
         {
             GL_EXTCALL(glActiveTextureARB(GL_TEXTURE0_ARB + s));
             glTexEnvi(GL_TEXTURE_SHADER_NV, GL_PREVIOUS_TEXTURE_INPUT_NV, GL_TEXTURE0_ARB + s - 1);
@@ -1460,7 +1460,7 @@ struct wined3d_context *context_create(IWineD3DDeviceImpl *This, IWineD3DSurface
         GL_EXTCALL(glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, strlen(dummy_program), dummy_program));
     }
 
-    for (s = 0; s < gl_info->max_point_sprite_units; ++s)
+    for (s = 0; s < gl_info->limits.point_sprite_units; ++s)
     {
         GL_EXTCALL(glActiveTextureARB(GL_TEXTURE0_ARB + s));
         glTexEnvi(GL_POINT_SPRITE_ARB, GL_COORD_REPLACE_ARB, GL_TRUE);
@@ -1667,7 +1667,7 @@ static inline void SetupForBlit(IWineD3DDeviceImpl *This, struct wined3d_context
      * The blitting code uses (for now) the fixed function pipeline, so make sure to reset all fixed
      * function texture unit. No need to care for higher samplers
      */
-    for (i = gl_info->max_textures - 1; i > 0 ; --i)
+    for (i = gl_info->limits.textures - 1; i > 0 ; --i)
     {
         sampler = This->rev_tex_unit_map[i];
         GL_EXTCALL(glActiveTextureARB(GL_TEXTURE0_ARB + i));
@@ -2061,7 +2061,7 @@ static void context_apply_draw_buffer(struct wined3d_context *context, BOOL blit
             {
                 if (GL_SUPPORT(ARB_DRAW_BUFFERS))
                 {
-                    GL_EXTCALL(glDrawBuffersARB(gl_info->max_buffers, device->draw_buffers));
+                    GL_EXTCALL(glDrawBuffersARB(gl_info->limits.buffers, device->draw_buffers));
                     checkGLcall("glDrawBuffers()");
                 }
                 else
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index 66ccc15..25df284 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -1698,7 +1698,7 @@ static void create_dummy_textures(IWineD3DDeviceImpl *This) {
         checkGLcall("glPixelStorei(GL_UNPACK_CLIENT_STORAGE_APPLE, GL_FALSE)");
     }
 
-    for (i = 0; i < This->adapter->gl_info.max_textures; ++i)
+    for (i = 0; i < This->adapter->gl_info.limits.textures; ++i)
     {
         GLubyte white = 255;
 
@@ -1761,9 +1761,9 @@ static HRESULT WINAPI IWineD3DDeviceImpl_Init3D(IWineD3DDevice *iface,
     IWineD3DStateBlock_AddRef((IWineD3DStateBlock*)This->updateStateBlock);
 
     This->render_targets = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
-            sizeof(IWineD3DSurface *) * gl_info->max_buffers);
+            sizeof(IWineD3DSurface *) * gl_info->limits.buffers);
     This->draw_buffers = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
-            sizeof(GLenum) * gl_info->max_buffers);
+            sizeof(GLenum) * gl_info->limits.buffers);
 
     This->NumberOfPalettes = 1;
     This->palettes = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(PALETTEENTRY*));
@@ -1787,7 +1787,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_Init3D(IWineD3DDevice *iface,
     /* Initialize the texture unit mapping to a 1:1 mapping */
     for (state = 0; state < MAX_COMBINED_SAMPLERS; ++state)
     {
-        if (state < gl_info->max_fragment_samplers)
+        if (state < gl_info->limits.fragment_samplers)
         {
             This->texUnitMap[state] = state;
             This->rev_tex_unit_map[state] = state;
@@ -2738,7 +2738,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetClipPlane(IWineD3DDevice *iface, DWO
     TRACE("(%p) : for idx %d, %p\n", This, Index, pPlane);
 
     /* Validate Index */
-    if (Index >= This->adapter->gl_info.max_clipplanes)
+    if (Index >= This->adapter->gl_info.limits.clipplanes)
     {
         TRACE("Application has requested clipplane this device doesn't support\n");
         return WINED3DERR_INVALIDCALL;
@@ -2775,7 +2775,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_GetClipPlane(IWineD3DDevice *iface, DWO
     TRACE("(%p) : for idx %d\n", This, Index);
 
     /* Validate Index */
-    if (Index >= This->adapter->gl_info.max_clipplanes)
+    if (Index >= This->adapter->gl_info.limits.clipplanes)
     {
         TRACE("Application has requested clipplane this device doesn't support\n");
         return WINED3DERR_INVALIDCALL;
@@ -3475,7 +3475,7 @@ static void device_map_vsamplers(IWineD3DDeviceImpl *This, BOOL ps) {
     const WINED3DSAMPLER_TEXTURE_TYPE *vshader_sampler_type =
             ((IWineD3DVertexShaderImpl *)This->stateBlock->vertexShader)->baseShader.reg_maps.sampler_type;
     const WINED3DSAMPLER_TEXTURE_TYPE *pshader_sampler_type = NULL;
-    int start = min(MAX_COMBINED_SAMPLERS, This->adapter->gl_info.max_combined_samplers) - 1;
+    int start = min(MAX_COMBINED_SAMPLERS, This->adapter->gl_info.limits.combined_samplers) - 1;
     int i;
 
     if (ps) {
@@ -4196,7 +4196,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetTextureStageState(IWineD3DDevice *if
              * Again stage Stage doesn't need to be dirtified here, it is handled below.
              */
 
-            for (i = Stage + 1; i < This->adapter->gl_info.max_texture_stages; ++i)
+            for (i = Stage + 1; i < This->adapter->gl_info.limits.texture_stages; ++i)
             {
                 if(This->updateStateBlock->textureState[i][WINED3DTSS_COLOROP] == WINED3DTOP_DISABLE) {
                     break;
@@ -5905,10 +5905,10 @@ static void WINAPI IWineD3DDeviceImpl_ClearRendertargetView(IWineD3DDevice *ifac
 static HRESULT  WINAPI  IWineD3DDeviceImpl_GetRenderTarget(IWineD3DDevice* iface,DWORD RenderTargetIndex, IWineD3DSurface **ppRenderTarget) {
     IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
 
-    if (RenderTargetIndex >= This->adapter->gl_info.max_buffers)
+    if (RenderTargetIndex >= This->adapter->gl_info.limits.buffers)
     {
         ERR("(%p) : Only %d render targets are supported.\n",
-                This, This->adapter->gl_info.max_buffers);
+                This, This->adapter->gl_info.limits.buffers);
         return WINED3DERR_INVALIDCALL;
     }
 
@@ -6178,10 +6178,10 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetRenderTarget(IWineD3DDevice *iface,
 
     TRACE("(%p) : Setting rendertarget %d to %p\n", This, RenderTargetIndex, pRenderTarget);
 
-    if (RenderTargetIndex >= This->adapter->gl_info.max_buffers)
+    if (RenderTargetIndex >= This->adapter->gl_info.limits.buffers)
     {
         WARN("(%p) : Unsupported target %u set, returning WINED3DERR_INVALIDCALL(only %u supported)\n",
-             This, RenderTargetIndex, This->adapter->gl_info.max_buffers);
+                This, RenderTargetIndex, This->adapter->gl_info.limits.buffers);
         return WINED3DERR_INVALIDCALL;
     }
 
@@ -6647,7 +6647,7 @@ void delete_opengl_contexts(IWineD3DDevice *iface, IWineD3DSwapChain *swapchain_
     This->shader_backend->shader_free_private(iface);
 
     ENTER_GL();
-    for (i = 0; i < This->adapter->gl_info.max_textures; ++i)
+    for (i = 0; i < This->adapter->gl_info.limits.textures; ++i)
     {
         /* Textures are recreated below */
         glDeleteTextures(1, &This->dummyTextureName[i]);
@@ -6983,7 +6983,7 @@ void device_resource_released(IWineD3DDeviceImpl *This, IWineD3DResource *resour
 
             if (This->d3d_initialized)
             {
-                for (i = 0; i < This->adapter->gl_info.max_buffers; ++i)
+                for (i = 0; i < This->adapter->gl_info.limits.buffers; ++i)
                 {
                     if (This->render_targets[i] == (IWineD3DSurface *)resource) {
                         This->render_targets[i] = NULL;
diff --git a/dlls/wined3d/directx.c b/dlls/wined3d/directx.c
index 2640aa6..3551747 100644
--- a/dlls/wined3d/directx.c
+++ b/dlls/wined3d/directx.c
@@ -625,7 +625,7 @@ static BOOL match_dx10_capable(const struct wined3d_gl_info *gl_info, const char
      * hardcoded
      *
      * dx10 cards usually have 64 varyings */
-    return gl_info->max_glsl_varyings > 44;
+    return gl_info->limits.glsl_varyings > 44;
 }
 
 /* A GL context is provided by the caller */
@@ -712,10 +712,10 @@ static BOOL match_broken_nv_clip(const struct wined3d_gl_info *gl_info, const ch
 
 static void quirk_arb_constants(struct wined3d_gl_info *gl_info)
 {
-    TRACE_(d3d_caps)("Using ARB vs constant limit(=%u) for GLSL.\n", gl_info->max_vs_arb_native_constants);
-    gl_info->max_vs_glsl_constantsF = gl_info->max_vs_arb_native_constants;
-    TRACE_(d3d_caps)("Using ARB ps constant limit(=%u) for GLSL.\n", gl_info->max_ps_arb_native_constants);
-    gl_info->max_ps_glsl_constantsF = gl_info->max_ps_arb_native_constants;
+    TRACE_(d3d_caps)("Using ARB vs constant limit(=%u) for GLSL.\n", gl_info->limits.arb_vs_native_constants);
+    gl_info->limits.glsl_vs_float_constants = gl_info->limits.arb_vs_native_constants;
+    TRACE_(d3d_caps)("Using ARB ps constant limit(=%u) for GLSL.\n", gl_info->limits.arb_ps_native_constants);
+    gl_info->limits.glsl_ps_float_constants = gl_info->limits.arb_ps_native_constants;
 }
 
 static void quirk_apple_glsl_constants(struct wined3d_gl_info *gl_info)
@@ -745,7 +745,7 @@ static void quirk_one_point_sprite(struct wined3d_gl_info *gl_info)
     if (gl_info->supported[ARB_POINT_SPRITE])
     {
         TRACE("Limiting point sprites to one texture unit.\n");
-        gl_info->max_point_sprite_units = 1;
+        gl_info->limits.point_sprite_units = 1;
     }
 }
 
@@ -1636,40 +1636,40 @@ static BOOL IWineD3DImpl_FillGLCaps(struct wined3d_driver_info *driver_info, str
      *  with Default values
      */
     memset(gl_info->supported, 0, sizeof(gl_info->supported));
-    gl_info->max_buffers        = 1;
-    gl_info->max_textures       = 1;
-    gl_info->max_texture_stages = 1;
-    gl_info->max_fragment_samplers = 1;
-    gl_info->max_vertex_samplers = 0;
-    gl_info->max_combined_samplers = gl_info->max_fragment_samplers + gl_info->max_vertex_samplers;
-    gl_info->max_sampler_stages = 1;
-    gl_info->max_ps_arb_temps = 0;
-    gl_info->max_ps_arb_instructions = 0;
-    gl_info->max_vs_arb_temps = 0;
-    gl_info->max_vs_arb_instructions = 0;
-    gl_info->max_vs_glsl_constantsF = 0;
-    gl_info->max_ps_glsl_constantsF = 0;
-    gl_info->max_vs_arb_constantsF = 0;
-    gl_info->max_ps_arb_constantsF = 0;
-    gl_info->max_vs_arb_native_constants = 0;
-    gl_info->max_ps_arb_local_constants = 0;
+    gl_info->limits.buffers = 1;
+    gl_info->limits.textures = 1;
+    gl_info->limits.texture_stages = 1;
+    gl_info->limits.fragment_samplers = 1;
+    gl_info->limits.vertex_samplers = 0;
+    gl_info->limits.combined_samplers = gl_info->limits.fragment_samplers + gl_info->limits.vertex_samplers;
+    gl_info->limits.sampler_stages = 1;
+    gl_info->limits.glsl_vs_float_constants = 0;
+    gl_info->limits.glsl_ps_float_constants = 0;
+    gl_info->limits.arb_vs_float_constants = 0;
+    gl_info->limits.arb_vs_native_constants = 0;
+    gl_info->limits.arb_vs_instructions = 0;
+    gl_info->limits.arb_vs_temps = 0;
+    gl_info->limits.arb_ps_float_constants = 0;
+    gl_info->limits.arb_ps_local_constants = 0;
+    gl_info->limits.arb_ps_instructions = 0;
+    gl_info->limits.arb_ps_temps = 0;
 
     /* Retrieve opengl defaults */
     glGetIntegerv(GL_MAX_CLIP_PLANES, &gl_max);
-    gl_info->max_clipplanes = min(WINED3DMAXUSERCLIPPLANES, gl_max);
+    gl_info->limits.clipplanes = min(WINED3DMAXUSERCLIPPLANES, gl_max);
     TRACE_(d3d_caps)("ClipPlanes support - num Planes=%d\n", gl_max);
 
     glGetIntegerv(GL_MAX_LIGHTS, &gl_max);
-    gl_info->max_lights = gl_max;
+    gl_info->limits.lights = gl_max;
     TRACE_(d3d_caps)("Lights support - max lights=%d\n", gl_max);
 
     glGetIntegerv(GL_MAX_TEXTURE_SIZE, &gl_max);
-    gl_info->max_texture_size = gl_max;
+    gl_info->limits.texture_size = gl_max;
     TRACE_(d3d_caps)("Maximum texture size support - max texture size=%d\n", gl_max);
 
     glGetFloatv(GL_ALIASED_POINT_SIZE_RANGE, gl_floatv);
-    gl_info->max_pointsizemin = gl_floatv[0];
-    gl_info->max_pointsize = gl_floatv[1];
+    gl_info->limits.pointsize_min = gl_floatv[0];
+    gl_info->limits.pointsize_max = gl_floatv[1];
     TRACE_(d3d_caps)("Maximum point size support - max point size=%f\n", gl_floatv[1]);
 
     /* Parse the gl supported features, in theory enabling parts of our code appropriately. */
@@ -1798,46 +1798,46 @@ static BOOL IWineD3DImpl_FillGLCaps(struct wined3d_driver_info *driver_info, str
     if (gl_info->supported[ARB_DRAW_BUFFERS])
     {
         glGetIntegerv(GL_MAX_DRAW_BUFFERS_ARB, &gl_max);
-        gl_info->max_buffers = gl_max;
+        gl_info->limits.buffers = gl_max;
         TRACE_(d3d_caps)("Max draw buffers: %u.\n", gl_max);
     }
     if (gl_info->supported[ARB_MULTITEXTURE])
     {
         glGetIntegerv(GL_MAX_TEXTURE_UNITS_ARB, &gl_max);
-        gl_info->max_textures = min(MAX_TEXTURES, gl_max);
-        TRACE_(d3d_caps)("Max textures: %d.\n", gl_info->max_textures);
+        gl_info->limits.textures = min(MAX_TEXTURES, gl_max);
+        TRACE_(d3d_caps)("Max textures: %d.\n", gl_info->limits.textures);
 
         if (gl_info->supported[NV_REGISTER_COMBINERS])
         {
             GLint tmp;
             glGetIntegerv(GL_MAX_GENERAL_COMBINERS_NV, &tmp);
-            gl_info->max_texture_stages = min(MAX_TEXTURES, tmp);
+            gl_info->limits.texture_stages = min(MAX_TEXTURES, tmp);
         }
         else
         {
-            gl_info->max_texture_stages = min(MAX_TEXTURES, gl_max);
+            gl_info->limits.texture_stages = min(MAX_TEXTURES, gl_max);
         }
-        TRACE_(d3d_caps)("Max texture stages: %d.\n", gl_info->max_texture_stages);
+        TRACE_(d3d_caps)("Max texture stages: %d.\n", gl_info->limits.texture_stages);
 
         if (gl_info->supported[ARB_FRAGMENT_PROGRAM])
         {
             GLint tmp;
             glGetIntegerv(GL_MAX_TEXTURE_IMAGE_UNITS_ARB, &tmp);
-            gl_info->max_fragment_samplers = min(MAX_FRAGMENT_SAMPLERS, tmp);
+            gl_info->limits.fragment_samplers = min(MAX_FRAGMENT_SAMPLERS, tmp);
         }
         else
         {
-            gl_info->max_fragment_samplers = max(gl_info->max_fragment_samplers, gl_max);
+            gl_info->limits.fragment_samplers = max(gl_info->limits.fragment_samplers, gl_max);
         }
-        TRACE_(d3d_caps)("Max fragment samplers: %d.\n", gl_info->max_fragment_samplers);
+        TRACE_(d3d_caps)("Max fragment samplers: %d.\n", gl_info->limits.fragment_samplers);
 
         if (gl_info->supported[ARB_VERTEX_SHADER])
         {
             GLint tmp;
             glGetIntegerv(GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB, &tmp);
-            gl_info->max_vertex_samplers = tmp;
+            gl_info->limits.vertex_samplers = tmp;
             glGetIntegerv(GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS_ARB, &tmp);
-            gl_info->max_combined_samplers = tmp;
+            gl_info->limits.combined_samplers = tmp;
 
             /* Loading GLSL sampler uniforms is much simpler if we can assume that the sampler setup
              * is known at shader link time. In a vertex shader + pixel shader combination this isn't
@@ -1853,100 +1853,102 @@ static BOOL IWineD3DImpl_FillGLCaps(struct wined3d_driver_info *driver_info, str
              *
              * So this is just a check to check that our assumption holds true. If not, write a warning
              * and reduce the number of vertex samplers or probably disable vertex texture fetch. */
-            if (gl_info->max_vertex_samplers && gl_info->max_combined_samplers < 12
-                    && MAX_TEXTURES + gl_info->max_vertex_samplers > gl_info->max_combined_samplers)
+            if (gl_info->limits.vertex_samplers && gl_info->limits.combined_samplers < 12
+                    && MAX_TEXTURES + gl_info->limits.vertex_samplers > gl_info->limits.combined_samplers)
             {
                 FIXME("OpenGL implementation supports %u vertex samplers and %u total samplers.\n",
-                        gl_info->max_vertex_samplers, gl_info->max_combined_samplers);
+                        gl_info->limits.vertex_samplers, gl_info->limits.combined_samplers);
                 FIXME("Expected vertex samplers + MAX_TEXTURES(=8) > combined_samplers.\n");
-                if (gl_info->max_combined_samplers > MAX_TEXTURES)
-                    gl_info->max_vertex_samplers = gl_info->max_combined_samplers - MAX_TEXTURES;
+                if (gl_info->limits.combined_samplers > MAX_TEXTURES)
+                    gl_info->limits.vertex_samplers = gl_info->limits.combined_samplers - MAX_TEXTURES;
                 else
-                    gl_info->max_vertex_samplers = 0;
+                    gl_info->limits.vertex_samplers = 0;
             }
         }
         else
         {
-            gl_info->max_combined_samplers = gl_info->max_fragment_samplers;
+            gl_info->limits.combined_samplers = gl_info->limits.fragment_samplers;
         }
-        TRACE_(d3d_caps)("Max vertex samplers: %u.\n", gl_info->max_vertex_samplers);
-        TRACE_(d3d_caps)("Max combined samplers: %u.\n", gl_info->max_combined_samplers);
+        TRACE_(d3d_caps)("Max vertex samplers: %u.\n", gl_info->limits.vertex_samplers);
+        TRACE_(d3d_caps)("Max combined samplers: %u.\n", gl_info->limits.combined_samplers);
     }
     if (gl_info->supported[ARB_VERTEX_BLEND])
     {
         glGetIntegerv(GL_MAX_VERTEX_UNITS_ARB, &gl_max);
-        gl_info->max_blends = gl_max;
-        TRACE_(d3d_caps)("Max blends: %u.\n", gl_info->max_blends);
+        gl_info->limits.blends = gl_max;
+        TRACE_(d3d_caps)("Max blends: %u.\n", gl_info->limits.blends);
     }
     if (gl_info->supported[EXT_TEXTURE3D])
     {
         glGetIntegerv(GL_MAX_3D_TEXTURE_SIZE_EXT, &gl_max);
-        gl_info->max_texture3d_size = gl_max;
-        TRACE_(d3d_caps)("Max texture3D size: %d.\n", gl_info->max_texture3d_size);
+        gl_info->limits.texture3d_size = gl_max;
+        TRACE_(d3d_caps)("Max texture3D size: %d.\n", gl_info->limits.texture3d_size);
     }
     if (gl_info->supported[EXT_TEXTURE_FILTER_ANISOTROPIC])
     {
         glGetIntegerv(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &gl_max);
-        gl_info->max_anisotropy = gl_max;
-        TRACE_(d3d_caps)("Max anisotropy: %d.\n", gl_info->max_anisotropy);
+        gl_info->limits.anisotropy = gl_max;
+        TRACE_(d3d_caps)("Max anisotropy: %d.\n", gl_info->limits.anisotropy);
     }
     if (gl_info->supported[ARB_FRAGMENT_PROGRAM])
     {
         GL_EXTCALL(glGetProgramivARB(GL_FRAGMENT_PROGRAM_ARB, GL_MAX_PROGRAM_ENV_PARAMETERS_ARB, &gl_max));
-        gl_info->max_ps_arb_constantsF = gl_max;
-        TRACE_(d3d_caps)("Max ARB_FRAGMENT_PROGRAM float constants: %d.\n", gl_info->max_ps_arb_constantsF);
+        gl_info->limits.arb_ps_float_constants = gl_max;
+        TRACE_(d3d_caps)("Max ARB_FRAGMENT_PROGRAM float constants: %d.\n", gl_info->limits.arb_ps_float_constants);
         GL_EXTCALL(glGetProgramivARB(GL_FRAGMENT_PROGRAM_ARB, GL_MAX_PROGRAM_NATIVE_PARAMETERS_ARB, &gl_max));
-        gl_info->max_ps_arb_native_constants = gl_max;
-        TRACE_(d3d_caps)("Max ARB_FRAGMENT_PROGRAM native float constants: %d.\n", gl_info->max_ps_arb_native_constants);
+        gl_info->limits.arb_ps_native_constants = gl_max;
+        TRACE_(d3d_caps)("Max ARB_FRAGMENT_PROGRAM native float constants: %d.\n",
+                gl_info->limits.arb_ps_native_constants);
         GL_EXTCALL(glGetProgramivARB(GL_FRAGMENT_PROGRAM_ARB, GL_MAX_PROGRAM_NATIVE_TEMPORARIES_ARB, &gl_max));
-        gl_info->max_ps_arb_temps = gl_max;
-        TRACE_(d3d_caps)("Max ARB_FRAGMENT_PROGRAM native temporaries: %d.\n", gl_info->max_ps_arb_temps);
+        gl_info->limits.arb_ps_temps = gl_max;
+        TRACE_(d3d_caps)("Max ARB_FRAGMENT_PROGRAM native temporaries: %d.\n", gl_info->limits.arb_ps_temps);
         GL_EXTCALL(glGetProgramivARB(GL_FRAGMENT_PROGRAM_ARB, GL_MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB, &gl_max));
-        gl_info->max_ps_arb_instructions = gl_max;
-        TRACE_(d3d_caps)("Max ARB_FRAGMENT_PROGRAM native instructions: %d.\n", gl_info->max_ps_arb_instructions);
+        gl_info->limits.arb_ps_instructions = gl_max;
+        TRACE_(d3d_caps)("Max ARB_FRAGMENT_PROGRAM native instructions: %d.\n", gl_info->limits.arb_ps_instructions);
         GL_EXTCALL(glGetProgramivARB(GL_FRAGMENT_PROGRAM_ARB, GL_MAX_PROGRAM_LOCAL_PARAMETERS_ARB, &gl_max));
-        gl_info->max_ps_arb_local_constants = gl_max;
-        TRACE_(d3d_caps)("Max ARB_FRAGMENT_PROGRAM local parameters: %d.\n", gl_info->max_ps_arb_instructions);
+        gl_info->limits.arb_ps_local_constants = gl_max;
+        TRACE_(d3d_caps)("Max ARB_FRAGMENT_PROGRAM local parameters: %d.\n", gl_info->limits.arb_ps_instructions);
     }
     if (gl_info->supported[ARB_VERTEX_PROGRAM])
     {
         GL_EXTCALL(glGetProgramivARB(GL_VERTEX_PROGRAM_ARB, GL_MAX_PROGRAM_ENV_PARAMETERS_ARB, &gl_max));
-        gl_info->max_vs_arb_constantsF = gl_max;
-        TRACE_(d3d_caps)("Max ARB_VERTEX_PROGRAM float constants: %d.\n", gl_info->max_vs_arb_constantsF);
+        gl_info->limits.arb_vs_float_constants = gl_max;
+        TRACE_(d3d_caps)("Max ARB_VERTEX_PROGRAM float constants: %d.\n", gl_info->limits.arb_vs_float_constants);
         GL_EXTCALL(glGetProgramivARB(GL_VERTEX_PROGRAM_ARB, GL_MAX_PROGRAM_NATIVE_PARAMETERS_ARB, &gl_max));
-        gl_info->max_vs_arb_native_constants = gl_max;
-        TRACE_(d3d_caps)("Max ARB_VERTEX_PROGRAM native float constants: %d.\n", gl_info->max_vs_arb_native_constants);
+        gl_info->limits.arb_vs_native_constants = gl_max;
+        TRACE_(d3d_caps)("Max ARB_VERTEX_PROGRAM native float constants: %d.\n",
+                gl_info->limits.arb_vs_native_constants);
         GL_EXTCALL(glGetProgramivARB(GL_VERTEX_PROGRAM_ARB, GL_MAX_PROGRAM_NATIVE_TEMPORARIES_ARB, &gl_max));
-        gl_info->max_vs_arb_temps = gl_max;
-        TRACE_(d3d_caps)("Max ARB_VERTEX_PROGRAM native temporaries: %d.\n", gl_info->max_vs_arb_temps);
+        gl_info->limits.arb_vs_temps = gl_max;
+        TRACE_(d3d_caps)("Max ARB_VERTEX_PROGRAM native temporaries: %d.\n", gl_info->limits.arb_vs_temps);
         GL_EXTCALL(glGetProgramivARB(GL_VERTEX_PROGRAM_ARB, GL_MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB, &gl_max));
-        gl_info->max_vs_arb_instructions = gl_max;
-        TRACE_(d3d_caps)("Max ARB_VERTEX_PROGRAM native instructions: %d.\n", gl_info->max_vs_arb_instructions);
+        gl_info->limits.arb_vs_instructions = gl_max;
+        TRACE_(d3d_caps)("Max ARB_VERTEX_PROGRAM native instructions: %d.\n", gl_info->limits.arb_vs_instructions);
 
         if (test_arb_vs_offset_limit(gl_info)) gl_info->quirks |= WINED3D_QUIRK_ARB_VS_OFFSET_LIMIT;
     }
     if (gl_info->supported[ARB_VERTEX_SHADER])
     {
         glGetIntegerv(GL_MAX_VERTEX_UNIFORM_COMPONENTS_ARB, &gl_max);
-        gl_info->max_vs_glsl_constantsF = gl_max / 4;
-        TRACE_(d3d_caps)("Max ARB_VERTEX_SHADER float constants: %u.\n", gl_info->max_vs_glsl_constantsF);
+        gl_info->limits.glsl_vs_float_constants = gl_max / 4;
+        TRACE_(d3d_caps)("Max ARB_VERTEX_SHADER float constants: %u.\n", gl_info->limits.glsl_vs_float_constants);
     }
     if (gl_info->supported[ARB_FRAGMENT_SHADER])
     {
         glGetIntegerv(GL_MAX_FRAGMENT_UNIFORM_COMPONENTS_ARB, &gl_max);
-        gl_info->max_ps_glsl_constantsF = gl_max / 4;
-        TRACE_(d3d_caps)("Max ARB_FRAGMENT_SHADER float constants: %u.\n", gl_info->max_ps_glsl_constantsF);
+        gl_info->limits.glsl_ps_float_constants = gl_max / 4;
+        TRACE_(d3d_caps)("Max ARB_FRAGMENT_SHADER float constants: %u.\n", gl_info->limits.glsl_ps_float_constants);
         glGetIntegerv(GL_MAX_VARYING_FLOATS_ARB, &gl_max);
-        gl_info->max_glsl_varyings = gl_max;
+        gl_info->limits.glsl_varyings = gl_max;
         TRACE_(d3d_caps)("Max GLSL varyings: %u (%u 4 component varyings).\n", gl_max, gl_max / 4);
     }
     if (gl_info->supported[NV_LIGHT_MAX_EXPONENT])
     {
-        glGetFloatv(GL_MAX_SHININESS_NV, &gl_info->max_shininess);
+        glGetFloatv(GL_MAX_SHININESS_NV, &gl_info->limits.shininess);
     }
     else
     {
-        gl_info->max_shininess = 128.0f;
+        gl_info->limits.shininess = 128.0f;
     }
     if (gl_info->supported[ARB_TEXTURE_NON_POWER_OF_TWO])
     {
@@ -1975,11 +1977,11 @@ static BOOL IWineD3DImpl_FillGLCaps(struct wined3d_driver_info *driver_info, str
     }
     if (gl_info->supported[ARB_POINT_SPRITE])
     {
-        gl_info->max_point_sprite_units = gl_info->max_textures;
+        gl_info->limits.point_sprite_units = gl_info->limits.textures;
     }
     else
     {
-        gl_info->max_point_sprite_units = 0;
+        gl_info->limits.point_sprite_units = 0;
     }
     checkGLcall("extension detection");
 
@@ -1988,7 +1990,7 @@ static BOOL IWineD3DImpl_FillGLCaps(struct wined3d_driver_info *driver_info, str
     /* In some cases the number of texture stages can be larger than the number
      * of samplers. The GF4 for example can use only 2 samplers (no fragment
      * shaders), but 8 texture stages (register combiners). */
-    gl_info->max_sampler_stages = max(gl_info->max_fragment_samplers, gl_info->max_texture_stages);
+    gl_info->limits.sampler_stages = max(gl_info->limits.fragment_samplers, gl_info->limits.texture_stages);
 
     if (gl_info->supported[ARB_FRAMEBUFFER_OBJECT])
     {
@@ -2050,8 +2052,9 @@ static BOOL IWineD3DImpl_FillGLCaps(struct wined3d_driver_info *driver_info, str
     }
 
     /* MRTs are currently only supported when FBOs are used. */
-    if (wined3d_settings.offscreen_rendering_mode != ORM_FBO) {
-        gl_info->max_buffers = 1;
+    if (wined3d_settings.offscreen_rendering_mode != ORM_FBO)
+    {
+        gl_info->limits.buffers = 1;
     }
 
     device = wined3d_guess_card(gl_info, gl_renderer, &vendor, &vidmem);
@@ -3194,7 +3197,7 @@ static BOOL CheckVertexTextureCapability(struct wined3d_adapter *adapter, const
 {
     const struct wined3d_gl_info *gl_info = &adapter->gl_info;
 
-    if (!gl_info->max_vertex_samplers)
+    if (!gl_info->limits.vertex_samplers)
     {
         TRACE_(d3d_caps)("[FAILED]\n");
         return FALSE;
@@ -4075,16 +4078,16 @@ static HRESULT WINAPI IWineD3DImpl_GetDeviceCaps(IWineD3D *iface, UINT Adapter,
      * idea how generating the smoothing alpha values works; the result is different
      */
 
-    pCaps->MaxTextureWidth = gl_info->max_texture_size;
-    pCaps->MaxTextureHeight = gl_info->max_texture_size;
+    pCaps->MaxTextureWidth = gl_info->limits.texture_size;
+    pCaps->MaxTextureHeight = gl_info->limits.texture_size;
 
-    if(GL_SUPPORT(EXT_TEXTURE3D))
-        pCaps->MaxVolumeExtent = gl_info->max_texture3d_size;
+    if (GL_SUPPORT(EXT_TEXTURE3D))
+        pCaps->MaxVolumeExtent = gl_info->limits.texture3d_size;
     else
         pCaps->MaxVolumeExtent = 0;
 
     pCaps->MaxTextureRepeat = 32768;
-    pCaps->MaxTextureAspectRatio = gl_info->max_texture_size;
+    pCaps->MaxTextureAspectRatio = gl_info->limits.texture_size;
     pCaps->MaxVertexW = 1.0f;
 
     pCaps->GuardBandLeft = 0.0f;
@@ -4110,14 +4113,14 @@ static HRESULT WINAPI IWineD3DImpl_GetDeviceCaps(IWineD3D *iface, UINT Adapter,
 
     pCaps->FVFCaps = WINED3DFVFCAPS_PSIZE | 0x0008; /* 8 texture coords */
 
-    pCaps->MaxUserClipPlanes = gl_info->max_clipplanes;
-    pCaps->MaxActiveLights = gl_info->max_lights;
+    pCaps->MaxUserClipPlanes = gl_info->limits.clipplanes;
+    pCaps->MaxActiveLights = gl_info->limits.lights;
 
-    pCaps->MaxVertexBlendMatrices = gl_info->max_blends;
+    pCaps->MaxVertexBlendMatrices = gl_info->limits.blends;
     pCaps->MaxVertexBlendMatrixIndex   = 0;
 
-    pCaps->MaxAnisotropy = gl_info->max_anisotropy;
-    pCaps->MaxPointSize = gl_info->max_pointsize;
+    pCaps->MaxAnisotropy = gl_info->limits.anisotropy;
+    pCaps->MaxPointSize = gl_info->limits.pointsize_max;
 
 
     /* FIXME: Add D3DVTXPCAPS_TWEENING, D3DVTXPCAPS_TEXGEN_SPHEREMAP */
@@ -4141,7 +4144,7 @@ static HRESULT WINAPI IWineD3DImpl_GetDeviceCaps(IWineD3D *iface, UINT Adapter,
     pCaps->AdapterOrdinalInGroup             = 0;
     pCaps->NumberOfAdaptersInGroup           = 1;
 
-    pCaps->NumSimultaneousRTs = gl_info->max_buffers;
+    pCaps->NumSimultaneousRTs = gl_info->limits.buffers;
 
     pCaps->StretchRectFilterCaps             = WINED3DPTFILTERCAPS_MINFPOINT  |
                                                 WINED3DPTFILTERCAPS_MAGFPOINT  |
@@ -4201,15 +4204,17 @@ static HRESULT WINAPI IWineD3DImpl_GetDeviceCaps(IWineD3D *iface, UINT Adapter,
         use the VS 3.0 from MSDN or else if there's OpenGL spec use a hardcoded value minimum VS3.0 value. */
         pCaps->VS20Caps.Caps                     = WINED3DVS20CAPS_PREDICATION;
         pCaps->VS20Caps.DynamicFlowControlDepth  = WINED3DVS20_MAX_DYNAMICFLOWCONTROLDEPTH; /* VS 3.0 requires MAX_DYNAMICFLOWCONTROLDEPTH (24) */
-        pCaps->VS20Caps.NumTemps                 = max(32, adapter->gl_info.max_vs_arb_temps);
+        pCaps->VS20Caps.NumTemps = max(32, adapter->gl_info.limits.arb_vs_temps);
         pCaps->VS20Caps.StaticFlowControlDepth   = WINED3DVS20_MAX_STATICFLOWCONTROLDEPTH ; /* level of nesting in loops / if-statements; VS 3.0 requires MAX (4) */
 
         pCaps->MaxVShaderInstructionsExecuted    = 65535; /* VS 3.0 needs at least 65535, some cards even use 2^32-1 */
-        pCaps->MaxVertexShader30InstructionSlots = max(512, adapter->gl_info.max_vs_arb_instructions);
-    } else if(pCaps->VertexShaderVersion == WINED3DVS_VERSION(2,0)) {
+        pCaps->MaxVertexShader30InstructionSlots = max(512, adapter->gl_info.limits.arb_vs_instructions);
+    }
+    else if (pCaps->VertexShaderVersion == WINED3DVS_VERSION(2,0))
+    {
         pCaps->VS20Caps.Caps                     = 0;
         pCaps->VS20Caps.DynamicFlowControlDepth  = WINED3DVS20_MIN_DYNAMICFLOWCONTROLDEPTH;
-        pCaps->VS20Caps.NumTemps                 = max(12, adapter->gl_info.max_vs_arb_temps);
+        pCaps->VS20Caps.NumTemps = max(12, adapter->gl_info.limits.arb_vs_temps);
         pCaps->VS20Caps.StaticFlowControlDepth   = 1;
 
         pCaps->MaxVShaderInstructionsExecuted    = 65535;
@@ -4235,17 +4240,20 @@ static HRESULT WINAPI IWineD3DImpl_GetDeviceCaps(IWineD3D *iface, UINT Adapter,
                 WINED3DPS20CAPS_NODEPENDENTREADLIMIT |
                 WINED3DPS20CAPS_NOTEXINSTRUCTIONLIMIT;
         pCaps->PS20Caps.DynamicFlowControlDepth  = WINED3DPS20_MAX_DYNAMICFLOWCONTROLDEPTH; /* PS 3.0 requires MAX_DYNAMICFLOWCONTROLDEPTH (24) */
-        pCaps->PS20Caps.NumTemps                 = max(32, adapter->gl_info.max_ps_arb_temps);
+        pCaps->PS20Caps.NumTemps = max(32, adapter->gl_info.limits.arb_ps_temps);
         pCaps->PS20Caps.StaticFlowControlDepth   = WINED3DPS20_MAX_STATICFLOWCONTROLDEPTH; /* PS 3.0 requires MAX_STATICFLOWCONTROLDEPTH (4) */
         pCaps->PS20Caps.NumInstructionSlots      = WINED3DPS20_MAX_NUMINSTRUCTIONSLOTS; /* PS 3.0 requires MAX_NUMINSTRUCTIONSLOTS (512) */
 
         pCaps->MaxPShaderInstructionsExecuted    = 65535;
-        pCaps->MaxPixelShader30InstructionSlots  = max(WINED3DMIN30SHADERINSTRUCTIONS, adapter->gl_info.max_ps_arb_instructions);
-    } else if(pCaps->PixelShaderVersion == WINED3DPS_VERSION(2,0)) {
+        pCaps->MaxPixelShader30InstructionSlots = max(WINED3DMIN30SHADERINSTRUCTIONS,
+                adapter->gl_info.limits.arb_ps_instructions);
+    }
+    else if(pCaps->PixelShaderVersion == WINED3DPS_VERSION(2,0))
+    {
         /* Below we assume PS2.0 specs, not extended 2.0a(GeforceFX)/2.0b(Radeon R3xx) ones */
         pCaps->PS20Caps.Caps                     = 0;
         pCaps->PS20Caps.DynamicFlowControlDepth  = 0; /* WINED3DVS20_MIN_DYNAMICFLOWCONTROLDEPTH = 0 */
-        pCaps->PS20Caps.NumTemps                 = max(12, adapter->gl_info.max_ps_arb_temps);
+        pCaps->PS20Caps.NumTemps = max(12, adapter->gl_info.limits.arb_ps_temps);
         pCaps->PS20Caps.StaticFlowControlDepth   = WINED3DPS20_MIN_STATICFLOWCONTROLDEPTH; /* Minimum: 1 */
         pCaps->PS20Caps.NumInstructionSlots      = WINED3DPS20_MIN_NUMINSTRUCTIONSLOTS; /* Minimum number (64 ALU + 32 Texture), a GeforceFX uses 512 */
 
diff --git a/dlls/wined3d/drawprim.c b/dlls/wined3d/drawprim.c
index c6d50b0..a9e69d1 100644
--- a/dlls/wined3d/drawprim.c
+++ b/dlls/wined3d/drawprim.c
@@ -76,7 +76,7 @@ static void drawStridedSlow(IWineD3DDevice *iface, const struct wined3d_context
     long                      SkipnStrides = startIdx + This->stateBlock->loadBaseVertexIndex;
     BOOL                      pixelShader = use_ps(This->stateBlock);
     BOOL specular_fog = FALSE;
-    UINT texture_stages = context->gl_info->max_texture_stages;
+    UINT texture_stages = context->gl_info->limits.texture_stages;
     const BYTE *texCoords[WINED3DDP_MAXTEXCOORD];
     const BYTE *diffuse = NULL, *specular = NULL, *normal = NULL, *position = NULL;
     const struct wined3d_stream_info_element *element;
@@ -582,7 +582,7 @@ void drawPrimitive(IWineD3DDevice *iface, UINT index_count, UINT StartIdx, UINT
     if (This->stateBlock->renderState[WINED3DRS_COLORWRITEENABLE])
     {
         /* Invalidate the back buffer memory so LockRect will read it the next time */
-        for (i = 0; i < This->adapter->gl_info.max_buffers; ++i)
+        for (i = 0; i < This->adapter->gl_info.limits.buffers; ++i)
         {
             target = (IWineD3DSurfaceImpl *)This->render_targets[i];
             if (target)
@@ -860,7 +860,7 @@ HRESULT tesselate_rectpatch(IWineD3DDeviceImpl *This,
         checkGLcall("glLightModel for MODEL_AMBIENT");
         IWineD3DDeviceImpl_MarkStateDirty(This, STATE_RENDER(WINED3DRS_AMBIENT));
 
-        for (i = 3; i < context->gl_info->max_lights; ++i)
+        for (i = 3; i < context->gl_info->limits.lights; ++i)
         {
             glDisable(GL_LIGHT0 + i);
             checkGLcall("glDisable(GL_LIGHT0 + i)");
diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c
index 25e2f61..b97936d 100644
--- a/dlls/wined3d/glsl_shader.c
+++ b/dlls/wined3d/glsl_shader.c
@@ -254,7 +254,7 @@ static void shader_glsl_load_psamplers(const struct wined3d_gl_info *gl_info,
         name_loc = GL_EXTCALL(glGetUniformLocationARB(programId, sampler_name));
         if (name_loc != -1) {
             DWORD mapped_unit = tex_unit_map[i];
-            if (mapped_unit != WINED3D_UNMAPPED_STAGE && mapped_unit < gl_info->max_fragment_samplers)
+            if (mapped_unit != WINED3D_UNMAPPED_STAGE && mapped_unit < gl_info->limits.fragment_samplers)
             {
                 TRACE("Loading %s for texture %d\n", sampler_name, mapped_unit);
                 GL_EXTCALL(glUniform1iARB(name_loc, mapped_unit));
@@ -279,7 +279,7 @@ static void shader_glsl_load_vsamplers(const struct wined3d_gl_info *gl_info,
         name_loc = GL_EXTCALL(glGetUniformLocationARB(programId, sampler_name));
         if (name_loc != -1) {
             DWORD mapped_unit = tex_unit_map[MAX_FRAGMENT_SAMPLERS + i];
-            if (mapped_unit != WINED3D_UNMAPPED_STAGE && mapped_unit < gl_info->max_combined_samplers)
+            if (mapped_unit != WINED3D_UNMAPPED_STAGE && mapped_unit < gl_info->limits.combined_samplers)
             {
                 TRACE("Loading %s for texture %d\n", sampler_name, mapped_unit);
                 GL_EXTCALL(glUniform1iARB(name_loc, mapped_unit));
@@ -794,7 +794,7 @@ static void shader_glsl_update_float_pixel_constants(IWineD3DDevice *iface, UINT
 
 static unsigned int vec4_varyings(DWORD shader_major, const struct wined3d_gl_info *gl_info)
 {
-    unsigned int ret = gl_info->max_glsl_varyings / 4;
+    unsigned int ret = gl_info->limits.glsl_varyings / 4;
     /* 4.0 shaders do not write clip coords because d3d10 does not support user clipplanes */
     if(shader_major > 3) return ret;
 
@@ -842,9 +842,10 @@ static void shader_generate_glsl_declarations(const struct wined3d_context *cont
          * 1) The shader really uses more uniforms than supported
          * 2) The shader uses indirect addressing, less constants than supported, but uses a constant index > #supported consts
          */
-        if(pshader) {
-            /* No indirect addressing here */
-            max_constantsF = gl_info->max_ps_glsl_constantsF;
+        if (pshader)
+        {
+            /* No indirect addressing here. */
+            max_constantsF = gl_info->limits.glsl_ps_float_constants;
         }
         else
         {
@@ -856,7 +857,7 @@ static void shader_generate_glsl_declarations(const struct wined3d_context *cont
                  *
                  * Writing gl_ClipPos requires one uniform for each clipplane as well.
                  */
-                max_constantsF = gl_info->max_vs_glsl_constantsF - 3 - gl_info->max_clipplanes;
+                max_constantsF = gl_info->limits.glsl_vs_float_constants - 3 - gl_info->limits.clipplanes;
                 max_constantsF -= count_bits(This->baseShader.reg_maps.integer_constants);
                 /* Strictly speaking a bool only uses one scalar, but the nvidia(Linux) compiler doesn't pack them properly,
                  * so each scalar requires a full vec4. We could work around this by packing the booleans ourselves, but
@@ -868,7 +869,7 @@ static void shader_generate_glsl_declarations(const struct wined3d_context *cont
             }
             else
             {
-                max_constantsF = gl_info->max_vs_glsl_constantsF;
+                max_constantsF = gl_info->limits.glsl_vs_float_constants;
             }
         }
         max_constantsF = min(This->baseShader.limits.constant_float, max_constantsF);
@@ -928,7 +929,8 @@ static void shader_generate_glsl_declarations(const struct wined3d_context *cont
         }
         if (reg_maps->vpos || reg_maps->usesdsy)
         {
-            if (This->baseShader.limits.constant_float + extra_constants_needed + 1 < gl_info->max_ps_glsl_constantsF)
+            if (This->baseShader.limits.constant_float + extra_constants_needed
+                    + 1 < gl_info->limits.glsl_ps_float_constants)
             {
                 shader_addline(buffer, "uniform vec4 ycorrection;\n");
                 ((IWineD3DPixelShaderImpl *) This)->vpos_uniform = 1;
@@ -1314,8 +1316,8 @@ static void shader_glsl_get_register_name(const struct wined3d_shader_register *
             break;
 
         case WINED3DSPR_COLOROUT:
-            if (reg->idx >= gl_info->max_buffers)
-                WARN("Write to render target %u, only %d supported\n", reg->idx, gl_info->max_buffers);
+            if (reg->idx >= gl_info->limits.buffers)
+                WARN("Write to render target %u, only %d supported.\n", reg->idx, gl_info->limits.buffers);
 
             sprintf(register_name, "gl_FragData[%u]", reg->idx);
             break;
@@ -4138,8 +4140,9 @@ static void set_glsl_shader_program(const struct wined3d_context *context,
     GL_EXTCALL(glLinkProgramARB(programId));
     print_glsl_info_log(gl_info, programId);
 
-    entry->vuniformF_locations = HeapAlloc(GetProcessHeap(), 0, sizeof(GLhandleARB) * gl_info->max_vs_glsl_constantsF);
-    for (i = 0; i < gl_info->max_vs_glsl_constantsF; ++i)
+    entry->vuniformF_locations = HeapAlloc(GetProcessHeap(), 0,
+            sizeof(GLhandleARB) * gl_info->limits.glsl_vs_float_constants);
+    for (i = 0; i < gl_info->limits.glsl_vs_float_constants; ++i)
     {
         snprintf(glsl_name, sizeof(glsl_name), "VC[%i]", i);
         entry->vuniformF_locations[i] = GL_EXTCALL(glGetUniformLocationARB(programId, glsl_name));
@@ -4149,8 +4152,9 @@ static void set_glsl_shader_program(const struct wined3d_context *context,
         snprintf(glsl_name, sizeof(glsl_name), "VI[%i]", i);
         entry->vuniformI_locations[i] = GL_EXTCALL(glGetUniformLocationARB(programId, glsl_name));
     }
-    entry->puniformF_locations = HeapAlloc(GetProcessHeap(), 0, sizeof(GLhandleARB) * gl_info->max_ps_glsl_constantsF);
-    for (i = 0; i < gl_info->max_ps_glsl_constantsF; ++i)
+    entry->puniformF_locations = HeapAlloc(GetProcessHeap(), 0,
+            sizeof(GLhandleARB) * gl_info->limits.glsl_ps_float_constants);
+    for (i = 0; i < gl_info->limits.glsl_ps_float_constants; ++i)
     {
         snprintf(glsl_name, sizeof(glsl_name), "PC[%i]", i);
         entry->puniformF_locations[i] = GL_EXTCALL(glGetUniformLocationARB(programId, glsl_name));
@@ -4533,7 +4537,8 @@ static HRESULT shader_glsl_alloc(IWineD3DDevice *iface) {
     IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
     const struct wined3d_gl_info *gl_info = &This->adapter->gl_info;
     struct shader_glsl_priv *priv = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(struct shader_glsl_priv));
-    SIZE_T stack_size = wined3d_log2i(max(gl_info->max_vs_glsl_constantsF, gl_info->max_ps_glsl_constantsF)) + 1;
+    SIZE_T stack_size = wined3d_log2i(max(gl_info->limits.glsl_vs_float_constants,
+            gl_info->limits.glsl_ps_float_constants)) + 1;
 
     if (!shader_buffer_init(&priv->shader_buffer))
     {
@@ -4548,13 +4553,13 @@ static HRESULT shader_glsl_alloc(IWineD3DDevice *iface) {
         goto fail;
     }
 
-    if (!constant_heap_init(&priv->vconst_heap, gl_info->max_vs_glsl_constantsF))
+    if (!constant_heap_init(&priv->vconst_heap, gl_info->limits.glsl_vs_float_constants))
     {
         ERR("Failed to initialize vertex shader constant heap\n");
         goto fail;
     }
 
-    if (!constant_heap_init(&priv->pconst_heap, gl_info->max_ps_glsl_constantsF))
+    if (!constant_heap_init(&priv->pconst_heap, gl_info->limits.glsl_ps_float_constants))
     {
         ERR("Failed to initialize pixel shader constant heap\n");
         goto fail;
@@ -4624,12 +4629,12 @@ static void shader_glsl_get_caps(WINED3DDEVTYPE devtype,
      * of native instructions, so use that here. For more info see the pixel shader versioning code below.
      */
     if ((gl_info->supported[NV_VERTEX_PROGRAM2] && !gl_info->supported[NV_VERTEX_PROGRAM3])
-            || gl_info->max_ps_arb_instructions <= 512)
+            || gl_info->limits.arb_ps_instructions <= 512)
         pCaps->VertexShaderVersion = WINED3DVS_VERSION(2,0);
     else
         pCaps->VertexShaderVersion = WINED3DVS_VERSION(3,0);
     TRACE_(d3d_caps)("Hardware vertex shader version %d.%d enabled (GLSL)\n", (pCaps->VertexShaderVersion >> 8) & 0xff, pCaps->VertexShaderVersion & 0xff);
-    pCaps->MaxVertexShaderConst = gl_info->max_vs_glsl_constantsF;
+    pCaps->MaxVertexShaderConst = gl_info->limits.glsl_vs_float_constants;
 
     /* Older DX9-class videocards (GeforceFX / Radeon >9500/X*00) only support pixel shader 2.0/2.0a/2.0b.
      * In OpenGL the extensions related to GLSL abstract lowlevel GL info away which is needed
@@ -4643,12 +4648,12 @@ static void shader_glsl_get_caps(WINED3DDEVTYPE devtype,
      * NOTE: ps3.0 hardware requires 512 or more instructions but ati and nvidia offer 'enough' (1024 vs 4096) on their most basic ps3.0 hardware.
      */
     if ((gl_info->supported[NV_FRAGMENT_PROGRAM] && !gl_info->supported[NV_FRAGMENT_PROGRAM2])
-            || (gl_info->max_ps_arb_instructions <= 512))
+            || gl_info->limits.arb_ps_instructions <= 512)
         pCaps->PixelShaderVersion = WINED3DPS_VERSION(2,0);
     else
         pCaps->PixelShaderVersion = WINED3DPS_VERSION(3,0);
 
-    pCaps->MaxPixelShaderConst = gl_info->max_ps_glsl_constantsF;
+    pCaps->MaxPixelShaderConst = gl_info->limits.glsl_ps_float_constants;
 
     /* FIXME: The following line is card dependent. -8.0 to 8.0 is the
      * Direct3D minimum requirement.
diff --git a/dlls/wined3d/nvidia_texture_shader.c b/dlls/wined3d/nvidia_texture_shader.c
index 63bc1a0..3f8c31c 100644
--- a/dlls/wined3d/nvidia_texture_shader.c
+++ b/dlls/wined3d/nvidia_texture_shader.c
@@ -469,7 +469,7 @@ static void nvrc_colorop(DWORD state, IWineD3DStateBlockImpl *stateblock, struct
 
     if (mapped_stage != WINED3D_UNMAPPED_STAGE)
     {
-        if (tex_used && mapped_stage >= gl_info->max_textures)
+        if (tex_used && mapped_stage >= gl_info->limits.textures)
         {
             FIXME("Attempt to enable unsupported stage!\n");
             return;
@@ -501,7 +501,7 @@ static void nvrc_colorop(DWORD state, IWineD3DStateBlockImpl *stateblock, struct
                 glDisable(GL_TEXTURE_RECTANGLE_ARB);
                 checkGLcall("glDisable(GL_TEXTURE_RECTANGLE_ARB)");
             }
-            if (gl_info->supported[NV_TEXTURE_SHADER2] && mapped_stage < gl_info->max_textures)
+            if (gl_info->supported[NV_TEXTURE_SHADER2] && mapped_stage < gl_info->limits.textures)
             {
                 glTexEnvi(GL_TEXTURE_SHADER_NV, GL_SHADER_OPERATION_NV, GL_NONE);
             }
@@ -558,7 +558,7 @@ static void nvts_texdim(DWORD state, IWineD3DStateBlockImpl *stateblock, struct
     * handler takes care. Also no action is needed with pixel shaders, or if tex_colorop
     * will take care of this business
     */
-    if (mapped_stage == WINED3D_UNMAPPED_STAGE || mapped_stage >= context->gl_info->max_textures) return;
+    if (mapped_stage == WINED3D_UNMAPPED_STAGE || mapped_stage >= context->gl_info->limits.textures) return;
     if(sampler >= stateblock->lowest_disabled_stage) return;
     if(isStateDirty(context, STATE_TEXTURESTAGE(sampler, WINED3DTSS_COLOROP))) return;
 
@@ -577,7 +577,7 @@ static void nvts_bumpenvmat(DWORD state, IWineD3DStateBlockImpl *stateblock, str
      * map is read from a specified source stage(always stage - 1 for d3d). Thus set the matrix
      * for stage + 1. Keep the nvrc tex unit mapping in mind too
      */
-    if (mapped_stage < context->gl_info->max_textures)
+    if (mapped_stage < context->gl_info->limits.textures)
     {
         GL_EXTCALL(glActiveTextureARB(GL_TEXTURE0_ARB + mapped_stage));
         checkGLcall("GL_EXTCALL(glActiveTextureARB(GL_TEXTURE0_ARB + mapped_stage))");
@@ -662,8 +662,8 @@ static void nvrc_fragment_get_caps(WINED3DDEVTYPE devtype,
             WINED3DTEXOPCAPS_PREMODULATE */
 #endif
 
-    pCaps->MaxTextureBlendStages = gl_info->max_texture_stages;
-    pCaps->MaxSimultaneousTextures = gl_info->max_textures;
+    pCaps->MaxTextureBlendStages = gl_info->limits.texture_stages;
+    pCaps->MaxSimultaneousTextures = gl_info->limits.textures;
 
     pCaps->PrimitiveMiscCaps |=  WINED3DPMISCCAPS_TSSARGTEMP;
 
diff --git a/dlls/wined3d/pixelshader.c b/dlls/wined3d/pixelshader.c
index 09fbe24..d156498 100644
--- a/dlls/wined3d/pixelshader.c
+++ b/dlls/wined3d/pixelshader.c
@@ -261,10 +261,10 @@ static HRESULT pixelshader_set_function(IWineD3DPixelShaderImpl *shader,
 
     /* Don't do any register mapping magic if it is not needed, or if we can't
      * achieve anything anyway */
-    if (highest_reg_used < (gl_info->max_glsl_varyings / 4)
-            || num_regs_used > (gl_info->max_glsl_varyings / 4))
+    if (highest_reg_used < (gl_info->limits.glsl_varyings / 4)
+            || num_regs_used > (gl_info->limits.glsl_varyings / 4))
     {
-        if (num_regs_used > (gl_info->max_glsl_varyings / 4))
+        if (num_regs_used > (gl_info->limits.glsl_varyings / 4))
         {
             /* This happens with relative addressing. The input mapper function
              * warns about this if the higher registers are declared too, so
diff --git a/dlls/wined3d/state.c b/dlls/wined3d/state.c
index bb6f1da..5cd29db 100644
--- a/dlls/wined3d/state.c
+++ b/dlls/wined3d/state.c
@@ -689,16 +689,16 @@ static void state_specularenable(DWORD state, IWineD3DStateBlockImpl *stateblock
         glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, (float*) &stateblock->material.Specular);
         checkGLcall("glMaterialfv");
 
-        if (stateblock->material.Power > gl_info->max_shininess)
+        if (stateblock->material.Power > gl_info->limits.shininess)
         {
             /* glMaterialf man page says that the material says that GL_SHININESS must be between 0.0
              * and 128.0, although in d3d neither -1 nor 129 produce an error. GL_NV_max_light_exponent
-             * allows bigger values. If the extension is supported, gl_info->max_shininess contains the
-             * value reported by the extension, otherwise 128. For values > gl_info->max_shininess clamp
+             * allows bigger values. If the extension is supported, gl_info->limits.shininess contains the
+             * value reported by the extension, otherwise 128. For values > gl_info->limits.shininess clamp
              * them, it should be safe to do so without major visual distortions.
              */
-            WARN("Material power = %f, limit %f\n", stateblock->material.Power, gl_info->max_shininess);
-            glMaterialf(GL_FRONT_AND_BACK, GL_SHININESS, gl_info->max_shininess);
+            WARN("Material power = %f, limit %f\n", stateblock->material.Power, gl_info->limits.shininess);
+            glMaterialf(GL_FRONT_AND_BACK, GL_SHININESS, gl_info->limits.shininess);
         } else {
             glMaterialf(GL_FRONT_AND_BACK, GL_SHININESS, stateblock->material.Power);
         }
@@ -764,7 +764,7 @@ static void state_texfactor(DWORD state, IWineD3DStateBlockImpl *stateblock, str
     D3DCOLORTOGLFLOAT4(stateblock->renderState[WINED3DRS_TEXTUREFACTOR], col);
 
     /* And now the default texture color as well */
-    for (i = 0; i < context->gl_info->max_texture_stages; ++i)
+    for (i = 0; i < context->gl_info->limits.texture_stages; ++i)
     {
         /* Note the WINED3DRS value applies to all textures, but GL has one
          * per texture, so apply it now ready to be used!
@@ -1448,29 +1448,29 @@ static void state_pscale(DWORD state, IWineD3DStateBlockImpl *stateblock, struct
         GLfloat scaleFactor;
         float h = stateblock->viewport.Height;
 
-        if (pointSize.f < gl_info->max_pointsizemin)
+        if (pointSize.f < gl_info->limits.pointsize_min)
         {
             /* Minimum valid point size for OpenGL is driver specific. For Direct3D it is
              * 0.0f. This means that OpenGL will clamp really small point sizes to the
              * driver minimum. To correct for this we need to multiply by the scale factor when sizes
              * are less than 1.0f. scale_factor =  1.0f / point_size.
              */
-            scaleFactor = pointSize.f / gl_info->max_pointsizemin;
+            scaleFactor = pointSize.f / gl_info->limits.pointsize_min;
             /* Clamp the point size, don't rely on the driver to do it. MacOS says min point size
              * is 1.0, but then accepts points below that and draws too small points
              */
-            pointSize.f = gl_info->max_pointsizemin;
+            pointSize.f = gl_info->limits.pointsize_min;
         }
-        else if(pointSize.f > gl_info->max_pointsize)
+        else if(pointSize.f > gl_info->limits.pointsize_max)
         {
             /* gl already scales the input to glPointSize,
              * d3d scales the result after the point size scale.
              * If the point size is bigger than the max size, use the
              * scaling to scale it bigger, and set the gl point size to max
              */
-            scaleFactor = pointSize.f / gl_info->max_pointsize;
+            scaleFactor = pointSize.f / gl_info->limits.pointsize_max;
             TRACE("scale: %f\n", scaleFactor);
-            pointSize.f = gl_info->max_pointsize;
+            pointSize.f = gl_info->limits.pointsize_max;
         } else {
             scaleFactor = 1.0f;
         }
@@ -1573,9 +1573,9 @@ static void state_pointsprite(DWORD state, IWineD3DStateBlockImpl *stateblock, s
     {
         static BOOL warned;
 
-        if (gl_info->max_point_sprite_units < gl_info->max_textures && !warned)
+        if (gl_info->limits.point_sprite_units < gl_info->limits.textures && !warned)
         {
-            if (use_ps(stateblock) || stateblock->lowest_disabled_stage > gl_info->max_point_sprite_units)
+            if (use_ps(stateblock) || stateblock->lowest_disabled_stage > gl_info->limits.point_sprite_units)
             {
                 FIXME("The app uses point sprite texture coordinates on more units than supported by the driver\n");
                 warned = TRUE;
@@ -2953,7 +2953,7 @@ static void tex_colorop(DWORD state, IWineD3DStateBlockImpl *stateblock, struct
 
     if (mapped_stage != WINED3D_UNMAPPED_STAGE)
     {
-        if (tex_used && mapped_stage >= gl_info->max_textures)
+        if (tex_used && mapped_stage >= gl_info->limits.textures)
         {
             FIXME("Attempt to enable unsupported stage!\n");
             return;
@@ -3009,7 +3009,7 @@ void tex_alphaop(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d
     /* Do not care for enabled / disabled stages, just assign the settings. colorop disables / enables required stuff */
     if (mapped_stage != WINED3D_UNMAPPED_STAGE)
     {
-        if (tex_used && mapped_stage >= context->gl_info->max_textures)
+        if (tex_used && mapped_stage >= context->gl_info->limits.textures)
         {
             FIXME("Attempt to enable unsupported stage!\n");
             return;
@@ -3114,7 +3114,7 @@ static void transform_texture(DWORD state, IWineD3DStateBlockImpl *stateblock, s
     }
 
     if (mapped_stage == WINED3D_UNMAPPED_STAGE) return;
-    if (mapped_stage >= context->gl_info->max_textures) return;
+    if (mapped_stage >= context->gl_info->limits.textures) return;
 
     GL_EXTCALL(glActiveTextureARB(GL_TEXTURE0_ARB + mapped_stage));
     checkGLcall("glActiveTextureARB");
@@ -3147,7 +3147,7 @@ static void unloadTexCoords(const struct wined3d_context *context)
 {
     unsigned int texture_idx;
 
-    for (texture_idx = 0; texture_idx < context->gl_info->max_texture_stages; ++texture_idx)
+    for (texture_idx = 0; texture_idx < context->gl_info->limits.texture_stages; ++texture_idx)
     {
         GL_EXTCALL(glClientActiveTextureARB(GL_TEXTURE0_ARB + texture_idx));
         glDisableClientState(GL_TEXTURE_COORD_ARRAY);
@@ -3161,7 +3161,7 @@ static void loadTexCoords(const struct wined3d_context *context, IWineD3DStateBl
     unsigned int mapped_stage = 0;
     unsigned int textureNo = 0;
 
-    for (textureNo = 0; textureNo < context->gl_info->max_texture_stages; ++textureNo)
+    for (textureNo = 0; textureNo < context->gl_info->limits.texture_stages; ++textureNo)
     {
         int coordIdx = stateblock->textureState[textureNo][WINED3DTSS_TEXCOORDINDEX];
 
@@ -3193,9 +3193,10 @@ static void loadTexCoords(const struct wined3d_context *context, IWineD3DStateBl
             GL_EXTCALL(glMultiTexCoord4fARB(GL_TEXTURE0_ARB + mapped_stage, 0, 0, 0, 1));
         }
     }
-    if (GL_SUPPORT(NV_REGISTER_COMBINERS)) {
-        /* The number of the mapped stages increases monotonically, so it's fine to use the last used one */
-        for (textureNo = mapped_stage + 1; textureNo < context->gl_info->max_textures; ++textureNo)
+    if (GL_SUPPORT(NV_REGISTER_COMBINERS))
+    {
+        /* The number of the mapped stages increases monotonically, so it's fine to use the last used one. */
+        for (textureNo = mapped_stage + 1; textureNo < context->gl_info->limits.textures; ++textureNo)
         {
             GL_EXTCALL(glMultiTexCoord4fARB(GL_TEXTURE0_ARB + textureNo, 0, 0, 0, 1));
         }
@@ -3219,7 +3220,7 @@ static void tex_coordindex(DWORD state, IWineD3DStateBlockImpl *stateblock, stru
         return;
     }
 
-    if (mapped_stage >= context->gl_info->max_fragment_samplers)
+    if (mapped_stage >= context->gl_info->limits.fragment_samplers)
     {
         WARN("stage %u not mapped to a valid texture unit (%u)\n", stage, mapped_stage);
         return;
@@ -3459,7 +3460,7 @@ static void sampler(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wine
         return;
     }
 
-    if (mapped_stage >= gl_info->max_combined_samplers)
+    if (mapped_stage >= gl_info->limits.combined_samplers)
     {
         return;
     }
@@ -3499,7 +3500,7 @@ static void sampler(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wine
                 (IWineD3DDevice*)d3ddevice, use_ps(stateblock), use_vs(stateblock));
         }
     }
-    else if (mapped_stage < gl_info->max_textures)
+    else if (mapped_stage < gl_info->limits.textures)
     {
         if(sampler < stateblock->lowest_disabled_stage) {
             /* TODO: What should I do with pixel shaders here ??? */
@@ -3610,7 +3611,7 @@ static void clipplane(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wi
 {
     UINT index = state - STATE_CLIPPLANE(0);
 
-    if (isStateDirty(context, STATE_TRANSFORM(WINED3DTS_VIEW)) || index >= context->gl_info->max_clipplanes)
+    if (isStateDirty(context, STATE_TRANSFORM(WINED3DTS_VIEW)) || index >= context->gl_info->limits.clipplanes)
     {
         return;
     }
@@ -3648,7 +3649,7 @@ static void transform_worldex(DWORD state, IWineD3DStateBlockImpl *stateblock, s
     GLenum glMat;
     TRACE("Setting world matrix %d\n", matrix);
 
-    if (matrix >= context->gl_info->max_blends)
+    if (matrix >= context->gl_info->limits.blends)
     {
         WARN("Unsupported blend matrix set\n");
         return;
@@ -3721,7 +3722,7 @@ static void state_vertexblend(DWORD state, IWineD3DStateBlockImpl *stateblock, s
 
             if(!stateblock->wineD3DDevice->vertexBlendUsed) {
                 unsigned int i;
-                for (i = 1; i < context->gl_info->max_blends; ++i)
+                for (i = 1; i < context->gl_info->limits.blends; ++i)
                 {
                     if (!isStateDirty(context, STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(i))))
                     {
@@ -3775,7 +3776,7 @@ static void transform_view(DWORD state, IWineD3DStateBlockImpl *stateblock, stru
     }
 
     /* Reset Clipping Planes  */
-    for (k = 0; k < context->gl_info->max_clipplanes; ++k)
+    for (k = 0; k < context->gl_info->limits.clipplanes; ++k)
     {
         if(!isStateDirty(context, STATE_CLIPPLANE(k))) {
             clipplane(STATE_CLIPPLANE(k), stateblock, context);
@@ -3797,8 +3798,9 @@ static void transform_view(DWORD state, IWineD3DStateBlockImpl *stateblock, stru
     }
 
     /* Avoid looping over a number of matrices if the app never used the functionality */
-    if(stateblock->wineD3DDevice->vertexBlendUsed) {
-        for (k = 1; k < context->gl_info->max_blends; ++k)
+    if (stateblock->wineD3DDevice->vertexBlendUsed)
+    {
+        for (k = 1; k < context->gl_info->limits.blends; ++k)
         {
             if(!isStateDirty(context, STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(k)))) {
                 transform_worldex(STATE_TRANSFORM(WINED3DTS_WORLDMATRIX(k)), stateblock, context);
@@ -4592,7 +4594,7 @@ static void vertexdeclaration(DWORD state, IWineD3DStateBlockImpl *stateblock, s
             if(!device->vs_clipping && !isStateDirty(context, STATE_RENDER(WINED3DRS_CLIPPLANEENABLE))) {
                 state_clipping(STATE_RENDER(WINED3DRS_CLIPPLANEENABLE), stateblock, context);
             }
-            for (i = 0; i < gl_info->max_clipplanes; ++i)
+            for (i = 0; i < gl_info->limits.clipplanes; ++i)
             {
                 clipplane(STATE_CLIPPLANE(i), stateblock, context);
             }
@@ -4607,7 +4609,7 @@ static void vertexdeclaration(DWORD state, IWineD3DStateBlockImpl *stateblock, s
                 /* Disable all clip planes to get defined results on all drivers. See comment in the
                  * state_clipping state handler
                  */
-                for (i = 0; i < gl_info->max_clipplanes; ++i)
+                for (i = 0; i < gl_info->limits.clipplanes; ++i)
                 {
                     glDisable(GL_CLIP_PLANE0 + i);
                     checkGLcall("glDisable(GL_CLIP_PLANE0 + i)");
@@ -4637,7 +4639,7 @@ static void vertexdeclaration(DWORD state, IWineD3DStateBlockImpl *stateblock, s
              * (Note: ARB shaders can read the clip planes for clipping emulation even if
              * device->vs_clipping is false.
              */
-            for (i = 0; i < gl_info->max_clipplanes; ++i)
+            for (i = 0; i < gl_info->limits.clipplanes; ++i)
             {
                 clipplane(STATE_CLIPPLANE(i), stateblock, context);
             }
@@ -5593,8 +5595,8 @@ static void ffp_fragment_get_caps(WINED3DDEVTYPE devtype,
     if (GL_SUPPORT(ARB_TEXTURE_ENV_DOT3))
         pCaps->TextureOpCaps |= WINED3DTEXOPCAPS_DOTPRODUCT3;
 
-    pCaps->MaxTextureBlendStages = gl_info->max_texture_stages;
-    pCaps->MaxSimultaneousTextures = gl_info->max_textures;
+    pCaps->MaxTextureBlendStages = gl_info->limits.texture_stages;
+    pCaps->MaxSimultaneousTextures = gl_info->limits.textures;
 }
 
 static HRESULT ffp_fragment_alloc(IWineD3DDevice *iface) { return WINED3D_OK; }
diff --git a/dlls/wined3d/stateblock.c b/dlls/wined3d/stateblock.c
index 2ab1fd9..5c33609 100644
--- a/dlls/wined3d/stateblock.c
+++ b/dlls/wined3d/stateblock.c
@@ -1177,7 +1177,7 @@ static HRESULT  WINAPI IWineD3DStateBlockImpl_InitStartupStateBlock(IWineD3DStat
     tmpfloat.f = 1.0f;
     IWineD3DDevice_SetRenderState(device, WINED3DRS_PATCHSEGMENTS,            tmpfloat.d);
     IWineD3DDevice_SetRenderState(device, WINED3DRS_DEBUGMONITORTOKEN,        0xbaadcafe);
-    tmpfloat.f = gl_info->max_pointsize;
+    tmpfloat.f = gl_info->limits.pointsize_max;
     IWineD3DDevice_SetRenderState(device, WINED3DRS_POINTSIZE_MAX,            tmpfloat.d);
     IWineD3DDevice_SetRenderState(device, WINED3DRS_INDEXEDVERTEXBLENDENABLE, FALSE);
     IWineD3DDevice_SetRenderState(device, WINED3DRS_COLORWRITEENABLE,         0x0000000F);
@@ -1271,7 +1271,7 @@ static HRESULT  WINAPI IWineD3DStateBlockImpl_InitStartupStateBlock(IWineD3DStat
         This->samplerState[i][WINED3DSAMP_DMAPOFFSET       ] = 0; /* TODO: Vertex offset in the presampled displacement map */
     }
 
-    for (i = 0; i < gl_info->max_textures; ++i)
+    for (i = 0; i < gl_info->limits.textures; ++i)
     {
         /* Note: This avoids calling SetTexture, so pretend it has been called */
         This->changed.textures |= 1 << i;
diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
index 086f9bd..1c57e11 100644
--- a/dlls/wined3d/surface.c
+++ b/dlls/wined3d/surface.c
@@ -4198,7 +4198,7 @@ static HRESULT WINAPI IWineD3DSurfaceImpl_PrivateSetup(IWineD3DSurface *iface) {
     }
 
     TRACE("%p\n", This);
-    if ((This->pow2Width > gl_info->max_texture_size || This->pow2Height > gl_info->max_texture_size)
+    if ((This->pow2Width > gl_info->limits.texture_size || This->pow2Height > gl_info->limits.texture_size)
             && !(This->resource.usage & (WINED3DUSAGE_RENDERTARGET | WINED3DUSAGE_DEPTHSTENCIL)))
     {
         /* one of three options
diff --git a/dlls/wined3d/utils.c b/dlls/wined3d/utils.c
index af780b5..d9d6503 100644
--- a/dlls/wined3d/utils.c
+++ b/dlls/wined3d/utils.c
@@ -916,7 +916,7 @@ static void init_format_filter_info(struct wined3d_gl_info *gl_info, enum wined3
             TRACE("Nvidia card with texture_float support: Assuming float16 blending\n");
             filtered = TRUE;
         }
-        else if (gl_info->max_glsl_varyings > 44)
+        else if (gl_info->limits.glsl_varyings > 44)
         {
             TRACE("More than 44 GLSL varyings - assuming d3d10 card with float16 blending\n");
             filtered = TRUE;
@@ -2192,7 +2192,7 @@ BOOL CalculateTexRect(IWineD3DSurfaceImpl *This, RECT *Rect, float glTexCoord[4]
     const struct wined3d_gl_info *gl_info = &This->resource.wineD3DDevice->adapter->gl_info;
     int x1 = Rect->left, x2 = Rect->right;
     int y1 = Rect->top, y2 = Rect->bottom;
-    GLint maxSize = gl_info->max_texture_size;
+    GLint maxSize = gl_info->limits.texture_size;
 
     TRACE("(%p)->(%d,%d)-(%d,%d)\n", This,
           Rect->left, Rect->top, Rect->right, Rect->bottom);
@@ -2275,8 +2275,9 @@ BOOL CalculateTexRect(IWineD3DSurfaceImpl *This, RECT *Rect, float glTexCoord[4]
                 This->glRect.right = This->pow2Width;
             }
 
-            if(This->pow2Height > maxSize) {
-                This->glRect.top = x1 - gl_info->max_texture_size / 2;
+            if (This->pow2Height > maxSize)
+            {
+                This->glRect.top = x1 - gl_info->limits.texture_size / 2;
                 if(This->glRect.top < 0) This->glRect.top = 0;
                 This->glRect.bottom = This->glRect.left + maxSize;
                 if(This->glRect.bottom > This->currentDesc.Height) {
@@ -2350,7 +2351,7 @@ void gen_ffp_frag_op(IWineD3DStateBlockImpl *stateblock, struct ffp_frag_setting
     IWineD3DDeviceImpl *device = stateblock->wineD3DDevice;
     const struct wined3d_gl_info *gl_info = &device->adapter->gl_info;
 
-    for (i = 0; i < gl_info->max_texture_stages; ++i)
+    for (i = 0; i < gl_info->limits.texture_stages; ++i)
     {
         IWineD3DBaseTextureImpl *texture;
         settings->op[i].padding = 0;
@@ -2662,7 +2663,7 @@ void sampler_texdim(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wine
     * handler takes care. Also no action is needed with pixel shaders, or if tex_colorop
     * will take care of this business
     */
-    if (mapped_stage == WINED3D_UNMAPPED_STAGE || mapped_stage >= context->gl_info->max_textures) return;
+    if (mapped_stage == WINED3D_UNMAPPED_STAGE || mapped_stage >= context->gl_info->limits.textures) return;
     if(sampler >= stateblock->lowest_disabled_stage) return;
     if(isStateDirty(context, STATE_TEXTURESTAGE(sampler, WINED3DTSS_COLOROP))) return;
 
diff --git a/dlls/wined3d/wined3d_gl.h b/dlls/wined3d/wined3d_gl.h
index 6536641..4eb57d2 100644
--- a/dlls/wined3d/wined3d_gl.h
+++ b/dlls/wined3d/wined3d_gl.h
@@ -4057,46 +4057,49 @@ struct wined3d_fbo_ops
     PGLFNGLGENERATEMIPMAPPROC                       glGenerateMipmap;
 };
 
+struct wined3d_gl_limits
+{
+    UINT buffers;
+    UINT lights;
+    UINT textures;
+    UINT texture_stages;
+    UINT fragment_samplers;
+    UINT vertex_samplers;
+    UINT combined_samplers;
+    UINT sampler_stages;
+    UINT clipplanes;
+    UINT texture_size;
+    UINT texture3d_size;
+    float pointsize_max;
+    float pointsize_min;
+    UINT point_sprite_units;
+    UINT blends;
+    UINT anisotropy;
+    float shininess;
+
+    UINT glsl_varyings;
+    UINT glsl_vs_float_constants;
+    UINT glsl_ps_float_constants;
+
+    UINT arb_vs_float_constants;
+    UINT arb_vs_native_constants;
+    UINT arb_vs_instructions;
+    UINT arb_vs_temps;
+    UINT arb_ps_float_constants;
+    UINT arb_ps_local_constants;
+    UINT arb_ps_native_constants;
+    UINT arb_ps_instructions;
+    UINT arb_ps_temps;
+};
+
 #define USE_GL_FUNC(type, pfn, ext, replace) type pfn;
 
 struct wined3d_gl_info
 {
     UINT vidmem;
-
-    UINT max_buffers;
-    UINT max_lights;
-    UINT max_textures;
-    UINT max_texture_stages;
-    UINT max_fragment_samplers;
-    UINT max_vertex_samplers;
-    UINT max_combined_samplers;
-    UINT max_sampler_stages;
-    UINT max_clipplanes;
-    UINT max_texture_size;
-    UINT max_texture3d_size;
-    float max_pointsize, max_pointsizemin;
-    UINT max_point_sprite_units;
-    UINT max_blends;
-    UINT max_anisotropy;
-    UINT max_glsl_varyings;
-    float max_shininess;
-
-    unsigned int max_vs_arb_constantsF;
-    unsigned int max_vs_arb_native_constants;
-    unsigned int max_vs_arb_instructions;
-    unsigned int max_vs_arb_temps;
-    unsigned int max_ps_arb_constantsF;
-    unsigned int max_ps_arb_local_constants;
-    unsigned int max_ps_arb_native_constants;
-    unsigned int max_ps_arb_instructions;
-    unsigned int max_ps_arb_temps;
-    unsigned int max_vs_glsl_constantsF;
-    unsigned int max_ps_glsl_constantsF;
-
+    struct wined3d_gl_limits limits;
     DWORD reserved_glsl_constants;
-
     DWORD quirks;
-
     BOOL supported[WINED3D_GL_EXT_COUNT];
 
     struct wined3d_fbo_ops fbo_ops;
-- 
1.6.4.4




More information about the wine-patches mailing list