Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Devel #1924

Merged
merged 2 commits into from Mar 15, 2021
Merged

Devel #1924

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
63 changes: 26 additions & 37 deletions Media/RTShaderLib/GLSL/FFPLib_AlphaTest.glsl
Expand Up @@ -5,46 +5,35 @@
// Language: GLSL
//-----------------------------------------------------------------------------

//0 - CMPF_ALWAYS_FAIL,
//1 - CMPF_ALWAYS_PASS,
//2 - CMPF_LESS,
//3 - CMPF_LESS_EQUAL,
//4 - CMPF_EQUAL,
//5 - CMPF_NOT_EQUAL,
//6 - CMPF_GREATER_EQUAL,
//7 - CMPF_GREATER
#define CMPF_ALWAYS_FAIL 0
#define CMPF_ALWAYS_PASS 1
#define CMPF_LESS 2
#define CMPF_LESS_EQUAL 3
#define CMPF_EQUAL 4
#define CMPF_NOT_EQUAL 5
#define CMPF_GREATER_EQUAL 6
#define CMPF_GREATER 7

bool Alpha_Func(in int func, in float alphaRef, in float alphaValue)
{
bool result = true;
switch (func)
{
case 0:// - CMPF_ALWAYS_FAIL,
result = false;
break;
case 1: //- CMPF_ALWAYS_PASS,
result = true;
break;
case 2: //- CMPF_LESS,
result = alphaValue < alphaRef;
break;
case 3: //- CMPF_LESS_EQUAL,
result = alphaValue <= alphaRef;
break;
case 4: //- CMPF_EQUAL,
result = alphaValue == alphaRef;
break;
case 5: //- CMPF_NOT_EQUAL,
result = alphaValue != alphaRef;
break;
case 6: //- CMPF_GREATER_EQUAL,
result = alphaValue >= alphaRef;
break;
case 7: //- CMPF_GREATER
result = alphaValue > alphaRef;
break;
}
return result;
// ES2 does not have switch
if(func == CMPF_ALWAYS_PASS)
return true;
else if(func == CMPF_LESS)
return alphaValue < alphaRef;
else if(func == CMPF_LESS_EQUAL)
return alphaValue <= alphaRef;
else if(func == CMPF_EQUAL)
return alphaValue == alphaRef;
else if(func == CMPF_NOT_EQUAL)
return alphaValue != alphaRef;
else if(func == CMPF_GREATER_EQUAL)
return alphaValue >= alphaRef;
else if(func == CMPF_GREATER)
return alphaValue > alphaRef;

// CMPF_ALWAYS_FAIL and default
return false;
}


Expand Down
4 changes: 2 additions & 2 deletions RenderSystems/GL/src/OgreGLHardwareBuffer.cpp
Expand Up @@ -62,7 +62,7 @@ namespace Ogre {
GLHardwareVertexBuffer::~GLHardwareVertexBuffer()
{
if(GLStateCacheManager* stateCacheManager = mRenderSystem->_getStateCacheManager())
stateCacheManager->deleteGLBuffer(GL_ARRAY_BUFFER_ARB, mBufferId);
stateCacheManager->deleteGLBuffer(mTarget, mBufferId);
}
//---------------------------------------------------------------------
void* GLHardwareVertexBuffer::lockImpl(size_t offset,
Expand Down Expand Up @@ -167,7 +167,7 @@ namespace Ogre {
// get data from the real buffer
mRenderSystem->_getStateCacheManager()->bindGLBuffer(mTarget, mBufferId);

glGetBufferSubDataARB(GL_ARRAY_BUFFER_ARB, offset, length, pDest);
glGetBufferSubDataARB(mTarget, offset, length, pDest);
}
}
//---------------------------------------------------------------------
Expand Down