diff options
| author | Alex Sakhartchouk <alexst@google.com> | 2012-01-10 14:39:59 -0800 |
|---|---|---|
| committer | Android (Google) Code Review <android-gerrit@google.com> | 2012-01-10 14:39:59 -0800 |
| commit | b64ef770db501ea4665a32bfbf6617e2005fad5c (patch) | |
| tree | ea5961745fe50860b3714d4526a4addb9deda34f | |
| parent | e135b1a0eef5b0586dbad00da4d16ec997000bb9 (diff) | |
| parent | 33680ff630760228c33cc3731eb5718be7bbc04f (diff) | |
| download | frameworks_base-b64ef770db501ea4665a32bfbf6617e2005fad5c.zip frameworks_base-b64ef770db501ea4665a32bfbf6617e2005fad5c.tar.gz frameworks_base-b64ef770db501ea4665a32bfbf6617e2005fad5c.tar.bz2 | |
Merge "Adding ability to bind constants to shaders." into graphics-dev
| -rw-r--r-- | libs/rs/driver/rsdRuntimeStubs.cpp | 12 | ||||
| -rw-r--r-- | libs/rs/rsRuntime.h | 2 | ||||
| -rw-r--r-- | libs/rs/rsScriptC_LibGL.cpp | 12 | ||||
| -rw-r--r-- | libs/rs/scriptc/rs_graphics.rsh | 22 |
4 files changed, 48 insertions, 0 deletions
diff --git a/libs/rs/driver/rsdRuntimeStubs.cpp b/libs/rs/driver/rsdRuntimeStubs.cpp index 506308f..44bfb1c 100644 --- a/libs/rs/driver/rsdRuntimeStubs.cpp +++ b/libs/rs/driver/rsdRuntimeStubs.cpp @@ -90,6 +90,16 @@ static void SC_BindTexture(ProgramFragment *pf, uint32_t slot, Allocation *a) { rsrBindTexture(rsc, sc, pf, slot, a); } +static void SC_BindVertexConstant(ProgramVertex *pv, uint32_t slot, Allocation *a) { + GET_TLS(); + rsrBindConstant(rsc, sc, pv, slot, a); +} + +static void SC_BindFragmentConstant(ProgramFragment *pf, uint32_t slot, Allocation *a) { + GET_TLS(); + rsrBindConstant(rsc, sc, pf, slot, a); +} + static void SC_BindSampler(ProgramFragment *pf, uint32_t slot, Sampler *s) { GET_TLS(); rsrBindSampler(rsc, sc, pf, slot, s); @@ -591,6 +601,8 @@ static RsdSymbolTable gSyms[] = { { "_Z20rsgBindProgramRaster17rs_program_raster", (void *)&SC_BindProgramRaster, false }, { "_Z14rsgBindSampler19rs_program_fragmentj10rs_sampler", (void *)&SC_BindSampler, false }, { "_Z14rsgBindTexture19rs_program_fragmentj13rs_allocation", (void *)&SC_BindTexture, false }, + { "_Z15rsgBindConstant19rs_program_fragmentj13rs_allocation", (void *)&SC_BindFragmentConstant, false }, + { "_Z15rsgBindConstant17rs_program_vertexj13rs_allocation", (void *)&SC_BindVertexConstant, false }, { "_Z36rsgProgramVertexLoadProjectionMatrixPK12rs_matrix4x4", (void *)&SC_VpLoadProjectionMatrix, false }, { "_Z31rsgProgramVertexLoadModelMatrixPK12rs_matrix4x4", (void *)&SC_VpLoadModelMatrix, false }, diff --git a/libs/rs/rsRuntime.h b/libs/rs/rsRuntime.h index b0869f6..3bded62 100644 --- a/libs/rs/rsRuntime.h +++ b/libs/rs/rsRuntime.h @@ -30,6 +30,8 @@ namespace renderscript { ////////////////////////////////////////////////////////////////////////////// void rsrBindTexture(Context *, Script *, ProgramFragment *, uint32_t slot, Allocation *); +void rsrBindConstant(Context *, Script *, ProgramFragment *, uint32_t slot, Allocation *); +void rsrBindConstant(Context *, Script *, ProgramVertex*, uint32_t slot, Allocation *); void rsrBindSampler(Context *, Script *, ProgramFragment *, uint32_t slot, Sampler *); void rsrBindProgramStore(Context *, Script *, ProgramStore *); void rsrBindProgramFragment(Context *, Script *, ProgramFragment *); diff --git a/libs/rs/rsScriptC_LibGL.cpp b/libs/rs/rsScriptC_LibGL.cpp index 742da96..dece363 100644 --- a/libs/rs/rsScriptC_LibGL.cpp +++ b/libs/rs/rsScriptC_LibGL.cpp @@ -50,6 +50,18 @@ void rsrBindTexture(Context *rsc, Script *sc, ProgramFragment *pf, uint32_t slot pf->bindTexture(rsc, slot, a); } +void rsrBindConstant(Context *rsc, Script *sc, ProgramFragment *pf, uint32_t slot, Allocation *a) { + CHECK_OBJ_OR_NULL(a); + CHECK_OBJ(pf); + pf->bindAllocation(rsc, a, slot); +} + +void rsrBindConstant(Context *rsc, Script *sc, ProgramVertex *pf, uint32_t slot, Allocation *a) { + CHECK_OBJ_OR_NULL(a); + CHECK_OBJ(pf); + pf->bindAllocation(rsc, a, slot); +} + void rsrBindSampler(Context *rsc, Script *sc, ProgramFragment *pf, uint32_t slot, Sampler *s) { CHECK_OBJ_OR_NULL(vs); CHECK_OBJ(vpf); diff --git a/libs/rs/scriptc/rs_graphics.rsh b/libs/rs/scriptc/rs_graphics.rsh index 64fcd23..7fdebdc 100644 --- a/libs/rs/scriptc/rs_graphics.rsh +++ b/libs/rs/scriptc/rs_graphics.rsh @@ -369,6 +369,28 @@ extern void __attribute__((overloadable)) rsgProgramFragmentConstantColor(rs_program_fragment pf, float r, float g, float b, float a); /** + * Bind a new Allocation object to a ProgramFragment. The + * Allocation must be a valid constant input for the Program. + * + * @param ps program object + * @param slot index of the constant buffer on the program + * @param c constants to bind + */ +extern void __attribute__((overloadable)) + rsgBindConstant(rs_program_fragment ps, uint slot, rs_allocation c); + +/** + * Bind a new Allocation object to a ProgramVertex. The + * Allocation must be a valid constant input for the Program. + * + * @param pv program object + * @param slot index of the constant buffer on the program + * @param c constants to bind + */ +extern void __attribute__((overloadable)) + rsgBindConstant(rs_program_vertex pv, uint slot, rs_allocation c); + +/** * Get the width of the current rendering surface. * * @return uint |
