本文整理汇总了C++中GetDesc函数的典型用法代码示例。如果您正苦于以下问题:C++ GetDesc函数的具体用法?C++ GetDesc怎么用?C++ GetDesc使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GetDesc函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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);
}
}
}
开发者ID:FeodorFitsner,项目名称:takoyaki,代码行数:25,代码来源:shader_compiler.cpp
示例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();
}
开发者ID:Loki999,项目名称:pioneer,代码行数:10,代码来源:GL2RenderTarget.cpp
示例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;
}
开发者ID:BenKZSSS,项目名称:ToyGE,代码行数:48,代码来源:ImageBasedLensFlare.cpp
示例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();
}
}
}
开发者ID:weimingtom,项目名称:xgame,代码行数:33,代码来源:profile.cpp
示例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);
}
}
开发者ID:bolt-dev,项目名称:gecko-dev,代码行数:33,代码来源:FontFace.cpp
示例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);
}
开发者ID:BenKZSSS,项目名称:ToyGE,代码行数:46,代码来源:RenderUtil.cpp
示例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;
}
}
开发者ID:Cody-Duncan,项目名称:ShadyTreeEngine2,代码行数:44,代码来源:TextureResourcer.cpp
示例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);
}
}
开发者ID:senderghost,项目名称:pioneer,代码行数:10,代码来源:VertexBufferGL.cpp
示例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
开发者ID:jkozik,项目名称:nf1988,代码行数:57,代码来源:CHART.CPP
示例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);
}
}
开发者ID:Zhou-Zhenglong,项目名称:star,代码行数:53,代码来源:SDX11Engine.cpp
示例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");
}
开发者ID:dcherednik,项目名称:porto,代码行数:38,代码来源:netlink.cpp
示例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;
}
开发者ID:azwing,项目名称:indi,代码行数:50,代码来源:HostIO_CyUSB.cpp
示例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;
}
开发者ID:MeteoricGames,项目名称:pioneer,代码行数:15,代码来源:GL2VertexBuffer.cpp
示例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) + "\""
);
}
}
开发者ID:LukasBanana,项目名称:LLGL,代码行数:48,代码来源:D3D12Shader.cpp
示例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;
}
开发者ID:DeadZoneLuna,项目名称:SourceEngine2007,代码行数:51,代码来源:vsSkinnerCmd.cpp
示例16: while
VertexBuffer::VertexBuffer(const VertexBufferDesc &desc)
{
m_desc = desc;
//update offsets in desc
for (Uint32 i = 0; i < MAX_ATTRIBS; i++) {
if (m_desc.attrib[i].offset == 0)
m_desc.attrib[i].offset = VertexBufferDesc::CalculateOffset(m_desc, m_desc.attrib[i].semantic);
}
//update stride in desc (respecting offsets)
if (m_desc.stride == 0)
{
Uint32 lastAttrib = 0;
while (lastAttrib < MAX_ATTRIBS) {
if (m_desc.attrib[lastAttrib].semantic == ATTRIB_NONE)
break;
lastAttrib++;
}
m_desc.stride = m_desc.attrib[lastAttrib].offset + VertexBufferDesc::GetAttribSize(m_desc.attrib[lastAttrib].format);
}
assert(m_desc.stride > 0);
assert(m_desc.numVertices > 0);
SetVertexCount(m_desc.numVertices);
glGenBuffers(1, &m_buffer);
//Allocate initial data store
//Using zeroed m_data is not mandatory, but otherwise contents are undefined
glBindBuffer(GL_ARRAY_BUFFER, m_buffer);
const Uint32 dataSize = m_desc.numVertices * m_desc.stride;
m_data = new Uint8[dataSize];
memset(m_data, 0, dataSize);
const GLenum usage = (m_desc.usage == BUFFER_USAGE_STATIC) ? GL_STATIC_DRAW : GL_DYNAMIC_DRAW;
glBufferData(GL_ARRAY_BUFFER, dataSize, m_data, usage);
glBindBuffer(GL_ARRAY_BUFFER, 0);
//Don't keep client data around for static buffers
if (GetDesc().usage == BUFFER_USAGE_STATIC) {
delete[] m_data;
m_data = nullptr;
}
//If we had VAOs could set up the pointers already
}
开发者ID:MeteoricGames,项目名称:pioneer,代码行数:46,代码来源:GL2VertexBuffer.cpp
示例17: Transform
PooledTextureRef SSR::BuildHZB(const Ptr<Texture> & depthTex)
{
auto texDesc = depthTex->GetDesc();
texDesc.format = RENDER_FORMAT_R16_FLOAT;
texDesc.bindFlag = TEXTURE_BIND_SHADER_RESOURCE | TEXTURE_BIND_RENDER_TARGET;
texDesc.mipLevels = 0;
auto hzb0Ref = TexturePool::Instance().FindFree({ TEXTURE_2D, texDesc });
auto hzb1Ref = TexturePool::Instance().FindFree({ TEXTURE_2D, texDesc });
auto hzb0 = hzb0Ref->Get()->Cast<Texture>();
auto hzb1 = hzb1Ref->Get()->Cast<Texture>();
Transform(
depthTex->GetShaderResourceView(0, 1, 0, 1, false, RENDER_FORMAT_R24_UNORM_X8_TYPELESS),
hzb0Ref->Get()->Cast<Texture>()->GetRenderTargetView(0, 0, 1));
auto rc = Global::GetRenderEngine()->GetRenderContext();
auto ps = Shader::FindOrCreate<HZBBuildPS>();
for (int32_t mipLevel = 1; mipLevel < hzb0->GetDesc().mipLevels; ++mipLevel)
{
auto & mipSize = hzb0->GetMipSize(mipLevel - 1);
auto w = mipSize.x();
auto h = mipSize.y();
float4 screenSize = float4((float)w, (float)h, 1.0f / (float)w, 1.0f / (float)h);
ps->SetScalar("screenSize", screenSize);
ps->SetScalar("mipLevel", (float)(mipLevel - 1));
ps->SetSRV("depthTex", hzb0->GetShaderResourceView());
ps->SetSampler("pointSampler", SamplerTemplate<FILTER_MIN_MAG_MIP_POINT>::Get());
ps->Flush();
auto & targetMipSize = hzb0->GetMipSize(mipLevel);
DrawQuad({ hzb1->GetRenderTargetView(mipLevel, 0, 1) });
hzb1->CopyTo(hzb0, mipLevel, 0, 0, 0, 0, mipLevel, 0);
}
return hzb0Ref;
}
开发者ID:BenKZSSS,项目名称:ToyGE,代码行数:44,代码来源:SSR.cpp
示例18: GetPoint
void CHARACTER::ClearAffect(bool bSave)
{
TAffectFlag afOld = m_afAffectFlag;
WORD wMovSpd = GetPoint(POINT_MOV_SPEED);
WORD wAttSpd = GetPoint(POINT_ATT_SPEED);
itertype(m_list_pkAffect) it = m_list_pkAffect.begin();
while (it != m_list_pkAffect.end())
{
CAffect * pkAff = *it;
if (bSave)
{
if ( IS_NO_CLEAR_ON_DEATH_AFFECT(pkAff->dwType) || IS_NO_SAVE_AFFECT(pkAff->dwType) )
{
++it;
continue;
}
if (IsPC())
{
SendAffectRemovePacket(GetDesc(), GetPlayerID(), pkAff->dwType, pkAff->bApplyOn);
}
}
ComputeAffect(pkAff, false);
it = m_list_pkAffect.erase(it);
CAffect::Release(pkAff);
}
if (afOld != m_afAffectFlag ||
wMovSpd != GetPoint(POINT_MOV_SPEED) ||
wAttSpd != GetPoint(POINT_ATT_SPEED))
UpdatePacket();
CheckMaximumPoints();
if (m_list_pkAffect.empty())
event_cancel(&m_pkAffectEvent);
}
开发者ID:adi97ida,项目名称:Server,代码行数:42,代码来源:char_affect.cpp
示例19: GetDesc
ProxyImplSurface::ProxyImplSurface(IBase *pimpl)
: ProxyBase<IBase>(pimpl)
{
D3DSURFACE_DESC desc;
HRESULT res = GetDesc(&desc);
assert(SUCCEEDED(res));
if (SUCCEEDED(res))
{
static set<D3DFORMAT> unsupported;
size_t b = bytesPerPixel(desc.Format);
if (b == 0 && !unsupported.count(desc.Format))
{
unsupported.insert(desc.Format);
char letters[5];
letters[4] = 0;
memcpy(letters, &desc.Format, 4);
LOG("Unsupported surface format: " << desc.Format << ": " << letters);
}
}
}
开发者ID:vasily-knk,项目名称:D3Digger,代码行数:21,代码来源:ProxyImpl_Surface.cpp
示例20: GetDesc
bool CHARACTER::DragonSoul_RefineWindow_Open(LPENTITY pEntity)
{
if (NULL == m_pointsInstant.m_pDragonSoulRefineWindowOpener)
{
m_pointsInstant.m_pDragonSoulRefineWindowOpener = pEntity;
}
TPacketGCDragonSoulRefine PDS;
PDS.header = HEADER_GC_DRAGON_SOUL_REFINE;
PDS.bSubType = DS_SUB_HEADER_OPEN;
LPDESC d = GetDesc();
if (NULL == d)
{
sys_err ("User(%s)'s DESC is NULL POINT.", GetName());
return false;
}
d->Packet(&PDS, sizeof(PDS));
return true;
}
开发者ID:Rarder44,项目名称:Server,代码行数:21,代码来源:char_dragonsoul.cpp
注:本文中的GetDesc函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论