Skip to content

Commit 2a17214

Browse files
Reworked dependencies between projects
1 parent 2fae6ac commit 2a17214

40 files changed

+1206
-1075
lines changed

Common/CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,8 @@ PUBLIC
4646
)
4747

4848
target_link_libraries(Common
49-
PUBLIC
49+
PUBLIC
50+
BuildSettings
5051
TargetPlatform
5152
)
5253
set_common_target_properties(Common)

Common/interface/STDAllocator.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525

2626
/// \file
2727
/// Defines Diligent::DefaultRawMemoryAllocator class
28+
#include <limits>
2829

2930
#include "BasicTypes.h"
3031
#include "MemoryAllocator.h"

Graphics/CMakeLists.txt

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,17 @@ cmake_minimum_required (VERSION 3.6)
33
set(DLL_REL_SUFFIX _${ARCH}r)
44
set(DLL_DBG_SUFFIX _${ARCH}d)
55

6+
add_library(GraphicsEngineInterface INTERFACE)
7+
target_include_directories(GraphicsEngineInterface
8+
INTERFACE
9+
GraphicsEngine/interface
10+
)
11+
target_link_libraries(GraphicsEngineInterface
12+
INTERFACE
13+
Primitives
14+
)
15+
16+
add_subdirectory(GraphicsAccessories)
617
add_subdirectory(GraphicsEngine)
718

819
if(D3D11_SUPPORTED OR D3D12_SUPPORTED)
@@ -17,9 +28,9 @@ if(D3D12_SUPPORTED)
1728
add_subdirectory(GraphicsEngineD3D12)
1829
endif()
1930

20-
add_subdirectory(GraphicsTools)
21-
2231
if(GL_SUPPORTED OR GLES_SUPPORTED)
2332
add_subdirectory(HLSL2GLSLConverterLib)
2433
add_subdirectory(GraphicsEngineOpenGL)
2534
endif()
35+
36+
add_subdirectory(GraphicsTools)
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
cmake_minimum_required (VERSION 3.6)
2+
3+
project(GraphicsAccessories CXX)
4+
5+
set(INTERFACE
6+
interface/RingBuffer.h
7+
interface/VariableSizeAllocationsManager.h
8+
interface/VariableSizeGPUAllocationsManager.h
9+
interface/GraphicsAccessories.h
10+
)
11+
12+
set(SOURCE
13+
src/test.cpp
14+
src/GraphicsAccessories.cpp
15+
)
16+
17+
add_library(GraphicsAccessories STATIC ${SOURCE} ${INTERFACE})
18+
19+
target_include_directories(GraphicsAccessories
20+
PUBLIC
21+
interface
22+
)
23+
24+
target_link_libraries(GraphicsAccessories
25+
PUBLIC
26+
BuildSettings
27+
Common
28+
GraphicsEngineInterface
29+
)
30+
31+
set_common_target_properties(GraphicsAccessories)
32+
33+
source_group("src" FILES ${SOURCE})
34+
source_group("interface" FILES ${INTERFACE})
35+
36+
set_target_properties(GraphicsAccessories PROPERTIES
37+
FOLDER Core/Graphics
38+
)
Lines changed: 257 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,257 @@
1+
/* Copyright 2015-2017 Egor Yusov
2+
*
3+
* Licensed under the Apache License, Version 2.0 (the "License");
4+
* you may not use this file except in compliance with the License.
5+
* You may obtain a copy of the License at
6+
*
7+
* http://www.apache.org/licenses/LICENSE-2.0
8+
*
9+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
10+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
11+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF ANY PROPRIETARY RIGHTS.
12+
*
13+
* In no event and under no legal theory, whether in tort (including negligence),
14+
* contract, or otherwise, unless required by applicable law (such as deliberate
15+
* and grossly negligent acts) or agreed to in writing, shall any Contributor be
16+
* liable for any damages, including any direct, indirect, special, incidental,
17+
* or consequential damages of any character arising as a result of this License or
18+
* out of the use or inability to use the software (including but not limited to damages
19+
* for loss of goodwill, work stoppage, computer failure or malfunction, or any and
20+
* all other commercial damages or losses), even if such Contributor has been advised
21+
* of the possibility of such damages.
22+
*/
23+
24+
#pragma once
25+
26+
/// \file
27+
/// Defines graphics engine utilities
28+
29+
#include "GraphicsTypes.h"
30+
#include "Shader.h"
31+
#include "Texture.h"
32+
#include "Buffer.h"
33+
#include "RenderDevice.h"
34+
#include "DebugUtilities.h"
35+
36+
namespace Diligent
37+
{
38+
39+
/// Template structure to convert VALUE_TYPE enumeration into C-type
40+
template<VALUE_TYPE ValType>
41+
struct VALUE_TYPE2CType
42+
{};
43+
44+
/// VALUE_TYPE2CType<> template specialization for 8-bit integer value type.
45+
46+
/// Usage example:
47+
///
48+
/// VALUE_TYPE2CType<VT_INT8>::CType MyInt8Var;
49+
template<>struct VALUE_TYPE2CType<VT_INT8> { typedef Int8 CType; };
50+
51+
/// VALUE_TYPE2CType<> template specialization for 16-bit integer value type.
52+
53+
/// Usage example:
54+
///
55+
/// VALUE_TYPE2CType<VT_INT16>::CType MyInt16Var;
56+
template<>struct VALUE_TYPE2CType<VT_INT16> { typedef Int16 CType; };
57+
58+
/// VALUE_TYPE2CType<> template specialization for 32-bit integer value type.
59+
60+
/// Usage example:
61+
///
62+
/// VALUE_TYPE2CType<VT_INT32>::CType MyInt32Var;
63+
template<>struct VALUE_TYPE2CType<VT_INT32> { typedef Int32 CType; };
64+
65+
/// VALUE_TYPE2CType<> template specialization for 8-bit unsigned-integer value type.
66+
67+
/// Usage example:
68+
///
69+
/// VALUE_TYPE2CType<VT_UINT8>::CType MyUint8Var;
70+
template<>struct VALUE_TYPE2CType<VT_UINT8> { typedef Uint8 CType; };
71+
72+
/// VALUE_TYPE2CType<> template specialization for 16-bit unsigned-integer value type.
73+
74+
/// Usage example:
75+
///
76+
/// VALUE_TYPE2CType<VT_UINT16>::CType MyUint16Var;
77+
template<>struct VALUE_TYPE2CType<VT_UINT16>{ typedef Uint16 CType; };
78+
79+
/// VALUE_TYPE2CType<> template specialization for 32-bit unsigned-integer value type.
80+
81+
/// Usage example:
82+
///
83+
/// VALUE_TYPE2CType<VT_UINT32>::CType MyUint32Var;
84+
template<>struct VALUE_TYPE2CType<VT_UINT32>{ typedef Uint32 CType; };
85+
86+
/// VALUE_TYPE2CType<> template specialization for half-precision 16-bit floating-point value type.
87+
88+
/// Usage example:
89+
///
90+
/// VALUE_TYPE2CType<VT_FLOAT16>::CType MyFloat16Var;
91+
///
92+
/// \note 16-bit floating-point values have no corresponding C++ type and are translated to Uint16
93+
template<>struct VALUE_TYPE2CType<VT_FLOAT16>{ typedef Uint16 CType; };
94+
95+
/// VALUE_TYPE2CType<> template specialization for full-precision 32-bit floating-point value type.
96+
97+
/// Usage example:
98+
///
99+
/// VALUE_TYPE2CType<VT_FLOAT32>::CType MyFloat32Var;
100+
template<>struct VALUE_TYPE2CType<VT_FLOAT32>{ typedef Float32 CType; };
101+
102+
103+
static const Uint32 ValueTypeToSizeMap[] =
104+
{
105+
0,
106+
sizeof(VALUE_TYPE2CType<VT_INT8> :: CType),
107+
sizeof(VALUE_TYPE2CType<VT_INT16> :: CType),
108+
sizeof(VALUE_TYPE2CType<VT_INT32> :: CType),
109+
sizeof(VALUE_TYPE2CType<VT_UINT8> :: CType),
110+
sizeof(VALUE_TYPE2CType<VT_UINT16> :: CType),
111+
sizeof(VALUE_TYPE2CType<VT_UINT32> :: CType),
112+
sizeof(VALUE_TYPE2CType<VT_FLOAT16> :: CType),
113+
sizeof(VALUE_TYPE2CType<VT_FLOAT32> :: CType)
114+
};
115+
static_assert(VT_NUM_TYPES == VT_FLOAT32 + 1, "Not all value type sizes initialized.");
116+
117+
/// Returns the size of the specified value type
118+
inline Uint32 GetValueSize(VALUE_TYPE Val)
119+
{
120+
VERIFY_EXPR(Val < _countof(ValueTypeToSizeMap));
121+
return ValueTypeToSizeMap[Val];
122+
}
123+
124+
/// Returns the string representing the specified value type
125+
const Char* GetValueTypeString( VALUE_TYPE Val );
126+
127+
/// Returns invariant texture format attributes, see TextureFormatAttribs for details.
128+
129+
/// \param [in] Format - Texture format which attributes are requested for.
130+
/// \return Constant reference to the TextureFormatAttribs structure containing
131+
/// format attributes.
132+
const TextureFormatAttribs& GetTextureFormatAttribs(TEXTURE_FORMAT Format);
133+
134+
/// Returns the default format for a specified texture view type
135+
136+
/// The default view is defined as follows:
137+
/// * For a fully qualified texture format, the SRV/RTV/UAV view format is the same as texture format;
138+
/// DSV format, if avaialble, is adjusted accrodingly (R32_FLOAT -> D32_FLOAT)
139+
/// * For 32-bit typeless formats, default view is XXXX32_FLOAT (where XXXX are the actual format components)\n
140+
/// * For 16-bit typeless formats, default view is XXXX16_FLOAT (where XXXX are the actual format components)\n
141+
/// ** R16_TYPELESS is special. If BIND_DEPTH_STENCIL flag is set, it is translated to R16_UNORM/D16_UNORM;
142+
/// otherwise it is translated to R16_FLOAT.
143+
/// * For 8-bit typeless formats, default view is XXXX8_UNORM (where XXXX are the actual format components)\n
144+
/// * sRGB is always chosen if it is available (RGBA8_UNORM_SRGB, TEX_FORMAT_BC1_UNORM_SRGB, etc.)
145+
/// * For combined depth-stencil formats, SRV format references depth component (R24_UNORM_X8_TYPELESS for D24S8 formats, and
146+
/// R32_FLOAT_X8X24_TYPELESS for D32S8X24 formats)
147+
/// * For compressed formats, only SRV format is defined
148+
///
149+
/// \param [in] Format - texture format, for which the view format is requested
150+
/// \param [in] ViewType - texture view type
151+
/// \param [in] BindFlags - texture bind flags
152+
/// \return texture view type format
153+
TEXTURE_FORMAT GetDefaultTextureViewFormat(TEXTURE_FORMAT TextureFormat, TEXTURE_VIEW_TYPE ViewType, Uint32 BindFlags);
154+
155+
/// Returns the default format for a specified texture view type
156+
157+
/// \param [in] TexDesc - texture description
158+
/// \param [in] ViewType - texture view type
159+
/// \return texture view type format
160+
inline TEXTURE_FORMAT GetDefaultTextureViewFormat(const TextureDesc &TexDesc, TEXTURE_VIEW_TYPE ViewType)
161+
{
162+
return GetDefaultTextureViewFormat(TexDesc.Format, ViewType, TexDesc.BindFlags);
163+
}
164+
165+
/// Returns the literal name of a texture view type. For instance,
166+
/// for a shader resource view, "TEXTURE_VIEW_SHADER_RESOURCE" will be returned.
167+
168+
/// \param [in] ViewType - Texture view type.
169+
/// \return Literal name of the texture view type.
170+
const Char *GetTexViewTypeLiteralName(TEXTURE_VIEW_TYPE ViewType);
171+
172+
/// Returns the literal name of a buffer view type. For instance,
173+
/// for an unordered access view, "BUFFER_VIEW_UNORDERED_ACCESS" will be returned.
174+
175+
/// \param [in] ViewType - Buffer view type.
176+
/// \return Literal name of the buffer view type.
177+
const Char *GetBufferViewTypeLiteralName(BUFFER_VIEW_TYPE ViewType);
178+
179+
/// Returns the literal name of a shader type. For instance,
180+
/// for a pixel shader, "SHADER_TYPE_PIXEL" will be returned.
181+
182+
/// \param [in] ShaderType - Shader type.
183+
/// \return Literal name of the shader type.
184+
const Char *GetShaderTypeLiteralName(SHADER_TYPE ShaderType);
185+
186+
187+
/// Returns the literal name of a shader variable type. For instance,
188+
/// for SHADER_VARIABLE_TYPE_STATIC, if bGetFullName == true, "SHADER_VARIABLE_TYPE_STATIC" will be returned;
189+
/// if bGetFullName == false, "static" will be returned
190+
191+
/// \param [in] VarType - Variable type.
192+
/// \param [in] bGetFullName - Whether to return string representation of the enum value
193+
/// \return Literal name of the shader variable type.
194+
const Char *GetShaderVariableTypeLiteralName(SHADER_VARIABLE_TYPE VarType, bool bGetFullName = false);
195+
196+
/// Overloaded function that returns the literal name of a texture view type.
197+
/// see GetTexViewTypeLiteralName().
198+
inline const Char* GetViewTypeLiteralName(TEXTURE_VIEW_TYPE TexViewType)
199+
{
200+
return GetTexViewTypeLiteralName( TexViewType );
201+
}
202+
203+
/// Overloaded function that returns the literal name of a buffer view type.
204+
/// see GetBufferViewTypeLiteralName().
205+
inline const Char* GetViewTypeLiteralName(BUFFER_VIEW_TYPE BuffViewType)
206+
{
207+
return GetBufferViewTypeLiteralName( BuffViewType );
208+
}
209+
210+
/// Returns the string containing the usage
211+
const Char* GetUsageString(USAGE Usage);
212+
213+
/// Returns the string containing the texture type
214+
const Char* GetResourceDimString( RESOURCE_DIMENSION TexType );
215+
216+
/// Returns the string containing the bind flags
217+
String GetBindFlagsString( Uint32 BindFlags );
218+
219+
/// Returns the string containing the CPU access flags
220+
String GetCPUAccessFlagsString( Uint32 CpuAccessFlags );
221+
222+
/// Returns the string containing the texture description
223+
String GetTextureDescString(const TextureDesc &Desc);
224+
225+
/// Returns the string containing the buffer description
226+
String GetBufferDescString(const BufferDesc &Desc);
227+
228+
229+
/// Helper template function that converts object description into a string
230+
template<typename TObjectDescType>
231+
String GetObjectDescString( const TObjectDescType& )
232+
{
233+
return "";
234+
}
235+
236+
/// Template specialization for texture description
237+
template<>
238+
inline String GetObjectDescString( const TextureDesc& TexDesc )
239+
{
240+
String Str( "Tex desc: " );
241+
Str += GetTextureDescString( TexDesc );
242+
return Str;
243+
}
244+
245+
/// Template specialization for buffer description
246+
template<>
247+
inline String GetObjectDescString( const BufferDesc& BuffDesc )
248+
{
249+
String Str( "Buff desc: " );
250+
Str += GetBufferDescString( BuffDesc );
251+
return Str;
252+
}
253+
254+
Uint32 ComputeMipLevelsCount( Uint32 Width );
255+
Uint32 ComputeMipLevelsCount( Uint32 Width, Uint32 Height );
256+
Uint32 ComputeMipLevelsCount( Uint32 Width, Uint32 Height, Uint32 Depth );
257+
}
File renamed without changes.

Graphics/GraphicsTools/include/VariableSizeAllocationsManager.h renamed to Graphics/GraphicsAccessories/interface/VariableSizeAllocationsManager.h

File renamed without changes.

Graphics/GraphicsTools/include/VariableSizeGPUAllocationsManager.h renamed to Graphics/GraphicsAccessories/interface/VariableSizeGPUAllocationsManager.h

File renamed without changes.

0 commit comments

Comments
 (0)