Commit 111307df authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

wined3d: Get rid of the GL_SUPPORT macro.

parent 48e03bc1
...@@ -46,22 +46,22 @@ static BOOL need_mova_const(IWineD3DBaseShader *shader, const struct wined3d_gl_ ...@@ -46,22 +46,22 @@ static BOOL need_mova_const(IWineD3DBaseShader *shader, const struct wined3d_gl_
{ {
IWineD3DBaseShaderImpl *This = (IWineD3DBaseShaderImpl *) shader; IWineD3DBaseShaderImpl *This = (IWineD3DBaseShaderImpl *) shader;
if(!This->baseShader.reg_maps.usesmova) return FALSE; if(!This->baseShader.reg_maps.usesmova) return FALSE;
return !GL_SUPPORT(NV_VERTEX_PROGRAM2_OPTION); return !gl_info->supported[NV_VERTEX_PROGRAM2_OPTION];
} }
/* Returns TRUE if result.clip from GL_NV_vertex_program2 should be used and FALSE otherwise */ /* Returns TRUE if result.clip from GL_NV_vertex_program2 should be used and FALSE otherwise */
static inline BOOL use_nv_clip(const struct wined3d_gl_info *gl_info) static inline BOOL use_nv_clip(const struct wined3d_gl_info *gl_info)
{ {
return GL_SUPPORT(NV_VERTEX_PROGRAM2_OPTION) && return gl_info->supported[NV_VERTEX_PROGRAM2_OPTION]
!(gl_info->quirks & WINED3D_QUIRK_NV_CLIP_BROKEN); && !(gl_info->quirks & WINED3D_QUIRK_NV_CLIP_BROKEN);
} }
static BOOL need_helper_const(const struct wined3d_gl_info *gl_info) static BOOL need_helper_const(const struct wined3d_gl_info *gl_info)
{ {
if (!GL_SUPPORT(NV_VERTEX_PROGRAM) /* Need to init colors. */ if (!gl_info->supported[NV_VERTEX_PROGRAM] /* Need to init colors. */
|| gl_info->quirks & WINED3D_QUIRK_ARB_VS_OFFSET_LIMIT /* Load the immval offset. */ || gl_info->quirks & WINED3D_QUIRK_ARB_VS_OFFSET_LIMIT /* Load the immval offset. */
|| gl_info->quirks & WINED3D_QUIRK_SET_TEXCOORD_W /* Have to init texcoords. */ || gl_info->quirks & WINED3D_QUIRK_SET_TEXCOORD_W /* Have to init texcoords. */
|| (!use_nv_clip(gl_info)) /* Init the clip texcoord */) || (!use_nv_clip(gl_info)) /* Init the clip texcoord */)
{ {
return TRUE; return TRUE;
} }
...@@ -328,7 +328,8 @@ static unsigned int shader_arb_load_constantsF(IWineD3DBaseShaderImpl *This, con ...@@ -328,7 +328,8 @@ static unsigned int shader_arb_load_constantsF(IWineD3DBaseShaderImpl *This, con
*/ */
} }
if(GL_SUPPORT(EXT_GPU_PROGRAM_PARAMETERS)) { if (gl_info->supported[EXT_GPU_PROGRAM_PARAMETERS])
{
/* TODO: Benchmark if we're better of with finding the dirty constants ourselves, /* TODO: Benchmark if we're better of with finding the dirty constants ourselves,
* or just reloading *all* constants at once * or just reloading *all* constants at once
* *
...@@ -3330,10 +3331,13 @@ static GLuint shader_arb_generate_pshader(IWineD3DPixelShaderImpl *This, struct ...@@ -3330,10 +3331,13 @@ static GLuint shader_arb_generate_pshader(IWineD3DPixelShaderImpl *This, struct
} }
shader_addline(buffer, "!!ARBfp1.0\n"); shader_addline(buffer, "!!ARBfp1.0\n");
if(want_nv_prog && GL_SUPPORT(NV_FRAGMENT_PROGRAM2)) { if (want_nv_prog && gl_info->supported[NV_FRAGMENT_PROGRAM2])
{
shader_addline(buffer, "OPTION NV_fragment_program2;\n"); shader_addline(buffer, "OPTION NV_fragment_program2;\n");
priv_ctx.target_version = NV3; priv_ctx.target_version = NV3;
} else if(want_nv_prog && GL_SUPPORT(NV_FRAGMENT_PROGRAM_OPTION)) { }
else if (want_nv_prog && gl_info->supported[NV_FRAGMENT_PROGRAM_OPTION])
{
shader_addline(buffer, "OPTION NV_fragment_program;\n"); shader_addline(buffer, "OPTION NV_fragment_program;\n");
priv_ctx.target_version = NV2; priv_ctx.target_version = NV2;
} else { } else {
...@@ -3855,11 +3859,14 @@ static GLuint shader_arb_generate_vshader(IWineD3DVertexShaderImpl *This, struct ...@@ -3855,11 +3859,14 @@ static GLuint shader_arb_generate_vshader(IWineD3DVertexShaderImpl *This, struct
/* Always enable the NV extension if available. Unlike fragment shaders, there is no /* Always enable the NV extension if available. Unlike fragment shaders, there is no
* mesurable performance penalty, and we can always make use of it for clipplanes. * mesurable performance penalty, and we can always make use of it for clipplanes.
*/ */
if(GL_SUPPORT(NV_VERTEX_PROGRAM3)) { if (gl_info->supported[NV_VERTEX_PROGRAM3])
{
shader_addline(buffer, "OPTION NV_vertex_program3;\n"); shader_addline(buffer, "OPTION NV_vertex_program3;\n");
priv_ctx.target_version = NV3; priv_ctx.target_version = NV3;
shader_addline(buffer, "ADDRESS aL;\n"); shader_addline(buffer, "ADDRESS aL;\n");
} else if(GL_SUPPORT(NV_VERTEX_PROGRAM2_OPTION)) { }
else if (gl_info->supported[NV_VERTEX_PROGRAM2_OPTION])
{
shader_addline(buffer, "OPTION NV_vertex_program2;\n"); shader_addline(buffer, "OPTION NV_vertex_program2;\n");
priv_ctx.target_version = NV2; priv_ctx.target_version = NV2;
shader_addline(buffer, "ADDRESS aL;\n"); shader_addline(buffer, "ADDRESS aL;\n");
...@@ -3918,7 +3925,8 @@ static GLuint shader_arb_generate_vshader(IWineD3DVertexShaderImpl *This, struct ...@@ -3918,7 +3925,8 @@ static GLuint shader_arb_generate_vshader(IWineD3DVertexShaderImpl *This, struct
* coords, we have a flag in the opengl caps. Many cards do not require the texcoord being set, and * coords, we have a flag in the opengl caps. Many cards do not require the texcoord being set, and
* this can eat a number of instructions, so skip it unless this cap is set as well * this can eat a number of instructions, so skip it unless this cap is set as well
*/ */
if(!GL_SUPPORT(NV_VERTEX_PROGRAM)) { if (!gl_info->supported[NV_VERTEX_PROGRAM])
{
shader_addline(buffer, "MOV result.color.secondary, -helper_const.wwwy;\n"); shader_addline(buffer, "MOV result.color.secondary, -helper_const.wwwy;\n");
if (gl_info->quirks & WINED3D_QUIRK_SET_TEXCOORD_W && !device->frag_pipe->ffp_proj_control) if (gl_info->quirks & WINED3D_QUIRK_SET_TEXCOORD_W && !device->frag_pipe->ffp_proj_control)
...@@ -4099,7 +4107,9 @@ static struct arb_vs_compiled_shader *find_arb_vshader(IWineD3DVertexShaderImpl ...@@ -4099,7 +4107,9 @@ static struct arb_vs_compiled_shader *find_arb_vshader(IWineD3DVertexShaderImpl
* (cache coherency etc) * (cache coherency etc)
*/ */
for(i = 0; i < shader_data->num_gl_shaders; i++) { for(i = 0; i < shader_data->num_gl_shaders; i++) {
if(vs_args_equal(&shader_data->gl_shaders[i].args, args, use_map, GL_SUPPORT(NV_VERTEX_PROGRAM2_OPTION))) { if (vs_args_equal(&shader_data->gl_shaders[i].args, args,
use_map, gl_info->supported[NV_VERTEX_PROGRAM2_OPTION]))
{
return &shader_data->gl_shaders[i]; return &shader_data->gl_shaders[i];
} }
} }
...@@ -4173,7 +4183,7 @@ static inline void find_arb_ps_compile_args(IWineD3DPixelShaderImpl *shader, IWi ...@@ -4173,7 +4183,7 @@ static inline void find_arb_ps_compile_args(IWineD3DPixelShaderImpl *shader, IWi
/* Skip if unused or local, or supported natively */ /* Skip if unused or local, or supported natively */
int_skip = ~shader->baseShader.reg_maps.integer_constants | shader->baseShader.reg_maps.local_int_consts; int_skip = ~shader->baseShader.reg_maps.integer_constants | shader->baseShader.reg_maps.local_int_consts;
if(int_skip == 0xffff || GL_SUPPORT(NV_FRAGMENT_PROGRAM_OPTION)) if (int_skip == 0xffff || gl_info->supported[NV_FRAGMENT_PROGRAM_OPTION])
{ {
memset(&args->loop_ctrl, 0, sizeof(args->loop_ctrl)); memset(&args->loop_ctrl, 0, sizeof(args->loop_ctrl));
return; return;
...@@ -4248,7 +4258,8 @@ static inline void find_arb_vs_compile_args(IWineD3DVertexShaderImpl *shader, IW ...@@ -4248,7 +4258,8 @@ static inline void find_arb_vs_compile_args(IWineD3DVertexShaderImpl *shader, IW
/* Skip if unused or local */ /* Skip if unused or local */
int_skip = ~shader->baseShader.reg_maps.integer_constants | shader->baseShader.reg_maps.local_int_consts; int_skip = ~shader->baseShader.reg_maps.integer_constants | shader->baseShader.reg_maps.local_int_consts;
if(int_skip == 0xffff || GL_SUPPORT(NV_VERTEX_PROGRAM2_OPTION)) /* This is about flow control, not clipping */ /* This is about flow control, not clipping. */
if (int_skip == 0xffff || gl_info->supported[NV_VERTEX_PROGRAM2_OPTION])
{ {
memset(&args->loop_ctrl, 0, sizeof(args->loop_ctrl)); memset(&args->loop_ctrl, 0, sizeof(args->loop_ctrl));
return; return;
...@@ -4324,7 +4335,9 @@ static void shader_arb_select(const struct wined3d_context *context, BOOL usePS, ...@@ -4324,7 +4335,9 @@ static void shader_arb_select(const struct wined3d_context *context, BOOL usePS,
/* Force constant reloading for the NP2 fixup (see comment in shader_glsl_select for more info) */ /* Force constant reloading for the NP2 fixup (see comment in shader_glsl_select for more info) */
if (compiled->np2fixup_info.super.active) if (compiled->np2fixup_info.super.active)
shader_arb_load_np2fixup_constants((IWineD3DDevice *)This, usePS, useVS); shader_arb_load_np2fixup_constants((IWineD3DDevice *)This, usePS, useVS);
} else if(GL_SUPPORT(ARB_FRAGMENT_PROGRAM) && !priv->use_arbfp_fixed_func) { }
else if (gl_info->supported[ARB_FRAGMENT_PROGRAM] && !priv->use_arbfp_fixed_func)
{
/* Disable only if we're not using arbfp fixed function fragment processing. If this is used, /* Disable only if we're not using arbfp fixed function fragment processing. If this is used,
* keep GL_FRAGMENT_PROGRAM_ARB enabled, and the fixed function pipeline will bind the fixed function * keep GL_FRAGMENT_PROGRAM_ARB enabled, and the fixed function pipeline will bind the fixed function
* replacement shader * replacement shader
...@@ -4358,14 +4371,17 @@ static void shader_arb_select(const struct wined3d_context *context, BOOL usePS, ...@@ -4358,14 +4371,17 @@ static void shader_arb_select(const struct wined3d_context *context, BOOL usePS,
if(priv->last_vs_color_unclamp != compiled->need_color_unclamp) { if(priv->last_vs_color_unclamp != compiled->need_color_unclamp) {
priv->last_vs_color_unclamp = compiled->need_color_unclamp; priv->last_vs_color_unclamp = compiled->need_color_unclamp;
if (GL_SUPPORT(ARB_COLOR_BUFFER_FLOAT)) { if (gl_info->supported[ARB_COLOR_BUFFER_FLOAT])
{
GL_EXTCALL(glClampColorARB(GL_CLAMP_VERTEX_COLOR_ARB, !compiled->need_color_unclamp)); GL_EXTCALL(glClampColorARB(GL_CLAMP_VERTEX_COLOR_ARB, !compiled->need_color_unclamp));
checkGLcall("glClampColorARB"); checkGLcall("glClampColorARB");
} else { } else {
FIXME("vertex color clamp needs to be changed, but extension not supported.\n"); FIXME("vertex color clamp needs to be changed, but extension not supported.\n");
} }
} }
} else if(GL_SUPPORT(ARB_VERTEX_PROGRAM)) { }
else if (gl_info->supported[ARB_VERTEX_PROGRAM])
{
priv->current_vprogram_id = 0; priv->current_vprogram_id = 0;
glDisable(GL_VERTEX_PROGRAM_ARB); glDisable(GL_VERTEX_PROGRAM_ARB);
checkGLcall("glDisable(GL_VERTEX_PROGRAM_ARB)"); checkGLcall("glDisable(GL_VERTEX_PROGRAM_ARB)");
...@@ -4550,8 +4566,9 @@ static void shader_arb_get_caps(WINED3DDEVTYPE devtype, const struct wined3d_gl_ ...@@ -4550,8 +4566,9 @@ static void shader_arb_get_caps(WINED3DDEVTYPE devtype, const struct wined3d_gl_
*/ */
none_shader_backend.shader_get_caps(devtype, gl_info, pCaps); none_shader_backend.shader_get_caps(devtype, gl_info, pCaps);
if(GL_SUPPORT(ARB_VERTEX_PROGRAM)) { if (gl_info->supported[ARB_VERTEX_PROGRAM])
if(GL_SUPPORT(NV_VERTEX_PROGRAM3)) {
if (gl_info->supported[NV_VERTEX_PROGRAM3])
{ {
pCaps->VertexShaderVersion = WINED3DVS_VERSION(3,0); pCaps->VertexShaderVersion = WINED3DVS_VERSION(3,0);
TRACE_(d3d_caps)("Hardware vertex shader version 3.0 enabled (NV_VERTEX_PROGRAM3)\n"); TRACE_(d3d_caps)("Hardware vertex shader version 3.0 enabled (NV_VERTEX_PROGRAM3)\n");
...@@ -4570,8 +4587,9 @@ static void shader_arb_get_caps(WINED3DDEVTYPE devtype, const struct wined3d_gl_ ...@@ -4570,8 +4587,9 @@ static void shader_arb_get_caps(WINED3DDEVTYPE devtype, const struct wined3d_gl_
pCaps->MaxVertexShaderConst = vs_consts; pCaps->MaxVertexShaderConst = vs_consts;
} }
if(GL_SUPPORT(ARB_FRAGMENT_PROGRAM)) { if (gl_info->supported[ARB_FRAGMENT_PROGRAM])
if(GL_SUPPORT(NV_FRAGMENT_PROGRAM2)) {
if (gl_info->supported[NV_FRAGMENT_PROGRAM2])
{ {
pCaps->PixelShaderVersion = WINED3DPS_VERSION(3,0); pCaps->PixelShaderVersion = WINED3DPS_VERSION(3,0);
TRACE_(d3d_caps)("Hardware pixel shader version 3.0 enabled (NV_FRAGMENT_PROGRAM2)\n"); TRACE_(d3d_caps)("Hardware pixel shader version 3.0 enabled (NV_FRAGMENT_PROGRAM2)\n");
...@@ -6636,17 +6654,20 @@ static HRESULT arbfp_blit_set(IWineD3DDevice *iface, const struct GlPixelFormatD ...@@ -6636,17 +6654,20 @@ static HRESULT arbfp_blit_set(IWineD3DDevice *iface, const struct GlPixelFormatD
/* Context activation is done by the caller. */ /* Context activation is done by the caller. */
static void arbfp_blit_unset(IWineD3DDevice *iface) { static void arbfp_blit_unset(IWineD3DDevice *iface) {
IWineD3DDeviceImpl *device = (IWineD3DDeviceImpl *) iface; IWineD3DDeviceImpl *device = (IWineD3DDeviceImpl *) iface;
const struct wined3d_gl_info *gl_info = &device->adapter->gl_info;
ENTER_GL(); ENTER_GL();
glDisable(GL_FRAGMENT_PROGRAM_ARB); glDisable(GL_FRAGMENT_PROGRAM_ARB);
checkGLcall("glDisable(GL_FRAGMENT_PROGRAM_ARB)"); checkGLcall("glDisable(GL_FRAGMENT_PROGRAM_ARB)");
glDisable(GL_TEXTURE_2D); glDisable(GL_TEXTURE_2D);
checkGLcall("glDisable(GL_TEXTURE_2D)"); checkGLcall("glDisable(GL_TEXTURE_2D)");
if(GL_SUPPORT(ARB_TEXTURE_CUBE_MAP)) { if (gl_info->supported[ARB_TEXTURE_CUBE_MAP])
{
glDisable(GL_TEXTURE_CUBE_MAP_ARB); glDisable(GL_TEXTURE_CUBE_MAP_ARB);
checkGLcall("glDisable(GL_TEXTURE_CUBE_MAP_ARB)"); checkGLcall("glDisable(GL_TEXTURE_CUBE_MAP_ARB)");
} }
if(GL_SUPPORT(ARB_TEXTURE_RECTANGLE)) { if (gl_info->supported[ARB_TEXTURE_RECTANGLE])
{
glDisable(GL_TEXTURE_RECTANGLE_ARB); glDisable(GL_TEXTURE_RECTANGLE_ARB);
checkGLcall("glDisable(GL_TEXTURE_RECTANGLE_ARB)"); checkGLcall("glDisable(GL_TEXTURE_RECTANGLE_ARB)");
} }
......
...@@ -26,7 +26,6 @@ ...@@ -26,7 +26,6 @@
#include "wined3d_private.h" #include "wined3d_private.h"
WINE_DEFAULT_DEBUG_CHANNEL(d3d_texture); WINE_DEFAULT_DEBUG_CHANNEL(d3d_texture);
#define GLINFO_LOCATION This->resource.wineD3DDevice->adapter->gl_info
HRESULT basetexture_init(IWineD3DBaseTextureImpl *texture, UINT levels, WINED3DRESOURCETYPE resource_type, HRESULT basetexture_init(IWineD3DBaseTextureImpl *texture, UINT levels, WINED3DRESOURCETYPE resource_type,
IWineD3DDeviceImpl *device, UINT size, DWORD usage, const struct GlPixelFormatDesc *format_desc, IWineD3DDeviceImpl *device, UINT size, DWORD usage, const struct GlPixelFormatDesc *format_desc,
...@@ -478,7 +477,10 @@ void basetexture_apply_state_changes(IWineD3DBaseTexture *iface, ...@@ -478,7 +477,10 @@ void basetexture_apply_state_changes(IWineD3DBaseTexture *iface,
if (gl_tex->states[WINED3DTEXSTA_MAXANISOTROPY] != aniso) if (gl_tex->states[WINED3DTEXSTA_MAXANISOTROPY] != aniso)
{ {
if (GL_SUPPORT(EXT_TEXTURE_FILTER_ANISOTROPIC)) IWineD3DDeviceImpl *device = This->resource.wineD3DDevice;
const struct wined3d_gl_info *gl_info = &device->adapter->gl_info;
if (gl_info->supported[EXT_TEXTURE_FILTER_ANISOTROPIC])
{ {
glTexParameteri(textureDimensions, GL_TEXTURE_MAX_ANISOTROPY_EXT, aniso); glTexParameteri(textureDimensions, GL_TEXTURE_MAX_ANISOTROPY_EXT, aniso);
checkGLcall("glTexParameteri(GL_TEXTURE_MAX_ANISOTROPY_EXT, aniso)"); checkGLcall("glTexParameteri(GL_TEXTURE_MAX_ANISOTROPY_EXT, aniso)");
......
...@@ -203,6 +203,8 @@ static BOOL buffer_check_attribute(struct wined3d_buffer *This, const struct win ...@@ -203,6 +203,8 @@ static BOOL buffer_check_attribute(struct wined3d_buffer *This, const struct win
DWORD *stride_this_run, BOOL *float16_used) DWORD *stride_this_run, BOOL *float16_used)
{ {
const struct wined3d_stream_info_element *attrib = &si->elements[attrib_idx]; const struct wined3d_stream_info_element *attrib = &si->elements[attrib_idx];
IWineD3DDeviceImpl *device = This->resource.wineD3DDevice;
const struct wined3d_gl_info *gl_info = &device->adapter->gl_info;
BOOL ret = FALSE; BOOL ret = FALSE;
WINED3DFORMAT format; WINED3DFORMAT format;
...@@ -215,7 +217,8 @@ static BOOL buffer_check_attribute(struct wined3d_buffer *This, const struct win ...@@ -215,7 +217,8 @@ static BOOL buffer_check_attribute(struct wined3d_buffer *This, const struct win
format = attrib->format_desc->format; format = attrib->format_desc->format;
/* Look for newly appeared conversion */ /* Look for newly appeared conversion */
if (!GL_SUPPORT(ARB_HALF_FLOAT_VERTEX) && (format == WINED3DFMT_R16G16_FLOAT || format == WINED3DFMT_R16G16B16A16_FLOAT)) if (!gl_info->supported[ARB_HALF_FLOAT_VERTEX]
&& (format == WINED3DFMT_R16G16_FLOAT || format == WINED3DFMT_R16G16B16A16_FLOAT))
{ {
ret = buffer_process_converted_attribute(This, CONV_FLOAT16_2, attrib, stride_this_run); ret = buffer_process_converted_attribute(This, CONV_FLOAT16_2, attrib, stride_this_run);
...@@ -309,6 +312,7 @@ static UINT *find_conversion_shift(struct wined3d_buffer *This, ...@@ -309,6 +312,7 @@ static UINT *find_conversion_shift(struct wined3d_buffer *This,
static BOOL buffer_find_decl(struct wined3d_buffer *This) static BOOL buffer_find_decl(struct wined3d_buffer *This)
{ {
IWineD3DDeviceImpl *device = This->resource.wineD3DDevice; IWineD3DDeviceImpl *device = This->resource.wineD3DDevice;
const struct wined3d_gl_info *gl_info = &device->adapter->gl_info;
const struct wined3d_stream_info *si = &device->strided_streams; const struct wined3d_stream_info *si = &device->strided_streams;
UINT stride_this_run = 0; UINT stride_this_run = 0;
BOOL float16_used = FALSE; BOOL float16_used = FALSE;
...@@ -415,7 +419,7 @@ static BOOL buffer_find_decl(struct wined3d_buffer *This) ...@@ -415,7 +419,7 @@ static BOOL buffer_find_decl(struct wined3d_buffer *This)
* FLOAT16s if not supported. Also, we can't iterate over the array, so use macros to generate code for all * FLOAT16s if not supported. Also, we can't iterate over the array, so use macros to generate code for all
* the attributes that our current fixed function pipeline implementation cares for. * the attributes that our current fixed function pipeline implementation cares for.
*/ */
BOOL support_d3dcolor = GL_SUPPORT(EXT_VERTEX_ARRAY_BGRA); BOOL support_d3dcolor = gl_info->supported[EXT_VERTEX_ARRAY_BGRA];
ret = buffer_check_attribute(This, si, WINED3D_FFP_POSITION, ret = buffer_check_attribute(This, si, WINED3D_FFP_POSITION,
TRUE, TRUE, FALSE, &stride_this_run, &float16_used) || ret; TRUE, TRUE, FALSE, &stride_this_run, &float16_used) || ret;
ret = buffer_check_attribute(This, si, WINED3D_FFP_NORMAL, ret = buffer_check_attribute(This, si, WINED3D_FFP_NORMAL,
......
...@@ -298,7 +298,8 @@ void device_stream_info_from_declaration(IWineD3DDeviceImpl *This, ...@@ -298,7 +298,8 @@ void device_stream_info_from_declaration(IWineD3DDeviceImpl *This,
stream_info->elements[idx].stream_idx = element->input_slot; stream_info->elements[idx].stream_idx = element->input_slot;
stream_info->elements[idx].buffer_object = buffer_object; stream_info->elements[idx].buffer_object = buffer_object;
if (!GL_SUPPORT(EXT_VERTEX_ARRAY_BGRA) && element->format_desc->format == WINED3DFMT_B8G8R8A8_UNORM) if (!This->adapter->gl_info.supported[EXT_VERTEX_ARRAY_BGRA]
&& element->format_desc->format == WINED3DFMT_B8G8R8A8_UNORM)
{ {
stream_info->swizzle_map |= 1 << idx; stream_info->swizzle_map |= 1 << idx;
} }
...@@ -360,7 +361,7 @@ void device_stream_info_from_strided(IWineD3DDeviceImpl *This, ...@@ -360,7 +361,7 @@ void device_stream_info_from_strided(IWineD3DDeviceImpl *This,
{ {
if (!stream_info->elements[i].format_desc) continue; if (!stream_info->elements[i].format_desc) continue;
if (!GL_SUPPORT(EXT_VERTEX_ARRAY_BGRA) if (!This->adapter->gl_info.supported[EXT_VERTEX_ARRAY_BGRA]
&& stream_info->elements[i].format_desc->format == WINED3DFMT_B8G8R8A8_UNORM) && stream_info->elements[i].format_desc->format == WINED3DFMT_B8G8R8A8_UNORM)
{ {
stream_info->swizzle_map |= 1 << i; stream_info->swizzle_map |= 1 << i;
...@@ -535,7 +536,8 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateVertexBuffer(IWineD3DDevice *ifac ...@@ -535,7 +536,8 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateVertexBuffer(IWineD3DDevice *ifac
* more. In this call we can convert dx7 buffers too. * more. In this call we can convert dx7 buffers too.
*/ */
conv = ((FVF & WINED3DFVF_POSITION_MASK) == WINED3DFVF_XYZRHW ) || (FVF & (WINED3DFVF_DIFFUSE | WINED3DFVF_SPECULAR)); conv = ((FVF & WINED3DFVF_POSITION_MASK) == WINED3DFVF_XYZRHW ) || (FVF & (WINED3DFVF_DIFFUSE | WINED3DFVF_SPECULAR));
if(!GL_SUPPORT(ARB_VERTEX_BUFFER_OBJECT)) { if (!This->adapter->gl_info.supported[ARB_VERTEX_BUFFER_OBJECT])
{
TRACE("Not creating a vbo because GL_ARB_vertex_buffer is not supported\n"); TRACE("Not creating a vbo because GL_ARB_vertex_buffer is not supported\n");
} else if(Pool == WINED3DPOOL_SYSTEMMEM) { } else if(Pool == WINED3DPOOL_SYSTEMMEM) {
TRACE("Not creating a vbo because the vertex buffer is in system memory\n"); TRACE("Not creating a vbo because the vertex buffer is in system memory\n");
...@@ -579,7 +581,9 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateIndexBuffer(IWineD3DDevice *iface ...@@ -579,7 +581,9 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateIndexBuffer(IWineD3DDevice *iface
TRACE("Created buffer %p.\n", object); TRACE("Created buffer %p.\n", object);
if(Pool != WINED3DPOOL_SYSTEMMEM && !(Usage & WINED3DUSAGE_DYNAMIC) && GL_SUPPORT(ARB_VERTEX_BUFFER_OBJECT)) { if (Pool != WINED3DPOOL_SYSTEMMEM && !(Usage & WINED3DUSAGE_DYNAMIC)
&& This->adapter->gl_info.supported[ARB_VERTEX_BUFFER_OBJECT])
{
object->flags |= WINED3D_BUFFER_CREATEBO; object->flags |= WINED3D_BUFFER_CREATEBO;
} }
...@@ -817,6 +821,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateCubeTexture(IWineD3DDevice *iface ...@@ -817,6 +821,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateCubeTexture(IWineD3DDevice *iface
static HRESULT WINAPI IWineD3DDeviceImpl_CreateQuery(IWineD3DDevice *iface, WINED3DQUERYTYPE Type, IWineD3DQuery **ppQuery, IUnknown* parent) { static HRESULT WINAPI IWineD3DDeviceImpl_CreateQuery(IWineD3DDevice *iface, WINED3DQUERYTYPE Type, IWineD3DQuery **ppQuery, IUnknown* parent) {
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
const struct wined3d_gl_info *gl_info = &This->adapter->gl_info;
IWineD3DQueryImpl *object; /*NOTE: impl ref allowed since this is a create function */ IWineD3DQueryImpl *object; /*NOTE: impl ref allowed since this is a create function */
HRESULT hr = WINED3DERR_NOTAVAILABLE; HRESULT hr = WINED3DERR_NOTAVAILABLE;
const IWineD3DQueryVtbl *vtable; const IWineD3DQueryVtbl *vtable;
...@@ -825,7 +830,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateQuery(IWineD3DDevice *iface, WINE ...@@ -825,7 +830,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateQuery(IWineD3DDevice *iface, WINE
switch(Type) { switch(Type) {
case WINED3DQUERYTYPE_OCCLUSION: case WINED3DQUERYTYPE_OCCLUSION:
TRACE("(%p) occlusion query\n", This); TRACE("(%p) occlusion query\n", This);
if (GL_SUPPORT(ARB_OCCLUSION_QUERY)) if (gl_info->supported[ARB_OCCLUSION_QUERY])
hr = WINED3D_OK; hr = WINED3D_OK;
else else
WARN("Unsupported in local OpenGL implementation: ARB_OCCLUSION_QUERY/NV_OCCLUSION_QUERY\n"); WARN("Unsupported in local OpenGL implementation: ARB_OCCLUSION_QUERY/NV_OCCLUSION_QUERY\n");
...@@ -834,7 +839,8 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateQuery(IWineD3DDevice *iface, WINE ...@@ -834,7 +839,8 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateQuery(IWineD3DDevice *iface, WINE
break; break;
case WINED3DQUERYTYPE_EVENT: case WINED3DQUERYTYPE_EVENT:
if(!(GL_SUPPORT(NV_FENCE) || GL_SUPPORT(APPLE_FENCE) )) { if (!gl_info->supported[NV_FENCE] && !gl_info->supported[APPLE_FENCE])
{
/* Half-Life 2 needs this query. It does not render the main menu correctly otherwise /* Half-Life 2 needs this query. It does not render the main menu correctly otherwise
* Pretend to support it, faking this query does not do much harm except potentially lowering performance * Pretend to support it, faking this query does not do much harm except potentially lowering performance
*/ */
...@@ -1683,7 +1689,9 @@ static void IWineD3DDeviceImpl_LoadLogo(IWineD3DDeviceImpl *This, const char *fi ...@@ -1683,7 +1689,9 @@ static void IWineD3DDeviceImpl_LoadLogo(IWineD3DDeviceImpl *This, const char *fi
} }
/* Context activation is done by the caller. */ /* Context activation is done by the caller. */
static void create_dummy_textures(IWineD3DDeviceImpl *This) { static void create_dummy_textures(IWineD3DDeviceImpl *This)
{
const struct wined3d_gl_info *gl_info = &This->adapter->gl_info;
unsigned int i; unsigned int i;
/* Under DirectX you can have texture stage operations even if no texture is /* Under DirectX you can have texture stage operations even if no texture is
bound, whereas opengl will only do texture operations when a valid texture is bound, whereas opengl will only do texture operations when a valid texture is
...@@ -1692,13 +1700,14 @@ static void create_dummy_textures(IWineD3DDeviceImpl *This) { ...@@ -1692,13 +1700,14 @@ static void create_dummy_textures(IWineD3DDeviceImpl *This) {
then the default texture will kick in until replaced by a SetTexture call */ then the default texture will kick in until replaced by a SetTexture call */
ENTER_GL(); ENTER_GL();
if(GL_SUPPORT(APPLE_CLIENT_STORAGE)) { if (gl_info->supported[APPLE_CLIENT_STORAGE])
{
/* The dummy texture does not have client storage backing */ /* The dummy texture does not have client storage backing */
glPixelStorei(GL_UNPACK_CLIENT_STORAGE_APPLE, GL_FALSE); glPixelStorei(GL_UNPACK_CLIENT_STORAGE_APPLE, GL_FALSE);
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.limits.textures; ++i) for (i = 0; i < gl_info->limits.textures; ++i)
{ {
GLubyte white = 255; GLubyte white = 255;
...@@ -1719,7 +1728,9 @@ static void create_dummy_textures(IWineD3DDeviceImpl *This) { ...@@ -1719,7 +1728,9 @@ static void create_dummy_textures(IWineD3DDeviceImpl *This) {
glTexImage2D(GL_TEXTURE_2D, 0, GL_LUMINANCE, 1, 1, 0, GL_LUMINANCE, GL_UNSIGNED_BYTE, &white); glTexImage2D(GL_TEXTURE_2D, 0, GL_LUMINANCE, 1, 1, 0, GL_LUMINANCE, GL_UNSIGNED_BYTE, &white);
checkGLcall("glTexImage2D"); checkGLcall("glTexImage2D");
} }
if(GL_SUPPORT(APPLE_CLIENT_STORAGE)) {
if (gl_info->supported[APPLE_CLIENT_STORAGE])
{
/* Reenable because if supported it is enabled by default */ /* Reenable because if supported it is enabled by default */
glPixelStorei(GL_UNPACK_CLIENT_STORAGE_APPLE, GL_TRUE); glPixelStorei(GL_UNPACK_CLIENT_STORAGE_APPLE, GL_TRUE);
checkGLcall("glPixelStorei(GL_UNPACK_CLIENT_STORAGE_APPLE, GL_TRUE)"); checkGLcall("glPixelStorei(GL_UNPACK_CLIENT_STORAGE_APPLE, GL_TRUE)");
...@@ -3734,6 +3745,7 @@ static HRESULT process_vertices_strided(IWineD3DDeviceImpl *This, DWORD dwDestIn ...@@ -3734,6 +3745,7 @@ static HRESULT process_vertices_strided(IWineD3DDeviceImpl *This, DWORD dwDestIn
const struct wined3d_stream_info *stream_info, struct wined3d_buffer *dest, DWORD dwFlags, const struct wined3d_stream_info *stream_info, struct wined3d_buffer *dest, DWORD dwFlags,
DWORD DestFVF) DWORD DestFVF)
{ {
const struct wined3d_gl_info *gl_info = &This->adapter->gl_info;
char *dest_ptr, *dest_conv = NULL, *dest_conv_addr = NULL; char *dest_ptr, *dest_conv = NULL, *dest_conv_addr = NULL;
unsigned int i; unsigned int i;
WINED3DVIEWPORT vp; WINED3DVIEWPORT vp;
...@@ -3762,7 +3774,7 @@ static HRESULT process_vertices_strided(IWineD3DDeviceImpl *This, DWORD dwDestIn ...@@ -3762,7 +3774,7 @@ static HRESULT process_vertices_strided(IWineD3DDeviceImpl *This, DWORD dwDestIn
/* Get a pointer into the destination vbo(create one if none exists) and /* Get a pointer into the destination vbo(create one if none exists) and
* write correct opengl data into it. It's cheap and allows us to run drawStridedFast * write correct opengl data into it. It's cheap and allows us to run drawStridedFast
*/ */
if (!dest->buffer_object && GL_SUPPORT(ARB_VERTEX_BUFFER_OBJECT)) if (!dest->buffer_object && gl_info->supported[ARB_VERTEX_BUFFER_OBJECT])
{ {
dest->flags |= WINED3D_BUFFER_CREATEBO; dest->flags |= WINED3D_BUFFER_CREATEBO;
IWineD3DBuffer_PreLoad((IWineD3DBuffer *)dest); IWineD3DBuffer_PreLoad((IWineD3DBuffer *)dest);
...@@ -6331,8 +6343,8 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetCursorProperties(IWineD3DDevice* i ...@@ -6331,8 +6343,8 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetCursorProperties(IWineD3DDevice* i
This->cursorHeight = pSur->currentDesc.Height; This->cursorHeight = pSur->currentDesc.Height;
if (SUCCEEDED(IWineD3DSurface_LockRect(pCursorBitmap, &rect, NULL, WINED3DLOCK_READONLY))) if (SUCCEEDED(IWineD3DSurface_LockRect(pCursorBitmap, &rect, NULL, WINED3DLOCK_READONLY)))
{ {
const struct GlPixelFormatDesc *glDesc = const struct wined3d_gl_info *gl_info = &This->adapter->gl_info;
getFormatDescEntry(WINED3DFMT_B8G8R8A8_UNORM, &This->adapter->gl_info); const struct GlPixelFormatDesc *glDesc = getFormatDescEntry(WINED3DFMT_B8G8R8A8_UNORM, gl_info);
struct wined3d_context *context; struct wined3d_context *context;
char *mem, *bits = rect.pBits; char *mem, *bits = rect.pBits;
GLint intfmt = glDesc->glInternal; GLint intfmt = glDesc->glInternal;
...@@ -6355,7 +6367,8 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetCursorProperties(IWineD3DDevice* i ...@@ -6355,7 +6367,8 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetCursorProperties(IWineD3DDevice* i
ENTER_GL(); ENTER_GL();
if(GL_SUPPORT(APPLE_CLIENT_STORAGE)) { if (gl_info->supported[APPLE_CLIENT_STORAGE])
{
glPixelStorei(GL_UNPACK_CLIENT_STORAGE_APPLE, GL_FALSE); glPixelStorei(GL_UNPACK_CLIENT_STORAGE_APPLE, GL_FALSE);
checkGLcall("glPixelStorei(GL_UNPACK_CLIENT_STORAGE_APPLE, GL_FALSE)"); checkGLcall("glPixelStorei(GL_UNPACK_CLIENT_STORAGE_APPLE, GL_FALSE)");
} }
...@@ -6378,7 +6391,8 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetCursorProperties(IWineD3DDevice* i ...@@ -6378,7 +6391,8 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetCursorProperties(IWineD3DDevice* i
HeapFree(GetProcessHeap(), 0, mem); HeapFree(GetProcessHeap(), 0, mem);
checkGLcall("glTexImage2D"); checkGLcall("glTexImage2D");
if(GL_SUPPORT(APPLE_CLIENT_STORAGE)) { if (gl_info->supported[APPLE_CLIENT_STORAGE])
{
glPixelStorei(GL_UNPACK_CLIENT_STORAGE_APPLE, GL_TRUE); glPixelStorei(GL_UNPACK_CLIENT_STORAGE_APPLE, GL_TRUE);
checkGLcall("glPixelStorei(GL_UNPACK_CLIENT_STORAGE_APPLE, GL_TRUE)"); checkGLcall("glPixelStorei(GL_UNPACK_CLIENT_STORAGE_APPLE, GL_TRUE)");
} }
...@@ -6522,7 +6536,8 @@ static HRESULT WINAPI IWineD3DDeviceImpl_EvictManagedResources(IWineD3DDevice* ...@@ -6522,7 +6536,8 @@ static HRESULT WINAPI IWineD3DDeviceImpl_EvictManagedResources(IWineD3DDevice*
static void updateSurfaceDesc(IWineD3DSurfaceImpl *surface, const WINED3DPRESENT_PARAMETERS* pPresentationParameters) static void updateSurfaceDesc(IWineD3DSurfaceImpl *surface, const WINED3DPRESENT_PARAMETERS* pPresentationParameters)
{ {
IWineD3DDeviceImpl *This = surface->resource.wineD3DDevice; /* for GL_SUPPORT */ IWineD3DDeviceImpl *device = surface->resource.wineD3DDevice;
const struct wined3d_gl_info *gl_info = &device->adapter->gl_info;
/* Reallocate proper memory for the front and back buffer and adjust their sizes */ /* Reallocate proper memory for the front and back buffer and adjust their sizes */
if(surface->Flags & SFLAG_DIBSECTION) { if(surface->Flags & SFLAG_DIBSECTION) {
...@@ -6537,8 +6552,9 @@ static void updateSurfaceDesc(IWineD3DSurfaceImpl *surface, const WINED3DPRESENT ...@@ -6537,8 +6552,9 @@ static void updateSurfaceDesc(IWineD3DSurfaceImpl *surface, const WINED3DPRESENT
} }
surface->currentDesc.Width = pPresentationParameters->BackBufferWidth; surface->currentDesc.Width = pPresentationParameters->BackBufferWidth;
surface->currentDesc.Height = pPresentationParameters->BackBufferHeight; surface->currentDesc.Height = pPresentationParameters->BackBufferHeight;
if (GL_SUPPORT(ARB_TEXTURE_NON_POWER_OF_TWO) || GL_SUPPORT(ARB_TEXTURE_RECTANGLE) || if (gl_info->supported[ARB_TEXTURE_NON_POWER_OF_TWO] || gl_info->supported[ARB_TEXTURE_RECTANGLE]
GL_SUPPORT(WINE_NORMALIZED_TEXRECT)) { || gl_info->supported[WINE_NORMALIZED_TEXRECT])
{
surface->pow2Width = pPresentationParameters->BackBufferWidth; surface->pow2Width = pPresentationParameters->BackBufferWidth;
surface->pow2Height = pPresentationParameters->BackBufferHeight; surface->pow2Height = pPresentationParameters->BackBufferHeight;
} else { } else {
...@@ -6553,7 +6569,7 @@ static void updateSurfaceDesc(IWineD3DSurfaceImpl *surface, const WINED3DPRESENT ...@@ -6553,7 +6569,7 @@ static void updateSurfaceDesc(IWineD3DSurfaceImpl *surface, const WINED3DPRESENT
if (surface->texture_name) if (surface->texture_name)
{ {
struct wined3d_context *context = context_acquire(This, NULL, CTXUSAGE_RESOURCELOAD); struct wined3d_context *context = context_acquire(device, NULL, CTXUSAGE_RESOURCELOAD);
ENTER_GL(); ENTER_GL();
glDeleteTextures(1, &surface->texture_name); glDeleteTextures(1, &surface->texture_name);
LEAVE_GL(); LEAVE_GL();
......
...@@ -76,9 +76,10 @@ static void drawStridedSlow(IWineD3DDevice *iface, const struct wined3d_context ...@@ -76,9 +76,10 @@ 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->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_gl_info *gl_info = context->gl_info;
UINT texture_stages = gl_info->limits.texture_stages;
const struct wined3d_stream_info_element *element; const struct wined3d_stream_info_element *element;
UINT num_untracked_materials; UINT num_untracked_materials;
DWORD tex_mask = 0; DWORD tex_mask = 0;
...@@ -147,7 +148,7 @@ static void drawStridedSlow(IWineD3DDevice *iface, const struct wined3d_context ...@@ -147,7 +148,7 @@ static void drawStridedSlow(IWineD3DDevice *iface, const struct wined3d_context
|| si->elements[WINED3D_FFP_POSITION].format_desc->format == WINED3DFMT_R32G32B32A32_FLOAT) || si->elements[WINED3D_FFP_POSITION].format_desc->format == WINED3DFMT_R32G32B32A32_FLOAT)
&& This->stateBlock->renderState[WINED3DRS_FOGTABLEMODE] == WINED3DFOG_NONE) && This->stateBlock->renderState[WINED3DRS_FOGTABLEMODE] == WINED3DFOG_NONE)
{ {
if (GL_SUPPORT(EXT_FOG_COORD)) if (gl_info->supported[EXT_FOG_COORD])
{ {
if (element->format_desc->format == WINED3DFMT_B8G8R8A8_UNORM) specular_fog = TRUE; if (element->format_desc->format == WINED3DFMT_B8G8R8A8_UNORM) specular_fog = TRUE;
else FIXME("Implement fog coordinates from %s\n", debug_d3dformat(element->format_desc->format)); else FIXME("Implement fog coordinates from %s\n", debug_d3dformat(element->format_desc->format));
...@@ -165,7 +166,7 @@ static void drawStridedSlow(IWineD3DDevice *iface, const struct wined3d_context ...@@ -165,7 +166,7 @@ static void drawStridedSlow(IWineD3DDevice *iface, const struct wined3d_context
} }
} }
} }
else if (GL_SUPPORT(EXT_SECONDARY_COLOR)) else if (gl_info->supported[EXT_SECONDARY_COLOR])
{ {
GL_EXTCALL(glSecondaryColor3fEXT)(0, 0, 0); GL_EXTCALL(glSecondaryColor3fEXT)(0, 0, 0);
} }
...@@ -175,7 +176,7 @@ static void drawStridedSlow(IWineD3DDevice *iface, const struct wined3d_context ...@@ -175,7 +176,7 @@ static void drawStridedSlow(IWineD3DDevice *iface, const struct wined3d_context
int coordIdx = This->stateBlock->textureState[textureNo][WINED3DTSS_TEXCOORDINDEX]; int coordIdx = This->stateBlock->textureState[textureNo][WINED3DTSS_TEXCOORDINDEX];
DWORD texture_idx = This->texUnitMap[textureNo]; DWORD texture_idx = This->texUnitMap[textureNo];
if (!GL_SUPPORT(ARB_MULTITEXTURE) && textureNo > 0) if (!gl_info->supported[ARB_MULTITEXTURE] && textureNo > 0)
{ {
FIXME("Program using multiple concurrent textures which this opengl implementation doesn't support\n"); FIXME("Program using multiple concurrent textures which this opengl implementation doesn't support\n");
continue; continue;
...@@ -205,7 +206,7 @@ static void drawStridedSlow(IWineD3DDevice *iface, const struct wined3d_context ...@@ -205,7 +206,7 @@ static void drawStridedSlow(IWineD3DDevice *iface, const struct wined3d_context
else else
{ {
TRACE("tex: %d - Skipping tex coords, as no data supplied\n", textureNo); TRACE("tex: %d - Skipping tex coords, as no data supplied\n", textureNo);
if (GL_SUPPORT(ARB_MULTITEXTURE)) if (gl_info->supported[ARB_MULTITEXTURE])
GL_EXTCALL(glMultiTexCoord4fARB(GL_TEXTURE0_ARB + texture_idx, 0, 0, 0, 1)); GL_EXTCALL(glMultiTexCoord4fARB(GL_TEXTURE0_ARB + texture_idx, 0, 0, 0, 1));
else else
glTexCoord4f(0, 0, 0, 1); glTexCoord4f(0, 0, 0, 1);
...@@ -314,6 +315,8 @@ static void drawStridedSlow(IWineD3DDevice *iface, const struct wined3d_context ...@@ -314,6 +315,8 @@ static void drawStridedSlow(IWineD3DDevice *iface, const struct wined3d_context
/* GL locking is done by the caller */ /* GL locking is done by the caller */
static inline void send_attribute(IWineD3DDeviceImpl *This, WINED3DFORMAT format, const UINT index, const void *ptr) static inline void send_attribute(IWineD3DDeviceImpl *This, WINED3DFORMAT format, const UINT index, const void *ptr)
{ {
const struct wined3d_gl_info *gl_info = &This->adapter->gl_info;
switch(format) switch(format)
{ {
case WINED3DFMT_R32_FLOAT: case WINED3DFMT_R32_FLOAT:
...@@ -333,7 +336,7 @@ static inline void send_attribute(IWineD3DDeviceImpl *This, WINED3DFORMAT format ...@@ -333,7 +336,7 @@ static inline void send_attribute(IWineD3DDeviceImpl *This, WINED3DFORMAT format
GL_EXTCALL(glVertexAttrib4ubvARB(index, ptr)); GL_EXTCALL(glVertexAttrib4ubvARB(index, ptr));
break; break;
case WINED3DFMT_B8G8R8A8_UNORM: case WINED3DFMT_B8G8R8A8_UNORM:
if (GL_SUPPORT(EXT_VERTEX_ARRAY_BGRA)) if (gl_info->supported[EXT_VERTEX_ARRAY_BGRA])
{ {
const DWORD *src = ptr; const DWORD *src = ptr;
DWORD c = *src & 0xff00ff00; DWORD c = *src & 0xff00ff00;
...@@ -386,20 +389,26 @@ static inline void send_attribute(IWineD3DDeviceImpl *This, WINED3DFORMAT format ...@@ -386,20 +389,26 @@ static inline void send_attribute(IWineD3DDeviceImpl *This, WINED3DFORMAT format
/* Are those 16 bit floats. C doesn't have a 16 bit float type. I could read the single bits and calculate a 4 /* Are those 16 bit floats. C doesn't have a 16 bit float type. I could read the single bits and calculate a 4
* byte float according to the IEEE standard * byte float according to the IEEE standard
*/ */
if (GL_SUPPORT(NV_HALF_FLOAT)) { if (gl_info->supported[NV_HALF_FLOAT])
{
/* Not supported by GL_ARB_half_float_vertex */ /* Not supported by GL_ARB_half_float_vertex */
GL_EXTCALL(glVertexAttrib2hvNV(index, ptr)); GL_EXTCALL(glVertexAttrib2hvNV(index, ptr));
} else { }
else
{
float x = float_16_to_32(((const unsigned short *)ptr) + 0); float x = float_16_to_32(((const unsigned short *)ptr) + 0);
float y = float_16_to_32(((const unsigned short *)ptr) + 1); float y = float_16_to_32(((const unsigned short *)ptr) + 1);
GL_EXTCALL(glVertexAttrib2fARB(index, x, y)); GL_EXTCALL(glVertexAttrib2fARB(index, x, y));
} }
break; break;
case WINED3DFMT_R16G16B16A16_FLOAT: case WINED3DFMT_R16G16B16A16_FLOAT:
if (GL_SUPPORT(NV_HALF_FLOAT)) { if (gl_info->supported[NV_HALF_FLOAT])
{
/* Not supported by GL_ARB_half_float_vertex */ /* Not supported by GL_ARB_half_float_vertex */
GL_EXTCALL(glVertexAttrib4hvNV(index, ptr)); GL_EXTCALL(glVertexAttrib4hvNV(index, ptr));
} else { }
else
{
float x = float_16_to_32(((const unsigned short *)ptr) + 0); float x = float_16_to_32(((const unsigned short *)ptr) + 0);
float y = float_16_to_32(((const unsigned short *)ptr) + 1); float y = float_16_to_32(((const unsigned short *)ptr) + 1);
float z = float_16_to_32(((const unsigned short *)ptr) + 2); float z = float_16_to_32(((const unsigned short *)ptr) + 2);
......
...@@ -342,10 +342,10 @@ static void WINE_GLAPI wine_glFogCoorddvEXT(const GLdouble *f) { ...@@ -342,10 +342,10 @@ static void WINE_GLAPI wine_glFogCoorddvEXT(const GLdouble *f) {
/* End GL_EXT_fog_coord emulation */ /* End GL_EXT_fog_coord emulation */
#define GLINFO_LOCATION (*gl_info)
void add_gl_compat_wrappers(struct wined3d_gl_info *gl_info) void add_gl_compat_wrappers(struct wined3d_gl_info *gl_info)
{ {
if(!GL_SUPPORT(ARB_MULTITEXTURE)) { if (!gl_info->supported[ARB_MULTITEXTURE])
{
TRACE("Applying GL_ARB_multitexture emulation hooks\n"); TRACE("Applying GL_ARB_multitexture emulation hooks\n");
gl_info->glActiveTextureARB = wine_glActiveTextureARB; gl_info->glActiveTextureARB = wine_glActiveTextureARB;
gl_info->glClientActiveTextureARB = wine_glClientActiveTextureARB; gl_info->glClientActiveTextureARB = wine_glClientActiveTextureARB;
...@@ -380,7 +380,8 @@ void add_gl_compat_wrappers(struct wined3d_gl_info *gl_info) ...@@ -380,7 +380,8 @@ void add_gl_compat_wrappers(struct wined3d_gl_info *gl_info)
gl_info->supported[ARB_MULTITEXTURE] = TRUE; gl_info->supported[ARB_MULTITEXTURE] = TRUE;
} }
if(!GL_SUPPORT(EXT_FOG_COORD)) { if (!gl_info->supported[EXT_FOG_COORD])
{
/* This emulation isn't perfect. There are a number of potential problems, but they should /* This emulation isn't perfect. There are a number of potential problems, but they should
* not matter in practise: * not matter in practise:
* *
...@@ -405,10 +406,13 @@ void add_gl_compat_wrappers(struct wined3d_gl_info *gl_info) ...@@ -405,10 +406,13 @@ void add_gl_compat_wrappers(struct wined3d_gl_info *gl_info)
* it via the GL core version, or someone messed around in the extension table in directx.c. Add version- * it via the GL core version, or someone messed around in the extension table in directx.c. Add version-
* dependent loading for this extension if we ever hit this situation * dependent loading for this extension if we ever hit this situation
*/ */
if(GL_SUPPORT(ARB_FRAGMENT_PROGRAM)) { if (gl_info->supported[ARB_FRAGMENT_PROGRAM])
{
FIXME("GL implementation supports GL_ARB_fragment_program but not GL_EXT_fog_coord\n"); FIXME("GL implementation supports GL_ARB_fragment_program but not GL_EXT_fog_coord\n");
FIXME("The fog coord emulation will most likely fail\n"); FIXME("The fog coord emulation will most likely fail\n");
} else if(GL_SUPPORT(ARB_FRAGMENT_SHADER)) { }
else if (gl_info->supported[ARB_FRAGMENT_SHADER])
{
FIXME("GL implementation supports GL_ARB_fragment_shader but not GL_EXT_fog_coord\n"); FIXME("GL implementation supports GL_ARB_fragment_shader but not GL_EXT_fog_coord\n");
FIXME("The fog coord emulation will most likely fail\n"); FIXME("The fog coord emulation will most likely fail\n");
} }
...@@ -533,4 +537,3 @@ void add_gl_compat_wrappers(struct wined3d_gl_info *gl_info) ...@@ -533,4 +537,3 @@ void add_gl_compat_wrappers(struct wined3d_gl_info *gl_info)
gl_info->supported[EXT_FOG_COORD] = TRUE; gl_info->supported[EXT_FOG_COORD] = TRUE;
} }
} }
#undef GLINFO_LOCATION
...@@ -2766,7 +2766,8 @@ static void shader_glsl_texldd(const struct wined3d_shader_instruction *ins) ...@@ -2766,7 +2766,8 @@ static void shader_glsl_texldd(const struct wined3d_shader_instruction *ins)
DWORD sampler_idx; DWORD sampler_idx;
DWORD swizzle = ins->src[1].swizzle; DWORD swizzle = ins->src[1].swizzle;
if(!GL_SUPPORT(ARB_SHADER_TEXTURE_LOD)) { if (!gl_info->supported[ARB_SHADER_TEXTURE_LOD])
{
FIXME("texldd used, but not supported by hardware. Falling back to regular tex\n"); FIXME("texldd used, but not supported by hardware. Falling back to regular tex\n");
return shader_glsl_tex(ins); return shader_glsl_tex(ins);
} }
...@@ -3743,10 +3744,12 @@ static GLuint shader_glsl_generate_pshader(const struct wined3d_context *context ...@@ -3743,10 +3744,12 @@ static GLuint shader_glsl_generate_pshader(const struct wined3d_context *context
shader_addline(buffer, "#version 120\n"); shader_addline(buffer, "#version 120\n");
if(GL_SUPPORT(ARB_SHADER_TEXTURE_LOD) && reg_maps->usestexldd) { if (gl_info->supported[ARB_SHADER_TEXTURE_LOD] && reg_maps->usestexldd)
{
shader_addline(buffer, "#extension GL_ARB_shader_texture_lod : enable\n"); shader_addline(buffer, "#extension GL_ARB_shader_texture_lod : enable\n");
} }
if (GL_SUPPORT(ARB_TEXTURE_RECTANGLE)) { if (gl_info->supported[ARB_TEXTURE_RECTANGLE])
{
/* The spec says that it doesn't have to be explicitly enabled, but the nvidia /* The spec says that it doesn't have to be explicitly enabled, but the nvidia
* drivers write a warning if we don't do so * drivers write a warning if we don't do so
*/ */
...@@ -4318,11 +4321,15 @@ static void shader_glsl_select(const struct wined3d_context *context, BOOL usePS ...@@ -4318,11 +4321,15 @@ static void shader_glsl_select(const struct wined3d_context *context, BOOL usePS
current_vertex_color_clamp = priv->glsl_program ? priv->glsl_program->vertex_color_clamp : GL_FIXED_ONLY_ARB; current_vertex_color_clamp = priv->glsl_program ? priv->glsl_program->vertex_color_clamp : GL_FIXED_ONLY_ARB;
if (old_vertex_color_clamp != current_vertex_color_clamp) { if (old_vertex_color_clamp != current_vertex_color_clamp)
if (GL_SUPPORT(ARB_COLOR_BUFFER_FLOAT)) { {
if (gl_info->supported[ARB_COLOR_BUFFER_FLOAT])
{
GL_EXTCALL(glClampColorARB(GL_CLAMP_VERTEX_COLOR_ARB, current_vertex_color_clamp)); GL_EXTCALL(glClampColorARB(GL_CLAMP_VERTEX_COLOR_ARB, current_vertex_color_clamp));
checkGLcall("glClampColorARB"); checkGLcall("glClampColorARB");
} else { }
else
{
FIXME("vertex color clamp needs to be changed, but extension not supported.\n"); FIXME("vertex color clamp needs to be changed, but extension not supported.\n");
} }
} }
......
...@@ -132,6 +132,7 @@ static void get_src_and_opr_nvrc(DWORD stage, DWORD arg, BOOL is_alpha, GLenum* ...@@ -132,6 +132,7 @@ static void get_src_and_opr_nvrc(DWORD stage, DWORD arg, BOOL is_alpha, GLenum*
void set_tex_op_nvrc(IWineD3DDevice *iface, BOOL is_alpha, int stage, WINED3DTEXTUREOP op, DWORD arg1, DWORD arg2, DWORD arg3, INT texture_idx, DWORD dst) { void set_tex_op_nvrc(IWineD3DDevice *iface, BOOL is_alpha, int stage, WINED3DTEXTUREOP op, DWORD arg1, DWORD arg2, DWORD arg3, INT texture_idx, DWORD dst) {
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl*)iface; IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl*)iface;
const struct wined3d_gl_info *gl_info = &This->adapter->gl_info;
tex_op_args tex_op_args = {{0}, {0}, {0}}; tex_op_args tex_op_args = {{0}, {0}, {0}};
GLenum portion = is_alpha ? GL_ALPHA : GL_RGB; GLenum portion = is_alpha ? GL_ALPHA : GL_RGB;
GLenum target = GL_COMBINER0_NV + stage; GLenum target = GL_COMBINER0_NV + stage;
...@@ -428,7 +429,8 @@ void set_tex_op_nvrc(IWineD3DDevice *iface, BOOL is_alpha, int stage, WINED3DTEX ...@@ -428,7 +429,8 @@ void set_tex_op_nvrc(IWineD3DDevice *iface, BOOL is_alpha, int stage, WINED3DTEX
case WINED3DTOP_BUMPENVMAPLUMINANCE: case WINED3DTOP_BUMPENVMAPLUMINANCE:
case WINED3DTOP_BUMPENVMAP: case WINED3DTOP_BUMPENVMAP:
if(GL_SUPPORT(NV_TEXTURE_SHADER)) { if (gl_info->supported[NV_TEXTURE_SHADER])
{
/* The bump map stage itself isn't exciting, just read the texture. But tell the next stage to /* The bump map stage itself isn't exciting, just read the texture. But tell the next stage to
* perform bump mapping and source from the current stage. Pretty much a SELECTARG2. * perform bump mapping and source from the current stage. Pretty much a SELECTARG2.
* ARG2 is passed through unmodified(apps will most likely use D3DTA_CURRENT for arg2, arg1 * ARG2 is passed through unmodified(apps will most likely use D3DTA_CURRENT for arg2, arg1
...@@ -493,11 +495,13 @@ static void nvrc_colorop(DWORD state, IWineD3DStateBlockImpl *stateblock, struct ...@@ -493,11 +495,13 @@ static void nvrc_colorop(DWORD state, IWineD3DStateBlockImpl *stateblock, struct
checkGLcall("glDisable(GL_TEXTURE_2D)"); checkGLcall("glDisable(GL_TEXTURE_2D)");
glDisable(GL_TEXTURE_3D); glDisable(GL_TEXTURE_3D);
checkGLcall("glDisable(GL_TEXTURE_3D)"); checkGLcall("glDisable(GL_TEXTURE_3D)");
if(GL_SUPPORT(ARB_TEXTURE_CUBE_MAP)) { if (gl_info->supported[ARB_TEXTURE_CUBE_MAP])
{
glDisable(GL_TEXTURE_CUBE_MAP_ARB); glDisable(GL_TEXTURE_CUBE_MAP_ARB);
checkGLcall("glDisable(GL_TEXTURE_CUBE_MAP_ARB)"); checkGLcall("glDisable(GL_TEXTURE_CUBE_MAP_ARB)");
} }
if(GL_SUPPORT(ARB_TEXTURE_RECTANGLE)) { if (gl_info->supported[ARB_TEXTURE_RECTANGLE])
{
glDisable(GL_TEXTURE_RECTANGLE_ARB); glDisable(GL_TEXTURE_RECTANGLE_ARB);
checkGLcall("glDisable(GL_TEXTURE_RECTANGLE_ARB)"); checkGLcall("glDisable(GL_TEXTURE_RECTANGLE_ARB)");
} }
...@@ -513,11 +517,16 @@ static void nvrc_colorop(DWORD state, IWineD3DStateBlockImpl *stateblock, struct ...@@ -513,11 +517,16 @@ static void nvrc_colorop(DWORD state, IWineD3DStateBlockImpl *stateblock, struct
/* The sampler will also activate the correct texture dimensions, so no need to do it here /* The sampler will also activate the correct texture dimensions, so no need to do it here
* if the sampler for this stage is dirty * if the sampler for this stage is dirty
*/ */
if(!isStateDirty(context, STATE_SAMPLER(stage))) { if (!isStateDirty(context, STATE_SAMPLER(stage)))
if (tex_used) { {
if(GL_SUPPORT(NV_TEXTURE_SHADER2)) { if (tex_used)
{
if (gl_info->supported[NV_TEXTURE_SHADER2])
{
nvts_activate_dimensions(stage, stateblock, context); nvts_activate_dimensions(stage, stateblock, context);
} else { }
else
{
texture_activate_dimensions(stage, stateblock, context); texture_activate_dimensions(stage, stateblock, context);
} }
} }
...@@ -535,7 +544,8 @@ static void nvrc_colorop(DWORD state, IWineD3DStateBlockImpl *stateblock, struct ...@@ -535,7 +544,8 @@ static void nvrc_colorop(DWORD state, IWineD3DStateBlockImpl *stateblock, struct
/* In register combiners bump mapping is done in the stage AFTER the one that has the bump map operation set, /* In register combiners bump mapping is done in the stage AFTER the one that has the bump map operation set,
* thus the texture shader may have to be updated * thus the texture shader may have to be updated
*/ */
if(GL_SUPPORT(NV_TEXTURE_SHADER2)) { if (gl_info->supported[NV_TEXTURE_SHADER2])
{
BOOL usesBump = (stateblock->textureState[stage][WINED3DTSS_COLOROP] == WINED3DTOP_BUMPENVMAPLUMINANCE || BOOL usesBump = (stateblock->textureState[stage][WINED3DTSS_COLOROP] == WINED3DTOP_BUMPENVMAPLUMINANCE ||
stateblock->textureState[stage][WINED3DTSS_COLOROP] == WINED3DTOP_BUMPENVMAP) ? TRUE : FALSE; stateblock->textureState[stage][WINED3DTSS_COLOROP] == WINED3DTOP_BUMPENVMAP) ? TRUE : FALSE;
BOOL usedBump = (context->texShaderBumpMap & 1 << (stage + 1)) ? TRUE : FALSE; BOOL usedBump = (context->texShaderBumpMap & 1 << (stage + 1)) ? TRUE : FALSE;
...@@ -600,9 +610,7 @@ static void nvrc_texfactor(DWORD state, IWineD3DStateBlockImpl *stateblock, stru ...@@ -600,9 +610,7 @@ static void nvrc_texfactor(DWORD state, IWineD3DStateBlockImpl *stateblock, stru
D3DCOLORTOGLFLOAT4(stateblock->renderState[WINED3DRS_TEXTUREFACTOR], col); D3DCOLORTOGLFLOAT4(stateblock->renderState[WINED3DRS_TEXTUREFACTOR], col);
GL_EXTCALL(glCombinerParameterfvNV(GL_CONSTANT_COLOR0_NV, &col[0])); GL_EXTCALL(glCombinerParameterfvNV(GL_CONSTANT_COLOR0_NV, &col[0]));
} }
#undef GLINFO_LOCATION
#define GLINFO_LOCATION (*gl_info)
/* Context activation is done by the caller. */ /* Context activation is done by the caller. */
static void nvrc_enable(IWineD3DDevice *iface, BOOL enable) { } static void nvrc_enable(IWineD3DDevice *iface, BOOL enable) { }
...@@ -646,7 +654,8 @@ static void nvrc_fragment_get_caps(WINED3DDEVTYPE devtype, ...@@ -646,7 +654,8 @@ static void nvrc_fragment_get_caps(WINED3DDEVTYPE devtype,
WINED3DTEXOPCAPS_MODULATEINVALPHA_ADDCOLOR | WINED3DTEXOPCAPS_MODULATEINVALPHA_ADDCOLOR |
WINED3DTEXOPCAPS_MODULATEINVCOLOR_ADDALPHA; WINED3DTEXOPCAPS_MODULATEINVCOLOR_ADDALPHA;
if(GL_SUPPORT(NV_TEXTURE_SHADER2)) { if (gl_info->supported[NV_TEXTURE_SHADER2])
{
/* Bump mapping is supported already in NV_TEXTURE_SHADER, but that extension does /* Bump mapping is supported already in NV_TEXTURE_SHADER, but that extension does
* not support 3D textures. This asks for trouble if an app uses both bump mapping * not support 3D textures. This asks for trouble if an app uses both bump mapping
* and 3D textures. It also allows us to keep the code simpler by having texture * and 3D textures. It also allows us to keep the code simpler by having texture
...@@ -669,7 +678,7 @@ static void nvrc_fragment_get_caps(WINED3DDEVTYPE devtype, ...@@ -669,7 +678,7 @@ static void nvrc_fragment_get_caps(WINED3DDEVTYPE devtype,
/* The caps below can be supported but aren't handled yet in utils.c 'd3dta_to_combiner_input', disable them until support is fixed */ /* The caps below can be supported but aren't handled yet in utils.c 'd3dta_to_combiner_input', disable them until support is fixed */
#if 0 #if 0
if (GL_SUPPORT(NV_REGISTER_COMBINERS2)) if (gl_info->supported[NV_REGISTER_COMBINERS2])
pCaps->PrimitiveMiscCaps |= WINED3DPMISCCAPS_PERSTAGECONSTANT; pCaps->PrimitiveMiscCaps |= WINED3DPMISCCAPS_PERSTAGECONSTANT;
#endif #endif
} }
......
...@@ -272,6 +272,8 @@ static HRESULT WINAPI IWineD3DQueryImpl_GetData(IWineD3DQuery* iface, void* pDa ...@@ -272,6 +272,8 @@ static HRESULT WINAPI IWineD3DQueryImpl_GetData(IWineD3DQuery* iface, void* pDa
static HRESULT WINAPI IWineD3DOcclusionQueryImpl_GetData(IWineD3DQuery* iface, void* pData, DWORD dwSize, DWORD dwGetDataFlags) { static HRESULT WINAPI IWineD3DOcclusionQueryImpl_GetData(IWineD3DQuery* iface, void* pData, DWORD dwSize, DWORD dwGetDataFlags) {
IWineD3DQueryImpl *This = (IWineD3DQueryImpl *) iface; IWineD3DQueryImpl *This = (IWineD3DQueryImpl *) iface;
struct wined3d_occlusion_query *query = This->extendedData; struct wined3d_occlusion_query *query = This->extendedData;
IWineD3DDeviceImpl *device = This->wineD3DDevice;
const struct wined3d_gl_info *gl_info = &device->adapter->gl_info;
struct wined3d_context *context; struct wined3d_context *context;
DWORD* data = pData; DWORD* data = pData;
GLuint available; GLuint available;
...@@ -297,7 +299,7 @@ static HRESULT WINAPI IWineD3DOcclusionQueryImpl_GetData(IWineD3DQuery* iface, ...@@ -297,7 +299,7 @@ static HRESULT WINAPI IWineD3DOcclusionQueryImpl_GetData(IWineD3DQuery* iface,
return S_FALSE; return S_FALSE;
} }
if (!GL_SUPPORT(ARB_OCCLUSION_QUERY)) if (!gl_info->supported[ARB_OCCLUSION_QUERY])
{ {
WARN("(%p) : Occlusion queries not supported. Returning 1.\n", This); WARN("(%p) : Occlusion queries not supported. Returning 1.\n", This);
*data = 1; *data = 1;
...@@ -373,12 +375,12 @@ static HRESULT WINAPI IWineD3DEventQueryImpl_GetData(IWineD3DQuery* iface, void ...@@ -373,12 +375,12 @@ static HRESULT WINAPI IWineD3DEventQueryImpl_GetData(IWineD3DQuery* iface, void
ENTER_GL(); ENTER_GL();
if (GL_SUPPORT(APPLE_FENCE)) if (context->gl_info->supported[APPLE_FENCE])
{ {
*data = GL_EXTCALL(glTestFenceAPPLE(query->id)); *data = GL_EXTCALL(glTestFenceAPPLE(query->id));
checkGLcall("glTestFenceAPPLE"); checkGLcall("glTestFenceAPPLE");
} }
else if (GL_SUPPORT(NV_FENCE)) else if (context->gl_info->supported[NV_FENCE])
{ {
*data = GL_EXTCALL(glTestFenceNV(query->id)); *data = GL_EXTCALL(glTestFenceNV(query->id));
checkGLcall("glTestFenceNV"); checkGLcall("glTestFenceNV");
...@@ -495,12 +497,12 @@ static HRESULT WINAPI IWineD3DEventQueryImpl_Issue(IWineD3DQuery* iface, DWORD ...@@ -495,12 +497,12 @@ static HRESULT WINAPI IWineD3DEventQueryImpl_Issue(IWineD3DQuery* iface, DWORD
ENTER_GL(); ENTER_GL();
if (GL_SUPPORT(APPLE_FENCE)) if (context->gl_info->supported[APPLE_FENCE])
{ {
GL_EXTCALL(glSetFenceAPPLE(query->id)); GL_EXTCALL(glSetFenceAPPLE(query->id));
checkGLcall("glSetFenceAPPLE"); checkGLcall("glSetFenceAPPLE");
} }
else if (GL_SUPPORT(NV_FENCE)) else if (context->gl_info->supported[NV_FENCE])
{ {
GL_EXTCALL(glSetFenceNV(query->id, GL_ALL_COMPLETED_NV)); GL_EXTCALL(glSetFenceNV(query->id, GL_ALL_COMPLETED_NV));
checkGLcall("glSetFenceNV"); checkGLcall("glSetFenceNV");
...@@ -527,8 +529,10 @@ static HRESULT WINAPI IWineD3DEventQueryImpl_Issue(IWineD3DQuery* iface, DWORD ...@@ -527,8 +529,10 @@ static HRESULT WINAPI IWineD3DEventQueryImpl_Issue(IWineD3DQuery* iface, DWORD
static HRESULT WINAPI IWineD3DOcclusionQueryImpl_Issue(IWineD3DQuery* iface, DWORD dwIssueFlags) { static HRESULT WINAPI IWineD3DOcclusionQueryImpl_Issue(IWineD3DQuery* iface, DWORD dwIssueFlags) {
IWineD3DQueryImpl *This = (IWineD3DQueryImpl *)iface; IWineD3DQueryImpl *This = (IWineD3DQueryImpl *)iface;
IWineD3DDeviceImpl *device = This->wineD3DDevice;
const struct wined3d_gl_info *gl_info = &device->adapter->gl_info;
if (GL_SUPPORT(ARB_OCCLUSION_QUERY)) if (gl_info->supported[ARB_OCCLUSION_QUERY])
{ {
struct wined3d_occlusion_query *query = This->extendedData; struct wined3d_occlusion_query *query = This->extendedData;
struct wined3d_context *context; struct wined3d_context *context;
......
...@@ -279,7 +279,9 @@ static HRESULT WINAPI IWineD3DSwapChainImpl_Present(IWineD3DSwapChain *iface, CO ...@@ -279,7 +279,9 @@ static HRESULT WINAPI IWineD3DSwapChainImpl_Present(IWineD3DSwapChain *iface, CO
} }
} }
if(This->presentParms.PresentationInterval != WINED3DPRESENT_INTERVAL_IMMEDIATE && GL_SUPPORT(SGI_VIDEO_SYNC)) { if (This->presentParms.PresentationInterval != WINED3DPRESENT_INTERVAL_IMMEDIATE
&& context->gl_info->supported[SGI_VIDEO_SYNC])
{
retval = GL_EXTCALL(glXGetVideoSyncSGI(&sync)); retval = GL_EXTCALL(glXGetVideoSyncSGI(&sync));
if(retval != 0) { if(retval != 0) {
ERR("glXGetVideoSyncSGI failed(retval = %d\n", retval); ERR("glXGetVideoSyncSGI failed(retval = %d\n", retval);
......
...@@ -574,8 +574,6 @@ static BOOL init_format_compression_info(struct wined3d_gl_info *gl_info) ...@@ -574,8 +574,6 @@ static BOOL init_format_compression_info(struct wined3d_gl_info *gl_info)
return TRUE; return TRUE;
} }
#define GLINFO_LOCATION (*gl_info)
/* Context activation is done by the caller. */ /* Context activation is done by the caller. */
static void check_fbo_compat(const struct wined3d_gl_info *gl_info, struct GlPixelFormatDesc *format_desc) static void check_fbo_compat(const struct wined3d_gl_info *gl_info, struct GlPixelFormatDesc *format_desc)
{ {
...@@ -663,8 +661,8 @@ static void check_fbo_compat(const struct wined3d_gl_info *gl_info, struct GlPix ...@@ -663,8 +661,8 @@ static void check_fbo_compat(const struct wined3d_gl_info *gl_info, struct GlPix
{ {
GLuint rb; GLuint rb;
if (GL_SUPPORT(ARB_FRAMEBUFFER_OBJECT) if (gl_info->supported[ARB_FRAMEBUFFER_OBJECT]
|| GL_SUPPORT(EXT_PACKED_DEPTH_STENCIL)) || gl_info->supported[EXT_PACKED_DEPTH_STENCIL])
{ {
gl_info->fbo_ops.glGenRenderbuffers(1, &rb); gl_info->fbo_ops.glGenRenderbuffers(1, &rb);
gl_info->fbo_ops.glBindRenderbuffer(GL_RENDERBUFFER, rb); gl_info->fbo_ops.glBindRenderbuffer(GL_RENDERBUFFER, rb);
...@@ -683,8 +681,8 @@ static void check_fbo_compat(const struct wined3d_gl_info *gl_info, struct GlPix ...@@ -683,8 +681,8 @@ static void check_fbo_compat(const struct wined3d_gl_info *gl_info, struct GlPix
format_desc->Flags &= ~WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING; format_desc->Flags &= ~WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING;
} }
if (GL_SUPPORT(ARB_FRAMEBUFFER_OBJECT) if (gl_info->supported[ARB_FRAMEBUFFER_OBJECT]
|| GL_SUPPORT(EXT_PACKED_DEPTH_STENCIL)) || gl_info->supported[EXT_PACKED_DEPTH_STENCIL])
{ {
gl_info->fbo_ops.glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, 0); gl_info->fbo_ops.glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, 0);
gl_info->fbo_ops.glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, GL_RENDERBUFFER, 0); gl_info->fbo_ops.glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, GL_RENDERBUFFER, 0);
...@@ -771,7 +769,7 @@ static BOOL init_format_texture_info(struct wined3d_gl_info *gl_info) ...@@ -771,7 +769,7 @@ static BOOL init_format_texture_info(struct wined3d_gl_info *gl_info)
return FALSE; return FALSE;
} }
if (!GL_SUPPORT(gl_formats_template[i].extension)) continue; if (!gl_info->supported[gl_formats_template[i].extension]) continue;
desc = &gl_info->gl_formats[fmt_idx]; desc = &gl_info->gl_formats[fmt_idx];
desc->glInternal = gl_formats_template[i].glInternal; desc->glInternal = gl_formats_template[i].glInternal;
...@@ -911,7 +909,7 @@ static void init_format_filter_info(struct wined3d_gl_info *gl_info, enum wined3 ...@@ -911,7 +909,7 @@ static void init_format_filter_info(struct wined3d_gl_info *gl_info, enum wined3
if(wined3d_settings.offscreen_rendering_mode != ORM_FBO) if(wined3d_settings.offscreen_rendering_mode != ORM_FBO)
{ {
WARN("No FBO support, or no FBO ORM, guessing filter info from GL caps\n"); WARN("No FBO support, or no FBO ORM, guessing filter info from GL caps\n");
if (vendor == VENDOR_NVIDIA && GL_SUPPORT(ARB_TEXTURE_FLOAT)) if (vendor == VENDOR_NVIDIA && gl_info->supported[ARB_TEXTURE_FLOAT])
{ {
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;
...@@ -990,7 +988,7 @@ static void apply_format_fixups(struct wined3d_gl_info *gl_info) ...@@ -990,7 +988,7 @@ static void apply_format_fixups(struct wined3d_gl_info *gl_info)
* returns 0.0 when sampling from it, DirectX 1.0. So we always have in-shader * returns 0.0 when sampling from it, DirectX 1.0. So we always have in-shader
* conversion for this format. * conversion for this format.
*/ */
if (!GL_SUPPORT(NV_TEXTURE_SHADER)) if (!gl_info->supported[NV_TEXTURE_SHADER])
{ {
idx = getFmtIdx(WINED3DFMT_R8G8_SNORM); idx = getFmtIdx(WINED3DFMT_R8G8_SNORM);
gl_info->gl_formats[idx].color_fixup = create_color_fixup_desc( gl_info->gl_formats[idx].color_fixup = create_color_fixup_desc(
...@@ -1009,7 +1007,7 @@ static void apply_format_fixups(struct wined3d_gl_info *gl_info) ...@@ -1009,7 +1007,7 @@ static void apply_format_fixups(struct wined3d_gl_info *gl_info)
0, CHANNEL_SOURCE_X, 0, CHANNEL_SOURCE_Y, 0, CHANNEL_SOURCE_ONE, 0, CHANNEL_SOURCE_ONE); 0, CHANNEL_SOURCE_X, 0, CHANNEL_SOURCE_Y, 0, CHANNEL_SOURCE_ONE, 0, CHANNEL_SOURCE_ONE);
} }
if (!GL_SUPPORT(NV_TEXTURE_SHADER)) if (!gl_info->supported[NV_TEXTURE_SHADER])
{ {
/* If GL_NV_texture_shader is not supported, those formats are converted, incompatibly /* If GL_NV_texture_shader is not supported, those formats are converted, incompatibly
* with each other * with each other
...@@ -1033,20 +1031,20 @@ static void apply_format_fixups(struct wined3d_gl_info *gl_info) ...@@ -1033,20 +1031,20 @@ static void apply_format_fixups(struct wined3d_gl_info *gl_info)
*/ */
} }
if (GL_SUPPORT(EXT_TEXTURE_COMPRESSION_RGTC)) if (gl_info->supported[EXT_TEXTURE_COMPRESSION_RGTC])
{ {
idx = getFmtIdx(WINED3DFMT_ATI2N); idx = getFmtIdx(WINED3DFMT_ATI2N);
gl_info->gl_formats[idx].color_fixup = create_color_fixup_desc( gl_info->gl_formats[idx].color_fixup = create_color_fixup_desc(
0, CHANNEL_SOURCE_Y, 0, CHANNEL_SOURCE_X, 0, CHANNEL_SOURCE_ONE, 0, CHANNEL_SOURCE_ONE); 0, CHANNEL_SOURCE_Y, 0, CHANNEL_SOURCE_X, 0, CHANNEL_SOURCE_ONE, 0, CHANNEL_SOURCE_ONE);
} }
else if (GL_SUPPORT(ATI_TEXTURE_COMPRESSION_3DC)) else if (gl_info->supported[ATI_TEXTURE_COMPRESSION_3DC])
{ {
idx = getFmtIdx(WINED3DFMT_ATI2N); idx = getFmtIdx(WINED3DFMT_ATI2N);
gl_info->gl_formats[idx].color_fixup= create_color_fixup_desc( gl_info->gl_formats[idx].color_fixup= create_color_fixup_desc(
0, CHANNEL_SOURCE_X, 0, CHANNEL_SOURCE_W, 0, CHANNEL_SOURCE_ONE, 0, CHANNEL_SOURCE_ONE); 0, CHANNEL_SOURCE_X, 0, CHANNEL_SOURCE_W, 0, CHANNEL_SOURCE_ONE, 0, CHANNEL_SOURCE_ONE);
} }
if (!GL_SUPPORT(APPLE_YCBCR_422)) if (!gl_info->supported[APPLE_YCBCR_422])
{ {
idx = getFmtIdx(WINED3DFMT_YUY2); idx = getFmtIdx(WINED3DFMT_YUY2);
gl_info->gl_formats[idx].color_fixup = create_yuv_fixup_desc(YUV_FIXUP_YUY2); gl_info->gl_formats[idx].color_fixup = create_yuv_fixup_desc(YUV_FIXUP_YUY2);
...@@ -1059,13 +1057,13 @@ static void apply_format_fixups(struct wined3d_gl_info *gl_info) ...@@ -1059,13 +1057,13 @@ static void apply_format_fixups(struct wined3d_gl_info *gl_info)
gl_info->gl_formats[idx].heightscale = 1.5f; gl_info->gl_formats[idx].heightscale = 1.5f;
gl_info->gl_formats[idx].color_fixup = create_yuv_fixup_desc(YUV_FIXUP_YV12); gl_info->gl_formats[idx].color_fixup = create_yuv_fixup_desc(YUV_FIXUP_YV12);
if (GL_SUPPORT(EXT_VERTEX_ARRAY_BGRA)) if (gl_info->supported[EXT_VERTEX_ARRAY_BGRA])
{ {
idx = getFmtIdx(WINED3DFMT_B8G8R8A8_UNORM); idx = getFmtIdx(WINED3DFMT_B8G8R8A8_UNORM);
gl_info->gl_formats[idx].gl_vtx_format = GL_BGRA; gl_info->gl_formats[idx].gl_vtx_format = GL_BGRA;
} }
if (GL_SUPPORT(ARB_HALF_FLOAT_VERTEX)) if (gl_info->supported[ARB_HALF_FLOAT_VERTEX])
{ {
/* Do not change the size of the type, it is CPU side. We have to change the GPU-side information though. /* Do not change the size of the type, it is CPU side. We have to change the GPU-side information though.
* It is the job of the vertex buffer code to make sure that the vbos have the right format */ * It is the job of the vertex buffer code to make sure that the vbos have the right format */
...@@ -2586,11 +2584,13 @@ void texture_activate_dimensions(DWORD stage, IWineD3DStateBlockImpl *stateblock ...@@ -2586,11 +2584,13 @@ void texture_activate_dimensions(DWORD stage, IWineD3DStateBlockImpl *stateblock
case GL_TEXTURE_2D: case GL_TEXTURE_2D:
glDisable(GL_TEXTURE_3D); glDisable(GL_TEXTURE_3D);
checkGLcall("glDisable(GL_TEXTURE_3D)"); checkGLcall("glDisable(GL_TEXTURE_3D)");
if(GL_SUPPORT(ARB_TEXTURE_CUBE_MAP)) { if (gl_info->supported[ARB_TEXTURE_CUBE_MAP])
{
glDisable(GL_TEXTURE_CUBE_MAP_ARB); glDisable(GL_TEXTURE_CUBE_MAP_ARB);
checkGLcall("glDisable(GL_TEXTURE_CUBE_MAP_ARB)"); checkGLcall("glDisable(GL_TEXTURE_CUBE_MAP_ARB)");
} }
if(GL_SUPPORT(ARB_TEXTURE_RECTANGLE)) { if (gl_info->supported[ARB_TEXTURE_RECTANGLE])
{
glDisable(GL_TEXTURE_RECTANGLE_ARB); glDisable(GL_TEXTURE_RECTANGLE_ARB);
checkGLcall("glDisable(GL_TEXTURE_RECTANGLE_ARB)"); checkGLcall("glDisable(GL_TEXTURE_RECTANGLE_ARB)");
} }
...@@ -2602,7 +2602,8 @@ void texture_activate_dimensions(DWORD stage, IWineD3DStateBlockImpl *stateblock ...@@ -2602,7 +2602,8 @@ void texture_activate_dimensions(DWORD stage, IWineD3DStateBlockImpl *stateblock
checkGLcall("glDisable(GL_TEXTURE_2D)"); checkGLcall("glDisable(GL_TEXTURE_2D)");
glDisable(GL_TEXTURE_3D); glDisable(GL_TEXTURE_3D);
checkGLcall("glDisable(GL_TEXTURE_3D)"); checkGLcall("glDisable(GL_TEXTURE_3D)");
if(GL_SUPPORT(ARB_TEXTURE_CUBE_MAP)) { if (gl_info->supported[ARB_TEXTURE_CUBE_MAP])
{
glDisable(GL_TEXTURE_CUBE_MAP_ARB); glDisable(GL_TEXTURE_CUBE_MAP_ARB);
checkGLcall("glDisable(GL_TEXTURE_CUBE_MAP_ARB)"); checkGLcall("glDisable(GL_TEXTURE_CUBE_MAP_ARB)");
} }
...@@ -2610,11 +2611,13 @@ void texture_activate_dimensions(DWORD stage, IWineD3DStateBlockImpl *stateblock ...@@ -2610,11 +2611,13 @@ void texture_activate_dimensions(DWORD stage, IWineD3DStateBlockImpl *stateblock
checkGLcall("glEnable(GL_TEXTURE_RECTANGLE_ARB)"); checkGLcall("glEnable(GL_TEXTURE_RECTANGLE_ARB)");
break; break;
case GL_TEXTURE_3D: case GL_TEXTURE_3D:
if(GL_SUPPORT(ARB_TEXTURE_CUBE_MAP)) { if (gl_info->supported[ARB_TEXTURE_CUBE_MAP])
{
glDisable(GL_TEXTURE_CUBE_MAP_ARB); glDisable(GL_TEXTURE_CUBE_MAP_ARB);
checkGLcall("glDisable(GL_TEXTURE_CUBE_MAP_ARB)"); checkGLcall("glDisable(GL_TEXTURE_CUBE_MAP_ARB)");
} }
if(GL_SUPPORT(ARB_TEXTURE_RECTANGLE)) { if (gl_info->supported[ARB_TEXTURE_RECTANGLE])
{
glDisable(GL_TEXTURE_RECTANGLE_ARB); glDisable(GL_TEXTURE_RECTANGLE_ARB);
checkGLcall("glDisable(GL_TEXTURE_RECTANGLE_ARB)"); checkGLcall("glDisable(GL_TEXTURE_RECTANGLE_ARB)");
} }
...@@ -2628,7 +2631,8 @@ void texture_activate_dimensions(DWORD stage, IWineD3DStateBlockImpl *stateblock ...@@ -2628,7 +2631,8 @@ void texture_activate_dimensions(DWORD stage, IWineD3DStateBlockImpl *stateblock
checkGLcall("glDisable(GL_TEXTURE_2D)"); checkGLcall("glDisable(GL_TEXTURE_2D)");
glDisable(GL_TEXTURE_3D); glDisable(GL_TEXTURE_3D);
checkGLcall("glDisable(GL_TEXTURE_3D)"); checkGLcall("glDisable(GL_TEXTURE_3D)");
if(GL_SUPPORT(ARB_TEXTURE_RECTANGLE)) { if (gl_info->supported[ARB_TEXTURE_RECTANGLE])
{
glDisable(GL_TEXTURE_RECTANGLE_ARB); glDisable(GL_TEXTURE_RECTANGLE_ARB);
checkGLcall("glDisable(GL_TEXTURE_RECTANGLE_ARB)"); checkGLcall("glDisable(GL_TEXTURE_RECTANGLE_ARB)");
} }
...@@ -2641,11 +2645,13 @@ void texture_activate_dimensions(DWORD stage, IWineD3DStateBlockImpl *stateblock ...@@ -2641,11 +2645,13 @@ void texture_activate_dimensions(DWORD stage, IWineD3DStateBlockImpl *stateblock
checkGLcall("glEnable(GL_TEXTURE_2D)"); checkGLcall("glEnable(GL_TEXTURE_2D)");
glDisable(GL_TEXTURE_3D); glDisable(GL_TEXTURE_3D);
checkGLcall("glDisable(GL_TEXTURE_3D)"); checkGLcall("glDisable(GL_TEXTURE_3D)");
if(GL_SUPPORT(ARB_TEXTURE_CUBE_MAP)) { if (gl_info->supported[ARB_TEXTURE_CUBE_MAP])
{
glDisable(GL_TEXTURE_CUBE_MAP_ARB); glDisable(GL_TEXTURE_CUBE_MAP_ARB);
checkGLcall("glDisable(GL_TEXTURE_CUBE_MAP_ARB)"); checkGLcall("glDisable(GL_TEXTURE_CUBE_MAP_ARB)");
} }
if(GL_SUPPORT(ARB_TEXTURE_RECTANGLE)) { if (gl_info->supported[ARB_TEXTURE_RECTANGLE])
{
glDisable(GL_TEXTURE_RECTANGLE_ARB); glDisable(GL_TEXTURE_RECTANGLE_ARB);
checkGLcall("glDisable(GL_TEXTURE_RECTANGLE_ARB)"); checkGLcall("glDisable(GL_TEXTURE_RECTANGLE_ARB)");
} }
......
...@@ -30,6 +30,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(d3d_surface); ...@@ -30,6 +30,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(d3d_surface);
/* Context activation is done by the caller. */ /* Context activation is done by the caller. */
static void volume_bind_and_dirtify(IWineD3DVolume *iface) { static void volume_bind_and_dirtify(IWineD3DVolume *iface) {
IWineD3DVolumeImpl *This = (IWineD3DVolumeImpl *)iface; IWineD3DVolumeImpl *This = (IWineD3DVolumeImpl *)iface;
const struct wined3d_gl_info *gl_info = &This->resource.wineD3DDevice->adapter->gl_info;
IWineD3DVolumeTexture *texture; IWineD3DVolumeTexture *texture;
DWORD active_sampler; DWORD active_sampler;
...@@ -44,7 +45,8 @@ static void volume_bind_and_dirtify(IWineD3DVolume *iface) { ...@@ -44,7 +45,8 @@ static void volume_bind_and_dirtify(IWineD3DVolume *iface) {
* *
* TODO: Track the current active texture per GL context instead of using glGet * TODO: Track the current active texture per GL context instead of using glGet
*/ */
if (GL_SUPPORT(ARB_MULTITEXTURE)) { if (gl_info->supported[ARB_MULTITEXTURE])
{
GLint active_texture; GLint active_texture;
ENTER_GL(); ENTER_GL();
glGetIntegerv(GL_ACTIVE_TEXTURE, &active_texture); glGetIntegerv(GL_ACTIVE_TEXTURE, &active_texture);
......
...@@ -26,8 +26,6 @@ ...@@ -26,8 +26,6 @@
WINE_DEFAULT_DEBUG_CHANNEL(d3d_texture); WINE_DEFAULT_DEBUG_CHANNEL(d3d_texture);
#define GLINFO_LOCATION (*gl_info)
static void volumetexture_internal_preload(IWineD3DBaseTexture *iface, enum WINED3DSRGB srgb) static void volumetexture_internal_preload(IWineD3DBaseTexture *iface, enum WINED3DSRGB srgb)
{ {
/* Override the IWineD3DResource Preload method. */ /* Override the IWineD3DResource Preload method. */
...@@ -42,7 +40,7 @@ static void volumetexture_internal_preload(IWineD3DBaseTexture *iface, enum WINE ...@@ -42,7 +40,7 @@ static void volumetexture_internal_preload(IWineD3DBaseTexture *iface, enum WINE
TRACE("(%p) : About to load texture.\n", This); TRACE("(%p) : About to load texture.\n", This);
if (!device->isInDraw) context = context_acquire(device, NULL, CTXUSAGE_RESOURCELOAD); if (!device->isInDraw) context = context_acquire(device, NULL, CTXUSAGE_RESOURCELOAD);
else if (GL_SUPPORT(EXT_TEXTURE_SRGB) && This->baseTexture.bindCount > 0) else if (gl_info->supported[EXT_TEXTURE_SRGB] && This->baseTexture.bindCount > 0)
{ {
srgb_mode = device->stateBlock->samplerState[This->baseTexture.sampler][WINED3DSAMP_SRGBTEXTURE]; srgb_mode = device->stateBlock->samplerState[This->baseTexture.sampler][WINED3DSAMP_SRGBTEXTURE];
srgb_was_toggled = This->baseTexture.is_srgb != srgb_mode; srgb_was_toggled = This->baseTexture.is_srgb != srgb_mode;
...@@ -97,8 +95,6 @@ static void volumetexture_cleanup(IWineD3DVolumeTextureImpl *This) ...@@ -97,8 +95,6 @@ static void volumetexture_cleanup(IWineD3DVolumeTextureImpl *This)
basetexture_cleanup((IWineD3DBaseTexture *)This); basetexture_cleanup((IWineD3DBaseTexture *)This);
} }
#undef GLINFO_LOCATION
/* ******************************************* /* *******************************************
IWineD3DTexture IUnknown parts follow IWineD3DTexture IUnknown parts follow
******************************************* */ ******************************************* */
......
...@@ -745,7 +745,6 @@ extern int num_lock DECLSPEC_HIDDEN; ...@@ -745,7 +745,6 @@ extern int num_lock DECLSPEC_HIDDEN;
/* GL related defines */ /* GL related defines */
/* ------------------ */ /* ------------------ */
#define GL_SUPPORT(ExtName) (GLINFO_LOCATION.supported[ExtName] != 0)
#define GL_EXTCALL(FuncName) (GLINFO_LOCATION.FuncName) #define GL_EXTCALL(FuncName) (GLINFO_LOCATION.FuncName)
#define D3DCOLOR_B_R(dw) (((dw) >> 16) & 0xFF) #define D3DCOLOR_B_R(dw) (((dw) >> 16) & 0xFF)
......
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