Merge remote-tracking branch 'origin/master' into include-glew
This commit is contained in:
commit
e8aa181348
@ -33,8 +33,6 @@ void main()
|
|||||||
|
|
||||||
// Uncharted2 tonemap with Auria's custom coefficients
|
// Uncharted2 tonemap with Auria's custom coefficients
|
||||||
vec4 perChannel = (col * (6.9 * col + .5)) / (col * (5.2 * col + 1.7) + 0.06);
|
vec4 perChannel = (col * (6.9 * col + .5)) / (col * (5.2 * col + 1.7) + 0.06);
|
||||||
// Protect us from negative coefficient just in case...
|
|
||||||
perChannel = max(perChannel, vec4(0.));
|
|
||||||
perChannel = pow(perChannel, vec4(2.2));
|
perChannel = pow(perChannel, vec4(2.2));
|
||||||
|
|
||||||
vec2 inside = uv - 0.5;
|
vec2 inside = uv - 0.5;
|
||||||
|
@ -14,6 +14,6 @@ vec3 getLightFactor(float specMapValue)
|
|||||||
vec3 DiffuseComponent = texture(DiffuseMap, tc).xyz;
|
vec3 DiffuseComponent = texture(DiffuseMap, tc).xyz;
|
||||||
vec3 SpecularComponent = texture(SpecularMap, tc).xyz;
|
vec3 SpecularComponent = texture(SpecularMap, tc).xyz;
|
||||||
float ao = texture(SSAO, tc).x;
|
float ao = texture(SSAO, tc).x;
|
||||||
vec3 tmp = DiffuseComponent + SpecularComponent * max(specMapValue, 0.);
|
vec3 tmp = DiffuseComponent + SpecularComponent * specMapValue;
|
||||||
return tmp * ao;
|
return tmp * ao;
|
||||||
}
|
}
|
@ -499,6 +499,36 @@ void IrrPrintXGrabError(int grabResult, const c8 * grabCommand )
|
|||||||
static GLXContext getMeAGLContext(Display *display, GLXFBConfig glxFBConfig)
|
static GLXContext getMeAGLContext(Display *display, GLXFBConfig glxFBConfig)
|
||||||
{
|
{
|
||||||
GLXContext Context;
|
GLXContext Context;
|
||||||
|
int compat43ctxdebug[] =
|
||||||
|
{
|
||||||
|
GLX_CONTEXT_MAJOR_VERSION_ARB, 4,
|
||||||
|
GLX_CONTEXT_MINOR_VERSION_ARB, 3,
|
||||||
|
GLX_CONTEXT_PROFILE_MASK_ARB, GLX_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB,
|
||||||
|
GLX_CONTEXT_FLAGS_ARB, GLX_CONTEXT_DEBUG_BIT_ARB,
|
||||||
|
None
|
||||||
|
};
|
||||||
|
int compat43ctx[] =
|
||||||
|
{
|
||||||
|
GLX_CONTEXT_MAJOR_VERSION_ARB, 4,
|
||||||
|
GLX_CONTEXT_MINOR_VERSION_ARB, 3,
|
||||||
|
GLX_CONTEXT_PROFILE_MASK_ARB, GLX_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB,
|
||||||
|
None
|
||||||
|
};
|
||||||
|
int core43ctxdebug[] =
|
||||||
|
{
|
||||||
|
GLX_CONTEXT_MAJOR_VERSION_ARB, 4,
|
||||||
|
GLX_CONTEXT_MINOR_VERSION_ARB, 3,
|
||||||
|
GLX_CONTEXT_PROFILE_MASK_ARB, GLX_CONTEXT_CORE_PROFILE_BIT_ARB,
|
||||||
|
GLX_CONTEXT_FLAGS_ARB, GLX_CONTEXT_DEBUG_BIT_ARB,
|
||||||
|
None
|
||||||
|
};
|
||||||
|
int core43ctx[] =
|
||||||
|
{
|
||||||
|
GLX_CONTEXT_MAJOR_VERSION_ARB, 4,
|
||||||
|
GLX_CONTEXT_MINOR_VERSION_ARB, 3,
|
||||||
|
GLX_CONTEXT_PROFILE_MASK_ARB, GLX_CONTEXT_CORE_PROFILE_BIT_ARB,
|
||||||
|
None
|
||||||
|
};
|
||||||
int compat33ctxdebug[] =
|
int compat33ctxdebug[] =
|
||||||
{
|
{
|
||||||
GLX_CONTEXT_MAJOR_VERSION_ARB, 3,
|
GLX_CONTEXT_MAJOR_VERSION_ARB, 3,
|
||||||
@ -553,7 +583,19 @@ static GLXContext getMeAGLContext(Display *display, GLXFBConfig glxFBConfig)
|
|||||||
PFNGLXCREATECONTEXTATTRIBSARBPROC glXCreateContextAttribsARB = 0;
|
PFNGLXCREATECONTEXTATTRIBSARBPROC glXCreateContextAttribsARB = 0;
|
||||||
glXCreateContextAttribsARB = (PFNGLXCREATECONTEXTATTRIBSARBPROC)
|
glXCreateContextAttribsARB = (PFNGLXCREATECONTEXTATTRIBSARBPROC)
|
||||||
glXGetProcAddressARB( (const GLubyte *) "glXCreateContextAttribsARB" );
|
glXGetProcAddressARB( (const GLubyte *) "glXCreateContextAttribsARB" );
|
||||||
|
|
||||||
|
// create compat 4.3 context (for proprietary drivers)
|
||||||
|
Context = glXCreateContextAttribsARB(display, glxFBConfig, 0, True, GLContextDebugBit ? compat43ctxdebug : compat43ctx);
|
||||||
|
if (!XErrorSignaled)
|
||||||
|
return Context;
|
||||||
|
|
||||||
|
XErrorSignaled = false;
|
||||||
|
// create core 4.3 context (for mesa)
|
||||||
|
Context = glXCreateContextAttribsARB(display, glxFBConfig, 0, True, GLContextDebugBit ? core43ctxdebug : core43ctx);
|
||||||
|
if (!XErrorSignaled)
|
||||||
|
return Context;
|
||||||
|
|
||||||
|
XErrorSignaled = false;
|
||||||
// create compat 3.3 context (for proprietary drivers)
|
// create compat 3.3 context (for proprietary drivers)
|
||||||
Context = glXCreateContextAttribsARB(display, glxFBConfig, 0, True, GLContextDebugBit ? compat33ctxdebug : compat33ctx);
|
Context = glXCreateContextAttribsARB(display, glxFBConfig, 0, True, GLContextDebugBit ? compat33ctxdebug : compat33ctx);
|
||||||
if (!XErrorSignaled)
|
if (!XErrorSignaled)
|
||||||
|
@ -335,6 +335,8 @@ void PostProcessing::renderGaussian6Blur(FrameBuffer &in_fbo, FrameBuffer &auxil
|
|||||||
void PostProcessing::renderGaussian17TapBlur(FrameBuffer &in_fbo, FrameBuffer &auxiliary)
|
void PostProcessing::renderGaussian17TapBlur(FrameBuffer &in_fbo, FrameBuffer &auxiliary)
|
||||||
{
|
{
|
||||||
assert(in_fbo.getWidth() == auxiliary.getWidth() && in_fbo.getHeight() == auxiliary.getHeight());
|
assert(in_fbo.getWidth() == auxiliary.getWidth() && in_fbo.getHeight() == auxiliary.getHeight());
|
||||||
|
if (irr_driver->hasARBComputeShaders())
|
||||||
|
glMemoryBarrier(GL_FRAMEBUFFER_BARRIER_BIT);
|
||||||
float inv_width = 1.0f / in_fbo.getWidth(), inv_height = 1.0f / in_fbo.getHeight();
|
float inv_width = 1.0f / in_fbo.getWidth(), inv_height = 1.0f / in_fbo.getHeight();
|
||||||
{
|
{
|
||||||
if (!irr_driver->hasARBComputeShaders())
|
if (!irr_driver->hasARBComputeShaders())
|
||||||
@ -345,8 +347,10 @@ void PostProcessing::renderGaussian17TapBlur(FrameBuffer &in_fbo, FrameBuffer &a
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
||||||
glUseProgram(FullScreenShader::ComputeGaussian17TapHShader::getInstance()->Program);
|
glUseProgram(FullScreenShader::ComputeGaussian17TapHShader::getInstance()->Program);
|
||||||
|
glBindSampler(FullScreenShader::ComputeGaussian17TapHShader::getInstance()->TU_source, 0);
|
||||||
|
glBindSampler(FullScreenShader::ComputeGaussian17TapHShader::getInstance()->TU_depth, 0);
|
||||||
|
glBindSampler(FullScreenShader::ComputeGaussian17TapHShader::getInstance()->TU_dest, 0);
|
||||||
glBindImageTexture(FullScreenShader::ComputeGaussian17TapHShader::getInstance()->TU_source, in_fbo.getRTT()[0], 0, false, 0, GL_READ_ONLY, GL_R16F);
|
glBindImageTexture(FullScreenShader::ComputeGaussian17TapHShader::getInstance()->TU_source, in_fbo.getRTT()[0], 0, false, 0, GL_READ_ONLY, GL_R16F);
|
||||||
glBindImageTexture(FullScreenShader::ComputeGaussian17TapHShader::getInstance()->TU_depth, irr_driver->getFBO(FBO_LINEAR_DEPTH).getRTT()[0], 1, false, 0, GL_READ_ONLY, GL_R32F);
|
glBindImageTexture(FullScreenShader::ComputeGaussian17TapHShader::getInstance()->TU_depth, irr_driver->getFBO(FBO_LINEAR_DEPTH).getRTT()[0], 1, false, 0, GL_READ_ONLY, GL_R32F);
|
||||||
glBindImageTexture(FullScreenShader::ComputeGaussian17TapHShader::getInstance()->TU_dest, auxiliary.getRTT()[0], 0, false, 0, GL_WRITE_ONLY, GL_R16F);
|
glBindImageTexture(FullScreenShader::ComputeGaussian17TapHShader::getInstance()->TU_dest, auxiliary.getRTT()[0], 0, false, 0, GL_WRITE_ONLY, GL_R16F);
|
||||||
@ -354,24 +358,35 @@ void PostProcessing::renderGaussian17TapBlur(FrameBuffer &in_fbo, FrameBuffer &a
|
|||||||
glDispatchCompute(in_fbo.getWidth() / 8, in_fbo.getHeight() / 8, 1);
|
glDispatchCompute(in_fbo.getWidth() / 8, in_fbo.getHeight() / 8, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (irr_driver->hasARBComputeShaders())
|
||||||
|
glMemoryBarrier(GL_SHADER_IMAGE_ACCESS_BARRIER_BIT);
|
||||||
{
|
{
|
||||||
|
#ifdef WIN32
|
||||||
if (!irr_driver->hasARBComputeShaders())
|
if (!irr_driver->hasARBComputeShaders())
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
in_fbo.Bind();
|
in_fbo.Bind();
|
||||||
|
|
||||||
FullScreenShader::Gaussian17TapVShader::getInstance()->SetTextureUnits(createVector<GLuint>(auxiliary.getRTT()[0], irr_driver->getFBO(FBO_LINEAR_DEPTH).getRTT()[0]));
|
FullScreenShader::Gaussian17TapVShader::getInstance()->SetTextureUnits(createVector<GLuint>(auxiliary.getRTT()[0], irr_driver->getFBO(FBO_LINEAR_DEPTH).getRTT()[0]));
|
||||||
DrawFullScreenEffect<FullScreenShader::Gaussian17TapVShader>(core::vector2df(inv_width, inv_height));
|
DrawFullScreenEffect<FullScreenShader::Gaussian17TapVShader>(core::vector2df(inv_width, inv_height));
|
||||||
}
|
}
|
||||||
|
#ifdef WIN32
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
glUseProgram(FullScreenShader::ComputeGaussian17TapVShader::getInstance()->Program);
|
glUseProgram(FullScreenShader::ComputeGaussian17TapVShader::getInstance()->Program);
|
||||||
|
glBindSampler(FullScreenShader::ComputeGaussian17TapVShader::getInstance()->TU_source, 0);
|
||||||
|
glBindSampler(FullScreenShader::ComputeGaussian17TapVShader::getInstance()->TU_depth, 0);
|
||||||
|
glBindSampler(FullScreenShader::ComputeGaussian17TapVShader::getInstance()->TU_dest, 0);
|
||||||
glBindImageTexture(FullScreenShader::ComputeGaussian17TapVShader::getInstance()->TU_source, auxiliary.getRTT()[0], 0, false, 0, GL_READ_ONLY, GL_R16F);
|
glBindImageTexture(FullScreenShader::ComputeGaussian17TapVShader::getInstance()->TU_source, auxiliary.getRTT()[0], 0, false, 0, GL_READ_ONLY, GL_R16F);
|
||||||
glBindImageTexture(FullScreenShader::ComputeGaussian17TapVShader::getInstance()->TU_depth, irr_driver->getFBO(FBO_LINEAR_DEPTH).getRTT()[0], 1, false, 0, GL_READ_ONLY, GL_R32F);
|
glBindImageTexture(FullScreenShader::ComputeGaussian17TapVShader::getInstance()->TU_depth, irr_driver->getFBO(FBO_LINEAR_DEPTH).getRTT()[0], 1, false, 0, GL_READ_ONLY, GL_R32F);
|
||||||
glBindImageTexture(FullScreenShader::ComputeGaussian17TapVShader::getInstance()->TU_dest, in_fbo.getRTT()[0], 0, false, 0, GL_WRITE_ONLY, GL_R16F);
|
glBindImageTexture(FullScreenShader::ComputeGaussian17TapVShader::getInstance()->TU_dest, in_fbo.getRTT()[0], 0, false, 0, GL_WRITE_ONLY, GL_R16F);
|
||||||
FullScreenShader::ComputeGaussian17TapVShader::getInstance()->setUniforms();
|
FullScreenShader::ComputeGaussian17TapVShader::getInstance()->setUniforms();
|
||||||
glDispatchCompute(in_fbo.getWidth() / 8, in_fbo.getHeight() / 8, 1);
|
glDispatchCompute(in_fbo.getWidth() / 8, in_fbo.getHeight() / 8, 1);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
if (irr_driver->hasARBComputeShaders())
|
||||||
|
glMemoryBarrier(GL_TEXTURE_FETCH_BARRIER_BIT);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PostProcessing::renderPassThrough(GLuint tex)
|
void PostProcessing::renderPassThrough(GLuint tex)
|
||||||
|
Loading…
Reference in New Issue
Block a user