Skip to content

Commit

Permalink
ManagedUniformBuffer support OpenGL ComputeNode
Browse files Browse the repository at this point in the history
Differential Revision: D67106593

fbshipit-source-id: f871f75f0dbef1f6776e1023f00f0c1c7383af5f
  • Loading branch information
Ren Liu authored and facebook-github-bot committed Dec 13, 2024
1 parent 04f0e6a commit 7b7fe71
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
13 changes: 11 additions & 2 deletions IGLU/managedUniformBuffer/ManagedUniformBuffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -150,9 +150,18 @@ void ManagedUniformBuffer::bind(const igl::IDevice& device,
}
}

void ManagedUniformBuffer::bind(const igl::IDevice& device, igl::IComputeCommandEncoder& encoder) {
void ManagedUniformBuffer::bind(const igl::IDevice& device,
const igl::IComputePipelineState& pipelineState,
igl::IComputeCommandEncoder& encoder) {
if (device.getBackendType() == igl::BackendType::OpenGL) {
IGL_DEBUG_ABORT("No ComputeEncoder supported for OpenGL\n");
for (auto& uniform : uniformInfo.uniforms) {
uniform.location = pipelineState.getIndexByName(igl::genNameHandle(uniform.name));
if (uniform.location >= 0) {
encoder.bindUniform(uniform, data_);
} else {
IGL_LOG_ERROR_ONCE("The uniform %s was not found in shader\n", uniform.name.c_str());
}
}
} else {
if (useBindBytes_) {
encoder.bindBytes(uniformInfo.index, data_, length_);
Expand Down
4 changes: 3 additions & 1 deletion IGLU/managedUniformBuffer/ManagedUniformBuffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@ class ManagedUniformBuffer {
void bind(const igl::IDevice& device,
const igl::IRenderPipelineState& pipelineState,
igl::IRenderCommandEncoder& encoder);
void bind(const igl::IDevice& device, igl::IComputeCommandEncoder& encoder);
void bind(const igl::IDevice& device,
const igl::IComputePipelineState& pipelineState,
igl::IComputeCommandEncoder& encoder);

void* getData();

Expand Down

0 comments on commit 7b7fe71

Please sign in to comment.