Skip to content

Commit 47d0702

Browse files
committed
Move gl_device into separate directory
This will be converted into a crate once associated items are added and used in the `Device` trait. See rust-lang/rfcs#195
1 parent b8e1470 commit 47d0702

File tree

11 files changed

+17
-15
lines changed

11 files changed

+17
-15
lines changed

src/device/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@ name = "device"
1010
path = "lib.rs"
1111

1212
[dependencies.gl]
13-
path = "../gl/"
13+
path = "../gl_device/gl/"

src/device/lib.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,8 @@
2626
#[phase(plugin, link)] extern crate log;
2727
extern crate libc;
2828

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

3532
use std::mem;
3633

@@ -43,7 +40,10 @@ pub mod shade;
4340
pub mod state;
4441
pub mod target;
4542
pub mod tex;
46-
/* #[cfg(gl)] */ mod gl;
43+
44+
// TODO: This will become a separate crate once associated items are implemented
45+
// in rustc and subsequently used in the `Device` trait.
46+
/* #[cfg(gl)] */ #[path = "../gl_device/lib.rs"] pub mod gl_device;
4747

4848
/// Draw vertex count.
4949
pub type VertexCount = u32;

src/gfx/lib.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,6 @@ pub use render::state::{DrawState, BlendAdditive, BlendAlpha};
4040
pub use render::shade;
4141
pub use render::target::{Frame, Plane, PlaneEmpty, PlaneSurface, PlaneTexture};
4242
pub use device::Device;
43-
// when cargo is ready, re-enable the cfgs
44-
/* #[cfg(gl)] */ pub use device::{GlDevice, GlCommandBuffer};
4543
pub use device::{attrib, state, tex};
4644
pub use device::{BufferHandle, BufferInfo, RawBufferHandle, ShaderHandle,
4745
ProgramHandle, SurfaceHandle, TextureHandle};
@@ -56,3 +54,6 @@ pub use device::shade::{UniformValue,
5654
ValueF32Matrix2, ValueF32Matrix3, ValueF32Matrix4};
5755
pub use device::shade::{ShaderSource, StaticBytes, OwnedBytes, ProgramInfo};
5856
pub use device::target::{Color, ClearData, Layer, Level};
57+
58+
// TODO: Remove this re-export once `gl_device` becomes a separate crate.
59+
pub use device::gl_device::{GlDevice, GlCommandBuffer};
File renamed without changes.
File renamed without changes.

src/gl/lib.rs renamed to src/gl_device/gl/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
//! An OpenGL loader generated by [gl-rs](https://github.com/bjz/gl-rs).
2323
//!
24-
//! This is useful directly accessing the underlying OpenGL API via the
24+
//! This is useful for directly accessing the underlying OpenGL API via the
2525
//! `GlDevice::with_gl` method. It is also used internally by the `GlDevice`
2626
//! implementation.
2727
File renamed without changes.

src/device/gl/mod.rs renamed to src/gl_device/lib.rs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15-
//! OpenGL implementation of a device, striving to support OpenGL 2.0 with at least VAOs, but using
16-
//! newer extensions when available.
15+
//! OpenGL implementation of a device, striving to support OpenGL 2.0 with at
16+
//! least VAOs, but using newer extensions when available.
1717
1818
#![allow(missing_doc)]
1919
#![experimental]
@@ -28,9 +28,10 @@ use attrib;
2828
use Device;
2929
use blob::{Blob, RefBlobCast};
3030

31+
pub use self::draw::GlCommandBuffer;
3132
pub use self::info::{Info, PlatformName, Version};
3233

33-
pub mod draw;
34+
mod draw;
3435
mod shade;
3536
mod state;
3637
mod tex;
@@ -420,7 +421,7 @@ impl GlDevice {
420421
}
421422
}
422423

423-
impl Device<draw::GlCommandBuffer> for GlDevice {
424+
impl Device<GlCommandBuffer> for GlDevice {
424425
fn get_capabilities<'a>(&'a self) -> &'a ::Capabilities {
425426
&self.caps
426427
}
@@ -431,7 +432,7 @@ impl Device<draw::GlCommandBuffer> for GlDevice {
431432
}
432433
}
433434

434-
fn submit(&mut self, cb: &draw::GlCommandBuffer) {
435+
fn submit(&mut self, cb: &GlCommandBuffer) {
435436
self.reset_state();
436437
for com in cb.iter() {
437438
self.process(com);
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)