Direct3D 12 Early Adopters (ii): Fence

Source: Internet
Author: User

(reproduced please specify the source)

As stated at the end of the previous section, a run-time error occurred:

d3d12 error:id3d12commandallocator::reset:a Command allocator is being Reset before previous executions associated W ITH the allocator has completed. [Execution ERROR #548: Command_allocator_sync]

That is, after the implementation of the relevant execution can not be reset, in their first impression that the submission of the presentation (Present), all the manipulation is done, but this does not seem to be the case, Microsoft has mentioned here:

Waiting for frame rendering is probably the coarsest-on-the-be certain, the GPU has finished. At a finer grain, you can again use fences

That is, it is not good enough to wait for the frame to finish rendering and assume that the GPU is done, preferably using fence:

All right, the fence is coming, the barricade is coming, Microsoft, you're not going to have a spike? ╮ ( ̄▽ ̄) ╭

Fence corresponding interface is id3d12fence, you can use Id3d12device::createfence to create this interface, the specific code is not tired, very simple.
This fence is in frames and can wait for all commands against this frame. Use id3d12fence::seteventoncompletion and id3d12commandqueue::signal for signal operation, then wait after the end, In frames.
However, there is a id3d12fence::signal, it seems possible that id3d12commandqueue::signal will call this method, otherwise this fence can not be bound with the command method.

so the approximate rendering process is:
    1. Fence-Seteventoncompletion
    2. Execute command
    3. Submit Rendering
    4. Queue--Signal
    5. Waitforxxxxxxxobject

The last time, this time is very simple. And I tried to put 3 on the back of 5 , too (looks like ?) No problem, but according to Microsoft's statement, still put in front of signal.

Download the accompanying code:

Click here

Direct3D 12 Early Adopters (ii): Fence

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.