microsoft / microsoft/DirectX-Graphics-Samples
MiniEngine: PSO will not be set properly when mixed gfxCtx and cptCtx
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 6.8k
- Forks
- 2.2k
- PR merge metrics
- No merged PRs in 30d
Description
Hey Guys,
I found the following code will cause later PSO not being set
void Render(CommandContext& cmdCtx)
{
GraphicsContext& gfxCtx = cmdCtx.GetGraphicsContext();
ComputeContext& cptCtx = cmdCtx.GetComputeContext();
// both renderjob and computejob are in same cmdlist, no flush/finish called inbetween
ComputeJob(cptCtx); // will call cptCtx.SetPipelineState inside
RenderJob(gfxCtx); // will call gfxCtx.SetPipelineState inside
// The cptCtx.SetPipelineState call in the following func will not execute
// since the pso pointer is the same as the one saved in m_CurComputePipelineState
// while the pso bind on cmdlist is the one for gfxCtx
ComputeJob(cptCtx); // will call cptCtx.SetPipelineState inside
....
}
I feel like either this is a small bug or my usage listed above is discouraged.
My test project only have very small cmdlist, so I tend to put them all in one command list, thus I get that trouble. Eventhough it is not recomend to mix gfx cpt job like above, but in my project the order is important, so reorder is not an option.
Please let me know if it is OK to do the stuff like I did (right now I use a messy work around by adding a flag indicate whether i use cpt or gfx ctx). And if I shouldn't do the way I did, what's the proper way to use commandcontext if I have very small cmdlist in mixed compute job and graphics job
Thanks
P.S. any suggestion about dx12 bundle support in MiniEngine?
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the Render sequence and inspect GetGraphicsContext, GetComputeContext, and the SetPipelineState calls in ComputeJob and RenderJob. Reproduce the mixed gfxCtx/cptCtx order in one command list and trace the cached pipeline-state comparisons. Done means the compute PSO is correctly bound after the graphics job, or the supported usage is clearly documented.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- computer-graphics
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100