Skip to content

Commit

Permalink
support windows
Browse files Browse the repository at this point in the history
  • Loading branch information
Yuichiro Nakada committed Jul 10, 2018
1 parent 47647c9 commit e96c2a4
Show file tree
Hide file tree
Showing 13 changed files with 126 additions and 90 deletions.
17 changes: 16 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@ Using GLSL.
- Linux with GLEW
- macOS with GLEW
- Windows with [GLFW](http://www.glfw.org/) and GLEW
- nupengl.core with NuGet

## Download

- You can download this program from [here](https://github.com/yui0/waifu2x-glsl/releases).

## How to build on macOS

Expand All @@ -26,6 +29,18 @@ $ make
$ make
```

## How to build on Windows

1. Installing OpenGL

- nupengl.core with NuGet

2. Linking OpenGL

- Choose ‘Linker-> General’.
- In the ‘Additional Dependencies’ field click on the arrow that appears at the end of the field and choose Edit…
- In the dialog that appears enter “opengl32.lib”

## How to use

```bash
Expand Down
8 changes: 7 additions & 1 deletion gpgpu_glsl.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
#endif
#define GLFW_INCLUDE_GLU

#ifdef _MSC_VER
#define strdup _strdup
#endif
#ifdef _WIN32
#include <windows.h>
#include <GL/glew.h>
Expand Down Expand Up @@ -61,8 +64,10 @@
char pass_through[] = STRINGIFY(

#ifdef GL_ES
precision highp float;
\n
precision highp float;\n
#endif
\n

attribute vec3 pos;
attribute vec2 tex;
Expand Down Expand Up @@ -98,6 +103,7 @@ GLuint coLoadShader(GLenum shaderType, const char* pSource)
case '{':
case ';':
if (*p==0x20) *p = '\n';
// if (*p==0x20 && *(p+1)!='i') *p = '\n';
}
}

Expand Down
Binary file added waifu2x-glsl/.vs/waifu2x-glsl/v15/.suo
Binary file not shown.
Binary file added waifu2x-glsl/.vs/waifu2x-glsl/v15/Browse.VC.db
Binary file not shown.
Binary file not shown.
Binary file added waifu2x-glsl/output.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions waifu2x-glsl/packages.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="nupengl.core" version="0.1.0.1" targetFramework="native" />
<package id="nupengl.core.redist" version="0.1.0.1" targetFramework="native" />
</packages>
67 changes: 35 additions & 32 deletions windows/waifu2x_glsl.vcxproj → waifu2x-glsl/waifu2x-glsl.vcxproj
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
Expand All @@ -19,50 +19,51 @@
</ProjectConfiguration>
</ItemGroup>
<ItemGroup>
<ClCompile Include="waifu2x_glsl.c" />
<ClCompile Include="..\waifu2x_glsl.c" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="clock.h" />
<ClInclude Include="gpgpu_glsl.h" />
<ClInclude Include="parg.h" />
<ClInclude Include="parson.h" />
<ClInclude Include="stb_image.h" />
<ClInclude Include="stb_image_resize.h" />
<ClInclude Include="stb_image_write.h" />
<ClInclude Include="..\clock.h" />
<ClInclude Include="..\gpgpu_glsl.h" />
<ClInclude Include="..\parg.h" />
<ClInclude Include="..\parson.h" />
<ClInclude Include="..\stb_image.h" />
<ClInclude Include="..\stb_image_resize.h" />
<ClInclude Include="..\stb_image_write.h" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{FD5EFCCF-691D-4F9D-B074-597CE15B2C5A}</ProjectGuid>
<VCProjectVersion>15.0</VCProjectVersion>
<ProjectGuid>{EF4923BA-52AE-4900-83C9-38CE4479B782}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>waifu2x_glsl</RootNamespace>
<WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
<RootNamespace>waifu2xglsl</RootNamespace>
<WindowsTargetPlatformVersion>10.0.17134.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset>
<PlatformToolset>v141</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset>
<PlatformToolset>v141</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset>
<PlatformToolset>v141</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset>
<PlatformToolset>v141</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
Expand Down Expand Up @@ -98,66 +99,68 @@
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<PrecompiledHeader>
</PrecompiledHeader>
<PrecompiledHeader>Use</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Custom</Optimization>
<Optimization>Disabled</Optimization>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>opengl32.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<PrecompiledHeader>
</PrecompiledHeader>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies);opengl32.lib</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<PrecompiledHeader>Use</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<PrecompiledHeader>
</PrecompiledHeader>
<Optimization>Full</Optimization>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>opengl32.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<PrecompiledHeader>
</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies);opengl32.lib</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
Expand All @@ -167,7 +170,7 @@
</ImportGroup>
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
<ErrorText>このプロジェクトは、このコンピューター上にない NuGet パッケージを参照しています。それらのパッケージをダウンロードするには、[NuGet パッケージの復元] を使用します。詳細については、http://go.microsoft.com/fwlink/?LinkID=322105 を参照してください。見つからないファイルは {0} です。</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\nupengl.core.redist.0.1.0.1\build\native\nupengl.core.redist.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\nupengl.core.redist.0.1.0.1\build\native\nupengl.core.redist.targets'))" />
<Error Condition="!Exists('..\packages\nupengl.core.0.1.0.1\build\native\nupengl.core.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\nupengl.core.0.1.0.1\build\native\nupengl.core.targets'))" />
Expand Down
48 changes: 48 additions & 0 deletions waifu2x-glsl/waifu2x-glsl.vcxproj.filters
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="ソース ファイル">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="ヘッダー ファイル">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hh;hpp;hxx;hm;inl;inc;ipp;xsd</Extensions>
</Filter>
<Filter Include="リソース ファイル">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\waifu2x_glsl.c">
<Filter>ソース ファイル</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\clock.h">
<Filter>ヘッダー ファイル</Filter>
</ClInclude>
<ClInclude Include="..\gpgpu_glsl.h">
<Filter>ヘッダー ファイル</Filter>
</ClInclude>
<ClInclude Include="..\parg.h">
<Filter>ヘッダー ファイル</Filter>
</ClInclude>
<ClInclude Include="..\parson.h">
<Filter>ヘッダー ファイル</Filter>
</ClInclude>
<ClInclude Include="..\stb_image.h">
<Filter>ヘッダー ファイル</Filter>
</ClInclude>
<ClInclude Include="..\stb_image_resize.h">
<Filter>ヘッダー ファイル</Filter>
</ClInclude>
<ClInclude Include="..\stb_image_write.h">
<Filter>ヘッダー ファイル</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LocalDebuggerCommandArguments>001_200x.jpg</LocalDebuggerCommandArguments>
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
<LocalDebuggerWorkingDirectory>..\</LocalDebuggerWorkingDirectory>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LocalDebuggerCommandArguments>001_200x.jpg</LocalDebuggerCommandArguments>
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
<LocalDebuggerWorkingDirectory>..\</LocalDebuggerWorkingDirectory>
</PropertyGroup>
</Project>
13 changes: 9 additions & 4 deletions waifu2x_glsl.c
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
//---------------------------------------------------------
//---------------------------------------------------------
// Cat's eye
//
// ©2016-2018 Yuichiro Nakada
//---------------------------------------------------------

// clang -Os waifu2x_glsl.c -o waifu2x_glsl `pkg-config --libs --cflags glesv2 egl gbm` -lglfw -lm
#define _CRT_SECURE_NO_WARNINGS 1
#include <stdlib.h>
#include <stdint.h>
#include "gpgpu_glsl.h"
Expand Down Expand Up @@ -131,14 +132,18 @@ int CatsEye_loadJson(CatsEye *this, char *name)
#define KERNEL_W 256
#define KERNEL_H 281 // 287136/4/256

#undef max // for windows
#undef min // for windows
char convolution[] = STRINGIFY(

#ifdef GL_ES
precision highp float;
\n
precision highp float;\n
#endif
\n

#define xSize 1./DATA_XSIZE.
#define ySize 1./DATA_YSIZE.
#define xSize 1./DATA_XSIZE. \n
#define ySize 1./DATA_YSIZE. \n

uniform int INPUTPLANE; // /4
uniform vec2 inputOffset[128/4];
Expand Down
File renamed without changes.
48 changes: 0 additions & 48 deletions windows/waifu2x_glsl.vcxproj.filters

This file was deleted.

0 comments on commit e96c2a4

Please sign in to comment.