Skip to content

Commit

Permalink
rename VResult to Result
Browse files Browse the repository at this point in the history
  • Loading branch information
DasLixou committed May 13, 2024
1 parent 3e9e11c commit 45546db
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 12 deletions.
12 changes: 6 additions & 6 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ pub enum VelloError {
}

#[allow(dead_code)]
pub(crate) type VResult<T> = Result<T, VelloError>;
pub(crate) type Result<T, E = VelloError> = std::result::Result<T, E>;

/// Renders a scene into a texture or surface.
#[cfg(feature = "wgpu")]
Expand Down Expand Up @@ -284,7 +284,7 @@ pub struct RendererOptions {
#[cfg(feature = "wgpu")]
impl Renderer {
/// Creates a new renderer for the specified device.
pub fn new(device: &Device, options: RendererOptions) -> VResult<Self> {
pub fn new(device: &Device, options: RendererOptions) -> Result<Self> {
let mut engine = WgpuEngine::new(options.use_cpu);
// If we are running in parallel (i.e. the number of threads is not 1)
if options.num_init_threads != NonZeroUsize::new(1) {
Expand Down Expand Up @@ -327,7 +327,7 @@ impl Renderer {
scene: &Scene,
texture: &TextureView,
params: &RenderParams,
) -> VResult<()> {
) -> Result<()> {
let (recording, target) =
render::render_full(scene, &mut self.resolver, &self.shaders, params);
let external_resources = [ExternalResource::Image(
Expand Down Expand Up @@ -361,7 +361,7 @@ impl Renderer {
scene: &Scene,
surface: &SurfaceTexture,
params: &RenderParams,
) -> VResult<()> {
) -> Result<()> {
let width = params.width;
let height = params.height;
let mut target = self
Expand Down Expand Up @@ -465,7 +465,7 @@ impl Renderer {
scene: &Scene,
texture: &TextureView,
params: &RenderParams,
) -> VResult<Option<BumpAllocators>> {
) -> Result<Option<BumpAllocators>> {
let mut render = Render::new();
let encoding = scene.encoding();
// TODO: turn this on; the download feature interacts with CPU dispatch
Expand Down Expand Up @@ -525,7 +525,7 @@ impl Renderer {
scene: &Scene,
surface: &SurfaceTexture,
params: &RenderParams,
) -> VResult<Option<BumpAllocators>> {
) -> Result<Option<BumpAllocators>> {
let width = params.width;
let height = params.height;
let mut target = self
Expand Down
4 changes: 2 additions & 2 deletions src/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use wgpu::{
TextureFormat,
};

use crate::{VResult, VelloError};
use crate::{Result, VelloError};

/// Simple render context that maintains wgpu state for rendering the pipeline.
pub struct RenderContext {
Expand Down Expand Up @@ -51,7 +51,7 @@ impl RenderContext {
width: u32,
height: u32,
present_mode: wgpu::PresentMode,
) -> VResult<RenderSurface<'w>> {
) -> Result<RenderSurface<'w>> {
let surface = self.instance.create_surface(window.into())?;
let dev_id = self
.device(Some(&surface))
Expand Down
7 changes: 3 additions & 4 deletions src/wgpu_engine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,9 @@ use wgpu::{
TextureUsages, TextureView, TextureViewDimension,
};

use crate::recording::BindType;
use crate::{
recording::BindType, BufferProxy, Command, ImageProxy,
Recording, ResourceId, ResourceProxy, ShaderId, VResult, VelloError,
recording::BindType, BufferProxy, Command, ImageProxy, Recording, ResourceId,
ResourceProxy, Result, ShaderId, VelloError,
};

#[cfg(not(target_arch = "wasm32"))]
Expand Down Expand Up @@ -346,7 +345,7 @@ impl WgpuEngine {
external_resources: &[ExternalResource],
label: &'static str,
#[cfg(feature = "wgpu-profiler")] profiler: &mut wgpu_profiler::GpuProfiler,
) -> VResult<()> {
) -> Result<()> {
let mut free_bufs: HashSet<ResourceId> = Default::default();
let mut free_images: HashSet<ResourceId> = Default::default();
let mut transient_map = TransientBindMap::new(external_resources);
Expand Down

0 comments on commit 45546db

Please sign in to comment.