MCPcopy Create free account
hub / github.com/NVIDIAGameWorks/PhysX / operator()

Method operator()

physx/samples/sampleframework/renderer/src/Renderer.cpp:608–664  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

606}
607
608bool Renderer::CompareRenderMaterialDesc::operator()(const RendererMaterialDesc& desc1, const RendererMaterialDesc& desc2) const
609{
610 if (desc1.type != desc2.type)
611 return desc1.type < desc2.type;
612
613 if (desc1.alphaTestFunc != desc2.alphaTestFunc)
614 return desc1.alphaTestFunc < desc2.alphaTestFunc;
615
616 if (desc1.alphaTestRef != desc2.alphaTestRef)
617 return desc1.alphaTestRef < desc2.alphaTestRef;
618
619 if (desc1.blending != desc2.blending)
620 return desc1.blending < desc2.blending;
621
622 if (desc1.srcBlendFunc != desc2.srcBlendFunc)
623 return desc1.srcBlendFunc < desc2.srcBlendFunc;
624
625 if (desc1.dstBlendFunc != desc2.dstBlendFunc)
626 return desc1.dstBlendFunc < desc2.dstBlendFunc;
627
628 int result = Ps::stricmp(desc1.vertexShaderPath, desc2.vertexShaderPath);
629 if (result != 0)
630 return result < 0;
631
632 result = Ps::stricmp(desc1.fragmentShaderPath, desc2.fragmentShaderPath);
633 if (result != 0)
634 return result < 0;
635
636 // Geometry, hull and domain shaders are optional, so only check when present
637 // * stricmp only works properly for well defined pointers, so only test when both present
638 // * if one material has a particular shader when the other material does not, the one WITH should be first
639 if (desc1.geometryShaderPath || desc2.geometryShaderPath)
640 {
641 if (desc1.geometryShaderPath && desc2.geometryShaderPath)
642 result = Ps::stricmp(desc1.geometryShaderPath, desc2.geometryShaderPath);
643 else
644 result = desc1.geometryShaderPath ? -1 : 1;
645 }
646
647 if (0 == result && (desc1.hullShaderPath || desc2.hullShaderPath))
648 {
649 if (desc1.hullShaderPath && desc2.hullShaderPath)
650 result = Ps::stricmp(desc1.hullShaderPath, desc2.hullShaderPath);
651 else
652 result = desc1.hullShaderPath ? -1 : 1;
653 }
654
655 if (0 == result && (desc1.domainShaderPath || desc2.domainShaderPath))
656 {
657 if (desc1.domainShaderPath && desc2.domainShaderPath)
658 result = Ps::stricmp(desc1.domainShaderPath, desc2.domainShaderPath);
659 else
660 result = desc1.domainShaderPath ? -1 : 1;
661 }
662
663 return result < 0;
664}
665

Callers

nothing calls this directly

Calls 1

stricmpFunction · 0.85

Tested by

no test coverage detected