• Home
  • Raw
  • Download

Lines Matching +full:attrib +full:-

3 // Use of this source code is governed by a BSD-style license that can be
40 // Warning: ensure the binding matches attrib.bindingIndex before using these functions.
41 int64_t GetMaxAttributeByteOffsetForDraw(const gl::VertexAttribute &attrib, in GetMaxAttributeByteOffsetForDraw() argument
45 CheckedNumeric<int64_t> stride = ComputeVertexAttributeStride(attrib, binding); in GetMaxAttributeByteOffsetForDraw()
46 CheckedNumeric<int64_t> offset = ComputeVertexAttributeOffset(attrib, binding); in GetMaxAttributeByteOffsetForDraw()
47 CheckedNumeric<int64_t> size = ComputeVertexAttributeTypeSize(attrib); in GetMaxAttributeByteOffsetForDraw()
52 stride * (CheckedNumeric<int64_t>(elementCount) - 1) + size + offset; in GetMaxAttributeByteOffsetForDraw()
56 // Warning: ensure the binding matches attrib.bindingIndex before using these functions.
57 int ElementsInBuffer(const gl::VertexAttribute &attrib, in ElementsInBuffer() argument
62 angle::CheckedNumeric<int64_t> stride = ComputeVertexAttributeStride(attrib, binding); in ElementsInBuffer()
63 angle::CheckedNumeric<int64_t> offset = ComputeVertexAttributeOffset(attrib, binding); in ElementsInBuffer()
64 angle::CheckedNumeric<int64_t> elementSize = ComputeVertexAttributeTypeSize(attrib); in ElementsInBuffer()
66 auto elementsInBuffer = (bufferSize - (offset % stride) + (stride - elementSize)) / stride; in ElementsInBuffer()
72 // Warning: you should ensure binding really matches attrib.bindingIndex before using this function.
74 const gl::VertexAttribute &attrib, in DirectStoragePossible() argument
78 if (!attrib.enabled) in DirectStoragePossible()
91 if (!bufferD3D->supportsDirectBinding()) in DirectStoragePossible()
97 // 4-byte boundary, whichever is smaller. (Undocumented, and experimentally confirmed) in DirectStoragePossible()
101 BufferFactoryD3D *factory = bufferD3D->getFactory(); in DirectStoragePossible()
103 angle::FormatID vertexFormatID = attrib.format->id; in DirectStoragePossible()
105 // CPU-converted vertex data must be converted (naturally). in DirectStoragePossible()
106 if ((factory->getVertexConversionType(vertexFormatID) & VERTEX_CONVERT_CPU) != 0) in DirectStoragePossible()
111 if (attrib.format->vertexAttribType != gl::VertexAttribType::Float) in DirectStoragePossible()
115 factory->getVertexSpaceRequired(context, attrib, binding, 1, 0, 0, &elementSize); in DirectStoragePossible()
120 GLintptr offset = ComputeVertexAttributeOffset(attrib, binding); in DirectStoragePossible()
121 // Final alignment check - unaligned data must be converted. in DirectStoragePossible()
122 return (static_cast<size_t>(ComputeVertexAttributeStride(attrib, binding)) % alignment == 0) && in DirectStoragePossible()
162 // Warning: you should ensure binding really matches attrib.bindingIndex before using this function.
164 const gl::VertexAttribute &attrib, in ClassifyAttributeStorage() argument
168 if (!attrib.enabled) in ClassifyAttributeStorage()
181 if (DirectStoragePossible(context, attrib, binding)) in ClassifyAttributeStorage()
189 switch (bufferD3D->getUsage()) in ClassifyAttributeStorage()
250 const gl::State &state = context->getState(); in prepareVertexData()
253 const auto &vertexAttributes = vertexArray->getVertexAttributes(); in prepareVertexData()
254 const auto &vertexBindings = vertexArray->getVertexBindings(); in prepareVertexData()
258 translatedAttribs->clear(); in prepareVertexData()
262 // Skip attrib locations the program doesn't use. in prepareVertexData()
263 if (!executable->isAttribLocationActive(attribIndex)) in prepareVertexData()
266 const auto &attrib = vertexAttributes[attribIndex]; in prepareVertexData() local
267 const auto &binding = vertexBindings[attrib.bindingIndex]; in prepareVertexData()
270 translatedAttribs->resize(attribIndex + 1); in prepareVertexData()
276 translated->active = true; in prepareVertexData()
277 translated->attribute = &attrib; in prepareVertexData()
278 translated->binding = &binding; in prepareVertexData()
279 translated->currentValueType = currentValueData.Type; in prepareVertexData()
280 translated->divisor = binding.getDivisor(); in prepareVertexData()
282 switch (ClassifyAttributeStorage(context, attrib, binding)) in prepareVertexData()
327 ASSERT(directAttrib->attribute && directAttrib->binding); in StoreDirectAttrib()
328 const auto &attrib = *directAttrib->attribute; in StoreDirectAttrib() local
329 const auto &binding = *directAttrib->binding; in StoreDirectAttrib()
335 ASSERT(DirectStoragePossible(context, attrib, binding)); in StoreDirectAttrib()
336 directAttrib->vertexBuffer.set(nullptr); in StoreDirectAttrib()
337 directAttrib->storage = bufferD3D; in StoreDirectAttrib()
338 directAttrib->serial = bufferD3D->getSerial(); in StoreDirectAttrib()
339 directAttrib->stride = static_cast<unsigned int>(ComputeVertexAttributeStride(attrib, binding)); in StoreDirectAttrib()
340 directAttrib->baseOffset = in StoreDirectAttrib()
341 static_cast<unsigned int>(ComputeVertexAttributeOffset(attrib, binding)); in StoreDirectAttrib()
344 directAttrib->usesFirstVertexOffset = (binding.getDivisor() == 0); in StoreDirectAttrib()
351 ASSERT(translated->attribute && translated->binding); in StoreStaticAttrib()
352 const auto &attrib = *translated->attribute; in StoreStaticAttrib() local
353 const auto &binding = *translated->binding; in StoreStaticAttrib()
356 ASSERT(buffer && attrib.enabled && !DirectStoragePossible(context, attrib, binding)); in StoreStaticAttrib()
361 const int offset = static_cast<int>(ComputeVertexAttributeOffset(attrib, binding)); in StoreStaticAttrib()
363 ANGLE_TRY(bufferD3D->getData(context, &sourceData)); in StoreStaticAttrib()
372 translated->storage = nullptr; in StoreStaticAttrib()
373 ANGLE_TRY(bufferD3D->getFactory()->getVertexSpaceRequired(context, attrib, binding, 1, 0, 0, in StoreStaticAttrib()
374 &translated->stride)); in StoreStaticAttrib()
376 auto *staticBuffer = bufferD3D->getStaticVertexBuffer(attrib, binding); in StoreStaticAttrib()
379 if (staticBuffer->empty()) in StoreStaticAttrib()
383 ElementsInBuffer(attrib, binding, static_cast<unsigned int>(bufferD3D->getSize())); in StoreStaticAttrib()
384 int startIndex = offset / static_cast<int>(ComputeVertexAttributeStride(attrib, binding)); in StoreStaticAttrib()
388 ANGLE_TRY(staticBuffer->storeStaticAttribute(context, attrib, binding, -startIndex, in StoreStaticAttrib()
395 static_cast<unsigned int>(ComputeVertexAttributeStride(attrib, binding))) * in StoreStaticAttrib()
396 translated->stride; in StoreStaticAttrib()
398 VertexBuffer *vertexBuffer = staticBuffer->getVertexBuffer(); in StoreStaticAttrib()
405 translated->vertexBuffer.set(vertexBuffer); in StoreStaticAttrib()
406 translated->serial = vertexBuffer->getSerial(); in StoreStaticAttrib()
407 translated->baseOffset = streamOffset + firstElementOffset; in StoreStaticAttrib()
410 translated->usesFirstVertexOffset = (binding.getDivisor() == 0); in StoreStaticAttrib()
433 ~StreamingBufferUnmapper() { mStreamingBuffer->getVertexBuffer()->hintUnmapResource(); } in storeDynamicAttribs()
479 bufferD3D->promoteStaticUsage(context, count * typeSize); in PromoteDynamicAttribs()
492 const auto &attrib = *translatedAttrib.attribute; in reserveSpaceForAttrib() local
495 ASSERT(!DirectStoragePossible(context, attrib, binding)); in reserveSpaceForAttrib()
499 ASSERT(!bufferD3D || bufferD3D->getStaticVertexBuffer(attrib, binding) == nullptr); in reserveSpaceForAttrib()
503 // have a non-zero divisor. in reserveSpaceForAttrib()
510 // Vertices do not apply the 'start' offset when the divisor is non-zero even when doing in reserveSpaceForAttrib()
511 // a non-instanced draw call in reserveSpaceForAttrib()
518 int64_t maxByte = GetMaxAttributeByteOffsetForDraw(attrib, binding, maxVertexCount); in reserveSpaceForAttrib()
520 ASSERT(bufferD3D->getSize() <= static_cast<size_t>(std::numeric_limits<int64_t>::max())); in reserveSpaceForAttrib()
522 maxByte <= static_cast<int64_t>(bufferD3D->getSize()), in reserveSpaceForAttrib()
525 return mStreamingBuffer.reserveVertexSpace(context, attrib, binding, totalCount, instances, in reserveSpaceForAttrib()
536 ASSERT(translated->attribute && translated->binding); in storeDynamicAttrib()
537 const auto &attrib = *translated->attribute; in storeDynamicAttrib() local
538 const auto &binding = *translated->binding; in storeDynamicAttrib()
541 ASSERT(buffer || attrib.pointer); in storeDynamicAttrib()
542 ASSERT(attrib.enabled); in storeDynamicAttrib()
555 ANGLE_TRY(storage->getData(context, &sourceData)); in storeDynamicAttrib()
556 sourceData += static_cast<int>(ComputeVertexAttributeOffset(attrib, binding)); in storeDynamicAttrib()
562 sourceData = static_cast<const uint8_t *>(attrib.pointer); in storeDynamicAttrib()
567 translated->storage = nullptr; in storeDynamicAttrib()
569 mFactory->getVertexSpaceRequired(context, attrib, binding, 1, 0, 0, &translated->stride)); in storeDynamicAttrib()
575 context, attrib, binding, translated->currentValueType, firstVertexIndex, in storeDynamicAttrib()
580 translated->vertexBuffer.set(vertexBuffer); in storeDynamicAttrib()
581 translated->serial = vertexBuffer->getSerial(); in storeDynamicAttrib()
582 translated->baseOffset = streamOffset; in storeDynamicAttrib()
583 translated->usesFirstVertexOffset = false; in storeDynamicAttrib()
595 StreamingVertexBufferInterface &buffer = *cachedState->buffer; in storeCurrentValue()
602 if (cachedState->data != currentValue) in storeCurrentValue()
604 ASSERT(translated->attribute && translated->binding); in storeCurrentValue()
605 const auto &attrib = *translated->attribute; in storeCurrentValue() local
606 const auto &binding = *translated->binding; in storeCurrentValue()
608 ANGLE_TRY(buffer.reserveVertexSpace(context, attrib, binding, 1, 0, 0)); in storeCurrentValue()
613 ANGLE_TRY(buffer.storeDynamicAttribute(context, attrib, binding, currentValue.Type, 0, 1, 0, in storeCurrentValue()
616 buffer.getVertexBuffer()->hintUnmapResource(); in storeCurrentValue()
618 cachedState->data = currentValue; in storeCurrentValue()
619 cachedState->offset = streamOffset; in storeCurrentValue()
622 translated->vertexBuffer.set(buffer.getVertexBuffer()); in storeCurrentValue()
624 translated->storage = nullptr; in storeCurrentValue()
625 translated->serial = buffer.getSerial(); in storeCurrentValue()
626 translated->divisor = 0; in storeCurrentValue()
627 translated->stride = 0; in storeCurrentValue()
628 translated->baseOffset = static_cast<unsigned int>(cachedState->offset); in storeCurrentValue()
629 translated->usesFirstVertexOffset = false; in storeCurrentValue()
642 mBoundVertexBuffer->addRef(); in VertexBufferBinding()
650 mBoundVertexBuffer->release(); in ~VertexBufferBinding()
659 mBoundVertexBuffer->addRef(); in operator =()
671 mBoundVertexBuffer->release(); in set()
675 vertexBuffer->addRef(); in set()