Add more validation logs instead of FML logs.
This commit is contained in:
@@ -89,11 +89,11 @@ TEST_F(AiksTest, CanRenderStrokes) {
|
||||
TEST_F(AiksTest, CanRenderCurvedStrokes) {
|
||||
Canvas canvas;
|
||||
Paint paint;
|
||||
paint.color = Color::Blue();
|
||||
paint.color = Color::Red();
|
||||
paint.stroke_width = 25.0;
|
||||
paint.style = Paint::Style::kStroke;
|
||||
canvas.DrawPath(PathBuilder{}.AddCircle({500, 500}, 250).CreatePath(), paint);
|
||||
// ASSERT_TRUE(OpenPlaygroundHere(canvas.EndRecordingAsPicture()));
|
||||
ASSERT_TRUE(OpenPlaygroundHere(canvas.EndRecordingAsPicture()));
|
||||
}
|
||||
|
||||
TEST_F(AiksTest, CanRenderClips) {
|
||||
@@ -103,7 +103,7 @@ TEST_F(AiksTest, CanRenderClips) {
|
||||
canvas.ClipPath(
|
||||
PathBuilder{}.AddRect(Rect::MakeXYWH(0, 0, 500, 500)).CreatePath());
|
||||
canvas.DrawPath(PathBuilder{}.AddCircle({500, 500}, 250).CreatePath(), paint);
|
||||
// ASSERT_TRUE(OpenPlaygroundHere(canvas.EndRecordingAsPicture()));
|
||||
ASSERT_TRUE(OpenPlaygroundHere(canvas.EndRecordingAsPicture()));
|
||||
}
|
||||
|
||||
TEST_F(AiksTest, CanRenderGroupOpacity) {
|
||||
@@ -138,7 +138,7 @@ TEST_F(AiksTest, CanPerformFullScreenMSAA) {
|
||||
|
||||
canvas.DrawCircle({250, 250}, 125, red);
|
||||
|
||||
// ASSERT_TRUE(OpenPlaygroundHere(canvas.EndRecordingAsPicture()));
|
||||
ASSERT_TRUE(OpenPlaygroundHere(canvas.EndRecordingAsPicture()));
|
||||
}
|
||||
|
||||
} // namespace testing
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
#include <algorithm>
|
||||
|
||||
#include "flutter/fml/logging.h"
|
||||
#include "impeller/base/validation.h"
|
||||
|
||||
namespace impeller {
|
||||
|
||||
@@ -69,7 +70,7 @@ bool Allocation::Reserve(size_t reserved) {
|
||||
// If new length is zero, a minimum non-zero sized allocation is returned.
|
||||
// So this check will not trip and this routine will indicate success as
|
||||
// expected.
|
||||
FML_LOG(ERROR) << "Allocation failed. Out of host memory.";
|
||||
VALIDATION_LOG << "Allocation failed. Out of host memory.";
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#include "flutter/impeller/compiler/compiler.h"
|
||||
#include "flutter/testing/testing.h"
|
||||
#include "gtest/gtest.h"
|
||||
#include "impeller/base/validation.h"
|
||||
|
||||
namespace impeller {
|
||||
namespace compiler {
|
||||
@@ -25,7 +26,7 @@ class CompilerTest : public ::testing::Test {
|
||||
bool CanCompileFixture(const char* fixture_name) const {
|
||||
auto fixture = flutter::testing::OpenFixtureAsMapping(fixture_name);
|
||||
if (!fixture->GetMapping()) {
|
||||
FML_LOG(ERROR) << "Could not find shader in fixtures: " << fixture_name;
|
||||
VALIDATION_LOG << "Could not find shader in fixtures: " << fixture_name;
|
||||
return false;
|
||||
}
|
||||
Compiler::SourceOptions compiler_options(fixture_name);
|
||||
@@ -34,7 +35,7 @@ class CompilerTest : public ::testing::Test {
|
||||
Reflector::Options reflector_options;
|
||||
Compiler compiler(*fixture.get(), compiler_options, reflector_options);
|
||||
if (!compiler.IsValid()) {
|
||||
FML_LOG(ERROR) << "Compilation failed: " << compiler.GetErrorMessages();
|
||||
VALIDATION_LOG << "Compilation failed: " << compiler.GetErrorMessages();
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
#include "flutter/impeller/geometry/matrix.h"
|
||||
#include "flutter/impeller/geometry/scalar.h"
|
||||
#include "impeller/base/strings.h"
|
||||
#include "impeller/base/validation.h"
|
||||
|
||||
namespace impeller {
|
||||
namespace compiler {
|
||||
@@ -150,7 +151,7 @@ std::optional<nlohmann::json> Reflector::GenerateTemplateArguments() const {
|
||||
|
||||
const auto& entrypoints = compiler_->get_entry_points_and_stages();
|
||||
if (entrypoints.size() != 1) {
|
||||
FML_LOG(ERROR) << "Incorrect number of entrypoints in the shader. Found "
|
||||
VALIDATION_LOG << "Incorrect number of entrypoints in the shader. Found "
|
||||
<< entrypoints.size() << " but expected 1.";
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
@@ -38,8 +38,6 @@ class ContentRenderer {
|
||||
struct Options {
|
||||
SampleCount sample_count = SampleCount::kCount1;
|
||||
|
||||
Options() {}
|
||||
|
||||
struct Hash {
|
||||
constexpr std::size_t operator()(const Options& o) const {
|
||||
return fml::HashCombine(o.sample_count);
|
||||
|
||||
@@ -6,6 +6,8 @@
|
||||
|
||||
#include <stb_image.h>
|
||||
|
||||
#include "impeller/base/validation.h"
|
||||
|
||||
namespace impeller {
|
||||
|
||||
CompressedImage::CompressedImage(
|
||||
@@ -32,7 +34,7 @@ DecompressedImage CompressedImage::Decode() const {
|
||||
STBI_default);
|
||||
|
||||
if (decoded == nullptr) {
|
||||
FML_LOG(ERROR) << "Could not decode image from host memory.";
|
||||
VALIDATION_LOG << "Could not decode image from host memory.";
|
||||
return {};
|
||||
}
|
||||
|
||||
@@ -68,7 +70,7 @@ DecompressedImage CompressedImage::Decode() const {
|
||||
}
|
||||
|
||||
if (components == DecompressedImage::Format::kInvalid) {
|
||||
FML_LOG(ERROR) << "Could not detect image components when decoding.";
|
||||
VALIDATION_LOG << "Could not detect image components when decoding.";
|
||||
return {};
|
||||
}
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
|
||||
#include "flutter/fml/paths.h"
|
||||
#include "flutter/testing/testing.h"
|
||||
#include "impeller/base/validation.h"
|
||||
#include "impeller/image/compressed_image.h"
|
||||
#include "impeller/playground/playground.h"
|
||||
#include "impeller/renderer/allocator.h"
|
||||
@@ -140,7 +141,7 @@ bool Playground::OpenPlaygroundHere(Renderer::RenderCallback render_callback) {
|
||||
auto current_drawable = [layer nextDrawable];
|
||||
|
||||
if (!current_drawable) {
|
||||
FML_LOG(ERROR) << "Could not acquire current drawable.";
|
||||
VALIDATION_LOG << "Could not acquire current drawable.";
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -207,7 +208,7 @@ bool Playground::OpenPlaygroundHere(Renderer::RenderCallback render_callback) {
|
||||
};
|
||||
|
||||
if (!renderer_.Render(surface, wrapped_callback)) {
|
||||
FML_LOG(ERROR) << "Could not render into the surface.";
|
||||
VALIDATION_LOG << "Could not render into the surface.";
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -228,7 +229,7 @@ std::shared_ptr<Texture> Playground::CreateTextureForFixture(
|
||||
// simplicity.
|
||||
auto image = compressed_image.Decode().ConvertToRGBA();
|
||||
if (!image.IsValid()) {
|
||||
FML_LOG(ERROR) << "Could not find fixture named " << fixture_name;
|
||||
VALIDATION_LOG << "Could not find fixture named " << fixture_name;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -241,7 +242,7 @@ std::shared_ptr<Texture> Playground::CreateTextureForFixture(
|
||||
renderer_.GetContext()->GetPermanentsAllocator()->CreateTexture(
|
||||
StorageMode::kHostVisible, texture_descriptor);
|
||||
if (!texture) {
|
||||
FML_LOG(ERROR) << "Could not allocate texture for fixture " << fixture_name;
|
||||
VALIDATION_LOG << "Could not allocate texture for fixture " << fixture_name;
|
||||
return nullptr;
|
||||
}
|
||||
texture->SetLabel(fixture_name);
|
||||
@@ -249,7 +250,7 @@ std::shared_ptr<Texture> Playground::CreateTextureForFixture(
|
||||
auto uploaded = texture->SetContents(image.GetAllocation()->GetMapping(),
|
||||
image.GetAllocation()->GetSize());
|
||||
if (!uploaded) {
|
||||
FML_LOG(ERROR) << "Could not upload texture to device memory for fixture "
|
||||
VALIDATION_LOG << "Could not upload texture to device memory for fixture "
|
||||
<< fixture_name;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
|
||||
#include "flutter/fml/build_config.h"
|
||||
#include "flutter/fml/logging.h"
|
||||
#include "impeller/base/validation.h"
|
||||
#include "impeller/renderer/backend/metal/device_buffer_mtl.h"
|
||||
#include "impeller/renderer/backend/metal/formats_mtl.h"
|
||||
#include "impeller/renderer/backend/metal/texture_mtl.h"
|
||||
@@ -113,7 +114,7 @@ std::shared_ptr<Texture> AllocatorMTL::CreateTexture(
|
||||
auto mtl_texture_desc = ToMTLTextureDescriptor(desc);
|
||||
|
||||
if (!mtl_texture_desc) {
|
||||
FML_DLOG(ERROR) << "Texture descriptor was invalid.";
|
||||
VALIDATION_LOG << "Texture descriptor was invalid.";
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ static NSArray<id<MTLLibrary>>* ShaderLibrariesFromFiles(
|
||||
NSMutableArray<id<MTLLibrary>>* found_libraries = [NSMutableArray array];
|
||||
for (const auto& library_path : libraries_paths) {
|
||||
if (!fml::IsFile(library_path)) {
|
||||
FML_LOG(ERROR) << "Shader library does not exist at path '"
|
||||
VALIDATION_LOG << "Shader library does not exist at path '"
|
||||
<< library_path << "'";
|
||||
continue;
|
||||
}
|
||||
@@ -61,7 +61,7 @@ ContextMTL::ContextMTL(const std::vector<std::string>& libraries_paths)
|
||||
auto library = std::shared_ptr<ShaderLibraryMTL>(new ShaderLibraryMTL(
|
||||
ShaderLibrariesFromFiles(device_, libraries_paths)));
|
||||
if (!library->IsValid()) {
|
||||
FML_DLOG(ERROR) << "Could not create valid Metal shader library.";
|
||||
VALIDATION_LOG << "Could not create valid Metal shader library.";
|
||||
return;
|
||||
}
|
||||
shader_library_ = std::move(library);
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#include "impeller/renderer/backend/metal/device_buffer_mtl.h"
|
||||
|
||||
#include "flutter/fml/logging.h"
|
||||
#include "impeller/base/validation.h"
|
||||
#include "impeller/renderer/backend/metal/formats_mtl.h"
|
||||
#include "impeller/renderer/backend/metal/texture_mtl.h"
|
||||
|
||||
@@ -29,7 +30,7 @@ std::shared_ptr<Texture> DeviceBufferMTL::MakeTexture(TextureDescriptor desc,
|
||||
|
||||
// Avoid overruns.
|
||||
if (offset + desc.GetSizeOfBaseMipLevel() > size_) {
|
||||
FML_DLOG(ERROR) << "Avoiding buffer overrun when creating texture.";
|
||||
VALIDATION_LOG << "Avoiding buffer overrun when creating texture.";
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
@@ -4,6 +4,8 @@
|
||||
|
||||
#include "impeller/renderer/backend/metal/texture_mtl.h"
|
||||
|
||||
#include "impeller/base/validation.h"
|
||||
|
||||
namespace impeller {
|
||||
|
||||
TextureMTL::TextureMTL(TextureDescriptor p_desc, id<MTLTexture> texture)
|
||||
@@ -15,8 +17,7 @@ TextureMTL::TextureMTL(TextureDescriptor p_desc, id<MTLTexture> texture)
|
||||
}
|
||||
|
||||
if (desc.size != GetSize()) {
|
||||
FML_DLOG(ERROR)
|
||||
<< "The texture and its descriptor disagree about its size.";
|
||||
VALIDATION_LOG << "The texture and its descriptor disagree about its size.";
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#include "impeller/renderer/backend/metal/vertex_descriptor_mtl.h"
|
||||
|
||||
#include "flutter/fml/logging.h"
|
||||
#include "impeller/base/validation.h"
|
||||
|
||||
namespace impeller {
|
||||
|
||||
@@ -176,7 +177,7 @@ bool VertexDescriptorMTL::SetStageInputs(
|
||||
const auto& input = inputs[i];
|
||||
auto vertex_format = ReadStageInputFormat(input);
|
||||
if (vertex_format == MTLVertexFormatInvalid) {
|
||||
FML_LOG(ERROR) << "Format for input " << input.name << " not supported.";
|
||||
VALIDATION_LOG << "Format for input " << input.name << " not supported.";
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -74,13 +74,13 @@ class PipelineT {
|
||||
using Builder = PipelineBuilder<VertexShader, FragmentShader>;
|
||||
|
||||
explicit PipelineT(const Context& context)
|
||||
: pipeline_future_(CreatePipelineFuture(
|
||||
: PipelineT(CreatePipelineFuture(
|
||||
context,
|
||||
Builder::MakeDefaultPipelineDescriptor(context))) {}
|
||||
|
||||
explicit PipelineT(const Context& context,
|
||||
std::optional<PipelineDescriptor> desc)
|
||||
: pipeline_future_(CreatePipelineFuture(context, desc)) {}
|
||||
: PipelineT(CreatePipelineFuture(context, desc)) {}
|
||||
|
||||
explicit PipelineT(PipelineFuture future)
|
||||
: pipeline_future_(std::move(future)) {}
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#include "impeller/renderer/renderer.h"
|
||||
|
||||
#include "flutter/fml/logging.h"
|
||||
#include "impeller/base/validation.h"
|
||||
#include "impeller/renderer/command_buffer.h"
|
||||
#include "impeller/renderer/surface.h"
|
||||
|
||||
@@ -69,7 +70,7 @@ bool Renderer::Render(const Surface& surface,
|
||||
[sema = frames_in_flight_sema_](CommandBuffer::Status result) {
|
||||
sema->Signal();
|
||||
if (result != CommandBuffer::Status::kCompleted) {
|
||||
FML_LOG(ERROR) << "Could not commit command buffer.";
|
||||
VALIDATION_LOG << "Could not commit command buffer.";
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user