Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Clark Lin
hw3d
Commits
6086a3d2
Commit
6086a3d2
authored
Jan 29, 2019
by
chili
Browse files
vertex shader created and loaded
parent
f2326a37
Changes
5
Hide whitespace changes
Inline
Side-by-side
.gitignore
View file @
6086a3d2
...
...
@@ -258,4 +258,5 @@ paket-files/
# Python Tools for Visual Studio (PTVS)
__pycache__/
*.pyc
\ No newline at end of file
*.pyc
*.cso
hw3d/Graphics.cpp
View file @
6086a3d2
#include "Graphics.h"
#include "dxerr.h"
#include <sstream>
#include <d3dcompiler.h>
namespace
wrl
=
Microsoft
::
WRL
;
#pragma comment(lib,"d3d11.lib")
#pragma comment(lib,"D3DCompiler.lib")
// graphics exception checking/throwing macros (some with dxgi infos)
#define GFX_EXCEPT_NOINFO(hr) Graphics::HrException( __LINE__,__FILE__,(hr) )
...
...
@@ -130,8 +132,19 @@ void Graphics::DrawTestTriangle()
const
UINT
stride
=
sizeof
(
Vertex
);
const
UINT
offset
=
0u
;
pContext
->
IASetVertexBuffers
(
0u
,
1u
,
&
pVertexBuffer
,
&
stride
,
&
offset
);
GFX_THROW_INFO_ONLY
(
pContext
->
Draw
(
3u
,
0u
)
);
// create vertex shader
wrl
::
ComPtr
<
ID3D11VertexShader
>
pVertexShader
;
wrl
::
ComPtr
<
ID3DBlob
>
pBlob
;
GFX_THROW_INFO
(
D3DReadFileToBlob
(
L"VertexShader.cso"
,
&
pBlob
)
);
GFX_THROW_INFO
(
pDevice
->
CreateVertexShader
(
pBlob
->
GetBufferPointer
(),
pBlob
->
GetBufferSize
(),
nullptr
,
&
pVertexShader
)
);
// bind vertex shader
pContext
->
VSSetShader
(
pVertexShader
.
Get
(),
nullptr
,
0u
);
GFX_THROW_INFO_ONLY
(
pContext
->
Draw
(
(
UINT
)
std
::
size
(
vertices
),
0u
)
);
}
...
...
hw3d/VertexShader.hlsl
0 → 100644
View file @
6086a3d2
float4
main
(
float2
pos
:
Position
)
:
SV_Position
{
return
float4
(
pos
.
x
,
pos
.
y
,
0
.
0
f
,
1
.
0
f
);
}
\ No newline at end of file
hw3d/hw3d.vcxproj
View file @
6086a3d2
...
...
@@ -182,6 +182,18 @@
<None
Include=
"DXGetErrorString.inl"
/>
<None
Include=
"DXTrace.inl"
/>
</ItemGroup>
<ItemGroup>
<FxCompile
Include=
"VertexShader.hlsl"
>
<ObjectFileOutput
Condition=
"'$(Configuration)|$(Platform)'=='Debug|Win32'"
>
$(ProjectDir)%(Filename).cso
</ObjectFileOutput>
<ObjectFileOutput
Condition=
"'$(Configuration)|$(Platform)'=='Release|Win32'"
>
$(ProjectDir)%(Filename).cso
</ObjectFileOutput>
<ObjectFileOutput
Condition=
"'$(Configuration)|$(Platform)'=='Debug|x64'"
>
$(ProjectDir)%(Filename).cso
</ObjectFileOutput>
<ObjectFileOutput
Condition=
"'$(Configuration)|$(Platform)'=='Release|x64'"
>
$(ProjectDir)%(Filename).cso
</ObjectFileOutput>
<ShaderType
Condition=
"'$(Configuration)|$(Platform)'=='Debug|Win32'"
>
Vertex
</ShaderType>
<ShaderType
Condition=
"'$(Configuration)|$(Platform)'=='Release|Win32'"
>
Vertex
</ShaderType>
<ShaderType
Condition=
"'$(Configuration)|$(Platform)'=='Debug|x64'"
>
Vertex
</ShaderType>
<ShaderType
Condition=
"'$(Configuration)|$(Platform)'=='Release|x64'"
>
Vertex
</ShaderType>
</FxCompile>
</ItemGroup>
<Import
Project=
"$(VCTargetsPath)\Microsoft.Cpp.targets"
/>
<ImportGroup
Label=
"ExtensionTargets"
>
</ImportGroup>
...
...
hw3d/hw3d.vcxproj.filters
View file @
6086a3d2
...
...
@@ -16,6 +16,9 @@
<Filter
Include=
"Dxerr"
>
<UniqueIdentifier>
{2b144e38-4e36-4755-9c6f-ce7bdafe689d}
</UniqueIdentifier>
</Filter>
<Filter
Include=
"Shader"
>
<UniqueIdentifier>
{246c933d-909b-4e52-ace4-7be4ab3da27b}
</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile
Include=
"WinMain.cpp"
>
...
...
@@ -111,4 +114,9 @@
<Filter>
Dxerr
</Filter>
</None>
</ItemGroup>
<ItemGroup>
<FxCompile
Include=
"VertexShader.hlsl"
>
<Filter>
Shader
</Filter>
</FxCompile>
</ItemGroup>
</Project>
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment