Skip to content

Commit 80a2bc1

Browse files
committed
Add vhClear calls to graphics tests to properly clear render targets before drawing
1 parent cb60daf commit 80a2bc1

1 file changed

Lines changed: 23 additions & 0 deletions

File tree

test/test_gfx.cpp

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -315,6 +315,7 @@ UTEST_F( Graphics, DrawTriangle )
315315

316316
vhStateId sid = 200;
317317
vhSetState( sid, state );
318+
vhClear( sid, VRHI_CLEAR_COLOR );
318319
vhDraw( sid, 3 );
319320
vhFinish();
320321

@@ -356,6 +357,7 @@ UTEST_F( Graphics, DrawIndexedTriangle )
356357

357358
vhStateId sid = 300;
358359
vhSetState( sid, state );
360+
vhClear( sid, VRHI_CLEAR_COLOR );
359361
vhDrawIndexed( sid, 3 );
360362
vhFinish();
361363

@@ -395,6 +397,7 @@ UTEST_F( Graphics, DrawTriangleStrip )
395397

396398
vhStateId sid = 350;
397399
vhSetState( sid, state );
400+
vhClear( sid, VRHI_CLEAR_COLOR );
398401
vhDraw( sid, 4 );
399402
vhFinish();
400403

@@ -451,6 +454,7 @@ UTEST_F( Graphics, DepthTest )
451454

452455
vhStateId sidFar = 400;
453456
vhSetState( sidFar, state );
457+
vhClear( sidFar, VRHI_CLEAR_COLOR | VRHI_CLEAR_DEPTH );
454458
vhDraw( sidFar, 6 );
455459

456460
state.SetVertexBuffer( vbNear, 0 );
@@ -505,6 +509,7 @@ UTEST_F( Graphics, StencilTest )
505509

506510
vhStateId sid1 = 501;
507511
vhSetState( sid1, state );
512+
vhClear( sid1, VRHI_CLEAR_COLOR | VRHI_CLEAR_STENCIL );
508513
vhDraw( sid1, 6 );
509514
vhFinish();
510515

@@ -514,6 +519,7 @@ UTEST_F( Graphics, StencilTest )
514519

515520
vhStateId sid2 = 502;
516521
vhSetState( sid2, state );
522+
vhClear( sid2, VRHI_CLEAR_COLOR );
517523
vhDraw( sid2, 6 );
518524
vhFinish();
519525
EXPECT_TRUE( VerifyPixel( rt, 32, 32, 0xFF000000 ) ); // Black
@@ -523,6 +529,7 @@ UTEST_F( Graphics, StencilTest )
523529

524530
vhStateId sid3 = 503;
525531
vhSetState( sid3, state );
532+
vhClear( sid3, VRHI_CLEAR_COLOR );
526533
vhDraw( sid3, 6 );
527534
vhFinish();
528535
EXPECT_TRUE( VerifyPixel( rt, 32, 32, 0xFFFFFFFF ) ); // White
@@ -564,6 +571,7 @@ UTEST_F( Graphics, AlphaBlending )
564571

565572
vhStateId sid = 550;
566573
vhSetState( sid, state );
574+
vhClear( sid, VRHI_CLEAR_COLOR );
567575
vhDraw( sid, 6 );
568576
vhFinish();
569577

@@ -615,6 +623,7 @@ UTEST_F( Graphics, Culling )
615623

616624
vhStateId sidCW = 600;
617625
vhSetState( sidCW, state );
626+
vhClear( sidCW, VRHI_CLEAR_COLOR );
618627
vhDraw( sidCW, 3 );
619628
vhFinish();
620629
EXPECT_TRUE( VerifyPixel( rt, 16, 16, 0xFF0000FF ) ); // Red
@@ -626,6 +635,7 @@ UTEST_F( Graphics, Culling )
626635

627636
vhStateId sidCCW = 601;
628637
vhSetState( sidCCW, state );
638+
vhClear( sidCCW, VRHI_CLEAR_COLOR );
629639
vhDraw( sidCCW, 3 );
630640
vhFinish();
631641
EXPECT_TRUE( VerifyPixel( rt, 16, 16, 0xFF00FF00 ) ); // Green
@@ -668,6 +678,7 @@ UTEST_F( Graphics, ScissorTest )
668678

669679
vhStateId sid = 620;
670680
vhSetState( sid, state );
681+
vhClear( sid, VRHI_CLEAR_COLOR );
671682
vhDraw( sid, 6 );
672683
vhFinish();
673684

@@ -729,6 +740,7 @@ UTEST_F( Graphics, MultipleTextures )
729740

730741
vhStateId sid = 770;
731742
vhSetState( sid, state );
743+
vhClear( sid, VRHI_CLEAR_COLOR );
732744
vhDraw( sid, 6 );
733745
vhFinish();
734746

@@ -775,6 +787,7 @@ UTEST_F( Graphics, TextureFormats )
775787

776788
vhStateId sid = 820;
777789
vhSetState( sid, state );
790+
vhClear( sid, VRHI_CLEAR_COLOR );
778791
vhDraw( sid, 6 );
779792
vhFinish();
780793

@@ -842,6 +855,7 @@ UTEST_F( Graphics, UniformBuffers )
842855

843856
vhStateId sid = 830;
844857
vhSetState( sid, state );
858+
vhClear( sid, VRHI_CLEAR_COLOR );
845859
vhDraw( sid, 6 );
846860
vhFinish();
847861

@@ -884,6 +898,7 @@ UTEST_F( Graphics, PushConstants )
884898

885899
vhStateId sid = 650;
886900
vhSetState( sid, state );
901+
vhClear( sid, VRHI_CLEAR_COLOR );
887902
vhDraw( sid, 6 );
888903
vhFinish();
889904

@@ -927,6 +942,7 @@ UTEST_F( Graphics, MultipleRenderTargets )
927942

928943
vhStateId sid = 700;
929944
vhSetState( sid, state );
945+
vhClear( sid, VRHI_CLEAR_COLOR );
930946
vhDraw( sid, 6 );
931947
vhFinish();
932948

@@ -966,6 +982,7 @@ UTEST_F( Graphics, InstancedRendering )
966982

967983
vhStateId sid = 800;
968984
vhSetState( sid, state );
985+
vhClear( sid, VRHI_CLEAR_COLOR );
969986
vhDraw( sid, 3, 10 ); // 10 instances
970987
vhFinish();
971988

@@ -1030,6 +1047,7 @@ UTEST_F( Graphics, SamplerModes )
10301047

10311048
vhStateId sidWrap = 900;
10321049
vhSetState( sidWrap, state );
1050+
vhClear( sidWrap, VRHI_CLEAR_COLOR );
10331051
vhDraw( sidWrap, 6 );
10341052
vhFinish();
10351053

@@ -1045,6 +1063,7 @@ UTEST_F( Graphics, SamplerModes )
10451063

10461064
vhStateId sidClamp = 901;
10471065
vhSetState( sidClamp, state );
1066+
vhClear( sidClamp, VRHI_CLEAR_COLOR );
10481067
vhDraw( sidClamp, 6 );
10491068
vhFinish();
10501069

@@ -1113,6 +1132,7 @@ UTEST_F( Graphics, MipmapRendering )
11131132

11141133
vhStateId sid = 1000;
11151134
vhSetState( sid, state );
1135+
vhClear( sid, VRHI_CLEAR_COLOR );
11161136
vhDraw( sid, 6 );
11171137
vhFinish();
11181138

@@ -1174,6 +1194,7 @@ UTEST_F( Graphics, MultipleVertexStreams )
11741194

11751195
vhStateId sid = 1100;
11761196
vhSetState( sid, state );
1197+
vhClear( sid, VRHI_CLEAR_COLOR );
11771198
vhDraw( sid, 3 );
11781199
vhFinish();
11791200

@@ -1224,6 +1245,7 @@ UTEST_F( Graphics, VertexBufferOffset )
12241245

12251246
vhStateId sid = 1200; // Unique ID
12261247
vhSetState( sid, state );
1248+
vhClear( sid, VRHI_CLEAR_COLOR );
12271249

12281250
vhDraw( sid, 3 );
12291251
vhFinish();
@@ -1283,6 +1305,7 @@ UTEST_F( Graphics, IndirectDraw )
12831305

12841306
vhStateId sid = 1201; // Unique ID
12851307
vhSetState( sid, state );
1308+
vhClear( sid, VRHI_CLEAR_COLOR );
12861309

12871310
vhDrawIndirect( sid, 1 ); // 1 call
12881311
vhFinish();

0 commit comments

Comments
 (0)