summaryrefslogtreecommitdiffstats
path: root/RenderScript
diff options
context:
space:
mode:
authorEgor Yusov <egor.yusov@gmail.com>2017-11-13 03:18:57 +0000
committerEgor Yusov <egor.yusov@gmail.com>2017-11-13 03:18:57 +0000
commit5e3941de79b573b8798f6a6bcd4eaf544c48cde2 (patch)
tree77f33c32420cec66a88f24555f7211c02136468a /RenderScript
parentMerge from dev branch (diff)
downloadDiligentTools-5e3941de79b573b8798f6a6bcd4eaf544c48cde2.tar.gz
DiligentTools-5e3941de79b573b8798f6a6bcd4eaf544c48cde2.zip
Updated to version 2.1
Diffstat (limited to 'RenderScript')
-rw-r--r--RenderScript/include/ConvenienceFunctions.h4
-rw-r--r--RenderScript/include/ScriptParser.h6
-rw-r--r--RenderScript/include/ShaderParser.h1
-rw-r--r--RenderScript/include/pch.h2
-rw-r--r--RenderScript/src/BufferParser.cpp8
-rw-r--r--RenderScript/src/DrawAttribsParser.cpp32
-rw-r--r--RenderScript/src/ScissorRectParser.cpp2
-rw-r--r--RenderScript/src/ScriptParser.cpp3
-rw-r--r--RenderScript/src/ShaderParser.cpp4
-rw-r--r--RenderScript/src/ViewportParser.cpp2
10 files changed, 50 insertions, 14 deletions
diff --git a/RenderScript/include/ConvenienceFunctions.h b/RenderScript/include/ConvenienceFunctions.h
index 334f4c9..01bcdf4 100644
--- a/RenderScript/include/ConvenienceFunctions.h
+++ b/RenderScript/include/ConvenienceFunctions.h
@@ -52,7 +52,7 @@ Diligent::RefCntAutoPtr<Diligent::ScriptParser> CreateRenderScriptFromFile( cons
Diligent::FileWrapper ScriptFile(FilePath);
if( !ScriptFile )
LOG_ERROR_AND_THROW( "Failed to open Lua source file" );
- Diligent::RefCntAutoPtr<Diligent::IDataBlob> pFileData( new Diligent::DataBlobImpl );
+ Diligent::RefCntAutoPtr<Diligent::IDataBlob> pFileData( Diligent::MakeNewRCObj<Diligent::DataBlobImpl>()(0) );
ScriptFile->Read( pFileData );
// Null-terminator is not read from the stream
@@ -60,7 +60,7 @@ Diligent::RefCntAutoPtr<Diligent::ScriptParser> CreateRenderScriptFromFile( cons
auto *ScriptText = reinterpret_cast<char*>(pFileData->GetDataPtr());
ScriptText[pFileData->GetSize() - 1] = 0;
- pScriptParser = new Diligent::ScriptParser( pRenderDevice );
+ pScriptParser = Diligent::MakeNewRCObj<Diligent::ScriptParser>()( pRenderDevice );
pScriptParser->Parse( ScriptText );
SetGlobalVars( pScriptParser );
pScriptParser->Run( pContext );
diff --git a/RenderScript/include/ScriptParser.h b/RenderScript/include/ScriptParser.h
index 828a945..137f0fd 100644
--- a/RenderScript/include/ScriptParser.h
+++ b/RenderScript/include/ScriptParser.h
@@ -33,10 +33,12 @@
namespace Diligent
{
- class ScriptParser : public Diligent::RefCountedObject<Diligent::IObject>
+ class ScriptParser : public RefCountedObject<IObject>
{
public:
- ScriptParser( IRenderDevice *pRenderDevice );
+ typedef RefCountedObject<IObject> TBase;
+
+ ScriptParser( IReferenceCounters *pRefCounters, IRenderDevice *pRenderDevice );
~ScriptParser();
virtual void QueryInterface( const Diligent::INTERFACE_ID &IID, IObject **ppInterface );
diff --git a/RenderScript/include/ShaderParser.h b/RenderScript/include/ShaderParser.h
index a1df356..b827def 100644
--- a/RenderScript/include/ShaderParser.h
+++ b/RenderScript/include/ShaderParser.h
@@ -52,6 +52,7 @@ namespace Diligent
String FilePathBuffer;
String EntryPointBuffer;
String SearchDirectoriesBuffer;
+ const char *SearchDirectories = nullptr;
std::vector<ShaderVariableDesc> m_VarDescBuffer;
std::vector<String> m_VarNamesBuffer;
std::vector<StaticSamplerDesc> m_StaticSamplersBuffer;
diff --git a/RenderScript/include/pch.h b/RenderScript/include/pch.h
index eec1e6d..ffe6b1c 100644
--- a/RenderScript/include/pch.h
+++ b/RenderScript/include/pch.h
@@ -37,8 +37,8 @@
#include "lauxlib.h"
#include "BasicTypes.h"
-#include "Errors.h"
#include "ParsingErrors.h"
+#include "Errors.h"
#include "RefCntAutoPtr.h"
#include "RenderDevice.h"
diff --git a/RenderScript/src/BufferParser.cpp b/RenderScript/src/BufferParser.cpp
index 92cbc2e..40cda67 100644
--- a/RenderScript/src/BufferParser.cpp
+++ b/RenderScript/src/BufferParser.cpp
@@ -83,7 +83,7 @@ namespace Diligent
DEFINE_FLAGS_BINDER( m_Bindings, SBuffDescWrapper, CPUAccessFlags, CPU_ACCESS_FLAG, m_CpuAccessFlagEnumMapping );
DEFINE_ENUM_ELEMENT_MAPPING( m_BuffModeEnumMapping, BUFFER_MODE_UNDEFINED );
- DEFINE_ENUM_ELEMENT_MAPPING( m_BuffModeEnumMapping, BUFFER_MODE_FORMATED );
+ DEFINE_ENUM_ELEMENT_MAPPING( m_BuffModeEnumMapping, BUFFER_MODE_FORMATTED );
DEFINE_ENUM_ELEMENT_MAPPING( m_BuffModeEnumMapping, BUFFER_MODE_STRUCTURED );
static_assert(BUFFER_MODE_NUM_MODES == BUFFER_MODE_STRUCTURED + 1, "Not all buffer modes initialized.");
VERIFY( m_BuffModeEnumMapping.m_Str2ValMap.size() == BUFFER_MODE_NUM_MODES,
@@ -106,11 +106,11 @@ namespace Diligent
ParseLuaTable( L, 1, &BufferDesc, m_Bindings );
CHECK_LUA_STACK_HEIGHT();
- if( BufferDesc.Mode == BUFFER_MODE_FORMATED )
+ if( BufferDesc.Mode == BUFFER_MODE_FORMATTED )
{
auto &BuffFmt = BufferDesc.Format;
if( BuffFmt.ValueType == VT_UNDEFINED || BuffFmt.NumComponents == 0 )
- SCRIPT_PARSING_ERROR( L, "Valid format must be specified for a formated buffer" );
+ SCRIPT_PARSING_ERROR( L, "Valid format must be specified for a formatted buffer" );
auto FmtSize = GetValueSize( BuffFmt.ValueType ) * BuffFmt.NumComponents;
if( BufferDesc.ElementByteStride != 0 )
{
@@ -128,7 +128,7 @@ namespace Diligent
if( BufferDesc.Mode == BUFFER_MODE_STRUCTURED && BufferDesc.ElementByteStride == 0 )
SCRIPT_PARSING_ERROR( L, "UAV element byte stride of a structured buffer cannot be zero" );
- if( (BufferDesc.Mode == BUFFER_MODE_FORMATED || BufferDesc.Mode == BUFFER_MODE_STRUCTURED) &&
+ if( (BufferDesc.Mode == BUFFER_MODE_FORMATTED || BufferDesc.Mode == BUFFER_MODE_STRUCTURED) &&
(BufferDesc.uiSizeInBytes % BufferDesc.ElementByteStride) != 0 )
SCRIPT_PARSING_ERROR( L, "Buffer size (", BufferDesc.uiSizeInBytes, ") is not multiple of element byte stride (", BufferDesc.ElementByteStride, ")." );
diff --git a/RenderScript/src/DrawAttribsParser.cpp b/RenderScript/src/DrawAttribsParser.cpp
index f1be965..fd55c14 100644
--- a/RenderScript/src/DrawAttribsParser.cpp
+++ b/RenderScript/src/DrawAttribsParser.cpp
@@ -39,6 +39,38 @@ namespace Diligent
DEFINE_ENUM_ELEMENT_MAPPING( m_PrimTopologyEnumMapping, PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP );
DEFINE_ENUM_ELEMENT_MAPPING( m_PrimTopologyEnumMapping, PRIMITIVE_TOPOLOGY_POINT_LIST );
DEFINE_ENUM_ELEMENT_MAPPING( m_PrimTopologyEnumMapping, PRIMITIVE_TOPOLOGY_LINE_LIST );
+ DEFINE_ENUM_ELEMENT_MAPPING( m_PrimTopologyEnumMapping, PRIMITIVE_TOPOLOGY_1_CONTROL_POINT_PATCHLIST );
+ DEFINE_ENUM_ELEMENT_MAPPING( m_PrimTopologyEnumMapping, PRIMITIVE_TOPOLOGY_2_CONTROL_POINT_PATCHLIST );
+ DEFINE_ENUM_ELEMENT_MAPPING( m_PrimTopologyEnumMapping, PRIMITIVE_TOPOLOGY_3_CONTROL_POINT_PATCHLIST );
+ DEFINE_ENUM_ELEMENT_MAPPING( m_PrimTopologyEnumMapping, PRIMITIVE_TOPOLOGY_4_CONTROL_POINT_PATCHLIST );
+ DEFINE_ENUM_ELEMENT_MAPPING( m_PrimTopologyEnumMapping, PRIMITIVE_TOPOLOGY_5_CONTROL_POINT_PATCHLIST );
+ DEFINE_ENUM_ELEMENT_MAPPING( m_PrimTopologyEnumMapping, PRIMITIVE_TOPOLOGY_6_CONTROL_POINT_PATCHLIST );
+ DEFINE_ENUM_ELEMENT_MAPPING( m_PrimTopologyEnumMapping, PRIMITIVE_TOPOLOGY_7_CONTROL_POINT_PATCHLIST );
+ DEFINE_ENUM_ELEMENT_MAPPING( m_PrimTopologyEnumMapping, PRIMITIVE_TOPOLOGY_8_CONTROL_POINT_PATCHLIST );
+ DEFINE_ENUM_ELEMENT_MAPPING( m_PrimTopologyEnumMapping, PRIMITIVE_TOPOLOGY_9_CONTROL_POINT_PATCHLIST );
+ DEFINE_ENUM_ELEMENT_MAPPING( m_PrimTopologyEnumMapping, PRIMITIVE_TOPOLOGY_10_CONTROL_POINT_PATCHLIST );
+ DEFINE_ENUM_ELEMENT_MAPPING( m_PrimTopologyEnumMapping, PRIMITIVE_TOPOLOGY_11_CONTROL_POINT_PATCHLIST );
+ DEFINE_ENUM_ELEMENT_MAPPING( m_PrimTopologyEnumMapping, PRIMITIVE_TOPOLOGY_12_CONTROL_POINT_PATCHLIST );
+ DEFINE_ENUM_ELEMENT_MAPPING( m_PrimTopologyEnumMapping, PRIMITIVE_TOPOLOGY_13_CONTROL_POINT_PATCHLIST );
+ DEFINE_ENUM_ELEMENT_MAPPING( m_PrimTopologyEnumMapping, PRIMITIVE_TOPOLOGY_14_CONTROL_POINT_PATCHLIST );
+ DEFINE_ENUM_ELEMENT_MAPPING( m_PrimTopologyEnumMapping, PRIMITIVE_TOPOLOGY_15_CONTROL_POINT_PATCHLIST );
+ DEFINE_ENUM_ELEMENT_MAPPING( m_PrimTopologyEnumMapping, PRIMITIVE_TOPOLOGY_16_CONTROL_POINT_PATCHLIST );
+ DEFINE_ENUM_ELEMENT_MAPPING( m_PrimTopologyEnumMapping, PRIMITIVE_TOPOLOGY_17_CONTROL_POINT_PATCHLIST );
+ DEFINE_ENUM_ELEMENT_MAPPING( m_PrimTopologyEnumMapping, PRIMITIVE_TOPOLOGY_18_CONTROL_POINT_PATCHLIST );
+ DEFINE_ENUM_ELEMENT_MAPPING( m_PrimTopologyEnumMapping, PRIMITIVE_TOPOLOGY_19_CONTROL_POINT_PATCHLIST );
+ DEFINE_ENUM_ELEMENT_MAPPING( m_PrimTopologyEnumMapping, PRIMITIVE_TOPOLOGY_20_CONTROL_POINT_PATCHLIST );
+ DEFINE_ENUM_ELEMENT_MAPPING( m_PrimTopologyEnumMapping, PRIMITIVE_TOPOLOGY_21_CONTROL_POINT_PATCHLIST );
+ DEFINE_ENUM_ELEMENT_MAPPING( m_PrimTopologyEnumMapping, PRIMITIVE_TOPOLOGY_22_CONTROL_POINT_PATCHLIST );
+ DEFINE_ENUM_ELEMENT_MAPPING( m_PrimTopologyEnumMapping, PRIMITIVE_TOPOLOGY_23_CONTROL_POINT_PATCHLIST );
+ DEFINE_ENUM_ELEMENT_MAPPING( m_PrimTopologyEnumMapping, PRIMITIVE_TOPOLOGY_24_CONTROL_POINT_PATCHLIST );
+ DEFINE_ENUM_ELEMENT_MAPPING( m_PrimTopologyEnumMapping, PRIMITIVE_TOPOLOGY_25_CONTROL_POINT_PATCHLIST );
+ DEFINE_ENUM_ELEMENT_MAPPING( m_PrimTopologyEnumMapping, PRIMITIVE_TOPOLOGY_26_CONTROL_POINT_PATCHLIST );
+ DEFINE_ENUM_ELEMENT_MAPPING( m_PrimTopologyEnumMapping, PRIMITIVE_TOPOLOGY_27_CONTROL_POINT_PATCHLIST );
+ DEFINE_ENUM_ELEMENT_MAPPING( m_PrimTopologyEnumMapping, PRIMITIVE_TOPOLOGY_28_CONTROL_POINT_PATCHLIST );
+ DEFINE_ENUM_ELEMENT_MAPPING( m_PrimTopologyEnumMapping, PRIMITIVE_TOPOLOGY_29_CONTROL_POINT_PATCHLIST );
+ DEFINE_ENUM_ELEMENT_MAPPING( m_PrimTopologyEnumMapping, PRIMITIVE_TOPOLOGY_30_CONTROL_POINT_PATCHLIST );
+ DEFINE_ENUM_ELEMENT_MAPPING( m_PrimTopologyEnumMapping, PRIMITIVE_TOPOLOGY_31_CONTROL_POINT_PATCHLIST );
+ DEFINE_ENUM_ELEMENT_MAPPING( m_PrimTopologyEnumMapping, PRIMITIVE_TOPOLOGY_32_CONTROL_POINT_PATCHLIST );
VERIFY( m_PrimTopologyEnumMapping.m_Str2ValMap.size() == PRIMITIVE_TOPOLOGY_NUM_TOPOLOGIES - 1,
"Unexpected map size. Did you update PRIMITIVE_TOPOLOGY enum?" );
VERIFY( m_PrimTopologyEnumMapping.m_Val2StrMap.size() == PRIMITIVE_TOPOLOGY_NUM_TOPOLOGIES - 1,
diff --git a/RenderScript/src/ScissorRectParser.cpp b/RenderScript/src/ScissorRectParser.cpp
index ecc60a8..a36036d 100644
--- a/RenderScript/src/ScissorRectParser.cpp
+++ b/RenderScript/src/ScissorRectParser.cpp
@@ -108,7 +108,7 @@ namespace Diligent
}
}
- if( RTWidth == 0 && RTHeight != 0 || RTWidth != 0 && RTHeight == 0 )
+ if( (RTWidth == 0 && RTHeight != 0) || (RTWidth != 0 && RTHeight == 0) )
SCRIPT_PARSING_ERROR( L, "Render target size is incomplete (", RTWidth, "x", RTHeight, "). Use either 0x0 or fully specified size" );
Uint32 NumScissorRects = static_cast<Uint32>( m_ScissorRects.size() );
diff --git a/RenderScript/src/ScriptParser.cpp b/RenderScript/src/ScriptParser.cpp
index 8f23f8d..8e65d75 100644
--- a/RenderScript/src/ScriptParser.cpp
+++ b/RenderScript/src/ScriptParser.cpp
@@ -85,7 +85,8 @@ namespace Diligent
m_pScriptParser->m_pScissorRectParser->PushObject( L, &Rect );
}
- ScriptParser::ScriptParser( IRenderDevice *pRenderDevice ) :
+ ScriptParser::ScriptParser( IReferenceCounters *pRefCounters, IRenderDevice *pRenderDevice ) :
+ TBase(pRefCounters),
m_pRenderDevice( pRenderDevice ),
m_LuaState( LuaState::LUA_LIB_BASE | LuaState::LUA_LIB_COROUTINE | LuaState::LUA_LIB_TABLE |
LuaState::LUA_LIB_STRING | LuaState::LUA_LIB_BIT32 | LuaState::LUA_LIB_MATH )
diff --git a/RenderScript/src/ShaderParser.cpp b/RenderScript/src/ShaderParser.cpp
index 10416e2..12d9157 100644
--- a/RenderScript/src/ShaderParser.cpp
+++ b/RenderScript/src/ShaderParser.cpp
@@ -86,7 +86,7 @@ namespace Diligent
);
}
- virtual void SetValue( lua_State *L, int Index, void* pBasePointer )
+ virtual void SetValue( lua_State *L, int Index, void* pBasePointer )override
{
auto &ShaderVarDescBuffer = GetMemberByOffest<std::vector<ShaderVariableDesc>>( pBasePointer, m_VarDescBufferOffset);
auto &ShaderNamesBuffer = GetMemberByOffest<std::vector<String>>( pBasePointer, m_VarNamesBufferOffset);
@@ -191,7 +191,7 @@ namespace Diligent
);
}
- virtual void SetValue( lua_State *L, int Index, void* pBasePointer )
+ virtual void SetValue( lua_State *L, int Index, void* pBasePointer )override
{
auto &StaticSamplersBuffer = GetMemberByOffest<std::vector<StaticSamplerDesc>>( pBasePointer, m_StaticSamplersBufferOffset);
auto &StaticSamplerTexNamesBuffer = GetMemberByOffest<std::vector<String>>( pBasePointer, m_StaticSamplerTexNamesBufferOffset);
diff --git a/RenderScript/src/ViewportParser.cpp b/RenderScript/src/ViewportParser.cpp
index 3f4dc06..555baa3 100644
--- a/RenderScript/src/ViewportParser.cpp
+++ b/RenderScript/src/ViewportParser.cpp
@@ -117,7 +117,7 @@ namespace Diligent
}
}
- if( RTWidth == 0 && RTHeight != 0 || RTWidth != 0 && RTHeight == 0 )
+ if( (RTWidth == 0 && RTHeight != 0) || (RTWidth != 0 && RTHeight == 0) )
SCRIPT_PARSING_ERROR( L, "Render target size is incomplete (", RTWidth, "x", RTHeight, "). Use either 0x0 or fully specified size" );
Uint32 NumViewports = static_cast<Uint32>( m_Viewports.size() );