Loading libs/rs/rsProgramVertex.cpp +6 −1 Original line number Diff line number Diff line Loading @@ -160,6 +160,11 @@ void ProgramVertex::createShader() const Element *e = mInputElements[ct].get(); for (uint32_t field=0; field < e->getFieldCount(); field++) { const Element *f = e->getField(field); const char *fn = e->getFieldName(field); if (fn[0] == '#') { continue; } // Cannot be complex rsAssert(!f->getFieldCount()); Loading @@ -172,7 +177,7 @@ void ProgramVertex::createShader() rsAssert(0); } mShader.append(e->getFieldName(field)); mShader.append(fn); mShader.append(";\n"); } } Loading libs/rs/rsScriptC_LibGL.cpp +6 −143 Original line number Diff line number Diff line Loading @@ -121,38 +121,6 @@ static void SC_vpLoadTextureMatrix(const rsc_Matrix *m) // Drawing ////////////////////////////////////////////////////////////////////////////// static void SC_drawLine(float x1, float y1, float z1, float x2, float y2, float z2) { GET_TLS(); if (!rsc->setupCheck()) { return; } float vtx[] = { x1, y1, z1, x2, y2, z2 }; VertexArray va; va.add(GL_FLOAT, 3, 12, false, (uint32_t)vtx, "position"); va.setupGL2(rsc, &rsc->mStateVertexArray, &rsc->mShaderCache); glDrawArrays(GL_LINES, 0, 2); } static void SC_drawPoint(float x, float y, float z) { GET_TLS(); if (!rsc->setupCheck()) { return; } float vtx[] = { x, y, z }; VertexArray va; va.add(GL_FLOAT, 3, 12, false, (uint32_t)vtx, "position"); va.setupGL2(rsc, &rsc->mStateVertexArray, &rsc->mShaderCache); glDrawArrays(GL_POINTS, 0, 1); } static void SC_drawQuadTexCoords(float x1, float y1, float z1, float u1, float v1, float x2, float y2, float z2, Loading Loading @@ -212,20 +180,7 @@ static void SC_drawSpriteScreenspace(float x, float y, float z, float w, float h x, sh - (y+h), z); rsc->setVertex((ProgramVertex *)tmp.get()); } static void SC_drawSpriteScreenspaceCropped(float x, float y, float z, float w, float h, float cx0, float cy0, float cx1, float cy1) { GET_TLS(); if (!rsc->setupCheck()) { return; } GLint crop[4] = {cx0, cy0, cx1, cy1}; glTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_CROP_RECT_OES, crop); glDrawTexfOES(x, y, z, w, h); } /* static void SC_drawSprite(float x, float y, float z, float w, float h) { GET_TLS(); Loading Loading @@ -253,7 +208,7 @@ static void SC_drawSprite(float x, float y, float z, float w, float h) SC_drawSpriteScreenspace(vout[0], vout[1], z, h, w); //rsc->setupCheck(); } */ static void SC_drawRect(float x1, float y1, float x2, float y2, float z) Loading Loading @@ -303,91 +258,6 @@ static void SC_color(float r, float g, float b, float a) } } static void SC_pointAttenuation(float a, float b, float c) { GLfloat params[] = { a, b, c }; glPointParameterfv(GL_POINT_DISTANCE_ATTENUATION, params); } static void SC_hsbToRgb(float h, float s, float b, float* rgb) { float red = 0.0f; float green = 0.0f; float blue = 0.0f; float x = h; float y = s; float z = b; float hf = (x - (int) x) * 6.0f; int ihf = (int) hf; float f = hf - ihf; float pv = z * (1.0f - y); float qv = z * (1.0f - y * f); float tv = z * (1.0f - y * (1.0f - f)); switch (ihf) { case 0: // Red is the dominant color red = z; green = tv; blue = pv; break; case 1: // Green is the dominant color red = qv; green = z; blue = pv; break; case 2: red = pv; green = z; blue = tv; break; case 3: // Blue is the dominant color red = pv; green = qv; blue = z; break; case 4: red = tv; green = pv; blue = z; break; case 5: // Red is the dominant color red = z; green = pv; blue = qv; break; } rgb[0] = red; rgb[1] = green; rgb[2] = blue; } static int SC_hsbToAbgr(float h, float s, float b, float a) { //LOGE("hsb a %f, %f, %f %f", h, s, b, a); float rgb[3]; SC_hsbToRgb(h, s, b, rgb); //LOGE("rgb %f, %f, %f ", rgb[0], rgb[1], rgb[2]); return int(a * 255.0f) << 24 | int(rgb[2] * 255.0f) << 16 | int(rgb[1] * 255.0f) << 8 | int(rgb[0] * 255.0f); } static void SC_hsb(float h, float s, float b, float a) { GET_TLS(); float rgb[3]; SC_hsbToRgb(h, s, b, rgb); if (rsc->checkVersion2_0()) { glVertexAttrib4f(1, rgb[0], rgb[1], rgb[2], a); } else { glColor4f(rgb[0], rgb[1], rgb[2], a); } } static void SC_uploadToTexture2(RsAllocation va, uint32_t baseMipLevel) { GET_TLS(); Loading Loading @@ -486,9 +356,6 @@ static ScriptCState::SymbolTable_t gSyms[] = { { "rsgDrawQuadTexCoords", (void *)&SC_drawQuadTexCoords }, //{ "drawSprite", (void *)&SC_drawSprite }, { "rsgDrawSpriteScreenspace", (void *)&SC_drawSpriteScreenspace }, { "rsgDrawSpriteScreenspaceCropped", (void *)&SC_drawSpriteScreenspaceCropped }, { "rsgDrawLine", (void *)&SC_drawLine }, { "rsgDrawPoint", (void *)&SC_drawPoint }, { "_Z17rsgDrawSimpleMesh7rs_mesh", (void *)&SC_drawSimpleMesh }, { "_Z17rsgDrawSimpleMesh7rs_meshii", (void *)&SC_drawSimpleMeshRange }, { "_Z17rsgDrawSimpleMeshi", (void *)&SC_drawSimpleMesh }, Loading @@ -505,10 +372,6 @@ static ScriptCState::SymbolTable_t gSyms[] = { // misc //{ "pfClearColor", (void *)&SC_ClearColor }, { "color", (void *)&SC_color }, { "hsb", (void *)&SC_hsb }, { "hsbToRgb", (void *)&SC_hsbToRgb }, { "hsbToAbgr", (void *)&SC_hsbToAbgr }, { "pointAttenuation", (void *)&SC_pointAttenuation }, { NULL, NULL } }; Loading libs/rs/rsVertexArray.cpp +5 −0 Original line number Diff line number Diff line Loading @@ -123,6 +123,11 @@ void VertexArray::setupGL2(const Context *rsc, class VertexArrayState *state, Sh rsc->checkError("VertexArray::setupGL2 disabled"); for (uint32_t ct=0; ct < mCount; ct++) { uint32_t slot = 0; if (mAttribs[ct].name[0] == '#') { continue; } if (sc->isUserVertexProgram()) { slot = sc->vtxAttribSlot(ct); } else { Loading libs/rs/scriptc/rs_graphics.rsh +0 −2 Original line number Diff line number Diff line Loading @@ -29,8 +29,6 @@ extern void rsgDrawQuad(float x1, float y1, float z1, float x2, float y2, float extern void rsgDrawQuadTexCoords(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); //extern void rsgDrawSprite(float x, float y, float z, float w, float h); extern void rsgDrawSpriteScreenspace(float x, float y, float z, float w, float h); extern void rsgDrawLine(float x1, float y1, float z1, float x2, float y2, float z2); extern void rsgDrawPoint(float x1, float y1, float z1); extern void __attribute__((overloadable)) rsgDrawSimpleMesh(rs_mesh ism); extern void __attribute__((overloadable)) rsgDrawSimpleMesh(rs_mesh ism, int start, int len); Loading Loading
libs/rs/rsProgramVertex.cpp +6 −1 Original line number Diff line number Diff line Loading @@ -160,6 +160,11 @@ void ProgramVertex::createShader() const Element *e = mInputElements[ct].get(); for (uint32_t field=0; field < e->getFieldCount(); field++) { const Element *f = e->getField(field); const char *fn = e->getFieldName(field); if (fn[0] == '#') { continue; } // Cannot be complex rsAssert(!f->getFieldCount()); Loading @@ -172,7 +177,7 @@ void ProgramVertex::createShader() rsAssert(0); } mShader.append(e->getFieldName(field)); mShader.append(fn); mShader.append(";\n"); } } Loading
libs/rs/rsScriptC_LibGL.cpp +6 −143 Original line number Diff line number Diff line Loading @@ -121,38 +121,6 @@ static void SC_vpLoadTextureMatrix(const rsc_Matrix *m) // Drawing ////////////////////////////////////////////////////////////////////////////// static void SC_drawLine(float x1, float y1, float z1, float x2, float y2, float z2) { GET_TLS(); if (!rsc->setupCheck()) { return; } float vtx[] = { x1, y1, z1, x2, y2, z2 }; VertexArray va; va.add(GL_FLOAT, 3, 12, false, (uint32_t)vtx, "position"); va.setupGL2(rsc, &rsc->mStateVertexArray, &rsc->mShaderCache); glDrawArrays(GL_LINES, 0, 2); } static void SC_drawPoint(float x, float y, float z) { GET_TLS(); if (!rsc->setupCheck()) { return; } float vtx[] = { x, y, z }; VertexArray va; va.add(GL_FLOAT, 3, 12, false, (uint32_t)vtx, "position"); va.setupGL2(rsc, &rsc->mStateVertexArray, &rsc->mShaderCache); glDrawArrays(GL_POINTS, 0, 1); } static void SC_drawQuadTexCoords(float x1, float y1, float z1, float u1, float v1, float x2, float y2, float z2, Loading Loading @@ -212,20 +180,7 @@ static void SC_drawSpriteScreenspace(float x, float y, float z, float w, float h x, sh - (y+h), z); rsc->setVertex((ProgramVertex *)tmp.get()); } static void SC_drawSpriteScreenspaceCropped(float x, float y, float z, float w, float h, float cx0, float cy0, float cx1, float cy1) { GET_TLS(); if (!rsc->setupCheck()) { return; } GLint crop[4] = {cx0, cy0, cx1, cy1}; glTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_CROP_RECT_OES, crop); glDrawTexfOES(x, y, z, w, h); } /* static void SC_drawSprite(float x, float y, float z, float w, float h) { GET_TLS(); Loading Loading @@ -253,7 +208,7 @@ static void SC_drawSprite(float x, float y, float z, float w, float h) SC_drawSpriteScreenspace(vout[0], vout[1], z, h, w); //rsc->setupCheck(); } */ static void SC_drawRect(float x1, float y1, float x2, float y2, float z) Loading Loading @@ -303,91 +258,6 @@ static void SC_color(float r, float g, float b, float a) } } static void SC_pointAttenuation(float a, float b, float c) { GLfloat params[] = { a, b, c }; glPointParameterfv(GL_POINT_DISTANCE_ATTENUATION, params); } static void SC_hsbToRgb(float h, float s, float b, float* rgb) { float red = 0.0f; float green = 0.0f; float blue = 0.0f; float x = h; float y = s; float z = b; float hf = (x - (int) x) * 6.0f; int ihf = (int) hf; float f = hf - ihf; float pv = z * (1.0f - y); float qv = z * (1.0f - y * f); float tv = z * (1.0f - y * (1.0f - f)); switch (ihf) { case 0: // Red is the dominant color red = z; green = tv; blue = pv; break; case 1: // Green is the dominant color red = qv; green = z; blue = pv; break; case 2: red = pv; green = z; blue = tv; break; case 3: // Blue is the dominant color red = pv; green = qv; blue = z; break; case 4: red = tv; green = pv; blue = z; break; case 5: // Red is the dominant color red = z; green = pv; blue = qv; break; } rgb[0] = red; rgb[1] = green; rgb[2] = blue; } static int SC_hsbToAbgr(float h, float s, float b, float a) { //LOGE("hsb a %f, %f, %f %f", h, s, b, a); float rgb[3]; SC_hsbToRgb(h, s, b, rgb); //LOGE("rgb %f, %f, %f ", rgb[0], rgb[1], rgb[2]); return int(a * 255.0f) << 24 | int(rgb[2] * 255.0f) << 16 | int(rgb[1] * 255.0f) << 8 | int(rgb[0] * 255.0f); } static void SC_hsb(float h, float s, float b, float a) { GET_TLS(); float rgb[3]; SC_hsbToRgb(h, s, b, rgb); if (rsc->checkVersion2_0()) { glVertexAttrib4f(1, rgb[0], rgb[1], rgb[2], a); } else { glColor4f(rgb[0], rgb[1], rgb[2], a); } } static void SC_uploadToTexture2(RsAllocation va, uint32_t baseMipLevel) { GET_TLS(); Loading Loading @@ -486,9 +356,6 @@ static ScriptCState::SymbolTable_t gSyms[] = { { "rsgDrawQuadTexCoords", (void *)&SC_drawQuadTexCoords }, //{ "drawSprite", (void *)&SC_drawSprite }, { "rsgDrawSpriteScreenspace", (void *)&SC_drawSpriteScreenspace }, { "rsgDrawSpriteScreenspaceCropped", (void *)&SC_drawSpriteScreenspaceCropped }, { "rsgDrawLine", (void *)&SC_drawLine }, { "rsgDrawPoint", (void *)&SC_drawPoint }, { "_Z17rsgDrawSimpleMesh7rs_mesh", (void *)&SC_drawSimpleMesh }, { "_Z17rsgDrawSimpleMesh7rs_meshii", (void *)&SC_drawSimpleMeshRange }, { "_Z17rsgDrawSimpleMeshi", (void *)&SC_drawSimpleMesh }, Loading @@ -505,10 +372,6 @@ static ScriptCState::SymbolTable_t gSyms[] = { // misc //{ "pfClearColor", (void *)&SC_ClearColor }, { "color", (void *)&SC_color }, { "hsb", (void *)&SC_hsb }, { "hsbToRgb", (void *)&SC_hsbToRgb }, { "hsbToAbgr", (void *)&SC_hsbToAbgr }, { "pointAttenuation", (void *)&SC_pointAttenuation }, { NULL, NULL } }; Loading
libs/rs/rsVertexArray.cpp +5 −0 Original line number Diff line number Diff line Loading @@ -123,6 +123,11 @@ void VertexArray::setupGL2(const Context *rsc, class VertexArrayState *state, Sh rsc->checkError("VertexArray::setupGL2 disabled"); for (uint32_t ct=0; ct < mCount; ct++) { uint32_t slot = 0; if (mAttribs[ct].name[0] == '#') { continue; } if (sc->isUserVertexProgram()) { slot = sc->vtxAttribSlot(ct); } else { Loading
libs/rs/scriptc/rs_graphics.rsh +0 −2 Original line number Diff line number Diff line Loading @@ -29,8 +29,6 @@ extern void rsgDrawQuad(float x1, float y1, float z1, float x2, float y2, float extern void rsgDrawQuadTexCoords(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); //extern void rsgDrawSprite(float x, float y, float z, float w, float h); extern void rsgDrawSpriteScreenspace(float x, float y, float z, float w, float h); extern void rsgDrawLine(float x1, float y1, float z1, float x2, float y2, float z2); extern void rsgDrawPoint(float x1, float y1, float z1); extern void __attribute__((overloadable)) rsgDrawSimpleMesh(rs_mesh ism); extern void __attribute__((overloadable)) rsgDrawSimpleMesh(rs_mesh ism, int start, int len); Loading