mirror of
https://github.com/libretro/rustation-libretro.git
synced 2024-12-03 14:50:41 +00:00
Use ArrayVec to avoid dynamic allocations
This commit is contained in:
parent
0cff516294
commit
de705e9c95
39
Cargo.lock
generated
39
Cargo.lock
generated
@ -2,6 +2,7 @@
|
||||
name = "rustation-retro"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"arrayvec 0.3.12 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"gl 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"log 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
@ -17,6 +18,15 @@ dependencies = [
|
||||
"winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "arrayvec"
|
||||
version = "0.3.12"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"nodrop 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"odds 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "bitflags"
|
||||
version = "0.3.3"
|
||||
@ -59,6 +69,22 @@ dependencies = [
|
||||
"libc 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "nodrop"
|
||||
version = "0.1.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"odds 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "odds"
|
||||
version = "0.2.10"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"unreachable 0.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rand"
|
||||
version = "0.3.12"
|
||||
@ -91,6 +117,19 @@ dependencies = [
|
||||
"rustc-serialize 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "unreachable"
|
||||
version = "0.0.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"void 0.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "void"
|
||||
version = "0.0.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "winapi"
|
||||
version = "0.2.5"
|
||||
|
@ -16,6 +16,7 @@ keywords = ["emulator", "playstation"]
|
||||
libc = "0.2.4"
|
||||
gl = "0.5.2"
|
||||
log = "0.3.4"
|
||||
arrayvec = "0.3.12"
|
||||
|
||||
[lib]
|
||||
name = "rustation_retro"
|
||||
|
@ -20,6 +20,7 @@ extern crate gl;
|
||||
#[macro_use]
|
||||
extern crate log;
|
||||
extern crate rustation;
|
||||
extern crate arrayvec;
|
||||
|
||||
macro_rules! cstring {
|
||||
($x:expr) => {
|
||||
|
@ -1,5 +1,6 @@
|
||||
use gl;
|
||||
use gl::types::{GLuint, GLint};
|
||||
use arrayvec::ArrayVec;
|
||||
use rustation::gpu::renderer::{Renderer, Vertex};
|
||||
|
||||
use retrogl::{State, DrawConfig};
|
||||
@ -103,7 +104,7 @@ impl Renderer for GlState {
|
||||
self.draw().unwrap();
|
||||
}
|
||||
|
||||
let v: Vec<_> =
|
||||
let v: ArrayVec<[_; 3]> =
|
||||
vertices.iter().map(|v| CommandVertex::from_vertex(v))
|
||||
.collect();
|
||||
|
||||
@ -115,7 +116,7 @@ impl Renderer for GlState {
|
||||
self.draw().unwrap();
|
||||
}
|
||||
|
||||
let v: Vec<_> =
|
||||
let v: ArrayVec<[_; 4]> =
|
||||
vertices.iter().map(|v| CommandVertex::from_vertex(v))
|
||||
.collect();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user