From fb9f82ca4f11cf7e43a001f3e6fd1b381cc86210 Mon Sep 17 00:00:00 2001 From: Jason Sams Date: Wed, 12 Jan 2011 14:53:25 -0800 Subject: Implement more of copy2DRange* Change-Id: Id6be481c4abc968df27e5bba1ed044262ec0f293 --- libs/rs/rsAllocation.cpp | 18 +++++++++++++++--- libs/rs/rsAllocation.h | 2 ++ 2 files changed, 17 insertions(+), 3 deletions(-) (limited to 'libs') diff --git a/libs/rs/rsAllocation.cpp b/libs/rs/rsAllocation.cpp index cf394c0..2ed7774 100644 --- a/libs/rs/rsAllocation.cpp +++ b/libs/rs/rsAllocation.cpp @@ -202,6 +202,17 @@ void Allocation::uploadToTexture(const Context *rsc) { rsc->checkError("Allocation::uploadToTexture"); } +void Allocation::update2DTexture(const void *ptr, uint32_t xoff, uint32_t yoff, + uint32_t lod, RsAllocationCubemapFace face, + uint32_t w, uint32_t h) { + GLenum type = mType->getElement()->getComponent().getGLType(); + GLenum format = mType->getElement()->getComponent().getGLFormat(); + GLenum target = (GLenum)getGLTarget(); + glBindTexture(target, mTextureID); + glPixelStorei(GL_UNPACK_ALIGNMENT, 1); + glTexSubImage2D(GL_TEXTURE_2D, lod, xoff, yoff, w, h, format, type, ptr); +} + void Allocation::upload2DTexture(bool isFirstUpload, const void *ptr) { GLenum type = mType->getElement()->getComponent().getGLType(); GLenum format = mType->getElement()->getComponent().getGLFormat(); @@ -368,12 +379,13 @@ void Allocation::data(Context *rsc, uint32_t xoff, uint32_t yoff, uint32_t lod, sendDirty(); mUploadDefered = true; } else { - upload2DTexture(false, data); + update2DTexture(data, xoff, yoff, lod, face, w, h); } } -void Allocation::data(Context *rsc, uint32_t xoff, uint32_t yoff, uint32_t zoff, uint32_t lod, RsAllocationCubemapFace face, - uint32_t w, uint32_t h, uint32_t d, const void *data, uint32_t sizeBytes) { +void Allocation::data(Context *rsc, uint32_t xoff, uint32_t yoff, uint32_t zoff, + uint32_t lod, RsAllocationCubemapFace face, + uint32_t w, uint32_t h, uint32_t d, const void *data, uint32_t sizeBytes) { } void Allocation::elementData(Context *rsc, uint32_t x, const void *data, diff --git a/libs/rs/rsAllocation.h b/libs/rs/rsAllocation.h index a8d086e..a160765 100644 --- a/libs/rs/rsAllocation.h +++ b/libs/rs/rsAllocation.h @@ -106,6 +106,8 @@ public: } void upload2DTexture(bool isFirstUpload, const void *ptr); + void update2DTexture(const void *ptr, uint32_t xoff, uint32_t yoff, + uint32_t lod, RsAllocationCubemapFace face, uint32_t w, uint32_t h); protected: ObjectBaseRef mType; -- cgit v1.1