Commit 984ed6e9 authored by Rico Schüller's avatar Rico Schüller Committed by Alexandre Julliard

d3dcompiler: Parse reflection STAT tag.

parent 8f08d385
......@@ -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 */
......
......@@ -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 *)&section->tag, 4));
break;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment