diff --git a/Content/core/shaders/pbr.mshdr b/Content/core/shaders/pbr.mshdr index 8a558958..51c3a009 100644 --- a/Content/core/shaders/pbr.mshdr +++ b/Content/core/shaders/pbr.mshdr @@ -16,6 +16,8 @@ Common struct FS_IN { + float4 vPosition : SV_POSITION; + float3 vColor : COLOR; float3 vPositionWS : TEXCOORD0; float3 vCameraWS : TEXCOORD1; @@ -32,7 +34,7 @@ Common }; // Push constants block - cbuffer PushConstants + [[vk::push_constant]] cbuffer PushConstants { float4 data; @@ -59,6 +61,7 @@ Vertex float3 vBitangent : BINORMAL; }; + [shader("vertex")] FS_IN main(VS_IN input) { FS_IN output; @@ -67,7 +70,7 @@ Vertex output.vPositionWS = mul(float4(input.vPosition, 1.0f), model_matrix).xyz; output.vCameraWS = vCameraPosWS; output.vColor = input.vColor; - output.vTexCoord = input.vTexCoord; + output.vTexCoord = input.vTexCoord * float2( -1, 1 ); output.vNormalWS = input.vNormal; // Calculate TBN matrix for lighting @@ -95,6 +98,8 @@ Vertex // Finish - transform into clip space float4 position = mul(float4(input.vPosition, 1.0f), render_matrix); + output.vPosition = position; + return output; } } @@ -103,13 +108,13 @@ Fragment { #define PI 3.14159265359 - Texture2D diffuseTexture : register(t0); - Texture2D normalTexture : register(t1); - Texture2D ambientOcclusionTexture : register(t2); - Texture2D metalnessTexture : register(t3); - Texture2D roughnessTexture : register(t4); + [[vk::binding(0, 0)]] Texture2D diffuseTexture; + [[vk::binding(1, 0)]] Texture2D normalTexture; + [[vk::binding(2, 0)]] Texture2D ambientOcclusionTexture; + [[vk::binding(3, 0)]] Texture2D metalnessTexture; + [[vk::binding(4, 0)]] Texture2D roughnessTexture; - SamplerState samplerState : register(s0); + [[vk::binding(6, 0)]] SamplerState samplerState; float3 fresnelSchlick(float cosTheta, float3 F0) { @@ -207,6 +212,7 @@ Fragment return lerp(v / (1.0f + l), tv, tv); } + [shader("fragment")] float4 main(FS_IN input) : SV_TARGET { // Collect material properties diff --git a/Content/core/shaders/tonemap/agx.mshdr b/Content/core/shaders/tonemap/agx.mshdr deleted file mode 100644 index 14326617..00000000 --- a/Content/core/shaders/tonemap/agx.mshdr +++ /dev/null @@ -1,53 +0,0 @@ -Shader -{ - Name = "AgX Shader"; - Description = "AgX Tonemap Shader"; -} - -Common -{ - // Empty -} - -Vertex -{ - struct fs_in - { - vec2 vTexCoord; - }; - - layout (location = 0) in vec3 vPosition; - layout (location = 1) in vec2 vTexCoord; - - layout (location = 0) out fs_in vs_out; - - void main() - { - vs_out.vTexCoord = vTexCoord; - gl_Position = vec4( vPosition, 1.0 ); - } -} - -Fragment -{ - struct fs_in - { - vec2 vTexCoord; - }; - - layout (location = 0) in fs_in vs_out; - layout (location = 0) out vec4 outFragColor; - - layout (set = 0, binding = 0) uniform sampler2D renderTexture; - - vec3 sampleTexture( sampler2D target ) - { - return texture( target, vs_out.vTexCoord.xy ).rgb; - } - - void main() - { - vec3 fragColor = sampleTexture( renderTexture ); - outFragColor = vec4(fragColor, 1.0f); - } -} \ No newline at end of file diff --git a/Content/core/shaders/ui/ui.mshdr b/Content/core/shaders/ui/ui.mshdr deleted file mode 100644 index 29e3d028..00000000 --- a/Content/core/shaders/ui/ui.mshdr +++ /dev/null @@ -1,223 +0,0 @@ -Shader -{ - Name = "UI Shader"; - Description = "Uber shader for UI elements"; -} - -Common -{ - #pragma optionNV (unroll all) - - #define DEBUG_VIEW_NONE 0 - #define DEBUG_VIEW_DIFFUSE 1 - #define DEBUG_VIEW_NORMAL 2 - #define DEBUG_VIEW_AMBIENTOCCLUSION 3 - #define DEBUG_VIEW_METALNESS 4 - #define DEBUG_VIEW_ROUGHNESS 5 - #define DEBUG_VIEW_OTHER 63 - - // - // Common - // - #define PI 3.14159 - - // - // Uniforms - // - layout( set = 0, binding = 0 ) uniform sampler2D g_tAtlas; - - struct VS_OUT { - vec3 vPositionWS; - vec3 vPositionPS; - vec2 vTexCoords; - vec4 vColor; - float flScreenPxRange; - vec2 vPanelPos; - vec2 vPanelSize; - }; - - //push constants block - layout( push_constant ) uniform constants - { - vec4 data; // 4 - - mat4 model_matrix; // 16 - - mat4 render_matrix; // 16 - - vec3 vCameraPosWS; // 3 - float flTime; // 1 - - vec4[4] vLightInfoWS; // 16 - } PushConstants; - - // - // Flags - // - // GraphicsFlags - const uint None = 0; - const uint UseRawImage = 1; - const uint UseSdf = 2; - const uint HighDistMul = 4; - // const uint Rounded = 8; - - const uint RoundedTopLeft = 8; - const uint RoundedTopRight = 16; - const uint RoundedBottomLeft = 32; - const uint RoundedBottomRight = 64; - - const uint Border = 128; -} - -Vertex -{ - // - // Layout - // - layout( location = 0 ) in vec3 g_vPosition; - layout( location = 1 ) in vec2 g_vTexCoords; - layout( location = 2 ) in vec4 g_vColor; - layout( location = 3 ) in vec2 g_vPanelPos; - layout( location = 4 ) in vec2 g_vPanelSize; - layout( location = 5 ) in int g_flags; - - // - // Out - // - layout( location = 0 ) out VS_OUT vs_out; - layout( location = 8 ) flat out int vs_flags; - layout( location = 9 ) flat out float vs_rounding; - - void main() { - vec4 pos = vec4( g_vPosition.xy, 0.0, 1.0 ); - - vs_out.vPositionWS = g_vPosition; - vs_out.vPositionPS = pos.xyz; - vs_out.vTexCoords = g_vTexCoords; - vs_out.vColor = g_vColor; - vs_out.vPanelPos = g_vPanelPos; - vs_out.vPanelSize = g_vPanelSize; - - //C#: - //var flagsInt = (int)flags; - //flagsInt |= (int)rounding << 16; - // - - vs_flags = g_flags & 0xFFFF; - vs_rounding = (g_flags >> 16); - - gl_Position = pos; - } -} - -Fragment -{ - // - // In - // - layout( location = 0 ) in VS_OUT fs_in; - layout( location = 8 ) flat in int fs_flags; - layout( location = 9 ) flat in float fs_rounding; - - // - // Out - // - layout( location = 0 ) out vec4 fragColor; - - vec4 GetTextureSample( sampler2D tex ) - { - return texture( tex, fs_in.vTexCoords ); - } - - float sdRoundedBox( in vec2 p, in vec2 b, in vec4 r ) - { - r.xy = (p.x>0.0)?r.xy : r.zw; - r.x = (p.y>0.0)?r.x : r.y; - vec2 q = abs(p)-b+r.x; - return min(max(q.x,q.y),0.0) + length(max(q,0.0)) - r.x; - } - - float sdBox( in vec2 p, in vec2 b ) - { - vec2 d = abs(p) - b; - return min(max(d.x,d.y),0.0) + length(max(d,0.0)); - } - - void main() - { - vec4 texSample = GetTextureSample( g_tAtlas ); - - if ( (fs_flags & UseRawImage) == UseRawImage ) - { - fragColor = texSample; - } - else - { - float opacity = 1.0; - - if ( (fs_flags & UseSdf) == UseSdf ) - { - float r = texSample.r; - float g = texSample.g; - float b = texSample.b; - - float median = max(min(r, g), min(max(r, g), b)); - float signed_dist = median; - - float mul = fs_in.vPanelSize.y / 3.0; - - signed_dist *= mul; - opacity = clamp( signed_dist, 0.0, 1.0 ); - } - - fragColor = vec4( fs_in.vColor.rgb, opacity * fs_in.vColor.a ); - } - - bool rounded = (fs_flags & RoundedTopLeft) == RoundedTopLeft - || (fs_flags & RoundedTopRight) == RoundedTopRight - || (fs_flags & RoundedBottomLeft) == RoundedBottomLeft - || (fs_flags & RoundedBottomRight) == RoundedBottomRight; - - if ( rounded ) - { - vec2 uv = ( fs_in.vPanelPos * 2.0 ) - fs_in.vPanelSize; - vec4 rounding = vec4( fs_rounding ); - - if ( (fs_flags & RoundedTopLeft) != RoundedTopLeft ) - rounding.w *= 0.0; - if ( (fs_flags & RoundedBottomLeft) != RoundedBottomLeft ) - rounding.z *= 0.0; - if ( (fs_flags & RoundedBottomRight) != RoundedBottomRight ) - rounding.x *= 0.0; - if ( (fs_flags & RoundedTopRight) != RoundedTopRight ) - rounding.y *= 0.0; - - vec2 size = fs_in.vPanelSize; - - float r = sdRoundedBox( uv, size, rounding ); - float a = clamp( r + 0.5, 0.0, 1.0 ); - - fragColor.a *= 1.0 - a; - } - - if ( (fs_flags & Border) == Border ) - { - vec2 uv = ( fs_in.vPanelPos * 2.0 ) - fs_in.vPanelSize; - vec2 size = fs_in.vPanelSize; - - float r = sdBox( uv, size ); - float a = clamp( r + 0.5, 0.0, 1.0 ); - - fragColor.rgb = smoothstep( 1.0, 0.99, a ).xxx; - } - - int debugView = int( floor( PushConstants.data.x ) ); - - if ( debugView == DEBUG_VIEW_DIFFUSE ) - fragColor = vec4( texSample.rgb, 1 ); - else if ( debugView == DEBUG_VIEW_NORMAL ) - fragColor.a = 1.0; - else if ( debugView == DEBUG_VIEW_OTHER ) - fragColor = vec4( fs_in.vTexCoords.x, fs_in.vTexCoords.y, 0, 1 ); - } -} \ No newline at end of file diff --git a/Samples/mocha-minimal/code/Game.cs b/Samples/mocha-minimal/code/Game.cs index 6cb1e118..b08f2bc9 100644 --- a/Samples/mocha-minimal/code/Game.cs +++ b/Samples/mocha-minimal/code/Game.cs @@ -15,7 +15,5 @@ public override void OnStartup() // Spawn a player var player = new Player(); player.Position = new Vector3( 0, 5, 10 ); - - _ = new PostProcess( "shaders/tonemap/agx.mshdr" ); } } diff --git a/Source/Mocha.Common/ShaderType.cs b/Source/Mocha.Common/ShaderType.cs new file mode 100644 index 00000000..7be5c71c --- /dev/null +++ b/Source/Mocha.Common/ShaderType.cs @@ -0,0 +1,7 @@ +namespace Mocha; + +public enum ShaderType +{ + Vertex, + Fragment +} diff --git a/Source/Mocha.Host/Managed/hostmanager.cpp b/Source/Mocha.Host/Managed/hostmanager.cpp index c48d9489..63afb843 100644 --- a/Source/Mocha.Host/Managed/hostmanager.cpp +++ b/Source/Mocha.Host/Managed/hostmanager.cpp @@ -176,7 +176,9 @@ inline void HostManager::Invoke( std::string _method, void* params, const char_t if (fnPtr == nullptr) { - spdlog::error( "Failed to load managed method {}", _method ); + spdlog::error( "Failed to load managed method {}, {}", _method, rc ); + __debugbreak(); + return; } // Invoke method diff --git a/Source/Mocha.Host/Rendering/Assets/material.cpp b/Source/Mocha.Host/Rendering/Assets/material.cpp index bca16000..9cfacc6d 100644 --- a/Source/Mocha.Host/Rendering/Assets/material.cpp +++ b/Source/Mocha.Host/Rendering/Assets/material.cpp @@ -89,6 +89,11 @@ void Material::CreateResources() descriptorInfo.bindings.push_back( bindingInfo ); } + DescriptorBindingInfo_t samplerBindingInfo = {}; + samplerBindingInfo.type = DESCRIPTOR_BINDING_TYPE_SAMPLER; + samplerBindingInfo.sampler = m_samplerType; + descriptorInfo.bindings.push_back( samplerBindingInfo ); + m_descriptor = Descriptor( descriptorInfo ); pipelineInfo.descriptors.push_back( &m_descriptor ); diff --git a/Source/Mocha.Host/Rendering/Platform/Vulkan/vkinit.h b/Source/Mocha.Host/Rendering/Platform/Vulkan/vkinit.h index c2d0a5b7..a653d90c 100644 --- a/Source/Mocha.Host/Rendering/Platform/Vulkan/vkinit.h +++ b/Source/Mocha.Host/Rendering/Platform/Vulkan/vkinit.h @@ -255,7 +255,7 @@ namespace VKInit } inline VkImageMemoryBarrier ImageMemoryBarrier( - VkAccessFlags accessMask, VkImageLayout oldLayout, VkImageLayout newLayout, VkImage image ) + VkAccessFlags accessMask, VkImageLayout oldLayout, VkImageLayout newLayout, VkImage image, VkImageAspectFlags aspectMask = VK_IMAGE_ASPECT_COLOR_BIT ) { VkImageMemoryBarrier imageMemoryBarrier = {}; imageMemoryBarrier.sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER; @@ -265,7 +265,7 @@ namespace VKInit imageMemoryBarrier.image = image; imageMemoryBarrier.subresourceRange = {}; - imageMemoryBarrier.subresourceRange.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT; + imageMemoryBarrier.subresourceRange.aspectMask = aspectMask; imageMemoryBarrier.subresourceRange.baseMipLevel = 0; imageMemoryBarrier.subresourceRange.levelCount = VK_REMAINING_MIP_LEVELS; imageMemoryBarrier.subresourceRange.baseArrayLayer = 0; diff --git a/Source/Mocha.Host/Rendering/Platform/Vulkan/vulkanrendercontext.cpp b/Source/Mocha.Host/Rendering/Platform/Vulkan/vulkanrendercontext.cpp index 25918dbb..b87cb35b 100644 --- a/Source/Mocha.Host/Rendering/Platform/Vulkan/vulkanrendercontext.cpp +++ b/Source/Mocha.Host/Rendering/Platform/Vulkan/vulkanrendercontext.cpp @@ -160,6 +160,19 @@ VulkanRenderTexture::VulkanRenderTexture( VulkanRenderContext* parent, RenderTex SetDebugName( "RenderTexture Image", VK_OBJECT_TYPE_IMAGE, ( uint64_t )image ); SetDebugName( "RenderTexture Image View", VK_OBJECT_TYPE_IMAGE_VIEW, ( uint64_t )imageView ); + + + m_parent->ImmediateSubmit( [&]( VkCommandBuffer cmd ) -> RenderStatus { + { + VkImageMemoryBarrier transitionBarrier = + VKInit::ImageMemoryBarrier( 0, VK_IMAGE_LAYOUT_UNDEFINED, VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL, image, GetAspectFlags( textureInfo.type ) ); + + vkCmdPipelineBarrier( cmd, VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT, VK_PIPELINE_STAGE_TRANSFER_BIT, 0, 0, nullptr, 0, + nullptr, 1, &transitionBarrier ); + } + + return RenderStatus::RENDER_STATUS_OK; + } ); } void VulkanRenderTexture::Delete() const @@ -476,6 +489,8 @@ VkSamplerCreateInfo VulkanSampler::GetCreateInfo( SamplerType samplerType ) return VKInit::SamplerCreateInfo( VK_FILTER_LINEAR, VK_SAMPLER_ADDRESS_MODE_REPEAT, false ); if ( samplerType == SAMPLER_TYPE_ANISOTROPIC ) return VKInit::SamplerCreateInfo( VK_FILTER_LINEAR, VK_SAMPLER_ADDRESS_MODE_REPEAT, true ); + if ( samplerType == SAMPLER_TYPE_BILINEAR ) + return VKInit::SamplerCreateInfo( VK_FILTER_LINEAR, VK_SAMPLER_ADDRESS_MODE_REPEAT, false ); __debugbreak(); // Invalid / unsupported sampler type. } @@ -693,6 +708,7 @@ vkb::PhysicalDevice VulkanRenderContext::CreatePhysicalDevice( vkb::Instance vkb // VkPhysicalDeviceFeatures requiredFeatures = {}; requiredFeatures.samplerAnisotropy = VK_TRUE; + requiredFeatures.geometryShader = VK_TRUE; selector = selector.set_required_features( requiredFeatures ); // @@ -853,7 +869,9 @@ void VulkanRenderContext::CreateRenderTargets() void VulkanRenderContext::CreateSamplers() { m_pointSampler = VulkanSampler( this, SAMPLER_TYPE_POINT ); + m_linearSampler = VulkanSampler( this, SAMPLER_TYPE_LINEAR ); m_anisoSampler = VulkanSampler( this, SAMPLER_TYPE_ANISOTROPIC ); + m_bilinearSampler = VulkanSampler( this, SAMPLER_TYPE_BILINEAR ); } void VulkanRenderContext::CreateImGuiIconFont() @@ -893,9 +911,10 @@ void VulkanRenderContext::CreateImGui() ImPlot::CreateContext(); auto& io = ImGui::GetIO(); + //io.FontGlobalScale = 1.0f / 1.25f; #define ADD_FONT( name, path, size ) \ - name = io.Fonts->AddFontFromFileTTF( path, size ); \ + name = io.Fonts->AddFontFromFileTTF( path, size * 1.25f ); \ CreateImGuiIconFont(); ADD_FONT( m_mainFont, "Content\\core\\fonts\\editor\\Inter-Regular.ttf", 14.0f ); @@ -1101,6 +1120,7 @@ void VulkanRenderContext::CreateFullScreenTri() DescriptorInfo_t descriptorInfo = {}; DescriptorBindingInfo_t colorTextureBinding = {}; + DescriptorBindingInfo_t samplerBinding = {}; // HACK: Horrific hack to get render textures working with descriptor sets for now VulkanImageTexture vkImageTexture; @@ -1114,8 +1134,10 @@ void VulkanRenderContext::CreateFullScreenTri() colorTextureBinding.texture = &m_fullScreenTri.imageTexture; colorTextureBinding.type = DESCRIPTOR_BINDING_TYPE_IMAGE; + samplerBinding.type = DESCRIPTOR_BINDING_TYPE_SAMPLER; + descriptorInfo.name = "Fullscreen triangle descriptor"; - descriptorInfo.bindings = std::vector{ colorTextureBinding }; + descriptorInfo.bindings = std::vector{ colorTextureBinding, samplerBinding }; m_fullScreenTri.descriptor = Descriptor( descriptorInfo ); @@ -1442,12 +1464,18 @@ RenderStatus VulkanRenderContext::EndRendering() BindDescriptor( m_fullScreenTri.descriptor ); DescriptorUpdateInfo_t updateInfo = {}; + updateInfo.type = DESCRIPTOR_BINDING_TYPE_IMAGE; updateInfo.binding = 0; - updateInfo.samplerType = SAMPLER_TYPE_POINT; updateInfo.src = &m_fullScreenTri.imageTexture; UpdateDescriptor( m_fullScreenTri.descriptor, updateInfo ); + updateInfo.type = DESCRIPTOR_BINDING_TYPE_SAMPLER; + updateInfo.binding = 1; + updateInfo.samplerType = SAMPLER_TYPE_ANISOTROPIC; + + UpdateDescriptor( m_fullScreenTri.descriptor, updateInfo ); + Draw( m_fullScreenTri.vertexCount, m_fullScreenTri.indexCount, 1 ); vkCmdEndRendering( cmd ); @@ -1538,17 +1566,38 @@ RenderStatus VulkanRenderContext::UpdateDescriptor( Descriptor d, DescriptorUpda BindDescriptor( d ); std::shared_ptr descriptor = m_descriptors.Get( d.m_handle ); - std::shared_ptr texture = m_imageTextures.Get( updateInfo.src->m_handle ); - VkDescriptorImageInfo imageInfo = {}; - imageInfo.imageLayout = VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL; - imageInfo.imageView = texture->imageView; - imageInfo.sampler = updateInfo.samplerType == SAMPLER_TYPE_ANISOTROPIC ? m_anisoSampler.sampler : m_pointSampler.sampler; // TODO + if (updateInfo.type == DESCRIPTOR_BINDING_TYPE_IMAGE) + { + std::shared_ptr texture = m_imageTextures.Get( updateInfo.src->m_handle ); + + VkDescriptorImageInfo imageInfo = {}; + imageInfo.imageLayout = VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL; + imageInfo.imageView = texture->imageView; + + auto descriptorWrite = VKInit::WriteDescriptorImage( + VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, descriptor->descriptorSet, &imageInfo, updateInfo.binding ); - auto descriptorWrite = VKInit::WriteDescriptorImage( - VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, descriptor->descriptorSet, &imageInfo, updateInfo.binding ); + vkUpdateDescriptorSets( m_device, 1, &descriptorWrite, 0, nullptr ); + } + else if (updateInfo.type == DESCRIPTOR_BINDING_TYPE_SAMPLER) + { + VkDescriptorImageInfo imageInfo = {}; + + if ( updateInfo.samplerType == SAMPLER_TYPE_ANISOTROPIC ) + imageInfo.sampler = m_anisoSampler.sampler; + else if ( updateInfo.samplerType == SAMPLER_TYPE_POINT ) + imageInfo.sampler = m_pointSampler.sampler; + else if ( updateInfo.samplerType == SAMPLER_TYPE_LINEAR ) + imageInfo.sampler = m_linearSampler.sampler; + else if ( updateInfo.samplerType == SAMPLER_TYPE_BILINEAR ) + imageInfo.sampler = m_bilinearSampler.sampler; - vkUpdateDescriptorSets( m_device, 1, &descriptorWrite, 0, nullptr ); + auto descriptorWrite = VKInit::WriteDescriptorImage( + VK_DESCRIPTOR_TYPE_SAMPLER, descriptor->descriptorSet, &imageInfo, updateInfo.binding ); + + vkUpdateDescriptorSets( m_device, 1, &descriptorWrite, 0, nullptr ); + } return RENDER_STATUS_OK; } @@ -1915,7 +1964,10 @@ VkDescriptorType VulkanDescriptor::GetDescriptorType( DescriptorBindingType type switch ( type ) { case DESCRIPTOR_BINDING_TYPE_IMAGE: - return VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER; + return VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE; + + case DESCRIPTOR_BINDING_TYPE_SAMPLER: + return VK_DESCRIPTOR_TYPE_SAMPLER; } __debugbreak(); // Invalid / unsupported descriptor binding type diff --git a/Source/Mocha.Host/Rendering/Platform/Vulkan/vulkanrendercontext.h b/Source/Mocha.Host/Rendering/Platform/Vulkan/vulkanrendercontext.h index 9b8e2c05..a2e11dc3 100644 --- a/Source/Mocha.Host/Rendering/Platform/Vulkan/vulkanrendercontext.h +++ b/Source/Mocha.Host/Rendering/Platform/Vulkan/vulkanrendercontext.h @@ -52,7 +52,7 @@ struct PSInput }; [[vk::binding(0, 0)]] Texture2D renderTexture; -[[vk::binding(0, 1)]] SamplerState textureSampler; +[[vk::binding(1, 0)]] SamplerState textureSampler; [shader("fragment")] float4 main(PSInput input) : SV_Target @@ -380,7 +380,7 @@ class VulkanRenderContext : public BaseRenderContext std::unordered_map> m_uploadContexts; VulkanSwapchain m_swapchain; - VulkanSampler m_anisoSampler, m_pointSampler; + VulkanSampler m_anisoSampler, m_pointSampler, m_linearSampler, m_bilinearSampler; std::shared_ptr GetUploadContext( std::thread::id thread ); diff --git a/Source/Mocha.Host/Rendering/baserendercontext.h b/Source/Mocha.Host/Rendering/baserendercontext.h index 477ceac7..3cae3baf 100644 --- a/Source/Mocha.Host/Rendering/baserendercontext.h +++ b/Source/Mocha.Host/Rendering/baserendercontext.h @@ -43,6 +43,7 @@ enum SamplerType { SAMPLER_TYPE_POINT, SAMPLER_TYPE_LINEAR, + SAMPLER_TYPE_BILINEAR, SAMPLER_TYPE_ANISOTROPIC }; @@ -55,7 +56,8 @@ enum BufferType enum DescriptorBindingType { - DESCRIPTOR_BINDING_TYPE_IMAGE + DESCRIPTOR_BINDING_TYPE_IMAGE, + DESCRIPTOR_BINDING_TYPE_SAMPLER, }; enum VertexAttributeFormat @@ -146,6 +148,7 @@ struct DescriptorBindingInfo_t { DescriptorBindingType type = DESCRIPTOR_BINDING_TYPE_IMAGE; ImageTexture* texture = nullptr; + SamplerType sampler{}; }; struct DescriptorInfo_t @@ -156,6 +159,7 @@ struct DescriptorInfo_t struct DescriptorUpdateInfo_t { + DescriptorBindingType type = DESCRIPTOR_BINDING_TYPE_IMAGE; int binding = 0; ImageTexture* src = nullptr; SamplerType samplerType = SAMPLER_TYPE_ANISOTROPIC; diff --git a/Source/Mocha.Host/Rendering/rendermanager.cpp b/Source/Mocha.Host/Rendering/rendermanager.cpp index 9ee75462..3456b7dd 100644 --- a/Source/Mocha.Host/Rendering/rendermanager.cpp +++ b/Source/Mocha.Host/Rendering/rendermanager.cpp @@ -152,13 +152,20 @@ void SceneMeshPass::Execute() for ( int i = 0; i < m.material->m_textures.size(); ++i ) { DescriptorUpdateInfo_t updateInfo = {}; + updateInfo.type = DESCRIPTOR_BINDING_TYPE_IMAGE; updateInfo.binding = i; - updateInfo.samplerType = m.material->m_samplerType; updateInfo.src = &m.material->m_textures[i].m_image; Globals::m_renderContext->UpdateDescriptor( m.material->m_descriptor, updateInfo ); } + DescriptorUpdateInfo_t samplerUpdateInfo = {}; + samplerUpdateInfo.type = DESCRIPTOR_BINDING_TYPE_SAMPLER; + samplerUpdateInfo.binding = m.material->m_textures.size(); + samplerUpdateInfo.samplerType = m.material->m_samplerType; + + Globals::m_renderContext->UpdateDescriptor( m.material->m_descriptor, samplerUpdateInfo ); + Globals::m_renderContext->BindVertexBuffer( m.vertexBuffer ); RenderPushConstants meshConstants = RenderPushConstants( m_constants ); diff --git a/Source/Mocha.Host/Rendering/shadercompiler.cpp b/Source/Mocha.Host/Rendering/shadercompiler.cpp index 7424cd4d..a541b7d4 100644 --- a/Source/Mocha.Host/Rendering/shadercompiler.cpp +++ b/Source/Mocha.Host/Rendering/shadercompiler.cpp @@ -1,5 +1,9 @@ #include "shadercompiler.h" +#include "baserendercontext.h" +#include +#include "spdlog/spdlog.h" + using namespace slang; ShaderCompiler::ShaderCompiler() @@ -17,9 +21,9 @@ bool ShaderCompiler::Compile( const ShaderType shaderType, const char* pShader, targetDesc.format = SLANG_SPIRV; if ( shaderType == SHADER_TYPE_FRAGMENT ) - targetDesc.profile = m_globalSession->findProfile( "fs_6_6" ); + targetDesc.profile = m_globalSession->findProfile( "spirv_1_3" ); else if ( shaderType == SHADER_TYPE_VERTEX ) - targetDesc.profile = m_globalSession->findProfile( "vs_6_6" ); + targetDesc.profile = m_globalSession->findProfile( "spirv_1_3" ); targetDesc.flags = SLANG_TARGET_FLAG_GENERATE_SPIRV_DIRECTLY | SLANG_TARGET_FLAG_GENERATE_WHOLE_PROGRAM; @@ -34,7 +38,7 @@ bool ShaderCompiler::Compile( const ShaderType shaderType, const char* pShader, session->loadModuleFromSourceString( "Shader", "Shader.slang", pShader, diagnostics.writeRef() ); if ( diagnostics ) - spdlog::error( "Failed to compile shader: {}", ( const char* )diagnostics->getBufferPointer() ); + spdlog::error( "Shader compiler: {}", ( const char* )diagnostics->getBufferPointer() ); spdlog::info( "Entry point count: {}", module->getDefinedEntryPointCount() ); @@ -47,7 +51,7 @@ bool ShaderCompiler::Compile( const ShaderType shaderType, const char* pShader, session->createCompositeComponentType( components, 2, program.writeRef(), diagnostics.writeRef() ); if ( diagnostics ) - spdlog::error( "Failed to compile shader: {}", ( const char* )diagnostics->getBufferPointer() ); + spdlog::error( "Shader compiler: {}", ( const char* )diagnostics->getBufferPointer() ); Slang::ComPtr linkedProgram; Slang::ComPtr diagnosticBlob; @@ -60,7 +64,7 @@ bool ShaderCompiler::Compile( const ShaderType shaderType, const char* pShader, linkedProgram->getEntryPointCode( entryPointIndex, targetIndex, kernelBlob.writeRef(), diagnostics.writeRef() ); if ( diagnostics ) - spdlog::error( "Failed to get code for shader: {}", ( const char* )diagnostics->getBufferPointer() ); + spdlog::error( "Shader compiler: {}", ( const char* )diagnostics->getBufferPointer() ); const uint32_t* data = static_cast( kernelBlob->getBufferPointer() ); size_t wordCount = kernelBlob->getBufferSize() / sizeof( uint32_t ); diff --git a/Source/Mocha.Host/Rendering/shadercompiler.h b/Source/Mocha.Host/Rendering/shadercompiler.h index 5bf33d61..54f07ecf 100644 --- a/Source/Mocha.Host/Rendering/shadercompiler.h +++ b/Source/Mocha.Host/Rendering/shadercompiler.h @@ -2,8 +2,9 @@ #include #include -#include -#include +#include + +#include "baserendercontext.h" using namespace slang; @@ -23,4 +24,12 @@ class ShaderCompiler } bool Compile( const ShaderType shaderType, const char* pshader, std::vector& outSpirv ); + + inline UtilArray CompileOffline( const ShaderType shaderType, const char* pshader ) + { + std::vector out; + Compile( shaderType, pshader, out ); + + return UtilArray::FromVector( out ); + } }; \ No newline at end of file diff --git a/Source/Mocha.Host/Util/utilarray.h b/Source/Mocha.Host/Util/utilarray.h index 86017fbe..eb5ac4ae 100644 --- a/Source/Mocha.Host/Util/utilarray.h +++ b/Source/Mocha.Host/Util/utilarray.h @@ -32,7 +32,9 @@ struct UtilArray UtilArray array; array.count = vec.size(); array.size = vec.size() * sizeof( T ); - array.data = vec.data(); + + array.data = new uint8_t[array.size]; + std::memcpy( array.data, vec.data(), array.size ); return array; } diff --git a/Source/Mocha.Hotload/Main.cs b/Source/Mocha.Hotload/Main.cs index dddb07bf..96404269 100644 --- a/Source/Mocha.Hotload/Main.cs +++ b/Source/Mocha.Hotload/Main.cs @@ -4,7 +4,6 @@ using Mocha.Hotload.Projects; using Mocha.Hotload.Upgrading; using Mocha.Hotload.Util; -using MochaTool.AssetCompiler; using System.Diagnostics; using System.Runtime.InteropServices; using System.Text; @@ -126,7 +125,7 @@ public static void Run( IntPtr args ) s_manifest.Resources.Content, "content\\core" ); - FileSystem.Mounted.AssetCompiler = new RuntimeAssetCompiler(); + // FileSystem.Mounted.AssetCompiler = new RuntimeAssetCompiler(); // Create assemblies. if ( isDedicatedServer ) diff --git a/Source/Mocha.sln b/Source/Mocha.sln index d2e7d714..a5a0a6db 100644 --- a/Source/Mocha.sln +++ b/Source/Mocha.sln @@ -25,7 +25,6 @@ EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Mocha.Host", "Mocha.Host\Mocha.Host.vcxproj", "{E07C31BC-2908-46EC-A186-D27077AA3EBA}" ProjectSection(ProjectDependencies) = postProject {05117E76-6DE2-4B04-BF23-93621AF84576} = {05117E76-6DE2-4B04-BF23-93621AF84576} - {06D1B36D-62C6-4687-A21B-7D1C36AC0D4F} = {06D1B36D-62C6-4687-A21B-7D1C36AC0D4F} {0FD2339A-B0C8-4AFC-B2AB-AF3C0DDCD6F2} = {0FD2339A-B0C8-4AFC-B2AB-AF3C0DDCD6F2} {4A73958E-BC60-4383-949B-4C57E1B484E1} = {4A73958E-BC60-4383-949B-4C57E1B484E1} {574073D7-C7B5-456F-8568-420E34A3A081} = {574073D7-C7B5-456F-8568-420E34A3A081} @@ -60,6 +59,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Mocha.Tests", "Mocha.Tests\ EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tests", "Tests", "{72F58AEF-9202-4AD4-8D52-8AA54B30550B}" EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MochaTool.ShaderCompilerBindings", "MochaTool.ShaderCompilerBindings\MochaTool.ShaderCompilerBindings.vcxproj", "{4851A29B-3D69-4702-841E-35F30F019296}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -202,6 +203,18 @@ Global {267A391D-CD51-4A29-A41B-11D57E9F9AAF}.Release|x64.Build.0 = Release|Any CPU {267A391D-CD51-4A29-A41B-11D57E9F9AAF}.Release|x86.ActiveCfg = Release|Any CPU {267A391D-CD51-4A29-A41B-11D57E9F9AAF}.Release|x86.Build.0 = Release|Any CPU + {4851A29B-3D69-4702-841E-35F30F019296}.Debug|Any CPU.ActiveCfg = Debug|x64 + {4851A29B-3D69-4702-841E-35F30F019296}.Debug|Any CPU.Build.0 = Debug|x64 + {4851A29B-3D69-4702-841E-35F30F019296}.Debug|x64.ActiveCfg = Debug|x64 + {4851A29B-3D69-4702-841E-35F30F019296}.Debug|x64.Build.0 = Debug|x64 + {4851A29B-3D69-4702-841E-35F30F019296}.Debug|x86.ActiveCfg = Debug|Win32 + {4851A29B-3D69-4702-841E-35F30F019296}.Debug|x86.Build.0 = Debug|Win32 + {4851A29B-3D69-4702-841E-35F30F019296}.Release|Any CPU.ActiveCfg = Release|x64 + {4851A29B-3D69-4702-841E-35F30F019296}.Release|Any CPU.Build.0 = Release|x64 + {4851A29B-3D69-4702-841E-35F30F019296}.Release|x64.ActiveCfg = Release|x64 + {4851A29B-3D69-4702-841E-35F30F019296}.Release|x64.Build.0 = Release|x64 + {4851A29B-3D69-4702-841E-35F30F019296}.Release|x86.ActiveCfg = Release|Win32 + {4851A29B-3D69-4702-841E-35F30F019296}.Release|x86.Build.0 = Release|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -220,6 +233,7 @@ Global {860C57C4-6E4B-445F-9614-9084AF4CD46B} = {40918016-AB8B-47EC-9B4C-EDF1532D3FAF} {40918016-AB8B-47EC-9B4C-EDF1532D3FAF} = {E5E9BDE7-3F7F-4044-ACFD-FE2F0F66AB53} {267A391D-CD51-4A29-A41B-11D57E9F9AAF} = {72F58AEF-9202-4AD4-8D52-8AA54B30550B} + {4851A29B-3D69-4702-841E-35F30F019296} = {CB07C6D5-36BE-4B1E-B29D-7372756F892F} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {501E447E-DCFC-42D2-AF68-88486D3529DD} diff --git a/Source/Mocha/main.cpp b/Source/Mocha/main.cpp index 2aa1b7b4..b4999e56 100644 --- a/Source/Mocha/main.cpp +++ b/Source/Mocha/main.cpp @@ -14,6 +14,8 @@ char* getCmdOption( char** begin, char** end, const std::string& option ); int APIENTRY WinMain( HINSTANCE hInst, HINSTANCE hInstPrev, LPSTR cmdline, int cmdshow ) { + SetProcessDPIAware(); + Globals::m_activeProjectPath = getCmdOption( __argv, __argv + __argc, "-project" ); Globals::m_isDedicatedServer = false; diff --git a/Source/MochaTool.AssetCompiler/Handlers/Shader/ShaderCompiler.cs b/Source/MochaTool.AssetCompiler/Handlers/Shader/ShaderCompiler.cs index 9881193c..7105a600 100644 --- a/Source/MochaTool.AssetCompiler/Handlers/Shader/ShaderCompiler.cs +++ b/Source/MochaTool.AssetCompiler/Handlers/Shader/ShaderCompiler.cs @@ -1,6 +1,7 @@ -using System.Text; -using Veldrid; -using Veldrid.SPIRV; +using Mocha; +using Mocha.Glue; +using System.Runtime.InteropServices; +using System.Text; namespace MochaTool.AssetCompiler; @@ -16,33 +17,28 @@ public partial class ShaderCompiler : BaseCompiler /// public override bool SupportsMochaFile => true; + [DllImport( "MochaTool.ShaderCompilerBindings.dll", CharSet = CharSet.Ansi )] + private static extern UtilArray CompileShader( ShaderType shaderType, string shaderSource ); + /// /// Compiles a shader from GLSL into SPIR-V using Veldrid's libshaderc bindings. /// /// Vulkan-compatible SPIR-V bytecode. - private int[] CompileShader( string? commonSource, string shaderSource, ShaderStages shaderStage, string debugName = "temp" ) + private int[] CompileShader( string? commonSource, string shaderSource, ShaderType shaderType, string debugName = "temp" ) { // // Prepend a preamble with GLSL version & macro definitions // var preamble = new StringBuilder(); - preamble.AppendLine( $"#version 460" ); preamble.AppendLine( commonSource ); - preamble.AppendLine(); - shaderSource = preamble.ToString() + shaderSource; - // - // Perform the compilation - // - var compileOptions = new GlslCompileOptions( false ); - var compileResult = SpirvCompilation.CompileGlslToSpirv( shaderSource, $"{debugName}_{shaderStage}.glsl", shaderStage, compileOptions ); + shaderSource = preamble.ToString() + shaderSource; - // Data will be in bytes, but we want it in 32-bit integers as that is what Vulkan expects - var dataBytes = compileResult.SpirvBytes; - var dataInts = new int[dataBytes.Length / 4]; - Buffer.BlockCopy( dataBytes, 0, dataInts, 0, dataBytes.Length ); + var shaderData = CompileShader( shaderType, shaderSource ); + var dataInts = new int[shaderData.count]; + Marshal.Copy( shaderData.data, dataInts, 0, dataInts.Length ); return dataInts; } @@ -62,13 +58,15 @@ public override CompileResult Compile( ref CompileInput input ) var shaderFormat = new ShaderInfo(); if ( shaderFile.Vertex != null ) - shaderFormat.VertexShaderData = CompileShader( shaderFile.Common, shaderFile.Vertex, ShaderStages.Vertex, debugName ); + shaderFormat.VertexShaderData = CompileShader( shaderFile.Common, shaderFile.Vertex, ShaderType.Vertex, debugName ); if ( shaderFile.Fragment != null ) - shaderFormat.FragmentShaderData = CompileShader( shaderFile.Common, shaderFile.Fragment, ShaderStages.Fragment, debugName ); + shaderFormat.FragmentShaderData = CompileShader( shaderFile.Common, shaderFile.Fragment, ShaderType.Fragment, debugName ); + /* if ( shaderFile.Compute != null ) shaderFormat.ComputeShaderData = CompileShader( shaderFile.Common, shaderFile.Compute, ShaderStages.Compute, debugName ); + */ // Wrapper for file. var mochaFile = new MochaFile diff --git a/Source/MochaTool.AssetCompiler/Properties/launchSettings.json b/Source/MochaTool.AssetCompiler/Properties/launchSettings.json index 742e1dda..b7a62881 100644 --- a/Source/MochaTool.AssetCompiler/Properties/launchSettings.json +++ b/Source/MochaTool.AssetCompiler/Properties/launchSettings.json @@ -4,7 +4,8 @@ "commandName": "Project", "commandLineArgs": "--mountpoints \"samples/mocha-minimal/content/\" \"content/core/\" -f", "workingDirectory": "$(SolutionDir)..", - "remoteDebugEnabled": false + "remoteDebugEnabled": false, + "nativeDebugging": true } } } \ No newline at end of file diff --git a/Source/MochaTool.InteropGen/Program.cs b/Source/MochaTool.InteropGen/Program.cs index 0c0fb723..1776b01f 100644 --- a/Source/MochaTool.InteropGen/Program.cs +++ b/Source/MochaTool.InteropGen/Program.cs @@ -163,9 +163,9 @@ private static async Task WriteNativeStructAsync( string baseDir, IEnumerable<(s nativeStructWriter.WriteLine( '{' ); nativeStructWriter.Indent++; - nativeStructWriter.WriteLine( "Root::GetInstance()," ); + nativeStructWriter.WriteLine( ".__Root = Root::GetInstance()," ); - nativeStructBody = string.Join( ",\r\n\t", methods.Select( x => $"(void*)__{x.Name}_{x.method.Hash}" ) ); + nativeStructBody = string.Join( ",\r\n\t", methods.Select( x => $".__{x.Name}_{x.method.Hash} = (void*)__{x.Name}_{x.method.Hash}" ) ); nativeStructWriter.Write( nativeStructBody ); nativeStructWriter.WriteLine(); diff --git a/Source/MochaTool.ShaderCompilerBindings/MochaTool.ShaderCompilerBindings.vcxproj b/Source/MochaTool.ShaderCompilerBindings/MochaTool.ShaderCompilerBindings.vcxproj new file mode 100644 index 00000000..9893cc1e --- /dev/null +++ b/Source/MochaTool.ShaderCompilerBindings/MochaTool.ShaderCompilerBindings.vcxproj @@ -0,0 +1,175 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + 17.0 + Win32Proj + {4851a29b-3d69-4702-841e-35f30f019296} + MochaToolShaderCompilerBindings + 10.0 + + + + DynamicLibrary + true + v143 + Unicode + + + DynamicLibrary + false + v143 + true + Unicode + + + DynamicLibrary + true + v143 + Unicode + + + DynamicLibrary + false + v143 + true + Unicode + + + + + + + + + + + + + + + + + + + + + $(VULKAN_SDK)\Include;$(SolutionDir)vcpkg_installed\$(Platform)-windows\include;$(SolutionDir)vcpkg_installed\$(Platform)-windows\include\SDL2;$(ExternalIncludePath);$(SolutionDir)Mocha.Host\Thirdparty\imgui;$(SolutionDir)Mocha.Host\ + $(SolutionDir)vcpkg_installed\$(Platform)-windows\lib;$(VC_LibraryPath_x64);$(WindowsSDK_LibraryPath_x64) + $(SolutionDir)..\build + + + true + + + x64-windows + + + + Level3 + true + WIN32;_DEBUG;MOCHATOOLSHADERCOMPILERBINDINGS_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) + true + Use + pch.h + + + Windows + true + false + + + + + Level3 + true + true + true + WIN32;NDEBUG;MOCHATOOLSHADERCOMPILERBINDINGS_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) + true + Use + pch.h + + + Windows + true + true + true + false + + + + + Level3 + true + _DEBUG;MOCHATOOLSHADERCOMPILERBINDINGS_EXPORTS;_WINDOWS;_USRDLL;_SILENCE_ALL_MS_EXT_DEPRECATION_WARNINGS;%(PreprocessorDefinitions) + true + Use + pch.h + stdcpp20 + stdc17 + + + Windows + true + false + + + + + Level3 + true + true + true + NDEBUG;MOCHATOOLSHADERCOMPILERBINDINGS_EXPORTS;_WINDOWS;_USRDLL;_SILENCE_ALL_MS_EXT_DEPRECATION_WARNINGS;%(PreprocessorDefinitions) + true + Use + pch.h + + + Windows + true + true + true + false + + + + + + + + + + Create + Create + Create + Create + + + + + {e07c31bc-2908-46ec-a186-d27077aa3eba} + + + + + + \ No newline at end of file diff --git a/Source/MochaTool.ShaderCompilerBindings/MochaTool.ShaderCompilerBindings.vcxproj.filters b/Source/MochaTool.ShaderCompilerBindings/MochaTool.ShaderCompilerBindings.vcxproj.filters new file mode 100644 index 00000000..1e57c7b1 --- /dev/null +++ b/Source/MochaTool.ShaderCompilerBindings/MochaTool.ShaderCompilerBindings.vcxproj.filters @@ -0,0 +1,33 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + + + Header Files + + + Header Files + + + + + Source Files + + + Source Files + + + \ No newline at end of file diff --git a/Source/MochaTool.ShaderCompilerBindings/dllmain.cpp b/Source/MochaTool.ShaderCompilerBindings/dllmain.cpp new file mode 100644 index 00000000..1457c06c --- /dev/null +++ b/Source/MochaTool.ShaderCompilerBindings/dllmain.cpp @@ -0,0 +1,9 @@ +#include "pch.h" +#include "Util/utilarray.h" +#include "Rendering/baserendercontext.h" +#include "Rendering/shadercompiler.h" + +extern "C" __declspec( dllexport ) UtilArray CompileShader( const ShaderType shaderType, const char* pshader ) +{ + return ShaderCompiler::Instance().CompileOffline( shaderType, pshader ); +} \ No newline at end of file diff --git a/Source/MochaTool.ShaderCompilerBindings/framework.h b/Source/MochaTool.ShaderCompilerBindings/framework.h new file mode 100644 index 00000000..54b83e94 --- /dev/null +++ b/Source/MochaTool.ShaderCompilerBindings/framework.h @@ -0,0 +1,5 @@ +#pragma once + +#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers +// Windows Header Files +#include diff --git a/Source/MochaTool.ShaderCompilerBindings/pch.cpp b/Source/MochaTool.ShaderCompilerBindings/pch.cpp new file mode 100644 index 00000000..64b7eef6 --- /dev/null +++ b/Source/MochaTool.ShaderCompilerBindings/pch.cpp @@ -0,0 +1,5 @@ +// pch.cpp: source file corresponding to the pre-compiled header + +#include "pch.h" + +// When you are using pre-compiled headers, this source file is necessary for compilation to succeed. diff --git a/Source/MochaTool.ShaderCompilerBindings/pch.h b/Source/MochaTool.ShaderCompilerBindings/pch.h new file mode 100644 index 00000000..885d5d62 --- /dev/null +++ b/Source/MochaTool.ShaderCompilerBindings/pch.h @@ -0,0 +1,13 @@ +// pch.h: This is a precompiled header file. +// Files listed below are compiled only once, improving build performance for future builds. +// This also affects IntelliSense performance, including code completion and many code browsing features. +// However, files listed here are ALL re-compiled if any one of them is updated between builds. +// Do not add files here that you will be updating frequently as this negates the performance advantage. + +#ifndef PCH_H +#define PCH_H + +// add headers that you want to pre-compile here +#include "framework.h" + +#endif //PCH_H