Move the GPU rendering code out of `pathfinder_gl`, since it's now no longer

OpenGL-specific
This commit is contained in:
Patrick Walton 2019-03-05 14:46:18 -08:00
parent bc80490158
commit f7a8b573ce
10 changed files with 39 additions and 22 deletions

7
Cargo.lock generated
View File

@ -541,9 +541,6 @@ dependencies = [
"pathfinder_gpu 0.1.0", "pathfinder_gpu 0.1.0",
"pathfinder_renderer 0.1.0", "pathfinder_renderer 0.1.0",
"pathfinder_simd 0.3.0", "pathfinder_simd 0.3.0",
"serde 1.0.88 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_derive 1.0.88 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_json 1.0.38 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]] [[package]]
@ -563,9 +560,13 @@ dependencies = [
"fixedbitset 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", "fixedbitset 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)",
"hashbrown 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", "hashbrown 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)",
"pathfinder_geometry 0.3.0", "pathfinder_geometry 0.3.0",
"pathfinder_gpu 0.1.0",
"pathfinder_simd 0.3.0", "pathfinder_simd 0.3.0",
"quickcheck 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)", "quickcheck 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)",
"rayon 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", "rayon 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.88 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_derive 1.0.88 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_json 1.0.38 (registry+https://github.com/rust-lang/crates.io-index)",
"smallvec 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)", "smallvec 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)",
] ]

View File

@ -20,10 +20,10 @@ use pathfinder_geometry::basic::rect::RectF32;
use pathfinder_geometry::basic::transform2d::Transform2DF32; use pathfinder_geometry::basic::transform2d::Transform2DF32;
use pathfinder_geometry::basic::transform3d::{Perspective, Transform3DF32}; use pathfinder_geometry::basic::transform3d::{Perspective, Transform3DF32};
use pathfinder_gl::device::GLDevice; use pathfinder_gl::device::GLDevice;
use pathfinder_gl::renderer::Renderer;
use pathfinder_gpu::{DepthFunc, DepthState, Device, Primitive, RenderState, Resources}; use pathfinder_gpu::{DepthFunc, DepthState, Device, Primitive, RenderState, Resources};
use pathfinder_gpu::{StencilFunc, StencilState, UniformData}; use pathfinder_gpu::{StencilFunc, StencilState, UniformData};
use pathfinder_renderer::builder::{RenderOptions, RenderTransform, SceneBuilder}; use pathfinder_renderer::builder::{RenderOptions, RenderTransform, SceneBuilder};
use pathfinder_renderer::gpu::renderer::Renderer;
use pathfinder_renderer::gpu_data::BuiltScene; use pathfinder_renderer::gpu_data::BuiltScene;
use pathfinder_renderer::paint::ColorU; use pathfinder_renderer::paint::ColorU;
use pathfinder_renderer::post::{DEFRINGING_KERNEL_CORE_GRAPHICS, STEM_DARKENING_FACTORS}; use pathfinder_renderer::post::{DEFRINGING_KERNEL_CORE_GRAPHICS, STEM_DARKENING_FACTORS};

View File

@ -12,8 +12,8 @@ use crate::Options;
use nfd::Response; use nfd::Response;
use pathfinder_geometry::basic::point::Point2DI32; use pathfinder_geometry::basic::point::Point2DI32;
use pathfinder_geometry::basic::rect::RectI32; use pathfinder_geometry::basic::rect::RectI32;
use pathfinder_gl::debug::{DebugUI, PADDING, TEXT_COLOR, WINDOW_COLOR};
use pathfinder_gpu::{Device, Resources}; use pathfinder_gpu::{Device, Resources};
use pathfinder_renderer::gpu::debug::{DebugUI, PADDING, TEXT_COLOR, WINDOW_COLOR};
use pathfinder_renderer::paint::ColorU; use pathfinder_renderer::paint::ColorU;
use std::f32::consts::PI; use std::f32::consts::PI;
use std::path::PathBuf; use std::path::PathBuf;

View File

@ -6,9 +6,6 @@ authors = ["Patrick Walton <pcwalton@mimiga.net>"]
[dependencies] [dependencies]
gl = "0.6" gl = "0.6"
serde = "1.0"
serde_derive = "1.0"
serde_json = "1.0"
[dependencies.image] [dependencies.image]
version = "0.21" version = "0.21"

View File

@ -15,9 +15,4 @@
//! rendering yourself using the API or engine of your choice. This crate can //! rendering yourself using the API or engine of your choice. This crate can
//! be useful for simple use cases, however. //! be useful for simple use cases, however.
#[macro_use]
extern crate serde_derive;
pub mod debug;
pub mod device; pub mod device;
pub mod renderer;

View File

@ -9,11 +9,17 @@ byteorder = "1.2"
fixedbitset = "0.1" fixedbitset = "0.1"
hashbrown = "0.1" hashbrown = "0.1"
rayon = "1.0" rayon = "1.0"
serde = "1.0"
serde_derive = "1.0"
serde_json = "1.0"
smallvec = "0.6" smallvec = "0.6"
[dependencies.pathfinder_geometry] [dependencies.pathfinder_geometry]
path = "../geometry" path = "../geometry"
[dependencies.pathfinder_gpu]
path = "../gpu"
[dependencies.pathfinder_simd] [dependencies.pathfinder_simd]
path = "../simd" path = "../simd"

View File

@ -1,4 +1,4 @@
// pathfinder/gl/src/debug.rs // pathfinder/renderer/src/gpu/debug.rs
// //
// Copyright © 2019 The Pathfinder Project Developers. // Copyright © 2019 The Pathfinder Project Developers.
// //
@ -15,12 +15,12 @@
//! //!
//! The debug font atlas was generated using: https://evanw.github.io/font-texture-generator/ //! The debug font atlas was generated using: https://evanw.github.io/font-texture-generator/
use crate::gpu_data::Stats;
use crate::paint::ColorU;
use pathfinder_geometry::basic::point::Point2DI32; use pathfinder_geometry::basic::point::Point2DI32;
use pathfinder_geometry::basic::rect::RectI32; use pathfinder_geometry::basic::rect::RectI32;
use pathfinder_gpu::{BlendState, BufferTarget, BufferUploadMode, Device, Primitive, RenderState}; use pathfinder_gpu::{BlendState, BufferTarget, BufferUploadMode, Device, Primitive, RenderState};
use pathfinder_gpu::{Resources, UniformData, VertexAttrType}; use pathfinder_gpu::{Resources, UniformData, VertexAttrType};
use pathfinder_renderer::gpu_data::Stats;
use pathfinder_renderer::paint::ColorU;
use pathfinder_simd::default::F32x4; use pathfinder_simd::default::F32x4;
use serde_json; use serde_json;
use std::collections::{HashMap, VecDeque}; use std::collections::{HashMap, VecDeque};

14
renderer/src/gpu/mod.rs Normal file
View File

@ -0,0 +1,14 @@
// pathfinder/renderer/src/gpu/mod.rs
//
// Copyright © 2019 The Pathfinder Project Developers.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
//! The GPU renderer for Pathfinder 3.
pub mod debug;
pub mod renderer;

View File

@ -1,4 +1,4 @@
// pathfinder/gl/src/renderer.rs // pathfinder/renderer/src/gpu/renderer.rs
// //
// Copyright © 2019 The Pathfinder Project Developers. // Copyright © 2019 The Pathfinder Project Developers.
// //
@ -8,15 +8,15 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // except according to those terms.
use crate::debug::DebugUI; use crate::gpu::debug::DebugUI;
use crate::gpu_data::{Batch, BuiltScene, SolidTileScenePrimitive};
use crate::paint::{ColorU, ObjectShader};
use crate::post::DefringingKernel;
use crate::tiles::{TILE_HEIGHT, TILE_WIDTH};
use pathfinder_geometry::basic::point::{Point2DI32, Point3DF32}; use pathfinder_geometry::basic::point::{Point2DI32, Point3DF32};
use pathfinder_gpu::{BlendState, BufferTarget, BufferUploadMode, DepthFunc, DepthState, Device}; use pathfinder_gpu::{BlendState, BufferTarget, BufferUploadMode, DepthFunc, DepthState, Device};
use pathfinder_gpu::{Primitive, RenderState, Resources, StencilFunc, StencilState, TextureFormat}; use pathfinder_gpu::{Primitive, RenderState, Resources, StencilFunc, StencilState, TextureFormat};
use pathfinder_gpu::{UniformData, VertexAttrType}; use pathfinder_gpu::{UniformData, VertexAttrType};
use pathfinder_renderer::gpu_data::{Batch, BuiltScene, SolidTileScenePrimitive};
use pathfinder_renderer::paint::{ColorU, ObjectShader};
use pathfinder_renderer::post::DefringingKernel;
use pathfinder_renderer::tiles::{TILE_HEIGHT, TILE_WIDTH};
use pathfinder_simd::default::{F32x4, I32x4}; use pathfinder_simd::default::{F32x4, I32x4};
use std::collections::VecDeque; use std::collections::VecDeque;
use std::time::Duration; use std::time::Duration;

View File

@ -10,7 +10,11 @@
//! The CPU portion of Pathfinder's renderer. //! The CPU portion of Pathfinder's renderer.
#[macro_use]
extern crate serde_derive;
pub mod builder; pub mod builder;
pub mod gpu;
pub mod gpu_data; pub mod gpu_data;
pub mod paint; pub mod paint;
pub mod post; pub mod post;