Skip to content

Commit

Permalink
Move gl_device into separate directory
Browse files Browse the repository at this point in the history
This will be converted into a crate once associated items are added and used in the `Device` trait. See rust-lang/rfcs#195
  • Loading branch information
brendanzab committed Sep 1, 2014
1 parent b8e1470 commit 47d0702
Show file tree
Hide file tree
Showing 11 changed files with 17 additions and 15 deletions.
2 changes: 1 addition & 1 deletion src/device/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ name = "device"
path = "lib.rs"

[dependencies.gl]
path = "../gl/"
path = "../gl_device/gl/"
12 changes: 6 additions & 6 deletions src/device/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,8 @@
#[phase(plugin, link)] extern crate log;
extern crate libc;

// when cargo is ready, re-enable the cfgs
/* #[cfg(gl)] */ pub use self::gl as back;
/* #[cfg(gl)] */ pub use gl::GlDevice;
/* #[cfg(gl)] */ pub use gl::draw::GlCommandBuffer;
// #[cfg(d3d11)] ... // TODO
// TODO: Remove these exports once `gl_device` becomes a separate crate.
pub use self::gl_device as back;

use std::mem;

Expand All @@ -43,7 +40,10 @@ pub mod shade;
pub mod state;
pub mod target;
pub mod tex;
/* #[cfg(gl)] */ mod gl;

// TODO: This will become a separate crate once associated items are implemented
// in rustc and subsequently used in the `Device` trait.
/* #[cfg(gl)] */ #[path = "../gl_device/lib.rs"] pub mod gl_device;

/// Draw vertex count.
pub type VertexCount = u32;
Expand Down
5 changes: 3 additions & 2 deletions src/gfx/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,6 @@ pub use render::state::{DrawState, BlendAdditive, BlendAlpha};
pub use render::shade;
pub use render::target::{Frame, Plane, PlaneEmpty, PlaneSurface, PlaneTexture};
pub use device::Device;
// when cargo is ready, re-enable the cfgs
/* #[cfg(gl)] */ pub use device::{GlDevice, GlCommandBuffer};
pub use device::{attrib, state, tex};
pub use device::{BufferHandle, BufferInfo, RawBufferHandle, ShaderHandle,
ProgramHandle, SurfaceHandle, TextureHandle};
Expand All @@ -56,3 +54,6 @@ pub use device::shade::{UniformValue,
ValueF32Matrix2, ValueF32Matrix3, ValueF32Matrix4};
pub use device::shade::{ShaderSource, StaticBytes, OwnedBytes, ProgramInfo};
pub use device::target::{Color, ClearData, Layer, Level};

// TODO: Remove this re-export once `gl_device` becomes a separate crate.
pub use device::gl_device::{GlDevice, GlCommandBuffer};
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion src/gl/lib.rs → src/gl_device/gl/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

//! An OpenGL loader generated by [gl-rs](https://github.com/bjz/gl-rs).
//!
//! This is useful directly accessing the underlying OpenGL API via the
//! This is useful for directly accessing the underlying OpenGL API via the
//! `GlDevice::with_gl` method. It is also used internally by the `GlDevice`
//! implementation.

Expand Down
File renamed without changes.
11 changes: 6 additions & 5 deletions src/device/gl/mod.rs → src/gl_device/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.

//! OpenGL implementation of a device, striving to support OpenGL 2.0 with at least VAOs, but using
//! newer extensions when available.
//! OpenGL implementation of a device, striving to support OpenGL 2.0 with at
//! least VAOs, but using newer extensions when available.

#![allow(missing_doc)]
#![experimental]
Expand All @@ -28,9 +28,10 @@ use attrib;
use Device;
use blob::{Blob, RefBlobCast};

pub use self::draw::GlCommandBuffer;
pub use self::info::{Info, PlatformName, Version};

pub mod draw;
mod draw;
mod shade;
mod state;
mod tex;
Expand Down Expand Up @@ -420,7 +421,7 @@ impl GlDevice {
}
}

impl Device<draw::GlCommandBuffer> for GlDevice {
impl Device<GlCommandBuffer> for GlDevice {
fn get_capabilities<'a>(&'a self) -> &'a ::Capabilities {
&self.caps
}
Expand All @@ -431,7 +432,7 @@ impl Device<draw::GlCommandBuffer> for GlDevice {
}
}

fn submit(&mut self, cb: &draw::GlCommandBuffer) {
fn submit(&mut self, cb: &GlCommandBuffer) {
self.reset_state();
for com in cb.iter() {
self.process(com);
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 47d0702

Please sign in to comment.