Commit 175d634f by Alexis Hetu Committed by Alexis Hétu

Minor bug fixes and cleanup

- Removed unused variables - Fixed member initialization order in a few classes - Fixed Surface::setSwapBehavior() - Removed unused mPixelPackingStateDirty members - Fixed initialization of "size" member in LinkedVarying class - Fixed constness of a string - Removed unused static functions - Added parenthesis to fix && / || order ambiguity Change-Id: Ia9ad8eaca335c60871fdc58037e441aa2010a641 Reviewed-on: https://swiftshader-review.googlesource.com/4301Tested-by: 's avatarAlexis Hétu <sugoi@google.com> Reviewed-by: 's avatarNicolas Capens <capn@google.com>
parent 5dcf88b2
......@@ -41,7 +41,7 @@ namespace sw
}
}
FrameBufferX11::FrameBufferX11(Display *display, Window window, int width, int height) : FrameBuffer(width, height, false, false), x_window(window), x_display(display), ownX11(!display)
FrameBufferX11::FrameBufferX11(Display *display, Window window, int width, int height) : FrameBuffer(width, height, false, false), ownX11(!display), x_display(display), x_window(window)
{
if(!x_display)
{
......
......@@ -144,7 +144,7 @@ egl::Image *Surface::getDepthStencil()
void Surface::setSwapBehavior(EGLenum swapBehavior)
{
swapBehavior = swapBehavior;
this->swapBehavior = swapBehavior;
}
void Surface::setSwapInterval(EGLint interval)
......
......@@ -624,7 +624,6 @@ private:
// state caching flags
bool mDepthStateDirty;
bool mMaskStateDirty;
bool mPixelPackingStateDirty;
bool mBlendStateDirty;
bool mStencilStateDirty;
bool mPolygonOffsetStateDirty;
......
......@@ -747,7 +747,6 @@ private:
// state caching flags
bool mDepthStateDirty;
bool mMaskStateDirty;
bool mPixelPackingStateDirty;
bool mBlendStateDirty;
bool mStencilStateDirty;
bool mPolygonOffsetStateDirty;
......
......@@ -162,7 +162,7 @@ std::size_t IndexDataManager::typeSize(GLenum type)
}
}
StreamingIndexBuffer::StreamingIndexBuffer(unsigned int initialSize) : mBufferSize(initialSize), mIndexBuffer(NULL)
StreamingIndexBuffer::StreamingIndexBuffer(unsigned int initialSize) : mIndexBuffer(NULL), mBufferSize(initialSize)
{
if(initialSize > 0)
{
......
......@@ -147,12 +147,12 @@ namespace es2
{
}
LinkedVarying::LinkedVarying(const std::string &name, GLenum type, GLsizei sizet)
LinkedVarying::LinkedVarying(const std::string &name, GLenum type, GLsizei size)
: name(name), type(type), size(size)
{
}
Program::Program(ResourceManager *manager, GLuint handle) : resourceManager(manager), handle(handle), serial(issueSerial())
Program::Program(ResourceManager *manager, GLuint handle) : serial(issueSerial()), resourceManager(manager), handle(handle)
{
device = getDevice();
......@@ -1700,7 +1700,6 @@ namespace es2
if(blockIndex == GL_INVALID_INDEX)
{
const glsl::ActiveUniforms &activeUniforms = shader->activeUniforms;
const std::vector<int>& fields = block.fields;
std::vector<unsigned int> memberUniformIndexes;
for(size_t i = 0; i < fields.size(); ++i)
......
......@@ -199,7 +199,7 @@ void Shader::compile()
TranslatorASM *compiler = createCompiler(getType());
// Ensure we don't pass a NULL source to the compiler
char *source = "\0";
const char *source = "\0";
if(mSource)
{
source = mSource;
......
......@@ -46,41 +46,6 @@ static bool validImageSize(GLint level, GLsizei width, GLsizei height)
return true;
}
static bool validateSubImageParams(bool compressed, GLsizei width, GLsizei height, GLint xoffset, GLint yoffset, GLenum target, GLint level, GLenum format, es2::Texture *texture)
{
if(!texture)
{
return error(GL_INVALID_OPERATION, false);
}
if(compressed != texture->isCompressed(target, level))
{
return error(GL_INVALID_OPERATION, false);
}
if(format != GL_NONE && format != texture->getFormat(target, level))
{
return error(GL_INVALID_OPERATION, false);
}
if(compressed)
{
if((width % 4 != 0 && width != texture->getWidth(target, 0)) ||
(height % 4 != 0 && height != texture->getHeight(target, 0)))
{
return error(GL_INVALID_OPERATION, false);
}
}
if(xoffset + width > texture->getWidth(target, level) ||
yoffset + height > texture->getHeight(target, level))
{
return error(GL_INVALID_VALUE, false);
}
return true;
}
static bool validateSubImageParams(bool compressed, GLsizei width, GLsizei height, GLsizei depth, GLint xoffset, GLint yoffset, GLint zoffset, GLenum target, GLint level, GLenum format, es2::Texture *texture)
{
if(!texture)
......@@ -415,26 +380,6 @@ static bool ValidateQueryTarget(GLenum target)
return true;
}
static bool ValidateBufferTarget(GLenum target)
{
switch(target)
{
case GL_ARRAY_BUFFER:
case GL_COPY_READ_BUFFER:
case GL_COPY_WRITE_BUFFER:
case GL_ELEMENT_ARRAY_BUFFER:
case GL_PIXEL_PACK_BUFFER:
case GL_PIXEL_UNPACK_BUFFER:
case GL_TRANSFORM_FEEDBACK_BUFFER:
case GL_UNIFORM_BUFFER:
break;
default:
return false;
}
return true;
}
bool ValidateTexParamParameters(GLenum pname, GLint param)
{
switch(pname)
......@@ -1624,7 +1569,11 @@ GL_APICALL void GL_APIENTRY glFramebufferTextureLayer(GLenum target, GLenum atta
TRACE("(GLenum target = 0x%X, GLenum attachment = 0x%X, GLuint texture = %d, GLint level = %d, GLint layer = %d)",
target, attachment, texture, level, layer);
if(texture != 0 && layer < 0 || level < 0)
// GLES 3.0.4 spec, p.209, section 4.4.2
// If texture is zero, any image or array of images attached to the attachment point
// named by attachment is detached. Any additional parameters(level, textarget,
// and / or layer) are ignored when texture is zero.
if(texture != 0 && (layer < 0 || level < 0))
{
return error(GL_INVALID_VALUE);
}
......@@ -2814,12 +2763,16 @@ GL_APICALL void GL_APIENTRY glCopyBufferSubData(GLenum readTarget, GLenum writeT
{
return error(GL_INVALID_OPERATION);
}
if((readBuffer == writeBuffer) && // If same buffer, check for overlap
((readOffset >= writeOffset) && (readOffset < (writeOffset + size)) ||
(writeOffset >= readOffset) && (writeOffset < (readOffset + size))))
if(readBuffer == writeBuffer)
{
return error(GL_INVALID_VALUE);
// If same buffer, check for overlap
if(((readOffset >= writeOffset) && (readOffset < (writeOffset + size))) ||
((writeOffset >= readOffset) && (writeOffset < (readOffset + size))))
{
return error(GL_INVALID_VALUE);
}
}
if((static_cast<size_t>(readOffset + size) > readBuffer->size()) ||
(static_cast<size_t>(writeOffset + size) > writeBuffer->size()))
{
......
......@@ -343,9 +343,9 @@ namespace sw
float sxsy = sx * sy;
float sxcy = sx * cy;
return Matrix(cy * cz - sy * sx * sz, -cy * sz - sy * sx * cz, -sy * cx,
cx * sz, cx * cz, -sx,
sy * cz + cy * sx * sz, -sy * sz + cy * sx * cz, cy * cx);
return Matrix(cy * cz - sxsy * sz, -cy * sz - sxsy * cz, -sy * cx,
cx * sz, cx * cz, -sx,
sy * cz + sxcy * sz, -sy * sz + sxcy * cz, cy * cx);
}
Matrix Matrix::eulerRotate(float x, float y, float z)
......
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