-
Notifications
You must be signed in to change notification settings - Fork 327
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
Allow the user to override the vertex semantics. #1847
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe include a/the usage case for this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Possibly the same as p.GetOptions().GetExcludeData()
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
gapis/api/gles/draw_call_mesh.go
Outdated
|
||
var dci drawCallIndices | ||
if noData { | ||
dci = drawCallIndices{nil, dc.getDrawMode(), false} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not currently important, but I think it makes sense to keep it, since it's part of the mesh metadata.
s.Semantic.Type = p.semantic | ||
taken[p.semantic] = true | ||
break | ||
} | ||
} | ||
} | ||
} | ||
|
||
func needsGuess(s *vertex.Stream) bool { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't this already covered with the taken
map?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No. If a hint is provided, I don't want the guessing to override the hint.
gapis/api/vulkan/draw_call_mesh.go
Outdated
@@ -81,20 +81,25 @@ func drawCallMesh(ctx context.Context, dc *VkQueueSubmit, p *path.Mesh) (*api.Me | |||
|
|||
stats := &api.Mesh_Stats{} | |||
|
|||
noData := p.Options != nil && p.Options.ExcludeData |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See above
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
@@ -452,7 +470,20 @@ func guessSemantics(vb *vertex.Buffer) { | |||
} | |||
|
|||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@AWoloszyn do streams typically have names in vulkan?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done. PTAL.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
s.Semantic.Type = p.semantic | ||
taken[p.semantic] = true | ||
break | ||
} | ||
} | ||
} | ||
} | ||
|
||
func needsGuess(s *vertex.Stream) bool { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No. If a hint is provided, I don't want the guessing to override the hint.
gapis/api/vulkan/draw_call_mesh.go
Outdated
@@ -81,20 +81,25 @@ func drawCallMesh(ctx context.Context, dc *VkQueueSubmit, p *path.Mesh) (*api.Me | |||
|
|||
stats := &api.Mesh_Stats{} | |||
|
|||
noData := p.Options != nil && p.Options.ExcludeData |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
@@ -452,7 +470,20 @@ func guessSemantics(vb *vertex.Buffer) { | |||
} | |||
|
|||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
|
||
var dci drawCallIndices | ||
if noData { | ||
dci = drawCallIndices{nil, dc.getDrawMode(), false} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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