fix stride calculation on types bigger than a vec4#359
Open
vvcarvalho wants to merge 2 commits intocbaggers:masterfrom
Open
fix stride calculation on types bigger than a vec4#359vvcarvalho wants to merge 2 commits intocbaggers:masterfrom
vvcarvalho wants to merge 2 commits intocbaggers:masterfrom
Conversation
If the data definition via defstruct-g or a built-in type exceeds a vec4
, the usage of `%gl:vertex-attrib-*pointer` calls changes.
In CEPL, the stride was previously always 0, meaning the generic vertex
attributes are tightly packed (as per the spec). The splitting of a type
into multiple pointers and their offsets was already done. However, in
both Fedora 37 and macOS 12.6 it gave unexpected results.
The reason, though not documented (AFAICT), is likely due to the stride
being necessary in cases for types longer than a vec4 for vertex
attributes. By always providing it, we get the expected results.
A sample pipeline is given:
```
(defun-g vert ((data g-pnt)
(instance :mat4)
&uniform
(view :mat4)
(proj :mat4))
(* proj view instance (v! (pos data) 1.0)))
(defun-g frag ()
(vec4 1.0))
(defpipeline-g test-instancing ()
(vert g-pnt :mat4)
(frag))
```
The data definition and map-g is left to the patch reader.
Owner
|
Thank you for the PR! I am not back yet, but I'm not gone either. This won't be forgotten |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
If the data definition via defstruct-g or a built-in type exceeds a vec4 , the usage of
%gl:vertex-attrib-*pointercall changes.In CEPL, the stride was previously always 0, meaning the generic vertex attributes are tightly packed (as per the spec). The splitting of a type into multiple pointers and their offsets was already done. However, in both Fedora 37 and macOS 12.6 it gave unexpected results with vertex attributes on types that exceeded the size of a vec4.
The reason, though not documented (AFAICT), is likely due to the stride being necessary in cases for types longer than a vec4 for vertex attributes. By always providing it, we get the expected results.
The patch was tested using the following pipeline:
Thanks for CEPL!