Merge "Fix framebuffer incomplete errors" into nyc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
4bcf66030d
@@ -256,6 +256,7 @@ LOCAL_SRC_FILES += \
|
||||
tests/unit/MatrixTests.cpp \
|
||||
tests/unit/OffscreenBufferPoolTests.cpp \
|
||||
tests/unit/RenderNodeTests.cpp \
|
||||
tests/unit/RenderPropertiesTests.cpp \
|
||||
tests/unit/SkiaBehaviorTests.cpp \
|
||||
tests/unit/SnapshotTests.cpp \
|
||||
tests/unit/StringUtilsTests.cpp \
|
||||
|
||||
@@ -66,8 +66,13 @@ void BakedOpRenderer::startRepaintLayer(OffscreenBuffer* offscreenBuffer, const
|
||||
offscreenBuffer->texture.id(), 0);
|
||||
GL_CHECKPOINT(LOW);
|
||||
|
||||
LOG_ALWAYS_FATAL_IF(glCheckFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE,
|
||||
"framebuffer incomplete!");
|
||||
int status = glCheckFramebufferStatus(GL_FRAMEBUFFER);
|
||||
LOG_ALWAYS_FATAL_IF(status != GL_FRAMEBUFFER_COMPLETE,
|
||||
"framebuffer incomplete, status %d, textureId %d, size %dx%d",
|
||||
status,
|
||||
offscreenBuffer->texture.id(),
|
||||
offscreenBuffer->texture.width(),
|
||||
offscreenBuffer->texture.height());
|
||||
|
||||
// Change the viewport & ortho projection
|
||||
setViewport(offscreenBuffer->viewportWidth, offscreenBuffer->viewportHeight);
|
||||
|
||||
@@ -86,7 +86,9 @@ void FrameBuilder::deferLayers(const LayerUpdateQueue& layers) {
|
||||
ATRACE_FORMAT("Optimize HW Layer DisplayList %s %ux%u",
|
||||
layerNode->getName(), layerNode->getWidth(), layerNode->getHeight());
|
||||
|
||||
const Rect& layerDamage = layers.entries()[i].damage;
|
||||
Rect layerDamage = layers.entries()[i].damage;
|
||||
// TODO: ensure layer damage can't be larger than layer
|
||||
layerDamage.doIntersect(0, 0, layer->viewportWidth, layer->viewportHeight);
|
||||
layerNode->computeOrdering();
|
||||
|
||||
// map current light center into RenderNode's coordinate space
|
||||
|
||||
@@ -319,6 +319,8 @@ void RenderNode::pushLayerUpdate(TreeInfo& info) {
|
||||
transformUpdateNeeded = true;
|
||||
} else if (!layerMatchesWidthAndHeight(mLayer, getWidth(), getHeight())) {
|
||||
#if HWUI_NEW_OPS
|
||||
// TODO: remove now irrelevant, currently enqueued damage (respecting damage ordering)
|
||||
// Or, ideally, maintain damage between frames on node/layer so ordering is always correct
|
||||
RenderState& renderState = mLayer->renderState;
|
||||
if (properties().fitsOnLayer()) {
|
||||
mLayer = renderState.layerPool().resize(mLayer, getWidth(), getHeight());
|
||||
|
||||
@@ -611,7 +611,9 @@ public:
|
||||
bool fitsOnLayer() const {
|
||||
const DeviceInfo* deviceInfo = DeviceInfo::get();
|
||||
return mPrimitiveFields.mWidth <= deviceInfo->maxTextureSize()
|
||||
&& mPrimitiveFields.mHeight <= deviceInfo->maxTextureSize();
|
||||
&& mPrimitiveFields.mHeight <= deviceInfo->maxTextureSize()
|
||||
&& mPrimitiveFields.mWidth > 0
|
||||
&& mPrimitiveFields.mHeight > 0;
|
||||
}
|
||||
|
||||
bool promotedToLayer() const {
|
||||
|
||||
48
libs/hwui/tests/unit/RenderPropertiesTests.cpp
Normal file
48
libs/hwui/tests/unit/RenderPropertiesTests.cpp
Normal file
@@ -0,0 +1,48 @@
|
||||
/*
|
||||
* Copyright (C) 2016 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 <gtest/gtest.h>
|
||||
|
||||
#include <RenderProperties.h>
|
||||
|
||||
using namespace android;
|
||||
using namespace android::uirenderer;
|
||||
|
||||
TEST(RenderProperties, layerValidity) {
|
||||
DeviceInfo::initialize();
|
||||
|
||||
const int maxTextureSize = DeviceInfo::get()->maxTextureSize();
|
||||
ASSERT_LE(2048, maxTextureSize);
|
||||
ASSERT_GT(100000, maxTextureSize);
|
||||
|
||||
RenderProperties props;
|
||||
|
||||
// simple cases that all should fit on layers
|
||||
props.setLeftTopRightBottom(0, 0, 100, 100);
|
||||
ASSERT_TRUE(props.fitsOnLayer());
|
||||
props.setLeftTopRightBottom(100, 2000, 300, 4000);
|
||||
ASSERT_TRUE(props.fitsOnLayer());
|
||||
props.setLeftTopRightBottom(-10, -10, 510, 512);
|
||||
ASSERT_TRUE(props.fitsOnLayer());
|
||||
|
||||
// Too big - can't have layer bigger than max texture size
|
||||
props.setLeftTopRightBottom(0, 0, maxTextureSize + 1, maxTextureSize + 1);
|
||||
ASSERT_FALSE(props.fitsOnLayer());
|
||||
|
||||
// Too small - can't have 0 dimen layer
|
||||
props.setLeftTopRightBottom(0, 0, 100, 0);
|
||||
ASSERT_FALSE(props.fitsOnLayer());
|
||||
}
|
||||
Reference in New Issue
Block a user