| 64 | } |
| 65 | |
| 66 | ALResult Tr2DrawUPHelper::FillUPVertexBuffer( |
| 67 | uint32_t vertexCount, |
| 68 | const void* vertexStreamZeroData, |
| 69 | uint32_t vertexStreamZeroStride, |
| 70 | ::Tr2BufferAL& buffer, |
| 71 | Tr2RenderContextAL& renderContext, |
| 72 | Tr2PrimaryRenderContextAL& device ) |
| 73 | { |
| 74 | const uint32_t totalSize = vertexCount * vertexStreamZeroStride; |
| 75 | |
| 76 | if( totalSize == 0 ) |
| 77 | { |
| 78 | return S_OK; |
| 79 | } |
| 80 | |
| 81 | if( totalSize > buffer.GetDesc().count * buffer.GetDesc().stride ) |
| 82 | { |
| 83 | CR_RETURN_HR( buffer.Create( 4, ( totalSize + 3 ) / 4, Tr2GpuUsage::VERTEX_BUFFER, Tr2CpuUsage::WRITE_OFTEN, nullptr, device ) ); |
| 84 | } |
| 85 | |
| 86 | void* mapped = nullptr; |
| 87 | CR_RETURN_HR( buffer.MapForWriting( mapped, renderContext ) ); |
| 88 | if( !mapped ) |
| 89 | { |
| 90 | buffer.UnmapForWriting( renderContext ); |
| 91 | return E_FAIL; |
| 92 | } |
| 93 | memcpy( mapped, vertexStreamZeroData, totalSize ); |
| 94 | buffer.UnmapForWriting( renderContext ); |
| 95 | |
| 96 | return S_OK; |
| 97 | } |
| 98 | |
| 99 | ALResult Tr2DrawUPHelper::DrawPrimitiveUP( |
| 100 | Tr2RenderContextEnum::Topology topology, |
nothing calls this directly
no test coverage detected