Skip to content

Commit

Permalink
missing const on API struct pointer members
Browse files Browse the repository at this point in the history
  • Loading branch information
Amar Patel (GRAPHICS) committed Mar 13, 2024
1 parent 4fc6075 commit 41d9b76
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions d3d/WorkGraphs.md
Original file line number Diff line number Diff line change
Expand Up @@ -3443,7 +3443,7 @@ typedef struct D3D12_NODE_CPU_INPUT
{
UINT EntrypointIndex;
UINT NumRecords;
void* pRecords;
const void* pRecords;
UINT64 RecordStrideInBytes;
} D3D12_NODE_CPU_INPUT;
```
Expand All @@ -3452,7 +3452,7 @@ Member | Definition
--------- | ----------
`UINT EntrypointIndex` | Provides index of a given entry to a work graph. See the [GetEntrypointIndex](#getentrypointindex) API.
`UINT NumRecords` | Number of records to add. `NumRecords` is always used - even with empty records the count of empty work items still drives node invocations.
`void* pRecords` | Record definitions, laid out with the same member packing and struct size rules that C uses. If the target node's [input declaration](#node-input-declaration) declares an empty node input, or there is no input declaration (an alternate mode of empty node input), this parameter is ignored by the system and can be set to NULL if desired. The data is copied/saved by the driver at the [DispatchGraph()](#dispatchgraph) call during command-list recording. So immediately after the [DispatchGraph()](#dispatchgraph) call returns on the CPU timeline, the data pointed to is no longer referenced by the system and the caller has free ownership of the memory again. The address must be aligned to the largest scalar member size and be a multiple of 4 bytes. The alignment requirement for a given entrypoint can be queried by [GetEntrypointRecordAlignmentInBytes()](#getentrypointrecordalignmentinbytes).
`const void* pRecords` | Record definitions, laid out with the same member packing and struct size rules that C uses. If the target node's [input declaration](#node-input-declaration) declares an empty node input, or there is no input declaration (an alternate mode of empty node input), this parameter is ignored by the system and can be set to NULL if desired. The data is copied/saved by the driver at the [DispatchGraph()](#dispatchgraph) call during command-list recording. So immediately after the [DispatchGraph()](#dispatchgraph) call returns on the CPU timeline, the data pointed to is no longer referenced by the system and the caller has free ownership of the memory again. The address must be aligned to the largest scalar member size and be a multiple of 4 bytes. The alignment requirement for a given entrypoint can be queried by [GetEntrypointRecordAlignmentInBytes()](#getentrypointrecordalignmentinbytes).
`UINT64 RecordStrideInBytes` | Distance between the start of each record in bytes. If the target node's [input declaration](#node-input-declaration) declares an empty node input, or there is no input declaration (an alternate mode of empty node input), this parameter is ignored by the system and can be set to NULL if desired. This doesn't need to be 64 bits, but this way the struct matches with the layout of the GPU version below, in case there is ever a world where CPU and GPU can share pointers. `RecordStrideInBytes` can be 0 to replicate a single record, and if it is nonzero, it must be at least as big as the entrypoint's input record size, which can be retrieved via [GetEntrypointRecordSizeInBytes()](#getentrypointrecordsizeinbytes) for convenience. Stride must be aligned to the largest scalar member size and be a multiple of 4 bytes. The alignment requirement for a given entrypoint can be queried by [GetEntrypointRecordAlignmentInBytes()](#getentrypointrecordalignmentinbytes).

Referenced by [D3D12_DISPATCH_GRAPH_DESC](#d3d12_dispatch_graph_desc).
Expand Down Expand Up @@ -3492,7 +3492,7 @@ This allows batching of inputs to multiple nodes from CPU memory, copied into th
typedef struct D3D12_MULTI_NODE_CPU_INPUT
{
UINT NumNodeInputs;
D3D12_NODE_CPU_INPUT* pNodeInputs;
const D3D12_NODE_CPU_INPUT* pNodeInputs;
UINT64 NodeInputStrideInBytes;
} D3D12_MULTI_NODE_CPU_INPUT;

Expand All @@ -3501,7 +3501,7 @@ typedef struct D3D12_MULTI_NODE_CPU_INPUT
Member | Definition
--------- | ----------
`UINT NumNodeInputs` | Number of entries in the array `pNodeInputs`.
`D3D12_NODE_CPU_INPUT* pNodeInputs` | Array of [D3D12_NODE_CPU_INPUT](#d3d12_node_cpu_input). Address must be `8` byte aligned.
`const D3D12_NODE_CPU_INPUT* pNodeInputs` | Array of [D3D12_NODE_CPU_INPUT](#d3d12_node_cpu_input). Address must be `8` byte aligned.
`UINT64 NodeInputStrideInBytes` | Distance between `D3D12_NODE_CPU_INPUT` structs pointed to by pNodeInputs. Stride can be 0 to replicate the input, otherwise the stride must be at least as large as `D3D12_NODE_CPU_INPUT`. Stride must be `8` byte aligned. This field doesn't need to be 64 bits, but this way the struct matches with the layout of the GPU version below, in case there is ever a world where CPU and GPU can share pointers.

Referenced by [D3D12_DISPATCH_GRAPH_DESC](#d3d12_dispatch_graph_desc).
Expand Down Expand Up @@ -5478,7 +5478,7 @@ typedef struct D3D12DDI_NODE_CPU_INPUT_0108
{
UINT EntrypointIndex;
UINT NumRecords;
void* pRecords;
const void* pRecords;
UINT64 RecordStrideInBytes;
} D3D12DDI_NODE_CPU_INPUT_0108;
```
Expand Down Expand Up @@ -5512,7 +5512,7 @@ At API see [D3D12_NODE_GPU_INPUT](#d3d12_node_gpu_input).
typedef struct D3D12DDI_MULTI_NODE_CPU_INPUT_0108
{
UINT NumNodeInputs;
D3D12DDI_NODE_CPU_INPUT_0108* pNodeInputs;
const D3D12DDI_NODE_CPU_INPUT_0108* pNodeInputs;
UINT64 NodeInputStrideInBytes;
} D3D12DDI_MULTI_NODE_CPU_INPUT_0108;
```
Expand Down Expand Up @@ -6526,4 +6526,4 @@ v0.53|2/22/2024|<li>Cleared out mentions of June 2023 preview ahead of official
v0.54|3/1/2024|<li>Now that DXC reports record alignment to the runtime based on the member sizes, added a [GetEntrypointRecordAlignmentInBytes()](#getentrypointrecordalignmentinbytes) method to help apps understand the record alignment rules, as applied to a given entry point's struct definition. No driver impact from this new API. This is a complement to the exisiting [GetEntrypointRecordSizeInBytes()](#getentrypointrecordsizeinbytes) API.</li><li>Cleaned up the entry record size and alignemnt requirements in [D3D12_NODE_CPU_INPUT](#d3d12_node_cpu_input) and [D3D12_NODE_GPU_INPUT](#d3d12_node_gpu_input) such that they are aligned to largest scalar member size and must be a multiple of 4. The previous definition would have allowed a struct of size 6 bytes to have a stride of 6. To be safe, bumping that to 8. This is reflected in the above mentioned APIs.</li><li>In [D3D12_STATE_SUBOBJECT_TYPE](#d3d12_state_object_type), the contents of the subobject `D3D12_SATE_SUBOBJECT_TYPE_RASTERIZER` were incorrectly stated as `D3D12_RASTERIZER_DESC`. Corrected this to be the latest version of this desc, `D3D12_RASTERIZER_DESC2`, which is what the runtime was already assuming and passing to the driver. Correspondingly updated the section describing defaults for missing subobjects to define the correct struct type in [Missing RASTERIZER](#missing-rasterizer), where `MultisampleEnable` isn't a member, it is `LineRasterizationMode` instead, defaulting to `D3D12_LINE_RASTERIZATION_MODE_ALIASED`.</li>
v0.55|3/9/2024|<li>Added [Helping mesh nodes work better on some hardware](#helping-mesh-nodes-work-better-on-some-hardware). Plus a few related sections linked from there. This is relevant to experimental mesh nodes prototyping, not yet exposed.</li><li>Minor fixup: Under [Supported shader targets](#supported-shader-targets) for generic programs, there was a TBD on what DXC version would be required to compile non-lib shaders such as vs_* / ps_* targets and have the runtime be able to know the name of the function (so the app isn't forced to give it a name to use it in a generic program). Updated the TBD to DXC version 1.8, the compiler launched alongside the runtime with generic programs support.</li>
v1.000|3/11/2023|<li>Bumping version to 1.000 for official release.</li>
v1.001|3/13/2024|<li>Fixed broken wording in experimental [Mesh nodes](#mesh-nodes) section. Made it more clear that a shader of node launch "mesh" is basically a hybrid of a broadcasting launch shader and a mesh shader. One point in particular that needed cleaning up is that dispatch grid (fixed or dynamic) works just like with broadcasting launch wrt `SV_DispatchGrid` in record, `[NodeMaxDispatchGrid()]` vs `[NodeDispatchGrid()]` options.</li>
v1.001|3/13/2024|<li>Fixed broken wording in experimental [Mesh nodes](#mesh-nodes) section. Made it more clear that a shader of node launch "mesh" is basically a hybrid of a broadcasting launch shader and a mesh shader. One point in particular that needed cleaning up is that dispatch grid (fixed or dynamic) works just like with broadcasting launch wrt `SV_DispatchGrid` in record, `[NodeMaxDispatchGrid()]` vs `[NodeDispatchGrid()]` options.</li><li>Missing const on pointer members of [D3D12_NODE_CPU_INPUT](#d3d12_node_cpu_input) and [D3D12_MULTI_NODE_CPU_INPUT](#d3d12_multi_node_cpu_input). Released headers don't have this fixed yet - will be include at next chance for an update.</li>

0 comments on commit 41d9b76

Please sign in to comment.