Skip to content

Commit

Permalink
Added seprate "ftransform" vertex shader to avoid validation layer wa…
Browse files Browse the repository at this point in the history
…rnings
  • Loading branch information
victorcoda committed Apr 22, 2021
1 parent 6bfea19 commit a215042
Show file tree
Hide file tree
Showing 8 changed files with 67 additions and 7 deletions.
2 changes: 1 addition & 1 deletion bumpmapping/bumpmapping.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ class BumpMapping : public GraphicsApp
if (!fillPipeline)
{
fillPipeline = createCommonPipeline(
"transform.o", "fill.o",
"ftransform.o", "fill.o",
dot->getVertexInput(),
fillDescriptor.layout);
}
Expand Down
13 changes: 13 additions & 0 deletions bumpmapping/bumpmapping.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,19 @@
<ItemGroup>
<ClInclude Include="shaders\sobel.h" />
</ItemGroup>
<ItemGroup>
<CustomBuild Include="shaders\ftransform.vert">
<FileType>Document</FileType>
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(VK_SDK_PATH)\Bin32\glslangValidator.exe -V %(FullPath) -I..\framework\shaders -o %(Filename).o</Command>
<Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(VK_SDK_PATH)\Bin32\glslangValidator.exe -V %(FullPath) -I..\framework\shaders -o %(Filename).o</Command>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(Filename).o</Outputs>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(Filename).o</Outputs>
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(VK_SDK_PATH)\Bin32\glslangValidator.exe -V %(FullPath) -I..\framework\shaders -o %(Filename).o</Command>
<Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(VK_SDK_PATH)\Bin32\glslangValidator.exe -V %(FullPath) -I..\framework\shaders -o %(Filename).o</Command>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(Filename).o</Outputs>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(Filename).o</Outputs>
</CustomBuild>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
Expand Down
3 changes: 3 additions & 0 deletions bumpmapping/bumpmapping.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@
<CustomBuild Include="shaders\transform.vert">
<Filter>Resource Files</Filter>
</CustomBuild>
<CustomBuild Include="shaders\ftransform.vert">
<Filter>Resource Files</Filter>
</CustomBuild>
</ItemGroup>
<ItemGroup>
<ClInclude Include="shaders\sobel.h">
Expand Down
14 changes: 14 additions & 0 deletions bumpmapping/shaders/ftransform.vert
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#version 450
#extension GL_GOOGLE_include_directive : enable
#include "common/transforms.h"

layout(location = 0) in vec4 position;

out gl_PerVertex {
vec4 gl_Position;
};

void main()
{
gl_Position = worldViewProj * position;
}
12 changes: 6 additions & 6 deletions normalmapping/normalmapping.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class NormalMapping : public GraphicsApp
std::unique_ptr<quadric::Sphere> sphere;
std::shared_ptr<magma::ImageView> normalMap;
std::shared_ptr<magma::GraphicsPipeline> bumpPipeline;
std::shared_ptr<magma::GraphicsPipeline> spherePipeline;
std::shared_ptr<magma::GraphicsPipeline> fillPipeline;
DescriptorSet bumpDescriptor;
DescriptorSet fillDescriptor;

Expand Down Expand Up @@ -160,10 +160,10 @@ class NormalMapping : public GraphicsApp
std::move(specialization),
torus->getVertexInput(),
bumpDescriptor.layout);
if (!spherePipeline)
if (!fillPipeline)
{
spherePipeline = createCommonPipeline(
"transform.o", "fill.o",
fillPipeline = createCommonPipeline(
"ftransform.o", "fill.o",
sphere->getVertexInput(),
fillDescriptor.layout);
}
Expand All @@ -182,8 +182,8 @@ class NormalMapping : public GraphicsApp
cmdBuffer->bindPipeline(bumpPipeline);
cmdBuffer->bindDescriptorSet(bumpPipeline, bumpDescriptor.set, transforms->getDynamicOffset(0));
torus->draw(cmdBuffer);
cmdBuffer->bindPipeline(spherePipeline);
cmdBuffer->bindDescriptorSet(spherePipeline, fillDescriptor.set, transforms->getDynamicOffset(1));
cmdBuffer->bindPipeline(fillPipeline);
cmdBuffer->bindDescriptorSet(fillPipeline, fillDescriptor.set, transforms->getDynamicOffset(1));
sphere->draw(cmdBuffer);
}
cmdBuffer->endRenderPass();
Expand Down
13 changes: 13 additions & 0 deletions normalmapping/normalmapping.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,19 @@
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(Filename).o</Outputs>
</CustomBuild>
</ItemGroup>
<ItemGroup>
<CustomBuild Include="shaders\ftransform.vert">
<FileType>Document</FileType>
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(VK_SDK_PATH)\Bin32\glslangValidator.exe -V %(FullPath) -I..\framework\shaders -o %(Filename).o</Command>
<Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(VK_SDK_PATH)\Bin32\glslangValidator.exe -V %(FullPath) -I..\framework\shaders -o %(Filename).o</Command>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(Filename).o</Outputs>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(Filename).o</Outputs>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(Filename).o</Outputs>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(Filename).o</Outputs>
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(VK_SDK_PATH)\Bin32\glslangValidator.exe -V %(FullPath) -I..\framework\shaders -o %(Filename).o</Command>
<Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(VK_SDK_PATH)\Bin32\glslangValidator.exe -V %(FullPath) -I..\framework\shaders -o %(Filename).o</Command>
</CustomBuild>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
Expand Down
3 changes: 3 additions & 0 deletions normalmapping/normalmapping.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,8 @@
<CustomBuild Include="shaders\bump.frag">
<Filter>Resource Files</Filter>
</CustomBuild>
<CustomBuild Include="shaders\ftransform.vert">
<Filter>Resource Files</Filter>
</CustomBuild>
</ItemGroup>
</Project>
14 changes: 14 additions & 0 deletions normalmapping/shaders/ftransform.vert
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#version 450
#extension GL_GOOGLE_include_directive : enable
#include "common/transforms.h"

layout(location = 0) in vec4 position;

out gl_PerVertex {
vec4 gl_Position;
};

void main()
{
gl_Position = worldViewProj * position;
}

0 comments on commit a215042

Please sign in to comment.