diff options
author | Alex Sakhartchouk <alexst@google.com> | 2012-02-24 14:22:34 -0800 |
---|---|---|
committer | Alex Sakhartchouk <alexst@google.com> | 2012-02-24 14:22:34 -0800 |
commit | 20c9c92ec6fc72d913f660874d3d0c00e0d14a79 (patch) | |
tree | df811cefad13a5fb93a57a3e906980e327321744 /libs | |
parent | 1eb4c26a96cb00edb6e5d53e35da152b421805c0 (diff) | |
download | frameworks_base-20c9c92ec6fc72d913f660874d3d0c00e0d14a79.zip frameworks_base-20c9c92ec6fc72d913f660874d3d0c00e0d14a79.tar.gz frameworks_base-20c9c92ec6fc72d913f660874d3d0c00e0d14a79.tar.bz2 |
Removing GL calls from librs
Change-Id: Ida22199a33f0f9fd534dcc5951d12937967a187b
Diffstat (limited to 'libs')
-rw-r--r-- | libs/rs/driver/rsdGL.cpp | 34 | ||||
-rw-r--r-- | libs/rs/driver/rsdGL.h | 9 | ||||
-rw-r--r-- | libs/rs/driver/rsdRuntimeStubs.cpp | 8 | ||||
-rw-r--r-- | libs/rs/rsRuntime.h | 4 | ||||
-rw-r--r-- | libs/rs/rsScriptC_LibGL.cpp | 18 |
5 files changed, 50 insertions, 23 deletions
diff --git a/libs/rs/driver/rsdGL.cpp b/libs/rs/driver/rsdGL.cpp index b136cc7..a1d1d53 100644 --- a/libs/rs/driver/rsdGL.cpp +++ b/libs/rs/driver/rsdGL.cpp @@ -455,3 +455,37 @@ void rsdGLCheckError(const android::renderscript::Context *rsc, } } + +void rsdGLClearColor(const android::renderscript::Context *rsc, + float r, float g, float b, float a) { + RSD_CALL_GL(glClearColor, r, g, b, a); + RSD_CALL_GL(glClear, GL_COLOR_BUFFER_BIT); +} + +void rsdGLClearDepth(const android::renderscript::Context *rsc, float v) { + RSD_CALL_GL(glClearDepthf, v); + RSD_CALL_GL(glClear, GL_DEPTH_BUFFER_BIT); +} + +void rsdGLFinish(const android::renderscript::Context *rsc) { + RSD_CALL_GL(glFinish); +} + +void rsdGLDrawQuadTexCoords(const android::renderscript::Context *rsc, + float x1, float y1, float z1, float u1, float v1, + float x2, float y2, float z2, float u2, float v2, + float x3, float y3, float z3, float u3, float v3, + float x4, float y4, float z4, float u4, float v4) { + + float vtx[] = {x1,y1,z1, x2,y2,z2, x3,y3,z3, x4,y4,z4}; + const float tex[] = {u1,v1, u2,v2, u3,v3, u4,v4}; + + RsdVertexArray::Attrib attribs[2]; + attribs[0].set(GL_FLOAT, 3, 12, false, (uint32_t)vtx, "ATTRIB_position"); + attribs[1].set(GL_FLOAT, 2, 8, false, (uint32_t)tex, "ATTRIB_texture0"); + + RsdVertexArray va(attribs, 2); + va.setup(rsc); + + RSD_CALL_GL(glDrawArrays, GL_TRIANGLE_FAN, 0, 4); +} diff --git a/libs/rs/driver/rsdGL.h b/libs/rs/driver/rsdGL.h index e015cb1..1e5b40f 100644 --- a/libs/rs/driver/rsdGL.h +++ b/libs/rs/driver/rsdGL.h @@ -84,6 +84,15 @@ void rsdGLCheckError(const android::renderscript::Context *rsc, const char *msg, bool isFatal = false); void rsdGLSetPriority(const android::renderscript::Context *rsc, int32_t priority); +void rsdGLClearColor(const android::renderscript::Context *rsc, + float r, float g, float b, float a); +void rsdGLClearDepth(const android::renderscript::Context *rsc, float v); +void rsdGLFinish(const android::renderscript::Context *rsc); +void rsdGLDrawQuadTexCoords(const android::renderscript::Context *rsc, + float x1, float y1, float z1, float u1, float v1, + float x2, float y2, float z2, float u2, float v2, + float x3, float y3, float z3, float u3, float v3, + float x4, float y4, float z4, float u4, float v4); #endif diff --git a/libs/rs/driver/rsdRuntimeStubs.cpp b/libs/rs/driver/rsdRuntimeStubs.cpp index 44bfb1c..aa9f159 100644 --- a/libs/rs/driver/rsdRuntimeStubs.cpp +++ b/libs/rs/driver/rsdRuntimeStubs.cpp @@ -257,17 +257,19 @@ static void SC_Color(float r, float g, float b, float a) { static void SC_Finish() { GET_TLS(); - rsrFinish(rsc, sc); + rsdGLFinish(rsc); } static void SC_ClearColor(float r, float g, float b, float a) { GET_TLS(); - rsrClearColor(rsc, sc, r, g, b, a); + rsrPrepareClear(rsc, sc); + rsdGLClearColor(rsc, r, g, b, a); } static void SC_ClearDepth(float v) { GET_TLS(); - rsrClearDepth(rsc, sc, v); + rsrPrepareClear(rsc, sc); + rsdGLClearDepth(rsc, v); } static uint32_t SC_GetWidth() { diff --git a/libs/rs/rsRuntime.h b/libs/rs/rsRuntime.h index 3bded62..64f2de8 100644 --- a/libs/rs/rsRuntime.h +++ b/libs/rs/rsRuntime.h @@ -86,7 +86,6 @@ void rsrMeshComputeBoundingBox(Context *, Script *, Mesh *, void rsrColor(Context *, Script *, float r, float g, float b, float a); -void rsrFinish(Context *, Script *); void rsrAllocationSyncAll(Context *, Script *, Allocation *); void rsrAllocationCopy1DRange(Context *, Allocation *dstAlloc, @@ -103,8 +102,7 @@ void rsrAllocationCopy2DRange(Context *, Allocation *dstAlloc, uint32_t srcXoff, uint32_t srcYoff, uint32_t srcMip, uint32_t srcFace); -void rsrClearColor(Context *, Script *, float r, float g, float b, float a); -void rsrClearDepth(Context *, Script *, float v); +void rsrPrepareClear(Context *, Script *); uint32_t rsrGetWidth(Context *, Script *); uint32_t rsrGetHeight(Context *, Script *); void rsrDrawTextAlloc(Context *, Script *, Allocation *, int x, int y); diff --git a/libs/rs/rsScriptC_LibGL.cpp b/libs/rs/rsScriptC_LibGL.cpp index 97469d3..bda18fd 100644 --- a/libs/rs/rsScriptC_LibGL.cpp +++ b/libs/rs/rsScriptC_LibGL.cpp @@ -269,25 +269,9 @@ void rsrColor(Context *rsc, Script *sc, float r, float g, float b, float a) { pf->setConstantColor(rsc, r, g, b, a); } -void rsrFinish(Context *rsc, Script *sc) { - RSD_CALL_GL(glFinish); -} - - -void rsrClearColor(Context *rsc, Script *sc, float r, float g, float b, float a) { +void rsrPrepareClear(Context *rsc, Script *sc) { rsc->mFBOCache.setup(rsc); rsc->setupProgramStore(); - - RSD_CALL_GL(glClearColor, r, g, b, a); - RSD_CALL_GL(glClear, GL_COLOR_BUFFER_BIT); -} - -void rsrClearDepth(Context *rsc, Script *sc, float v) { - rsc->mFBOCache.setup(rsc); - rsc->setupProgramStore(); - - RSD_CALL_GL(glClearDepthf, v); - RSD_CALL_GL(glClear, GL_DEPTH_BUFFER_BIT); } uint32_t rsrGetWidth(Context *rsc, Script *sc) { |