From ca3d15282b75eb7035bad5ba31bc6ae6c2266d1e Mon Sep 17 00:00:00 2001
From: myT <>
Date: Mon, 4 Nov 2024 00:23:09 +0100
Subject: [PATCH] draw Dear ImGUI after tone mapping
---
code/client/cl_imgui.cpp | 13 ++
code/renderer/crp_main.cpp | 2 +-
code/renderer/grp_blit.cpp | 147 ++++++++++++++++++
code/renderer/grp_local.h | 16 +-
code/renderer/grp_main.cpp | 28 ++--
code/renderer/grp_post.cpp | 64 +-------
code/renderer/shaders/crp/imgui.hlsl | 4 +-
code/renderer/shaders/grp/blit.hlsl | 71 +++++++++
code/renderer/shaders/grp/post_gamma.hlsl | 12 +-
code/renderer/srp_imgui.cpp | 8 +-
code/renderer/tr_gui.cpp | 10 +-
code/shadercomp/shadercomp.cpp | 1 +
makefiles/windows_vs2019/renderer.vcxproj | 4 +
.../windows_vs2019/renderer.vcxproj.filters | 4 +
makefiles/windows_vs2022/renderer.vcxproj | 4 +
.../windows_vs2022/renderer.vcxproj.filters | 4 +
16 files changed, 284 insertions(+), 108 deletions(-)
create mode 100644 code/renderer/grp_blit.cpp
create mode 100644 code/renderer/shaders/grp/blit.hlsl
diff --git a/code/client/cl_imgui.cpp b/code/client/cl_imgui.cpp
index ef08858..6e68cbd 100644
--- a/code/client/cl_imgui.cpp
+++ b/code/client/cl_imgui.cpp
@@ -471,6 +471,19 @@ static void ImGUI_ApplyTheme()
colors[ImGuiCol_SeparatorHovered] = hover;
colors[ImGuiCol_SeparatorActive] = hover;
+ const float brightness = 2.0f;
+ const float gamma = 1.3f;
+ for(int i = 0; i < ImGuiCol_COUNT; i++)
+ {
+ colors[i].x = min(powf(colors[i].x * brightness, gamma), 1.0f);
+ colors[i].y = min(powf(colors[i].y * brightness, gamma), 1.0f);
+ colors[i].z = min(powf(colors[i].z * brightness, gamma), 1.0f);
+ Q_assert(colors[i].x >= 0.0f && colors[i].x <= 1.0f);
+ Q_assert(colors[i].y >= 0.0f && colors[i].y <= 1.0f);
+ Q_assert(colors[i].z >= 0.0f && colors[i].z <= 1.0f);
+ Q_assert(colors[i].w >= 0.0f && colors[i].w <= 1.0f);
+ }
+
ImGuiStyle& style = ImGui::GetStyle();
style.WindowPadding = ImVec2(8.00f, 8.00f);
style.FramePadding = ImVec2(5.00f, 2.00f);
diff --git a/code/renderer/crp_main.cpp b/code/renderer/crp_main.cpp
index 14edbc3..f164cbb 100644
--- a/code/renderer/crp_main.cpp
+++ b/code/renderer/crp_main.cpp
@@ -687,8 +687,8 @@ void CRP::EndFrame()
volumetricLight.DrawGUI();
vdbManager.DrawGUI();
im3d.DrawGUI();
- imgui.Draw(renderTarget);
toneMap.DrawToneMap();
+ imgui.Draw(renderTarget);
magnifier.Draw();
BlitRenderTarget(GetSwapChainTexture(), "Blit to Swap Chain");
BlitRenderTarget(readbackRenderTarget, "Blit to Readback Texture");
diff --git a/code/renderer/grp_blit.cpp b/code/renderer/grp_blit.cpp
new file mode 100644
index 0000000..06184b7
--- /dev/null
+++ b/code/renderer/grp_blit.cpp
@@ -0,0 +1,147 @@
+/*
+===========================================================================
+Copyright (C) 2024 Gian 'myT' Schellenbaum
+
+This file is part of Challenge Quake 3 (CNQ3).
+
+Challenge Quake 3 is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 2 of the License,
+or (at your option) any later version.
+
+Challenge Quake 3 is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with Challenge Quake 3. If not, see .
+===========================================================================
+*/
+// Gameplay Rendering Pipeline - blitting
+
+
+#include "grp_local.h"
+#include "compshaders/grp/blit.h"
+
+
+#pragma pack(push, 4)
+
+struct BlitVertexRC
+{
+ float scaleX;
+ float scaleY;
+};
+
+#pragma pack(pop)
+
+
+void Blitter::Init()
+{
+ if(!srp.firstInit)
+ {
+ return;
+ }
+
+ {
+ RootSignatureDesc desc("blitter");
+ desc.usingVertexBuffers = false;
+ desc.constants[ShaderStage::Vertex].byteCount = sizeof(BlitVertexRC);
+ desc.samplerCount = 1;
+ desc.samplerVisibility = ShaderStages::PixelBit;
+ desc.AddRange(DescriptorType::Texture, 0, 1);
+ desc.genericVisibility = ShaderStages::PixelBit;
+ rootSignature = CreateRootSignature(desc);
+ }
+ {
+ DescriptorTableDesc desc("blitter", rootSignature);
+ descriptorTable = CreateDescriptorTable(desc);
+
+ DescriptorTableUpdate update;
+ update.SetSamplers(1, &grp.samplers[GetSamplerIndex(TW_CLAMP_TO_EDGE, TextureFilter::Linear)]);
+ UpdateDescriptorTable(descriptorTable, update);
+ }
+ {
+ GraphicsPipelineDesc desc("blitter", rootSignature);
+ desc.vertexShader = ShaderByteCode(g_blit_vs);
+ desc.pixelShader = ShaderByteCode(g_blit_ps);
+ desc.depthStencil.DisableDepth();
+ desc.rasterizer.cullMode = CT_TWO_SIDED;
+ desc.AddRenderTarget(0, TextureFormat::R8G8B8A8_UNorm);
+ pipeline = CreateGraphicsPipeline(desc);
+ }
+}
+
+void Blitter::Blit(HTexture renderTarget)
+{
+ SCOPED_RENDER_PASS("Blit to Swap Chain", 0.125f, 0.125f, 0.5f);
+
+ CmdBeginBarrier();
+ CmdTextureBarrier(grp.renderTarget, ResourceStates::PixelShaderAccessBit);
+ CmdTextureBarrier(renderTarget, ResourceStates::RenderTargetBit);
+ CmdEndBarrier();
+
+ float vsX = 1.0f; // vertex shader scale factors
+ float vsY = 1.0f;
+ float srX = 1.0f; // scissor rectangle scale factors
+ float srY = 1.0f;
+ if(r_fullscreen->integer == 1 && r_mode->integer == VIDEOMODE_UPSCALE)
+ {
+ if(r_blitMode->integer == BLITMODE_CENTERED)
+ {
+ vsX = (float)glConfig.vidWidth / (float)glInfo.winWidth;
+ vsY = (float)glConfig.vidHeight / (float)glInfo.winHeight;
+ }
+ else if(r_blitMode->integer == BLITMODE_ASPECT)
+ {
+ const float ars = (float)glConfig.vidWidth / (float)glConfig.vidHeight;
+ const float ard = (float)glInfo.winWidth / (float)glInfo.winHeight;
+ if(ard > ars)
+ {
+ vsX = ars / ard;
+ vsY = 1.0f;
+ srX = (float)glInfo.winHeight / (float)glConfig.vidHeight;
+ srY = srX;
+ }
+ else
+ {
+ vsX = 1.0f;
+ vsY = ard / ars;
+ srX = (float)glInfo.winWidth / (float)glConfig.vidWidth;
+ srY = srX;
+ }
+ }
+ }
+
+ if(vsX != 1.0f || vsY != 1.0f)
+ {
+ CmdClearColorTarget(renderTarget, colorBlack);
+
+ const int x = (glInfo.winWidth - glInfo.winWidth * vsX) / 2.0f;
+ const int y = (glInfo.winHeight - glInfo.winHeight * vsY) / 2.0f;
+ CmdSetViewport(0, 0, glInfo.winWidth, glInfo.winHeight);
+ CmdSetScissor(x, y, glConfig.vidWidth * srX, glConfig.vidHeight * srY);
+ }
+ else
+ {
+ CmdSetViewportAndScissor(0, 0, glInfo.winWidth, glInfo.winHeight);
+ }
+
+ BlitVertexRC vertexRC = {};
+ vertexRC.scaleX = vsX;
+ vertexRC.scaleY = vsY;
+
+ CmdBindRenderTargets(1, &renderTarget, NULL);
+ CmdBindPipeline(pipeline);
+ CmdBindRootSignature(rootSignature);
+ CmdBindDescriptorTable(rootSignature, descriptorTable);
+ CmdSetRootConstants(rootSignature, ShaderStage::Vertex, &vertexRC);
+ CmdDraw(3, 0);
+}
+
+void Blitter::SetInputTexture(HTexture source)
+{
+ DescriptorTableUpdate update;
+ update.SetTextures(1, &source);
+ UpdateDescriptorTable(descriptorTable, update);
+}
diff --git a/code/renderer/grp_local.h b/code/renderer/grp_local.h
index 7d3e6f0..2fccd0f 100644
--- a/code/renderer/grp_local.h
+++ b/code/renderer/grp_local.h
@@ -256,6 +256,18 @@ private:
HDescriptorTable inverseToneMapDescriptorTable;
};
+struct Blitter
+{
+ void Init();
+ void SetInputTexture(HTexture source);
+ void Blit(HTexture renderTarget);
+
+private:
+ HPipeline pipeline;
+ HRootSignature rootSignature;
+ HDescriptorTable descriptorTable;
+};
+
struct SMAA
{
void Init();
@@ -333,8 +345,6 @@ struct GRP : IRenderPipeline
uint32_t CreatePSO(CachedPSO& cache, const char* name);
- void UpdateReadbackTexture();
-
UI ui;
World world;
MipMapGenerator mipMapGen;
@@ -343,8 +353,8 @@ struct GRP : IRenderPipeline
PostProcess post;
SMAA smaa;
Nuklear nuklear;
+ Blitter blitter;
float frameSeed;
- bool updateReadbackTexture;
HTexture renderTarget;
TextureFormat::Id renderTargetFormat;
diff --git a/code/renderer/grp_main.cpp b/code/renderer/grp_main.cpp
index 4c86cb6..67bb510 100644
--- a/code/renderer/grp_main.cpp
+++ b/code/renderer/grp_main.cpp
@@ -216,7 +216,7 @@ void GRP::Init()
ui.Init(false, ShaderByteCode(g_ui_vs), ShaderByteCode(g_ui_ps), renderTargetFormat, descriptorTable, &rootSignatureDesc);
world.Init();
mipMapGen.Init(false, ShaderByteCode(g_mip_1_cs), ShaderByteCode(g_mip_2_cs), ShaderByteCode(g_mip_3_cs));
- const HTexture fontAtlas = imgui.Init(false, ShaderByteCode(g_imgui_vs), ShaderByteCode(g_imgui_ps), renderTargetFormat, descriptorTable, &rootSignatureDesc);
+ const HTexture fontAtlas = imgui.Init(false, ShaderByteCode(g_imgui_vs), ShaderByteCode(g_imgui_ps), TextureFormat::R8G8B8A8_UNorm, descriptorTable, &rootSignatureDesc);
const uint32_t fontAtlasSRV = RegisterTexture(fontAtlas);
imgui.RegisterFontAtlas(fontAtlasSRV);
im3d.Init(false, im3dShaders, renderTargetFormat);
@@ -224,6 +224,8 @@ void GRP::Init()
post.Init();
post.SetToneMapInput(renderTarget);
smaa.Init(); // must be after post
+ blitter.Init();
+ blitter.SetInputTexture(readbackRenderTarget);
srp.firstInit = false;
}
@@ -266,25 +268,19 @@ void GRP::BeginFrame()
void GRP::EndFrame()
{
+ // issue ImGUI calls
srp.DrawGUI();
im3d.DrawGUI();
- imgui.Draw(renderTarget);
- post.Draw("Post-process", GetSwapChainTexture());
+
+ // now using a R8G8B8A8 UNorm render target
+ post.Draw("Post-process", readbackRenderTarget);
+ imgui.Draw(readbackRenderTarget);
+ blitter.Blit(GetSwapChainTexture());
+
world.EndFrame();
- UpdateReadbackTexture();
srp.EndFrame();
}
-void GRP::UpdateReadbackTexture()
-{
- if(!updateReadbackTexture)
- {
- return;
- }
-
- post.Draw("Readback post-process", readbackRenderTarget);
-}
-
void GRP::CreateTexture(image_t* image, int mipCount, int width, int height)
{
TextureDesc desc(image->name, width, height, mipCount);
@@ -603,10 +599,8 @@ uint32_t GRP::CreatePSO(CachedPSO& cache, const char* name)
return index;
}
-void GRP::ExecuteRenderCommands(const byte* data, bool readbackRequested)
+void GRP::ExecuteRenderCommands(const byte* data, bool /*readbackRequested*/)
{
- updateReadbackTexture = readbackRequested;
-
for(;;)
{
const int commandId = ((const renderCommandBase_t*)data)->commandId;
diff --git a/code/renderer/grp_post.cpp b/code/renderer/grp_post.cpp
index 1dc9030..33a40cd 100644
--- a/code/renderer/grp_post.cpp
+++ b/code/renderer/grp_post.cpp
@@ -28,12 +28,6 @@ along with Challenge Quake 3. If not, see .
#pragma pack(push, 4)
-struct GammaVertexRC
-{
- float scaleX;
- float scaleY;
-};
-
struct GammaPixelRC
{
float invGamma;
@@ -69,7 +63,6 @@ void PostProcess::Init()
{
RootSignatureDesc desc("tone map");
desc.usingVertexBuffers = false;
- desc.constants[ShaderStage::Vertex].byteCount = sizeof(GammaVertexRC);
desc.constants[ShaderStage::Pixel].byteCount = sizeof(GammaPixelRC);
desc.samplerCount = 1;
desc.samplerVisibility = ShaderStages::PixelBit;
@@ -135,76 +128,22 @@ void PostProcess::Draw(const char* renderPassName, HTexture renderTarget)
CmdTextureBarrier(renderTarget, ResourceStates::RenderTargetBit);
CmdEndBarrier();
- float vsX = 1.0f; // vertex shader scale factors
- float vsY = 1.0f;
- float srX = 1.0f; // scissor rectangle scale factors
- float srY = 1.0f;
- if(r_fullscreen->integer == 1 && r_mode->integer == VIDEOMODE_UPSCALE)
- {
- if(r_blitMode->integer == BLITMODE_CENTERED)
- {
- vsX = (float)glConfig.vidWidth / (float)glInfo.winWidth;
- vsY = (float)glConfig.vidHeight / (float)glInfo.winHeight;
- }
- else if(r_blitMode->integer == BLITMODE_ASPECT)
- {
- const float ars = (float)glConfig.vidWidth / (float)glConfig.vidHeight;
- const float ard = (float)glInfo.winWidth / (float)glInfo.winHeight;
- if(ard > ars)
- {
- vsX = ars / ard;
- vsY = 1.0f;
- srX = (float)glInfo.winHeight / (float)glConfig.vidHeight;
- srY = srX;
- }
- else
- {
- vsX = 1.0f;
- vsY = ard / ars;
- srX = (float)glInfo.winWidth / (float)glConfig.vidWidth;
- srY = srX;
- }
- }
- }
-
- if(vsX != 1.0f || vsY != 1.0f)
- {
- CmdClearColorTarget(renderTarget, colorBlack);
-
- const int x = (glInfo.winWidth - glInfo.winWidth * vsX) / 2.0f;
- const int y = (glInfo.winHeight - glInfo.winHeight * vsY) / 2.0f;
- CmdSetViewport(0, 0, glInfo.winWidth, glInfo.winHeight);
- CmdSetScissor(x, y, glConfig.vidWidth * srX, glConfig.vidHeight * srY);
- }
- else
- {
- CmdSetViewportAndScissor(0, 0, glInfo.winWidth, glInfo.winHeight);
- }
-
- GammaVertexRC vertexRC = {};
- vertexRC.scaleX = vsX;
- vertexRC.scaleY = vsY;
-
GammaPixelRC pixelRC = {};
pixelRC.invGamma = 1.0f / r_gamma->value;
pixelRC.brightness = r_brightness->value;
pixelRC.greyscale = r_greyscale->value;
+ CmdSetViewportAndScissor(0, 0, glConfig.vidWidth, glConfig.vidHeight);
CmdBindRenderTargets(1, &renderTarget, NULL);
CmdBindPipeline(toneMapPipeline);
CmdBindRootSignature(toneMapRootSignature);
CmdBindDescriptorTable(toneMapRootSignature, toneMapDescriptorTable);
- CmdSetRootConstants(toneMapRootSignature, ShaderStage::Vertex, &vertexRC);
CmdSetRootConstants(toneMapRootSignature, ShaderStage::Pixel, &pixelRC);
CmdDraw(3, 0);
}
void PostProcess::ToneMap()
{
- GammaVertexRC vertexRC = {};
- vertexRC.scaleX = 1.0f;
- vertexRC.scaleY = 1.0f;
-
GammaPixelRC pixelRC = {};
pixelRC.invGamma = 1.0f / r_gamma->value;
pixelRC.brightness = r_brightness->value;
@@ -213,7 +152,6 @@ void PostProcess::ToneMap()
CmdBindPipeline(toneMapPipeline);
CmdBindRootSignature(toneMapRootSignature);
CmdBindDescriptorTable(toneMapRootSignature, toneMapDescriptorTable);
- CmdSetRootConstants(toneMapRootSignature, ShaderStage::Vertex, &vertexRC);
CmdSetRootConstants(toneMapRootSignature, ShaderStage::Pixel, &pixelRC);
CmdDraw(3, 0);
}
diff --git a/code/renderer/shaders/crp/imgui.hlsl b/code/renderer/shaders/crp/imgui.hlsl
index f5f8f33..e2391eb 100644
--- a/code/renderer/shaders/crp/imgui.hlsl
+++ b/code/renderer/shaders/crp/imgui.hlsl
@@ -27,7 +27,6 @@ cbuffer RootConstants : register(b0)
uint textureIndex;
uint samplerIndex;
float mipIndex;
- float colorScale;
};
struct VIn
@@ -58,8 +57,7 @@ float4 ps(VOut input) : SV_Target
{
Texture2D texture0 = ResourceDescriptorHeap[textureIndex];
SamplerState sampler0 = SamplerDescriptorHeap[samplerIndex];
- float4 color = float4(colorScale.xxx, 1);
- float4 result = input.col * color * texture0.SampleLevel(sampler0, input.uv, mipIndex);
+ float4 result = input.col * texture0.SampleLevel(sampler0, input.uv, mipIndex);
return result;
}
diff --git a/code/renderer/shaders/grp/blit.hlsl b/code/renderer/shaders/grp/blit.hlsl
new file mode 100644
index 0000000..89e1eb7
--- /dev/null
+++ b/code/renderer/shaders/grp/blit.hlsl
@@ -0,0 +1,71 @@
+/*
+===========================================================================
+Copyright (C) 2024 Gian 'myT' Schellenbaum
+
+This file is part of Challenge Quake 3 (CNQ3).
+
+Challenge Quake 3 is free software; you can redistribute it
+and/or modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 2 of the License,
+or (at your option) any later version.
+
+Challenge Quake 3 is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with Challenge Quake 3. If not, see .
+===========================================================================
+*/
+// blit shader - unlike texture copies, it doesn't care about the specific formats used
+
+
+#include "shared.hlsli"
+
+
+struct VOut
+{
+ float4 position : SV_Position;
+ float2 texCoords : TEXCOORD0;
+};
+
+
+#if VERTEX_SHADER
+
+cbuffer RootConstants
+{
+ float scaleX;
+ float scaleY;
+};
+
+VOut vs(uint id : SV_VertexID)
+{
+ VOut output;
+ output.position.x = scaleX * ((float)(id / 2) * 4.0 - 1.0);
+ output.position.y = scaleY * ((float)(id % 2) * 4.0 - 1.0);
+ output.position.z = 0.0;
+ output.position.w = 1.0;
+ output.texCoords.x = (float)(id / 2) * 2.0;
+ output.texCoords.y = 1.0 - (float)(id % 2) * 2.0;
+
+ return output;
+}
+
+#endif
+
+
+#if PIXEL_SHADER
+
+Texture2D texture0 : register(t0);
+SamplerState sampler0 : register(s0);
+
+float4 ps(VOut input) : SV_Target
+{
+ float3 color = texture0.Sample(sampler0, input.texCoords).rgb;
+ float4 result = float4(color, 1.0);
+
+ return result;
+}
+
+#endif
diff --git a/code/renderer/shaders/grp/post_gamma.hlsl b/code/renderer/shaders/grp/post_gamma.hlsl
index 4bab28f..11fc499 100644
--- a/code/renderer/shaders/grp/post_gamma.hlsl
+++ b/code/renderer/shaders/grp/post_gamma.hlsl
@@ -1,6 +1,6 @@
/*
===========================================================================
-Copyright (C) 2023 Gian 'myT' Schellenbaum
+Copyright (C) 2023-2024 Gian 'myT' Schellenbaum
This file is part of Challenge Quake 3 (CNQ3).
@@ -34,17 +34,11 @@ struct VOut
#if VERTEX_SHADER
-cbuffer RootConstants
-{
- float scaleX;
- float scaleY;
-};
-
VOut vs(uint id : SV_VertexID)
{
VOut output;
- output.position.x = scaleX * ((float)(id / 2) * 4.0 - 1.0);
- output.position.y = scaleY * ((float)(id % 2) * 4.0 - 1.0);
+ output.position.x = (float)(id / 2) * 4.0 - 1.0;
+ output.position.y = (float)(id % 2) * 4.0 - 1.0;
output.position.z = 0.0;
output.position.w = 1.0;
output.texCoords.x = (float)(id / 2) * 2.0;
diff --git a/code/renderer/srp_imgui.cpp b/code/renderer/srp_imgui.cpp
index 06028bd..6f38379 100644
--- a/code/renderer/srp_imgui.cpp
+++ b/code/renderer/srp_imgui.cpp
@@ -41,7 +41,6 @@ struct ImGUIPixelRC
uint32_t texture;
uint32_t sampler;
float mip;
- float colorScale;
};
#pragma pack(pop)
@@ -59,7 +58,7 @@ HTexture ImGUI::Init(bool ddhi_, const ShaderByteCode& vs, const ShaderByteCode&
if(srp.firstInit)
{
io.BackendRendererUserData = this;
- io.BackendRendererName = "CNQ3 Direct3D 12";
+ io.BackendRendererName = "CNQ3";
io.BackendFlags |= ImGuiBackendFlags_RendererHasVtxOffset; // We can honor the ImDrawCmd::VtxOffset field, allowing for large meshes.
for(int i = 0; i < FrameCount; i++)
@@ -213,6 +212,10 @@ void ImGUI::Draw(HTexture renderTarget)
const uint32_t vertexStride = sizeof(ImDrawVert);
static_assert(sizeof(ImDrawIdx) == 4, "uint32 indices expected!");
+ CmdBeginBarrier();
+ CmdTextureBarrier(renderTarget, ResourceStates::RenderTargetBit);
+ CmdEndBarrier();
+
CmdBindRenderTargets(1, &renderTarget, NULL);
if(!ddhi)
{
@@ -259,7 +262,6 @@ void ImGUI::Draw(HTexture renderTarget)
pixelRC.texture = (uint32_t)cmd->TextureId & 0xFFFF;
pixelRC.sampler = GetSamplerIndex(TW_CLAMP_TO_EDGE, TextureFilter::Linear);
pixelRC.mip = (float)(((uint32_t)cmd->TextureId >> 16) & 0xFFFF);
- pixelRC.colorScale = tr.identityLight;
if(ddhi)
{
CmdSetGraphicsRootConstants(sizeof(vertexRC), sizeof(pixelRC), &pixelRC);
diff --git a/code/renderer/tr_gui.cpp b/code/renderer/tr_gui.cpp
index bd970ce..079b57e 100644
--- a/code/renderer/tr_gui.cpp
+++ b/code/renderer/tr_gui.cpp
@@ -231,11 +231,6 @@ static ImVec4 GetColorFromCPMACode(char colorCode)
return color;
}
-static float InverseToneMap(float x)
-{
- return powf(x / r_brightness->value, r_gamma->value);
-}
-
static bool CPMAColorCodeButton(const char* title, const char* id, char& currentColor)
{
const char* const popupId = va("##color_popup_%s", id);
@@ -278,10 +273,7 @@ static bool CPMAColorCodeButton(const char* title, const char* id, char& current
const char colorCode = row[x];
const ImGuiColorEditFlags buttonFlags = ImGuiColorEditFlags_InputRGB | ImGuiColorEditFlags_NoAlpha;
- ImVec4 color = GetColorFromCPMACode(colorCode);
- color.x = InverseToneMap(color.x);
- color.y = InverseToneMap(color.y);
- color.z = InverseToneMap(color.z);
+ const ImVec4 color = GetColorFromCPMACode(colorCode);
if(ImGui::ColorButton(va("%c", colorCode), color, buttonFlags))
{
currentColor = colorCode;
diff --git a/code/shadercomp/shadercomp.cpp b/code/shadercomp/shadercomp.cpp
index 15d3911..b3b31bb 100644
--- a/code/shadercomp/shadercomp.cpp
+++ b/code/shadercomp/shadercomp.cpp
@@ -384,6 +384,7 @@ void ProcessGRP()
CompileGraphics("ui.h", "ui.hlsl", "ui");
CompileGraphics("depth_pre_pass.h", "depth_pre_pass.hlsl", "zpp");
CompileGraphics("dynamic_light.h", "dynamic_light.hlsl", "dl");
+ CompileGraphics("blit.h", "blit.hlsl", "blit");
CompileVertexShader("fog.h", "fog_inside.hlsl", "fog");
CompilePixelShader("fog_inside.h", "fog_inside.hlsl", "fog_inside");
CompilePixelShader("fog_outside.h", "fog_outside.hlsl", "fog_outside");
diff --git a/makefiles/windows_vs2019/renderer.vcxproj b/makefiles/windows_vs2019/renderer.vcxproj
index 78b9ebb..5478a74 100644
--- a/makefiles/windows_vs2019/renderer.vcxproj
+++ b/makefiles/windows_vs2019/renderer.vcxproj
@@ -147,6 +147,7 @@
+
@@ -394,6 +395,9 @@
true
+
+ true
+
true
diff --git a/makefiles/windows_vs2019/renderer.vcxproj.filters b/makefiles/windows_vs2019/renderer.vcxproj.filters
index 7b58b38..064a429 100644
--- a/makefiles/windows_vs2019/renderer.vcxproj.filters
+++ b/makefiles/windows_vs2019/renderer.vcxproj.filters
@@ -53,6 +53,7 @@
+
@@ -300,6 +301,9 @@
shaders\crp
+
+ shaders\grp
+
shaders\grp
diff --git a/makefiles/windows_vs2022/renderer.vcxproj b/makefiles/windows_vs2022/renderer.vcxproj
index 46598e1..01c0d63 100644
--- a/makefiles/windows_vs2022/renderer.vcxproj
+++ b/makefiles/windows_vs2022/renderer.vcxproj
@@ -149,6 +149,7 @@
+
@@ -396,6 +397,9 @@
true
+
+ true
+
true
diff --git a/makefiles/windows_vs2022/renderer.vcxproj.filters b/makefiles/windows_vs2022/renderer.vcxproj.filters
index 7b58b38..064a429 100644
--- a/makefiles/windows_vs2022/renderer.vcxproj.filters
+++ b/makefiles/windows_vs2022/renderer.vcxproj.filters
@@ -53,6 +53,7 @@
+
@@ -300,6 +301,9 @@
shaders\crp
+
+ shaders\grp
+
shaders\grp