@@ -286,7 +286,7 @@ class DXDevice : public hlsltest::Device {
286
286
CComPtr<ID3D12Resource> Source) {
287
287
addUploadBeginBarrier (IS, Destination);
288
288
IS.CmdList ->CopyBufferRegion (Destination, 0 , Source, 0 , R.Size );
289
- addUploadEndBarrier (IS, Destination, R.Access == DataAccess::ReadOnly );
289
+ addUploadEndBarrier (IS, Destination, R.Access == DataAccess::ReadWrite );
290
290
}
291
291
292
292
llvm::Error createSRV (Resource &R, InvocationState &IS,
@@ -504,14 +504,8 @@ class DXDevice : public hlsltest::Device {
504
504
return waitForSignal (IS);
505
505
}
506
506
507
- llvm::Error createComputeCommands (Pipeline &P, InvocationState &IS) {
508
- if (auto Err =
509
- HR::toError (IS.Allocator ->Reset (), " Failed to reset allocator." ))
510
- return Err;
511
- if (auto Err = HR::toError (IS.CmdList ->Reset (IS.Allocator , IS.PSO ),
512
- " Failed to reset command list." ))
513
- return Err;
514
-
507
+ void createComputeCommands (Pipeline &P, InvocationState &IS) {
508
+ IS.CmdList ->SetPipelineState (IS.PSO );
515
509
IS.CmdList ->SetComputeRootSignature (IS.RootSig );
516
510
517
511
ID3D12DescriptorHeap *const Heaps[] = {IS.DescHeap };
@@ -535,8 +529,6 @@ class DXDevice : public hlsltest::Device {
535
529
IS.CmdList ->CopyResource (Out.second .Readback , Out.second .Buffer );
536
530
addReadbackEndBarrier (IS, Out.second .Buffer );
537
531
}
538
-
539
- return llvm::Error::success ();
540
532
}
541
533
542
534
llvm::Error readBack (Pipeline &P, InvocationState &IS) {
@@ -559,7 +551,7 @@ class DXDevice : public hlsltest::Device {
559
551
ResourcePair->second .Readback ->Unmap (0 , nullptr );
560
552
}
561
553
}
562
- return waitForSignal (IS );
554
+ return llvm::Error::success ( );
563
555
}
564
556
565
557
llvm::Error executeProgram (llvm::StringRef Program, Pipeline &P) override {
@@ -585,21 +577,14 @@ class DXDevice : public hlsltest::Device {
585
577
if (auto Err = createEvent (State))
586
578
return Err;
587
579
llvm::outs () << " Event prepared.\n " ;
588
- if (auto Err = executeCommandList (State))
589
- return Err;
590
- llvm::outs () << " Preparation commands executed.\n " ;
591
- if (auto Err = createComputeCommands (P, State))
592
- return Err;
580
+ createComputeCommands (P, State);
593
581
llvm::outs () << " Compute command list created.\n " ;
594
582
if (auto Err = executeCommandList (State))
595
583
return Err;
596
584
llvm::outs () << " Compute commands executed.\n " ;
597
585
if (auto Err = readBack (P, State))
598
586
return Err;
599
587
llvm::outs () << " Read data back.\n " ;
600
- if (auto Err = waitForSignal (State))
601
- return Err;
602
- llvm::outs () << " Wait and Sync...\n " ;
603
588
604
589
return llvm::Error::success ();
605
590
}
0 commit comments