Skip to content

Commit 11bbeae

Browse files
committed
fix shaderpack under windows
1 parent 23cb1f5 commit 11bbeae

File tree

6 files changed

+211
-14
lines changed

6 files changed

+211
-14
lines changed

hydra_app/input.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Input::Input()
1616
//inLibraryPath = "C:/[Hydra]/pluginFiles/scenelib";
1717

1818
inDevelopment = true; ///< recompile shaders each time; note that nvidia have their own shader cache!
19-
inDeviceId = 0; ///< opencl device id
19+
inDeviceId = 1; ///< opencl device id
2020
cpuFB = false; ///< store frame buffer on CPU. Automaticly enabled if
2121
enableMLT = false; ///< not used currently
2222

hydra_app/main_app.sln

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "clew", "..\..\HydraAPI\clew
2424
EndProject
2525
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ies_parser", "..\..\HydraAPI\ies_parser\ies_parser.vcxproj", "{1D53B494-4B7E-464B-82A1-A2052240F6EF}"
2626
EndProject
27+
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "shaderpack", "..\shaderpack\shaderpack.vcxproj", "{E0914440-7CB6-4D4F-84FD-49BD580663A3}"
28+
EndProject
2729
Global
2830
GlobalSection(SolutionConfigurationPlatforms) = preSolution
2931
Debug|x64 = Debug|x64
@@ -106,6 +108,18 @@ Global
106108
{1D53B494-4B7E-464B-82A1-A2052240F6EF}.RelWithDebInfo|x64.Build.0 = Release|x64
107109
{1D53B494-4B7E-464B-82A1-A2052240F6EF}.RelWithDebInfo|x86.ActiveCfg = Release|Win32
108110
{1D53B494-4B7E-464B-82A1-A2052240F6EF}.RelWithDebInfo|x86.Build.0 = Release|Win32
111+
{E0914440-7CB6-4D4F-84FD-49BD580663A3}.Debug|x64.ActiveCfg = Debug|x64
112+
{E0914440-7CB6-4D4F-84FD-49BD580663A3}.Debug|x64.Build.0 = Debug|x64
113+
{E0914440-7CB6-4D4F-84FD-49BD580663A3}.Debug|x86.ActiveCfg = Debug|Win32
114+
{E0914440-7CB6-4D4F-84FD-49BD580663A3}.Debug|x86.Build.0 = Debug|Win32
115+
{E0914440-7CB6-4D4F-84FD-49BD580663A3}.Release|x64.ActiveCfg = Release|x64
116+
{E0914440-7CB6-4D4F-84FD-49BD580663A3}.Release|x64.Build.0 = Release|x64
117+
{E0914440-7CB6-4D4F-84FD-49BD580663A3}.Release|x86.ActiveCfg = Release|Win32
118+
{E0914440-7CB6-4D4F-84FD-49BD580663A3}.Release|x86.Build.0 = Release|Win32
119+
{E0914440-7CB6-4D4F-84FD-49BD580663A3}.RelWithDebInfo|x64.ActiveCfg = Release|x64
120+
{E0914440-7CB6-4D4F-84FD-49BD580663A3}.RelWithDebInfo|x64.Build.0 = Release|x64
121+
{E0914440-7CB6-4D4F-84FD-49BD580663A3}.RelWithDebInfo|x86.ActiveCfg = Release|Win32
122+
{E0914440-7CB6-4D4F-84FD-49BD580663A3}.RelWithDebInfo|x86.Build.0 = Release|Win32
109123
EndGlobalSection
110124
GlobalSection(SolutionProperties) = preSolution
111125
HideSolutionNode = FALSE

shaderpack/pack.cpp

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,8 @@ int main(int argc, const char** argv)
1515
std::string inputfolder = HYDRA_DRV_PATH;
1616
#endif
1717

18-
std::cout << "inputfolder = " << HYDRA_DRV_PATH << std::endl;
19-
20-
#ifdef WIN32
21-
int initRes = clewInit(L"opencl.dll");
22-
if (initRes == -1)
23-
{
24-
std::cerr << "[cl_core]: failed to load opencl.dll " << std::endl;
25-
return 0;
26-
}
27-
#else
28-
int initRes = 0;
29-
#endif
18+
std::cout << "inputfolder = " << inputfolder.c_str() << std::endl;
19+
3020

3121
std::string specDefines = " -D SHADOW_TRACE_COLORED_SHADOWS -D ENABLE_OPACITY_TEX -D ENABLE_BLINN "; // -D NEXT_BOUNCE_RR
3222

@@ -85,3 +75,4 @@ int main(int argc, const char** argv)
8575

8676
return 0;
8777
}
78+

shaderpack/shaderpack.vcxproj

Lines changed: 169 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,169 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<ItemGroup Label="ProjectConfigurations">
4+
<ProjectConfiguration Include="Debug|Win32">
5+
<Configuration>Debug</Configuration>
6+
<Platform>Win32</Platform>
7+
</ProjectConfiguration>
8+
<ProjectConfiguration Include="Release|Win32">
9+
<Configuration>Release</Configuration>
10+
<Platform>Win32</Platform>
11+
</ProjectConfiguration>
12+
<ProjectConfiguration Include="Debug|x64">
13+
<Configuration>Debug</Configuration>
14+
<Platform>x64</Platform>
15+
</ProjectConfiguration>
16+
<ProjectConfiguration Include="Release|x64">
17+
<Configuration>Release</Configuration>
18+
<Platform>x64</Platform>
19+
</ProjectConfiguration>
20+
</ItemGroup>
21+
<ItemGroup>
22+
<ClCompile Include="pack.cpp" />
23+
</ItemGroup>
24+
<ItemGroup>
25+
<ProjectReference Include="..\..\HydraAPI\clew\clew.vcxproj">
26+
<Project>{5f13e40f-c0f1-4ef4-a775-ab8bc703de88}</Project>
27+
</ProjectReference>
28+
<ProjectReference Include="..\..\HydraAPI\hydra_api\HydraNewAPI1.vcxproj">
29+
<Project>{c05ff9ea-3d61-48b7-abea-4353253691dc}</Project>
30+
</ProjectReference>
31+
<ProjectReference Include="..\hydra_drv\hydra_drv.vcxproj">
32+
<Project>{cb095789-f909-46dc-b9d6-9160ba7c508c}</Project>
33+
</ProjectReference>
34+
<ProjectReference Include="..\vsgl3\vsgl3.vcxproj">
35+
<Project>{2758dd4a-78f6-452f-bbf5-4e86b46bd2ea}</Project>
36+
</ProjectReference>
37+
</ItemGroup>
38+
<PropertyGroup Label="Globals">
39+
<VCProjectVersion>15.0</VCProjectVersion>
40+
<ProjectGuid>{E0914440-7CB6-4D4F-84FD-49BD580663A3}</ProjectGuid>
41+
<Keyword>Win32Proj</Keyword>
42+
<RootNamespace>shaderpack2</RootNamespace>
43+
<WindowsTargetPlatformVersion>10.0.16299.0</WindowsTargetPlatformVersion>
44+
</PropertyGroup>
45+
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
46+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
47+
<ConfigurationType>Application</ConfigurationType>
48+
<UseDebugLibraries>true</UseDebugLibraries>
49+
<PlatformToolset>v141</PlatformToolset>
50+
<CharacterSet>Unicode</CharacterSet>
51+
</PropertyGroup>
52+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
53+
<ConfigurationType>Application</ConfigurationType>
54+
<UseDebugLibraries>false</UseDebugLibraries>
55+
<PlatformToolset>v141</PlatformToolset>
56+
<WholeProgramOptimization>true</WholeProgramOptimization>
57+
<CharacterSet>Unicode</CharacterSet>
58+
</PropertyGroup>
59+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
60+
<ConfigurationType>Application</ConfigurationType>
61+
<UseDebugLibraries>true</UseDebugLibraries>
62+
<PlatformToolset>v141</PlatformToolset>
63+
<CharacterSet>Unicode</CharacterSet>
64+
</PropertyGroup>
65+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
66+
<ConfigurationType>Application</ConfigurationType>
67+
<UseDebugLibraries>false</UseDebugLibraries>
68+
<PlatformToolset>v141</PlatformToolset>
69+
<WholeProgramOptimization>true</WholeProgramOptimization>
70+
<CharacterSet>Unicode</CharacterSet>
71+
</PropertyGroup>
72+
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
73+
<ImportGroup Label="ExtensionSettings">
74+
</ImportGroup>
75+
<ImportGroup Label="Shared">
76+
</ImportGroup>
77+
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
78+
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
79+
</ImportGroup>
80+
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
81+
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
82+
</ImportGroup>
83+
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
84+
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
85+
</ImportGroup>
86+
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
87+
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
88+
</ImportGroup>
89+
<PropertyGroup Label="UserMacros" />
90+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
91+
<LinkIncremental>false</LinkIncremental>
92+
</PropertyGroup>
93+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
94+
<LinkIncremental>true</LinkIncremental>
95+
</PropertyGroup>
96+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
97+
<LinkIncremental>true</LinkIncremental>
98+
</PropertyGroup>
99+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
100+
<LinkIncremental>false</LinkIncremental>
101+
</PropertyGroup>
102+
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
103+
<ClCompile>
104+
<PrecompiledHeader>NotUsing</PrecompiledHeader>
105+
<WarningLevel>Level3</WarningLevel>
106+
<Optimization>MaxSpeed</Optimization>
107+
<FunctionLevelLinking>true</FunctionLevelLinking>
108+
<IntrinsicFunctions>true</IntrinsicFunctions>
109+
<SDLCheck>true</SDLCheck>
110+
<PreprocessorDefinitions>WIN32; NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
111+
<ConformanceMode>true</ConformanceMode>
112+
</ClCompile>
113+
<Link>
114+
<SubSystem>Console</SubSystem>
115+
<EnableCOMDATFolding>true</EnableCOMDATFolding>
116+
<OptimizeReferences>true</OptimizeReferences>
117+
<GenerateDebugInformation>true</GenerateDebugInformation>
118+
</Link>
119+
</ItemDefinitionGroup>
120+
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
121+
<ClCompile>
122+
<PrecompiledHeader>Use</PrecompiledHeader>
123+
<WarningLevel>Level3</WarningLevel>
124+
<Optimization>Disabled</Optimization>
125+
<SDLCheck>true</SDLCheck>
126+
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
127+
<ConformanceMode>true</ConformanceMode>
128+
</ClCompile>
129+
<Link>
130+
<SubSystem>Console</SubSystem>
131+
<GenerateDebugInformation>true</GenerateDebugInformation>
132+
</Link>
133+
</ItemDefinitionGroup>
134+
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
135+
<ClCompile>
136+
<PrecompiledHeader>NotUsing</PrecompiledHeader>
137+
<WarningLevel>Level3</WarningLevel>
138+
<Optimization>Disabled</Optimization>
139+
<SDLCheck>true</SDLCheck>
140+
<PreprocessorDefinitions>WIN32; _DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
141+
<ConformanceMode>true</ConformanceMode>
142+
</ClCompile>
143+
<Link>
144+
<SubSystem>Console</SubSystem>
145+
<GenerateDebugInformation>true</GenerateDebugInformation>
146+
</Link>
147+
</ItemDefinitionGroup>
148+
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
149+
<ClCompile>
150+
<PrecompiledHeader>Use</PrecompiledHeader>
151+
<WarningLevel>Level3</WarningLevel>
152+
<Optimization>MaxSpeed</Optimization>
153+
<FunctionLevelLinking>true</FunctionLevelLinking>
154+
<IntrinsicFunctions>true</IntrinsicFunctions>
155+
<SDLCheck>true</SDLCheck>
156+
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
157+
<ConformanceMode>true</ConformanceMode>
158+
</ClCompile>
159+
<Link>
160+
<SubSystem>Console</SubSystem>
161+
<EnableCOMDATFolding>true</EnableCOMDATFolding>
162+
<OptimizeReferences>true</OptimizeReferences>
163+
<GenerateDebugInformation>true</GenerateDebugInformation>
164+
</Link>
165+
</ItemDefinitionGroup>
166+
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
167+
<ImportGroup Label="ExtensionTargets">
168+
</ImportGroup>
169+
</Project>

shaderpack/shaderpack.vcxproj.filters

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<ItemGroup>
4+
<Filter Include="Исходные файлы">
5+
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
6+
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
7+
</Filter>
8+
<Filter Include="Файлы заголовков">
9+
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
10+
<Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>
11+
</Filter>
12+
<Filter Include="Файлы ресурсов">
13+
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
14+
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
15+
</Filter>
16+
</ItemGroup>
17+
<ItemGroup>
18+
<ClCompile Include="pack.cpp">
19+
<Filter>Файлы ресурсов</Filter>
20+
</ClCompile>
21+
</ItemGroup>
22+
</Project>

vsgl3/clHelper.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -647,7 +647,8 @@ CLProgram::~CLProgram()
647647
clReleaseKernel(p->second);
648648
}
649649

650-
clReleaseProgram(program);
650+
if(program != nullptr)
651+
clReleaseProgram(program);
651652
}
652653

653654
}

0 commit comments

Comments
 (0)