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 ...@@ -1107,6 +1107,11 @@ const PixelUnpackState &State::getUnpackState() const
return mUnpack; return mUnpack;
} }
PixelUnpackState &State::getUnpackState()
{
return mUnpack;
}
void State::getBooleanv(GLenum pname, GLboolean *params) void State::getBooleanv(GLenum pname, GLboolean *params)
{ {
switch (pname) switch (pname)
......
...@@ -244,6 +244,7 @@ class State ...@@ -244,6 +244,7 @@ class State
void setUnpackRowLength(GLint rowLength); void setUnpackRowLength(GLint rowLength);
GLint getUnpackRowLength() const; GLint getUnpackRowLength() const;
const PixelUnpackState &getUnpackState() const; const PixelUnpackState &getUnpackState() const;
PixelUnpackState &getUnpackState();
// State query functions // State query functions
void getBooleanv(GLenum pname, GLboolean *params); void getBooleanv(GLenum pname, GLboolean *params);
......
...@@ -188,15 +188,27 @@ struct PixelUnpackState ...@@ -188,15 +188,27 @@ struct PixelUnpackState
BindingPointer<Buffer> pixelBuffer; BindingPointer<Buffer> pixelBuffer;
GLint alignment; GLint alignment;
GLint rowLength; GLint rowLength;
GLint skipRows;
GLint skipPixels;
GLint imageHeight;
GLint skipImages;
PixelUnpackState() PixelUnpackState()
: alignment(4), : alignment(4),
rowLength(0) rowLength(0),
skipRows(0),
skipPixels(0),
imageHeight(0),
skipImages(0)
{} {}
PixelUnpackState(GLint alignmentIn, GLint rowLengthIn) PixelUnpackState(GLint alignmentIn, GLint rowLengthIn)
: alignment(alignmentIn), : 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, ...@@ -160,6 +160,12 @@ gl::Error TextureD3D::setImage(const gl::ImageIndex &index, GLenum type,
const gl::PixelUnpackState &unpack, const uint8_t *pixels, const gl::PixelUnpackState &unpack, const uint8_t *pixels,
ptrdiff_t layerOffset) 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); ImageD3D *image = getImage(index);
ASSERT(image); ASSERT(image);
...@@ -243,6 +249,12 @@ gl::Error TextureD3D::subImage(const gl::ImageIndex &index, const gl::Box &area, ...@@ -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, gl::Error TextureD3D::setCompressedImage(const gl::ImageIndex &index, const gl::PixelUnpackState &unpack,
const uint8_t *pixels, ptrdiff_t layerOffset) 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. // 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. // 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; const uint8_t *pixelData = NULL;
...@@ -274,6 +286,12 @@ gl::Error TextureD3D::subImageCompressed(const gl::ImageIndex &index, const gl:: ...@@ -274,6 +286,12 @@ gl::Error TextureD3D::subImageCompressed(const gl::ImageIndex &index, const gl::
const gl::PixelUnpackState &unpack, const uint8_t *pixels, const gl::PixelUnpackState &unpack, const uint8_t *pixels,
ptrdiff_t layerOffset) 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; const uint8_t *pixelData = NULL;
gl::Error error = GetUnpackPointer(unpack, pixels, layerOffset, &pixelData); gl::Error error = GetUnpackPointer(unpack, pixels, layerOffset, &pixelData);
if (error.isError()) if (error.isError())
...@@ -684,6 +702,12 @@ gl::Error TextureD3D_2D::setSubImage(GLenum target, size_t level, const gl::Box ...@@ -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); 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); gl::ImageIndex index = gl::ImageIndex::Make2D(level);
if (isFastUnpackable(unpack, getInternalFormat(level)) && isLevelComplete(level)) if (isFastUnpackable(unpack, getInternalFormat(level)) && isLevelComplete(level))
{ {
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
#include "libANGLE/renderer/gl/TextureGL.h" #include "libANGLE/renderer/gl/TextureGL.h"
#include "common/debug.h" #include "common/debug.h"
#include "libANGLE/State.h"
namespace rx namespace rx
{ {
...@@ -28,6 +29,12 @@ void TextureGL::setUsage(GLenum usage) ...@@ -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, 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) 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(); UNIMPLEMENTED();
return gl::Error(GL_INVALID_OPERATION); return gl::Error(GL_INVALID_OPERATION);
} }
...@@ -35,6 +42,12 @@ gl::Error TextureGL::setImage(GLenum target, size_t level, GLenum internalFormat ...@@ -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, 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) 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(); UNIMPLEMENTED();
return gl::Error(GL_INVALID_OPERATION); return gl::Error(GL_INVALID_OPERATION);
} }
...@@ -42,6 +55,12 @@ gl::Error TextureGL::setSubImage(GLenum target, size_t level, const gl::Box &are ...@@ -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, gl::Error TextureGL::setCompressedImage(GLenum target, size_t level, GLenum internalFormat, const gl::Extents &size,
const gl::PixelUnpackState &unpack, const uint8_t *pixels) 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(); UNIMPLEMENTED();
return gl::Error(GL_INVALID_OPERATION); return gl::Error(GL_INVALID_OPERATION);
} }
...@@ -49,6 +68,12 @@ gl::Error TextureGL::setCompressedImage(GLenum target, size_t level, GLenum inte ...@@ -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, gl::Error TextureGL::setCompressedSubImage(GLenum target, size_t level, const gl::Box &area, GLenum format,
const gl::PixelUnpackState &unpack, const uint8_t *pixels) 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(); UNIMPLEMENTED();
return gl::Error(GL_INVALID_OPERATION); return gl::Error(GL_INVALID_OPERATION);
} }
......
...@@ -3172,6 +3172,14 @@ void GL_APIENTRY PixelStorei(GLenum pname, GLint param) ...@@ -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) switch (pname)
{ {
case GL_UNPACK_ALIGNMENT: case GL_UNPACK_ALIGNMENT:
...@@ -3181,7 +3189,7 @@ void GL_APIENTRY PixelStorei(GLenum pname, GLint param) ...@@ -3181,7 +3189,7 @@ void GL_APIENTRY PixelStorei(GLenum pname, GLint param)
return; return;
} }
context->getState().setUnpackAlignment(param); state.setUnpackAlignment(param);
break; break;
case GL_PACK_ALIGNMENT: case GL_PACK_ALIGNMENT:
...@@ -3191,22 +3199,38 @@ void GL_APIENTRY PixelStorei(GLenum pname, GLint param) ...@@ -3191,22 +3199,38 @@ void GL_APIENTRY PixelStorei(GLenum pname, GLint param)
return; return;
} }
context->getState().setPackAlignment(param); state.setPackAlignment(param);
break; break;
case GL_PACK_REVERSE_ROW_ORDER_ANGLE: case GL_PACK_REVERSE_ROW_ORDER_ANGLE:
context->getState().setPackReverseRowOrder(param != 0); state.setPackReverseRowOrder(param != 0);
break; break;
case GL_UNPACK_ROW_LENGTH: case GL_UNPACK_ROW_LENGTH:
ASSERT(context->getClientVersion() >= 3); ASSERT(context->getClientVersion() >= 3);
context->getState().setUnpackRowLength(param); state.setUnpackRowLength(param);
break; break;
case GL_UNPACK_IMAGE_HEIGHT: case GL_UNPACK_IMAGE_HEIGHT:
ASSERT(context->getClientVersion() >= 3);
state.getUnpackState().imageHeight = param;
break;
case GL_UNPACK_SKIP_IMAGES: case GL_UNPACK_SKIP_IMAGES:
ASSERT(context->getClientVersion() >= 3);
state.getUnpackState().skipImages = param;
break;
case GL_UNPACK_SKIP_ROWS: case GL_UNPACK_SKIP_ROWS:
ASSERT(context->getClientVersion() >= 3);
state.getUnpackState().skipRows = param;
break;
case GL_UNPACK_SKIP_PIXELS: case GL_UNPACK_SKIP_PIXELS:
ASSERT(context->getClientVersion() >= 3);
state.getUnpackState().skipPixels = param;
break;
case GL_PACK_ROW_LENGTH: case GL_PACK_ROW_LENGTH:
case GL_PACK_SKIP_ROWS: case GL_PACK_SKIP_ROWS:
case GL_PACK_SKIP_PIXELS: 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