Allow the user to override the vertex semantics.#1847
Allow the user to override the vertex semantics.#1847pmuetschard merged 3 commits intogoogle:masterfrom
Conversation
gapis/service/path/path.proto
Outdated
| bool faceted = 1; // If true then normals are calculated from each face. | ||
| // If true then normals are calculated from each face. | ||
| bool faceted = 1; | ||
| // If true, the actual data will be missing from the vertex.Buffers. |
There was a problem hiding this comment.
Maybe include a/the usage case for this?
gapis/service/path/path.proto
Outdated
| bool exclude_data = 2; | ||
| // Hints that override the semantic guessing. Maps vertex attribute names to | ||
| // their intentended semantic type. | ||
| map<string, vertex.Semantic.Type> vertex_semantics = 3; |
There was a problem hiding this comment.
We've intentionally avoided proto's map to date. While I am happy to revisit that decision, I'd prefer consistency for now.
There was a problem hiding this comment.
Do you think that name to type is the right association here?
I was thinking that stream index to type might be more explicit and less error prone (like when there is no name).
There was a problem hiding this comment.
No more maps.... though, why?
There always seems to be a name and it is the most descriptive thing available, so it makes sense to me. It doesn't relay on the order, which does not appear to be stable.
gapis/api/gles/draw_call_mesh.go
Outdated
| dci, err := dc.getIndices(ctx, c, s) | ||
| if err != nil { | ||
| return nil, err | ||
| noData := p.Options != nil && p.Options.ExcludeData |
There was a problem hiding this comment.
Possibly the same as p.GetOptions().GetExcludeData() ?
|
|
||
| var dci drawCallIndices | ||
| if noData { | ||
| dci = drawCallIndices{nil, dc.getDrawMode(), false} |
There was a problem hiding this comment.
If we're not getting data, is the draw mode important? If not, can we drop the new interface method?
There was a problem hiding this comment.
It's not currently important, but I think it makes sense to keep it, since it's part of the mesh metadata.
| } | ||
| } | ||
|
|
||
| func needsGuess(s *vertex.Stream) bool { |
There was a problem hiding this comment.
Isn't this already covered with the taken map?
There was a problem hiding this comment.
No. If a hint is provided, I don't want the guessing to override the hint.
gapis/api/vulkan/draw_call_mesh.go
Outdated
|
|
||
| stats := &api.Mesh_Stats{} | ||
|
|
||
| noData := p.Options != nil && p.Options.ExcludeData |
| taken := map[vertex.Semantic_Type]bool{} | ||
| if len(hints) > 0 { | ||
| for _, s := range vb.Streams { | ||
| if t, ok := hints[s.Name]; ok && !taken[t] { |
There was a problem hiding this comment.
@AWoloszyn do streams typically have names in vulkan?
There was a problem hiding this comment.
They do, though they are not "names" as such (yet), but are of the form binding=##, location=##.
Fetching the mesh without data allows clients to query the mesh metadata before deciding how to fetch the data. The semantic hints allow overriding of the not-so-state-of-the-art semantic AI guesser.
Adds a new settings-gear button to the geo view, that when clicked, shows a dialog where the user can assign the sementic type to each vertex stream of the current model.
gapis/api/gles/draw_call_mesh.go
Outdated
| dci, err := dc.getIndices(ctx, c, s) | ||
| if err != nil { | ||
| return nil, err | ||
| noData := p.Options != nil && p.Options.ExcludeData |
| } | ||
| } | ||
|
|
||
| func needsGuess(s *vertex.Stream) bool { |
There was a problem hiding this comment.
No. If a hint is provided, I don't want the guessing to override the hint.
gapis/api/vulkan/draw_call_mesh.go
Outdated
|
|
||
| stats := &api.Mesh_Stats{} | ||
|
|
||
| noData := p.Options != nil && p.Options.ExcludeData |
| taken := map[vertex.Semantic_Type]bool{} | ||
| if len(hints) > 0 { | ||
| for _, s := range vb.Streams { | ||
| if t, ok := hints[s.Name]; ok && !taken[t] { |
There was a problem hiding this comment.
They do, though they are not "names" as such (yet), but are of the form binding=##, location=##.
gapis/service/path/path.proto
Outdated
| bool faceted = 1; // If true then normals are calculated from each face. | ||
| // If true then normals are calculated from each face. | ||
| bool faceted = 1; | ||
| // If true, the actual data will be missing from the vertex.Buffers. |
gapis/service/path/path.proto
Outdated
| bool exclude_data = 2; | ||
| // Hints that override the semantic guessing. Maps vertex attribute names to | ||
| // their intentended semantic type. | ||
| map<string, vertex.Semantic.Type> vertex_semantics = 3; |
There was a problem hiding this comment.
No more maps.... though, why?
There always seems to be a name and it is the most descriptive thing available, so it makes sense to me. It doesn't relay on the order, which does not appear to be stable.
|
|
||
| var dci drawCallIndices | ||
| if noData { | ||
| dci = drawCallIndices{nil, dc.getDrawMode(), false} |
There was a problem hiding this comment.
It's not currently important, but I think it makes sense to keep it, since it's part of the mesh metadata.
Adds a new settings-gear button to the geo view, that when clicked, shows a dialog where the user can assign the sementic type to each vertex stream of the current model.
Fixes #960