Closed vorg closed 2 months ago
Should all resource creation method (ctx.vertexBuffer/program/pass/pipeline/vertexArray/texture2D/textureCube/framebuffer/renderbuffer/vertexBuffer/indexBuffer) have their console.debug under debuMode too ? Aka debug logs only in debugMode.
I don't think any of them log anything. I think that query log message could be also removed.
I don't think any of them log anything.
What do you mean? Basic example debug logs every resource created:
I think that query log message could be also removed.
So remove console.debug call?
Ok. I see.
texture2D(opts) {
console.debug(NAMESPACE, "texture2D", opts);
Then the only difference is that texture2D
is called rarely and query
every frame.
In that case all of the console.debug calls should be moved behind this.debugMode check, including query. What do you think?
There will be a difference in workflow. Right now we create resources and if anything is wrong we just open devtools to see if any malformed parameters were sent. If we put them all under debugMode, we'll have to ctx.debug(true)
then recreates resources.
debugMode could be kept for debugCommands list, all ctx.applyPass/Uniforms/etc and ctx.update, actions assumed to happened on every frame.
Q: do you need to create queries on every frame? Would you get same timer results with:
const query1 = ctx.query();
ctx.frame(() => {
if (query1.state === ctx.QueryState.Ready && query1.result) {
console.log("query1", query1.result);
}
ctx.submit(clearCmd, () => {
ctx.beginQuery(query1);
ctx.submit(drawFloorCmd);
ctx.endQuery(query1);
});
});
Queries can indeed be reused. Just tested it in my graph. Not sure why i though they are one off. All good then.
Queries can indeed be reused. Just tested it in my graph. Not sure why i though they are one off. All good then.
Maybe it was something about query.result not available right away, that made you think that. Because they are asynchronous.
https://github.com/pex-gl/pex-context/blob/main/index.js#L638
it should happen only in debug mode