Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bindless] Struct for unique addressing modes per dimension #863

Merged
merged 1 commit into from
Sep 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions include/ur.py
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,7 @@ class ur_structure_type_v(IntEnum):
EXP_FILE_DESCRIPTOR = 0x2003 ## ::ur_exp_file_descriptor_t
EXP_WIN32_HANDLE = 0x2004 ## ::ur_exp_win32_handle_t
EXP_LAYERED_IMAGE_PROPERTIES = 0x2005 ## ::ur_exp_layered_image_properties_t
EXP_SAMPLER_ADDR_MODES = 0x2006 ## ::ur_exp_sampler_addr_modes_t

class ur_structure_type_t(c_int):
def __str__(self):
Expand Down Expand Up @@ -2216,6 +2217,22 @@ class ur_exp_sampler_mip_properties_t(Structure):
("mipFilterMode", ur_sampler_filter_mode_t) ## [in] mipmap filter mode used for filtering between mipmap levels
]

###############################################################################
## @brief Describes unique sampler addressing mode per dimension
##
## @details
## - Specify these properties in ::urSamplerCreate via ::ur_sampler_desc_t
## as part of a `pNext` chain.
class ur_exp_sampler_addr_modes_t(Structure):
_fields_ = [
("stype", ur_structure_type_t), ## [in] type of this structure, must be
## ::UR_STRUCTURE_TYPE_EXP_SAMPLER_ADDR_MODES
("pNext", c_void_p), ## [in,out][optional] pointer to extension-specific structure
("addrModeX", ur_sampler_addressing_mode_t), ## [in] Specify the addressing mode of the x-dimension.
("addrModeY", ur_sampler_addressing_mode_t), ## [in] Specify the addressing mode of the y-dimension.
("addrModeZ", ur_sampler_addressing_mode_t) ## [in] Specify the addressing mode of the z-dimension.
]

###############################################################################
## @brief Describes an interop memory resource descriptor
class ur_exp_interop_mem_desc_t(Structure):
Expand Down
17 changes: 17 additions & 0 deletions include/ur_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,7 @@ typedef enum ur_structure_type_t {
UR_STRUCTURE_TYPE_EXP_FILE_DESCRIPTOR = 0x2003, ///< ::ur_exp_file_descriptor_t
UR_STRUCTURE_TYPE_EXP_WIN32_HANDLE = 0x2004, ///< ::ur_exp_win32_handle_t
UR_STRUCTURE_TYPE_EXP_LAYERED_IMAGE_PROPERTIES = 0x2005, ///< ::ur_exp_layered_image_properties_t
UR_STRUCTURE_TYPE_EXP_SAMPLER_ADDR_MODES = 0x2006, ///< ::ur_exp_sampler_addr_modes_t
/// @cond
UR_STRUCTURE_TYPE_FORCE_UINT32 = 0x7fffffff
/// @endcond
Expand Down Expand Up @@ -7037,6 +7038,22 @@ typedef struct ur_exp_sampler_mip_properties_t {

} ur_exp_sampler_mip_properties_t;

///////////////////////////////////////////////////////////////////////////////
/// @brief Describes unique sampler addressing mode per dimension
///
/// @details
/// - Specify these properties in ::urSamplerCreate via ::ur_sampler_desc_t
/// as part of a `pNext` chain.
typedef struct ur_exp_sampler_addr_modes_t {
ur_structure_type_t stype; ///< [in] type of this structure, must be
///< ::UR_STRUCTURE_TYPE_EXP_SAMPLER_ADDR_MODES
void *pNext; ///< [in,out][optional] pointer to extension-specific structure
ur_sampler_addressing_mode_t addrModeX; ///< [in] Specify the addressing mode of the x-dimension.
ur_sampler_addressing_mode_t addrModeY; ///< [in] Specify the addressing mode of the y-dimension.
ur_sampler_addressing_mode_t addrModeZ; ///< [in] Specify the addressing mode of the z-dimension.

} ur_exp_sampler_addr_modes_t;

///////////////////////////////////////////////////////////////////////////////
/// @brief Describes an interop memory resource descriptor
typedef struct ur_exp_interop_mem_desc_t {
Expand Down
4 changes: 4 additions & 0 deletions scripts/core/EXP-BINDLESS-IMAGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ Enums
${X}_STRUCTURE_TYPE_EXP_FILE_DESCRIPTOR
${X}_STRUCTURE_TYPE_EXP_WIN32_HANDLE
${X}_STRUCTURE_TYPE_EXP_LAYERED_IMAGE_PROPERTIES
${X}_STRUCTURE_TYPE_EXP_SAMPLER_ADDR_MODES

* ${x}_device_info_t
* ${X}_DEVICE_INFO_BINDLESS_IMAGES_SUPPORT_EXP
Expand Down Expand Up @@ -129,6 +130,7 @@ Types
* ${x}_exp_file_descriptor_t
* ${x}_exp_win32_handle_t
* ${x}_exp_layered_image_properties_t
* ${x}_exp_sampler_addr_modes_t

Functions
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand Down Expand Up @@ -180,6 +182,8 @@ Changelog
+----------+-------------------------------------------------------------+
| 7.0 | Add layered image properties struct. |
+----------+-------------------------------------------------------------+
| 8.0 | Added structure for sampler addressing modes per dimension. |
+------------------------------------------------------------------------+

Contributors
--------------------------------------------------------------------------------
Expand Down
22 changes: 22 additions & 0 deletions scripts/core/exp-bindless-images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,9 @@ etors:
- name: EXP_LAYERED_IMAGE_PROPERTIES
desc: $x_exp_layered_image_properties_t
value: "0x2005"
- name: EXP_SAMPLER_ADDR_MODES
desc: $x_exp_sampler_addr_modes_t
value: "0x2006"
--- #--------------------------------------------------------------------------
type: enum
extend: true
Expand Down Expand Up @@ -176,6 +179,25 @@ members:
desc: "[in] mipmap filter mode used for filtering between mipmap levels"
--- #--------------------------------------------------------------------------
type: struct
desc: "Describes unique sampler addressing mode per dimension"
details:
- Specify these properties in $xSamplerCreate via $x_sampler_desc_t as part
of a `pNext` chain.
class: $xBindlessImages
name: $x_exp_sampler_addr_modes_t
base: $x_base_properties_t
members:
- type: $x_sampler_addressing_mode_t
name: addrModeX
desc: "[in] Specify the addressing mode of the x-dimension."
- type: $x_sampler_addressing_mode_t
name: addrModeY
desc: "[in] Specify the addressing mode of the y-dimension."
- type: $x_sampler_addressing_mode_t
name: addrModeZ
desc: "[in] Specify the addressing mode of the z-dimension."
--- #--------------------------------------------------------------------------
type: struct
desc: "Describes an interop memory resource descriptor"
class: $xBindlessImages
name: $x_exp_interop_mem_desc_t
Expand Down
43 changes: 43 additions & 0 deletions source/common/ur_params.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -432,6 +432,8 @@ inline std::ostream &operator<<(std::ostream &os,
inline std::ostream &
operator<<(std::ostream &os,
const struct ur_exp_sampler_mip_properties_t params);
inline std::ostream &
operator<<(std::ostream &os, const struct ur_exp_sampler_addr_modes_t params);
inline std::ostream &operator<<(std::ostream &os,
const struct ur_exp_interop_mem_desc_t params);
inline std::ostream &
Expand Down Expand Up @@ -1333,6 +1335,10 @@ inline std::ostream &operator<<(std::ostream &os,
case UR_STRUCTURE_TYPE_EXP_LAYERED_IMAGE_PROPERTIES:
os << "UR_STRUCTURE_TYPE_EXP_LAYERED_IMAGE_PROPERTIES";
break;

case UR_STRUCTURE_TYPE_EXP_SAMPLER_ADDR_MODES:
os << "UR_STRUCTURE_TYPE_EXP_SAMPLER_ADDR_MODES";
break;
default:
os << "unknown enumerator";
break;
Expand Down Expand Up @@ -1587,6 +1593,12 @@ inline void serializeStruct(std::ostream &os, const void *ptr) {
(const ur_exp_layered_image_properties_t *)ptr;
ur_params::serializePtr(os, pstruct);
} break;

case UR_STRUCTURE_TYPE_EXP_SAMPLER_ADDR_MODES: {
const ur_exp_sampler_addr_modes_t *pstruct =
(const ur_exp_sampler_addr_modes_t *)ptr;
ur_params::serializePtr(os, pstruct);
} break;
default:
os << "unknown enumerator";
break;
Expand Down Expand Up @@ -9879,6 +9891,37 @@ operator<<(std::ostream &os,
os << "}";
return os;
}
inline std::ostream &
operator<<(std::ostream &os, const struct ur_exp_sampler_addr_modes_t params) {
os << "(struct ur_exp_sampler_addr_modes_t){";

os << ".stype = ";

os << (params.stype);

os << ", ";
os << ".pNext = ";

ur_params::serializeStruct(os, (params.pNext));

os << ", ";
os << ".addrModeX = ";

os << (params.addrModeX);

os << ", ";
os << ".addrModeY = ";

os << (params.addrModeY);

os << ", ";
os << ".addrModeZ = ";

os << (params.addrModeZ);

os << "}";
return os;
}
inline std::ostream &operator<<(std::ostream &os,
const struct ur_exp_interop_mem_desc_t params) {
os << "(struct ur_exp_interop_mem_desc_t){";
Expand Down