Add the actual blend equation support for MRTs to the driver.
git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@3662 dfc29bdd-3216-0410-991c-e03cc46cb475master
parent
8f2de7d521
commit
dddac77a75
|
@ -208,20 +208,20 @@ namespace video
|
|||
E_COLOR_PLANE colorMask=ECP_ALL,
|
||||
E_BLEND_FACTOR blendFuncSrc=EBF_ONE,
|
||||
E_BLEND_FACTOR blendFuncDst=EBF_ONE_MINUS_SRC_ALPHA,
|
||||
bool blendEnable=false) :
|
||||
E_BLEND_OPERATION blendOp=EBO_NONE) :
|
||||
RenderTexture(texture),
|
||||
TargetType(ERT_RENDER_TEXTURE), ColorMask(colorMask),
|
||||
BlendFuncSrc(blendFuncSrc), BlendFuncDst(blendFuncDst),
|
||||
BlendEnable(blendEnable) {}
|
||||
BlendOp(blendOp) {}
|
||||
IRenderTarget(E_RENDER_TARGET target,
|
||||
E_COLOR_PLANE colorMask=ECP_ALL,
|
||||
E_BLEND_FACTOR blendFuncSrc=EBF_ONE,
|
||||
E_BLEND_FACTOR blendFuncDst=EBF_ONE_MINUS_SRC_ALPHA,
|
||||
bool blendEnable=false) :
|
||||
E_BLEND_OPERATION blendOp=EBO_NONE) :
|
||||
RenderTexture(0),
|
||||
TargetType(target), ColorMask(colorMask),
|
||||
BlendFuncSrc(blendFuncSrc), BlendFuncDst(blendFuncDst),
|
||||
BlendEnable(blendEnable) {}
|
||||
BlendOp(blendOp) {}
|
||||
bool operator!=(const IRenderTarget& other) const
|
||||
{
|
||||
return ((RenderTexture != other.RenderTexture) ||
|
||||
|
@ -229,14 +229,14 @@ namespace video
|
|||
(ColorMask != other.ColorMask) ||
|
||||
(BlendFuncSrc != other.BlendFuncSrc) ||
|
||||
(BlendFuncDst != other.BlendFuncDst) ||
|
||||
(BlendEnable != other.BlendEnable));
|
||||
(BlendOp != other.BlendOp));
|
||||
}
|
||||
ITexture* RenderTexture;
|
||||
E_RENDER_TARGET TargetType:8;
|
||||
E_COLOR_PLANE ColorMask:8;
|
||||
E_BLEND_FACTOR BlendFuncSrc:4;
|
||||
E_BLEND_FACTOR BlendFuncDst:4;
|
||||
bool BlendEnable;
|
||||
E_BLEND_OPERATION BlendOp:4;
|
||||
};
|
||||
|
||||
//! Interface to driver which is able to perform 2d and 3d graphics functions.
|
||||
|
|
|
@ -4067,14 +4067,32 @@ bool COpenGLDriver::setRenderTarget(const core::array<video::IRenderTarget>& tar
|
|||
(targets[i].ColorMask & ECP_GREEN)?GL_TRUE:GL_FALSE,
|
||||
(targets[i].ColorMask & ECP_BLUE)?GL_TRUE:GL_FALSE,
|
||||
(targets[i].ColorMask & ECP_ALPHA)?GL_TRUE:GL_FALSE);
|
||||
if (targets[i].BlendEnable)
|
||||
extGlEnableIndexed(GL_BLEND, i);
|
||||
else
|
||||
if (targets[i].BlendOp==EBO_NONE)
|
||||
extGlDisableIndexed(GL_BLEND, i);
|
||||
else
|
||||
extGlEnableIndexed(GL_BLEND, i);
|
||||
}
|
||||
if (FeatureAvailable[IRR_AMD_draw_buffers_blend] || FeatureAvailable[IRR_ARB_draw_buffers_blend])
|
||||
{
|
||||
extGlBlendFuncIndexed(i, getGLBlend(targets[i].BlendFuncSrc), getGLBlend(targets[i].BlendFuncDst));
|
||||
switch(targets[i].BlendOp)
|
||||
{
|
||||
case EBO_SUBTRACT:
|
||||
extGlBlendEquationIndexed(i, GL_FUNC_SUBTRACT);
|
||||
break;
|
||||
case EBO_REVSUBTRACT:
|
||||
extGlBlendEquationIndexed(i, GL_FUNC_REVERSE_SUBTRACT);
|
||||
break;
|
||||
case EBO_MIN:
|
||||
extGlBlendEquationIndexed(i, GL_MIN);
|
||||
break;
|
||||
case EBO_MAX:
|
||||
extGlBlendEquationIndexed(i, GL_MAX);
|
||||
break;
|
||||
default:
|
||||
extGlBlendEquationIndexed(i, GL_FUNC_ADD);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (targets[i].TargetType==ERT_RENDER_TEXTURE)
|
||||
{
|
||||
|
@ -4319,7 +4337,7 @@ GLenum COpenGLDriver::primitiveTypeToGL(scene::E_PRIMITIVE_TYPE type) const
|
|||
|
||||
GLenum COpenGLDriver::getGLBlend (E_BLEND_FACTOR factor) const
|
||||
{
|
||||
u32 r = 0;
|
||||
GLenum r = 0;
|
||||
switch (factor)
|
||||
{
|
||||
case EBF_ZERO: r = GL_ZERO; break;
|
||||
|
|
Loading…
Reference in New Issue