Commit f3898617 by Nicolas Capens

Pass the gralloc buffer stride to sw::Surface.

Bug 19979104 Change-Id: If9dd668b4b6a1d82b38d1840648cb578e80495bf Reviewed-on: https://swiftshader-review.googlesource.com/4302Reviewed-by: 's avatarNicolas Capens <capn@google.com> Tested-by: 's avatarNicolas Capens <capn@google.com>
parent 6ee16a14
...@@ -54,8 +54,8 @@ public: ...@@ -54,8 +54,8 @@ public:
referenceCount = 1; referenceCount = 1;
} }
Image(Texture *parentTexture, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type) Image(Texture *parentTexture, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, int pitchP = 0)
: sw::Surface(getParentResource(parentTexture), width, height, depth, SelectInternalFormat(format, type), true, true), : sw::Surface(getParentResource(parentTexture), width, height, depth, SelectInternalFormat(format, type), true, true, pitchP),
width(width), height(height), format(format), type(type), internalFormat(SelectInternalFormat(format, type)), depth(depth), width(width), height(height), format(format), type(type), internalFormat(SelectInternalFormat(format, type)), depth(depth),
parentTexture(parentTexture) parentTexture(parentTexture)
{ {
...@@ -182,12 +182,13 @@ public: ...@@ -182,12 +182,13 @@ public:
explicit AndroidNativeImage(ANativeWindowBuffer *nativeBuffer) explicit AndroidNativeImage(ANativeWindowBuffer *nativeBuffer)
: egl::Image(0, nativeBuffer->width, nativeBuffer->height, 1, : egl::Image(0, nativeBuffer->width, nativeBuffer->height, 1,
GLPixelFormatFromAndroid(nativeBuffer->format), GLPixelFormatFromAndroid(nativeBuffer->format),
GLPixelTypeFromAndroid(nativeBuffer->format)), GLPixelTypeFromAndroid(nativeBuffer->format),
nativeBuffer->stride),
nativeBuffer(nativeBuffer) nativeBuffer(nativeBuffer)
{ {
nativeBuffer->common.incRef(&nativeBuffer->common); nativeBuffer->common.incRef(&nativeBuffer->common);
markShared(); markShared();
} }
private: private:
ANativeWindowBuffer *nativeBuffer; ANativeWindowBuffer *nativeBuffer;
......
...@@ -1205,7 +1205,7 @@ namespace sw ...@@ -1205,7 +1205,7 @@ namespace sw
paletteUsed = 0; paletteUsed = 0;
} }
Surface::Surface(Resource *texture, int width, int height, int depth, Format format, bool lockable, bool renderTarget) : lockable(lockable), renderTarget(renderTarget) Surface::Surface(Resource *texture, int width, int height, int depth, Format format, bool lockable, bool renderTarget, int pitchPprovided) : lockable(lockable), renderTarget(renderTarget)
{ {
resource = texture ? texture : new Resource(0); resource = texture ? texture : new Resource(0);
hasParent = texture != 0; hasParent = texture != 0;
...@@ -1231,8 +1231,8 @@ namespace sw ...@@ -1231,8 +1231,8 @@ namespace sw
internal.depth = depth; internal.depth = depth;
internal.format = selectInternalFormat(format); internal.format = selectInternalFormat(format);
internal.bytes = bytes(internal.format); internal.bytes = bytes(internal.format);
internal.pitchB = pitchB(internal.width, internal.format, renderTarget); internal.pitchB = !pitchPprovided ? pitchB(internal.width, internal.format, renderTarget) : pitchPprovided * internal.bytes;
internal.pitchP = pitchP(internal.width, internal.format, renderTarget); internal.pitchP = !pitchPprovided ? pitchP(internal.width, internal.format, renderTarget) : pitchPprovided;
internal.sliceB = sliceB(internal.width, internal.height, internal.format, renderTarget); internal.sliceB = sliceB(internal.width, internal.height, internal.format, renderTarget);
internal.sliceP = sliceP(internal.width, internal.height, internal.format, renderTarget); internal.sliceP = sliceP(internal.width, internal.height, internal.format, renderTarget);
internal.lock = LOCK_UNLOCKED; internal.lock = LOCK_UNLOCKED;
......
...@@ -237,14 +237,14 @@ namespace sw ...@@ -237,14 +237,14 @@ namespace sw
int sliceP; int sliceP;
Format format; Format format;
Lock lock; Lock lock;
bool dirty; bool dirty;
}; };
public: public:
Surface(int width, int height, int depth, Format format, void *pixels, int pitch, int slice); Surface(int width, int height, int depth, Format format, void *pixels, int pitch, int slice);
Surface(Resource *texture, int width, int height, int depth, Format format, bool lockable, bool renderTarget); Surface(Resource *texture, int width, int height, int depth, Format format, bool lockable, bool renderTarget, int pitchP = 0);
virtual ~Surface(); virtual ~Surface();
inline void *lock(int x, int y, int z, Lock lock, Accessor client, bool internal = false); inline void *lock(int x, int y, int z, Lock lock, Accessor client, bool internal = false);
......
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