d3d10/effect: Store bytecode blob for every shader.

Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Matteo Bruni <mbruni@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Nikolay Sivov 2021-08-30 08:06:37 +03:00 committed by Alexandre Julliard
parent 2b83832fdf
commit 87f099b7dc
3 changed files with 14 additions and 8 deletions

View File

@ -107,6 +107,7 @@ struct d3d10_effect_shader_variable
{
ID3D10ShaderReflection *reflection;
ID3D10Blob *input_signature;
ID3D10Blob *bytecode;
union
{
ID3D10VertexShader *vs;

View File

@ -606,6 +606,11 @@ static HRESULT parse_fx10_shader(const char *data, size_t data_size, DWORD offse
D3DGetInputSignatureBlob(ptr, dxbc_size, &v->u.shader.input_signature);
if (FAILED(hr = D3DCreateBlob(dxbc_size, &v->u.shader.bytecode)))
return hr;
memcpy(ID3D10Blob_GetBufferPointer(v->u.shader.bytecode), ptr, dxbc_size);
if (FAILED(hr = get_fx10_shader_resources(v, ptr, dxbc_size)))
return hr;
@ -2589,6 +2594,8 @@ static void d3d10_effect_shader_variable_destroy(struct d3d10_effect_shader_vari
s->reflection->lpVtbl->Release(s->reflection);
if (s->input_signature)
ID3D10Blob_Release(s->input_signature);
if (s->bytecode)
ID3D10Blob_Release(s->bytecode);
switch (type)
{
@ -6828,6 +6835,11 @@ static HRESULT STDMETHODCALLTYPE d3d10_effect_shader_variable_GetShaderDesc(
if (s->input_signature)
desc->pInputSignature = ID3D10Blob_GetBufferPointer(s->input_signature);
desc->SODecl = s->stream_output_declaration;
if (s->bytecode)
{
desc->pBytecode = ID3D10Blob_GetBufferPointer(s->bytecode);
desc->BytecodeLength = ID3D10Blob_GetBufferSize(s->bytecode);
}
if (s->reflection)
{
if (SUCCEEDED(hr = s->reflection->lpVtbl->GetDesc(s->reflection, &shader_desc)))

View File

@ -5887,10 +5887,8 @@ static void test_effect_optimize(void)
ok(hr == S_OK, "Failed to get shader description, hr %#x.\n", hr);
ok(!!shaderdesc.pInputSignature, "Expected input signature.\n");
ok(!shaderdesc.IsInline, "Unexpected inline flag.\n");
todo_wine {
ok(!!shaderdesc.pBytecode, "Expected bytecode.\n");
ok(!!shaderdesc.BytecodeLength, "Unexpected bytecode length.\n");
}
ok(!strcmp(shaderdesc.SODecl, "SV_POSITION.x"), "Unexpected stream output declaration %s.\n", shaderdesc.SODecl);
ok(!!shaderdesc.NumInputSignatureEntries, "Unexpected input signature count.\n");
ok(!!shaderdesc.NumOutputSignatureEntries, "Unexpected output signature count.\n");
@ -5903,9 +5901,9 @@ todo_wine
ok(hr == S_OK, "Failed to get shader description, hr %#x.\n", hr);
ok(!!shaderdesc.pInputSignature, "Expected input signature.\n");
ok(!shaderdesc.IsInline, "Unexpected inline flag.\n");
todo_wine {
ok(!shaderdesc.pBytecode, "Unexpected bytecode.\n");
ok(!shaderdesc.BytecodeLength, "Unexpected bytecode length.\n");
todo_wine {
ok(!shaderdesc.SODecl, "Unexpected stream output declaration %p.\n", shaderdesc.SODecl);
ok(!shaderdesc.NumInputSignatureEntries, "Unexpected input signature count.\n");
ok(!shaderdesc.NumOutputSignatureEntries, "Unexpected output signature count.\n");
@ -5950,28 +5948,23 @@ static void test_effect_shader_description(void)
ok(!shaderdesc.BytecodeLength, "Unexpected bytecode length %u.\n", shaderdesc.BytecodeLength);
hr = s->lpVtbl->GetShaderDesc(s, 3, &shaderdesc);
ok(hr == S_OK, "Failed to get shader description, hr %#x.\n", hr);
todo_wine
ok(shaderdesc.BytecodeLength == 424, "Unexpected bytecode length %u.\n",
shaderdesc.BytecodeLength);
hr = s->lpVtbl->GetShaderDesc(s, 4, &shaderdesc);
ok(hr == S_OK, "Failed to get shader description, hr %#x.\n", hr);
todo_wine
ok(shaderdesc.BytecodeLength == 424, "Unexpected bytecode length %u.\n",
shaderdesc.BytecodeLength);
hr = s->lpVtbl->GetShaderDesc(s, 5, &shaderdesc);
ok(hr == S_OK, "Failed to get shader description, hr %#x.\n", hr);
todo_wine
ok(shaderdesc.BytecodeLength == 420, "Unexpected bytecode length %u.\n",
shaderdesc.BytecodeLength);
hr = s->lpVtbl->GetShaderDesc(s, 6, &shaderdesc);
ok(hr == S_OK, "Failed to get shader description, hr %#x.\n", hr);
todo_wine
ok(shaderdesc.BytecodeLength == 516, "Unexpected bytecode length %u.\n",
shaderdesc.BytecodeLength);
ok(!shaderdesc.SODecl, "Unexpected SO declaration %p.\n", shaderdesc.SODecl);
hr = s->lpVtbl->GetShaderDesc(s, 7, &shaderdesc);
ok(hr == S_OK, "Failed to get shader description, hr %#x.\n", hr);
todo_wine
ok(shaderdesc.BytecodeLength == 516, "Unexpected bytecode length %u.\n",
shaderdesc.BytecodeLength);
ok(!strcmp(shaderdesc.SODecl, "SV_POSITION.x"), "Unexpected SO declaration %s.\n",