本文整理汇总了C++中SerialiserType::Serialise方法的典型用法代码示例。如果您正苦于以下问题:C++ SerialiserType::Serialise方法的具体用法?C++ SerialiserType::Serialise怎么用?C++ SerialiserType::Serialise使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SerialiserType
的用法示例。
在下文中一共展示了SerialiserType::Serialise方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DoSerialise
void DoSerialise(SerialiserType &ser, DynamicDescriptorCopy &el)
{
D3D12ResourceManager *rm = (D3D12ResourceManager *)ser.GetUserData();
SERIALISE_MEMBER(type);
PortableHandle dst, src;
if(ser.IsWriting())
{
dst = ToPortableHandle(el.dst);
src = ToPortableHandle(el.src);
}
ser.Serialise("dst", dst);
ser.Serialise("src", src);
if(ser.IsReading())
{
if(rm)
{
el.dst = DescriptorFromPortableHandle(rm, dst);
el.src = DescriptorFromPortableHandle(rm, src);
}
else
{
el.dst = NULL;
el.src = NULL;
}
}
}
示例2: DoSerialise
void DoSerialise(SerialiserType &ser, D3D12_CACHED_PIPELINE_STATE &el)
{
// don't serialise these, just set to NULL/0. See the definition of SERIALISE_MEMBER_DUMMY
SERIALISE_MEMBER_ARRAY_EMPTY(pCachedBlob);
uint64_t CachedBlobSizeInBytes = 0;
ser.Serialise("CachedBlobSizeInBytes", CachedBlobSizeInBytes);
}
示例3: DoSerialise
void DoSerialise(SerialiserType &ser, ProgramUniformValue &el)
{
SERIALISE_MEMBER(Type);
SERIALISE_MEMBER(Location);
// some special logic here, we decode Type to figure out what the actual data is, and serialise it
// with the right type.
VarType baseType = VarType::Float;
uint32_t elemCount = 1;
switch(el.Type)
{
case eGL_FLOAT_MAT4:
case eGL_FLOAT_MAT4x3:
case eGL_FLOAT_MAT4x2:
case eGL_FLOAT_MAT3:
case eGL_FLOAT_MAT3x4:
case eGL_FLOAT_MAT3x2:
case eGL_FLOAT_MAT2:
case eGL_FLOAT_MAT2x4:
case eGL_FLOAT_MAT2x3:
case eGL_FLOAT:
case eGL_FLOAT_VEC2:
case eGL_FLOAT_VEC3:
case eGL_FLOAT_VEC4: baseType = VarType::Float; break;
case eGL_DOUBLE_MAT4:
case eGL_DOUBLE_MAT4x3:
case eGL_DOUBLE_MAT4x2:
case eGL_DOUBLE_MAT3:
case eGL_DOUBLE_MAT3x4:
case eGL_DOUBLE_MAT3x2:
case eGL_DOUBLE_MAT2:
case eGL_DOUBLE_MAT2x4:
case eGL_DOUBLE_MAT2x3:
case eGL_DOUBLE:
case eGL_DOUBLE_VEC2:
case eGL_DOUBLE_VEC3:
case eGL_DOUBLE_VEC4: baseType = VarType::Double; break;
case eGL_SAMPLER_1D:
case eGL_SAMPLER_2D:
case eGL_SAMPLER_3D:
case eGL_SAMPLER_CUBE:
case eGL_SAMPLER_CUBE_MAP_ARRAY:
case eGL_SAMPLER_1D_SHADOW:
case eGL_SAMPLER_2D_SHADOW:
case eGL_SAMPLER_1D_ARRAY:
case eGL_SAMPLER_2D_ARRAY:
case eGL_SAMPLER_1D_ARRAY_SHADOW:
case eGL_SAMPLER_2D_ARRAY_SHADOW:
case eGL_SAMPLER_2D_MULTISAMPLE:
case eGL_SAMPLER_2D_MULTISAMPLE_ARRAY:
case eGL_SAMPLER_CUBE_SHADOW:
case eGL_SAMPLER_CUBE_MAP_ARRAY_SHADOW:
case eGL_SAMPLER_BUFFER:
case eGL_SAMPLER_2D_RECT:
case eGL_SAMPLER_2D_RECT_SHADOW:
case eGL_INT_SAMPLER_1D:
case eGL_INT_SAMPLER_2D:
case eGL_INT_SAMPLER_3D:
case eGL_INT_SAMPLER_CUBE:
case eGL_INT_SAMPLER_CUBE_MAP_ARRAY:
case eGL_INT_SAMPLER_1D_ARRAY:
case eGL_INT_SAMPLER_2D_ARRAY:
case eGL_INT_SAMPLER_2D_MULTISAMPLE:
case eGL_INT_SAMPLER_2D_MULTISAMPLE_ARRAY:
case eGL_INT_SAMPLER_BUFFER:
case eGL_INT_SAMPLER_2D_RECT:
case eGL_UNSIGNED_INT_SAMPLER_1D:
case eGL_UNSIGNED_INT_SAMPLER_2D:
case eGL_UNSIGNED_INT_SAMPLER_3D:
case eGL_UNSIGNED_INT_SAMPLER_CUBE:
case eGL_UNSIGNED_INT_SAMPLER_1D_ARRAY:
case eGL_UNSIGNED_INT_SAMPLER_2D_ARRAY:
case eGL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE:
case eGL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE_ARRAY:
case eGL_UNSIGNED_INT_SAMPLER_BUFFER:
case eGL_UNSIGNED_INT_SAMPLER_2D_RECT:
case eGL_IMAGE_1D:
case eGL_IMAGE_2D:
case eGL_IMAGE_3D:
case eGL_IMAGE_2D_RECT:
case eGL_IMAGE_CUBE:
case eGL_IMAGE_BUFFER:
case eGL_IMAGE_1D_ARRAY:
case eGL_IMAGE_2D_ARRAY:
case eGL_IMAGE_CUBE_MAP_ARRAY:
case eGL_IMAGE_2D_MULTISAMPLE:
case eGL_IMAGE_2D_MULTISAMPLE_ARRAY:
case eGL_INT_IMAGE_1D:
case eGL_INT_IMAGE_2D:
case eGL_INT_IMAGE_3D:
case eGL_INT_IMAGE_2D_RECT:
case eGL_INT_IMAGE_CUBE:
case eGL_INT_IMAGE_BUFFER:
case eGL_INT_IMAGE_1D_ARRAY:
case eGL_INT_IMAGE_2D_ARRAY:
case eGL_INT_IMAGE_2D_MULTISAMPLE:
case eGL_INT_IMAGE_2D_MULTISAMPLE_ARRAY:
case eGL_UNSIGNED_INT_IMAGE_1D:
//.........这里部分代码省略.........
示例4: Serialise_wglDXLockObjectsNV
bool WrappedOpenGL::Serialise_wglDXLockObjectsNV(SerialiserType &ser, GLResource Resource)
{
SERIALISE_ELEMENT(Resource);
SERIALISE_ELEMENT_LOCAL(textype, Resource.Namespace == eResBuffer
? eGL_NONE
: m_Textures[GetResourceManager()->GetID(Resource)].curType)
.Hidden();
const GLHookSet &gl = m_Real;
// buffer contents are easier to save
if(textype == eGL_NONE)
{
byte *Contents = NULL;
uint32_t length = 1;
// while writing, fetch the buffer's size and contents
if(ser.IsWriting())
{
gl.glGetNamedBufferParameterivEXT(Resource.name, eGL_BUFFER_SIZE, (GLint *)&length);
Contents = new byte[length];
GLuint oldbuf = 0;
gl.glGetIntegerv(eGL_COPY_READ_BUFFER_BINDING, (GLint *)&oldbuf);
gl.glBindBuffer(eGL_COPY_READ_BUFFER, Resource.name);
gl.glGetBufferSubData(eGL_COPY_READ_BUFFER, 0, (GLsizeiptr)length, Contents);
gl.glBindBuffer(eGL_COPY_READ_BUFFER, oldbuf);
}
SERIALISE_ELEMENT_ARRAY(Contents, length);
SERIALISE_CHECK_READ_ERRORS();
// restore on replay
if(IsReplayingAndReading())
{
uint32_t liveLength = 1;
gl.glGetNamedBufferParameterivEXT(Resource.name, eGL_BUFFER_SIZE, (GLint *)&liveLength);
gl.glNamedBufferSubData(Resource.name, 0, (GLsizeiptr)RDCMIN(length, liveLength), Contents);
}
}
else
{
GLuint ppb = 0, pub = 0;
PixelPackState pack;
PixelUnpackState unpack;
// save and restore pixel pack/unpack state. We only need one or the other but for clarity we
// push and pop both always.
if(ser.IsWriting() || !IsStructuredExporting(m_State))
{
gl.glGetIntegerv(eGL_PIXEL_PACK_BUFFER_BINDING, (GLint *)&ppb);
gl.glGetIntegerv(eGL_PIXEL_UNPACK_BUFFER_BINDING, (GLint *)&pub);
gl.glBindBuffer(eGL_PIXEL_PACK_BUFFER, 0);
gl.glBindBuffer(eGL_PIXEL_UNPACK_BUFFER, 0);
pack.Fetch(&gl, false);
unpack.Fetch(&gl, false);
ResetPixelPackState(gl, false, 1);
ResetPixelUnpackState(gl, false, 1);
}
TextureData &details = m_Textures[GetResourceManager()->GetID(Resource)];
GLuint tex = Resource.name;
// serialise the metadata for convenience
SERIALISE_ELEMENT_LOCAL(internalFormat, details.internalFormat).Hidden();
SERIALISE_ELEMENT_LOCAL(width, details.width).Hidden();
SERIALISE_ELEMENT_LOCAL(height, details.height).Hidden();
SERIALISE_ELEMENT_LOCAL(depth, details.depth).Hidden();
RDCASSERT(internalFormat == details.internalFormat, internalFormat, details.internalFormat);
RDCASSERT(width == details.width, width, details.width);
RDCASSERT(height == details.height, height, details.height);
RDCASSERT(depth == details.depth, depth, details.depth);
GLenum fmt = GetBaseFormat(internalFormat);
GLenum type = GetDataType(internalFormat);
GLint dim = details.dimension;
uint32_t size = (uint32_t)GetByteSize(width, height, depth, fmt, type);
int mips = 0;
if(IsReplayingAndReading())
mips = GetNumMips(gl, textype, tex, width, height, depth);
byte *scratchBuf = NULL;
// on read and write, we allocate a single buffer big enough for all mips and re-use it
// to avoid repeated new/free.
scratchBuf = AllocAlignedBuffer(size);
GLuint prevtex = 0;
if(!IsStructuredExporting(m_State))
//.........这里部分代码省略.........