<commit_before>#include "FullScreen.h"
#include "ShaderFactory.hpp"

using namespace Device;
using namespace Rendering::PostProcessing;
using namespace Rendering::Shader;
using namespace Rendering::Texture;
using namespace Rendering::Manager;
using namespace Rendering::RenderState;

void FullScreen::Initialize(Device::DirectX& dx, const InitParam& param, ShaderManager& shaderManager)
{
	std::string folderPath = "";
	{
		Factory::ShaderFactory pathFinder(nullptr);

		std::string path = pathFinder.FetchShaderFullPath(param.shaderFileName);

		Utility::String::ParseDirectory(path, &folderPath, nullptr, nullptr);
	}
	assert(folderPath.empty() == false);// "Error!, Invalid File Path"

#pragma region MacroKey
	std::vector<ShaderMacro> vsMacro;

	std::string vsKey	= "FullScreenVS";
	_psUniqueKey		= param.shaderFileName + ":" + param.psName;

	// VS
	{
		if (param.useViewInfo)
		{
			vsMacro.emplace_back("USE_VIEW_INFORMATION");
			vsKey += ":[ViewInfoMacro]:";
		}

		if (param.useMSAAMacro)
		{
			vsMacro.push_back(dx.GetMSAAShaderMacro());

			constexpr char* key = ":[MSAA]:";
			vsKey += key;
			_psUniqueKey += key;
		}
	}

	if (param.psMacros)
	{
		for (auto iter : (*param.psMacros))
			_psUniqueKey += ":[" + iter.GetName() + "/" + iter.GetDefinition() + "]";
	}
#pragma endregion MacroKey

#pragma region VertexShader
	if (shaderManager.GetPool<VertexShader>().Has(vsKey) == false)
	{
		// Setting Vertex Shader
		{
			std::vector<D3D11_INPUT_ELEMENT_DESC> nullDeclations;

			auto blob = shaderManager.GetCompiler().CreateBlob(folderPath, param.shaderFileName, "vs", "FullScreenVS", false, &vsMacro);
			_vs = std::make_shared<VertexShader>(blob, vsKey);
			_vs->Initialize(dx, nullDeclations);

			shaderManager.GetPool<VertexShader>().Add(vsKey, _vs);
		}
	}
#pragma endregion VertexShader

#pragma region PixelShader
	if (shaderManager.GetPool<PixelShader>().Has(_psUniqueKey) == false)
	{
		auto blob = shaderManager.GetCompiler().CreateBlob(folderPath, param.shaderFileName, "vs", "FullScreenVS", false, param.psMacros);
		_ps = std::make_shared<PixelShader>(blob, _psUniqueKey);
		_ps->Initialize(dx);

		shaderManager.GetPool<PixelShader>().Add(_psUniqueKey, _ps);
	}
#pragma endregion PixelShader
}

void FullScreen::Render(Device::DirectX& dx, RenderTexture& outResultRT, bool useOutRTViewportSize) const
{
	if(useOutRTViewportSize)
	{
		const auto& size = outResultRT.GetSize().Cast<float>();
		dx.SetViewport(Rect<float>(0.0f, 0.0f, size.w, size.h));
	}

	dx.SetRenderTarget(outResultRT);
	dx.SetDepthStencilState(DepthState::DisableDepthTest, 0);
	dx.SetBlendState(BlendState::Opaque);

	_vs->BindShaderToContext(dx);
	_vs->BindInputLayoutToContext(dx);
	
	_ps->BindShaderToContext(dx);

	dx.SetPrimitiveTopology(PrimitiveTopology::TriangleStrip);
	dx.SetRasterizerState(RasterizerState::CWDefault);
<commit_msg>FullScreen - ps 컴파일 버그 수정<commit_after>#include "FullScreen.h"
#include "ShaderFactory.hpp"

using namespace Device;
using namespace Rendering::PostProcessing;
using namespace Rendering::Shader;
using namespace Rendering::Texture;
using namespace Rendering::Manager;
using namespace Rendering::RenderState;

void FullScreen::Initialize(Device::DirectX& dx, const InitParam& param, ShaderManager& shaderManager)
{
	std::string folderPath = "";
	{
		Factory::ShaderFactory pathFinder(nullptr);

		std::string path = pathFinder.FetchShaderFullPath(param.shaderFileName);

		Utility::String::ParseDirectory(path, &folderPath, nullptr, nullptr);
	}
	assert(folderPath.empty() == false);// "Error!, Invalid File Path"

#pragma region MacroKey
	std::vector<ShaderMacro> vsMacro;

	std::string vsKey	= "FullScreenVS";
	_psUniqueKey		= param.shaderFileName + ":" + param.psName;

	// VS
	{
		if (param.useViewInfo)
		{
			vsMacro.emplace_back("USE_VIEW_INFORMATION");
			vsKey += ":[ViewInfoMacro]:";
		}

		if (param.useMSAAMacro)
		{
			vsMacro.push_back(dx.GetMSAAShaderMacro());

			constexpr char* key = ":[MSAA]:";
			vsKey += key;
			_psUniqueKey += key;
		}
	}

	if (param.psMacros)
	{
		for (auto iter : (*param.psMacros))
			_psUniqueKey += ":[" + iter.GetName() + "/" + iter.GetDefinition() + "]";
	}
#pragma endregion MacroKey

#pragma region VertexShader
	if (shaderManager.GetPool<VertexShader>().Has(vsKey) == false)
	{
		// Setting Vertex Shader
		{
			std::vector<D3D11_INPUT_ELEMENT_DESC> nullDeclations;

			auto blob = shaderManager.GetCompiler().CreateBlob(folderPath, param.shaderFileName, "vs", "FullScreenVS", false, &vsMacro);
			_vs = std::make_shared<VertexShader>(blob, vsKey);
			_vs->Initialize(dx, nullDeclations);

			shaderManager.GetPool<VertexShader>().Add(vsKey, _vs);
		}
	}
#pragma endregion VertexShader

#pragma region PixelShader
	if (shaderManager.GetPool<PixelShader>().Has(_psUniqueKey) == false)
	{
		auto blob = shaderManager.GetCompiler().CreateBlob(folderPath, param.shaderFileName, "ps", param.psName, false, param.psMacros);
		_ps = std::make_shared<PixelShader>(blob, _psUniqueKey);
		_ps->Initialize(dx);

		shaderManager.GetPool<PixelShader>().Add(_psUniqueKey, _ps);
	}
#pragma endregion PixelShader
}

void FullScreen::Render(Device::DirectX& dx, RenderTexture& outResultRT, bool useOutRTViewportSize) const
{
	if(useOutRTViewportSize)
	{
		const auto& size = outResultRT.GetSize().Cast<float>();
		dx.SetViewport(Rect<float>(0.0f, 0.0f, size.w, size.h));
	}

	dx.SetRenderTarget(outResultRT);
	dx.SetDepthStencilState(DepthState::DisableDepthTest, 0);
	dx.SetBlendState(BlendState::Opaque);

	_vs->BindShaderToContext(dx);
	_vs->BindInputLayoutToContext(dx);
	
	_ps->BindShaderToContext(dx);

	dx.SetPrimitiveTopology(PrimitiveTopology::TriangleStrip);
	dx.SetRasterizerState(RasterizerState::CWDefault);

{'fraction_non_alphanumeric': 0.1429574991218827, 'fraction_numerical': 0.0028099754127151387, 'mean_word_length': 6.083333333333333, 'pattern_counts': {'":': 8, '<': 23, '<?xml version=': 0, '>': 33, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3017219', 'n_tokens_mistral': 2084, 'n_tokens_neox': 1980, 'n_words': 334}