gallium: properly type pipe_resource.usage with the enum

This allows for a more strongly typed field on the Rust side.

Acked-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29720>
This commit is contained in:
Karol Herbst
2024-06-13 21:54:19 +02:00
committed by Marge Bot
parent f58247882a
commit 40785d9a52
4 changed files with 4 additions and 4 deletions

View File

@@ -333,7 +333,7 @@ d3d12_surface_update_pre_draw(struct pipe_context *pctx,
templ.array_size = src->array_size;
templ.nr_samples = src->nr_samples;
templ.nr_storage_samples = src->nr_storage_samples;
templ.usage = PIPE_USAGE_DEFAULT | PIPE_USAGE_STAGING;
templ.usage = PIPE_USAGE_STAGING;
templ.bind = src->bind;
templ.target = src->target;

View File

@@ -107,7 +107,7 @@ impl PipeResource {
}
pub fn is_staging(&self) -> bool {
self.as_ref().usage() & pipe_resource_usage::PIPE_USAGE_STAGING.0 != 0
self.as_ref().usage() == pipe_resource_usage::PIPE_USAGE_STAGING
}
pub fn pipe_image_view(

View File

@@ -81,7 +81,7 @@ impl ResourceType {
fn apply(&self, tmpl: &mut pipe_resource, screen: &PipeScreen) {
match self {
Self::Staging => {
tmpl.set_usage(pipe_resource_usage::PIPE_USAGE_STAGING.0);
tmpl.set_usage(pipe_resource_usage::PIPE_USAGE_STAGING);
tmpl.flags |= PIPE_RESOURCE_FLAG_MAP_PERSISTENT | PIPE_RESOURCE_FLAG_MAP_COHERENT;
tmpl.bind |= PIPE_BIND_LINEAR;
}

View File

@@ -581,7 +581,7 @@ struct pipe_resource
unsigned compression_rate:4; /**< Fixed-rate compresion bitrate if any */
unsigned usage:4; /**< PIPE_USAGE_x (not a bitmask) */
enum pipe_resource_usage usage:4;
unsigned bind; /**< bitmask of PIPE_BIND_x */
unsigned flags; /**< bitmask of PIPE_RESOURCE_FLAG_x */