thatcosmonaut / FNA3D

FNA3D - 3D Graphics Library for FNA
http://fna-xna.github.io/
Other
4 stars 2 forks source link

SetTextureDataYUV #47

Closed TheSpydog closed 4 years ago

TheSpydog commented 4 years ago
  1. Moved the BytesPer* functions into FNA3D_Driver.h since 3/4 of our backends use them.
  2. Added SetTextureDataYUV. This is mostly just copy-pasting SetTextureData2D three times in a row with changes for offset / size. Totally cargo-culted on this, I have no idea how the pipeline barriers actually work.

Tested on a video from Dust AET and it works as expected.

There's definitely room for refactoring since the if (stagingBuffer->resourceAccessType != nextResourceAccessType) block is copied three times in this function and once in SetTextureData2D. Wanted to see what you thought about extracting that stuff to an external function since it technically already uses another convenience function (CreateBufferMemoryBarrier) internally. Would it be weird to have a wrapper for a wrapper?