MCPcopy Create free account
hub / github.com/carbonengine/trinity / SetStreamSource

Method SetStreamSource

trinityal/dx12/Tr2RenderContextDx12.cpp:250–289  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

248}
249
250ALResult Tr2RenderContextAL::SetStreamSource(
251 uint32_t index,
252 const Tr2BufferAL& buffer,
253 uint32_t offset,
254 uint32_t stride ) throw()
255{
256 if( index > 3 )
257 {
258 return E_INVALIDARG;
259 }
260
261 m_vertexBuffers[index].buffer = buffer;
262 m_vertexBuffers[index].offset = offset;
263 m_vertexBuffers[index].stride = stride;
264
265 if( !buffer.IsValid() || !HasFlag( buffer.GetDesc().cpuUsage, Tr2CpuUsage::WRITE_OFTEN ) )
266 {
267 D3D12_VERTEX_BUFFER_VIEW vb;
268 if( buffer.IsValid() )
269 {
270 vb.BufferLocation = buffer.m_buffer->GetGpuView() + offset;
271 vb.SizeInBytes = buffer.GetSize() - offset;
272 vb.StrideInBytes = stride;
273 }
274 else
275 {
276 vb.BufferLocation = 0;
277 vb.SizeInBytes = 0;
278 vb.StrideInBytes = 0;
279 }
280 m_commandList->IASetVertexBuffers( index, 1, &vb );
281 m_dynamicVBs = m_dynamicVBs & ~( 1 << index );
282 }
283 else
284 {
285 m_dynamicVBs = m_dynamicVBs | ( 1 << index );
286 }
287
288 return S_OK;
289}
290
291ALResult Tr2RenderContextAL::SetIndices( const Tr2BufferAL& buffer ) throw()
292{

Callers 5

DrawPrimitiveUPMethod · 0.45
TEST_FFunction · 0.45
TEST_FFunction · 0.45
RenderMethod · 0.45

Calls 5

IASetVertexBuffersMethod · 0.80
HasFlagFunction · 0.50
IsValidMethod · 0.45
GetGpuViewMethod · 0.45
GetSizeMethod · 0.45

Tested by 3

TEST_FFunction · 0.36
TEST_FFunction · 0.36
RenderMethod · 0.36