Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit 8db2e66

Browse files
authored
[Impeller] Cast chat8_t* to char* for MSSTL compat (#36223)
1 parent 54c8772 commit 8db2e66

File tree

2 files changed

+24
-16
lines changed

2 files changed

+24
-16
lines changed

impeller/compiler/impellerc_main.cc

Lines changed: 22 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -90,9 +90,10 @@ bool Main(const fml::CommandLine& command_line) {
9090

9191
auto spriv_file_name = std::filesystem::absolute(
9292
std::filesystem::current_path() / switches.spirv_file_name);
93-
if (!fml::WriteAtomically(*switches.working_directory,
94-
spriv_file_name.u8string().c_str(),
95-
*compiler.GetSPIRVAssembly())) {
93+
if (!fml::WriteAtomically(
94+
*switches.working_directory,
95+
reinterpret_cast<const char*>(spriv_file_name.u8string().c_str()),
96+
*compiler.GetSPIRVAssembly())) {
9697
std::cerr << "Could not write file to " << switches.spirv_file_name
9798
<< std::endl;
9899
return false;
@@ -118,9 +119,10 @@ bool Main(const fml::CommandLine& command_line) {
118119
std::cerr << "Runtime stage data could not be created." << std::endl;
119120
return false;
120121
}
121-
if (!fml::WriteAtomically(*switches.working_directory, //
122-
sl_file_name.u8string().c_str(), //
123-
*stage_data_mapping //
122+
if (!fml::WriteAtomically(*switches.working_directory, //
123+
reinterpret_cast<const char*>(
124+
sl_file_name.u8string().c_str()), //
125+
*stage_data_mapping //
124126
)) {
125127
std::cerr << "Could not write file to " << switches.sl_file_name
126128
<< std::endl;
@@ -132,9 +134,10 @@ bool Main(const fml::CommandLine& command_line) {
132134
return false;
133135
}
134136
} else {
135-
if (!fml::WriteAtomically(*switches.working_directory,
136-
sl_file_name.u8string().c_str(),
137-
*compiler.GetSLShaderSource())) {
137+
if (!fml::WriteAtomically(
138+
*switches.working_directory,
139+
reinterpret_cast<const char*>(sl_file_name.u8string().c_str()),
140+
*compiler.GetSLShaderSource())) {
138141
std::cerr << "Could not write file to " << switches.sl_file_name
139142
<< std::endl;
140143
return false;
@@ -148,7 +151,8 @@ bool Main(const fml::CommandLine& command_line) {
148151
std::filesystem::current_path() / switches.reflection_json_name);
149152
if (!fml::WriteAtomically(
150153
*switches.working_directory,
151-
reflection_json_name.u8string().c_str(),
154+
reinterpret_cast<const char*>(
155+
reflection_json_name.u8string().c_str()),
152156
*compiler.GetReflector()->GetReflectionJSON())) {
153157
std::cerr << "Could not write reflection json to "
154158
<< switches.reflection_json_name << std::endl;
@@ -162,7 +166,8 @@ bool Main(const fml::CommandLine& command_line) {
162166
switches.reflection_header_name.c_str());
163167
if (!fml::WriteAtomically(
164168
*switches.working_directory,
165-
reflection_header_name.u8string().c_str(),
169+
reinterpret_cast<const char*>(
170+
reflection_header_name.u8string().c_str()),
166171
*compiler.GetReflector()->GetReflectionHeader())) {
167172
std::cerr << "Could not write reflection header to "
168173
<< switches.reflection_header_name << std::endl;
@@ -175,7 +180,8 @@ bool Main(const fml::CommandLine& command_line) {
175180
std::filesystem::absolute(std::filesystem::current_path() /
176181
switches.reflection_cc_name.c_str());
177182
if (!fml::WriteAtomically(*switches.working_directory,
178-
reflection_cc_name.u8string().c_str(),
183+
reinterpret_cast<const char*>(
184+
reflection_cc_name.u8string().c_str()),
179185
*compiler.GetReflector()->GetReflectionCC())) {
180186
std::cerr << "Could not write reflection CC to "
181187
<< switches.reflection_cc_name << std::endl;
@@ -204,9 +210,10 @@ bool Main(const fml::CommandLine& command_line) {
204210
}
205211
auto depfile_path = std::filesystem::absolute(
206212
std::filesystem::current_path() / switches.depfile_path.c_str());
207-
if (!fml::WriteAtomically(*switches.working_directory,
208-
depfile_path.u8string().c_str(),
209-
*compiler.CreateDepfileContents({result_file}))) {
213+
if (!fml::WriteAtomically(
214+
*switches.working_directory,
215+
reinterpret_cast<const char*>(depfile_path.u8string().c_str()),
216+
*compiler.CreateDepfileContents({result_file}))) {
210217
std::cerr << "Could not write depfile to " << switches.depfile_path
211218
<< std::endl;
212219
return false;

impeller/compiler/utilities.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ namespace impeller {
1212
namespace compiler {
1313

1414
std::string InferShaderNameFromPath(std::string_view path) {
15-
return std::filesystem::path{path}.stem().u8string();
15+
return reinterpret_cast<const char*>(
16+
std::filesystem::path{path}.stem().u8string().c_str());
1617
}
1718

1819
std::string ConvertToCamelCase(std::string_view string) {

0 commit comments

Comments
 (0)