mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-22 02:00:22 +01:00
rusticl: specify buffer bindings explicitly
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25946>
This commit is contained in:
parent
77f4f3112d
commit
a4f47ba52c
5 changed files with 21 additions and 10 deletions
|
|
@ -9,7 +9,7 @@ use crate::impl_cl_type_trait;
|
|||
|
||||
use mesa_rust::pipe::resource::*;
|
||||
use mesa_rust::pipe::screen::ResourceType;
|
||||
use mesa_rust_gen::pipe_format;
|
||||
use mesa_rust_gen::*;
|
||||
use mesa_rust_util::properties::Properties;
|
||||
use rusticl_opencl_gen::*;
|
||||
|
||||
|
|
@ -62,13 +62,17 @@ impl Context {
|
|||
let mut resource = None;
|
||||
|
||||
if !user_ptr.is_null() && !copy {
|
||||
resource = dev
|
||||
.screen()
|
||||
.resource_create_buffer_from_user(adj_size, user_ptr)
|
||||
resource = dev.screen().resource_create_buffer_from_user(
|
||||
adj_size,
|
||||
user_ptr,
|
||||
PIPE_BIND_GLOBAL,
|
||||
)
|
||||
}
|
||||
|
||||
if resource.is_none() {
|
||||
resource = dev.screen().resource_create_buffer(adj_size, res_type)
|
||||
resource = dev
|
||||
.screen()
|
||||
.resource_create_buffer(adj_size, res_type, PIPE_BIND_GLOBAL)
|
||||
}
|
||||
|
||||
let resource = resource.ok_or(CL_OUT_OF_RESOURCES);
|
||||
|
|
|
|||
|
|
@ -1011,7 +1011,11 @@ impl Kernel {
|
|||
let buf = Arc::new(
|
||||
q.device
|
||||
.screen
|
||||
.resource_create_buffer(printf_size, ResourceType::Staging)
|
||||
.resource_create_buffer(
|
||||
printf_size,
|
||||
ResourceType::Staging,
|
||||
PIPE_BIND_GLOBAL,
|
||||
)
|
||||
.unwrap(),
|
||||
);
|
||||
|
||||
|
|
|
|||
|
|
@ -584,7 +584,7 @@ impl Mem {
|
|||
} else {
|
||||
let shadow = dev
|
||||
.screen()
|
||||
.resource_create_buffer(size as u32, ResourceType::Staging)
|
||||
.resource_create_buffer(size as u32, ResourceType::Staging, 0)
|
||||
.ok_or(CL_OUT_OF_RESOURCES)?;
|
||||
let tx = ctx
|
||||
.buffer_map_coherent(&shadow, 0, size, rw)
|
||||
|
|
|
|||
|
|
@ -112,9 +112,10 @@ impl NirKernelBuild {
|
|||
let len = buf.len() as u32;
|
||||
|
||||
if len > 0 {
|
||||
// TODO bind as constant buffer
|
||||
let res = dev
|
||||
.screen()
|
||||
.resource_create_buffer(len, ResourceType::Normal)
|
||||
.resource_create_buffer(len, ResourceType::Normal, PIPE_BIND_GLOBAL)
|
||||
.unwrap();
|
||||
|
||||
dev.helper_ctx()
|
||||
|
|
|
|||
|
|
@ -135,6 +135,7 @@ impl PipeScreen {
|
|||
&self,
|
||||
size: u32,
|
||||
res_type: ResourceType,
|
||||
pipe_bind: u32,
|
||||
) -> Option<PipeResource> {
|
||||
let mut tmpl = pipe_resource::default();
|
||||
|
||||
|
|
@ -143,7 +144,7 @@ impl PipeScreen {
|
|||
tmpl.height0 = 1;
|
||||
tmpl.depth0 = 1;
|
||||
tmpl.array_size = 1;
|
||||
tmpl.bind = PIPE_BIND_GLOBAL;
|
||||
tmpl.bind = pipe_bind;
|
||||
|
||||
res_type.apply(&mut tmpl);
|
||||
|
||||
|
|
@ -154,6 +155,7 @@ impl PipeScreen {
|
|||
&self,
|
||||
size: u32,
|
||||
mem: *mut c_void,
|
||||
pipe_bind: u32,
|
||||
) -> Option<PipeResource> {
|
||||
let mut tmpl = pipe_resource::default();
|
||||
|
||||
|
|
@ -162,7 +164,7 @@ impl PipeScreen {
|
|||
tmpl.height0 = 1;
|
||||
tmpl.depth0 = 1;
|
||||
tmpl.array_size = 1;
|
||||
tmpl.bind = PIPE_BIND_GLOBAL;
|
||||
tmpl.bind = pipe_bind;
|
||||
|
||||
self.resource_create_from_user(&tmpl, mem)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue