mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-06 13:48:06 +02:00
rusticl: fix flag validation when creating an image
From the OpenCL specification:
`CL_MEM_KERNEL_READ_AND_WRITE`: This flag is only used by
clGetSupportedImageFormats to query image formats that may be both
read from and written to by the same kernel instance. To create a
memory object that may be read from and written to use
CL_MEM_READ_WRITE.
If an application follows the instructions above, i.e. query a list of
supported image formats, using `CL_MEM_KERNEL_READ_AND_WRITE` as
input, and then attempts to create an image using one of the supported
image formats, by calling `clCreateImage` and passing
`CL_MEM_READ_WRITE`, the call to the image creation entry point should
succeed. This instead fails on Mali devices with the error
`CL_IMAGE_FORMAT_NOT_SUPPORTED`.
Rusticl fails when validating the image format against its supported
flags. Formats that support `PIPE_BIND_SHADER_IMAGE` have their
supported flags set as `CL_MEM_WRITE_ONLY` and
`CL_MEM_KERNEL_READ_AND_WRITE`.
This changes the supported CL flags to be `CL_MEM_WRITE_ONLY` for
`PIPE_BIND_SHADER_IMAGE` and `CL_MEM_READ_WRTE |
CL_MEM_KERNEL_READ_AND_WRITE` for `PIPE_BIND_SAMPLER_VIEW |
PIPE_BIND_SHADER_IMAGE`.
Fixes: 3386e142 (rusticl: support read_write images)
Fixes OpenCL-CTS test: `test_image_streams` on Mali. Invocation:
```
test_image_streams write 1D CL_RGB CL_SIGNED_INT8
```
Signed-off-by: Ahmed Hesham <ahmed.hesham@arm.com>
(cherry picked from commit e77c984cef)
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40979>
This commit is contained in:
parent
46aea87a79
commit
e145579956
2 changed files with 3 additions and 3 deletions
|
|
@ -5104,7 +5104,7 @@
|
|||
"description": "rusticl: fix flag validation when creating an image",
|
||||
"nominated": true,
|
||||
"nomination_type": 2,
|
||||
"resolution": 0,
|
||||
"resolution": 1,
|
||||
"main_sha": null,
|
||||
"because_sha": "3386e1425f1c4fa52c8fae9511f6c31d2713dac8",
|
||||
"notes": null
|
||||
|
|
|
|||
|
|
@ -297,7 +297,7 @@ impl DeviceBase {
|
|||
PIPE_BIND_SHADER_IMAGE,
|
||||
)
|
||||
{
|
||||
flags |= CL_MEM_WRITE_ONLY | CL_MEM_KERNEL_READ_AND_WRITE;
|
||||
flags |= CL_MEM_WRITE_ONLY;
|
||||
}
|
||||
|
||||
// TODO: cl_khr_srgb_image_writes
|
||||
|
|
@ -308,7 +308,7 @@ impl DeviceBase {
|
|||
PIPE_BIND_SAMPLER_VIEW | PIPE_BIND_SHADER_IMAGE,
|
||||
)
|
||||
{
|
||||
flags |= CL_MEM_READ_WRITE;
|
||||
flags |= CL_MEM_READ_WRITE | CL_MEM_KERNEL_READ_AND_WRITE;
|
||||
}
|
||||
|
||||
fs.insert(t, flags as cl_mem_flags);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue