summaryrefslogtreecommitdiffstats
path: root/libs/rs/rsAllocation.cpp
diff options
context:
space:
mode:
authorJason Sams <rjsams@android.com>2010-03-01 15:42:03 -0800
committerAndroid (Google) Code Review <android-gerrit@google.com>2010-03-01 15:42:03 -0800
commit1549257d12d8c134c0671ae56981e2e40d471d05 (patch)
treea08580ec71bf4b1ff73c8cdf028466e366649115 /libs/rs/rsAllocation.cpp
parent053100e6b6fdb57dbea98f7adff48fd07455c00b (diff)
parentc2908e60c9b021fb4bb69acff8d49981dd4dade8 (diff)
downloadframeworks_base-1549257d12d8c134c0671ae56981e2e40d471d05.zip
frameworks_base-1549257d12d8c134c0671ae56981e2e40d471d05.tar.gz
frameworks_base-1549257d12d8c134c0671ae56981e2e40d471d05.tar.bz2
Merge "Support defered generation of mipmaps. With this change we support mipmap generation when the texture is uploaded to GL without requiring RS to retain the full chain."
Diffstat (limited to 'libs/rs/rsAllocation.cpp')
-rw-r--r--libs/rs/rsAllocation.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/libs/rs/rsAllocation.cpp b/libs/rs/rsAllocation.cpp
index 1ae2317..f1798de 100644
--- a/libs/rs/rsAllocation.cpp
+++ b/libs/rs/rsAllocation.cpp
@@ -17,6 +17,7 @@
#include "rsContext.h"
#include <GLES/gl.h>
+#include <GLES2/gl2.h>
#include <GLES/glext.h>
using namespace android;
@@ -88,12 +89,13 @@ bool Allocation::fixAllocation()
return false;
}
-void Allocation::deferedUploadToTexture(const Context *rsc, uint32_t lodOffset)
+void Allocation::deferedUploadToTexture(const Context *rsc, bool genMipmap, uint32_t lodOffset)
{
rsAssert(lodOffset < mType->getLODCount());
mIsTexture = true;
mTextureLOD = lodOffset;
mUploadDefered = true;
+ mTextureGenMipmap = !mType->getDimLOD() && genMipmap;
}
void Allocation::uploadToTexture(const Context *rsc)
@@ -138,6 +140,10 @@ void Allocation::uploadToTexture(const Context *rsc)
adapt.getDimX(), adapt.getDimY(),
0, format, type, ptr);
}
+ if (mTextureGenMipmap) {
+ glGenerateMipmap(GL_TEXTURE_2D);
+ }
+
}
void Allocation::deferedUploadToBufferObject(const Context *rsc)
@@ -316,10 +322,10 @@ RsAllocation rsi_AllocationCreateSized(Context *rsc, RsElement e, size_t count)
return rsi_AllocationCreateTyped(rsc, type);
}
-void rsi_AllocationUploadToTexture(Context *rsc, RsAllocation va, uint32_t baseMipLevel)
+void rsi_AllocationUploadToTexture(Context *rsc, RsAllocation va, bool genmip, uint32_t baseMipLevel)
{
Allocation *alloc = static_cast<Allocation *>(va);
- alloc->deferedUploadToTexture(rsc, baseMipLevel);
+ alloc->deferedUploadToTexture(rsc, genmip, baseMipLevel);
}
void rsi_AllocationUploadToBufferObject(Context *rsc, RsAllocation va)