diff --git a/src/renderer/atlas/BackendD3D.cpp b/src/renderer/atlas/BackendD3D.cpp index 1199b28ada..1dd70346eb 100644 --- a/src/renderer/atlas/BackendD3D.cpp +++ b/src/renderer/atlas/BackendD3D.cpp @@ -12,7 +12,7 @@ #include #include "BuiltinGlyphs.h" -#include "dwrite.h" +#include "dwrite_helpers.h" #include "wic.h" #include "../../types/inc/ColorFix.hpp" #include "../../types/inc/convert.hpp" diff --git a/src/renderer/atlas/atlas.vcxproj b/src/renderer/atlas/atlas.vcxproj index 913d9bd9c2..01085f529e 100644 --- a/src/renderer/atlas/atlas.vcxproj +++ b/src/renderer/atlas/atlas.vcxproj @@ -18,7 +18,7 @@ - + Create @@ -33,7 +33,7 @@ - + @@ -45,7 +45,7 @@ Vertex - + true diff --git a/src/renderer/atlas/dwrite.cpp b/src/renderer/atlas/dwrite_helpers.cpp similarity index 97% rename from src/renderer/atlas/dwrite.cpp rename to src/renderer/atlas/dwrite_helpers.cpp index cfb95299f6..7162f44aa1 100644 --- a/src/renderer/atlas/dwrite.cpp +++ b/src/renderer/atlas/dwrite_helpers.cpp @@ -2,7 +2,7 @@ // Licensed under the MIT license. #include "pch.h" -#include "dwrite.h" +#include "dwrite_helpers.h" #pragma warning(disable : 26429) // Symbol '...' is never tested for nullness, it can be marked as not_null (f.23). @@ -37,7 +37,7 @@ void DWrite_GetRenderParams(IDWriteFactory1* factory, float* gamma, float* clear THROW_IF_FAILED(factory->CreateCustomRenderingParams(1.0f, 0.0f, 0.0f, defaultParams->GetClearTypeLevel(), defaultParams->GetPixelGeometry(), defaultParams->GetRenderingMode(), linearParams)); } -// This function produces 4 magic constants for DWrite_ApplyAlphaCorrection() in dwrite.hlsl +// This function produces 4 magic constants for DWrite_ApplyAlphaCorrection() in dwrite_helpers.hlsl // and are required as an argument for DWrite_GetGrayscaleCorrectedAlpha(). // gamma should be set to the return value of DWrite_GetRenderParams() or (pseudo-code): // IDWriteRenderingParams* defaultParams; diff --git a/src/renderer/atlas/dwrite.h b/src/renderer/atlas/dwrite_helpers.h similarity index 89% rename from src/renderer/atlas/dwrite.h rename to src/renderer/atlas/dwrite_helpers.h index 9c61e2cba7..73df600aba 100644 --- a/src/renderer/atlas/dwrite.h +++ b/src/renderer/atlas/dwrite_helpers.h @@ -4,8 +4,13 @@ #pragma once // Exclude stuff from we don't need. +#ifndef NOMINMAX #define NOMINMAX +#endif + +#ifndef WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN +#endif #include diff --git a/src/renderer/atlas/dwrite.hlsl b/src/renderer/atlas/dwrite_helpers.hlsl similarity index 97% rename from src/renderer/atlas/dwrite.hlsl rename to src/renderer/atlas/dwrite_helpers.hlsl index 955b9f57e5..e69b55766e 100644 --- a/src/renderer/atlas/dwrite.hlsl +++ b/src/renderer/atlas/dwrite_helpers.hlsl @@ -52,7 +52,7 @@ float3 DWrite_ApplyAlphaCorrection3(float3 a, float3 f, float4 g) // out of the blending of foregroundColor with glyphAlpha. // // gammaRatios: -// Magic constants produced by DWrite_GetGammaRatios() in dwrite.cpp. +// Magic constants produced by DWrite_GetGammaRatios() in dwrite_helpers.cpp. // The default value for this are the 1.8 gamma ratios, which equates to: // 0.148054421f, -0.894594550f, 1.47590804f, -0.324668258f // grayscaleEnhancedContrast: @@ -92,7 +92,7 @@ float4 DWrite_GrayscaleBlend(float4 gammaRatios, float grayscaleEnhancedContrast // of foregroundColor and backgroundColor using glyphColor to do sub-pixel AA. // // gammaRatios: -// Magic constants produced by DWrite_GetGammaRatios() in dwrite.cpp. +// Magic constants produced by DWrite_GetGammaRatios() in dwrite_helpers.cpp. // The default value for this are the 1.8 gamma ratios, which equates to: // 0.148054421f, -0.894594550f, 1.47590804f, -0.324668258f // enhancedContrast: diff --git a/src/renderer/atlas/makefile.inc b/src/renderer/atlas/makefile.inc new file mode 100644 index 0000000000..6c935369a6 --- /dev/null +++ b/src/renderer/atlas/makefile.inc @@ -0,0 +1,21 @@ +.SUFFIXES: .hlsl + +# Vertex Shaders + +$(OBJ_PATH)\$(O)\custom_shader_vs.h: custom_shader_vs.hlsl + @$(ECHO) Compiling shader $(*F)... + $(FXC) $(FXC_FLAGS) /Tvs_$(FXC_PROFILE_VERSION) /Fh"$@" /Vn$(*B) $? + +$(OBJ_PATH)\$(O)\shader_vs.h: shader_vs.hlsl + @$(ECHO) Compiling shader $(*F)... + $(FXC) $(FXC_FLAGS) /Tvs_$(FXC_PROFILE_VERSION) /Fh"$@" /Vn$(*B) $? + +# Pixel Shaders + +$(OBJ_PATH)\$(O)\custom_shader_ps.h: custom_shader_ps.hlsl + @$(ECHO) Compiling shader $(*F)... + $(FXC) $(FXC_FLAGS) /Tps_$(FXC_PROFILE_VERSION) /Fh"$@" /Vn$(*B) $? + +$(OBJ_PATH)\$(O)\shader_ps.h: shader_ps.hlsl + @$(ECHO) Compiling shader $(*F)... + $(FXC) $(FXC_FLAGS) /Tps_$(FXC_PROFILE_VERSION) /Fh"$@" /Vn$(*B) $? diff --git a/src/renderer/atlas/pch.h b/src/renderer/atlas/pch.h index 7e9109010b..952d0fb2d7 100644 --- a/src/renderer/atlas/pch.h +++ b/src/renderer/atlas/pch.h @@ -3,8 +3,13 @@ #pragma once +#ifndef NOMINMAX #define NOMINMAX +#endif + +#ifndef WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN +#endif #include #include diff --git a/src/renderer/atlas/shader_ps.hlsl b/src/renderer/atlas/shader_ps.hlsl index a39ec79dc7..ec8f1c0084 100644 --- a/src/renderer/atlas/shader_ps.hlsl +++ b/src/renderer/atlas/shader_ps.hlsl @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. -#include "dwrite.hlsl" +#include "dwrite_helpers.hlsl" #include "shader_common.hlsl" cbuffer ConstBuffer : register(b0) diff --git a/src/renderer/atlas/sources b/src/renderer/atlas/sources new file mode 100644 index 0000000000..b68efa81e7 --- /dev/null +++ b/src/renderer/atlas/sources @@ -0,0 +1,46 @@ +!include ..\..\project.inc + +TARGETNAME = ConRenderAtlas +TARGETTYPE = LIBRARY + +PRECOMPILED_CXX = 1 +PRECOMPILED_INCLUDE = pch.h + +MSC_WARNING_LEVEL = $(MSC_WARNING_LEVEL) /wd4201 + +FXC_FLAGS = /nologo /Emain /WX /all_resources_bound /Zi +FXC_PROFILE_VERSION = 4_0 + +# Release flags for the shader compiler +!if $(FREEBUILD) +FXC_FLAGS = $(FXC_FLAGS) /O3 /Zsb /Qstrip_debug /Qstrip_reflect +!endif + +INCLUDES = \ + $(INCLUDES); \ + ..\..\inc; \ + ..\..\..\oss\stb; \ + $(OBJ_PATH)\$(O); \ + $(MINWIN_INTERNAL_PRIV_SDK_INC_PATH_L); \ + $(MINWIN_RESTRICTED_PRIV_SDK_INC_PATH_L); \ + +SOURCES = \ + $(SOURCES) \ + AtlasEngine.api.cpp \ + AtlasEngine.cpp \ + AtlasEngine.r.cpp \ + Backend.cpp \ + BackendD2D.cpp \ + BackendD3D.cpp \ + BuiltinGlyphs.cpp \ + dwrite_helpers.cpp \ + DWriteTextAnalysis.cpp \ + stb_rect_pack.cpp \ + wic.cpp \ + +# Build rules specified in makefile.inc +NTTARGETFILE0 = \ + $(OBJ_PATH)\$(O)\custom_shader_vs.h \ + $(OBJ_PATH)\$(O)\custom_shader_ps.h \ + $(OBJ_PATH)\$(O)\shader_vs.h \ + $(OBJ_PATH)\$(O)\shader_ps.h \ diff --git a/src/renderer/atlas/sources.dep b/src/renderer/atlas/sources.dep new file mode 100644 index 0000000000..fce1139651 --- /dev/null +++ b/src/renderer/atlas/sources.dep @@ -0,0 +1,3 @@ +BUILD_PASS1_CONSUMES= \ + onecore\windows\core\console\vcpkg|PASS1 \ + diff --git a/src/renderer/dirs b/src/renderer/dirs index 1b3b1ee6c5..5d5fd4e0d0 100644 --- a/src/renderer/dirs +++ b/src/renderer/dirs @@ -2,3 +2,4 @@ DIRS= \ base \ gdi \ wddmcon \ + atlas \ diff --git a/src/tools/vtpipeterm/main.cpp b/src/tools/vtpipeterm/main.cpp index 0a87724727..e9deb00d52 100644 --- a/src/tools/vtpipeterm/main.cpp +++ b/src/tools/vtpipeterm/main.cpp @@ -232,7 +232,7 @@ static int run(int argc, const wchar_t* argv[]) } } -int wmain(int argc, const wchar_t* argv[]) +int __cdecl wmain(int argc, const wchar_t* argv[]) { const auto inputHandle = GetStdHandle(STD_INPUT_HANDLE); const auto outputHandle = GetStdHandle(STD_OUTPUT_HANDLE);