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

Commit 1441bf7e authored by Alec Mouri's avatar Alec Mouri
Browse files

Add default values to {Display,Layer}Settings fields

For primitives at least, the compiler can do whatever it wants due to
undefined behavior. For other types it's documentation of default values.

Bug: 118461793
Change-Id: I9ff3f6c4fd77f1aa60bd2e724d8dee54fddbe5f8
Test: builds
parent d653633b
Loading
Loading
Loading
Loading
+7 −7
Original line number Diff line number Diff line
@@ -29,32 +29,32 @@ namespace renderengine {
struct DisplaySettings {
    // Rectangle describing the physical display. We will project from the
    // logical clip onto this rectangle.
    Rect physicalDisplay;
    Rect physicalDisplay = Rect::INVALID_RECT;

    // Rectangle bounded by the x,y- clipping planes in the logical display, so
    // that the orthographic projection matrix can be computed. When
    // constructing this matrix, z-coordinate bound are assumed to be at z=0 and
    // z=1.
    Rect clip;
    Rect clip = Rect::INVALID_RECT;

    // Global transform to apply to all layers.
    mat4 globalTransform;
    mat4 globalTransform = mat4();

    // Maximum luminance pulled from the display's HDR capabilities.
    float maxLuminence;
    float maxLuminence = 1.0f;

    // Output dataspace that will be populated if wide color gamut is used, or
    // DataSpace::UNKNOWN otherwise.
    ui::Dataspace outputDataspace;
    ui::Dataspace outputDataspace = ui::Dataspace::UNKNOWN;

    // Additional color transform to apply in linear space after transforming
    // to the output dataspace.
    mat4 colorTransform;
    mat4 colorTransform = mat4();

    // Region that will be cleared to (0, 0, 0, 0) prior to rendering.
    // clearRegion will first be transformed by globalTransform so that it will
    // be in the same coordinate space as the rendered layers.
    Region clearRegion;
    Region clearRegion = Region::INVALID_REGION;
};

} // namespace renderengine
+14 −14
Original line number Diff line number Diff line
@@ -34,58 +34,58 @@ struct Buffer {
    // Buffer containing the image that we will render.
    // If buffer == nullptr, then the rest of the fields in this struct will be
    // ignored.
    sp<GraphicBuffer> buffer;
    sp<GraphicBuffer> buffer = nullptr;

    // Texture identifier to bind the external texture to.
    // TODO(alecmouri): This is GL-specific...make the type backend-agnostic.
    uint32_t textureName;
    uint32_t textureName = 0;

    // Whether to use filtering when rendering the texture.
    bool useTextureFiltering;
    bool useTextureFiltering = false;

    // Transform matrix to apply to texture coordinates.
    mat4 textureTransform;
    mat4 textureTransform = mat4();

    // Wheteher to use pre-multiplied alpha
    bool usePremultipliedAlpha;
    bool usePremultipliedAlpha = true;

    // HDR color-space setting for Y410.
    bool isY410BT2020;
    bool isY410BT2020 = false;
};

// Metadata describing the layer geometry.
struct Geometry {
    // Boundaries of the layer.
    FloatRect boundaries;
    FloatRect boundaries = FloatRect();

    // Transform matrix to apply to mesh coordinates.
    mat4 positionTransform;
    mat4 positionTransform = mat4();
};

// Descriptor of the source pixels for this layer.
struct PixelSource {
    // Source buffer
    Buffer buffer;
    Buffer buffer = Buffer();

    // The solid color with which to fill the layer.
    // This should only be populated if we don't render from an application
    // buffer.
    half3 solidColor;
    half3 solidColor = half3(0.0f, 0.0f, 0.0f);
};

// The settings that RenderEngine requires for correctly rendering a Layer.
struct LayerSettings {
    // Geometry information
    Geometry geometry;
    Geometry geometry = Geometry();

    // Source pixels for this layer.
    PixelSource source;
    PixelSource source = PixelSource();

    // Alpha option to apply to the source pixels
    half alpha;
    half alpha = half(0.0);

    // Color space describing how the source pixels should be interpreted.
    ui::Dataspace sourceDataspace;
    ui::Dataspace sourceDataspace = ui::Dataspace::UNKNOWN;
};

} // namespace renderengine