APEX Framework: RenderBufferData.h Source File

NVIDIA APEX

RenderBufferData.h
Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 2008-2017, NVIDIA CORPORATION.  All rights reserved.
00003  *
00004  * NVIDIA CORPORATION and its licensors retain all intellectual property
00005  * and proprietary rights in and to this software, related documentation
00006  * and any modifications thereto.  Any use, reproduction, disclosure or
00007  * distribution of this software and related documentation without an express
00008  * license agreement from NVIDIA CORPORATION is strictly prohibited.
00009  */
00010 
00011 
00012 #ifndef RENDER_BUFFER_DATA_H
00013 #define RENDER_BUFFER_DATA_H
00014 
00020 #include "ApexUsingNamespace.h"
00021 #include "RenderDataFormat.h"
00022 #include "ApexSDK.h"
00023 
00024 namespace nvidia
00025 {
00026 namespace apex
00027 {
00028 
00029 PX_PUSH_PACK_DEFAULT
00030 
00034 class RenderSemanticData
00035 {
00036 public:
00037     const void*             data;   
00038     uint32_t                stride; 
00039     void*                   ident;  
00040     RenderDataFormat::Enum  format; 
00041 
00047     RenderDataFormat::Enum  srcFormat;
00053     bool                    serialize;
00054 public:
00055     PX_INLINE RenderSemanticData(void)
00056     {
00057         data   = 0;
00058         stride = 0;
00059         ident  = 0;
00060         format = RenderDataFormat::UNSPECIFIED;
00061         srcFormat = RenderDataFormat::UNSPECIFIED;
00062         serialize = false;
00063     }
00064 };
00065 
00069 template < class SemanticClass, class SemanticEnum>
00070 class RenderBufferData
00071 {
00072 public:
00073     PX_INLINE RenderBufferData(void)
00074     {
00075         m_numCustomSemantics = 0;
00076         m_customSemanticData = 0;
00077     }
00078 
00082     PX_INLINE const RenderSemanticData& getSemanticData(SemanticEnum semantic) const
00083     {
00084         PX_ASSERT(semantic < SemanticClass::NUM_SEMANTICS);
00085         return m_semanticData[semantic];
00086     }
00087 
00091     PX_INLINE uint32_t getNumCustomSemantics() const
00092     {
00093         return m_numCustomSemantics;
00094     }
00095 
00099     PX_INLINE const RenderSemanticData& getCustomSemanticData(uint32_t index) const
00100     {
00101         PX_ASSERT(index < m_numCustomSemantics);
00102         return m_customSemanticData[index];
00103     }
00104 
00111     PX_INLINE void setCustomSemanticData(RenderSemanticData* data, uint32_t num)
00112     {
00113         m_numCustomSemantics = num;
00114         m_customSemanticData = data;
00115     }
00116 
00120     PX_INLINE void setSemanticData(SemanticEnum semantic, const void* data, uint32_t stride, RenderDataFormat::Enum format, RenderDataFormat::Enum srcFormat = RenderDataFormat::UNSPECIFIED)
00121     {
00122         PX_ASSERT(semantic < SemanticClass::NUM_SEMANTICS);
00123         RenderSemanticData& sd = m_semanticData[semantic];
00124         sd.data   = data;
00125         sd.stride = stride;
00126         sd.format = format;
00127         sd.srcFormat = srcFormat == RenderDataFormat::UNSPECIFIED ? format : srcFormat;
00128     }
00129 
00130 private:
00131     RenderSemanticData  m_semanticData[SemanticClass::NUM_SEMANTICS]; 
00132     uint32_t              m_numCustomSemantics;                         
00133     RenderSemanticData* m_customSemanticData;                           
00134 };
00135 
00139 class ModuleSpecificRenderBufferData
00140 {
00141 public:
00142     AuthObjTypeID           moduleId;                       
00143     RenderSemanticData*     moduleSpecificSemanticData;   
00144     uint32_t                numModuleSpecificSemantics;   
00145 
00146 public:
00147     PX_INLINE ModuleSpecificRenderBufferData(void)
00148     {
00149         moduleId                   = 0;
00150         moduleSpecificSemanticData = 0;
00151         numModuleSpecificSemantics = 0;
00152     }
00153 };
00154 
00155 PX_POP_PACK
00156 
00157 }
00158 } // end namespace nvidia::apex
00159 
00160 #endif // RENDER_BUFFER_DATA_H

Generated on Fri Dec 15 2017 13:58:35
Copyright © 2012-2017 NVIDIA Corporation, 2701 San Tomas Expressway, Santa Clara, CA 95050 U.S.A. All rights reserved.