这篇教程C++ GetType函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中GetType函数的典型用法代码示例。如果您正苦于以下问题:C++ GetType函数的具体用法?C++ GetType怎么用?C++ GetType使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了GetType函数的25个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: idVarDef/*============idProgram::AllocDef============*/idVarDef *idProgram::AllocDef( idTypeDef *type, const char *name, idVarDef *scope, bool constant ) { idVarDef *def; idStr element; idVarDef *def_x; idVarDef *def_y; idVarDef *def_z; // allocate a new def def = new idVarDef( type ); def->scope = scope; def->numUsers = 1; def->num = varDefs.Append( def ); // add the def to the list with defs with this name and set the name pointer AddDefToNameList( def, name ); if ( ( type->Type() == ev_vector ) || ( ( type->Type() == ev_field ) && ( type->FieldType()->Type() == ev_vector ) ) ) { // // vector // if ( !strcmp( name, RESULT_STRING ) ) { // <RESULT> vector defs don't need the _x, _y and _z components assert( scope->Type() == ev_function ); def->value.stackOffset = scope->value.functionPtr->locals; def->initialized = idVarDef::stackVariable; scope->value.functionPtr->locals += type->Size(); } else if ( scope->TypeDef()->Inherits( &type_object ) ) { idTypeDef newtype( ev_field, NULL, "float field", 0, &type_float ); idTypeDef *type = GetType( newtype, true ); // set the value to the variable's position in the object def->value.ptrOffset = scope->TypeDef()->Size(); // make automatic defs for the vectors elements // origin can be accessed as origin_x, origin_y, and origin_z sprintf( element, "%s_x", def->Name() ); def_x = AllocDef( type, element, scope, constant ); sprintf( element, "%s_y", def->Name() ); def_y = AllocDef( type, element, scope, constant ); def_y->value.ptrOffset = def_x->value.ptrOffset + type_float.Size(); sprintf( element, "%s_z", def->Name() ); def_z = AllocDef( type, element, scope, constant ); def_z->value.ptrOffset = def_y->value.ptrOffset + type_float.Size(); } else { // make automatic defs for the vectors elements // origin can be accessed as origin_x, origin_y, and origin_z sprintf( element, "%s_x", def->Name() ); def_x = AllocDef( &type_float, element, scope, constant ); sprintf( element, "%s_y", def->Name() ); def_y = AllocDef( &type_float, element, scope, constant ); sprintf( element, "%s_z", def->Name() ); def_z = AllocDef( &type_float, element, scope, constant ); // point the vector def to the x coordinate def->value = def_x->value; def->initialized = def_x->initialized; } } else if ( scope->TypeDef()->Inherits( &type_object ) ) { // // object variable // // set the value to the variable's position in the object def->value.ptrOffset = scope->TypeDef()->Size(); } else if ( scope->Type() == ev_function ) { // // stack variable // // since we don't know how many local variables there are, // we have to have them go backwards on the stack def->value.stackOffset = scope->value.functionPtr->locals; def->initialized = idVarDef::stackVariable; if ( type->Inherits( &type_object ) ) { // objects only have their entity number on the stack, not the entire object scope->value.functionPtr->locals += type_object.Size(); } else { scope->value.functionPtr->locals += type->Size(); } } else { // // global variable // def->value.bytePtr = &variables[ numVariables ]; numVariables += def->TypeDef()->Size(); if ( numVariables > sizeof( variables ) ) { throw idCompileError( va( "Exceeded global memory size (%d bytes)", sizeof( variables ) ) ); } memset( def->value.bytePtr, 0, def->TypeDef()->Size() ); }//.........这里部分代码省略.........
开发者ID:bagobor,项目名称:doom3.gpl,代码行数:101,
示例2: ifvoid WrappedID3D11DeviceContext::ProcessChunk(uint64_t offset, D3D11ChunkType chunk, bool forceExecute){ if(chunk < FIRST_CONTEXT_CHUNK && !forceExecute) { if(m_State == READING) { m_pDevice->GetResourceManager()->MarkInFrame(false); m_pDevice->ProcessChunk(offset, chunk); m_pSerialiser->PopContext(NULL, chunk); m_pDevice->GetResourceManager()->MarkInFrame(true); } else if(m_State == EXECUTING) { m_pSerialiser->SkipCurrentChunk(); m_pSerialiser->PopContext(NULL, chunk); } return; } m_CurChunkOffset = offset; RDCASSERT(GetType() == D3D11_DEVICE_CONTEXT_IMMEDIATE); uint64_t cOffs = m_pSerialiser->GetOffset(); ResourceId ctxId; m_pSerialiser->Serialise("context", ctxId); WrappedID3D11DeviceContext *context = (WrappedID3D11DeviceContext *)m_pDevice->GetResourceManager()->GetLiveResource(ctxId); if(m_FakeContext != ResourceId()) { if(m_FakeContext == ctxId) context = this; else { m_pSerialiser->SetOffset(cOffs); m_pSerialiser->SkipCurrentChunk(); m_pSerialiser->PopContext(NULL, chunk); return; } } RDCASSERT(WrappedID3D11DeviceContext::IsAlloc(context)); LogState state = context->m_State; if(forceExecute) context->m_State = EXECUTING; else context->m_State = m_State; m_AddedDrawcall = false; switch(chunk) { case SET_INPUT_LAYOUT: context->Serialise_IASetInputLayout(0x0); break; case SET_VBUFFER: context->Serialise_IASetVertexBuffers(0, 0, 0x0, 0x0, 0x0); break; case SET_IBUFFER: context->Serialise_IASetIndexBuffer(0, DXGI_FORMAT_UNKNOWN, 0); break; case SET_TOPOLOGY: context->Serialise_IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_UNDEFINED); break; case SET_VS_CBUFFERS: context->Serialise_VSSetConstantBuffers(0, 0, 0x0); break; case SET_VS_RESOURCES: context->Serialise_VSSetShaderResources(0, 0, 0x0); break; case SET_VS_SAMPLERS: context->Serialise_VSSetSamplers(0, 0, 0x0); break; case SET_VS: context->Serialise_VSSetShader(0x0, 0x0, 0); break; case SET_HS_CBUFFERS: context->Serialise_HSSetConstantBuffers(0, 0, 0x0); break; case SET_HS_RESOURCES: context->Serialise_HSSetShaderResources(0, 0, 0x0); break; case SET_HS_SAMPLERS: context->Serialise_HSSetSamplers(0, 0, 0x0); break; case SET_HS: context->Serialise_HSSetShader(0x0, 0x0, 0); break; case SET_DS_CBUFFERS: context->Serialise_DSSetConstantBuffers(0, 0, 0x0); break;//.........这里部分代码省略.........
开发者ID:FeuernD,项目名称:renderdoc,代码行数:101,
|