Speculative fixes for Windows build
This commit is contained in:
Dan Field
2022-04-19 21:04:03 -07:00
committed by Dan Field
parent 855ef1ba64
commit b433a73aa4
10 changed files with 30 additions and 9 deletions

View File

@@ -4,6 +4,8 @@
#include "impeller/base/comparable.h"
#include <atomic>
namespace impeller {
static std::atomic_size_t sLastID;

View File

@@ -5,6 +5,7 @@
#pragma once
#include <memory>
#include <mutex>
#include <thread>
#include "flutter/fml/macros.h"

View File

@@ -52,9 +52,9 @@ bool Main(const fml::CommandLine& command_line) {
reflector_options.shader_name =
InferShaderNameFromPath(switches.source_file_name);
reflector_options.header_file_name =
std::filesystem::path{switches.reflection_header_name}
.filename()
.native();
ToUtf8(std::filesystem::path{switches.reflection_header_name}
.filename()
.native());
Compiler compiler(*source_file_mapping, options, reflector_options);
if (!compiler.IsValid()) {

View File

@@ -62,10 +62,10 @@ static TargetPlatform TargetPlatformFromCommandLine(
Switches::Switches(const fml::CommandLine& command_line)
: target_platform(TargetPlatformFromCommandLine(command_line)),
working_directory(std::make_shared<fml::UniqueFD>(
fml::OpenDirectory(std::filesystem::current_path().native().c_str(),
false, // create if necessary,
fml::FilePermission::kRead))),
working_directory(std::make_shared<fml::UniqueFD>(fml::OpenDirectory(
ToUtf8(std::filesystem::current_path().native()).c_str(),
false, // create if necessary,
fml::FilePermission::kRead))),
source_file_name(command_line.GetOptionValueWithDefault("input", "")),
sl_file_name(command_line.GetOptionValueWithDefault("sl", "")),
spirv_file_name(command_line.GetOptionValueWithDefault("spirv", "")),

View File

@@ -12,6 +12,7 @@
#include "flutter/fml/unique_fd.h"
#include "impeller/compiler/compiler.h"
#include "impeller/compiler/include_dir.h"
#include "impeller/compiler/types.h"
namespace impeller {
namespace compiler {

View File

@@ -60,7 +60,7 @@ static std::string UniqueEntryPointFunctionNameFromSourceName(
SourceType type) {
std::stringstream stream;
std::filesystem::path file_path(file_name);
stream << file_path.stem().native() << "_";
stream << ToUtf8(file_path.stem().native()) << "_";
switch (type) {
case SourceType::kUnknown:
stream << "unknown";
@@ -212,5 +212,14 @@ std::string TargetPlatformSLExtension(TargetPlatform platform) {
FML_UNREACHABLE();
}
std::string ToUtf8(const std::wstring& wstring) {
std::wstring_convert<std::codecvt_utf8<wchar_t>> myconv;
return myconv.to_bytes(wstring);
}
std::string ToUtf8(const std::string& string) {
return string;
}
} // namespace compiler
} // namespace impeller

View File

@@ -4,6 +4,8 @@
#pragma once
#include <codecvt>
#include <locale>
#include <string>
#include "flutter/fml/macros.h"
@@ -54,5 +56,9 @@ spv::ExecutionModel ToExecutionModel(SourceType type);
spirv_cross::CompilerMSL::Options::Platform TargetPlatformToMSLPlatform(
TargetPlatform platform);
std::string ToUtf8(const std::wstring& wstring);
std::string ToUtf8(const std::string& string);
} // namespace compiler
} // namespace impeller

View File

@@ -6,6 +6,7 @@
#include <filesystem>
#include <sstream>
#include <string>
namespace impeller {
namespace compiler {

View File

@@ -147,7 +147,7 @@ struct TRect {
constexpr std::array<TPoint<T>, 4> GetTransformedPoints(
const Matrix& transform) const {
auto points = GetPoints();
for (uint i = 0; i < points.size(); i++) {
for (int i = 0; i < points.size(); i++) {
points[i] = transform * points[i];
}
return points;

View File

@@ -4,6 +4,7 @@
#pragma once
#include <algorithm>
#include <cmath>
#include <limits>
#include <ostream>