diff options
| author | Egor Yusov <egor.yusov@gmail.com> | 2019-04-06 15:49:17 +0000 |
|---|---|---|
| committer | Egor Yusov <egor.yusov@gmail.com> | 2019-04-06 15:49:17 +0000 |
| commit | 696a3cbb5a5f30d2f5000c0db90125d614ea09ca (patch) | |
| tree | f1c03f120f1cccfa94a583801179212d32d20711 /Graphics/GraphicsTools | |
| parent | Added API info query (diff) | |
| download | DiligentCore-696a3cbb5a5f30d2f5000c0db90125d614ea09ca.tar.gz DiligentCore-696a3cbb5a5f30d2f5000c0db90125d614ea09ca.zip | |
Made IShaderSourceInputStreamFactory derived from IObject (upgraded API Version to 240021)
Diffstat (limited to 'Graphics/GraphicsTools')
| -rw-r--r-- | Graphics/GraphicsTools/CMakeLists.txt | 2 | ||||
| -rw-r--r-- | Graphics/GraphicsTools/include/BasicShaderSourceStreamFactory.h | 41 | ||||
| -rw-r--r-- | Graphics/GraphicsTools/src/BasicShaderSourceStreamFactory.cpp | 87 |
3 files changed, 0 insertions, 130 deletions
diff --git a/Graphics/GraphicsTools/CMakeLists.txt b/Graphics/GraphicsTools/CMakeLists.txt index c6f2144e..05061415 100644 --- a/Graphics/GraphicsTools/CMakeLists.txt +++ b/Graphics/GraphicsTools/CMakeLists.txt @@ -3,7 +3,6 @@ cmake_minimum_required (VERSION 3.6) project(GraphicsTools CXX) set(INCLUDE - include/BasicShaderSourceStreamFactory.h include/CommonlyUsedStates.h include/GraphicsUtilities.h include/pch.h @@ -14,7 +13,6 @@ set(INCLUDE ) set(SOURCE - src/BasicShaderSourceStreamFactory.cpp src/GraphicsUtilities.cpp src/ScreenCapture.cpp src/pch.cpp diff --git a/Graphics/GraphicsTools/include/BasicShaderSourceStreamFactory.h b/Graphics/GraphicsTools/include/BasicShaderSourceStreamFactory.h deleted file mode 100644 index 625df71f..00000000 --- a/Graphics/GraphicsTools/include/BasicShaderSourceStreamFactory.h +++ /dev/null @@ -1,41 +0,0 @@ -/* Copyright 2015-2019 Egor Yusov - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF ANY PROPRIETARY RIGHTS. - * - * In no event and under no legal theory, whether in tort (including negligence), - * contract, or otherwise, unless required by applicable law (such as deliberate - * and grossly negligent acts) or agreed to in writing, shall any Contributor be - * liable for any damages, including any direct, indirect, special, incidental, - * or consequential damages of any character arising as a result of this License or - * out of the use or inability to use the software (including but not limited to damages - * for loss of goodwill, work stoppage, computer failure or malfunction, or any and - * all other commercial damages or losses), even if such Contributor has been advised - * of the possibility of such damages. - */ - -#pragma once - -#include "../../../Common/interface/BasicFileStream.h" -#include "../../GraphicsEngine/interface/Shader.h" - -namespace Diligent -{ - class BasicShaderSourceStreamFactory : public IShaderSourceInputStreamFactory - { - public: - BasicShaderSourceStreamFactory( const Char *SearchDirectories = nullptr ); - - virtual void CreateInputStream( const Char *Name, IFileStream **ppStream )override; - - private: - std::vector<String> m_SearchDirectories; - }; -} diff --git a/Graphics/GraphicsTools/src/BasicShaderSourceStreamFactory.cpp b/Graphics/GraphicsTools/src/BasicShaderSourceStreamFactory.cpp deleted file mode 100644 index 43c6baae..00000000 --- a/Graphics/GraphicsTools/src/BasicShaderSourceStreamFactory.cpp +++ /dev/null @@ -1,87 +0,0 @@ -/* Copyright 2015-2019 Egor Yusov - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF ANY PROPRIETARY RIGHTS. - * - * In no event and under no legal theory, whether in tort (including negligence), - * contract, or otherwise, unless required by applicable law (such as deliberate - * and grossly negligent acts) or agreed to in writing, shall any Contributor be - * liable for any damages, including any direct, indirect, special, incidental, - * or consequential damages of any character arising as a result of this License or - * out of the use or inability to use the software (including but not limited to damages - * for loss of goodwill, work stoppage, computer failure or malfunction, or any and - * all other commercial damages or losses), even if such Contributor has been advised - * of the possibility of such damages. - */ - -#include "pch.h" -#include "BasicShaderSourceStreamFactory.h" -#include "RefCntAutoPtr.h" - -namespace Diligent -{ - BasicShaderSourceStreamFactory::BasicShaderSourceStreamFactory( const Char *SearchDirectories ) - { - while( SearchDirectories ) - { - const char* Semicolon = strchr( SearchDirectories, ';' ); - String SearchPath; - if( Semicolon == nullptr ) - { - SearchPath = SearchDirectories; - SearchDirectories = nullptr; - } - else - { - SearchPath = String( SearchDirectories, Semicolon ); - SearchDirectories = Semicolon + 1; - } - - if( SearchPath.length() > 0 ) - { - if( SearchPath.back() != '\\' && SearchPath.back() != '/' ) - SearchPath.push_back( '\\' ); - m_SearchDirectories.push_back( SearchPath ); - } - } - m_SearchDirectories.push_back( "" ); - } - - void BasicShaderSourceStreamFactory::CreateInputStream( const Diligent::Char *Name, IFileStream **ppStream ) - { - bool bFileCreated = false; - Diligent::RefCntAutoPtr<BasicFileStream> pBasicFileStream; - for( const auto &SearchDir : m_SearchDirectories ) - { - String FullPath = SearchDir + ( (Name[0] == '\\' || Name[0] == '/') ? Name + 1 : Name); - if( !FileSystem::FileExists( FullPath.c_str() ) ) - continue; - pBasicFileStream = MakeNewRCObj<BasicFileStream>()( FullPath.c_str(), EFileAccessMode::Read ); - if( pBasicFileStream->IsValid() ) - { - bFileCreated = true; - break; - } - else - { - pBasicFileStream.Release(); - } - } - if( bFileCreated ) - { - pBasicFileStream->QueryInterface( IID_FileStream, reinterpret_cast<IObject**>(ppStream) ); - } - else - { - *ppStream = nullptr; - LOG_ERROR( "Failed to create input stream for source file ", Name ); - } - } -}
\ No newline at end of file |
