Skip to content

Conversation

@bernie-laberge
Copy link
Contributor

@bernie-laberge bernie-laberge commented Nov 14, 2024

457: Fix OCIO failure with 1D LUTs of 2048 length

Linked issues

Fixes #457

Summarize your change.

Prevent shader collisions with 'uniform sampler1D' or 'uniform sampler2D' variables by adding a hash to the
array variable name to make it unique.
This was already done for other kinds of variables but not uniform sampler1D or sampler2D.

This is not an issue with OCIOv2 per say. This is an issue because Open RV combines the results of multiple shaders generated by OCIOv2 so Open RV needs to make the generated global variables unique.

Note that this issue happened with 1D LUTs of 2048 length because OCIOv2 uses different sampler types depending of the LUT size: a sampler1D for LUTs<=2048 entries, and a sampler2D type for LUTs>2048.

Solution

Similar to a previously fixed issue, we are now appending a hash to a uniform sampler1D or uniform sampler2D to make it really unique to prevent shader compilation errors.

Describe the reason for the change.

A specific OCIOv2 use case (#457) involving a 1D LUT with 2048 entries was not working in Open RV.
The following error was reported by Open RVl

ERROR: compiling program: 
      		with functions:  OCIO_l_identity_2048_sourceGroup000000_lookPipeline_0_5927894d66be2f09_0ResizeDownSampleDerivative SourcePlanarYUV OCIO_c_issue_space_2_scene_linear_sourceGroup000000_tolinPipeline_0_2744ed689522d6e3

ERROR: Multiple declarations of 'ocio_lut1d_0Sampler' have different types (sampler2D and sampler1D)
ERROR: failed to compile/select GL program: ERROR: failed to select the GL program

Describe what you have tested and on which operating system.

Successfully tested on macOS

Add a list of changes, and note any that might need special attention during the review.

If possible, provide screenshots.

@bernie-laberge bernie-laberge enabled auto-merge (squash) November 18, 2024 16:10
@bernie-laberge bernie-laberge merged commit faeef40 into AcademySoftwareFoundation:main Nov 20, 2024
2 checks passed
cedrik-fuoco-adsk added a commit to cedrik-fuoco-adsk/OpenRV that referenced this pull request Nov 28, 2024
…ndation#627)

### 457: Fix OCIO failure with 1D LUTs of 2048 length

### Linked issues
Fixes AcademySoftwareFoundation#457

### Summarize your change.

Prevent shader collisions with 'uniform sampler1D' or 'uniform
sampler2D' variables by adding a hash to the
array variable name to make it unique.
This was already done for other kinds of variables but not uniform
sampler1D or sampler2D.

This is not an issue with OCIOv2 per say. This is an issue because Open
RV combines the results of multiple shaders generated by OCIOv2 so Open
RV needs to make the generated global variables unique.

Note that this issue happened with 1D LUTs of 2048 length because OCIOv2
uses different sampler types depending of the LUT size: a sampler1D for
LUTs<=2048 entries, and a sampler2D type for LUTs>2048.

#### Solution
Similar to a previously fixed
[issue](AcademySoftwareFoundation@c7d1cd4#diff-1f024a562fd99e22efc42e11e6824c1f0c4259b1a6c7e80cb3b942a7f79e5603R1348),
we are now appending a hash to a uniform sampler1D or uniform sampler2D
to make it really unique to prevent shader compilation errors.

### Describe the reason for the change.

A specific OCIOv2 use case
(AcademySoftwareFoundation#457)
involving a 1D LUT with 2048 entries was not working in Open RV.
The following error was reported by Open RVl

```
ERROR: compiling program:
      		with functions:  OCIO_l_identity_2048_sourceGroup000000_lookPipeline_0_5927894d66be2f09_0ResizeDownSampleDerivative SourcePlanarYUV OCIO_c_issue_space_2_scene_linear_sourceGroup000000_tolinPipeline_0_2744ed689522d6e3

ERROR: Multiple declarations of 'ocio_lut1d_0Sampler' have different types (sampler2D and sampler1D)
ERROR: failed to compile/select GL program: ERROR: failed to select the GL program
```

### Describe what you have tested and on which operating system.
Successfully tested on macOS

### Add a list of changes, and note any that might need special
attention during the review.

### If possible, provide screenshots.

Signed-off-by: Bernard Laberge <[email protected]>
Co-authored-by: Cédrik Fuoco <[email protected]>
Signed-off-by: Cédrik Fuoco <[email protected]>
cedrik-fuoco-adsk added a commit to cedrik-fuoco-adsk/OpenRV that referenced this pull request Nov 28, 2024
…ndation#627)

### 457: Fix OCIO failure with 1D LUTs of 2048 length

### Linked issues
Fixes AcademySoftwareFoundation#457

### Summarize your change.

Prevent shader collisions with 'uniform sampler1D' or 'uniform
sampler2D' variables by adding a hash to the
array variable name to make it unique.
This was already done for other kinds of variables but not uniform
sampler1D or sampler2D.

This is not an issue with OCIOv2 per say. This is an issue because Open
RV combines the results of multiple shaders generated by OCIOv2 so Open
RV needs to make the generated global variables unique.

Note that this issue happened with 1D LUTs of 2048 length because OCIOv2
uses different sampler types depending of the LUT size: a sampler1D for
LUTs<=2048 entries, and a sampler2D type for LUTs>2048.

#### Solution
Similar to a previously fixed
[issue](AcademySoftwareFoundation@c7d1cd4#diff-1f024a562fd99e22efc42e11e6824c1f0c4259b1a6c7e80cb3b942a7f79e5603R1348),
we are now appending a hash to a uniform sampler1D or uniform sampler2D
to make it really unique to prevent shader compilation errors.

### Describe the reason for the change.

A specific OCIOv2 use case
(AcademySoftwareFoundation#457)
involving a 1D LUT with 2048 entries was not working in Open RV.
The following error was reported by Open RVl 

```
ERROR: compiling program: 
      		with functions:  OCIO_l_identity_2048_sourceGroup000000_lookPipeline_0_5927894d66be2f09_0ResizeDownSampleDerivative SourcePlanarYUV OCIO_c_issue_space_2_scene_linear_sourceGroup000000_tolinPipeline_0_2744ed689522d6e3

ERROR: Multiple declarations of 'ocio_lut1d_0Sampler' have different types (sampler2D and sampler1D)
ERROR: failed to compile/select GL program: ERROR: failed to select the GL program
```

### Describe what you have tested and on which operating system.
Successfully tested on macOS

### Add a list of changes, and note any that might need special
attention during the review.

### If possible, provide screenshots.

Signed-off-by: Bernard Laberge <[email protected]>
Co-authored-by: Cédrik Fuoco <[email protected]>
cedrik-fuoco-adsk added a commit to cedrik-fuoco-adsk/OpenRV that referenced this pull request Nov 28, 2024
…ndation#627)

### 457: Fix OCIO failure with 1D LUTs of 2048 length

### Linked issues
Fixes AcademySoftwareFoundation#457

### Summarize your change.

Prevent shader collisions with 'uniform sampler1D' or 'uniform
sampler2D' variables by adding a hash to the
array variable name to make it unique.
This was already done for other kinds of variables but not uniform
sampler1D or sampler2D.

This is not an issue with OCIOv2 per say. This is an issue because Open
RV combines the results of multiple shaders generated by OCIOv2 so Open
RV needs to make the generated global variables unique.

Note that this issue happened with 1D LUTs of 2048 length because OCIOv2
uses different sampler types depending of the LUT size: a sampler1D for
LUTs<=2048 entries, and a sampler2D type for LUTs>2048.

#### Solution
Similar to a previously fixed
[issue](AcademySoftwareFoundation@c7d1cd4#diff-1f024a562fd99e22efc42e11e6824c1f0c4259b1a6c7e80cb3b942a7f79e5603R1348),
we are now appending a hash to a uniform sampler1D or uniform sampler2D
to make it really unique to prevent shader compilation errors.

### Describe the reason for the change.

A specific OCIOv2 use case
(AcademySoftwareFoundation#457)
involving a 1D LUT with 2048 entries was not working in Open RV.
The following error was reported by Open RVl

```
ERROR: compiling program:
      		with functions:  OCIO_l_identity_2048_sourceGroup000000_lookPipeline_0_5927894d66be2f09_0ResizeDownSampleDerivative SourcePlanarYUV OCIO_c_issue_space_2_scene_linear_sourceGroup000000_tolinPipeline_0_2744ed689522d6e3

ERROR: Multiple declarations of 'ocio_lut1d_0Sampler' have different types (sampler2D and sampler1D)
ERROR: failed to compile/select GL program: ERROR: failed to select the GL program
```

### Describe what you have tested and on which operating system.
Successfully tested on macOS

### Add a list of changes, and note any that might need special
attention during the review.

### If possible, provide screenshots.

Signed-off-by: Bernard Laberge <[email protected]>
Co-authored-by: Cédrik Fuoco <[email protected]>
Signed-off-by: Cédrik Fuoco <[email protected]>
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

Successfully merging this pull request may close these issues.

[Bug]: OCIO failed to compile GL program with 1d luts with 2048 length in RV 2024.1.0

3 participants