File tree Expand file tree Collapse file tree 1 file changed +0
-30
lines changed
examples_tests/06.MeshLoaders Expand file tree Collapse file tree 1 file changed +0
-30
lines changed Original file line number Diff line number Diff line change 17
17
using namespace nbl ;
18
18
using namespace core ;
19
19
20
- static std::size_t pipeline_hash (asset::ICPURenderpassIndependentPipeline* _ppln)
21
- {
22
- constexpr size_t bytesToHash =
23
- asset::SVertexInputParams::serializedSize () +
24
- asset::SBlendParams::serializedSize () +
25
- asset::SRasterizationParams::serializedSize () +
26
- asset::SPrimitiveAssemblyParams::serializedSize () +
27
- sizeof (void *) * asset::ICPURenderpassIndependentPipeline::SHADER_STAGE_COUNT +// shaders
28
- sizeof (void *);// layout
29
- uint8_t mem[bytesToHash]{};
30
- uint32_t offset = 0u ;
31
- _ppln->getVertexInputParams ().serialize (mem + offset);
32
- offset += asset::SVertexInputParams::serializedSize ();
33
- _ppln->getBlendParams ().serialize (mem + offset);
34
- offset += asset::SBlendParams::serializedSize ();
35
- _ppln->getRasterizationParams ().serialize (mem + offset);
36
- offset += sizeof (asset::SRasterizationParams);
37
- _ppln->getPrimitiveAssemblyParams ().serialize (mem + offset);
38
- offset += sizeof (asset::SPrimitiveAssemblyParams);
39
- const asset::ICPUSpecializedShader** shaders = reinterpret_cast <const asset::ICPUSpecializedShader**>(mem + offset);
40
- for (uint32_t i = 0u ; i < asset::ICPURenderpassIndependentPipeline::SHADER_STAGE_COUNT; ++i)
41
- shaders[i] = _ppln->getShaderAtIndex (i);
42
- offset += asset::ICPURenderpassIndependentPipeline::SHADER_STAGE_COUNT * sizeof (void *);
43
- reinterpret_cast <const asset::ICPUPipelineLayout**>(mem + offset)[0 ] = _ppln->getLayout ();
44
-
45
- const std::size_t hs = std::hash<std::string_view>{}(std::string_view (reinterpret_cast <const char *>(mem), bytesToHash));
46
-
47
- return hs;
48
- }
49
-
50
20
int main ()
51
21
{
52
22
// create device with full flexibility over creation parameters
You can’t perform that action at this time.
0 commit comments