Use one texture with two channels for video
This commit is contained in:
@@ -113,7 +113,7 @@ impl CoreVB {
|
||||
unsafe { vb_emulate(self.sim, &mut cycles) };
|
||||
}
|
||||
|
||||
pub fn read_pixels(&mut self, buffers: &mut [Vec<u8>; 2]) -> bool {
|
||||
pub fn read_pixels(&mut self, buffers: &mut [u8]) -> bool {
|
||||
// SAFETY: the *mut VB owns its userdata.
|
||||
// There is no way for the userdata to be null or otherwise invalid.
|
||||
let data: &mut VBState = unsafe { &mut *vb_get_user_data(self.sim).cast() };
|
||||
@@ -122,17 +122,17 @@ impl CoreVB {
|
||||
}
|
||||
data.frame_seen = false;
|
||||
|
||||
assert_eq!(buffers[0].len(), 384 * 224);
|
||||
assert_eq!(buffers[1].len(), 384 * 224);
|
||||
// the buffer must be big enough for our data
|
||||
assert!(buffers.len() >= 384 * 224 * 2);
|
||||
unsafe {
|
||||
vb_get_pixels(
|
||||
self.sim,
|
||||
buffers[0].as_mut_ptr().cast(),
|
||||
1,
|
||||
384,
|
||||
buffers[1].as_mut_ptr().cast(),
|
||||
1,
|
||||
384,
|
||||
buffers.as_mut_ptr().cast(),
|
||||
2,
|
||||
384 * 2,
|
||||
buffers.as_mut_ptr().offset(1).cast(),
|
||||
2,
|
||||
384 * 2,
|
||||
);
|
||||
};
|
||||
true
|
||||
|
||||
Reference in New Issue
Block a user