Skip to content
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

domeLight.glslfx doesn't support Apple's Metal #1656

Closed
MrKepzie opened this issue Oct 15, 2021 · 1 comment
Closed

domeLight.glslfx doesn't support Apple's Metal #1656

MrKepzie opened this issue Oct 15, 2021 · 1 comment

Comments

@MrKepzie
Copy link

MrKepzie commented Oct 15, 2021

When using latest USD on macOS, the domeLight.glslfx compute shader fails to compile on Metal.
This is due to a few GL hard-coding in the shader which makes the shader generator fail to recognize/replace tokens, such as hd_GlobalInvocationID.

Based on other uses of HdStGLSLProgram::GetComputeProgram, seems like there's something to pass to setup the kernel parameters, including output texture

Log:

Compilation failed: 

program_source:203:2: error: invalid preprocessing directive
#version 430
 ^
program_source:208:8: error: C++ requires a type specifier for all declarations
layout(binding = 0) uniform sampler2D inTexture;
       ^
program_source:208:1: error: C++ requires a type specifier for all declarations
layout(binding = 0) uniform sampler2D inTexture;
^
program_source:208:20: error: expected ';' at end of declaration list
layout(binding = 0) uniform sampler2D inTexture;
                   ^
                   ;
program_source:209:8: error: C++ requires a type specifier for all declarations
layout(rgba16f, binding = 1) uniform image2D outTexture;
       ^
program_source:209:17: error: C++ requires a type specifier for all declarations
layout(rgba16f, binding = 1) uniform image2D outTexture;
                ^
program_source:209:1: error: C++ requires a type specifier for all declarations
layout(rgba16f, binding = 1) uniform image2D outTexture;
^
program_source:209:29: error: expected ';' at end of declaration list
layout(rgba16f, binding = 1) uniform image2D outTexture;
                            ^
                            ;
program_source:243:8: error: C++ requires a type specifier for all declarations
layout(local_size_x = 32, local_size_y = 32) in;
       ^
program_source:243:27: error: C++ requires a type specifier for all declarations
layout(local_size_x = 32, local_size_y = 32) in;
                          ^
program_source:243:1: error: C++ requires a type specifier for all declarations
layout(local_size_x = 32, local_size_y = 32) in;
^
program_source:214:30: error: use of undeclared identifier 'outTexture'
    vec2 outDims = imageSize(outTexture);
                             ^
program_source:216:33: error: implicit conversions between vector types ('int2' (vector of 2 'int' values) and 'float2' (vector of 2 'float' values)) are not permitted
    vec2 texCoords = (outCoords + vec2(0.5, 0.5)) / outDims;
                                ^
program_source:224:23: error: use of undeclared identifier 'inTexture'
    return textureLod(inTexture, coord, sampleLod).rgb;
                      ^
program_source:252:32: error: use of undeclared identifier 'inTexture'
    ivec2 inDims = textureSize(inTexture, 0);
                               ^
program_source:283:29: error: use of undeclared identifier 'gl_GlobalInvocationID'
    ivec2 outCoords = ivec2(gl_GlobalInvocationID.xy);
                            ^
program_source:289:16: error: use of undeclared identifier 'outTexture'
    imageStore(outTexture, outCoords, outColor);
               ^
@jilliene
Copy link

Filed as internal issue #USD-6970

pixar-oss pushed a commit that referenced this issue Nov 16, 2021
HgiShaderFunctionDesc, allowing client to specify the desired number of threads
in the local compute work group for a computer shader. HgiShaderGenerator now
handles the writing of this local size to the shader, if necessary.

The HgiComputeCmds::Dispatch() function for HgiGL and HgiVulkan will now use
the local size provided by the HgiShaderFunctionDesc to determine number of
work groups to dispatch. Calls to Dispatch() should specify the total size of
the compute work (and not the total work size / local work size), and the
backend will handle determining the number of work groups.

Also adds some limit checks on work group size and number of work groups based
on device limits.

See #1656

(Internal change: 2199330)
pixar-oss pushed a commit that referenced this issue Nov 25, 2021
…akes some

progress towards getting the dome light computations to run on Metal.

See #1656

(Internal change: 2200704)
(Internal change: 2201198)
lkerley pushed a commit to imageworks/USD that referenced this issue Jan 7, 2022
HgiShaderFunctionDesc, allowing client to specify the desired number of threads
in the local compute work group for a computer shader. HgiShaderGenerator now
handles the writing of this local size to the shader, if necessary.

The HgiComputeCmds::Dispatch() function for HgiGL and HgiVulkan will now use
the local size provided by the HgiShaderFunctionDesc to determine number of
work groups to dispatch. Calls to Dispatch() should specify the total size of
the compute work (and not the total work size / local work size), and the
backend will handle determining the number of work groups.

Also adds some limit checks on work group size and number of work groups based
on device limits.

See PixarAnimationStudios#1656

(Internal change: 2199330)
lkerley pushed a commit to imageworks/USD that referenced this issue Jan 7, 2022
…akes some

progress towards getting the dome light computations to run on Metal.

See PixarAnimationStudios#1656

(Internal change: 2200704)
(Internal change: 2201198)
pixar-oss pushed a commit that referenced this issue Feb 25, 2022
fullscreen shader pipelines.

Contribution: Jon Creighton

See #1656

(Internal change: 2217440)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants