Skip to content

Commit 54cd0fc

Browse files
authored
bugfix: remove extra include for string table (#1)
* bugfix: remove extra include for string table * fix test
1 parent 474e90b commit 54cd0fc

File tree

2 files changed

+2
-6
lines changed

2 files changed

+2
-6
lines changed

src/code-generator-static-impl.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -114,17 +114,14 @@ export class StaticCodeGenerator implements CodeGenerator, SourceBuilder {
114114
return code.join("");
115115
}
116116

117-
#buildGenerateIndex(repo: TemplateRepository<TemplatePass2>, includePathPrefix: string): string {
117+
#buildGenerateIndex(repo: TemplateRepository<TemplatePass2>): string {
118118
const indexContent = [];
119119
indexContent.push("// This file is auto-generated by wgsl-gen. Do not edit manually.");
120120
indexContent.push("");
121121
//indexContent.push("#pragma once");
122122
indexContent.push("#ifndef INCLUDED_BY_WGSL_GEN_HEADER");
123123
indexContent.push('#error "This file is expected to be included by wgsl-gen header. Do not include it directly."');
124124
indexContent.push("#endif");
125-
if (this.#stringTable) {
126-
indexContent.push(`#include "${includePathPrefix}wgsl_gen/string_table.h"`);
127-
}
128125
indexContent.push("");
129126
for (const [name, template] of repo.templates) {
130127
indexContent.push(`//`);
@@ -308,7 +305,7 @@ std::string pass_as_string(T&& v) {
308305
const result = new Map<string, TemplateBuildResult>();
309306

310307
// STEP.1. Generate the index.h
311-
result.set("index.h", this.#buildGenerateIndex(repo, options.includePathPrefix ?? ""));
308+
result.set("index.h", this.#buildGenerateIndex(repo));
312309

313310
// STEP.2. Generate the string table if needed
314311
if (this.#stringTable) {

test/testcases/build-basic/expected/static-cpp/index.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
#ifndef INCLUDED_BY_WGSL_GEN_HEADER
44
#error "This file is expected to be included by wgsl-gen header. Do not include it directly."
55
#endif
6-
#include "wgsl_gen/string_table.h"
76

87
//
98
// Template: shader/triangle.wgsl.template

0 commit comments

Comments
 (0)