Menu

[025cc2]: / DirectPython11 / DPLayout.cpp  Maximize  Restore  History

Download this file

52 lines (40 with data), 1.5 kB

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
/*
Copyright (C) 2010, Heikki Salo
All rights reserved.
Distributed under the BSD license:
http://www.opensource.org/licenses/bsd-license.php
*/
#include "stdafx.h"
#include "DPEffect.hpp"
#include "DPDevice.hpp"
#include "DPLayout.hpp"
#include "DPUtils.hpp"
DPInputLayout::DPInputLayout(python::object& desc, DPEffect& effect, UINT techIndex, UINT passIndex)
{
layout = 0;
DPDevice* device = getDPDevice();
ID3DX11EffectTechnique* technique = effect.getEffect()->GetTechniqueByIndex(techIndex);
if (!technique->IsValid()) {
DPThrow("Invalid technique");
}
ID3DX11EffectPass* effectPass = technique->GetPassByIndex(passIndex);
if (!effectPass->IsValid())
DPThrow("Invalid pass");
std::vector<D3D11_INPUT_ELEMENT_DESC> resultDesc;
ConvertLayoutDesc(desc, &resultDesc);
D3DX11_PASS_DESC passDesc;
effectPass->GetDesc(&passDesc);
HRESULT hr = device->getDevice()->CreateInputLayout(&resultDesc[0], resultDesc.size(),
passDesc.pIAInputSignature, passDesc.IAInputSignatureSize, &layout);
if (FAILED(hr)) {
DPThrow(hr);
}
DPBase::init(device->getDevice());
}
void ExportDPInputLayout()
{
using namespace boost::python;
class_<DPInputLayout, boost::noncopyable>("InputLayout", init<object&, DPEffect&, UINT, UINT>())
.def("release", &DPInputLayout::release)
;
}
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.