mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2025-09-12 18:50:22 -07:00
vkd3d-utils: Null-terminate the output of D3DDisassemble().
This commit is contained in:
committed by
Henri Verbeet
parent
df1c94dd60
commit
f52dc8a89a
Notes:
Henri Verbeet
2025-09-10 12:03:47 +02:00
Approved-by: Henri Verbeet (@hverbeet) Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/1697
@@ -1034,7 +1034,9 @@ HRESULT WINAPI D3DDisassemble(const void *data, SIZE_T data_size,
|
||||
return hresult_from_vkd3d_result(ret);
|
||||
}
|
||||
|
||||
if (FAILED(hr = vkd3d_blob_create((void *)output.code, output.size, blob)))
|
||||
/* vkd3d-shader output is null-terminated, but the null terminator isn't
|
||||
* included in the size. Increase the size to account for that. */
|
||||
if (FAILED(hr = vkd3d_blob_create((void *)output.code, output.size + 1, blob)))
|
||||
vkd3d_shader_free_shader_code(&output);
|
||||
|
||||
return hr;
|
||||
|
@@ -3495,9 +3495,9 @@ static void test_disassemble_shader(void)
|
||||
ok(hr == S_OK, "Got hr %#x.\n", hr);
|
||||
code = ID3D10Blob_GetBufferPointer(blob);
|
||||
size = ID3D10Blob_GetBufferSize(blob);
|
||||
todo ok(size == strlen(code) + 1, "Expected size %u, got %u.\n",
|
||||
ok(size == strlen(code) + 1, "Expected size %u, got %u.\n",
|
||||
(unsigned int)strlen(code) + 1, (unsigned int)size);
|
||||
todo ok(code[size - 1] == 0, "Expected null termination, got %#x.\n", code[size - 1]);
|
||||
ok(code[size - 1] == 0, "Expected null termination, got %#x.\n", code[size - 1]);
|
||||
ID3D10Blob_Release(blob);
|
||||
|
||||
hr = D3DDisassemble(vs_3_0, sizeof(vs_3_0), 0, NULL, &blob);
|
||||
@@ -3513,9 +3513,9 @@ static void test_disassemble_shader(void)
|
||||
ok(hr == S_OK, "Got hr %#x.\n", hr);
|
||||
code = ID3D10Blob_GetBufferPointer(blob);
|
||||
size = ID3D10Blob_GetBufferSize(blob);
|
||||
todo ok(size == strlen(code) + 1, "Expected size %u, got %u.\n",
|
||||
ok(size == strlen(code) + 1, "Expected size %u, got %u.\n",
|
||||
(unsigned int)strlen(code) + 1, (unsigned int)size);
|
||||
todo ok(code[size - 1] == 0, "Expected null termination, got %#x.\n", code[size - 1]);
|
||||
ok(code[size - 1] == 0, "Expected null termination, got %#x.\n", code[size - 1]);
|
||||
ID3D10Blob_Release(blob);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user