atlas: build with Windows Razzle; fix inbox build (#19848)

This commit is contained in:
Dustin L. Howett
2026-02-11 08:45:44 -06:00
committed by GitHub
parent 692f06beb6
commit 5f1ecb005a
12 changed files with 91 additions and 10 deletions

View File

@@ -12,7 +12,7 @@
#include <shader_vs.h>
#include "BuiltinGlyphs.h"
#include "dwrite.h"
#include "dwrite_helpers.h"
#include "wic.h"
#include "../../types/inc/ColorFix.hpp"
#include "../../types/inc/convert.hpp"

View File

@@ -18,7 +18,7 @@
<ClCompile Include="BackendD2D.cpp" />
<ClCompile Include="BackendD3D.cpp" />
<ClCompile Include="BuiltinGlyphs.cpp" />
<ClCompile Include="dwrite.cpp" />
<ClCompile Include="dwrite_helpers.cpp" />
<ClCompile Include="DWriteTextAnalysis.cpp" />
<ClCompile Include="pch.cpp">
<PrecompiledHeader>Create</PrecompiledHeader>
@@ -33,7 +33,7 @@
<ClInclude Include="BackendD3D.h" />
<ClInclude Include="BuiltinGlyphs.h" />
<ClInclude Include="common.h" />
<ClInclude Include="dwrite.h" />
<ClInclude Include="dwrite_helpers.h" />
<ClInclude Include="DWriteTextAnalysis.h" />
<ClInclude Include="pch.h" />
<ClInclude Include="wic.h" />
@@ -45,7 +45,7 @@
<FxCompile Include="custom_shader_vs.hlsl">
<ShaderType>Vertex</ShaderType>
</FxCompile>
<FxCompile Include="dwrite.hlsl">
<FxCompile Include="dwrite_helpers.hlsl">
<ExcludedFromBuild>true</ExcludedFromBuild>
</FxCompile>
<FxCompile Include="shader_common.hlsl">

View File

@@ -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;

View File

@@ -4,8 +4,13 @@
#pragma once
// Exclude stuff from <Windows.h> we don't need.
#ifndef NOMINMAX
#define NOMINMAX
#endif
#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN
#endif
#include <dwrite_1.h>

View File

@@ -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:

View File

@@ -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) $?

View File

@@ -3,8 +3,13 @@
#pragma once
#ifndef NOMINMAX
#define NOMINMAX
#endif
#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN
#endif
#include <filesystem>
#include <functional>

View File

@@ -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)

View File

@@ -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 \

View File

@@ -0,0 +1,3 @@
BUILD_PASS1_CONSUMES= \
onecore\windows\core\console\vcpkg|PASS1 \

View File

@@ -2,3 +2,4 @@ DIRS= \
base \
gdi \
wddmcon \
atlas \

View File

@@ -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);