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:
parent
2b83832fdf
commit
87f099b7dc
|
@ -107,6 +107,7 @@ struct d3d10_effect_shader_variable
|
||||||
{
|
{
|
||||||
ID3D10ShaderReflection *reflection;
|
ID3D10ShaderReflection *reflection;
|
||||||
ID3D10Blob *input_signature;
|
ID3D10Blob *input_signature;
|
||||||
|
ID3D10Blob *bytecode;
|
||||||
union
|
union
|
||||||
{
|
{
|
||||||
ID3D10VertexShader *vs;
|
ID3D10VertexShader *vs;
|
||||||
|
|
|
@ -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);
|
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)))
|
if (FAILED(hr = get_fx10_shader_resources(v, ptr, dxbc_size)))
|
||||||
return hr;
|
return hr;
|
||||||
|
|
||||||
|
@ -2589,6 +2594,8 @@ static void d3d10_effect_shader_variable_destroy(struct d3d10_effect_shader_vari
|
||||||
s->reflection->lpVtbl->Release(s->reflection);
|
s->reflection->lpVtbl->Release(s->reflection);
|
||||||
if (s->input_signature)
|
if (s->input_signature)
|
||||||
ID3D10Blob_Release(s->input_signature);
|
ID3D10Blob_Release(s->input_signature);
|
||||||
|
if (s->bytecode)
|
||||||
|
ID3D10Blob_Release(s->bytecode);
|
||||||
|
|
||||||
switch (type)
|
switch (type)
|
||||||
{
|
{
|
||||||
|
@ -6828,6 +6835,11 @@ static HRESULT STDMETHODCALLTYPE d3d10_effect_shader_variable_GetShaderDesc(
|
||||||
if (s->input_signature)
|
if (s->input_signature)
|
||||||
desc->pInputSignature = ID3D10Blob_GetBufferPointer(s->input_signature);
|
desc->pInputSignature = ID3D10Blob_GetBufferPointer(s->input_signature);
|
||||||
desc->SODecl = s->stream_output_declaration;
|
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 (s->reflection)
|
||||||
{
|
{
|
||||||
if (SUCCEEDED(hr = s->reflection->lpVtbl->GetDesc(s->reflection, &shader_desc)))
|
if (SUCCEEDED(hr = s->reflection->lpVtbl->GetDesc(s->reflection, &shader_desc)))
|
||||||
|
|
|
@ -5887,10 +5887,8 @@ static void test_effect_optimize(void)
|
||||||
ok(hr == S_OK, "Failed to get shader description, hr %#x.\n", hr);
|
ok(hr == S_OK, "Failed to get shader description, hr %#x.\n", hr);
|
||||||
ok(!!shaderdesc.pInputSignature, "Expected input signature.\n");
|
ok(!!shaderdesc.pInputSignature, "Expected input signature.\n");
|
||||||
ok(!shaderdesc.IsInline, "Unexpected inline flag.\n");
|
ok(!shaderdesc.IsInline, "Unexpected inline flag.\n");
|
||||||
todo_wine {
|
|
||||||
ok(!!shaderdesc.pBytecode, "Expected bytecode.\n");
|
ok(!!shaderdesc.pBytecode, "Expected bytecode.\n");
|
||||||
ok(!!shaderdesc.BytecodeLength, "Unexpected bytecode length.\n");
|
ok(!!shaderdesc.BytecodeLength, "Unexpected bytecode length.\n");
|
||||||
}
|
|
||||||
ok(!strcmp(shaderdesc.SODecl, "SV_POSITION.x"), "Unexpected stream output declaration %s.\n", shaderdesc.SODecl);
|
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.NumInputSignatureEntries, "Unexpected input signature count.\n");
|
||||||
ok(!!shaderdesc.NumOutputSignatureEntries, "Unexpected output 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(hr == S_OK, "Failed to get shader description, hr %#x.\n", hr);
|
||||||
ok(!!shaderdesc.pInputSignature, "Expected input signature.\n");
|
ok(!!shaderdesc.pInputSignature, "Expected input signature.\n");
|
||||||
ok(!shaderdesc.IsInline, "Unexpected inline flag.\n");
|
ok(!shaderdesc.IsInline, "Unexpected inline flag.\n");
|
||||||
|
todo_wine {
|
||||||
ok(!shaderdesc.pBytecode, "Unexpected bytecode.\n");
|
ok(!shaderdesc.pBytecode, "Unexpected bytecode.\n");
|
||||||
ok(!shaderdesc.BytecodeLength, "Unexpected bytecode length.\n");
|
ok(!shaderdesc.BytecodeLength, "Unexpected bytecode length.\n");
|
||||||
todo_wine {
|
|
||||||
ok(!shaderdesc.SODecl, "Unexpected stream output declaration %p.\n", shaderdesc.SODecl);
|
ok(!shaderdesc.SODecl, "Unexpected stream output declaration %p.\n", shaderdesc.SODecl);
|
||||||
ok(!shaderdesc.NumInputSignatureEntries, "Unexpected input signature count.\n");
|
ok(!shaderdesc.NumInputSignatureEntries, "Unexpected input signature count.\n");
|
||||||
ok(!shaderdesc.NumOutputSignatureEntries, "Unexpected output 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);
|
ok(!shaderdesc.BytecodeLength, "Unexpected bytecode length %u.\n", shaderdesc.BytecodeLength);
|
||||||
hr = s->lpVtbl->GetShaderDesc(s, 3, &shaderdesc);
|
hr = s->lpVtbl->GetShaderDesc(s, 3, &shaderdesc);
|
||||||
ok(hr == S_OK, "Failed to get shader description, hr %#x.\n", hr);
|
ok(hr == S_OK, "Failed to get shader description, hr %#x.\n", hr);
|
||||||
todo_wine
|
|
||||||
ok(shaderdesc.BytecodeLength == 424, "Unexpected bytecode length %u.\n",
|
ok(shaderdesc.BytecodeLength == 424, "Unexpected bytecode length %u.\n",
|
||||||
shaderdesc.BytecodeLength);
|
shaderdesc.BytecodeLength);
|
||||||
hr = s->lpVtbl->GetShaderDesc(s, 4, &shaderdesc);
|
hr = s->lpVtbl->GetShaderDesc(s, 4, &shaderdesc);
|
||||||
ok(hr == S_OK, "Failed to get shader description, hr %#x.\n", hr);
|
ok(hr == S_OK, "Failed to get shader description, hr %#x.\n", hr);
|
||||||
todo_wine
|
|
||||||
ok(shaderdesc.BytecodeLength == 424, "Unexpected bytecode length %u.\n",
|
ok(shaderdesc.BytecodeLength == 424, "Unexpected bytecode length %u.\n",
|
||||||
shaderdesc.BytecodeLength);
|
shaderdesc.BytecodeLength);
|
||||||
hr = s->lpVtbl->GetShaderDesc(s, 5, &shaderdesc);
|
hr = s->lpVtbl->GetShaderDesc(s, 5, &shaderdesc);
|
||||||
ok(hr == S_OK, "Failed to get shader description, hr %#x.\n", hr);
|
ok(hr == S_OK, "Failed to get shader description, hr %#x.\n", hr);
|
||||||
todo_wine
|
|
||||||
ok(shaderdesc.BytecodeLength == 420, "Unexpected bytecode length %u.\n",
|
ok(shaderdesc.BytecodeLength == 420, "Unexpected bytecode length %u.\n",
|
||||||
shaderdesc.BytecodeLength);
|
shaderdesc.BytecodeLength);
|
||||||
hr = s->lpVtbl->GetShaderDesc(s, 6, &shaderdesc);
|
hr = s->lpVtbl->GetShaderDesc(s, 6, &shaderdesc);
|
||||||
ok(hr == S_OK, "Failed to get shader description, hr %#x.\n", hr);
|
ok(hr == S_OK, "Failed to get shader description, hr %#x.\n", hr);
|
||||||
todo_wine
|
|
||||||
ok(shaderdesc.BytecodeLength == 516, "Unexpected bytecode length %u.\n",
|
ok(shaderdesc.BytecodeLength == 516, "Unexpected bytecode length %u.\n",
|
||||||
shaderdesc.BytecodeLength);
|
shaderdesc.BytecodeLength);
|
||||||
ok(!shaderdesc.SODecl, "Unexpected SO declaration %p.\n", shaderdesc.SODecl);
|
ok(!shaderdesc.SODecl, "Unexpected SO declaration %p.\n", shaderdesc.SODecl);
|
||||||
hr = s->lpVtbl->GetShaderDesc(s, 7, &shaderdesc);
|
hr = s->lpVtbl->GetShaderDesc(s, 7, &shaderdesc);
|
||||||
ok(hr == S_OK, "Failed to get shader description, hr %#x.\n", hr);
|
ok(hr == S_OK, "Failed to get shader description, hr %#x.\n", hr);
|
||||||
todo_wine
|
|
||||||
ok(shaderdesc.BytecodeLength == 516, "Unexpected bytecode length %u.\n",
|
ok(shaderdesc.BytecodeLength == 516, "Unexpected bytecode length %u.\n",
|
||||||
shaderdesc.BytecodeLength);
|
shaderdesc.BytecodeLength);
|
||||||
ok(!strcmp(shaderdesc.SODecl, "SV_POSITION.x"), "Unexpected SO declaration %s.\n",
|
ok(!strcmp(shaderdesc.SODecl, "SV_POSITION.x"), "Unexpected SO declaration %s.\n",
|
||||||
|
|
Loading…
Reference in New Issue