Skip to content

Commit 338f0f8

Browse files
docs: update platform documentation to match code style and naming conventions
Co-authored-by: aider (anthropic/claude-sonnet-4-20250514) <aider@aider.chat>
1 parent 8c3e74e commit 338f0f8

File tree

1 file changed

+18
-18
lines changed

1 file changed

+18
-18
lines changed

docs/platform.md

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
### Description
44
The `get_ids` function queries the list of available OpenCL platforms and returns the number of platforms and their IDs. This is a crucial step in setting up an OpenCL context, as it allows the application to identify and select a specific platform to use.
55
```zig
6-
pub inline fn get_ids(platforms: ?[]cl_platform_id, num_platforms: ?*u32) errors.opencl_error!void;
6+
pub fn getIds(platforms: ?[]PlatformId, num_platforms: ?*u32) OpenCLError!void;
77
```
88
#### Parameters
99

10-
- `platforms`: A pointer to an array of `cl_platform_id` where the function will store the IDs of the available OpenCL platforms. If `platforms` is `null`, the function will not store the platform IDs, but it will still return the number of available platforms through `num_platforms`.
10+
- `platforms`: A pointer to an array of `PlatformId` where the function will store the IDs of the available OpenCL platforms. If `platforms` is `null`, the function will not store the platform IDs, but it will still return the number of available platforms through `num_platforms`.
1111
- `num_platforms`: A pointer to a `u32` variable where the function will store the number of available OpenCL platforms. If `num_platforms` is `null`, this argument is ignored.
1212

1313
#### Error Handling
@@ -23,25 +23,25 @@ The function uses Zig's error handling features to manage potential OpenCL error
2323

2424
The `get_info` function retrieves specific information about an OpenCL platform. This function is essential for obtaining various details about the platform, such as its name, profile, version, and other attributes.
2525
```zig
26-
pub inline fn get_info(
27-
platform: cl_platform_id,
28-
param_name: enums.platform_info,
29-
param_value_size: usize,
30-
param_value: ?*anyopaque,
31-
param_value_size_ret: ?*usize
32-
) errors.opencl_error!void;
26+
pub fn getInfo(
27+
platform: PlatformId,
28+
param_name: Info,
29+
param_value_size: usize,
30+
param_value: ?*anyopaque,
31+
param_value_size_ret: ?*usize,
32+
) OpenCLError!void;
3333
```
3434
#### Parameters
3535

36-
- `platform`: The `cl_platform_id` for which the information is being queried.
37-
- `param_name`: An enumeration constant that identifies the platform information being queried. This is a member of the `platform.enums.platform_info` namespace, which contains various attributes related to the platform. For example:
36+
- `platform`: The `PlatformId` for which the information is being queried.
37+
- `param_name`: An enumeration constant that identifies the platform information being queried. This is a member of the `Info` enum, which contains various attributes related to the platform. For example:
3838
- `CL_PLATFORM_PROFILE` -> `profile`
3939
- `CL_PLATFORM_NAME` -> `name`
4040
- `param_value_size`: Specifies the size in bytes of memory pointed to by `param_value`.
4141
- `param_value`: A pointer to the memory location where the appropriate values for the given `param_name` will be returned. If `param_value` is `null`, it is ignored.
4242
- `param_value_size_ret`: Returns the actual size in bytes of data being queried by `param_name`. If `param_value_size_ret` is `null`, it is ignored.
4343

44-
For a full list of the enum members, refer to the OpenCL PDF documentation or the `src/enums/platform.zig` file where the enums are defined.
44+
For a full list of the enum members, refer to the OpenCL PDF documentation or the `src/platform.zig` file where the enums are defined.
4545

4646
#### Error Handling
4747

@@ -57,27 +57,27 @@ The function uses Zig's error handling features to manage potential OpenCL error
5757

5858
The `get_all` function retrieves a list of all available OpenCL platforms and their associated data. This function simplifies the process of obtaining detailed information about each platform.
5959
```zig
60-
pub fn get_all(allocator: std.mem.Allocator) ![]platform_info;
60+
pub fn getAll(allocator: std.mem.Allocator) ![]Details;
6161
```
6262
#### Parameters
6363

6464
- `allocator`: An instance of `std.mem.Allocator` used to allocate memory for the platform information structures.
6565

6666
#### Return Value
67-
- Returns a slice of `platform_info` structures, each containing detailed information about an OpenCL platform, including its `id`, `profile`, `version`, `name`, `vendor`, and `extensions`.
67+
- Returns a slice of `Details` structures, each containing detailed information about an OpenCL platform, including its `id`, `profile`, `version`, `name`, `vendor`, and `extensions`.
6868

6969
## Releasing Platform List
7070

7171
### Description
7272

7373
The `release_list` function releases the memory allocated for the list of platform information structures.
7474
```zig
75-
pub fn release_list(allocator: std.mem.Allocator, platform_infos: []platform_info) void;
75+
pub fn releaseList(allocator: std.mem.Allocator, platform_infos: []Details) void;
7676
```
7777
#### Parameters
7878

7979
- `allocator`: An instance of `std.mem.Allocator` used to deallocate memory for the platform information structures.
80-
- `platform_infos`: A slice of `platform_info` structures that were previously allocated by the `get_all` function.
80+
- `platform_infos`: A slice of `Details` structures that were previously allocated by the `getAll` function.
8181

8282
#### Example Usage
8383

@@ -88,7 +88,7 @@ const cl = @import("opencl");
8888
8989
const allocator = std.heap.page_allocator;
9090
91-
const platform_infos = try cl.platform.get_all(allocator);
92-
defer release_list(allocator, platform_infos);
91+
const platform_infos = try cl.platform.getAll(allocator);
92+
defer releaseList(allocator, platform_infos);
9393
// Use the platform_infos as needed
9494
```

0 commit comments

Comments
 (0)