Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Commit

Permalink
WinRT: included shaders in SDL library (moved from SDLWinRTTestApp)
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidLudwig committed Nov 20, 2012
1 parent 1824595 commit 304358b
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 18 deletions.
18 changes: 18 additions & 0 deletions VisualC/SDL/SDL_VS2012_WinRT.vcxproj
Expand Up @@ -261,6 +261,24 @@
<ClInclude Include="..\..\src\video\windowsrt\SDL_winrtrenderer.h" />
<ClInclude Include="..\..\src\video\windowsrt\SDL_winrtvideo.h" />
</ItemGroup>
<ItemGroup>
<FxCompile Include="..\..\src\video\windowsrt\SimplePixelShader.hlsl">
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">Pixel</ShaderType>
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">Pixel</ShaderType>
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Pixel</ShaderType>
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Pixel</ShaderType>
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Pixel</ShaderType>
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Pixel</ShaderType>
</FxCompile>
<FxCompile Include="..\..\src\video\windowsrt\SimpleVertexShader.hlsl">
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">Vertex</ShaderType>
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Release|ARM'">Vertex</ShaderType>
<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>
<PropertyGroup Label="Globals">
<ProjectGuid>{aeaea3a2-d4e6-45b1-8ec6-53d84287fc14}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
Expand Down
4 changes: 2 additions & 2 deletions src/video/windowsrt/SDL_winrtrenderer.cpp
Expand Up @@ -16,8 +16,8 @@ void SDL_winrtrenderer::CreateDeviceResources()
{
Direct3DBase::CreateDeviceResources();

auto loadVSTask = DX::ReadDataAsync("SimpleVertexShader.cso");
auto loadPSTask = DX::ReadDataAsync("SimplePixelShader.cso");
auto loadVSTask = DX::ReadDataAsync("SDL_VS2012_WinRT\\SimpleVertexShader.cso");
auto loadPSTask = DX::ReadDataAsync("SDL_VS2012_WinRT\\SimplePixelShader.cso");

auto createVSTask = loadVSTask.then([this](Platform::Array<byte>^ fileData) {
DX::ThrowIfFailed(
Expand Down
19 changes: 3 additions & 16 deletions src/video/windowsrt/SimpleVertexShader.hlsl
@@ -1,9 +1,5 @@
cbuffer ModelViewProjectionConstantBuffer : register(b0)
{
matrix model;
matrix view;
matrix projection;
};

//#pragma pack_matrix( row_major )

struct VertexShaderInput
{
Expand All @@ -20,16 +16,7 @@ struct VertexShaderOutput
VertexShaderOutput main(VertexShaderInput input)
{
VertexShaderOutput output;
float4 pos = float4(input.pos, 1.0f);

// Transform the vertex position into projected space.
pos = mul(pos, model);
pos = mul(pos, view);
pos = mul(pos, projection);
output.pos = pos;

// Pass through the color without modification.
output.pos = float4(input.pos, 1.0f);
output.color = input.color;

return output;
}

0 comments on commit 304358b

Please sign in to comment.