Skip to content

Rendering to texture requires RenderAssetUsages::default() #18908

Open
@tigregalis

Description

@tigregalis

Bevy version

Latest main @ 12f71a8

[Optional] Relevant system information

2025-04-23T18:00:48.078539Z  INFO log: SystemInfo { os: "Windows 10 Home", kernel: "19045", cpu: "Intel(R) Core(TM) i7-8700K CPU @ 3.70GHz", core_count: "6", memory: "63.9 GiB" }
2025-04-23T18:00:48.408691Z  INFO bevy_render::renderer: AdapterInfo { name: "NVIDIA GeForce GTX 1080 Ti", vendor: 4318, device: 6918, device_type: DiscreteGpu, driver: "NVIDIA", driver_info: "560.94", backend: Vulkan }
2025-04-23T18:00:48.632350Z  INFO bevy_render::batching::gpu_preprocessing: GPU preprocessing is fully supported on this device.

What you did

Modify line 48 of example render_to_texture.rs

    // This is the texture that will be rendered to.
    let mut image = Image::new_fill(
        size,
        TextureDimension::D2,
        &[0, 0, 0, 0],
        TextureFormat::Bgra8UnormSrgb,
-       RenderAssetUsages::default(),
+       RenderAssetUsages::RENDER_WORLD,
    );

What went wrong

Although this example doesn't seem to be accessing the image from the CPU after creation:

With RenderAssetUsages::default() (RenderAssetUsages::MAIN_WORLD | RenderAssetUsages::RENDER_WORLD) the image renders as expected:

image

But with only RenderAssetUsages::RENDER_WORLD the cube in the first pass image isn't rendering correctly:

image

Additional information

More context where it was discovered in this PR: #17209 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-AssetsLoad files from disk to use for things like images, models, and soundsA-RenderingDrawing game state to the screenC-BugAn unexpected or incorrect behavior

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions