Skip to content

Add Query API - #619

Closed
haoxli wants to merge 1 commit into
gpuweb:masterfrom
haoxli:query-api-idl
Closed

haoxli wants to merge 1 commit into
gpuweb:masterfrom
haoxli:query-api-idl

Conversation

@haoxli

@haoxli haoxli commented Mar 17, 2020 •

Copy link
Copy Markdown
Contributor

Add the definition of Query API and its requirements according to #614.

  • Add extensions.
  • Define QuerySet, QuerySetDescriptor and QueryType.
  • Create QuerySet on GPU device.
  • Set query set in render pass descriptor for occlusion query.
  • Add separated begin/end method for occlusion query on render pass encoder.
  • Add begin/end method for pipeline statistics and timestamp queries on
    render pass encoder and compute pass encoder.
  • Resolve query result from query set on command encoder.
  • Add a new buffer usage for resolving query result.

💥 Error: write EPROTO 140222018242432:error:1407742E:SSL routines:SSL23_GET_SERVER_HELLO:tlsv1 alert protocol version:../deps/openssl/openssl/ssl/s23_clnt.c:772:

💥 ###

PR Preview failed to build. (Last tried on Mar 17, 2020, 1:57 AM UTC).

More

PR Preview relies on a number of web services to run. There seems to be an issue with the following one:

🚨 HTML Diff Service - The HTML Diff Service is used to create HTML diffs of the spec changes suggested in a pull request.

🔗 Related URL

If you don't have enough information above to solve the error by yourself (or to understand to which web service the error is related to, if any), please file an issue.

Add the definition of Query API and its requirements according to gpuweb#614.
* Add extensions.
* Define QuerySet, QuerySetDescriptor and QueryType.
* Create QuerySet on GPU device.
* Set query set in render pass descriptor for occlusion query.
* Add separated begin/end method for occlusion query on render pass encoder.
* Add begin/end method for pipeline statistics and timestamp queries on
  render pass encoder and compute pass encoder.
* Resolve query result from query set on command encoder.
* Add a new buffer usage for resolving query result.
Comment thread spec/index.bs
void setBlendColor(GPUColor color);
void setStencilReference(GPUStencilValue reference);

void beginOcclusionQuery(GPUSize32 queryIndex, boolean preciseOcclusion);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nit: preciseOcclusion = false

@kainino0x kainino0x Mar 24, 2020 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actually, I don't think we need this extra argument at all right now. We won't use it until we have an extension that needs it.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

hm... Never mind. I saw you added the extension string, but was thinking there was still more work to do on the API to add the extension (I didn't think about the fact that this is all there is).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done

@Kangz Kangz mentioned this pull request Mar 24, 2020

@kainino0x kainino0x left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks good overall!

Comment thread spec/index.bs
Comment on lines +2458 to +2459
void beginQuery(GPUQuerySet querySet, GPUSize32 queryIndex);
void endQuery(GPUQuerySet querySet, GPUSize32 queryIndex);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Move to GPUProgrammablePassEncoder

Comment thread spec/index.bs
Comment on lines +2509 to +2510
void beginQuery(GPUQuerySet querySet, GPUSize32 queryIndex);
void endQuery(GPUQuerySet querySet, GPUSize32 queryIndex);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Move to GPUProgrammablePassEncoder

Comment thread spec/index.bs
<script type=idl>
enum GPUQueryType {
"occlusion",
"pipelinestatistics",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
"pipelinestatistics",
"pipeline-statistics",

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done

Comment thread spec/index.bs
Comment on lines +2686 to +2687
GPUQueryType getQueryType();
GPUSize32 getQueryCount();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I don't think these are needed; they're just returning user provided values.
If we want them, they should be readonly attributes instead of methods.

@haoxli haoxli Mar 30, 2020 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I've removed the getters in #656, will add them as internal attributes in spec. At beginning I want to get the size of query data by this method when resolving, instead of passing in a actual number.

Comment thread spec/index.bs
GPUQueryType getQueryType();
GPUSize32 getQueryCount();

void destroy();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is there a specific overhead of GPUQuerySets that means we want a destroy() method? We don't usually include them right now (we only have them on buffers and textures).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I'm not sure if I understood correctly, QuerySet should be allocated in a continuous memory on GPU like buffers for storing query data, so I think it need the destory() method.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think that makes sense, though BindGroups also live in continuous memory on some backends but we don't put destroy() on them because they're small. QuerySets are probably typically a little larger.

@haoxli

haoxli commented Mar 30, 2020

Copy link
Copy Markdown
Contributor Author

I will splite this PR to small ones to make it merged easily.
First for occlusion query: #656

@Kangz

Kangz commented Apr 3, 2020

Copy link
Copy Markdown
Contributor

I will splite this PR to small ones to make it merged easily.
First for occlusion query: #656

Thanks for splitting up the PR. I'll close this one. #656 has been merged! Now we can start discussing the various extensions.

@Kangz Kangz closed this Apr 3, 2020
ben-clayton pushed a commit to ben-clayton/gpuweb that referenced this pull request Sep 6, 2022
The plan mentioned a lot of test combination with indexed=true/false but
this seems unnecessary since we already have different tests that check
the "index" generation for indexed calls.
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.

3 participants