Commit 1fa20678 by Alexis Hetu Committed by Alexis Hétu

Fixed size verification assert to include border

Whenever a cube map was being used, these asserts would fire as soon as any border computation would happen. Fixed the asserts to allow cube maps to work properly. Change-Id: Iedc2661e63db37e5b4e77e08f97ce044e9f88837 Reviewed-on: https://swiftshader-review.googlesource.com/19468Reviewed-by: 's avatarNicolas Capens <nicolascapens@google.com> Tested-by: 's avatarAlexis Hétu <sugoi@google.com>
parent 700a1a67
...@@ -44,7 +44,9 @@ namespace sw ...@@ -44,7 +44,9 @@ namespace sw
void Surface::Buffer::write(int x, int y, int z, const Color<float> &color) void Surface::Buffer::write(int x, int y, int z, const Color<float> &color)
{ {
ASSERT(x < width && y < height && z < depth); ASSERT((x >= -border) && (x < (width + border)));
ASSERT((y >= -border) && (y < (height + border)));
ASSERT((z >= 0) && (z < depth));
byte *element = (byte*)buffer + (x + border) * bytes + (y + border) * pitchB + z * samples * sliceB; byte *element = (byte*)buffer + (x + border) * bytes + (y + border) * pitchB + z * samples * sliceB;
...@@ -57,7 +59,8 @@ namespace sw ...@@ -57,7 +59,8 @@ namespace sw
void Surface::Buffer::write(int x, int y, const Color<float> &color) void Surface::Buffer::write(int x, int y, const Color<float> &color)
{ {
ASSERT(x < width && y < height); ASSERT((x >= -border) && (x < (width + border)));
ASSERT((y >= -border) && (y < (height + border)));
byte *element = (byte*)buffer + (x + border) * bytes + (y + border) * pitchB; byte *element = (byte*)buffer + (x + border) * bytes + (y + border) * pitchB;
...@@ -400,7 +403,9 @@ namespace sw ...@@ -400,7 +403,9 @@ namespace sw
Color<float> Surface::Buffer::read(int x, int y, int z) const Color<float> Surface::Buffer::read(int x, int y, int z) const
{ {
ASSERT(x < width && y < height && z < depth); ASSERT((x >= -border) && (x < (width + border)));
ASSERT((y >= -border) && (y < (height + border)));
ASSERT((z >= 0) && (z < depth));
void *element = (unsigned char*)buffer + (x + border) * bytes + (y + border) * pitchB + z * samples * sliceB; void *element = (unsigned char*)buffer + (x + border) * bytes + (y + border) * pitchB + z * samples * sliceB;
...@@ -409,7 +414,8 @@ namespace sw ...@@ -409,7 +414,8 @@ namespace sw
Color<float> Surface::Buffer::read(int x, int y) const Color<float> Surface::Buffer::read(int x, int y) const
{ {
ASSERT(x < width && y < height); ASSERT((x >= -border) && (x < (width + border)));
ASSERT((y >= -border) && (y < (height + border)));
void *element = (unsigned char*)buffer + (x + border) * bytes + (y + border) * pitchB; void *element = (unsigned char*)buffer + (x + border) * bytes + (y + border) * pitchB;
......
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