質問編集履歴
1
始めに投稿したコードはやっていることが支離滅裂だったので書き直しました。ですが.csoバイナリシェーダーオブジェクトファイル読み込めていないようです。
title
CHANGED
File without changes
|
body
CHANGED
@@ -3,32 +3,29 @@
|
|
3
3
|
HRESULT DrawTriangle::CreateVertexShader2(ID3D11Device* device, ID3D11VertexShader* resVS)
|
4
4
|
{
|
5
5
|
|
6
|
+
//char outfile[] = "VertexShader.cso";
|
6
7
|
HRESULT result;
|
7
|
-
|
8
|
+
|
8
|
-
char buf[16];
|
9
|
-
|
10
|
-
|
9
|
+
std::ifstream ifs("VertexShader.cso", std::ios::binary);
|
11
|
-
if (!
|
10
|
+
if (!ifs)
|
12
|
-
|
11
|
+
{
|
13
12
|
result = E_FAIL;
|
14
13
|
return result;
|
15
14
|
}
|
16
15
|
|
16
|
+
ifs.seekg(0, std::ios::end);
|
17
|
-
|
17
|
+
size_t size = ifs.tellg();
|
18
|
+
CHAR* buffer = new CHAR[size];
|
18
|
-
|
19
|
+
ifs.read(buffer, size);
|
20
|
+
ifs.close();
|
19
21
|
|
20
|
-
for (int i = 0, size = file.gcount(); i < size; i++) {
|
21
|
-
cout << buf[i] << flush;
|
22
|
-
}
|
23
|
-
}
|
24
|
-
|
25
|
-
file.close();
|
26
|
-
|
27
|
-
result = device->CreateVertexShader(&
|
22
|
+
result = device->CreateVertexShader(&buffer, sizeof(buffer), NULL, &resVS);
|
28
23
|
if (FAILED(result))
|
29
24
|
{
|
25
|
+
delete buffer;
|
30
26
|
return result;
|
31
27
|
}
|
28
|
+
delete buffer;
|
32
29
|
|
33
30
|
|
34
31
|
return result;
|