wined3d: Make use of the EXT_BLEND_SUBTRACT flag.
MSDN mentions a fallback to D3DBLENDOP_ADD if the selected blendop is not supported. In theory it would be nice to write a test for that but I don't think this is particularly important and moreover hardware without that cap seems hard to come by (i.e. I have none)...
This commit is contained in:
parent
35a2406900
commit
498e55a182
|
@ -3399,13 +3399,25 @@ static BOOL wined3d_adapter_init_gl_caps(struct wined3d_adapter *adapter)
|
|||
gl_info->supported[NV_POINT_SPRITE] = TRUE;
|
||||
}
|
||||
|
||||
if ((!gl_info->supported[EXT_BLEND_MINMAX] || !gl_info->supported[EXT_BLEND_SUBTRACT])
|
||||
&& gl_version >= MAKEDWORD_VERSION(1, 4))
|
||||
{
|
||||
TRACE("GL CORE: GL_EXT_blend_minmax / GL_EXT_blend_subtract support.\n");
|
||||
gl_info->supported[EXT_BLEND_MINMAX] = TRUE;
|
||||
gl_info->supported[EXT_BLEND_SUBTRACT] = TRUE;
|
||||
}
|
||||
|
||||
if (!gl_info->supported[ARB_TEXTURE_NON_POWER_OF_TWO] && gl_version >= MAKEDWORD_VERSION(2, 0))
|
||||
{
|
||||
TRACE("GL CORE: GL_ARB_texture_non_power_of_two support.\n");
|
||||
gl_info->supported[ARB_TEXTURE_NON_POWER_OF_TWO] = TRUE;
|
||||
}
|
||||
|
||||
if (gl_version >= MAKEDWORD_VERSION(2, 0)) gl_info->supported[WINED3D_GL_VERSION_2_0] = TRUE;
|
||||
if (gl_info->supported[EXT_BLEND_MINMAX] || gl_info->supported[EXT_BLEND_SUBTRACT])
|
||||
gl_info->supported[WINED3D_GL_BLEND_EQUATION] = TRUE;
|
||||
|
||||
if (gl_version >= MAKEDWORD_VERSION(2, 0))
|
||||
gl_info->supported[WINED3D_GL_VERSION_2_0] = TRUE;
|
||||
|
||||
if (gl_info->supported[APPLE_FENCE])
|
||||
{
|
||||
|
@ -4760,7 +4772,6 @@ HRESULT CDECL wined3d_get_device_caps(const struct wined3d *wined3d, UINT adapte
|
|||
WINED3DPMISCCAPS_CLIPTLVERTS |
|
||||
WINED3DPMISCCAPS_CLIPPLANESCALEDPOINTS |
|
||||
WINED3DPMISCCAPS_MASKZ |
|
||||
WINED3DPMISCCAPS_BLENDOP |
|
||||
WINED3DPMISCCAPS_MRTPOSTPIXELSHADERBLENDING;
|
||||
/* TODO:
|
||||
WINED3DPMISCCAPS_NULLREFERENCE
|
||||
|
@ -4768,6 +4779,8 @@ HRESULT CDECL wined3d_get_device_caps(const struct wined3d *wined3d, UINT adapte
|
|||
WINED3DPMISCCAPS_MRTINDEPENDENTBITDEPTHS
|
||||
WINED3DPMISCCAPS_FOGVERTEXCLAMPED */
|
||||
|
||||
if (gl_info->supported[WINED3D_GL_BLEND_EQUATION])
|
||||
caps->PrimitiveMiscCaps |= WINED3DPMISCCAPS_BLENDOP;
|
||||
if (gl_info->supported[EXT_BLEND_EQUATION_SEPARATE] && gl_info->supported[EXT_BLEND_FUNC_SEPARATE])
|
||||
caps->PrimitiveMiscCaps |= WINED3DPMISCCAPS_SEPARATEALPHABLEND;
|
||||
if (gl_info->supported[EXT_DRAW_BUFFERS2])
|
||||
|
|
|
@ -273,23 +273,23 @@ static void state_blendop_w(struct wined3d_context *context, const struct wined3
|
|||
WARN("Unsupported in local OpenGL implementation: glBlendEquation\n");
|
||||
}
|
||||
|
||||
static GLenum gl_blend_op(enum wined3d_blend_op op)
|
||||
static GLenum gl_blend_op(const struct wined3d_gl_info *gl_info, enum wined3d_blend_op op)
|
||||
{
|
||||
switch (op)
|
||||
{
|
||||
case WINED3D_BLEND_OP_ADD:
|
||||
return GL_FUNC_ADD_EXT;
|
||||
return GL_FUNC_ADD;
|
||||
case WINED3D_BLEND_OP_SUBTRACT:
|
||||
return GL_FUNC_SUBTRACT_EXT;
|
||||
return gl_info->supported[EXT_BLEND_SUBTRACT] ? GL_FUNC_SUBTRACT : GL_FUNC_ADD;
|
||||
case WINED3D_BLEND_OP_REVSUBTRACT:
|
||||
return GL_FUNC_REVERSE_SUBTRACT_EXT;
|
||||
return gl_info->supported[EXT_BLEND_SUBTRACT] ? GL_FUNC_REVERSE_SUBTRACT : GL_FUNC_ADD;
|
||||
case WINED3D_BLEND_OP_MIN:
|
||||
return GL_MIN_EXT;
|
||||
return gl_info->supported[EXT_BLEND_MINMAX] ? GL_MIN : GL_FUNC_ADD;
|
||||
case WINED3D_BLEND_OP_MAX:
|
||||
return GL_MAX_EXT;
|
||||
return gl_info->supported[EXT_BLEND_MINMAX] ? GL_MAX : GL_FUNC_ADD;
|
||||
default:
|
||||
FIXME("Unhandled blend op %#x.\n", op);
|
||||
return GL_NONE;
|
||||
return GL_FUNC_ADD;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -307,8 +307,8 @@ static void state_blendop(struct wined3d_context *context, const struct wined3d_
|
|||
return;
|
||||
}
|
||||
|
||||
blend_equation = gl_blend_op(state->render_states[WINED3D_RS_BLENDOP]);
|
||||
blend_equation_alpha = gl_blend_op(state->render_states[WINED3D_RS_BLENDOPALPHA]);
|
||||
blend_equation = gl_blend_op(gl_info, state->render_states[WINED3D_RS_BLENDOP]);
|
||||
blend_equation_alpha = gl_blend_op(gl_info, state->render_states[WINED3D_RS_BLENDOPALPHA]);
|
||||
TRACE("blend_equation %#x, blend_equation_alpha %#x.\n", blend_equation, blend_equation_alpha);
|
||||
|
||||
if (state->render_states[WINED3D_RS_SEPARATEALPHABLENDENABLE])
|
||||
|
@ -4997,7 +4997,7 @@ const struct StateEntryTemplate misc_state_template[] =
|
|||
{ STATE_RENDER(WINED3D_RS_DEBUGMONITORTOKEN), { STATE_RENDER(WINED3D_RS_DEBUGMONITORTOKEN), state_debug_monitor }, WINED3D_GL_EXT_NONE },
|
||||
{ STATE_RENDER(WINED3D_RS_COLORWRITEENABLE), { STATE_RENDER(WINED3D_RS_COLORWRITEENABLE), state_colorwrite0 }, EXT_DRAW_BUFFERS2 },
|
||||
{ STATE_RENDER(WINED3D_RS_COLORWRITEENABLE), { STATE_RENDER(WINED3D_RS_COLORWRITEENABLE), state_colorwrite }, WINED3D_GL_EXT_NONE },
|
||||
{ STATE_RENDER(WINED3D_RS_BLENDOP), { STATE_RENDER(WINED3D_RS_BLENDOP), state_blendop }, EXT_BLEND_MINMAX },
|
||||
{ STATE_RENDER(WINED3D_RS_BLENDOP), { STATE_RENDER(WINED3D_RS_BLENDOP), state_blendop }, WINED3D_GL_BLEND_EQUATION },
|
||||
{ STATE_RENDER(WINED3D_RS_BLENDOP), { STATE_RENDER(WINED3D_RS_BLENDOP), state_blendop_w }, WINED3D_GL_EXT_NONE },
|
||||
{ STATE_RENDER(WINED3D_RS_SCISSORTESTENABLE), { STATE_RENDER(WINED3D_RS_SCISSORTESTENABLE), state_scissor }, WINED3D_GL_EXT_NONE },
|
||||
{ STATE_RENDER(WINED3D_RS_SLOPESCALEDEPTHBIAS), { STATE_RENDER(WINED3D_RS_DEPTHBIAS), NULL }, WINED3D_GL_EXT_NONE },
|
||||
|
|
|
@ -160,6 +160,7 @@ enum wined3d_gl_extension
|
|||
WGL_EXT_SWAP_CONTROL,
|
||||
WGL_WINE_PIXEL_FORMAT_PASSTHROUGH,
|
||||
/* Internally used */
|
||||
WINED3D_GL_BLEND_EQUATION,
|
||||
WINED3D_GL_NORMALIZED_TEXRECT,
|
||||
WINED3D_GL_VERSION_2_0,
|
||||
|
||||
|
|
Loading…
Reference in New Issue