Commit 48e03bc1 authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

wined3d: Introduce a separate structure for various OpenGL implementation limits.

parent d7b08761
...@@ -629,13 +629,13 @@ static DWORD shader_generate_arb_declarations(IWineD3DBaseShader *iface, const s ...@@ -629,13 +629,13 @@ static DWORD shader_generate_arb_declarations(IWineD3DBaseShader *iface, const s
*/ */
if (pshader) if (pshader)
{ {
max_constantsF = gl_info->max_ps_arb_native_constants; max_constantsF = gl_info->limits.arb_ps_native_constants;
} }
else else
{ {
if(This->baseShader.reg_maps.usesrelconstF) { if(This->baseShader.reg_maps.usesrelconstF) {
DWORD highest_constf = 0, clip_limit; 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); max_constantsF -= count_bits(This->baseShader.reg_maps.integer_constants);
for(i = 0; i < This->baseShader.limits.constant_float; i++) for(i = 0; i < This->baseShader.limits.constant_float; i++)
...@@ -647,7 +647,7 @@ static DWORD shader_generate_arb_declarations(IWineD3DBaseShader *iface, const s ...@@ -647,7 +647,7 @@ static DWORD shader_generate_arb_declarations(IWineD3DBaseShader *iface, const s
if(use_nv_clip(gl_info) && ctx->target_version >= NV2) if(use_nv_clip(gl_info) && ctx->target_version >= NV2)
{ {
clip_limit = gl_info->max_clipplanes; clip_limit = gl_info->limits.clipplanes;
} }
else else
{ {
...@@ -658,14 +658,14 @@ static DWORD shader_generate_arb_declarations(IWineD3DBaseShader *iface, const s ...@@ -658,14 +658,14 @@ static DWORD shader_generate_arb_declarations(IWineD3DBaseShader *iface, const s
max_constantsF -= *num_clipplanes; max_constantsF -= *num_clipplanes;
if(*num_clipplanes < clip_limit) 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 else
{ {
if (ctx->target_version >= NV2) *num_clipplanes = gl_info->max_clipplanes; if (ctx->target_version >= NV2) *num_clipplanes = gl_info->limits.clipplanes;
else *num_clipplanes = min(gl_info->max_clipplanes, 4); else *num_clipplanes = min(gl_info->limits.clipplanes, 4);
max_constantsF = gl_info->max_vs_arb_native_constants; max_constantsF = gl_info->limits.arb_vs_native_constants;
} }
} }
...@@ -703,11 +703,11 @@ static DWORD shader_generate_arb_declarations(IWineD3DBaseShader *iface, const s ...@@ -703,11 +703,11 @@ static DWORD shader_generate_arb_declarations(IWineD3DBaseShader *iface, const s
*/ */
if(pshader) 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 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 */ /* Avoid declaring more constants than needed */
...@@ -2951,7 +2951,7 @@ static void vshader_add_footer(IWineD3DVertexShaderImpl *This, struct wined3d_sh ...@@ -2951,7 +2951,7 @@ static void vshader_add_footer(IWineD3DVertexShaderImpl *This, struct wined3d_sh
unsigned int cur_clip = 0; unsigned int cur_clip = 0;
char component[4] = {'x', 'y', 'z', 'w'}; 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)) if(args->boolclip.clipplane_mask & (1 << i))
{ {
...@@ -3493,7 +3493,7 @@ static GLuint shader_arb_generate_pshader(IWineD3DPixelShaderImpl *This, struct ...@@ -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; struct arb_ps_np2fixup_info* const fixup = priv_ctx.cur_np2fixup_info;
const WORD map = priv_ctx.cur_ps_args->super.np2_fixup; 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->offset = next_local;
fixup->super.active = 0; fixup->super.active = 0;
...@@ -4010,7 +4010,7 @@ static struct arb_ps_compiled_shader *find_arb_pshader(IWineD3DPixelShaderImpl * ...@@ -4010,7 +4010,7 @@ static struct arb_ps_compiled_shader *find_arb_pshader(IWineD3DPixelShaderImpl *
if (!device->vs_clipping) if (!device->vs_clipping)
shader_data->clipplane_emulation = shader_find_free_input_register(&shader->baseShader.reg_maps, 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 else
shader_data->clipplane_emulation = ~0U; shader_data->clipplane_emulation = ~0U;
} }
...@@ -4219,7 +4219,7 @@ static inline void find_arb_vs_compile_args(IWineD3DVertexShaderImpl *shader, IW ...@@ -4219,7 +4219,7 @@ static inline void find_arb_vs_compile_args(IWineD3DVertexShaderImpl *shader, IW
args->ps_signature = ~0; args->ps_signature = ~0;
if(!dev->vs_clipping) 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 */ /* Otherwise: Setting boolclip_compare set clip_texcoord to 0 */
} }
...@@ -4542,8 +4542,8 @@ static BOOL shader_arb_dirty_const(IWineD3DDevice *iface) { ...@@ -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, static void shader_arb_get_caps(WINED3DDEVTYPE devtype, const struct wined3d_gl_info *gl_info,
struct shader_caps *pCaps) struct shader_caps *pCaps)
{ {
DWORD vs_consts = min(gl_info->max_vs_arb_constantsF, gl_info->max_vs_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->max_ps_arb_constantsF, gl_info->max_ps_arb_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, /* We don't have an ARB fixed function pipeline yet, so let the none backend set its caps,
* then overwrite the shader specific ones * then overwrite the shader specific ones
...@@ -5232,7 +5232,7 @@ static void arbfp_get_caps(WINED3DDEVTYPE devtype, const struct wined3d_gl_info ...@@ -5232,7 +5232,7 @@ static void arbfp_get_caps(WINED3DDEVTYPE devtype, const struct wined3d_gl_info
/* TODO: Implement WINED3DTEXOPCAPS_PREMODULATE */ /* TODO: Implement WINED3DTEXOPCAPS_PREMODULATE */
caps->MaxTextureBlendStages = 8; 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; caps->PrimitiveMiscCaps |= WINED3DPMISCCAPS_TSSARGTEMP;
} }
...@@ -5886,7 +5886,7 @@ static void fragment_prog_arbfp(DWORD state, IWineD3DStateBlockImpl *stateblock, ...@@ -5886,7 +5886,7 @@ static void fragment_prog_arbfp(DWORD state, IWineD3DStateBlockImpl *stateblock,
return; return;
} }
new_desc->num_textures_used = 0; 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; if(settings.op[i].cop == WINED3DTOP_DISABLE) break;
new_desc->num_textures_used = i; new_desc->num_textures_used = i;
......
...@@ -402,7 +402,7 @@ static GLuint gen_ati_shader(const struct texture_stage_op op[MAX_TEXTURES], con ...@@ -402,7 +402,7 @@ static GLuint gen_ati_shader(const struct texture_stage_op op[MAX_TEXTURES], con
checkGLcall("GL_EXTCALL(glBeginFragmentShaderATI())"); checkGLcall("GL_EXTCALL(glBeginFragmentShaderATI())");
/* Pass 1: Generate sampling instructions for perturbation maps */ /* 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_DISABLE) break;
if(op[stage].cop != WINED3DTOP_BUMPENVMAP && if(op[stage].cop != WINED3DTOP_BUMPENVMAP &&
...@@ -428,7 +428,7 @@ static GLuint gen_ati_shader(const struct texture_stage_op op[MAX_TEXTURES], con ...@@ -428,7 +428,7 @@ static GLuint gen_ati_shader(const struct texture_stage_op op[MAX_TEXTURES], con
} }
/* Pass 2: Generate perturbation calculations */ /* 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; GLuint argmodextra_x, argmodextra_y;
struct color_fixup_desc fixup; struct color_fixup_desc fixup;
...@@ -477,7 +477,7 @@ static GLuint gen_ati_shader(const struct texture_stage_op op[MAX_TEXTURES], con ...@@ -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 */ /* 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) { if(op[stage].cop == WINED3DTOP_DISABLE) {
break; break;
...@@ -818,7 +818,7 @@ static void set_tex_op_atifs(DWORD state, IWineD3DStateBlockImpl *stateblock, st ...@@ -818,7 +818,7 @@ static void set_tex_op_atifs(DWORD state, IWineD3DStateBlockImpl *stateblock, st
return; return;
} }
new_desc->num_textures_used = 0; 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; if(settings.op[i].cop == WINED3DTOP_DISABLE) break;
new_desc->num_textures_used = i; new_desc->num_textures_used = i;
......
...@@ -88,7 +88,7 @@ static void context_clean_fbo_attachments(const struct wined3d_gl_info *gl_info) ...@@ -88,7 +88,7 @@ static void context_clean_fbo_attachments(const struct wined3d_gl_info *gl_info)
{ {
unsigned int i; 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); gl_info->fbo_ops.glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0 + i, GL_TEXTURE_2D, 0, 0);
checkGLcall("glFramebufferTexture2D()"); checkGLcall("glFramebufferTexture2D()");
...@@ -295,7 +295,7 @@ static void context_check_fbo_status(struct wined3d_context *context) ...@@ -295,7 +295,7 @@ static void context_check_fbo_status(struct wined3d_context *context)
} }
/* Dump the FBO attachments */ /* 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]; attachment = (IWineD3DSurfaceImpl *)context->current_fbo->render_targets[i];
if (attachment) if (attachment)
...@@ -322,8 +322,8 @@ static struct fbo_entry *context_create_fbo_entry(struct wined3d_context *contex ...@@ -322,8 +322,8 @@ static struct fbo_entry *context_create_fbo_entry(struct wined3d_context *contex
struct fbo_entry *entry; struct fbo_entry *entry;
entry = HeapAlloc(GetProcessHeap(), 0, sizeof(*entry)); entry = HeapAlloc(GetProcessHeap(), 0, sizeof(*entry));
entry->render_targets = HeapAlloc(GetProcessHeap(), 0, 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->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->depth_stencil = device->stencilBufferTarget;
entry->attached = FALSE; entry->attached = FALSE;
entry->id = 0; entry->id = 0;
...@@ -340,7 +340,7 @@ static void context_reuse_fbo_entry(struct wined3d_context *context, struct fbo_ ...@@ -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_bind_fbo(context, GL_FRAMEBUFFER, &entry->id);
context_clean_fbo_attachments(gl_info); 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->depth_stencil = device->stencilBufferTarget;
entry->attached = FALSE; entry->attached = FALSE;
} }
...@@ -370,7 +370,7 @@ static struct fbo_entry *context_find_fbo_entry(struct wined3d_context *context) ...@@ -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) LIST_FOR_EACH_ENTRY(entry, &context->fbo_list, struct fbo_entry, entry)
{ {
if (!memcmp(entry->render_targets, 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) && entry->depth_stencil == device->stencilBufferTarget)
{ {
list_remove(&entry->entry); list_remove(&entry->entry);
...@@ -408,7 +408,7 @@ static void context_apply_fbo_entry(struct wined3d_context *context, struct fbo_ ...@@ -408,7 +408,7 @@ static void context_apply_fbo_entry(struct wined3d_context *context, struct fbo_
if (!entry->attached) if (!entry->attached)
{ {
/* Apply render targets */ /* 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]; IWineD3DSurface *render_target = device->render_targets[i];
context_attach_surface_fbo(context, GL_FRAMEBUFFER, i, render_target); 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_ ...@@ -428,7 +428,7 @@ static void context_apply_fbo_entry(struct wined3d_context *context, struct fbo_
} }
else else
{ {
for (i = 0; i < gl_info->max_buffers; ++i) for (i = 0; i < gl_info->limits.buffers; ++i)
{ {
if (device->render_targets[i]) if (device->render_targets[i])
context_apply_attachment_filter_states(device->render_targets[i], FALSE); 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_ ...@@ -437,7 +437,7 @@ static void context_apply_fbo_entry(struct wined3d_context *context, struct fbo_
context_apply_attachment_filter_states(device->stencilBufferTarget, FALSE); 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]) if (device->render_targets[i])
device->draw_buffers[i] = GL_COLOR_ATTACHMENT0 + i; device->draw_buffers[i] = GL_COLOR_ATTACHMENT0 + i;
...@@ -621,7 +621,7 @@ void context_resource_released(IWineD3DDevice *iface, IWineD3DResource *resource ...@@ -621,7 +621,7 @@ void context_resource_released(IWineD3DDevice *iface, IWineD3DResource *resource
continue; 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) if (entry->render_targets[j] == (IWineD3DSurface *)resource)
{ {
...@@ -1434,7 +1434,7 @@ struct wined3d_context *context_create(IWineD3DDeviceImpl *This, IWineD3DSurface ...@@ -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 /* 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. * 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)); GL_EXTCALL(glActiveTextureARB(GL_TEXTURE0_ARB + s));
glTexEnvi(GL_TEXTURE_SHADER_NV, GL_PREVIOUS_TEXTURE_INPUT_NV, GL_TEXTURE0_ARB + s - 1); 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 ...@@ -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)); 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)); GL_EXTCALL(glActiveTextureARB(GL_TEXTURE0_ARB + s));
glTexEnvi(GL_POINT_SPRITE_ARB, GL_COORD_REPLACE_ARB, GL_TRUE); glTexEnvi(GL_POINT_SPRITE_ARB, GL_COORD_REPLACE_ARB, GL_TRUE);
...@@ -1667,7 +1667,7 @@ static inline void SetupForBlit(IWineD3DDeviceImpl *This, struct wined3d_context ...@@ -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 * 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 * 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]; sampler = This->rev_tex_unit_map[i];
GL_EXTCALL(glActiveTextureARB(GL_TEXTURE0_ARB + i)); GL_EXTCALL(glActiveTextureARB(GL_TEXTURE0_ARB + i));
...@@ -2061,7 +2061,7 @@ static void context_apply_draw_buffer(struct wined3d_context *context, BOOL blit ...@@ -2061,7 +2061,7 @@ static void context_apply_draw_buffer(struct wined3d_context *context, BOOL blit
{ {
if (GL_SUPPORT(ARB_DRAW_BUFFERS)) 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()"); checkGLcall("glDrawBuffers()");
} }
else else
......
...@@ -1698,7 +1698,7 @@ static void create_dummy_textures(IWineD3DDeviceImpl *This) { ...@@ -1698,7 +1698,7 @@ static void create_dummy_textures(IWineD3DDeviceImpl *This) {
checkGLcall("glPixelStorei(GL_UNPACK_CLIENT_STORAGE_APPLE, GL_FALSE)"); 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; GLubyte white = 255;
...@@ -1761,9 +1761,9 @@ static HRESULT WINAPI IWineD3DDeviceImpl_Init3D(IWineD3DDevice *iface, ...@@ -1761,9 +1761,9 @@ static HRESULT WINAPI IWineD3DDeviceImpl_Init3D(IWineD3DDevice *iface,
IWineD3DStateBlock_AddRef((IWineD3DStateBlock*)This->updateStateBlock); IWineD3DStateBlock_AddRef((IWineD3DStateBlock*)This->updateStateBlock);
This->render_targets = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, 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, This->draw_buffers = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
sizeof(GLenum) * gl_info->max_buffers); sizeof(GLenum) * gl_info->limits.buffers);
This->NumberOfPalettes = 1; This->NumberOfPalettes = 1;
This->palettes = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(PALETTEENTRY*)); This->palettes = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(PALETTEENTRY*));
...@@ -1787,7 +1787,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_Init3D(IWineD3DDevice *iface, ...@@ -1787,7 +1787,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_Init3D(IWineD3DDevice *iface,
/* Initialize the texture unit mapping to a 1:1 mapping */ /* Initialize the texture unit mapping to a 1:1 mapping */
for (state = 0; state < MAX_COMBINED_SAMPLERS; ++state) 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->texUnitMap[state] = state;
This->rev_tex_unit_map[state] = state; This->rev_tex_unit_map[state] = state;
...@@ -2738,7 +2738,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetClipPlane(IWineD3DDevice *iface, DWO ...@@ -2738,7 +2738,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetClipPlane(IWineD3DDevice *iface, DWO
TRACE("(%p) : for idx %d, %p\n", This, Index, pPlane); TRACE("(%p) : for idx %d, %p\n", This, Index, pPlane);
/* Validate 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"); TRACE("Application has requested clipplane this device doesn't support\n");
return WINED3DERR_INVALIDCALL; return WINED3DERR_INVALIDCALL;
...@@ -2775,7 +2775,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_GetClipPlane(IWineD3DDevice *iface, DWO ...@@ -2775,7 +2775,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_GetClipPlane(IWineD3DDevice *iface, DWO
TRACE("(%p) : for idx %d\n", This, Index); TRACE("(%p) : for idx %d\n", This, Index);
/* Validate 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"); TRACE("Application has requested clipplane this device doesn't support\n");
return WINED3DERR_INVALIDCALL; return WINED3DERR_INVALIDCALL;
...@@ -3475,7 +3475,7 @@ static void device_map_vsamplers(IWineD3DDeviceImpl *This, BOOL ps) { ...@@ -3475,7 +3475,7 @@ static void device_map_vsamplers(IWineD3DDeviceImpl *This, BOOL ps) {
const WINED3DSAMPLER_TEXTURE_TYPE *vshader_sampler_type = const WINED3DSAMPLER_TEXTURE_TYPE *vshader_sampler_type =
((IWineD3DVertexShaderImpl *)This->stateBlock->vertexShader)->baseShader.reg_maps.sampler_type; ((IWineD3DVertexShaderImpl *)This->stateBlock->vertexShader)->baseShader.reg_maps.sampler_type;
const WINED3DSAMPLER_TEXTURE_TYPE *pshader_sampler_type = NULL; 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; int i;
if (ps) { if (ps) {
...@@ -4196,7 +4196,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetTextureStageState(IWineD3DDevice *if ...@@ -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. * 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) { if(This->updateStateBlock->textureState[i][WINED3DTSS_COLOROP] == WINED3DTOP_DISABLE) {
break; break;
...@@ -5905,10 +5905,10 @@ static void WINAPI IWineD3DDeviceImpl_ClearRendertargetView(IWineD3DDevice *ifac ...@@ -5905,10 +5905,10 @@ static void WINAPI IWineD3DDeviceImpl_ClearRendertargetView(IWineD3DDevice *ifac
static HRESULT WINAPI IWineD3DDeviceImpl_GetRenderTarget(IWineD3DDevice* iface,DWORD RenderTargetIndex, IWineD3DSurface **ppRenderTarget) { static HRESULT WINAPI IWineD3DDeviceImpl_GetRenderTarget(IWineD3DDevice* iface,DWORD RenderTargetIndex, IWineD3DSurface **ppRenderTarget) {
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; 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", 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; return WINED3DERR_INVALIDCALL;
} }
...@@ -6178,10 +6178,10 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetRenderTarget(IWineD3DDevice *iface, ...@@ -6178,10 +6178,10 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetRenderTarget(IWineD3DDevice *iface,
TRACE("(%p) : Setting rendertarget %d to %p\n", This, RenderTargetIndex, pRenderTarget); 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", 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; return WINED3DERR_INVALIDCALL;
} }
...@@ -6647,7 +6647,7 @@ void delete_opengl_contexts(IWineD3DDevice *iface, IWineD3DSwapChain *swapchain_ ...@@ -6647,7 +6647,7 @@ void delete_opengl_contexts(IWineD3DDevice *iface, IWineD3DSwapChain *swapchain_
This->shader_backend->shader_free_private(iface); This->shader_backend->shader_free_private(iface);
ENTER_GL(); 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 */ /* Textures are recreated below */
glDeleteTextures(1, &This->dummyTextureName[i]); glDeleteTextures(1, &This->dummyTextureName[i]);
...@@ -6983,7 +6983,7 @@ void device_resource_released(IWineD3DDeviceImpl *This, IWineD3DResource *resour ...@@ -6983,7 +6983,7 @@ void device_resource_released(IWineD3DDeviceImpl *This, IWineD3DResource *resour
if (This->d3d_initialized) 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) { if (This->render_targets[i] == (IWineD3DSurface *)resource) {
This->render_targets[i] = NULL; This->render_targets[i] = NULL;
......
...@@ -76,7 +76,7 @@ static void drawStridedSlow(IWineD3DDevice *iface, const struct wined3d_context ...@@ -76,7 +76,7 @@ static void drawStridedSlow(IWineD3DDevice *iface, const struct wined3d_context
long SkipnStrides = startIdx + This->stateBlock->loadBaseVertexIndex; long SkipnStrides = startIdx + This->stateBlock->loadBaseVertexIndex;
BOOL pixelShader = use_ps(This->stateBlock); BOOL pixelShader = use_ps(This->stateBlock);
BOOL specular_fog = FALSE; 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 *texCoords[WINED3DDP_MAXTEXCOORD];
const BYTE *diffuse = NULL, *specular = NULL, *normal = NULL, *position = NULL; const BYTE *diffuse = NULL, *specular = NULL, *normal = NULL, *position = NULL;
const struct wined3d_stream_info_element *element; const struct wined3d_stream_info_element *element;
...@@ -582,7 +582,7 @@ void drawPrimitive(IWineD3DDevice *iface, UINT index_count, UINT StartIdx, UINT ...@@ -582,7 +582,7 @@ void drawPrimitive(IWineD3DDevice *iface, UINT index_count, UINT StartIdx, UINT
if (This->stateBlock->renderState[WINED3DRS_COLORWRITEENABLE]) if (This->stateBlock->renderState[WINED3DRS_COLORWRITEENABLE])
{ {
/* Invalidate the back buffer memory so LockRect will read it the next time */ /* 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]; target = (IWineD3DSurfaceImpl *)This->render_targets[i];
if (target) if (target)
...@@ -860,7 +860,7 @@ HRESULT tesselate_rectpatch(IWineD3DDeviceImpl *This, ...@@ -860,7 +860,7 @@ HRESULT tesselate_rectpatch(IWineD3DDeviceImpl *This,
checkGLcall("glLightModel for MODEL_AMBIENT"); checkGLcall("glLightModel for MODEL_AMBIENT");
IWineD3DDeviceImpl_MarkStateDirty(This, STATE_RENDER(WINED3DRS_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); glDisable(GL_LIGHT0 + i);
checkGLcall("glDisable(GL_LIGHT0 + i)"); checkGLcall("glDisable(GL_LIGHT0 + i)");
......
...@@ -254,7 +254,7 @@ static void shader_glsl_load_psamplers(const struct wined3d_gl_info *gl_info, ...@@ -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)); name_loc = GL_EXTCALL(glGetUniformLocationARB(programId, sampler_name));
if (name_loc != -1) { if (name_loc != -1) {
DWORD mapped_unit = tex_unit_map[i]; 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); TRACE("Loading %s for texture %d\n", sampler_name, mapped_unit);
GL_EXTCALL(glUniform1iARB(name_loc, 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, ...@@ -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)); name_loc = GL_EXTCALL(glGetUniformLocationARB(programId, sampler_name));
if (name_loc != -1) { if (name_loc != -1) {
DWORD mapped_unit = tex_unit_map[MAX_FRAGMENT_SAMPLERS + i]; 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); TRACE("Loading %s for texture %d\n", sampler_name, mapped_unit);
GL_EXTCALL(glUniform1iARB(name_loc, mapped_unit)); GL_EXTCALL(glUniform1iARB(name_loc, mapped_unit));
...@@ -794,7 +794,7 @@ static void shader_glsl_update_float_pixel_constants(IWineD3DDevice *iface, UINT ...@@ -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) 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 */ /* 4.0 shaders do not write clip coords because d3d10 does not support user clipplanes */
if(shader_major > 3) return ret; if(shader_major > 3) return ret;
...@@ -842,9 +842,10 @@ static void shader_generate_glsl_declarations(const struct wined3d_context *cont ...@@ -842,9 +842,10 @@ static void shader_generate_glsl_declarations(const struct wined3d_context *cont
* 1) The shader really uses more uniforms than supported * 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 * 2) The shader uses indirect addressing, less constants than supported, but uses a constant index > #supported consts
*/ */
if(pshader) { if (pshader)
/* No indirect addressing here */ {
max_constantsF = gl_info->max_ps_glsl_constantsF; /* No indirect addressing here. */
max_constantsF = gl_info->limits.glsl_ps_float_constants;
} }
else else
{ {
...@@ -856,7 +857,7 @@ static void shader_generate_glsl_declarations(const struct wined3d_context *cont ...@@ -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. * 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); 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, /* 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 * 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 ...@@ -868,7 +869,7 @@ static void shader_generate_glsl_declarations(const struct wined3d_context *cont
} }
else 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); 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 ...@@ -928,7 +929,8 @@ static void shader_generate_glsl_declarations(const struct wined3d_context *cont
} }
if (reg_maps->vpos || reg_maps->usesdsy) 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"); shader_addline(buffer, "uniform vec4 ycorrection;\n");
((IWineD3DPixelShaderImpl *) This)->vpos_uniform = 1; ((IWineD3DPixelShaderImpl *) This)->vpos_uniform = 1;
...@@ -1314,8 +1316,8 @@ static void shader_glsl_get_register_name(const struct wined3d_shader_register * ...@@ -1314,8 +1316,8 @@ static void shader_glsl_get_register_name(const struct wined3d_shader_register *
break; break;
case WINED3DSPR_COLOROUT: case WINED3DSPR_COLOROUT:
if (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->max_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); sprintf(register_name, "gl_FragData[%u]", reg->idx);
break; break;
...@@ -4138,8 +4140,9 @@ static void set_glsl_shader_program(const struct wined3d_context *context, ...@@ -4138,8 +4140,9 @@ static void set_glsl_shader_program(const struct wined3d_context *context,
GL_EXTCALL(glLinkProgramARB(programId)); GL_EXTCALL(glLinkProgramARB(programId));
print_glsl_info_log(gl_info, programId); print_glsl_info_log(gl_info, programId);
entry->vuniformF_locations = HeapAlloc(GetProcessHeap(), 0, sizeof(GLhandleARB) * gl_info->max_vs_glsl_constantsF); entry->vuniformF_locations = HeapAlloc(GetProcessHeap(), 0,
for (i = 0; i < gl_info->max_vs_glsl_constantsF; ++i) 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); snprintf(glsl_name, sizeof(glsl_name), "VC[%i]", i);
entry->vuniformF_locations[i] = GL_EXTCALL(glGetUniformLocationARB(programId, glsl_name)); 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, ...@@ -4149,8 +4152,9 @@ static void set_glsl_shader_program(const struct wined3d_context *context,
snprintf(glsl_name, sizeof(glsl_name), "VI[%i]", i); snprintf(glsl_name, sizeof(glsl_name), "VI[%i]", i);
entry->vuniformI_locations[i] = GL_EXTCALL(glGetUniformLocationARB(programId, glsl_name)); entry->vuniformI_locations[i] = GL_EXTCALL(glGetUniformLocationARB(programId, glsl_name));
} }
entry->puniformF_locations = HeapAlloc(GetProcessHeap(), 0, sizeof(GLhandleARB) * gl_info->max_ps_glsl_constantsF); entry->puniformF_locations = HeapAlloc(GetProcessHeap(), 0,
for (i = 0; i < gl_info->max_ps_glsl_constantsF; ++i) 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); snprintf(glsl_name, sizeof(glsl_name), "PC[%i]", i);
entry->puniformF_locations[i] = GL_EXTCALL(glGetUniformLocationARB(programId, glsl_name)); entry->puniformF_locations[i] = GL_EXTCALL(glGetUniformLocationARB(programId, glsl_name));
...@@ -4533,7 +4537,8 @@ static HRESULT shader_glsl_alloc(IWineD3DDevice *iface) { ...@@ -4533,7 +4537,8 @@ static HRESULT shader_glsl_alloc(IWineD3DDevice *iface) {
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
const struct wined3d_gl_info *gl_info = &This->adapter->gl_info; 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)); 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)) if (!shader_buffer_init(&priv->shader_buffer))
{ {
...@@ -4548,13 +4553,13 @@ static HRESULT shader_glsl_alloc(IWineD3DDevice *iface) { ...@@ -4548,13 +4553,13 @@ static HRESULT shader_glsl_alloc(IWineD3DDevice *iface) {
goto fail; 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"); ERR("Failed to initialize vertex shader constant heap\n");
goto fail; 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"); ERR("Failed to initialize pixel shader constant heap\n");
goto fail; goto fail;
...@@ -4624,12 +4629,12 @@ static void shader_glsl_get_caps(WINED3DDEVTYPE devtype, ...@@ -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. * 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]) 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); pCaps->VertexShaderVersion = WINED3DVS_VERSION(2,0);
else else
pCaps->VertexShaderVersion = WINED3DVS_VERSION(3,0); 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); 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. /* 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 * 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, ...@@ -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. * 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]) 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); pCaps->PixelShaderVersion = WINED3DPS_VERSION(2,0);
else else
pCaps->PixelShaderVersion = WINED3DPS_VERSION(3,0); 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 /* FIXME: The following line is card dependent. -8.0 to 8.0 is the
* Direct3D minimum requirement. * Direct3D minimum requirement.
......
...@@ -469,7 +469,7 @@ static void nvrc_colorop(DWORD state, IWineD3DStateBlockImpl *stateblock, struct ...@@ -469,7 +469,7 @@ static void nvrc_colorop(DWORD state, IWineD3DStateBlockImpl *stateblock, struct
if (mapped_stage != WINED3D_UNMAPPED_STAGE) 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"); FIXME("Attempt to enable unsupported stage!\n");
return; return;
...@@ -501,7 +501,7 @@ static void nvrc_colorop(DWORD state, IWineD3DStateBlockImpl *stateblock, struct ...@@ -501,7 +501,7 @@ static void nvrc_colorop(DWORD state, IWineD3DStateBlockImpl *stateblock, struct
glDisable(GL_TEXTURE_RECTANGLE_ARB); glDisable(GL_TEXTURE_RECTANGLE_ARB);
checkGLcall("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); glTexEnvi(GL_TEXTURE_SHADER_NV, GL_SHADER_OPERATION_NV, GL_NONE);
} }
...@@ -558,7 +558,7 @@ static void nvts_texdim(DWORD state, IWineD3DStateBlockImpl *stateblock, struct ...@@ -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 * handler takes care. Also no action is needed with pixel shaders, or if tex_colorop
* will take care of this business * 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(sampler >= stateblock->lowest_disabled_stage) return;
if(isStateDirty(context, STATE_TEXTURESTAGE(sampler, WINED3DTSS_COLOROP))) return; if(isStateDirty(context, STATE_TEXTURESTAGE(sampler, WINED3DTSS_COLOROP))) return;
...@@ -577,7 +577,7 @@ static void nvts_bumpenvmat(DWORD state, IWineD3DStateBlockImpl *stateblock, str ...@@ -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 * 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 * 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)); GL_EXTCALL(glActiveTextureARB(GL_TEXTURE0_ARB + mapped_stage));
checkGLcall("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, ...@@ -662,8 +662,8 @@ static void nvrc_fragment_get_caps(WINED3DDEVTYPE devtype,
WINED3DTEXOPCAPS_PREMODULATE */ WINED3DTEXOPCAPS_PREMODULATE */
#endif #endif
pCaps->MaxTextureBlendStages = gl_info->max_texture_stages; pCaps->MaxTextureBlendStages = gl_info->limits.texture_stages;
pCaps->MaxSimultaneousTextures = gl_info->max_textures; pCaps->MaxSimultaneousTextures = gl_info->limits.textures;
pCaps->PrimitiveMiscCaps |= WINED3DPMISCCAPS_TSSARGTEMP; pCaps->PrimitiveMiscCaps |= WINED3DPMISCCAPS_TSSARGTEMP;
......
...@@ -261,10 +261,10 @@ static HRESULT pixelshader_set_function(IWineD3DPixelShaderImpl *shader, ...@@ -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 /* Don't do any register mapping magic if it is not needed, or if we can't
* achieve anything anyway */ * achieve anything anyway */
if (highest_reg_used < (gl_info->max_glsl_varyings / 4) if (highest_reg_used < (gl_info->limits.glsl_varyings / 4)
|| num_regs_used > (gl_info->max_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 /* This happens with relative addressing. The input mapper function
* warns about this if the higher registers are declared too, so * warns about this if the higher registers are declared too, so
......
...@@ -1177,7 +1177,7 @@ static HRESULT WINAPI IWineD3DStateBlockImpl_InitStartupStateBlock(IWineD3DStat ...@@ -1177,7 +1177,7 @@ static HRESULT WINAPI IWineD3DStateBlockImpl_InitStartupStateBlock(IWineD3DStat
tmpfloat.f = 1.0f; tmpfloat.f = 1.0f;
IWineD3DDevice_SetRenderState(device, WINED3DRS_PATCHSEGMENTS, tmpfloat.d); IWineD3DDevice_SetRenderState(device, WINED3DRS_PATCHSEGMENTS, tmpfloat.d);
IWineD3DDevice_SetRenderState(device, WINED3DRS_DEBUGMONITORTOKEN, 0xbaadcafe); 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_POINTSIZE_MAX, tmpfloat.d);
IWineD3DDevice_SetRenderState(device, WINED3DRS_INDEXEDVERTEXBLENDENABLE, FALSE); IWineD3DDevice_SetRenderState(device, WINED3DRS_INDEXEDVERTEXBLENDENABLE, FALSE);
IWineD3DDevice_SetRenderState(device, WINED3DRS_COLORWRITEENABLE, 0x0000000F); IWineD3DDevice_SetRenderState(device, WINED3DRS_COLORWRITEENABLE, 0x0000000F);
...@@ -1271,7 +1271,7 @@ static HRESULT WINAPI IWineD3DStateBlockImpl_InitStartupStateBlock(IWineD3DStat ...@@ -1271,7 +1271,7 @@ static HRESULT WINAPI IWineD3DStateBlockImpl_InitStartupStateBlock(IWineD3DStat
This->samplerState[i][WINED3DSAMP_DMAPOFFSET ] = 0; /* TODO: Vertex offset in the presampled displacement map */ 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 */ /* Note: This avoids calling SetTexture, so pretend it has been called */
This->changed.textures |= 1 << i; This->changed.textures |= 1 << i;
......
...@@ -4198,7 +4198,7 @@ static HRESULT WINAPI IWineD3DSurfaceImpl_PrivateSetup(IWineD3DSurface *iface) { ...@@ -4198,7 +4198,7 @@ static HRESULT WINAPI IWineD3DSurfaceImpl_PrivateSetup(IWineD3DSurface *iface) {
} }
TRACE("%p\n", This); 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))) && !(This->resource.usage & (WINED3DUSAGE_RENDERTARGET | WINED3DUSAGE_DEPTHSTENCIL)))
{ {
/* one of three options /* one of three options
......
...@@ -916,7 +916,7 @@ static void init_format_filter_info(struct wined3d_gl_info *gl_info, enum wined3 ...@@ -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"); TRACE("Nvidia card with texture_float support: Assuming float16 blending\n");
filtered = TRUE; 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"); TRACE("More than 44 GLSL varyings - assuming d3d10 card with float16 blending\n");
filtered = TRUE; filtered = TRUE;
...@@ -2192,7 +2192,7 @@ BOOL CalculateTexRect(IWineD3DSurfaceImpl *This, RECT *Rect, float glTexCoord[4] ...@@ -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; const struct wined3d_gl_info *gl_info = &This->resource.wineD3DDevice->adapter->gl_info;
int x1 = Rect->left, x2 = Rect->right; int x1 = Rect->left, x2 = Rect->right;
int y1 = Rect->top, y2 = Rect->bottom; 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, TRACE("(%p)->(%d,%d)-(%d,%d)\n", This,
Rect->left, Rect->top, Rect->right, Rect->bottom); Rect->left, Rect->top, Rect->right, Rect->bottom);
...@@ -2275,8 +2275,9 @@ BOOL CalculateTexRect(IWineD3DSurfaceImpl *This, RECT *Rect, float glTexCoord[4] ...@@ -2275,8 +2275,9 @@ BOOL CalculateTexRect(IWineD3DSurfaceImpl *This, RECT *Rect, float glTexCoord[4]
This->glRect.right = This->pow2Width; This->glRect.right = This->pow2Width;
} }
if(This->pow2Height > maxSize) { if (This->pow2Height > maxSize)
This->glRect.top = x1 - gl_info->max_texture_size / 2; {
This->glRect.top = x1 - gl_info->limits.texture_size / 2;
if(This->glRect.top < 0) This->glRect.top = 0; if(This->glRect.top < 0) This->glRect.top = 0;
This->glRect.bottom = This->glRect.left + maxSize; This->glRect.bottom = This->glRect.left + maxSize;
if(This->glRect.bottom > This->currentDesc.Height) { if(This->glRect.bottom > This->currentDesc.Height) {
...@@ -2350,7 +2351,7 @@ void gen_ffp_frag_op(IWineD3DStateBlockImpl *stateblock, struct ffp_frag_setting ...@@ -2350,7 +2351,7 @@ void gen_ffp_frag_op(IWineD3DStateBlockImpl *stateblock, struct ffp_frag_setting
IWineD3DDeviceImpl *device = stateblock->wineD3DDevice; IWineD3DDeviceImpl *device = stateblock->wineD3DDevice;
const struct wined3d_gl_info *gl_info = &device->adapter->gl_info; 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; IWineD3DBaseTextureImpl *texture;
settings->op[i].padding = 0; settings->op[i].padding = 0;
...@@ -2662,7 +2663,7 @@ void sampler_texdim(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wine ...@@ -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 * handler takes care. Also no action is needed with pixel shaders, or if tex_colorop
* will take care of this business * 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(sampler >= stateblock->lowest_disabled_stage) return;
if(isStateDirty(context, STATE_TEXTURESTAGE(sampler, WINED3DTSS_COLOROP))) return; if(isStateDirty(context, STATE_TEXTURESTAGE(sampler, WINED3DTSS_COLOROP))) return;
......
...@@ -4057,46 +4057,49 @@ struct wined3d_fbo_ops ...@@ -4057,46 +4057,49 @@ struct wined3d_fbo_ops
PGLFNGLGENERATEMIPMAPPROC glGenerateMipmap; 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; #define USE_GL_FUNC(type, pfn, ext, replace) type pfn;
struct wined3d_gl_info struct wined3d_gl_info
{ {
UINT vidmem; UINT vidmem;
struct wined3d_gl_limits limits;
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;
DWORD reserved_glsl_constants; DWORD reserved_glsl_constants;
DWORD quirks; DWORD quirks;
BOOL supported[WINED3D_GL_EXT_COUNT]; BOOL supported[WINED3D_GL_EXT_COUNT];
struct wined3d_fbo_ops fbo_ops; struct wined3d_fbo_ops fbo_ops;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment