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

Commit 5ef2f53a authored by Alex Sakhartchouk's avatar Alex Sakhartchouk
Browse files

Remove ObjBaseRef from the hal struct

Change-Id: Idcac14ecfdd4d06a0f54bf50e3b9657be62e6638
parent a744ead9
Loading
Loading
Loading
Loading
+6 −6
Original line number Diff line number Diff line
@@ -33,11 +33,11 @@ void setDepthAttachment(const Context *rsc, const FBOCache *fb) {
    RsdFrameBufferObj *fbo = (RsdFrameBufferObj*)fb->mHal.drv;

    DrvAllocation *depth = NULL;
    if (fb->mHal.state.depthTarget.get() != NULL) {
    if (fb->mHal.state.depthTarget != NULL) {
        depth = (DrvAllocation *)fb->mHal.state.depthTarget->mHal.drv;

        if (depth->uploadDeferred) {
            rsdAllocationSyncAll(rsc, fb->mHal.state.depthTarget.get(),
            rsdAllocationSyncAll(rsc, fb->mHal.state.depthTarget,
                                 RS_ALLOCATION_USAGE_SCRIPT);
        }
    }
@@ -49,11 +49,11 @@ void setColorAttachment(const Context *rsc, const FBOCache *fb) {
    // Now attach color targets
    for (uint32_t i = 0; i < fb->mHal.state.colorTargetsCount; i ++) {
        DrvAllocation *color = NULL;
        if (fb->mHal.state.colorTargets[i].get() != NULL) {
        if (fb->mHal.state.colorTargets[i] != NULL) {
            color = (DrvAllocation *)fb->mHal.state.colorTargets[i]->mHal.drv;

            if (color->uploadDeferred) {
                rsdAllocationSyncAll(rsc, fb->mHal.state.colorTargets[i].get(),
                rsdAllocationSyncAll(rsc, fb->mHal.state.colorTargets[i],
                                     RS_ALLOCATION_USAGE_SCRIPT);
            }
        }
@@ -79,10 +79,10 @@ void rsdFrameBufferSetActive(const Context *rsc, const FBOCache *fb) {
    setColorAttachment(rsc, fb);

    RsdFrameBufferObj *fbo = (RsdFrameBufferObj *)fb->mHal.drv;
    if (fb->mHal.state.colorTargets[0].get()) {
    if (fb->mHal.state.colorTargets[0]) {
        fbo->setDimensions(fb->mHal.state.colorTargets[0]->getType()->getDimX(),
                           fb->mHal.state.colorTargets[0]->getType()->getDimY());
    } else if (fb->mHal.state.depthTarget.get()) {
    } else if (fb->mHal.state.depthTarget) {
        fbo->setDimensions(fb->mHal.state.depthTarget->getType()->getDimX(),
                           fb->mHal.state.depthTarget->getType()->getDimY());
    }
+4 −5
Original line number Diff line number Diff line
@@ -138,7 +138,7 @@ void RsdMeshObj::renderPrimitiveRange(const Context *rsc, uint32_t primIndex,
    }

    for (uint32_t ct=0; ct < mRSMesh->mHal.state.vertexBuffersCount; ct++) {
        const Allocation *alloc = mRSMesh->mHal.state.vertexBuffers[ct].get();
        const Allocation *alloc = mRSMesh->mHal.state.vertexBuffers[ct];
        DrvAllocation *drv = (DrvAllocation *)alloc->mHal.drv;
        if (drv->uploadDeferred) {
            rsdAllocationSyncAll(rsc, alloc, RS_ALLOCATION_USAGE_SCRIPT);
@@ -148,7 +148,7 @@ void RsdMeshObj::renderPrimitiveRange(const Context *rsc, uint32_t primIndex,
    // update attributes with either buffer information or data ptr based on their current state
    for (uint32_t ct=0; ct < mAttribCount; ct++) {
        uint32_t allocIndex = mAttribAllocationIndex[ct];
        Allocation *alloc = mRSMesh->mHal.state.vertexBuffers[allocIndex].get();
        Allocation *alloc = mRSMesh->mHal.state.vertexBuffers[allocIndex];
        DrvAllocation *drvAlloc = (DrvAllocation *)alloc->mHal.drv;

        if (drvAlloc->bufferID) {
@@ -163,8 +163,7 @@ void RsdMeshObj::renderPrimitiveRange(const Context *rsc, uint32_t primIndex,
    RsdVertexArray va(mAttribs, mAttribCount);
    va.setup(rsc);

    Mesh::Primitive_t *prim = mRSMesh->mHal.state.primitives[primIndex];
    const Allocation *idxAlloc = prim->mIndexBuffer.get();
    const Allocation *idxAlloc = mRSMesh->mHal.state.indexBuffers[primIndex];
    if (idxAlloc) {
        DrvAllocation *drvAlloc = (DrvAllocation *)idxAlloc->mHal.drv;
        if (drvAlloc->uploadDeferred) {
@@ -190,7 +189,7 @@ void RsdMeshObj::renderPrimitiveRange(const Context *rsc, uint32_t primIndex,
void RsdMeshObj::updateGLPrimitives() {
    mGLPrimitives = new uint32_t[mRSMesh->mHal.state.primitivesCount];
    for (uint32_t i = 0; i < mRSMesh->mHal.state.primitivesCount; i ++) {
        switch (mRSMesh->mHal.state.primitives[i]->mPrimitive) {
        switch (mRSMesh->mHal.state.primitives[i]) {
            case RS_PRIMITIVE_POINT:          mGLPrimitives[i] = GL_POINTS; break;
            case RS_PRIMITIVE_LINE:           mGLPrimitives[i] = GL_LINES; break;
            case RS_PRIMITIVE_LINE_STRIP:     mGLPrimitives[i] = GL_LINE_STRIP; break;
+1 −1
Original line number Diff line number Diff line
@@ -43,7 +43,7 @@ bool rsdProgramVertexInit(const Context *rsc, const ProgramVertex *pv,

static void SyncProgramConstants(const Context *rsc, const Program *p) {
    for (uint32_t ct=0; ct < p->mHal.state.texturesCount; ct++) {
        const Allocation *a = p->mHal.state.textures[ct].get();
        const Allocation *a = p->mHal.state.textures[ct];
        if (!a) {
            continue;
        }
+9 −9
Original line number Diff line number Diff line
@@ -69,7 +69,7 @@ void RsdShader::init() {
    uint32_t attribCount = 0;
    uint32_t uniformCount = 0;
    for (uint32_t ct=0; ct < mRSProgram->mHal.state.inputElementsCount; ct++) {
        initAddUserElement(mRSProgram->mHal.state.inputElements[ct].get(), mAttribNames, NULL, &attribCount, RS_SHADER_ATTR);
        initAddUserElement(mRSProgram->mHal.state.inputElements[ct], mAttribNames, NULL, &attribCount, RS_SHADER_ATTR);
    }
    for (uint32_t ct=0; ct < mRSProgram->mHal.state.constantsCount; ct++) {
        initAddUserElement(mRSProgram->mHal.state.constantTypes[ct]->getElement(), mUniformNames, mUniformArraySizes, &uniformCount, RS_SHADER_UNI);
@@ -89,7 +89,7 @@ void RsdShader::init() {
String8 RsdShader::getGLSLInputString() const {
    String8 s;
    for (uint32_t ct=0; ct < mRSProgram->mHal.state.inputElementsCount; ct++) {
        const Element *e = mRSProgram->mHal.state.inputElements[ct].get();
        const Element *e = mRSProgram->mHal.state.inputElements[ct];
        for (uint32_t field=0; field < e->getFieldCount(); field++) {
            const Element *f = e->getField(field);

@@ -113,7 +113,7 @@ String8 RsdShader::getGLSLInputString() const {

void RsdShader::appendAttributes() {
    for (uint32_t ct=0; ct < mRSProgram->mHal.state.inputElementsCount; ct++) {
        const Element *e = mRSProgram->mHal.state.inputElements[ct].get();
        const Element *e = mRSProgram->mHal.state.inputElements[ct];
        for (uint32_t field=0; field < e->getFieldCount(); field++) {
            const Element *f = e->getField(field);
            const char *fn = e->getFieldName(field);
@@ -414,7 +414,7 @@ void RsdShader::setupTextures(const Context *rsc, RsdShaderCache *sc) {
        RSD_CALL_GL(glActiveTexture, GL_TEXTURE0 + ct);
        RSD_CALL_GL(glUniform1i, sc->fragUniformSlot(mTextureUniformIndexStart + ct), ct);

        if (!mRSProgram->mHal.state.textures[ct].get()) {
        if (!mRSProgram->mHal.state.textures[ct]) {
            // if nothing is bound, reset to default GL texture
            RSD_CALL_GL(glBindTexture, mTextureTargets[ct], 0);
            continue;
@@ -427,9 +427,9 @@ void RsdShader::setupTextures(const Context *rsc, RsdShaderCache *sc) {
        }
        RSD_CALL_GL(glBindTexture, drvTex->glTarget, drvTex->textureID);
        rsdGLCheckError(rsc, "ProgramFragment::setup tex bind");
        if (mRSProgram->mHal.state.samplers[ct].get()) {
            setupSampler(rsc, mRSProgram->mHal.state.samplers[ct].get(),
                         mRSProgram->mHal.state.textures[ct].get());
        if (mRSProgram->mHal.state.samplers[ct]) {
            setupSampler(rsc, mRSProgram->mHal.state.samplers[ct],
                         mRSProgram->mHal.state.textures[ct]);
        } else {
            RSD_CALL_GL(glTexParameteri, drvTex->glTarget, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
            RSD_CALL_GL(glTexParameteri, drvTex->glTarget, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
@@ -448,7 +448,7 @@ void RsdShader::setupTextures(const Context *rsc, RsdShaderCache *sc) {
void RsdShader::setupUserConstants(const Context *rsc, RsdShaderCache *sc, bool isFragment) {
    uint32_t uidx = 0;
    for (uint32_t ct=0; ct < mRSProgram->mHal.state.constantsCount; ct++) {
        Allocation *alloc = mRSProgram->mHal.state.constants[ct].get();
        Allocation *alloc = mRSProgram->mHal.state.constants[ct];
        if (!alloc) {
            LOGE("Attempting to set constants on shader id %u, but alloc at slot %u is not set",
                 (uint32_t)this, ct);
@@ -504,7 +504,7 @@ void RsdShader::setup(const android::renderscript::Context *rsc, RsdShaderCache
void RsdShader::initAttribAndUniformArray() {
    mAttribCount = 0;
    for (uint32_t ct=0; ct < mRSProgram->mHal.state.inputElementsCount; ct++) {
        const Element *elem = mRSProgram->mHal.state.inputElements[ct].get();
        const Element *elem = mRSProgram->mHal.state.inputElements[ct];
        for (uint32_t field=0; field < elem->getFieldCount(); field++) {
            if (elem->getFieldName(field)[0] != '#') {
                mAttribCount ++;
+4 −4
Original line number Diff line number Diff line
@@ -30,7 +30,7 @@ Allocation::Allocation(Context *rsc, const Type *type, uint32_t usages,
    mHal.state.usageFlags = usages;
    mHal.state.mipmapControl = mc;

    mHal.state.type.set(type);
    setType(type);
    updateCache();
}

@@ -47,7 +47,7 @@ Allocation * Allocation::createAllocation(Context *rsc, const Type *type, uint32
}

void Allocation::updateCache() {
    const Type *type = mHal.state.type.get();
    const Type *type = mHal.state.type;
    mHal.state.dimensionX = type->getDimX();
    mHal.state.dimensionY = type->getDimY();
    mHal.state.dimensionZ = type->getDimZ();
@@ -187,7 +187,7 @@ void Allocation::dumpLOGV(const char *prefix) const {

    String8 s(prefix);
    s.append(" type ");
    if (mHal.state.type.get()) {
    if (mHal.state.type) {
        mHal.state.type->dumpLOGV(s.string());
    }

@@ -314,7 +314,7 @@ void Allocation::resize1D(Context *rsc, uint32_t dimX) {
        decRefs(getPtr(), oldDimX - dimX, dimX);
    }
    rsc->mHal.funcs.allocation.resize(rsc, this, t.get(), mHal.state.hasReferences);
    mHal.state.type.set(t.get());
    setType(t.get());
    updateCache();
}

Loading