Rico Schüller : d3dcompiler: Parse reflection STAT tag .
Alexandre Julliard
julliard at winehq.org
Tue Dec 21 14:32:19 CST 2010
Module: wine
Branch: master
Commit: 984ed6e9aca3c3f1009f6bdb9467d4e4fcca7407
URL: http://source.winehq.org/git/wine.git/?a=commit;h=984ed6e9aca3c3f1009f6bdb9467d4e4fcca7407
Author: Rico Schüller <kgbricola at web.de>
Date: Tue Dec 21 11:06:01 2010 +0100
d3dcompiler: Parse reflection STAT tag.
---
dlls/d3dcompiler_43/d3dcompiler_private.h | 27 +++++++
dlls/d3dcompiler_43/reflection.c | 120 +++++++++++++++++++++++++++++
2 files changed, 147 insertions(+), 0 deletions(-)
diff --git a/dlls/d3dcompiler_43/d3dcompiler_private.h b/dlls/d3dcompiler_43/d3dcompiler_private.h
index feb2edd..3e0915a 100644
--- a/dlls/d3dcompiler_43/d3dcompiler_private.h
+++ b/dlls/d3dcompiler_43/d3dcompiler_private.h
@@ -62,6 +62,33 @@ struct d3dcompiler_shader_reflection
{
ID3D11ShaderReflection ID3D11ShaderReflection_iface;
LONG refcount;
+
+ UINT mov_instruction_count;
+ UINT conversion_instruction_count;
+ UINT instruction_count;
+ UINT emit_instruction_count;
+ D3D_PRIMITIVE_TOPOLOGY gs_output_topology;
+ UINT gs_max_output_vertex_count;
+ D3D_PRIMITIVE input_primitive;
+ UINT cut_instruction_count;
+ UINT dcl_count;
+ UINT static_flow_control_count;
+ UINT float_instruction_count;
+ UINT temp_register_count;
+ UINT int_instruction_count;
+ UINT uint_instruction_count;
+ UINT temp_array_count;
+ UINT array_instruction_count;
+ UINT texture_normal_instructions;
+ UINT texture_load_instructions;
+ UINT texture_comp_instructions;
+ UINT texture_bias_instructions;
+ UINT texture_gradient_instructions;
+ UINT dynamic_flow_control_count;
+ UINT c_control_points;
+ D3D_TESSELLATOR_OUTPUT_PRIMITIVE hs_output_primitive;
+ D3D_TESSELLATOR_PARTITIONING hs_prtitioning;
+ D3D_TESSELLATOR_DOMAIN tessellator_domain;
};
/* reflection handling */
diff --git a/dlls/d3dcompiler_43/reflection.c b/dlls/d3dcompiler_43/reflection.c
index 2a64b93..08eb44c 100644
--- a/dlls/d3dcompiler_43/reflection.c
+++ b/dlls/d3dcompiler_43/reflection.c
@@ -247,6 +247,116 @@ const struct ID3D11ShaderReflectionVtbl d3dcompiler_shader_reflection_vtbl =
d3dcompiler_shader_reflection_GetThreadGroupSize,
};
+static HRESULT d3dcompiler_parse_stat(struct d3dcompiler_shader_reflection *r, const char *data, DWORD data_size)
+{
+ const char *ptr = data;
+ DWORD size = data_size >> 2;
+
+ TRACE("Size %u\n", size);
+
+ read_dword(&ptr, &r->instruction_count);
+ TRACE("InstructionCount: %u\n", r->instruction_count);
+
+ read_dword(&ptr, &r->temp_register_count);
+ TRACE("TempRegisterCount: %u\n", r->temp_register_count);
+
+ skip_dword_unknown(&ptr, 1);
+
+ read_dword(&ptr, &r->dcl_count);
+ TRACE("DclCount: %u\n", r->dcl_count);
+
+ read_dword(&ptr, &r->float_instruction_count);
+ TRACE("FloatInstructionCount: %u\n", r->float_instruction_count);
+
+ read_dword(&ptr, &r->int_instruction_count);
+ TRACE("IntInstructionCount: %u\n", r->int_instruction_count);
+
+ read_dword(&ptr, &r->uint_instruction_count);
+ TRACE("UintInstructionCount: %u\n", r->uint_instruction_count);
+
+ read_dword(&ptr, &r->static_flow_control_count);
+ TRACE("StaticFlowControlCount: %u\n", r->static_flow_control_count);
+
+ read_dword(&ptr, &r->dynamic_flow_control_count);
+ TRACE("DynamicFlowControlCount: %u\n", r->dynamic_flow_control_count);
+
+ skip_dword_unknown(&ptr, 1);
+
+ read_dword(&ptr, &r->temp_array_count);
+ TRACE("TempArrayCount: %u\n", r->temp_array_count);
+
+ read_dword(&ptr, &r->array_instruction_count);
+ TRACE("ArrayInstructionCount: %u\n", r->array_instruction_count);
+
+ read_dword(&ptr, &r->cut_instruction_count);
+ TRACE("CutInstructionCount: %u\n", r->cut_instruction_count);
+
+ read_dword(&ptr, &r->emit_instruction_count);
+ TRACE("EmitInstructionCount: %u\n", r->emit_instruction_count);
+
+ read_dword(&ptr, &r->texture_normal_instructions);
+ TRACE("TextureNormalInstructions: %u\n", r->texture_normal_instructions);
+
+ read_dword(&ptr, &r->texture_load_instructions);
+ TRACE("TextureLoadInstructions: %u\n", r->texture_load_instructions);
+
+ read_dword(&ptr, &r->texture_comp_instructions);
+ TRACE("TextureCompInstructions: %u\n", r->texture_comp_instructions);
+
+ read_dword(&ptr, &r->texture_bias_instructions);
+ TRACE("TextureBiasInstructions: %u\n", r->texture_bias_instructions);
+
+ read_dword(&ptr, &r->texture_gradient_instructions);
+ TRACE("TextureGradientInstructions: %u\n", r->texture_gradient_instructions);
+
+ read_dword(&ptr, &r->mov_instruction_count);
+ TRACE("MovInstructionCount: %u\n", r->mov_instruction_count);
+
+ skip_dword_unknown(&ptr, 1);
+
+ read_dword(&ptr, &r->conversion_instruction_count);
+ TRACE("ConversionInstructionCount: %u\n", r->conversion_instruction_count);
+
+ skip_dword_unknown(&ptr, 1);
+
+ read_dword(&ptr, &r->input_primitive);
+ TRACE("InputPrimitive: %x\n", r->input_primitive);
+
+ read_dword(&ptr, &r->gs_output_topology);
+ TRACE("GSOutputTopology: %x\n", r->gs_output_topology);
+
+ read_dword(&ptr, &r->gs_max_output_vertex_count);
+ TRACE("GSMaxOutputVertexCount: %u\n", r->gs_max_output_vertex_count);
+
+ skip_dword_unknown(&ptr, 3);
+
+ /* dx10 stat size */
+ if (size == 29) return S_OK;
+
+ skip_dword_unknown(&ptr, 1);
+
+ read_dword(&ptr, &r->c_control_points);
+ TRACE("cControlPoints: %u\n", r->c_control_points);
+
+ read_dword(&ptr, &r->hs_output_primitive);
+ TRACE("HSOutputPrimitive: %x\n", r->hs_output_primitive);
+
+ read_dword(&ptr, &r->hs_prtitioning);
+ TRACE("HSPartitioning: %x\n", r->hs_prtitioning);
+
+ read_dword(&ptr, &r->tessellator_domain);
+ TRACE("TessellatorDomain: %x\n", r->tessellator_domain);
+
+ skip_dword_unknown(&ptr, 3);
+
+ /* dx11 stat size */
+ if (size == 37) return S_OK;
+
+ FIXME("Unhandled size %u\n", size);
+
+ return E_FAIL;
+}
+
HRESULT d3dcompiler_shader_reflection_init(struct d3dcompiler_shader_reflection *reflection,
const void *data, SIZE_T data_size)
{
@@ -270,6 +380,16 @@ HRESULT d3dcompiler_shader_reflection_init(struct d3dcompiler_shader_reflection
switch (section->tag)
{
+ case TAG_STAT:
+ hr = d3dcompiler_parse_stat(reflection, section->data, section->data_size);
+ if (FAILED(hr))
+ {
+ dxbc_destroy(&src_dxbc);
+ WARN("Failed to parse section STAT.\n");
+ return hr;
+ }
+ break;
+
default:
FIXME("Unhandled section %s!\n", debugstr_an((const char *)§ion->tag, 4));
break;
More information about the wine-cvs
mailing list