Support constant and varying colors in ProgramFragment.
Change-Id: I16ce84ff427016f3a1923594efc718eca32dd7f2
diff --git a/rsScriptC_LibGL.cpp b/rsScriptC_LibGL.cpp
index 22b0945..f5e5953 100644
--- a/rsScriptC_LibGL.cpp
+++ b/rsScriptC_LibGL.cpp
@@ -110,6 +110,13 @@
}
+static void SC_pfConstantColor(RsProgramFragment vpf, float r, float g, float b, float a)
+{
+ //GET_TLS();
+ ProgramFragment *pf = static_cast<ProgramFragment *>(vpf);
+ pf->setConstantColor(r, g, b, a);
+}
+
//////////////////////////////////////////////////////////////////////////////
// Drawing
@@ -253,13 +260,8 @@
static void SC_color(float r, float g, float b, float a)
{
GET_TLS();
- rsc->mStateVertex.color[0] = r;
- rsc->mStateVertex.color[1] = g;
- rsc->mStateVertex.color[2] = b;
- rsc->mStateVertex.color[3] = a;
- if (!rsc->checkVersion2_0()) {
- glColor4f(r, g, b, a);
- }
+ ProgramFragment *pf = (ProgramFragment *)rsc->getFragment();
+ pf->setConstantColor(r, g, b, a);
}
static void SC_uploadToTexture2(RsAllocation va, uint32_t baseMipLevel)
@@ -371,6 +373,8 @@
{ "_Z31rsgProgramVertexLoadModelMatrixPK12rs_matrix4x4", (void *)&SC_vpLoadModelMatrix },
{ "_Z33rsgProgramVertexLoadTextureMatrixPK12rs_matrix4x4", (void *)&SC_vpLoadTextureMatrix },
+ { "_Z31rsgProgramFragmentConstantColor19rs_program_fragmentffff", (void *)&SC_pfConstantColor },
+
{ "_Z11rsgGetWidthv", (void *)&SC_getWidth },
{ "_Z12rsgGetHeightv", (void *)&SC_getHeight },