Commit 67102f01 by Jamie Madill

Add pass-through for new unpack store params.

Move the UNIMPLEMENTED checks to where they are used with non-default values. This allows dEQP to pass the prerequisite tests like state reset without throwing assertion failures in debug. BUG=angleproject:901,angleproject:512 Change-Id: I3bd35f6dea61e7d80d1379ba4e8e13437e68431a Reviewed-on: https://chromium-review.googlesource.com/257130Tested-by: 's avatarJamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org>
parent 2728eda4
......@@ -1107,6 +1107,11 @@ const PixelUnpackState &State::getUnpackState() const
return mUnpack;
}
PixelUnpackState &State::getUnpackState()
{
return mUnpack;
}
void State::getBooleanv(GLenum pname, GLboolean *params)
{
switch (pname)
......
......@@ -244,6 +244,7 @@ class State
void setUnpackRowLength(GLint rowLength);
GLint getUnpackRowLength() const;
const PixelUnpackState &getUnpackState() const;
PixelUnpackState &getUnpackState();
// State query functions
void getBooleanv(GLenum pname, GLboolean *params);
......
......@@ -188,15 +188,27 @@ struct PixelUnpackState
BindingPointer<Buffer> pixelBuffer;
GLint alignment;
GLint rowLength;
GLint skipRows;
GLint skipPixels;
GLint imageHeight;
GLint skipImages;
PixelUnpackState()
: alignment(4),
rowLength(0)
rowLength(0),
skipRows(0),
skipPixels(0),
imageHeight(0),
skipImages(0)
{}
PixelUnpackState(GLint alignmentIn, GLint rowLengthIn)
: alignment(alignmentIn),
rowLength(rowLengthIn)
rowLength(rowLengthIn),
skipRows(0),
skipPixels(0),
imageHeight(0),
skipImages(0)
{}
};
......
......@@ -160,6 +160,12 @@ gl::Error TextureD3D::setImage(const gl::ImageIndex &index, GLenum type,
const gl::PixelUnpackState &unpack, const uint8_t *pixels,
ptrdiff_t layerOffset)
{
if (unpack.skipRows != 0 || unpack.skipPixels != 0 || unpack.imageHeight != 0 || unpack.skipImages != 0)
{
UNIMPLEMENTED();
return gl::Error(GL_INVALID_OPERATION, "unimplemented pixel store state");
}
ImageD3D *image = getImage(index);
ASSERT(image);
......@@ -243,6 +249,12 @@ gl::Error TextureD3D::subImage(const gl::ImageIndex &index, const gl::Box &area,
gl::Error TextureD3D::setCompressedImage(const gl::ImageIndex &index, const gl::PixelUnpackState &unpack,
const uint8_t *pixels, ptrdiff_t layerOffset)
{
if (unpack.skipRows != 0 || unpack.skipPixels != 0 || unpack.imageHeight != 0 || unpack.skipImages != 0)
{
UNIMPLEMENTED();
return gl::Error(GL_INVALID_OPERATION, "unimplemented pixel store state");
}
// We no longer need the "GLenum format" parameter to TexImage to determine what data format "pixels" contains.
// From our image internal format we know how many channels to expect, and "type" gives the format of pixel's components.
const uint8_t *pixelData = NULL;
......@@ -274,6 +286,12 @@ gl::Error TextureD3D::subImageCompressed(const gl::ImageIndex &index, const gl::
const gl::PixelUnpackState &unpack, const uint8_t *pixels,
ptrdiff_t layerOffset)
{
if (unpack.skipRows != 0 || unpack.skipPixels != 0 || unpack.imageHeight != 0 || unpack.skipImages != 0)
{
UNIMPLEMENTED();
return gl::Error(GL_INVALID_OPERATION, "unimplemented pixel store state");
}
const uint8_t *pixelData = NULL;
gl::Error error = GetUnpackPointer(unpack, pixels, layerOffset, &pixelData);
if (error.isError())
......@@ -684,6 +702,12 @@ gl::Error TextureD3D_2D::setSubImage(GLenum target, size_t level, const gl::Box
{
ASSERT(target == GL_TEXTURE_2D && area.depth == 1 && area.z == 0);
if (unpack.skipRows != 0 || unpack.skipPixels != 0 || unpack.imageHeight != 0 || unpack.skipImages != 0)
{
UNIMPLEMENTED();
return gl::Error(GL_INVALID_OPERATION, "unimplemented pixel store state");
}
gl::ImageIndex index = gl::ImageIndex::Make2D(level);
if (isFastUnpackable(unpack, getInternalFormat(level)) && isLevelComplete(level))
{
......
......@@ -9,6 +9,7 @@
#include "libANGLE/renderer/gl/TextureGL.h"
#include "common/debug.h"
#include "libANGLE/State.h"
namespace rx
{
......@@ -28,6 +29,12 @@ void TextureGL::setUsage(GLenum usage)
gl::Error TextureGL::setImage(GLenum target, size_t level, GLenum internalFormat, const gl::Extents &size, GLenum format, GLenum type,
const gl::PixelUnpackState &unpack, const uint8_t *pixels)
{
if (unpack.skipRows != 0 || unpack.skipPixels != 0 || unpack.imageHeight != 0 || unpack.skipImages != 0)
{
UNIMPLEMENTED();
return gl::Error(GL_INVALID_OPERATION, "unimplemented pixel store state");
}
UNIMPLEMENTED();
return gl::Error(GL_INVALID_OPERATION);
}
......@@ -35,6 +42,12 @@ gl::Error TextureGL::setImage(GLenum target, size_t level, GLenum internalFormat
gl::Error TextureGL::setSubImage(GLenum target, size_t level, const gl::Box &area, GLenum format, GLenum type,
const gl::PixelUnpackState &unpack, const uint8_t *pixels)
{
if (unpack.skipRows != 0 || unpack.skipPixels != 0 || unpack.imageHeight != 0 || unpack.skipImages != 0)
{
UNIMPLEMENTED();
return gl::Error(GL_INVALID_OPERATION, "unimplemented pixel store state");
}
UNIMPLEMENTED();
return gl::Error(GL_INVALID_OPERATION);
}
......@@ -42,6 +55,12 @@ gl::Error TextureGL::setSubImage(GLenum target, size_t level, const gl::Box &are
gl::Error TextureGL::setCompressedImage(GLenum target, size_t level, GLenum internalFormat, const gl::Extents &size,
const gl::PixelUnpackState &unpack, const uint8_t *pixels)
{
if (unpack.skipRows != 0 || unpack.skipPixels != 0 || unpack.imageHeight != 0 || unpack.skipImages != 0)
{
UNIMPLEMENTED();
return gl::Error(GL_INVALID_OPERATION, "unimplemented pixel store state");
}
UNIMPLEMENTED();
return gl::Error(GL_INVALID_OPERATION);
}
......@@ -49,6 +68,12 @@ gl::Error TextureGL::setCompressedImage(GLenum target, size_t level, GLenum inte
gl::Error TextureGL::setCompressedSubImage(GLenum target, size_t level, const gl::Box &area, GLenum format,
const gl::PixelUnpackState &unpack, const uint8_t *pixels)
{
if (unpack.skipRows != 0 || unpack.skipPixels != 0 || unpack.imageHeight != 0 || unpack.skipImages != 0)
{
UNIMPLEMENTED();
return gl::Error(GL_INVALID_OPERATION, "unimplemented pixel store state");
}
UNIMPLEMENTED();
return gl::Error(GL_INVALID_OPERATION);
}
......
......@@ -3172,6 +3172,14 @@ void GL_APIENTRY PixelStorei(GLenum pname, GLint param)
}
}
if (param < 0)
{
context->recordError(Error(GL_INVALID_VALUE, "Cannot use negative values in PixelStorei"));
return;
}
State &state = context->getState();
switch (pname)
{
case GL_UNPACK_ALIGNMENT:
......@@ -3181,7 +3189,7 @@ void GL_APIENTRY PixelStorei(GLenum pname, GLint param)
return;
}
context->getState().setUnpackAlignment(param);
state.setUnpackAlignment(param);
break;
case GL_PACK_ALIGNMENT:
......@@ -3191,22 +3199,38 @@ void GL_APIENTRY PixelStorei(GLenum pname, GLint param)
return;
}
context->getState().setPackAlignment(param);
state.setPackAlignment(param);
break;
case GL_PACK_REVERSE_ROW_ORDER_ANGLE:
context->getState().setPackReverseRowOrder(param != 0);
state.setPackReverseRowOrder(param != 0);
break;
case GL_UNPACK_ROW_LENGTH:
ASSERT(context->getClientVersion() >= 3);
context->getState().setUnpackRowLength(param);
state.setUnpackRowLength(param);
break;
case GL_UNPACK_IMAGE_HEIGHT:
ASSERT(context->getClientVersion() >= 3);
state.getUnpackState().imageHeight = param;
break;
case GL_UNPACK_SKIP_IMAGES:
ASSERT(context->getClientVersion() >= 3);
state.getUnpackState().skipImages = param;
break;
case GL_UNPACK_SKIP_ROWS:
ASSERT(context->getClientVersion() >= 3);
state.getUnpackState().skipRows = param;
break;
case GL_UNPACK_SKIP_PIXELS:
ASSERT(context->getClientVersion() >= 3);
state.getUnpackState().skipPixels = param;
break;
case GL_PACK_ROW_LENGTH:
case GL_PACK_SKIP_ROWS:
case GL_PACK_SKIP_PIXELS:
......
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