From d9ff664e3d796f9526ed29b7a1066b3d3fb443b1 Mon Sep 17 00:00:00 2001 From: assiduous Date: Thu, 12 Dec 2019 15:16:42 -0800 Subject: Removed RenderScript and lua --- RenderScript/include/ScriptParser.h | 169 ------------------------------------ 1 file changed, 169 deletions(-) delete mode 100644 RenderScript/include/ScriptParser.h (limited to 'RenderScript/include/ScriptParser.h') diff --git a/RenderScript/include/ScriptParser.h b/RenderScript/include/ScriptParser.h deleted file mode 100644 index 9e5cf79..0000000 --- a/RenderScript/include/ScriptParser.h +++ /dev/null @@ -1,169 +0,0 @@ -/* Copyright 2019 Diligent Graphics LLC - * - * 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 -#include "LuaWrappers.h" -#include "LuaFunctionBinding.h" -#include "RenderDevice.h" -#include "DeviceContext.h" -#include "RefCountedObjectImpl.h" -#include "RefCntAutoPtr.h" - -namespace Diligent -{ - class ScriptParser : public RefCountedObject - { - public: - struct CombinedDrawAttribs - { - union - { - Uint32 NumVertices = 0; - Uint32 NumIndices; - }; - VALUE_TYPE IndexType = VT_UNDEFINED; - DRAW_FLAGS Flags = DRAW_FLAG_NONE; - RESOURCE_STATE_TRANSITION_MODE IndirectAttribsBufferStateTransitionMode = RESOURCE_STATE_TRANSITION_MODE_NONE; - Uint32 NumInstances = 1; - Uint32 BaseVertex = 0; - Uint32 IndirectDrawArgsOffset = 0; - union - { - Uint32 StartVertexLocation = 0; - Uint32 FirstIndexLocation; - }; - Uint32 FirstInstanceLocation = 0; - IBuffer* pIndirectDrawAttribs = nullptr; - }; - - typedef RefCountedObject TBase; - - ScriptParser( IReferenceCounters* pRefCounters, IRenderDevice* pRenderDevice ); - ~ScriptParser(); - - virtual void QueryInterface(const INTERFACE_ID& IID, IObject** ppInterface ); - - void Parse(const Char *pScript); - - template - void Run(IDeviceContext *pContext, const ArgsType&... Args) - { - lua_pushstring( m_LuaState, DeviceContextRegistryKey ); // -0 | +1 -> +1 - lua_pushlightuserdata( m_LuaState, pContext ); // -0 | +1 -> +1 - lua_settable( m_LuaState, LUA_REGISTRYINDEX ); // -2 | +0 -> -2 - - m_RunFunctionCaller(Args...); - } - template - void Run( RefCntAutoPtr &pContext, const ArgsType&... Args ) - { - Run(pContext.RawPtr(), Args... ); - } - - template - void Run( const ArgsType&... Args ) - { - Run( static_cast(nullptr), Args... ); - } - - - void GetSamplerByName( const Char *SamplerName, ISampler** ppSampler ); - void GetShaderByName( const Char *ShaderName, IShader** ppShader ); - void GetBufferByName( const Char *BufferName, IBuffer** ppBuffer ); - void GetTextureByName( const Char *TextureName, ITexture** ppTexture ); - void GetResourceMappingByName( const Char *ResourceMappingName, IResourceMapping** ppResourceMapping ); - void GetTextureViewByName( const Char *TextureViewName, ITextureView** ppTextureView ); - void GetBufferViewByName( const Char *BufferViewName, IBufferView** ppTextureView ); - void GetPipelineStateByName( const Char *PSOName, IPipelineState** ppPSO ); - void GetShaderVariableByName( const Char *ShaderVarName, IShaderResourceVariable** ppShaderVar ); - void GetShaderResourceBindingByName( const Char *SRBName, IShaderResourceBinding** ppSRB ); - - template - void SetGlobalVariable( const Char *Name, ValType Var ) - { - m_RunFunctionCaller.PushFuncStub( m_LuaState, Var ); - lua_setglobal( m_LuaState, Name ); - } - - static const Char* DeviceContextRegistryKey; - - private: - class SpecialPushFuncs - { - public: - SpecialPushFuncs() : m_pScriptParser( nullptr ){} - void SetScriptParser( ScriptParser *pScriptParser ){ m_pScriptParser = pScriptParser; } - - void PushFuncStub( lua_State *L, const ISampler* pSampler ); - void PushFuncStub( lua_State *L, const RefCntAutoPtr &pSampler ); - void PushFuncStub( lua_State *L, const IShader* pShader ); - void PushFuncStub( lua_State *L, const RefCntAutoPtr &pShader ); - void PushFuncStub( lua_State *L, const IBuffer* pBuffer ); - void PushFuncStub( lua_State *L, const RefCntAutoPtr &pBuffer ); - void PushFuncStub( lua_State *L, const ITexture* pTexture ); - void PushFuncStub( lua_State *L, const RefCntAutoPtr &pTexture ); - void PushFuncStub( lua_State *L, const struct CombinedDrawAttribs &Attribs ); - void PushFuncStub( lua_State *L, const DrawAttribs &Attribs ); - void PushFuncStub( lua_State *L, const DrawIndexedAttribs &Attribs ); - void PushFuncStub( lua_State *L, const IResourceMapping* pResourceMapping ); - void PushFuncStub( lua_State *L, const RefCntAutoPtr &pResourceMapping ); - void PushFuncStub( lua_State *L, const ITextureView* pTextureView ); - void PushFuncStub( lua_State *L, const RefCntAutoPtr &pTextureView ); - void PushFuncStub( lua_State *L, const IBufferView* pBufferView ); - void PushFuncStub( lua_State *L, const RefCntAutoPtr &pBufferView ); - void PushFuncStub( lua_State *L, const IPipelineState* pPSO ); - void PushFuncStub( lua_State *L, const RefCntAutoPtr &pPSO ); - void PushFuncStub( lua_State *L, const Viewport &Viewport ); - void PushFuncStub( lua_State *L, const Rect &Rect ); - void PushFuncStub( lua_State *L, const IShaderResourceVariable* pShaderVar ); - void PushFuncStub( lua_State *L, const RefCntAutoPtr &pShaderVar ); - void PushFuncStub( lua_State *L, const IShaderResourceBinding* pShaderVar ); - void PushFuncStub( lua_State *L, const RefCntAutoPtr &pShaderVar ); - - private: - ScriptParser *m_pScriptParser; - }; - LuaFunctionCaller m_RunFunctionCaller; - - void DefineGlobalConstants( lua_State *L ); - - Diligent::RefCntAutoPtr m_pRenderDevice; - LuaState m_LuaState; - std::unique_ptr m_pSamplerParser; - std::unique_ptr m_pShaderParser; - std::unique_ptr m_pBufferParser; - std::unique_ptr m_pTextureParser; - std::unique_ptr m_pDrawAttribsParser; - std::unique_ptr m_pResourceMappingParser; - std::unique_ptr m_pTextureViewParser; - std::unique_ptr m_pBufferViewParser; - std::unique_ptr m_pPSOParser; - std::unique_ptr m_pDeviceCtxFuncBindings; - std::unique_ptr m_pViewportParser; - std::unique_ptr m_pScissorRectParser; - std::unique_ptr m_pShaderVariableParser; - std::unique_ptr m_pShaderResBindingParser; - }; -} -- cgit v1.2.3