Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…mpute_texture_pingpong

https://bugs.webkit.org/show_bug.cgi?id=264272
rdar://118009042

Reviewed by Mike Wyrzykowski.

During code generation we were cleaning out the flag that we needed to generate
the division helper, but that is incorrect, since the flag is only set during
type checking, so it won't be set for subsequent compilations. The reason the other
similar flags around it need to be cleaned is that they are set during compilation
instead of checking. This whole system needs to be rafactored soon, but in the
mean time this fixes the sample.

* Source/WebGPU/WGSL/Metal/MetalFunctionWriter.cpp:
(WGSL::Metal::FunctionDefinitionWriter::emitNecessaryHelpers):
* Source/WebGPU/WGSL/WGSLShaderModule.h:
(WGSL::ShaderModule::setUsesWorkgroupUniformLoad):
(WGSL::ShaderModule::setUsesDivision):
(WGSL::ShaderModule::clearUsesWorkgroupUniformLoad): Deleted.
(WGSL::ShaderModule::clearUsesDivision): Deleted.

Canonical link: https://commits.webkit.org/270328@main
  • Loading branch information
tadeuzagallo committed Nov 7, 2023
1 parent a431b35 commit 3944b4d
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 4 deletions.
2 changes: 0 additions & 2 deletions Source/WebGPU/WGSL/Metal/MetalFunctionWriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,6 @@ void FunctionDefinitionWriter::emitNecessaryHelpers()
}

if (m_callGraph.ast().usesWorkgroupUniformLoad()) {
m_callGraph.ast().clearUsesWorkgroupUniformLoad();
m_stringBuilder.append(m_indent, "template<typename T>\n");
m_stringBuilder.append(m_indent, "T __workgroup_uniform_load(threadgroup T* const ptr)\n");
m_stringBuilder.append(m_indent, "{\n");
Expand All @@ -230,7 +229,6 @@ void FunctionDefinitionWriter::emitNecessaryHelpers()
}

if (m_callGraph.ast().usesDivision()) {
m_callGraph.ast().clearUsesDivision();
m_stringBuilder.append(m_indent, "template<typename T, typename U, typename V = conditional_t<is_scalar_v<U>, T, U>>\n");
m_stringBuilder.append(m_indent, "V __wgslDiv(T lhs, U rhs)\n");
m_stringBuilder.append(m_indent, "{\n");
Expand Down
2 changes: 0 additions & 2 deletions Source/WebGPU/WGSL/WGSLShaderModule.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,9 @@ class ShaderModule {

bool usesWorkgroupUniformLoad() const { return m_usesWorkgroupUniformLoad; }
void setUsesWorkgroupUniformLoad() { m_usesWorkgroupUniformLoad = true; }
void clearUsesWorkgroupUniformLoad() { m_usesWorkgroupUniformLoad = false; }

bool usesDivision() const { return m_usesDivision; }
void setUsesDivision() { m_usesDivision = true; }
void clearUsesDivision() { m_usesDivision = false; }

template<typename T>
std::enable_if_t<std::is_base_of_v<AST::Node, T>, void> replace(T* current, T&& replacement)
Expand Down

0 comments on commit 3944b4d

Please sign in to comment.