Make AllResourceData resolvable based on resource type.#2512
Make AllResourceData resolvable based on resource type.#2512AWoloszyn merged 1 commit intogoogle:masterfrom
Conversation
gapis/service/service.proto
Outdated
| // Resources contains the full list of resources used by a capture. | ||
| message Resources { | ||
| repeated ResourcesByType types = 1; | ||
| map<string, api.ResourceType> resourceTypes = 2; |
There was a problem hiding this comment.
Probably we should have a better name for resourceTypes to indicate this is a map from resource id to resource types.
There was a problem hiding this comment.
why would we need this map? The resources are already returned by type.
There was a problem hiding this comment.
This is so we can answer the question:
I have resourceID what type is that. We could get the same information out of the proto, but its backwards, given resourceID
- loop through all types
- loop through all ids, to see if Foo is found.
- Profit? (n^2 if we have to do this lookup repeatedly)
The reason it went into this message at all, was because it is free to compute along with the rest of the resources, otherwise we would have to re-mutate the entire world to generate this information.
There was a problem hiding this comment.
Used above
gapis/resolve/resource_data.go:141
There was a problem hiding this comment.
FYI: The only other "efficient" way I could see of doing this was forcing the Client to add the type in the request.
I.e. have the path be
// Copy of resource_type due to who includes whom
// Or move it entirely into path.proto but that seems worse
enum ResourceType {
// UnknownResource represents an unknown resource type
UnknownResource = 0;
// Texture represents the Texture resource type
TextureResource = 1;
// ShaderResource represents the Shader resource type
ShaderResource = 2;
// ProgramResource represents the Program resource type
ProgramResource = 3;
// PipelineResource respresents the Pipeline resource type
PipelineResource = 4;
}
message ResourceData {
ID ID = 1;
Command after = 2;
ResourceType type = 3;
}
There was a problem hiding this comment.
OK. Alright, I think I can live with it :). Here are my concerns:
- this is serialized to the client and stays resident in memory there
- not a big fan of the
ID.String()part as keys
I think the only way around it is to have an intermediate value stored in the DB and convert from it for both calls, but I'm not sure it's worth it...
64c7207 to
d05fc5c
Compare
This means that dump_resources does not have to actually kick off replays. It also means we don't have to store as much data if we do not need all of it.
d05fc5c to
523c9c4
Compare
This means that dump_resources does not have to actually
kick off replays. It also means we don't have to store
as much data if we do not need all of it.
Fixes #2435