1 // Copyright (c) 2017 The vulkano developers
2 // Licensed under the Apache License, Version 2.0
3 // <LICENSE-APACHE or
4 // https://www.apache.org/licenses/LICENSE-2.0> or the MIT
5 // license <LICENSE-MIT or https://opensource.org/licenses/MIT>,
6 // at your option. All files in the project carrying such
7 // notice may not be copied, modified, or distributed except
8 // according to those terms.
9
10 use crate::pipeline::layout::PipelineLayout;
11 use std::error;
12 use std::fmt;
13
14 /// Checks whether push constants are compatible with the pipeline.
check_push_constants_validity<Pc>( pipeline_layout: &PipelineLayout, push_constants: &Pc, ) -> Result<(), CheckPushConstantsValidityError> where Pc: ?Sized,15 pub fn check_push_constants_validity<Pc>(
16 pipeline_layout: &PipelineLayout,
17 push_constants: &Pc,
18 ) -> Result<(), CheckPushConstantsValidityError>
19 where
20 Pc: ?Sized,
21 {
22 // TODO
23 if !true {
24 return Err(CheckPushConstantsValidityError::IncompatiblePushConstants);
25 }
26
27 Ok(())
28 }
29
30 /// Error that can happen when checking push constants validity.
31 #[derive(Debug, Copy, Clone)]
32 pub enum CheckPushConstantsValidityError {
33 /// The push constants are incompatible with the pipeline layout.
34 IncompatiblePushConstants,
35 }
36
37 impl error::Error for CheckPushConstantsValidityError {}
38
39 impl fmt::Display for CheckPushConstantsValidityError {
40 #[inline]
fmt(&self, fmt: &mut fmt::Formatter) -> Result<(), fmt::Error>41 fn fmt(&self, fmt: &mut fmt::Formatter) -> Result<(), fmt::Error> {
42 write!(
43 fmt,
44 "{}",
45 match *self {
46 CheckPushConstantsValidityError::IncompatiblePushConstants => {
47 "the push constants are incompatible with the pipeline layout"
48 }
49 }
50 )
51 }
52 }
53