MCPcopy Create free account
hub / github.com/crosire/reshade / CreateInputLayout

Method CreateInputLayout

source/d3d10/d3d10_device.cpp:1154–1211  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1152 return hr;
1153}
1154HRESULT STDMETHODCALLTYPE D3D10Device::CreateInputLayout(const D3D10_INPUT_ELEMENT_DESC *pInputElementDescs, UINT NumElements, const void *pShaderBytecodeWithInputSignature, SIZE_T BytecodeLength, ID3D10InputLayout **ppInputLayout)
1155{
1156#if RESHADE_ADDON
1157 if (ppInputLayout == nullptr) // This can happen when application only wants to validate input parameters
1158 return _orig->CreateInputLayout(pInputElementDescs, NumElements, pShaderBytecodeWithInputSignature, BytecodeLength, ppInputLayout);
1159
1160 std::vector<D3D10_INPUT_ELEMENT_DESC> internal_desc; std::vector<reshade::api::input_element> desc;
1161 desc.reserve(NumElements);
1162 for (UINT i = 0; i < NumElements; ++i)
1163 desc.push_back(reshade::d3d10::convert_input_element(pInputElementDescs[i]));
1164
1165 reshade::api::shader_desc signature_desc = {};
1166 signature_desc.code = pShaderBytecodeWithInputSignature;
1167 signature_desc.code_size = BytecodeLength;
1168
1169 const reshade::api::pipeline_subobject subobjects[] = {
1170 { reshade::api::pipeline_subobject_type::input_layout, static_cast<uint32_t>(desc.size()), desc.data() },
1171 { reshade::api::pipeline_subobject_type::vertex_shader, 1, &signature_desc }
1172 };
1173
1174 if (reshade::invoke_addon_event<reshade::addon_event::create_pipeline>(this, _global_pipeline_layout, static_cast<uint32_t>(std::size(subobjects)), subobjects))
1175 {
1176 internal_desc.reserve(desc.size());
1177 for (size_t i = 0; i < desc.size(); ++i)
1178 reshade::d3d10::convert_input_element(desc[i], internal_desc.emplace_back());
1179
1180 pInputElementDescs = internal_desc.data();
1181 NumElements = static_cast<UINT>(internal_desc.size());
1182 pShaderBytecodeWithInputSignature = signature_desc.code;
1183 BytecodeLength = signature_desc.code_size;
1184 }
1185#endif
1186
1187 const HRESULT hr = _orig->CreateInputLayout(pInputElementDescs, NumElements, pShaderBytecodeWithInputSignature, BytecodeLength, ppInputLayout);
1188 if (SUCCEEDED(hr))
1189 {
1190#if RESHADE_ADDON
1191 ID3D10InputLayout *const pipeline = *ppInputLayout;
1192
1193 reshade::invoke_addon_event<reshade::addon_event::init_pipeline>(this, _global_pipeline_layout, static_cast<uint32_t>(std::size(subobjects)), subobjects, to_handle(pipeline));
1194
1195 if (reshade::has_addon_event<reshade::addon_event::destroy_pipeline>())
1196 {
1197 register_destruction_callback_d3dx(pipeline, [this, pipeline]() {
1198 reshade::invoke_addon_event<reshade::addon_event::destroy_pipeline>(this, to_handle(pipeline));
1199 });
1200 }
1201#endif
1202 }
1203#if RESHADE_VERBOSE_LOG
1204 else
1205 {
1206 reshade::log::message(reshade::log::level::warning, "ID3D10Device::CreateInputLayout failed with error code %s.", reshade::log::hr_to_string(hr).c_str());
1207 }
1208#endif
1209
1210 return hr;
1211}

Callers 1

create_input_layoutMethod · 0.45

Calls 4

messageFunction · 0.85
hr_to_stringFunction · 0.85
to_handleFunction · 0.70

Tested by

no test coverage detected