Struct CompositionTargetRenderPass
pub struct CompositionTargetRenderPass(/* private fields */);Expand description
Use the Composition Target Render Pass to set one to four composition targets and render all descendant render passes to the composition targets that the Composition Target Render Pass created. If you set multiple composition targets, rendering can write to all specified buffers at the same time. See MultipleCompositionTargets “Using multiple composition targets”. After Kanzi renders the descendant render passes of a Composition Target Render Pass, the Composition Target Render Pass restores the earlier composition settings.
§Configuring the composition target
Composition Target Render Pass by default creates one composition target whose size is the same as the size of the current Viewport 2D node using the RGBA pixel format and depth buffer. To configure the composition target, you can:
- Set the pixel format of the composition target with the PixelFormat0Property property.
- Set the size of the composition target in relation to the size of the current Viewport 2D node with the ResolutionMultiplierProperty and ResolutionDivisorProperty properties. These properties set a fractional number (rational number) which Kanzi uses to multiply the size of the current Viewport 2D node.
- Set the absolute size of the composition target with the WidthProperty and HeightProperty. This overrides the resolution that you set with the ResolutionMultiplierProperty and ResolutionDivisorProperty.
- Set the filtering mode of the composition target with the FilterModeProperty and MipmapModeProperty.
- Set the addressing mode of the composition target with the AddressingModeProperty.
- Set the number of samples for each pixel or disable multisampling with the MultisampleLevelProperty.
§Using custom render target textures
You can set a Composition Target Render Pass to use a composition target texture that you create somewhere else with the CompositionTarget0Property property. The render pass for which you set the composition target texture with this property does not create its own render target.
For example, to use a custom render target texture, bind the CompositionTarget0Property property of a Composition Target Render Pass to properties of other render passes. Use the DepthTargetProperty to set the depth texture.
To set a Composition Target Render Pass to render to multiple render target textures, use these properties to set each render target texture:
- CompositionTarget0Property
- CompositionTarget1Property
- CompositionTarget2Property
- CompositionTarget3Property
- DepthTargetProperty
When you use the result target properties from other CompositionTargetRenderPass render passes to render incrementally into the targets, set the ResolveImmediatelyProperty to false in the original CompositionTargetRenderPass.
The size settings of the explicitly defined composition targets must match. If you do not explicitly define some of the composition targets, the size of the explicitly defined composition targets must match the size that Kanzi automatically calculates for the viewport. Kanzi discards all composition targets with mismatches in their sizes and instead creates a composition target automatically.
§Accessing the composition target result
To access the result of a Composition Target Render Pass:
The texture that the getResultTexture0() function returns is not necessarily the texture that a Composition Target Render Pass rendered, or the texture set to the CompositionTarget0Property. For example, if you use multisampling, the getResultTexture0() function returns the target, where it resolves multiple samples into a 2D texture.
If a Composition Target Render Pass was not executed, the result of the getResultTexture0() function is undefined.
To use the result textures of a Composition Target Render Pass in another render pass, create bindings to these properties:
- ResultTexture0Property
- ResultTexture1Property
- ResultTexture2Property
- ResultTexture3Property
- ResultDepthTextureProperty
For example, in a Blit Render Pass you can bind the BlitRenderPass::Texture0Property to the ResultTexture0Property of a Composition Target Render Pass, the BlitRenderPass::Texture1Property to the ResultTexture1Property, and so on.
You can use the result texture properties to access the result textures of both the explicitly defined composition targets and the composition targets generated automatically by the Composition Target Render Pass.
To avoid needlessly updating the bindings that read these properties, Kanzi updates the values of these properties only when the associated composition targets change or disappear.
Use the ResolveImmediatelyProperty to set whether to resolve multisamples and generate mipmaps for the composition targets immediately after rendering. By default the Composition Render Target Render Pass resolves multisamples and generates mipmaps immediately, but if you use some or all of the composition targets for further rendering elsewhere, you can set the value of this property to false. This way you delay the resolve operations until the result composition target is referenced.
§Using multiple composition targets
You can set a Composition Target Render Pass to render to up to 4 composition targets at the same time. To control the pixel format of a composition target, set its pixel format property:
- PixelFormat0Property
- PixelFormat1Property
- PixelFormat2Property
- PixelFormat3Property
- DepthTextureFormatProperty
The Pixel Format property with the highest index sets the number of composition targets that Kanzi creates for a Composition Target Render Pass. If you do not set some of the Pixel Format properties, those properties get their value from a Pixel Format property with a higher index whose value is set. For example, if you set the values of the PixelFormat0Property and PixelFormat2Property, Kanzi creates three composition targets and:
- The first composition target uses the pixel format that you set using the PixelFormat0Property.
- The second composition target uses the pixel format that you set in the PixelFormat2Property.
- The third composition target uses the pixel format that you set in the PixelFormat2Property.
To set the same pixel format for all composition targets, you can set the corresponding highest-index pixel format property and remove the other pixel format properties.
Use the DepthTextureFormatProperty to set the format for a depth texture. When you do not set the DepthTextureFormatProperty, but the rendering settings require depth testing to render the child render passes, Kanzi automatically creates a depth renderbuffer. When you set the DepthTextureFormatProperty, Kanzi creates a depth texture that you can access with the ResultDepthTextureProperty.
To create a Composition Target Render Pass with multiple output textures:
To use the result textures from a Composition Target Render Pass in a Blit Render Pass:
§Examples
To use a Composition Target Render Pass with a custom render target with automatic size:
Implementations§
§impl CompositionTargetRenderPass
impl CompositionTargetRenderPass
pub fn get_resolution_multiplier(&self) -> Result<i32, Error>
pub fn get_resolution_multiplier(&self) -> Result<i32, Error>
pub fn set_resolution_multiplier(&self, value: i32) -> Result<(), Error>
pub fn set_resolution_multiplier(&self, value: i32) -> Result<(), Error>
pub fn get_resolution_divisor(&self) -> Result<i32, Error>
pub fn get_resolution_divisor(&self) -> Result<i32, Error>
pub fn set_resolution_divisor(&self, value: i32) -> Result<(), Error>
pub fn set_resolution_divisor(&self, value: i32) -> Result<(), Error>
pub fn get_width(&self) -> Result<i32, Error>
pub fn get_width(&self) -> Result<i32, Error>
See: WIDTH_PROPERTY
pub fn get_height(&self) -> Result<i32, Error>
pub fn get_height(&self) -> Result<i32, Error>
See: HEIGHT_PROPERTY
pub fn set_height(&self, value: i32) -> Result<(), Error>
pub fn set_height(&self, value: i32) -> Result<(), Error>
See: HEIGHT_PROPERTY
pub fn get_pixel_format0(&self) -> Result<GraphicsFormat, Error>
pub fn get_pixel_format0(&self) -> Result<GraphicsFormat, Error>
pub fn set_pixel_format0(&self, value: GraphicsFormat) -> Result<(), Error>
pub fn set_pixel_format0(&self, value: GraphicsFormat) -> Result<(), Error>
pub fn get_pixel_format1(&self) -> Result<GraphicsFormat, Error>
pub fn get_pixel_format1(&self) -> Result<GraphicsFormat, Error>
pub fn set_pixel_format1(&self, value: GraphicsFormat) -> Result<(), Error>
pub fn set_pixel_format1(&self, value: GraphicsFormat) -> Result<(), Error>
pub fn get_pixel_format2(&self) -> Result<GraphicsFormat, Error>
pub fn get_pixel_format2(&self) -> Result<GraphicsFormat, Error>
pub fn set_pixel_format2(&self, value: GraphicsFormat) -> Result<(), Error>
pub fn set_pixel_format2(&self, value: GraphicsFormat) -> Result<(), Error>
pub fn get_pixel_format3(&self) -> Result<GraphicsFormat, Error>
pub fn get_pixel_format3(&self) -> Result<GraphicsFormat, Error>
pub fn set_pixel_format3(&self, value: GraphicsFormat) -> Result<(), Error>
pub fn set_pixel_format3(&self, value: GraphicsFormat) -> Result<(), Error>
pub fn get_depth_texture_format(&self) -> Result<GraphicsFormat, Error>
pub fn get_depth_texture_format(&self) -> Result<GraphicsFormat, Error>
pub fn set_depth_texture_format(
&self,
value: GraphicsFormat,
) -> Result<(), Error>
pub fn set_depth_texture_format( &self, value: GraphicsFormat, ) -> Result<(), Error>
pub fn get_depth_renderbuffer_format(&self) -> Result<GraphicsFormat, Error>
pub fn get_depth_renderbuffer_format(&self) -> Result<GraphicsFormat, Error>
pub fn set_depth_renderbuffer_format(
&self,
value: GraphicsFormat,
) -> Result<(), Error>
pub fn set_depth_renderbuffer_format( &self, value: GraphicsFormat, ) -> Result<(), Error>
pub fn get_depth_compare_function(
&self,
) -> Result<GraphicsCompareFunction, Error>
pub fn get_depth_compare_function( &self, ) -> Result<GraphicsCompareFunction, Error>
pub fn set_depth_compare_function(
&self,
value: GraphicsCompareFunction,
) -> Result<(), Error>
pub fn set_depth_compare_function( &self, value: GraphicsCompareFunction, ) -> Result<(), Error>
pub fn get_addressing_mode(&self) -> Result<SamplerAddressingMode, Error>
pub fn get_addressing_mode(&self) -> Result<SamplerAddressingMode, Error>
pub fn set_addressing_mode(
&self,
value: SamplerAddressingMode,
) -> Result<(), Error>
pub fn set_addressing_mode( &self, value: SamplerAddressingMode, ) -> Result<(), Error>
pub fn get_filter_mode(&self) -> Result<SamplerFilter, Error>
pub fn get_filter_mode(&self) -> Result<SamplerFilter, Error>
See: FILTER_MODE_PROPERTY
pub fn set_filter_mode(&self, value: SamplerFilter) -> Result<(), Error>
pub fn set_filter_mode(&self, value: SamplerFilter) -> Result<(), Error>
See: FILTER_MODE_PROPERTY
pub fn get_mipmap_mode(&self) -> Result<SamplerMipmapMode, Error>
pub fn get_mipmap_mode(&self) -> Result<SamplerMipmapMode, Error>
See: MIPMAP_MODE_PROPERTY
pub fn set_mipmap_mode(&self, value: SamplerMipmapMode) -> Result<(), Error>
pub fn set_mipmap_mode(&self, value: SamplerMipmapMode) -> Result<(), Error>
See: MIPMAP_MODE_PROPERTY
pub fn get_multisample_level(&self) -> Result<MultisampleCount, Error>
pub fn get_multisample_level(&self) -> Result<MultisampleCount, Error>
pub fn set_multisample_level(
&self,
value: MultisampleCount,
) -> Result<(), Error>
pub fn set_multisample_level( &self, value: MultisampleCount, ) -> Result<(), Error>
pub fn get_resolve_immediately(&self) -> Result<bool, Error>
pub fn get_resolve_immediately(&self) -> Result<bool, Error>
pub fn set_resolve_immediately(&self, value: bool) -> Result<(), Error>
pub fn set_resolve_immediately(&self, value: bool) -> Result<(), Error>
Methods from Deref<Target = RenderPass>§
pub fn get_enabled(&self) -> Result<bool, Error>
pub fn get_enabled(&self) -> Result<bool, Error>
See: ENABLED_PROPERTY
pub fn set_enabled(&self, value: bool) -> Result<(), Error>
pub fn set_enabled(&self, value: bool) -> Result<(), Error>
See: ENABLED_PROPERTY
pub fn get_input_viewport_area(&self) -> Result<Vector4, Error>
pub fn get_input_viewport_area(&self) -> Result<Vector4, Error>
pub fn set_input_viewport_area(&self, value: Vector4) -> Result<(), Error>
pub fn set_input_viewport_area(&self, value: Vector4) -> Result<(), Error>
pub fn get_update_rate(&self) -> Result<i32, Error>
pub fn get_update_rate(&self) -> Result<i32, Error>
See: UPDATE_RATE_PROPERTY
pub fn set_update_rate(&self, value: i32) -> Result<(), Error>
pub fn set_update_rate(&self, value: i32) -> Result<(), Error>
See: UPDATE_RATE_PROPERTY
pub fn get_update_offset(&self) -> Result<i32, Error>
pub fn get_update_offset(&self) -> Result<i32, Error>
pub fn set_update_offset(&self, value: i32) -> Result<(), Error>
pub fn set_update_offset(&self, value: i32) -> Result<(), Error>
Methods from Deref<Target = Resource>§
pub fn get_name(&self) -> Result<KanziString, Error>
pub fn get_name(&self) -> Result<KanziString, Error>
Gets the resource name.
pub fn get_url(&self) -> Result<KanziString, Error>
pub fn get_url(&self) -> Result<KanziString, Error>
Gets the resource URL. Note that the URL is not necessarily in URL form if resource has been just created.
§Returns
URL string.
Methods from Deref<Target = Object>§
pub fn as_ptr(&self) -> *mut ObjectWrapper
pub fn as_wrapper(&self) -> &ObjectWrapper
pub fn as_object(&self) -> &Object
pub fn as_object(&self) -> &Object
Represents any type inheriting from Object as &Object.
This is useful for comparisions when PartialEq traits failed to compare objects of
different types.
let child = screen.get_child(0)?;
let parent = child.get_parent()?.into_error(ErrorKind::ObjectNotFound)?;
// assert_eq!(screen, parent); // <- Fails to compile!
assert_eq!(screen.as_object(), parent.as_object());pub fn get_native(&self) -> Result<NonNull<c_void>, Error>
pub fn get_native(&self) -> Result<NonNull<c_void>, Error>
Gets a pointer to the backing C++ instance.
pub fn get_property<T>(
&self,
property_type: &PropertyType<T>,
) -> Result<<T as VariantConstraint>::RetArg, Error>where
T: PropertyTypeConstraint,
pub fn get_property<T>(
&self,
property_type: &PropertyType<T>,
) -> Result<<T as VariantConstraint>::RetArg, Error>where
T: PropertyTypeConstraint,
Returns the current value of a property disregarding modifiers.
Base value is affected by the following inputs where the highest entry in the list determines the base value:
- Local value set with setProperty or loaded from kzb
- Value set by a style affecting the property.
- Value defined by class metadata.
Modifiers are not applied, the highest-priority base value is returned.
If no inputs to the property value can be established the system returns the value default value from property type metadata.
§Arguments
property_type- The property type identifying the property to retrieve.
§Returns
The evaluated property value.
pub fn get_optional_property<T>(
&self,
property_type: &PropertyType<T>,
) -> Result<Option<<T as VariantConstraint>::RetArg>, Error>where
T: PropertyTypeConstraint,
pub fn get_optional_property<T>(
&self,
property_type: &PropertyType<T>,
) -> Result<Option<<T as VariantConstraint>::RetArg>, Error>where
T: PropertyTypeConstraint,
Returns the current value of a property disregarding modifiers, but does not default to the value in property metadata if there are no inputs to the property value.
If there is no value sources, None is returned.
If no inputs to the property value can be established the system returns the value default value from property type metadata.
§Arguments
property_type- The property type identifying the property to retrieve.
§Returns
The evaluated property value.
pub fn set_property<T>(
&self,
property_type: &PropertyType<T>,
value: <T as VariantConstraint>::DataArg<'_>,
) -> Result<(), Error>where
T: PropertyTypeConstraint,
pub fn set_property<T>(
&self,
property_type: &PropertyType<T>,
value: <T as VariantConstraint>::DataArg<'_>,
) -> Result<(), Error>where
T: PropertyTypeConstraint,
Sets the local value of a property type.
pub fn has_value<T>(
&self,
property_type: &PropertyType<T>,
) -> Result<bool, Error>where
T: PropertyTypeConstraint,
pub fn has_value<T>(
&self,
property_type: &PropertyType<T>,
) -> Result<bool, Error>where
T: PropertyTypeConstraint,
Evaluates whether there are any inputs into the property value. Both value sources and modifiers are taken into account.
§Returns
Returns true if there are inputs into the property value, false otherwise.
pub fn remove_local_value<T>(
&self,
property_type: &PropertyType<T>,
) -> Result<(), Error>where
T: PropertyTypeConstraint,
pub fn remove_local_value<T>(
&self,
property_type: &PropertyType<T>,
) -> Result<(), Error>where
T: PropertyTypeConstraint,
Removes the local value associated with the property.
pub fn get_metaclass(&self) -> Result<Metaclass, Error>
pub fn get_metaclass(&self) -> Result<Metaclass, Error>
Returns the metaclass of the dynamic type of the object.
pub fn get_domain(&self) -> Result<Domain, Error>
pub fn get_domain(&self) -> Result<Domain, Error>
Returns the domain the object belongs to.
pub fn set_flag_keep_during_patching<T>(
&self,
property_type: &PropertyType<T>,
) -> Result<(), Error>where
T: PropertyTypeConstraint,
pub fn set_flag_keep_during_patching<T>(
&self,
property_type: &PropertyType<T>,
) -> Result<(), Error>where
T: PropertyTypeConstraint,
Sets the flag to indicate that the property was loaded from KZB.
pub fn debug_string(&self) -> Result<String, Error>
pub fn debug_string(&self) -> Result<String, Error>
Builds a string representation of the object intended for debugging purposes.
Trait Implementations§
§impl Clone for CompositionTargetRenderPass
impl Clone for CompositionTargetRenderPass
§fn clone(&self) -> CompositionTargetRenderPass
fn clone(&self) -> CompositionTargetRenderPass
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more