pub fn adapt_env<Q, E>(
    self,
    env: E,
  ) -> Result<BuiltProgram<S, Out, Q>, AdaptationFailure<S, Out, Uni>>
  where Q: UniformInterface<E> {
    // first, try to create the new uniform interface
    let new_uni_iface = create_uniform_interface(&self.raw, env);

    match new_uni_iface {
      Ok((uni_iface, warnings)) => {
        // if we have succeeded, return self with the new uniform interface
        let program = Program {
          raw: self.raw,
          uni_iface,
          _in: PhantomData,
          _out: PhantomData,
        };
        let warnings = warnings.into_iter().map(ProgramWarning::Uniform).collect();

        Ok(BuiltProgram { program, warnings })
      }

      Err(iface_err) => {
        // we couldn’t generate the new uniform interface; return the error(s) that occurred and the
        // the untouched former program
        let failure = AdaptationFailure { program: self, error: iface_err };
        Err(failure)
      }
    }
  }
/// Transform the program to adapt the uniform interface by looking up an environment.
///
/// This function will not re-allocate nor recreate the GPU data. It will try to change the
/// uniform interface and if the new uniform interface is correctly generated, return the same
/// shader program updated with the new uniform interface. If the generation of the new uniform
/// interface fails, this function will return the program with the former uniform interface.
Transform the program to adapt the uniform interface by looking up an environment.
This function will not re-allocate nor recreate the GPU data. It will try to change the
uniform interface and if the new uniform interface is correctly generated, return the same
shader program updated with the new uniform interface. If the generation of the new uniform
interface fails, this function will return the program with the former uniform interface.
Transform the program to adapt the uniform interface by looking up an environment . This function will not re - allocate nor recreate the GPU data . It will try to change the uniform interface and if the new uniform interface is correctly generated return the same shader program updated with the new uniform interface . If the generation of the new uniform interface fails this function will return the program with the former uniform interface .
pub fn adapt_env<Q, E>(
    self,
    env: E,
  ) -> Result<BuiltProgram<S, Out, Q>, AdaptationFailure<S, Out, Uni>>
  where Q: UniformInterface<E> {
    // first, try to create the new uniform interface
    let new_uni_iface = create_uniform_interface(&self.raw, env);
    match new_uni_iface {
      Ok((uni_iface, warnings)) => {
        // if we have succeeded, return self with the new uniform interface
        let program = Program {
          raw: self.raw,
          uni_iface,
          _in: PhantomData,
          _out: PhantomData,
        };
        let warnings = warnings.into_iter().map(ProgramWarning::Uniform).collect();
        Ok(BuiltProgram { program, warnings })
      }
      Err(iface_err) => {
        // we couldn’t generate the new uniform interface; return the error(s) that occurred and the
        // the untouched former program
        let failure = AdaptationFailure { program: self, error: iface_err };
        Err(failure)
      }
    }
  }
pub fn adapt_env < Q , E > ( self , env : E , ) -> Result < BuiltProgram < S , Out , Q > , AdaptationFailure < S , Out , Uni > > where Q : UniformInterface < E > { // first, try to create the new uniform interface let new_uni_iface = create_uniform_interface ( & self . raw , env ) ; match new_uni_iface { Ok ( ( uni_iface , warnings ) ) => { // if we have succeeded, return self with the new uniform interface let program = Program { raw : self . raw , uni_iface , _in : PhantomData , _out : PhantomData , } ; let warnings = warnings . into_iter ( ) . map ( ProgramWarning :: Uniform ) . collect ( ) ; Ok ( BuiltProgram { program , warnings } ) } Err ( iface_err ) => { // we couldn’t generate the new uniform interface; return the error(s) that occurred and the // the untouched former program let failure = AdaptationFailure { program : self , error : iface_err } ; Err ( failure ) } } }
Transform the program to adapt the uniform interface by looking up an environment.
Transform the program to adapt the uniform interface by looking up an environment .
self
env
E