MCPcopy Create free account
hub / github.com/carbonengine/trinity / TEST

Function TEST

shadercompiler/tests/Bindless.cpp:17–69  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

15#endif
16
17TEST( Bindless, SamplerInitializerStored )
18{
19 const char* src = R"SRC(
20Texture2D<float4> tex;
21
22BindlessHandleSampler sampl{
23 IsDynamic = true;
24 MinFilter = Anisotropic;
25 MagFilter = Linear;
26 MipFilter = Linear;
27 AddressU = Wrap;
28 AddressV = Wrap;
29};
30
31SamplerState HeapView_Sampler[]
32<
33 bool IsHeapView = true;
34>;
35
36float4 vs(): SV_Position
37{
38 return float4( 0.0, 0.0, 0.0, 1.0 );
39}
40
41float4 ps(): SV_Target
42{
43 return float4( tex.Sample( HeapView_Sampler[sampl], float2( 0, 0 ) ) );
44}
45
46technique t0
47{
48 pass p0
49 {
50 vertexshader = compile vs_3_0 vs();
51 pixelshader = compile ps_3_0 ps();
52 }
53}
54
55)SRC";
56
57 auto data = Compile<BindlessCompiler>( src );
58
59 ASSERT_FALSE( data.techniques[0].passes[0].stages[1].samplers.empty() );
60 auto& samplers = data.techniques[0].passes[0].stages[1].samplers;
61 auto sampl = find_if( begin( samplers ), end( samplers ), []( auto& s ) {
62 return strcmp( g_stringTable.GetString( s.second.name ), "sampl" ) == 0;
63 } );
64 ASSERT_NE( sampl, end( samplers ) );
65 EXPECT_EQ( sampl->second.addressU, 1 );
66 EXPECT_EQ( sampl->second.addressV, 1 );
67 EXPECT_EQ( sampl->second.addressW, 3 );
68 EXPECT_EQ( sampl->second.minFilter, 3 );
69}

Callers

nothing calls this directly

Calls 4

emptyMethod · 0.80
beginFunction · 0.50
endFunction · 0.50
GetStringMethod · 0.45

Tested by

no test coverage detected