本文整理汇总了C++中GetDesc函数的典型用法代码示例。如果您正苦于以下问题:C++ GetDesc函数的具体用法?C++ GetDesc怎么用?C++ GetDesc使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GetDesc函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: parseConstantBuffers
void ShaderCompiler::parseConstantBuffers(ID3D12ShaderReflection* reflect, const D3D12_SHADER_DESC& progDesc, std::weak_ptr<DX12DeviceContext> context)
{
for (uint_fast32_t i = 0; i < progDesc.ConstantBuffers; ++i) {
auto cb = reflect->GetConstantBufferByIndex(i);
D3D12_SHADER_BUFFER_DESC cbDesc;
cb->GetDesc(&cbDesc);
LOGS << "Constant buffer : " << cbDesc.Name;
auto& cbuffer = context.lock()->CreateConstanBuffer(cbDesc.Name);
for (uint_fast32_t j = 0; j < cbDesc.Variables; ++j) {
auto var = cb->GetVariableByIndex(j);
D3D12_SHADER_VARIABLE_DESC vardesc;
var->GetDesc(&vardesc);
auto fmt = boost::format("CB var : %1%, Offset: %2%, Size: %3%") % vardesc.Name % vardesc.StartOffset % vardesc.Size;
LOGS << boost::str(fmt);
cbuffer.addVariable(vardesc.Name, vardesc.StartOffset, vardesc.Size);
}
}
}
示例2: assert
void RenderTarget::CreateDepthRenderbuffer()
{
assert(!GetDesc().allowDepthTexture);
assert(m_active);
m_depthRenderBuffer.Reset(new RenderBuffer());
m_depthRenderBuffer->Bind();
glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, GL_DEPTH_COMPONENT24, GetDesc().width, GetDesc().height);
m_depthRenderBuffer->Attach(GL_DEPTH_ATTACHMENT_EXT);
m_depthRenderBuffer->Unbind();
}
示例3: int2
PooledTextureRef ImageBasedLensFlare::Setup(const Ptr<Texture> & brightPassTex)
{
auto setupTexRef = TexturePool::Instance().FindFree({ TEXTURE_2D, brightPassTex->GetDesc() });
auto setupTex = setupTexRef->Get()->Cast<Texture>();
Global::GetRenderEngine()->GetRenderContext()->ClearRenderTarget(setupTex->GetRenderTargetView(0, 0, 1), 0.0f);
auto ps = Shader::FindOrCreate<LensFlareSetupPS>();
Global::GetRenderEngine()->GetRenderContext()->SetBlendState(
BlendStateTemplate<false, false, true, BLEND_PARAM_ONE, BLEND_PARAM_ONE, BLEND_OP_ADD>::Get());
int2 texSize = int2(setupTex->GetDesc().width / 2, setupTex->GetDesc().height / 2);
int2 center = texSize;
for (int i = 0; i < 3; ++i)
{
int2 xy = center - texSize / 2;
ps->SetSRV("brightPassTex", brightPassTex->GetShaderResourceView());
ps->SetSampler("linearSampler", SamplerTemplate<>::Get());
ps->Flush();
DrawQuad({ setupTex->GetRenderTargetView(0, 0, 1) },
(float)xy.x(), (float)xy.y(), (float)texSize.x(), (float)texSize.y());
texSize /= 2;
}
for (int i = 0; i < 5; ++i)
{
int2 xy = center - texSize / 2;
ps->SetSRV("brightPassTex", brightPassTex->GetShaderResourceView());
ps->SetSampler("linearSampler", SamplerTemplate<>::Get());
ps->Flush();
DrawQuad({ setupTex->GetRenderTargetView(0, 0, 1) },
(float)xy.x(), (float)xy.y(), (float)texSize.x(), (float)texSize.y(),
1.0f, 1.0f, -1.0f, -1.0f);
texSize *= 2;
}
Global::GetRenderEngine()->GetRenderContext()->SetBlendState(nullptr);
return setupTexRef;
}
示例4: GetDesc
void CProfiler::BuildTree(HWND m_hTree,IProfileNode *pNode,HTREEITEM hItem)
{
if(!pNode)return;
char szMsg[256];
GetDesc(szMsg,pNode);
char szItem[512];
char *pName = (char*)pNode->GetName();
if(!pName)return;
int iSize = strlen(pName);
strcpy(szItem,pNode->GetName());
for(int k = 0; k < 32 - iSize; k++)
{
strcat(szItem," ");
}
strcat(szItem,szMsg);
HTREEITEM hNow = InsertItem(m_hTree,hItem,szItem);
TreeView_Expand(m_hTree,hItem,TVE_EXPAND);
IProfileNode *pChild = pNode->GetChild();
if(pChild)
{
while(pChild)
{
BuildTree(m_hTree,pChild,hNow);
pChild = pChild->GetSibling();
}
}
}
示例5: MOZ_ASSERT
void
FontFace::GetDesc(nsCSSFontDesc aDescID,
nsCSSProperty aPropID,
nsString& aResult) const
{
MOZ_ASSERT(aDescID == eCSSFontDesc_UnicodeRange ||
aPropID != eCSSProperty_UNKNOWN,
"only pass eCSSProperty_UNKNOWN for eCSSFontDesc_UnicodeRange");
nsCSSValue value;
GetDesc(aDescID, value);
aResult.Truncate();
// Fill in a default value for missing descriptors.
if (value.GetUnit() == eCSSUnit_Null) {
if (aDescID == eCSSFontDesc_UnicodeRange) {
aResult.AssignLiteral("U+0-10FFFF");
} else if (aDescID != eCSSFontDesc_Family &&
aDescID != eCSSFontDesc_Src) {
aResult.AssignLiteral("normal");
}
return;
}
if (aDescID == eCSSFontDesc_UnicodeRange) {
// Since there's no unicode-range property, we can't use
// nsCSSValue::AppendToString to serialize this descriptor.
nsStyleUtil::AppendUnicodeRange(value, aResult);
} else {
value.AppendToString(aPropID, aResult, nsCSSValue::eNormalized);
}
}
示例6: Transform
void Transform(
const Ptr<ShaderResourceView> & src,
const Ptr<RenderTargetView> & dst,
const Vector<ColorWriteMask, 4> & colorWriteMask,
const float4 & srcRect,
const float4 & dstRect,
const Ptr<class Sampler> & sampler,
const Ptr<DepthStencilView> & dsv )
{
auto rc = Global::GetRenderEngine()->GetRenderContext();
std::map<String, String> macros;
for (int32_t i = 0; i < 4; ++i)
{
auto & writeMask = colorWriteMask[i];
String writeChannel = std::to_string(static_cast<uint32_t>(std::log2(static_cast<uint32_t>(writeMask))));
macros["COLOR_CHANNEL_" + std::to_string(i)] = writeChannel;
}
auto transformPS = Shader::FindOrCreate<TransformPS>(macros);
transformPS->SetSampler("transformSampler", sampler ? sampler : SamplerTemplate<>::Get());
transformPS->SetSRV("srcTex", src);
transformPS->Flush();
auto srcTex = src->GetResource()->Cast<Texture>();
float topLeftU = srcRect.x() / static_cast<float>(srcTex->GetDesc().width);
float topLeftV = srcRect.y() / static_cast<float>(srcTex->GetDesc().height);
float uvWidth = srcRect.z() / static_cast<float>(srcTex->GetDesc().width);
float uvHeight = srcRect.w() / static_cast<float>(srcTex->GetDesc().height);
if (uvWidth == 0.0f)
uvWidth = 1.0f;
if (uvHeight == 0.0f)
uvHeight = 1.0f;
DrawQuad({ dst },
dstRect.x(),
dstRect.y(),
dstRect.z(),
dstRect.w(),
topLeftU,
topLeftV,
uvWidth,
uvHeight,
dsv);
}
示例7: GetTextureSizeD3D
void GetTextureSizeD3D( ID3D11Resource* res, unsigned int* width, unsigned int* height )
{
DebugAssert( res != 0, "Tried to get size of texture on a null ID3D11Resource (the texture resource bound to graphics card)");
// This is the most generic solution. you can make it a lot
// simpler if you know it will always be a 2D texture file
D3D11_RESOURCE_DIMENSION dim;
res->GetType( &dim );
switch(dim)
{
case D3D11_RESOURCE_DIMENSION_TEXTURE1D:
{
auto txt = reinterpret_cast<ID3D11Texture1D*>( res );
D3D11_TEXTURE1D_DESC desc;
txt->GetDesc( &desc );
if ( width ) *width = desc.Width;
if ( height ) *height = 1;
}
break;
case D3D11_RESOURCE_DIMENSION_TEXTURE2D:
{
auto txt = reinterpret_cast<ID3D11Texture2D*>( res );
D3D11_TEXTURE2D_DESC desc;
txt->GetDesc( &desc );
if ( width ) *width = desc.Width;
if ( height ) *height = desc.Height;
}
break;
case D3D11_RESOURCE_DIMENSION_TEXTURE3D:
{
auto txt = reinterpret_cast<ID3D11Texture3D*>( res );
D3D11_TEXTURE3D_DESC desc;
txt->GetDesc( &desc );
if ( width ) *width = desc.Width;
if ( height ) *height = desc.Height;
}
break;
default:
if ( width ) *width = 0;
if ( height ) *height = 0;
break;
}
}
示例8: PROFILE_SCOPED
void VertexBuffer::BufferData(const size_t size, void *data)
{
PROFILE_SCOPED()
assert(m_mapMode == BUFFER_MAP_NONE); //must not be currently mapped
if (GetDesc().usage == BUFFER_USAGE_DYNAMIC) {
glBindVertexArray(m_vao);
glBindBuffer(GL_ARRAY_BUFFER, m_buffer);
glBufferData(GL_ARRAY_BUFFER, (GLsizeiptr)size, (GLvoid*)data, GL_DYNAMIC_DRAW);
}
}
示例9: ASSERT_VALID
///////////////////////////////////////////////////////////////////////
// CChart::Convert
// Create CChart with input record string; Return NULL if invalid
//
BOOL CChart::Convert( const char* pszChartFileRecord )
{
ASSERT_VALID( this );
BOOL match, done;
int field, sidx, slen;
CString s = CString( pszChartFileRecord );
slen = s.GetLength();
done = FALSE;
sidx = 0;
for( field=0; done == FALSE; field++ )
{
match = FALSE;
switch( field )
{
case 0: /* "a," */
if ( s.Left(2) == "a," ) match = TRUE;
sidx += 2;
break;
case 1: /* account no. - X, XX, or XXX, */
match = SetChartAcct( (s.Mid( sidx )).SpanExcluding(","));
sidx += m_ChartAcct.GetLength() + 1;
break;
case 2: /* description - XX...X, or XX...X\n */
match = SetDesc( (s.Mid( sidx )).SpanExcluding(",\n") );
sidx += GetDesc().GetLength() + 1;
if ( sidx-1 >= slen || s[sidx-1] == '\n' ) done = TRUE;
break;
case 3: /* Old account - NULL X XX XXX followed by , or \n */
match = SetOldAcct( (s.Mid( sidx )).SpanExcluding(",\n") );
sidx += m_OldAcct.GetLength() + 1;
if( sidx-1 >= slen || s[sidx-1] == '\n' ) done = TRUE;
break;
case 4: /* Summary Account Flag - NULL\n or s\n */
//cerr << "\"" << (s.Mid( sidx )).SpanExcluding("\n") "\"\n";
match = SetSummaryAcct( (s.Mid( sidx )).SpanExcluding("\n") );
if ( sidx >= slen || s[sidx] == '\n' || s[sidx+1] == '\n' ) done = TRUE;
break;
} // switch
if( match == FALSE ) {
cerr << pszChartFileRecord
<< "Invalid Chart Record\n";
done = TRUE;
}
} // for
return match;
} // function
示例10: V
void DX11Engine::createSwapChainRenderTargets(IUnknown** ppRTV, IUnknown** ppRTVsRGB,
IUnknown** ppDSV, IUnknown* pNativeDevice, IUnknown* pSwapChainIn,
size_t length, const char* debugName) const
{
auto pSwapChain = reinterpret_cast<IDXGISwapChain*>(pSwapChainIn);
auto pDevice = reinterpret_cast<ID3D11Device*>(pNativeDevice);
HRESULT hr = S_OK;
std::unique_ptr<ID3D11Texture2D, COMDeleter> pD3D11Texture;
// rtv
DXGI_SWAP_CHAIN_DESC desc;
V(pSwapChain->GetDesc(&desc));
V(pSwapChain->GetBuffer(0, __uuidof(ID3D11Texture2D), ref(pD3D11Texture)));
STAR_SET_DEBUG_NAME(pD3D11Texture, length, debugName);
CD3D11_RENDER_TARGET_VIEW_DESC rtvDesc(D3D11_RTV_DIMENSION_TEXTURE2D);
rtvDesc.Format = DXGI_FORMAT_B8G8R8A8_UNORM;
ID3D11RenderTargetView* pRTV;
V(pDevice->CreateRenderTargetView(pD3D11Texture.get(), &rtvDesc, &pRTV));
*ppRTV = pRTV;
STAR_SET_DEBUG_NAME(pRTV, length, debugName);
rtvDesc.Format = DXGI_FORMAT_B8G8R8A8_UNORM_SRGB;
V(pDevice->CreateRenderTargetView(pD3D11Texture.get(), &rtvDesc, &pRTV));
*ppRTVsRGB = pRTV;
STAR_SET_DEBUG_STRING(pRTV, (debugName + std::string("_sRGB")));
// dsv
if(ppDSV) {
D3D11_TEXTURE2D_DESC descTex2D = {
desc.BufferDesc.Width,
desc.BufferDesc.Height,
1, 1, DXGI_FORMAT_D32_FLOAT,{ 1, 0 },
D3D11_USAGE_DEFAULT, D3D11_BIND_DEPTH_STENCIL,
0, 0
};
std::unique_ptr<ID3D11Texture2D, COMDeleter> pDST;
V(pDevice->CreateTexture2D(&descTex2D, nullptr, ref(pDST)));
STAR_SET_DEBUG_NAME(pDST, length, debugName);
D3D11_DEPTH_STENCIL_VIEW_DESC descV = {
DXGI_FORMAT_D32_FLOAT, D3D11_DSV_DIMENSION_TEXTURE2D, 0,{ 0 }
};
ID3D11DepthStencilView* pDSV;
V(pDevice->CreateDepthStencilView(pDST.get(), &descV, &pDSV));
*ppDSV = pDSV;
STAR_SET_DEBUG_NAME(pDSV, length, debugName);
}
}
示例11: L
TError TNlLink::WaitAddress(int timeout_s) {
struct nl_cache *cache;
int ret;
L() << "Wait for autoconf at " << GetDesc() << std::endl;
ret = rtnl_addr_alloc_cache(GetSock(), &cache);
if (ret < 0)
return Nl->Error(ret, "Cannot allocate addr cache");
do {
for (auto obj = nl_cache_get_first(cache); obj; obj = nl_cache_get_next(obj)) {
auto addr = (struct rtnl_addr *)obj;
if (!rtnl_addr_get_local(addr) ||
rtnl_addr_get_ifindex(addr) != GetIndex() ||
rtnl_addr_get_family(addr) != AF_INET6 ||
rtnl_addr_get_scope(addr) >= RT_SCOPE_LINK ||
(rtnl_addr_get_flags(addr) &
(IFA_F_TENTATIVE | IFA_F_DEPRECATED)))
continue;
L() << "Got " << TNlAddr(rtnl_addr_get_local(addr)).Format()
<< " at " << GetDesc() << std::endl;
nl_cache_free(cache);
return TError::Success();
}
usleep(1000000);
ret = nl_cache_refill(GetSock(), cache);
if (ret < 0)
return Nl->Error(ret, "Cannot refill address cache");
} while (--timeout_s > 0);
nl_cache_free(cache);
return TError(EError::Unknown, "Network autoconf timeout");
}
示例12: _T
int HostIO_CyUSB::OpenEx(CameraID cID)
{
int numDevs;
USHORT VID;
USHORT PID;
bool bFoundDevice = false;
m_log->Write(2, _T("OpenEx name: %s"), cID.SerialToOpen.c_str());
numDevs = cyusb_open();
for (int i = 0; i < (int)numDevs; i++)
{
h = cyusb_gethandle(i);
VID = cyusb_getvendor(h);
PID = cyusb_getproduct(h);
std::string SerialNum = std::string("None");
GetSerialNumber(SerialNum);
std::string SerialToOpen = SerialNum;
std::string Desc = std::string("None");
GetDesc(Desc);
m_log->Write(2, _T("Dev %d:"), i);
m_log->Write(2, _T(" SerialNumber=%s"), SerialNum.c_str());
m_log->Write(2, _T(" Description=%s"), Desc.c_str());
if (VID == QSICyVID && PID == QSICyPID && SerialNum == cID.SerialToOpen )
{
m_log->Write(2, _T("USB Open found QSI Cy device at index: %d, Serial: %s, Description: %s"),
i, SerialNum.c_str(), Desc.c_str());
bFoundDevice = true;
break;
}
}
if (bFoundDevice && cyusb_kernel_driver_active(h, 0) == 0 && cyusb_claim_interface(h, 0) == 0)
{
SetTimeouts(READ_TIMEOUT, WRITE_TIMEOUT);
}
else
{
m_log->Write(2, "No devices matched");
}
m_log->Write(2, _T("OpenEx Done."));
return bFoundDevice ? ALL_OK : ERR_USB_OpenFailed;
}
示例13: assert
Uint8 *VertexBuffer::MapInternal(BufferMapMode mode, size_t length)
{
assert(mode != BUFFER_MAP_NONE); //makes no sense
assert(m_mapMode == BUFFER_MAP_NONE); //must not be currently mapped
m_mapMode = mode;
if (GetDesc().usage == BUFFER_USAGE_STATIC) {
glBindBuffer(GL_ARRAY_BUFFER, m_buffer);
if (mode == BUFFER_MAP_READ)
return reinterpret_cast<Uint8*>(glMapBuffer(GL_ARRAY_BUFFER, GL_READ_ONLY));
else if (mode == BUFFER_MAP_WRITE)
return reinterpret_cast<Uint8*>(glMapBuffer(GL_ARRAY_BUFFER, GL_WRITE_ONLY));
}
return m_data;
}
示例14: ReflectShaderConstantBuffer
static void ReflectShaderConstantBuffer(
ID3D12ShaderReflection* reflection,
ShaderReflectionDescriptor& reflectionDesc,
const D3D12_SHADER_DESC& shaderDesc,
const D3D12_SHADER_INPUT_BIND_DESC& inputBindDesc,
long stageFlags,
UINT& cbufferIdx)
{
/* Initialize resource view descriptor for constant buffer */
auto resourceView = FetchOrInsertResource(reflectionDesc, inputBindDesc.Name, ResourceType::Buffer, inputBindDesc.BindPoint);
{
resourceView->bindFlags |= BindFlags::ConstantBuffer;
resourceView->stageFlags |= stageFlags;
resourceView->arraySize = inputBindDesc.BindCount;
}
/* Determine constant buffer size */
if (cbufferIdx < shaderDesc.ConstantBuffers)
{
auto cbufferReflection = reflection->GetConstantBufferByIndex(cbufferIdx++);
D3D12_SHADER_BUFFER_DESC shaderBufferDesc;
auto hr = cbufferReflection->GetDesc(&shaderBufferDesc);
DXThrowIfFailed(hr, "failed to retrieve D3D12 shader buffer descriptor");
if (shaderBufferDesc.Type == D3D_CT_CBUFFER)
{
/* Store constant buffer size in output descriptor */
resourceView->constantBufferSize = shaderBufferDesc.Size;
}
else
{
/* Type mismatch in descriptors */
throw std::runtime_error(
"failed to match D3D12 shader buffer descriptor \"" + std::string(shaderBufferDesc.Name) +
"\" with input binding descriptor for constant buffer \"" + std::string(inputBindDesc.Name) + "\""
);
}
}
else
{
/* Resource index mismatch in descriptor */
throw std::runtime_error(
"failed to find D3D12 shader buffer descriptor for input binding descriptor \"" +
std::string(inputBindDesc.Name) + "\""
);
}
}
示例15: GetSyntaxHelp
//-----------------------------------------------------------------------------
//
//-----------------------------------------------------------------------------
MStatus CVsSkinnerCmd::redoIt()
{
if ( m_undo.ArgDatabase().isFlagSet( kOptHelp ) )
{
GetSyntaxHelp()->PrintHelp( GetName(), GetDesc() );
return MS::kSuccess;
}
m_undo.SaveCurrentSelection();
if ( m_undo.ArgDatabase().isFlagSet( kOptCreate ) )
{
return DoCreate();
}
else if ( m_undo.ArgDatabase().isFlagSet( kOptNewVolume ) )
{
MSelectionList optSelectionList;
m_undo.ArgDatabase().getObjects( optSelectionList );
MSelectionList volumeList( DoNewVolumes( GetSpecifiedSkinnerNode(), optSelectionList ) );
if ( volumeList.length() == 0 )
{
merr << "Couldn't create new volumes" << std::endl;
return MS::kFailure;
}
MGlobal::setActiveSelectionList( volumeList, MGlobal::kReplaceList );
MStringArray vA;
volumeList.getSelectionStrings( vA );
setResult( vA );
return MS::kSuccess;
}
else if ( m_undo.ArgDatabase().isFlagSet( kOptAttachMesh ) )
{
return DoAttachMesh( GetSpecifiedSkinnerNode(), GetSpecifiedMesh() );
}
else if ( m_undo.ArgDatabase().isFlagSet( kOptDetachMesh ) )
{
return DoDetachMesh( GetSpecifiedSkinnerNode() );
}
else if ( m_undo.ArgDatabase().isFlagSet( kOptLs ) )
{
return DoLs();
}
merr << GetName() << ": No action specified" << std::endl;
return MS::kFailure;
}