diff options
author | 2010-09-01 16:34:48 -0700 | |
---|---|---|
committer | 2010-09-02 10:45:39 -0700 | |
commit | 8e95466b5aa16b13c9e39b7ff8167f47a643c4ba (patch) | |
tree | 50354e0b120c28a99467ce8ce0f82872e8b19fe6 | |
parent | 6d8fe9b40bf7ffba54c21f5b142dd247326cd9a6 (diff) |
Adding ability to dirty the allocation and notify shaders using it.
Change-Id: Id5ac8dbba5185cb1f43bedcf4098fcef9f477c51
-rw-r--r-- | libs/rs/java/Samples/src/com/android/samples/rsrenderstates.rs | 2 | ||||
-rw-r--r-- | libs/rs/rsAllocation.h | 2 | ||||
-rw-r--r-- | libs/rs/rsScriptC_Lib.cpp | 7 | ||||
-rw-r--r-- | libs/rs/scriptc/rs_math.rsh | 4 |
4 files changed, 14 insertions, 1 deletions
diff --git a/libs/rs/java/Samples/src/com/android/samples/rsrenderstates.rs b/libs/rs/java/Samples/src/com/android/samples/rsrenderstates.rs index 91613cf95c13..4bcf7f55d9c3 100644 --- a/libs/rs/java/Samples/src/com/android/samples/rsrenderstates.rs +++ b/libs/rs/java/Samples/src/com/android/samples/rsrenderstates.rs @@ -369,6 +369,7 @@ void setupCustomShaderLights() { gVSConstants->light1_Diffuse = 1.0f; gVSConstants->light1_Specular = 0.7f; gVSConstants->light1_CosinePower = 50.0f; + rsAllocationMarkDirty(rsGetAllocation(gVSConstants)); // Update fragmetn shader constants // Set light 0 colors @@ -377,6 +378,7 @@ void setupCustomShaderLights() { // Set light 1 colors gFSConstants->light1_DiffuseColor = light1DiffCol; gFSConstants->light1_SpecularColor = light1SpecCol; + rsAllocationMarkDirty(rsGetAllocation(gFSConstants)); } void displayCustomShaderSamples() { diff --git a/libs/rs/rsAllocation.h b/libs/rs/rsAllocation.h index 967f22042ead..b6b5d2f8d080 100644 --- a/libs/rs/rsAllocation.h +++ b/libs/rs/rsAllocation.h @@ -89,9 +89,9 @@ public: void incRefs(const void *ptr, size_t ct) const; void decRefs(const void *ptr, size_t ct) const; -protected: void sendDirty() const; +protected: ObjectBaseRef<const Type> mType; void * mPtr; diff --git a/libs/rs/rsScriptC_Lib.cpp b/libs/rs/rsScriptC_Lib.cpp index b4b32bbec1e8..41828dc2afa7 100644 --- a/libs/rs/rsScriptC_Lib.cpp +++ b/libs/rs/rsScriptC_Lib.cpp @@ -356,6 +356,11 @@ int SC_getAllocation(const void *ptr) return (int)alloc; } +void SC_allocationMarkDirty(RsAllocation a) +{ + Allocation *alloc = static_cast<Allocation *>(a); + alloc->sendDirty(); +} void SC_ForEach(RsScript vs, RsAllocation vin, @@ -422,6 +427,8 @@ static ScriptCState::SymbolTable_t gSyms[] = { { "_Z13rsClearObjectP13rs_allocation", (void *)&SC_clearObject }, { "_Z10rsIsObject13rs_allocation", (void *)&SC_isObject }, + { "_Z21rsAllocationMarkDirty13rs_allocation", (void *)&SC_allocationMarkDirty }, + // Debug { "_Z7rsDebugPKcf", (void *)&SC_debugF }, diff --git a/libs/rs/scriptc/rs_math.rsh b/libs/rs/scriptc/rs_math.rsh index c842ef131428..5720b05eae98 100644 --- a/libs/rs/scriptc/rs_math.rsh +++ b/libs/rs/scriptc/rs_math.rsh @@ -107,6 +107,10 @@ extern bool __attribute__((overloadable)) extern rs_allocation __attribute__((overloadable)) rsGetAllocation(const void *); +// Mark the allocation dirty and notify those using it +extern void __attribute__((overloadable)) + rsAllocationMarkDirty(rs_allocation); + // Return the dimensions associated with an allocation. extern uint32_t __attribute__((overloadable)) rsAllocationGetDimX(rs_allocation); |