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

Commit 9a9d1d5a authored by Chris Craik's avatar Chris Craik Committed by Android (Google) Code Review
Browse files

Merge "Tessellate on worker threads" into lmp-preview-dev

parents 3721cbaf 05f3d6e5
Loading
Loading
Loading
Loading
+5 −5
Original line number Diff line number Diff line
@@ -44,18 +44,18 @@ namespace uirenderer {
 * @param shadowVertexBuffer Return an floating point array of (x, y, a)
 *               triangle strips mode.
 */
VertexBufferMode AmbientShadow::createAmbientShadow(bool isCasterOpaque,
void AmbientShadow::createAmbientShadow(bool isCasterOpaque,
        const Vector3* vertices, int vertexCount, const Vector3& centroid3d,
        float heightFactor, float geomFactor, VertexBuffer& shadowVertexBuffer) {
    const int rays = SHADOW_RAY_COUNT;
    VertexBufferMode mode = kVertexBufferMode_OnePolyRingShadow;
    VertexBuffer::Mode mode = VertexBuffer::kOnePolyRingShadow;
    // Validate the inputs.
    if (vertexCount < 3 || heightFactor <= 0 || rays <= 0
        || geomFactor <= 0) {
#if DEBUG_SHADOW
        ALOGW("Invalid input for createAmbientShadow(), early return!");
#endif
        return mode; // vertex buffer is empty, so any mode doesn't matter.
        return;
    }

    Vector<Vector2> dir; // TODO: use C++11 unique_ptr
@@ -127,7 +127,7 @@ VertexBufferMode AmbientShadow::createAmbientShadow(bool isCasterOpaque,
    // If caster isn't opaque, we need to to fill the umbra by storing the umbra's
    // centroid in the innermost ring of vertices.
    if (!isCasterOpaque) {
        mode = kVertexBufferMode_TwoPolyRingShadow;
        mode = VertexBuffer::kTwoPolyRingShadow;
        float centroidAlpha = 1.0 / (1 + centroid3d.z * heightFactor);
        AlphaVertex centroidXYA;
        AlphaVertex::set(&centroidXYA, centroid2d.x, centroid2d.y, centroidAlpha);
@@ -135,6 +135,7 @@ VertexBufferMode AmbientShadow::createAmbientShadow(bool isCasterOpaque,
            shadowVertices[2 * rays + rayIndex] = centroidXYA;
        }
    }
    shadowVertexBuffer.setMode(mode);

#if DEBUG_SHADOW
    for (int i = 0; i < SHADOW_VERTEX_COUNT; i++) {
@@ -142,7 +143,6 @@ VertexBufferMode AmbientShadow::createAmbientShadow(bool isCasterOpaque,
                shadowVertices[i].y, shadowVertices[i].alpha);
    }
#endif
    return mode;
}

/**
+1 −1
Original line number Diff line number Diff line
@@ -35,7 +35,7 @@ namespace uirenderer {
 */
class AmbientShadow {
public:
    static VertexBufferMode createAmbientShadow(bool isCasterOpaque, const Vector3* poly,
    static void createAmbientShadow(bool isCasterOpaque, const Vector3* poly,
            int polyLength, const Vector3& centroid3d, float heightFactor,
            float geomFactor, VertexBuffer& shadowVertexBuffer);

+1 −0
Original line number Diff line number Diff line
@@ -51,6 +51,7 @@ ifeq ($(USE_OPENGL_RENDERER),true)
		SpotShadow.cpp \
		StatefulBaseRenderer.cpp \
		Stencil.cpp \
		TessellationCache.cpp \
		Texture.cpp \
		TextureCache.cpp \
		TextDropShadowCache.cpp
+4 −0
Original line number Diff line number Diff line
@@ -273,6 +273,8 @@ void Caches::dumpMemoryUsage(String8 &log) {
            gradientCache.getSize(), gradientCache.getMaxSize());
    log.appendFormat("  PathCache            %8d / %8d\n",
            pathCache.getSize(), pathCache.getMaxSize());
    log.appendFormat("  TessellationCache    %8d / %8d\n",
            tessellationCache.getSize(), tessellationCache.getMaxSize());
    log.appendFormat("  TextDropShadowCache  %8d / %8d\n", dropShadowCache.getSize(),
            dropShadowCache.getMaxSize());
    log.appendFormat("  PatchCache           %8d / %8d\n",
@@ -295,6 +297,7 @@ void Caches::dumpMemoryUsage(String8 &log) {
    total += renderBufferCache.getSize();
    total += gradientCache.getSize();
    total += pathCache.getSize();
    total += tessellationCache.getSize();
    total += dropShadowCache.getSize();
    total += patchCache.getSize();
    for (uint32_t i = 0; i < fontRenderer->getFontRendererCount(); i++) {
@@ -358,6 +361,7 @@ void Caches::flush(FlushMode mode) {
            fontRenderer->flush();
            textureCache.flush();
            pathCache.clear();
            tessellationCache.clear();
            // fall through
        case kFlushMode_Layers:
            layerCache.clear();
+2 −0
Original line number Diff line number Diff line
@@ -43,6 +43,7 @@
#include "PatchCache.h"
#include "ProgramCache.h"
#include "PathCache.h"
#include "TessellationCache.h"
#include "TextDropShadowCache.h"
#include "FboCache.h"
#include "ResourceCache.h"
@@ -326,6 +327,7 @@ public:
    ProgramCache programCache;
    PathCache pathCache;
    PatchCache patchCache;
    TessellationCache tessellationCache;
    TextDropShadowCache dropShadowCache;
    FboCache fboCache;
    ResourceCache resourceCache;
Loading