From 9c54bdbf458e3c9433d237ae71cf47c4ec47d852 Mon Sep 17 00:00:00 2001 From: Jason Sams Date: Wed, 17 Jun 2009 16:52:59 -0700 Subject: Implement default programs and implement defaults and parents for imports. --- libs/rs/rsProgramVertex.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'libs/rs/rsProgramVertex.cpp') diff --git a/libs/rs/rsProgramVertex.cpp b/libs/rs/rsProgramVertex.cpp index c24f2281e12a..19afad54fc0a 100644 --- a/libs/rs/rsProgramVertex.cpp +++ b/libs/rs/rsProgramVertex.cpp @@ -81,6 +81,23 @@ ProgramVertexState::~ProgramVertexState() delete mPV; } +void ProgramVertexState::init(Context *rsc, int32_t w, int32_t h) +{ + ProgramVertex *pv = new ProgramVertex(NULL, NULL); + Allocation *alloc = (Allocation *) + rsi_AllocationCreatePredefSized(rsc, RS_ELEMENT_USER_FLOAT, 48); + mDefaultAlloc.set(alloc); + mDefault.set(pv); + + pv->bindAllocation(0, alloc); + + Matrix m; + m.loadOrtho(0,w, h,0, -1,1); + alloc->subData(RS_PROGRAM_VERTEX_PROJECTION_OFFSET, 16, &m.m[0]); + + m.loadIdentity(); + alloc->subData(RS_PROGRAM_VERTEX_MODELVIEW_OFFSET, 16, &m.m[0]); +} namespace android { -- cgit v1.2.3-59-g8ed1b