Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d224c64a authored by Alex Sakhartchouk's avatar Alex Sakhartchouk Committed by Android (Google) Code Review
Browse files

Merge "Moving renderscript GL code into the HAL This change affects - shaders...

Merge "Moving renderscript GL code into the HAL This change affects  - shaders  - meshes  - fonts  - quad rendering"
parents 3a09a064 4a36b45c
Loading
Loading
Loading
Loading
+7 −4
Original line number Diff line number Diff line
@@ -110,20 +110,23 @@ LOCAL_SRC_FILES:= \
	rsScriptC.cpp \
	rsScriptC_Lib.cpp \
	rsScriptC_LibGL.cpp \
	rsShaderCache.cpp \
	rsSignal.cpp \
	rsStream.cpp \
	rsThreadIO.cpp \
	rsType.cpp \
	rsVertexArray.cpp \
	driver/rsdBcc.cpp \
	driver/rsdCore.cpp \
	driver/rsdGL.cpp \
	driver/rsdMesh.cpp \
	driver/rsdMeshObj.cpp \
	driver/rsdProgram.cpp \
	driver/rsdProgramRaster.cpp \
	driver/rsdProgramStore.cpp \
	driver/rsdRuntimeMath.cpp \
	driver/rsdRuntimeStubs.cpp

	driver/rsdRuntimeStubs.cpp \
	driver/rsdShader.cpp \
	driver/rsdShaderCache.cpp \
	driver/rsdVertexArray.cpp

LOCAL_SHARED_LIBRARIES += libz libcutils libutils libEGL libGLESv1_CM libGLESv2 libui libbcc

+21 −0
Original line number Diff line number Diff line
@@ -19,6 +19,9 @@
#include "rsdGL.h"
#include "rsdProgramStore.h"
#include "rsdProgramRaster.h"
#include "rsdProgramVertex.h"
#include "rsdProgramFragment.h"
#include "rsdMesh.h"

#include <malloc.h>
#include "rsContext.h"
@@ -69,6 +72,24 @@ static RsdHalFunctions FunctionTable = {
        rsdProgramRasterInit,
        rsdProgramRasterSetActive,
        rsdProgramRasterDestroy
    },

    {
        rsdProgramVertexInit,
        rsdProgramVertexSetActive,
        rsdProgramVertexDestroy
    },

    {
        rsdProgramFragmentInit,
        rsdProgramFragmentSetActive,
        rsdProgramFragmentDestroy
    },

    {
        rsdMeshInit,
        rsdMeshDraw,
        rsdMeshDestroy
    }

};
+11 −0
Original line number Diff line number Diff line
@@ -40,6 +40,8 @@

#include <malloc.h>
#include "rsContext.h"
#include "rsdShaderCache.h"
#include "rsdVertexArray.h"

using namespace android;
using namespace android::renderscript;
@@ -128,6 +130,11 @@ static void DumpDebug(RsdHal *dc) {
void rsdGLShutdown(const Context *rsc) {
    RsdHal *dc = (RsdHal *)rsc->mHal.drv;

    dc->gl.shaderCache->cleanupAll();
    delete dc->gl.shaderCache;

    delete dc->gl.vertexArrayState;

    LOGV("%p, deinitEGL", rsc);

    if (dc->gl.egl.context != EGL_NO_CONTEXT) {
@@ -287,6 +294,10 @@ bool rsdGLInit(const Context *rsc) {
        DumpDebug(dc);
    }

    dc->gl.shaderCache = new RsdShaderCache();
    dc->gl.vertexArrayState = new RsdVertexArrayState();
    dc->gl.vertexArrayState->init(dc->gl.gl.maxVertexAttribs);

    LOGV("initGLThread end %p", rsc);
    return true;
}
+4 −1
Original line number Diff line number Diff line
@@ -19,7 +19,8 @@

#include <rs_hal.h>


class RsdShaderCache;
class RsdVertexArrayState;

typedef void (* InvokeFunc_t)(void);
typedef void (*WorkerCallback_t)(void *usr, uint32_t idx);
@@ -64,6 +65,8 @@ typedef struct RsdGLRec {
    ANativeWindow *wndSurface;
    uint32_t width;
    uint32_t height;
    RsdShaderCache *shaderCache;
    RsdVertexArrayState *vertexArrayState;
} RsdGL;


+60 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2011 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */


#include <rs_hal.h>
#include <rsContext.h>
#include <rsMesh.h>

#include "rsdCore.h"
#include "rsdMesh.h"
#include "rsdMeshObj.h"
#include "rsdShaderCache.h"

using namespace android;
using namespace android::renderscript;

bool rsdMeshInit(const Context *rsc, const Mesh *m) {
    RsdMeshObj *drv = NULL;
    if(m->mHal.drv) {
        drv = (RsdMeshObj*)m->mHal.drv;
        delete drv;
    }
    drv = new RsdMeshObj(rsc, m);
    m->mHal.drv = drv;
    return drv->init();
}

void rsdMeshDraw(const Context *rsc, const Mesh *m, uint32_t primIndex, uint32_t start, uint32_t len) {
    if(m->mHal.drv) {
        RsdHal *dc = (RsdHal *)rsc->mHal.drv;
        if (!dc->gl.shaderCache->setup(rsc)) {
            return;
        }

        RsdMeshObj *drv = (RsdMeshObj*)m->mHal.drv;
        drv->renderPrimitiveRange(rsc, primIndex, start, len);
    }
}

void rsdMeshDestroy(const Context *rsc, const Mesh *m) {
    if(m->mHal.drv) {
        RsdMeshObj *drv = (RsdMeshObj*)m->mHal.drv;
        delete drv;
    }
}

Loading