Skip to content

Commit

Permalink
Fix { and address code review comments
Browse files Browse the repository at this point in the history
Signed-off-by: Rosie Wang <[email protected]>
  • Loading branch information
wRosie committed Aug 19, 2024
1 parent 5befeb7 commit 1f0fdb2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
8 changes: 6 additions & 2 deletions src/OpenColorIO/GpuShaderUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -223,9 +223,12 @@ std::string getMatrixValues(const T * mtx, GpuLanguage lang, bool transpose)
}


void RGBtoRGBATexture(const float* lutValues, int valueCount, std::vector<float>& float4AdaptedLutValues){
void RGBtoRGBATexture(const float* lutValues, int valueCount, std::vector<float>& float4AdaptedLutValues)
{
if(valueCount % 3 != 0)
{
throw Exception("Value count should be divisible by 3.");
}

valueCount = valueCount * 4 / 3;
if(lutValues != nullptr)
Expand All @@ -235,7 +238,8 @@ void RGBtoRGBATexture(const float* lutValues, int valueCount, std::vector<float>
float *rgbaLutValuesIt = float4AdaptedLutValues.data();
const float *end = rgbaLutValuesIt + valueCount;

while(rgbaLutValuesIt != end) {
while(rgbaLutValuesIt != end)
{
*rgbaLutValuesIt++ = *rgbLutValuesIt++;
*rgbaLutValuesIt++ = *rgbLutValuesIt++;
*rgbaLutValuesIt++ = *rgbLutValuesIt++;
Expand Down
5 changes: 3 additions & 2 deletions src/OpenColorIO/ops/lut1d/Lut1DOpGPU.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -186,9 +186,10 @@ void GetLut1DGPUShaderProgram(GpuShaderCreatorRcPtr & shaderCreator,
CreatePaddedLutChannels(width, height, lutData->getArray().getValues(), values);
channel = GpuShaderCreator::TEXTURE_RGB_CHANNEL;
break;
case 4: {
case 4:
{
std::vector<float> paddedChannels;
values.reserve(width * height * 3);
paddedChannels.reserve(width * height * 3);
CreatePaddedLutChannels(width, height, lutData->getArray().getValues(), paddedChannels);
// Insert a place holder alpha channel with value of 1. This is to support RGBA
// texture format for Metal shading language.
Expand Down

0 comments on commit 1f0fdb2

Please sign in to comment.