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

Method RunComputeShaderIndirect

trinity/Tr2Renderer.cpp:942–971  ·  view source on GitHub ↗

-------------------------------------------------------------------------------------- Description: Execute compute shaders in all passes of the specified effect. Group drid dimensions are taken from indirectParams GPU buffer. The function will unset bound UAVs after each pass. Arguments: effect - Effect containing compute shaders indirectParams - GPU buffer containing group dimensions offset - by

Source from the content-addressed store, hash-verified

940// false On failure
941// --------------------------------------------------------------------------------------
942bool Tr2Renderer::RunComputeShaderIndirect( Tr2Material* effect, Tr2BufferAL& indirectParams, unsigned offset, Tr2RenderContext& renderContext )
943{
944 if( !effect )
945 {
946 return false;
947 }
948 auto shader = effect->GetShaderStateInterface();
949 if( !shader )
950 {
951 return false;
952 }
953
954 auto& desc = shader->GetEffectDescription();
955 if( desc.techniques.empty() )
956 {
957 return false;
958 }
959 auto& technique = desc.techniques[0];
960 for( size_t i = 0; i < technique.passes.size(); ++i )
961 {
962 auto& stage = technique.passes[i].stageInputs[COMPUTE_SHADER];
963 if( stage.m_exists )
964 {
965 shader->ApplyAllStateForPass( 0, uint32_t( i ), renderContext );
966 effect->ApplyMaterialDataForPass( 0, uint32_t( i ), renderContext );
967 CR_RETURN_VAL( renderContext.RunComputeShaderIndirect( indirectParams, offset ), false );
968 }
969 }
970 return true;
971}
972
973void Tr2Renderer::PushProjection()
974{

Callers

nothing calls this directly

Calls 5

emptyMethod · 0.80
sizeMethod · 0.80
ApplyAllStateForPassMethod · 0.80

Tested by

no test coverage detected