Main Page Class List Class Members

- Main Page
- User's Guide
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

# sdk/toolkit/include/NvBlastTkGroup.h

Go to the documentation of this file.

    00001 // This code contains NVIDIA Confidential Information and is disclosed to you
    00002 // under a form of NVIDIA software license agreement provided separately to you.
    00003 //
    00004 // Notice
    00005 // NVIDIA Corporation and its licensors retain all intellectual property and
    00006 // proprietary rights in and to this software and related documentation and
    00007 // any modifications thereto. Any use, reproduction, disclosure, or
    00008 // distribution of this software and related documentation without an express
    00009 // license agreement from NVIDIA Corporation is strictly prohibited.
    00010 //
    00011 // ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
    00012 // NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
    00013 // THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
    00014 // MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
    00015 //
    00016 // Information and code furnished is believed to be accurate and reliable.
    00017 // However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
    00018 // information or for any infringement of patents or other rights of third parties that may
    00019 // result from its use. No license is granted by implication or otherwise under any patent
    00020 // or patent rights of NVIDIA Corporation. Details are subject to change without notice.
    00021 // This code supersedes and replaces all information previously supplied.
    00022 // NVIDIA Corporation products are not authorized for use as critical
    00023 // components in life support devices or systems without express written approval of
    00024 // NVIDIA Corporation.
    00025 //
    00026 // Copyright (c) 2016-2020 NVIDIA Corporation. All rights reserved.
    00027
    00028
    00029 #ifndef NVBLASTTKGROUP_H
    00030 #define NVBLASTTKGROUP_H
    00031
    00032 #include "NvBlastTkIdentifiable.h"
    00033
    00034
    00035 namespace Nv
    00036 {
    00037 namespace Blast
    00038 {
    00039
    00040 // Forward declarations
    00041 class TkActor;
    00042
    00043
    00048 struct TkGroupDesc
    00049 {
    00050     uint32_t        workerCount;
    00051 };
    00052
    00053
    00058 struct TkGroupStats
    00059 {
    00060     NvBlastTimers   timers;
    00061     uint32_t        processedActorsCount;
    00062     int64_t         workerTime;
    00063 };
    00064
    00065
    00074 class TkGroupWorker
    00075 {
    00076 public:
    00082     virtual void    process(uint32_t jobId) = 0;
    00083 };
    00084
    00085
    00101 class TkGroup : public TkIdentifiable
    00102 {
    00103 public:
    00111     virtual bool            addActor(TkActor& actor) = 0;
    00112
    00118     virtual uint32_t        getActorCount() const = 0;
    00119
    00129     virtual uint32_t        getActors(TkActor** buffer, uint32_t bufferSize, uint32_t indexStart = 0) const = 0;
    00130
    00137     virtual uint32_t        startProcess() = 0;
    00138
    00149     virtual bool            endProcess() = 0;
    00150
    00154     virtual void            setWorkerCount(uint32_t workerCount) = 0;
    00155
    00159     virtual uint32_t        getWorkerCount() const = 0;
    00160
    00167     virtual TkGroupWorker*  acquireWorker() = 0;
    00168
    00174     virtual void            returnWorker(TkGroupWorker*) = 0;
    00175
    00179             void            process();
    00180
    00187     virtual void            getStats(TkGroupStats& stats) const = 0;
    00188 };
    00189
    00190 } // namespace Blast
    00191 } // namespace Nv
    00192
    00193
    00194 NV_INLINE void Nv::Blast::TkGroup::process()
    00195 {
    00196     uint32_t jobCount = startProcess();
    00197     if (jobCount > 0)
    00198     {
    00199         TkGroupWorker* worker = acquireWorker();
    00200         for (uint32_t i = 0; i < jobCount; i++)
    00201         {
    00202             worker->process(i);
    00203         }
    00204         returnWorker(worker);
    00205     }
    00206     endProcess();
    00207 }
    00208
    00209
    00210 #endif // ifndef NVBLASTTKGROUP_H

Copyright © 2015-2017 NVIDIA Corporation, 2701 San Tomas Expressway, Santa Clara, CA 95050 U.S.A. All rights reserved. www.nvidia.com