mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-02-02 13:10:25 +01:00
rusticl/mem: relax flags validation for clGetSupportedImageFormats
While the API spec does describe which flags _may_ be passed in, the
overall CL working group agreement is, that implementations should expect
random flags to be passed in as other implementations _may_ use them to
further restrict or allow image formats.
Also fix validation for importing GL objects while at it.
Cc: mesa-stable
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36216>
(cherry picked from commit d8793e3874)
This commit is contained in:
parent
33cbbc27a7
commit
7a4dd7ac7e
2 changed files with 5 additions and 5 deletions
|
|
@ -5614,7 +5614,7 @@
|
|||
"description": "rusticl/mem: relax flags validation for clGetSupportedImageFormats",
|
||||
"nominated": true,
|
||||
"nomination_type": 1,
|
||||
"resolution": 0,
|
||||
"resolution": 1,
|
||||
"main_sha": null,
|
||||
"because_sha": null,
|
||||
"notes": null
|
||||
|
|
|
|||
|
|
@ -28,12 +28,12 @@ use std::os::raw::c_void;
|
|||
use std::ptr;
|
||||
use std::sync::Arc;
|
||||
|
||||
fn validate_mem_flags(flags: cl_mem_flags, images: bool) -> CLResult<()> {
|
||||
fn validate_mem_flags(flags: cl_mem_flags, import: bool) -> CLResult<()> {
|
||||
let mut valid_flags = cl_bitfield::from(
|
||||
CL_MEM_READ_WRITE | CL_MEM_WRITE_ONLY | CL_MEM_READ_ONLY | CL_MEM_KERNEL_READ_AND_WRITE,
|
||||
);
|
||||
|
||||
if !images {
|
||||
if !import {
|
||||
valid_flags |= cl_bitfield::from(
|
||||
CL_MEM_USE_HOST_PTR
|
||||
| CL_MEM_ALLOC_HOST_PTR
|
||||
|
|
@ -889,7 +889,7 @@ fn get_supported_image_formats(
|
|||
let c = Context::ref_from_raw(context)?;
|
||||
|
||||
// CL_INVALID_VALUE if flags
|
||||
validate_mem_flags(flags, true)?;
|
||||
validate_mem_flags(flags, false)?;
|
||||
|
||||
// or image_type are not valid
|
||||
if !image_type_valid(image_type) {
|
||||
|
|
@ -3068,7 +3068,7 @@ fn create_from_gl(
|
|||
|
||||
// CL_INVALID_VALUE if values specified in flags are not valid or if value specified in
|
||||
// texture_target is not one of the values specified in the description of texture_target.
|
||||
validate_mem_flags(flags, target == GL_ARRAY_BUFFER)?;
|
||||
validate_mem_flags(flags, true)?;
|
||||
|
||||
// CL_INVALID_MIP_LEVEL if miplevel is greather than zero and the OpenGL
|
||||
// implementation does not support creating from non-zero mipmap levels.
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue