Skip to content

Commit

Permalink
ShaderUniforms::set Float3/Float3Array/Float3x3/Float3x3Array which…
Browse files Browse the repository at this point in the history
… also takes `blockTypeName` and `blockInstanceName`

Summary: `ShaderUniforms::set Float3/Float3Array/Float3x3/Float3x3Array` which also takes `blockTypeName` and `blockInstanceName`

Reviewed By: syeh1

Differential Revision: D50436124

fbshipit-source-id: de652ab8cc7822c68624de3bcea6dcc3692d1e72
  • Loading branch information
AmesingFlank authored and facebook-github-bot committed Oct 19, 2023
1 parent 9c345eb commit 602731a
Show file tree
Hide file tree
Showing 2 changed files with 75 additions and 0 deletions.
53 changes: 53 additions & 0 deletions IGLU/simple_renderer/ShaderUniforms.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -415,13 +415,37 @@ void ShaderUniforms::setFloat3(const igl::NameHandle& uniformName,
setUniformBytes(uniformName, &value, sizeof(float[3]), 1, arrayIndex);
}

void ShaderUniforms::setFloat3(const igl::NameHandle& blockTypeName,
const igl::NameHandle& blockInstanceName,
const igl::NameHandle& memberName,
const iglu::simdtypes::float3& value,
size_t arrayIndex) {
setUniformBytes(
blockTypeName, blockInstanceName, memberName, &value, sizeof(float[3]), 1, arrayIndex);
}

void ShaderUniforms::setFloat3Array(const igl::NameHandle& uniformName,
iglu::simdtypes::float3* value,
size_t count,
size_t arrayIndex) {
setUniformBytes(uniformName, value, sizeof(iglu::simdtypes::float3), count, arrayIndex);
}

void ShaderUniforms::setFloat3Array(const igl::NameHandle& blockTypeName,
const igl::NameHandle& blockInstanceName,
const igl::NameHandle& memberName,
iglu::simdtypes::float3* value,
size_t count,
size_t arrayIndex) {
setUniformBytes(blockTypeName,
blockInstanceName,
memberName,
value,
sizeof(iglu::simdtypes::float3),
count,
arrayIndex);
}

void ShaderUniforms::setFloat4(const igl::NameHandle& uniformName,
const iglu::simdtypes::float4& value,
size_t arrayIndex) {
Expand Down Expand Up @@ -512,13 +536,42 @@ void ShaderUniforms::setFloat3x3(const igl::NameHandle& uniformName,
setUniformBytes(uniformName, &value, sizeof(iglu::simdtypes::float3x3), 1, arrayIndex);
}

void ShaderUniforms::setFloat3x3(const igl::NameHandle& blockTypeName,
const igl::NameHandle& blockInstanceName,
const igl::NameHandle& memberName,
const iglu::simdtypes::float3x3& value,
size_t arrayIndex) {
setUniformBytes(blockTypeName,
blockInstanceName,
memberName,
&value,
sizeof(iglu::simdtypes::float3x3),
1,
arrayIndex);
}

void ShaderUniforms::setFloat3x3Array(const igl::NameHandle& uniformName,
const iglu::simdtypes::float3x3* value,
size_t count,
size_t arrayIndex) {
setUniformBytes(uniformName, value, sizeof(iglu::simdtypes::float3x3), count, arrayIndex);
}

void ShaderUniforms::setFloat3x3Array(const igl::NameHandle& blockTypeName,
const igl::NameHandle& blockInstanceName,
const igl::NameHandle& memberName,
const iglu::simdtypes::float3x3* value,
size_t count,
size_t arrayIndex) {
setUniformBytes(blockTypeName,
blockInstanceName,
memberName,
value,
sizeof(iglu::simdtypes::float3x3),
count,
arrayIndex);
}

void ShaderUniforms::setFloat4x4(const igl::NameHandle& uniformName,
const iglu::simdtypes::float4x4& value,
size_t arrayIndex) {
Expand Down
22 changes: 22 additions & 0 deletions IGLU/simple_renderer/ShaderUniforms.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,21 @@ class ShaderUniforms final {
void setFloat3(const igl::NameHandle& uniformName,
const iglu::simdtypes::float3& value,
size_t arrayIndex = 0);
void setFloat3(const igl::NameHandle& blockTypeName,
const igl::NameHandle& blockInstanceName,
const igl::NameHandle& memberName,
const iglu::simdtypes::float3& value,
size_t arrayIndex = 0);
void setFloat3Array(const igl::NameHandle& uniformName,
iglu::simdtypes::float3* value,
size_t count = 1,
size_t arrayIndex = 0);
void setFloat3Array(const igl::NameHandle& blockTypeName,
const igl::NameHandle& blockInstanceName,
const igl::NameHandle& memberName,
iglu::simdtypes::float3* value,
size_t count = 1,
size_t arrayIndex = 0);

void setFloat4(const igl::NameHandle& uniformName,
const iglu::simdtypes::float4& value,
Expand Down Expand Up @@ -129,10 +140,21 @@ class ShaderUniforms final {
void setFloat3x3(const igl::NameHandle& uniformName,
const iglu::simdtypes::float3x3& value,
size_t arrayIndex = 0);
void setFloat3x3(const igl::NameHandle& blockTypeName,
const igl::NameHandle& blockInstanceName,
const igl::NameHandle& memberName,
const iglu::simdtypes::float3x3& value,
size_t arrayIndex = 0);
void setFloat3x3Array(const igl::NameHandle& uniformName,
const iglu::simdtypes::float3x3* value,
size_t count = 1,
size_t arrayIndex = 0);
void setFloat3x3Array(const igl::NameHandle& blockTypeName,
const igl::NameHandle& blockInstanceName,
const igl::NameHandle& memberName,
const iglu::simdtypes::float3x3* value,
size_t count = 1,
size_t arrayIndex = 0);

void setFloat4x4(const igl::NameHandle& uniformName,
const iglu::simdtypes::float4x4& value,
Expand Down

0 comments on commit 602731a

Please sign in to comment.