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

Allow the user to override the vertex semantics. #1847

Merged
merged 3 commits into from
May 2, 2018

Conversation

pmuetschard
Copy link
Member

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

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.
Copy link
Contributor

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?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

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;
Copy link
Contributor

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.

Copy link
Contributor

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).

Copy link
Member Author

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.

dci, err := dc.getIndices(ctx, c, s)
if err != nil {
return nil, err
noData := p.Options != nil && p.Options.ExcludeData
Copy link
Contributor

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() ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.


var dci drawCallIndices
if noData {
dci = drawCallIndices{nil, dc.getDrawMode(), false}
Copy link
Contributor

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?

Copy link
Member Author

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 {
Copy link
Contributor

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?

Copy link
Member Author

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.

@@ -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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See above

Copy link
Member Author

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] {
Copy link
Contributor

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?

Copy link
Member Author

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.
Copy link
Member Author

@pmuetschard pmuetschard left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. PTAL.

dci, err := dc.getIndices(ctx, c, s)
if err != nil {
return nil, err
noData := p.Options != nil && p.Options.ExcludeData
Copy link
Member Author

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 {
Copy link
Member Author

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.

@@ -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
Copy link
Member Author

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] {
Copy link
Member Author

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=##.

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.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

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;
Copy link
Member Author

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.


var dci drawCallIndices
if noData {
dci = drawCallIndices{nil, dc.getDrawMode(), false}
Copy link
Member Author

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.

@pmuetschard pmuetschard merged commit ddae44f into google:master May 2, 2018
@pmuetschard pmuetschard deleted the geo branch May 2, 2018 18:52
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.

2 participants