Skip to content

Commit

Permalink
Merge pull request gfx-rs#505 from bjz/de-warningify
Browse files Browse the repository at this point in the history
Dewarningify
  • Loading branch information
brendanzab committed Jan 25, 2015
2 parents 8291fa0 + f44c6b7 commit cb47f60
Show file tree
Hide file tree
Showing 21 changed files with 106 additions and 106 deletions.
2 changes: 1 addition & 1 deletion examples/deferred/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -729,7 +729,7 @@ fn main() {

let mut debug_buf: Option<TextureHandle> = None;

let mut light_pos_vec: Vec<[f32; 4]> = range(0, NUM_LIGHTS).map(|_| {
let mut light_pos_vec: Vec<[f32; 4]> = (0 ..NUM_LIGHTS).map(|_| {
[0.0, 0.0, 0.0, 0.0]
}).collect();

Expand Down
8 changes: 4 additions & 4 deletions examples/performance/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,8 @@ fn gfx_main(mut glfw: glfw::Glfw,
let start = precise_time_s() * 1000.;
graphics.clear(clear_data, gfx::COLOR | gfx::DEPTH, &frame);

for x in range(-dimension, dimension) {
for y in range(-dimension, dimension) {
for x in (-dimension) ..dimension {
for y in (-dimension) ..dimension {
let mut model = Matrix3::identity().mul_s(0.01f32).to_matrix4();
model.w = Vector4::new(x as f32 * 0.05,
0f32,
Expand Down Expand Up @@ -321,8 +321,8 @@ fn gl_main(mut glfw: glfw::Glfw,
gl.Clear(gl::COLOR_BUFFER_BIT);
}

for x in range(-dimension, dimension) {
for y in range(-dimension, dimension) {
for x in (-dimension) ..dimension {
for y in (-dimension) ..dimension {
let mut model = Matrix3::identity().mul_s(0.01f32).to_matrix4();
model.w = Vector4::new(x as f32 * 0.05,
0f32,
Expand Down
2 changes: 1 addition & 1 deletion examples/terrain/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ impl Clone for Vertex {
}
}

impl fmt::Show for Vertex {
impl fmt::Debug for Vertex {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "Pos({}, {}, {})", self.pos[0], self.pos[1], self.pos[2])
}
Expand Down
14 changes: 7 additions & 7 deletions src/device/attrib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,15 @@ pub type Stride = u8;
pub type InstanceRate = u8;

/// The signedness of an attribute.
#[derive(Eq, Ord, PartialEq, PartialOrd, Hash, Copy, Clone, Show)]
#[derive(Eq, Ord, PartialEq, PartialOrd, Hash, Copy, Clone, Debug)]
#[repr(u8)]
pub enum SignFlag {
Signed,
Unsigned,
}

/// Describes how an integer value is interpreted by the shader.
#[derive(Eq, Ord, PartialEq, PartialOrd, Hash, Copy, Clone, Show)]
#[derive(Eq, Ord, PartialEq, PartialOrd, Hash, Copy, Clone, Debug)]
#[repr(u8)]
pub enum IntSubType {
Raw, // un-processed integer
Expand All @@ -45,7 +45,7 @@ pub enum IntSubType {
}

/// The size of an integer attribute, in bits.
#[derive(Eq, Ord, PartialEq, PartialOrd, Hash, Copy, Clone, Show)]
#[derive(Eq, Ord, PartialEq, PartialOrd, Hash, Copy, Clone, Debug)]
#[repr(u8)]
pub enum IntSize {
U8,
Expand All @@ -54,15 +54,15 @@ pub enum IntSize {
}

/// Type of a floating point attribute on the shader side.
#[derive(Eq, Ord, PartialEq, PartialOrd, Hash, Copy, Clone, Show)]
#[derive(Eq, Ord, PartialEq, PartialOrd, Hash, Copy, Clone, Debug)]
#[repr(u8)]
pub enum FloatSubType {
Default, // 32-bit
Precision, // 64-bit
}

/// The size of a floating point attribute, in bits.
#[derive(Eq, Ord, PartialEq, PartialOrd, Hash, Copy, Clone, Show)]
#[derive(Eq, Ord, PartialEq, PartialOrd, Hash, Copy, Clone, Debug)]
#[repr(u8)]
pub enum FloatSize {
F16,
Expand All @@ -71,7 +71,7 @@ pub enum FloatSize {
}

/// The type of an attribute.
#[derive(Eq, Ord, PartialEq, PartialOrd, Hash, Copy, Clone, Show)]
#[derive(Eq, Ord, PartialEq, PartialOrd, Hash, Copy, Clone, Debug)]
pub enum Type {
Int(IntSubType, IntSize, SignFlag),
Float(FloatSubType, FloatSize),
Expand All @@ -98,7 +98,7 @@ impl Type {
}

/// Complete format of a vertex attribute.
#[derive(Eq, Ord, PartialEq, PartialOrd, Hash, Copy, Clone, Show)]
#[derive(Eq, Ord, PartialEq, PartialOrd, Hash, Copy, Clone, Debug)]
pub struct Format {
/// Number of elements per vertex
pub elem_count: Count,
Expand Down
6 changes: 3 additions & 3 deletions src/device/draw.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ type Offset = u32;
type Size = u32;

/// The place of some data in the data buffer.
#[derive(Copy, PartialEq, Show)]
#[derive(Copy, PartialEq, Debug)]
pub struct DataPointer(Offset, Size);

/// A buffer of data accompanying the commands. It can be vertex data, texture
Expand Down Expand Up @@ -61,7 +61,7 @@ impl DataBuffer {
self.buf.reserve(size);
unsafe {
self.buf.set_len(offset + size);
slice::bytes::copy_memory(self.buf.slice_from_mut(offset),
slice::bytes::copy_memory(&mut self.buf[offset ..],
slice::from_raw_buf(&(v.as_ptr() as *const u8), size));
}
DataPointer(offset as Offset, size as Size)
Expand All @@ -70,7 +70,7 @@ impl DataBuffer {
/// Return a reference to a stored data object.
pub fn get_ref(&self, data: DataPointer) -> &[u8] {
let DataPointer(offset, size) = data;
self.buf.slice(offset as usize, offset as usize + size as usize)
&self.buf[offset as usize ..offset as usize + size as usize]
}
}

Expand Down
14 changes: 7 additions & 7 deletions src/device/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ impl<'a, T: Copy, D: Device> Drop for RWMapping<'a, T, D> {
}

/// A generic handle struct
#[derive(Copy, Clone, PartialEq, Show)]
#[derive(Copy, Clone, PartialEq, Debug)]
pub struct Handle<T, I>(T, I);

impl<T: Copy, I> Handle<T, I> {
Expand All @@ -160,7 +160,7 @@ impl<T: Copy, I> Handle<T, I> {
}

/// Type-safe buffer handle
#[derive(Copy, Show, PartialEq, Clone)]
#[derive(Copy, Debug, PartialEq, Clone)]
pub struct BufferHandle<T> {
raw: RawBufferHandle,
}
Expand Down Expand Up @@ -242,7 +242,7 @@ pub fn as_byte_slice<T>(slice: &[T]) -> &[u8] {
}

/// Features that the device supports.
#[derive(Copy, Show)]
#[derive(Copy, Debug)]
#[allow(missing_docs)] // pretty self-explanatory fields!
pub struct Capabilities {
pub shader_model: shade::ShaderModel,
Expand All @@ -264,7 +264,7 @@ pub struct Capabilities {
}

/// Describes what geometric primitives are created from vertex data.
#[derive(Copy, Clone, PartialEq, Show)]
#[derive(Copy, Clone, PartialEq, Debug)]
#[repr(u8)]
pub enum PrimitiveType {
/// Each vertex represents a single point.
Expand Down Expand Up @@ -296,7 +296,7 @@ pub type IndexType = attrib::IntSize;
/// The nature of these hints make them very implementation specific. Different drivers on
/// different hardware will handle them differently. Only careful profiling will tell which is the
/// best to use for a specific buffer.
#[derive(Copy, Clone, PartialEq, Show)]
#[derive(Copy, Clone, PartialEq, Debug)]
#[repr(u8)]
pub enum BufferUsage {
/// Once uploaded, this buffer will rarely change, but will be read from often.
Expand All @@ -309,7 +309,7 @@ pub enum BufferUsage {
}

/// An information block that is immutable and associated with each buffer
#[derive(Copy, Clone, PartialEq, Show)]
#[derive(Copy, Clone, PartialEq, Debug)]
pub struct BufferInfo {
/// Usage hint
pub usage: BufferUsage,
Expand All @@ -322,7 +322,7 @@ pub struct BufferInfo {
/// this particular representation may be used by different backends,
/// such as OpenGL (prior to GLNG) and DirectX (prior to DX12)
#[allow(missing_docs)]
#[derive(Copy, Show)]
#[derive(Copy, Debug)]
pub enum Command {
BindProgram(back::Program),
BindArrayBuffer(back::ArrayBuffer),
Expand Down
38 changes: 19 additions & 19 deletions src/device/shade.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,32 +25,32 @@ use std::fmt;
pub type Dimension = u8;

/// Whether the sampler samples an array texture.
#[derive(Copy, Clone, PartialEq, Show)]
#[derive(Copy, Clone, PartialEq, Debug)]
pub enum IsArray { Array, NoArray }

/// Whether the sampler samples a shadow texture (texture with a depth comparison)
#[derive(Copy, Clone, PartialEq, Show)]
#[derive(Copy, Clone, PartialEq, Debug)]
pub enum IsShadow { Shadow, NoShadow }

/// Whether the sampler samples a multisample texture.
#[derive(Copy, Clone, PartialEq, Show)]
#[derive(Copy, Clone, PartialEq, Debug)]
pub enum IsMultiSample { MultiSample, NoMultiSample }

/// Whether the sampler samples a rectangle texture.
///
/// Rectangle textures are the same as 2D textures, but accessed with absolute texture coordinates
/// (as opposed to the usual, normalized to [0, 1]).
#[derive(Copy, Clone, PartialEq, Show)]
#[derive(Copy, Clone, PartialEq, Debug)]
pub enum IsRect { Rect, NoRect }

/// Whether the matrix is column or row major.
#[derive(Copy, Clone, PartialEq, Show)]
#[derive(Copy, Clone, PartialEq, Debug)]
pub enum MatrixFormat { ColumnMajor, RowMajor }

/// What texture type this sampler samples from.
///
/// A single sampler cannot be used with multiple texture types.
#[derive(Copy, Clone, PartialEq, Show)]
#[derive(Copy, Clone, PartialEq, Debug)]
pub enum SamplerType {
/// Sample from a buffer.
SamplerBuffer,
Expand All @@ -66,7 +66,7 @@ pub enum SamplerType {

/// Base type of this shader parameter.
#[allow(missing_docs)]
#[derive(Copy, Clone, PartialEq, Show)]
#[derive(Copy, Clone, PartialEq, Debug)]
pub enum BaseType {
F32,
F64,
Expand All @@ -76,7 +76,7 @@ pub enum BaseType {
}

/// Number of components this parameter represents.
#[derive(Copy, Clone, PartialEq, Show)]
#[derive(Copy, Clone, PartialEq, Debug)]
pub enum ContainerType {
/// Scalar value
Single,
Expand All @@ -90,7 +90,7 @@ pub enum ContainerType {

/// Which program stage this shader represents.
#[allow(missing_docs)]
#[derive(Copy, Clone, PartialEq, Show)]
#[derive(Copy, Clone, PartialEq, Debug)]
pub enum Stage {
Vertex,
Geometry,
Expand Down Expand Up @@ -168,7 +168,7 @@ impl Clone for UniformValue {
}
}

impl fmt::Show for UniformValue {
impl fmt::Debug for UniformValue {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match *self {
UniformValue::I32(x) => write!(f, "ValueI32({:?})", x),
Expand Down Expand Up @@ -208,7 +208,7 @@ impl fmt::Show for UniformValue {
}

/// Vertex information that a shader takes as input.
#[derive(Clone, PartialEq, Show)]
#[derive(Clone, PartialEq, Debug)]
pub struct Attribute {
/// Name of this attribute.
pub name: String,
Expand All @@ -223,7 +223,7 @@ pub struct Attribute {
}

/// Uniform, a type of shader parameter representing data passed to the program.
#[derive(Clone, PartialEq, Show)]
#[derive(Clone, PartialEq, Debug)]
pub struct UniformVar {
/// Name of this uniform.
pub name: String,
Expand All @@ -238,7 +238,7 @@ pub struct UniformVar {
}

/// A uniform block.
#[derive(Clone, PartialEq, Show)]
#[derive(Clone, PartialEq, Debug)]
pub struct BlockVar {
/// Name of this uniform block.
pub name: String,
Expand All @@ -249,7 +249,7 @@ pub struct BlockVar {
}

/// Sampler, a type of shader parameter representing a texture that can be sampled.
#[derive(Clone, PartialEq, Show)]
#[derive(Clone, PartialEq, Debug)]
pub struct SamplerVar {
/// Name of this sampler variable.
pub name: String,
Expand All @@ -262,7 +262,7 @@ pub struct SamplerVar {
}

/// Metadata about a program.
#[derive(Clone, PartialEq, Show)]
#[derive(Clone, PartialEq, Debug)]
pub struct ProgramInfo {
/// Attributes in the program.
pub attributes: Vec<Attribute>,
Expand All @@ -275,7 +275,7 @@ pub struct ProgramInfo {
}

/// Error type for trying to store a UniformValue in a UniformVar.
#[derive(Copy, Show)]
#[derive(Copy, Debug)]
pub enum CompatibilityError {
/// Array sizes differ between the value and the var (trying to upload a vec2 as a vec4, etc)
ErrorArraySize,
Expand Down Expand Up @@ -316,7 +316,7 @@ impl UniformVar {

/// A type storing shader source for different graphics APIs and versions.
#[allow(missing_docs)]
#[derive(Copy, Clone, PartialEq, Show)]
#[derive(Copy, Clone, PartialEq, Debug)]
pub struct ShaderSource<'a> {
pub glsl_120: Option<&'a [u8]>,
pub glsl_130: Option<&'a [u8]>,
Expand All @@ -327,7 +327,7 @@ pub struct ShaderSource<'a> {
}

/// An error type for creating programs.
#[derive(Copy, Clone, PartialEq, Show)]
#[derive(Copy, Clone, PartialEq, Debug)]
pub enum CreateShaderError {
/// The device does not support any of the shaders supplied.
NoSupportedShaderProvided,
Expand All @@ -337,7 +337,7 @@ pub enum CreateShaderError {

/// Shader model supported by the device, corresponds to the HLSL shader models.
#[allow(missing_docs)]
#[derive(Copy, Clone, PartialEq, PartialOrd, Show)]
#[derive(Copy, Clone, PartialEq, PartialOrd, Debug)]
pub enum ShaderModel {
Unsupported,
Version30,
Expand Down
Loading

0 comments on commit cb47f60

Please sign in to comment.