-
Notifications
You must be signed in to change notification settings - Fork 475
Add RGBA format in GpuShaderCreator for better Metal support (Issue #1956) #1984
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 3 commits
5befeb7
1f0fdb2
0e66261
00237a1
69c7780
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,7 +10,6 @@ | |
#include "ops/lut3d/Lut3DOpGPU.h" | ||
#include "utils/StringUtils.h" | ||
|
||
|
||
namespace OCIO_NAMESPACE | ||
{ | ||
|
||
|
@@ -38,12 +37,30 @@ void GetLut3DGPUShaderProgram(GpuShaderCreatorRcPtr & shaderCreator, ConstLut3DO | |
{ | ||
samplerInterpolation = INTERP_NEAREST; | ||
} | ||
// (Using CacheID here to potentially allow reuse of existing textures.) | ||
shaderCreator->add3DTexture(name.c_str(), | ||
|
||
if(shaderCreator->getLanguage() == GPU_LANGUAGE_MSL_2_0){ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [Minor] Brace opening should be on the next line. |
||
unsigned edgelen = lutData->getGridSize(); | ||
std::vector<float> float4AdaptedLutValues; | ||
RGBtoRGBATexture(&lutData->getArray()[0], 3*edgelen*edgelen*edgelen, float4AdaptedLutValues); | ||
|
||
shaderCreator->add3DTexture(name.c_str(), | ||
GpuShaderText::getSamplerName(name).c_str(), | ||
lutData->getGridSize(), | ||
edgelen, | ||
GpuShaderCreator::TEXTURE_RGBA_CHANNEL, | ||
samplerInterpolation, | ||
&lutData->getArray()[0]); | ||
float4AdaptedLutValues.data()); | ||
} | ||
else | ||
{ | ||
// All other languages | ||
// (Using CacheID here to potentially allow reuse of existing textures.) | ||
shaderCreator->add3DTexture(name.c_str(), | ||
GpuShaderText::getSamplerName(name).c_str(), | ||
lutData->getGridSize(), | ||
GpuShaderCreator::TEXTURE_RGB_CHANNEL, | ||
samplerInterpolation, | ||
&lutData->getArray()[0]); | ||
} | ||
|
||
{ | ||
GpuShaderText ss(shaderCreator->getLanguage()); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -210,8 +210,9 @@ void RGB_to_RGBA(const float* lutValues, int valueCount, std::vector<float>& flo | |
const char * textureName = nullptr; | ||
const char * samplerName = nullptr; | ||
unsigned edgelen = 0; | ||
GpuShaderDesc::TextureType channel = GpuShaderDesc::TEXTURE_RGBA_CHANNEL; | ||
Interpolation interpolation = INTERP_LINEAR; | ||
m_shaderDesc->get3DTexture(idx, textureName, samplerName, edgelen, interpolation); | ||
m_shaderDesc->get3DTexture(idx, textureName, samplerName, edgelen, channel, interpolation); | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Following up on Remi's comment above, GitHub won't let me leave a comment at that line, but on line 233, AllocateTexture3D seems to assume it is getting an RGB array. It calls RGB_to_RGBA on it. Isn't the idea that this should not be necessary anymore? Are the Metal GPU unit tests passing on your local build? When I run "ctest -v" on your branch, I get a seg-fault in the Metal tests in the RGB_to_RGBA function. |
||
if(!textureName || !*textureName | ||
|| !samplerName || !*samplerName | ||
|
Uh oh!
There was an error while loading. Please reload this page.