Просмотр исходного кода

Started a bit of work on DX11 RenderSystem
More work on DX11 shaders

Marko Pintera 13 лет назад
Родитель
Сommit
72db1730b1

+ 6 - 4
CamelotD3D11RenderSystem/CamelotD3D11RenderSystem.vcxproj

@@ -90,7 +90,7 @@
     </ClCompile>
     </ClCompile>
     <Link>
     <Link>
       <GenerateDebugInformation>true</GenerateDebugInformation>
       <GenerateDebugInformation>true</GenerateDebugInformation>
-      <AdditionalDependencies>D3DCompiler.lib;CamelotRenderer.lib;CamelotUtility.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <AdditionalDependencies>dxguid.lib;D3DCompiler.lib;CamelotRenderer.lib;CamelotUtility.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
       <AdditionalLibraryDirectories>C:\Program Files %28x86%29\Microsoft DirectX SDK %28June 2010%29\Lib\x86;..\lib\$(Configuration);..\Dependencies\lib\Debug;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
       <AdditionalLibraryDirectories>C:\Program Files %28x86%29\Microsoft DirectX SDK %28June 2010%29\Lib\x86;..\lib\$(Configuration);..\Dependencies\lib\Debug;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
       <ImportLibrary>..\lib\$(Configuration)\$(TargetName).lib</ImportLibrary>
       <ImportLibrary>..\lib\$(Configuration)\$(TargetName).lib</ImportLibrary>
     </Link>
     </Link>
@@ -104,7 +104,7 @@
     </ClCompile>
     </ClCompile>
     <Link>
     <Link>
       <GenerateDebugInformation>true</GenerateDebugInformation>
       <GenerateDebugInformation>true</GenerateDebugInformation>
-      <AdditionalDependencies>D3DCompiler.lib;CamelotRenderer.lib;CamelotUtility.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <AdditionalDependencies>dxguid.lib;D3DCompiler.lib;CamelotRenderer.lib;CamelotUtility.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
       <AdditionalLibraryDirectories>C:\Program Files %28x86%29\Microsoft DirectX SDK %28June 2010%29\Lib\x64;..\lib\$(Platform)\$(Configuration);..\Dependencies\lib\x64\Debug;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
       <AdditionalLibraryDirectories>C:\Program Files %28x86%29\Microsoft DirectX SDK %28June 2010%29\Lib\x64;..\lib\$(Platform)\$(Configuration);..\Dependencies\lib\x64\Debug;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
       <ImportLibrary>..\lib\$(Platform)\$(Configuration)\$(TargetName).lib</ImportLibrary>
       <ImportLibrary>..\lib\$(Platform)\$(Configuration)\$(TargetName).lib</ImportLibrary>
     </Link>
     </Link>
@@ -122,7 +122,7 @@
       <GenerateDebugInformation>true</GenerateDebugInformation>
       <GenerateDebugInformation>true</GenerateDebugInformation>
       <EnableCOMDATFolding>true</EnableCOMDATFolding>
       <EnableCOMDATFolding>true</EnableCOMDATFolding>
       <OptimizeReferences>true</OptimizeReferences>
       <OptimizeReferences>true</OptimizeReferences>
-      <AdditionalDependencies>D3DCompiler.lib;CamelotRenderer.lib;CamelotUtility.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <AdditionalDependencies>dxguid.lib;D3DCompiler.lib;CamelotRenderer.lib;CamelotUtility.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
       <AdditionalLibraryDirectories>C:\Program Files %28x86%29\Microsoft DirectX SDK %28June 2010%29\Lib\x86;..\lib\$(Configuration);..\Dependencies\lib\Release;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
       <AdditionalLibraryDirectories>C:\Program Files %28x86%29\Microsoft DirectX SDK %28June 2010%29\Lib\x86;..\lib\$(Configuration);..\Dependencies\lib\Release;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
       <ImportLibrary>..\lib\$(Configuration)\$(TargetName).lib</ImportLibrary>
       <ImportLibrary>..\lib\$(Configuration)\$(TargetName).lib</ImportLibrary>
     </Link>
     </Link>
@@ -140,7 +140,7 @@
       <GenerateDebugInformation>true</GenerateDebugInformation>
       <GenerateDebugInformation>true</GenerateDebugInformation>
       <EnableCOMDATFolding>true</EnableCOMDATFolding>
       <EnableCOMDATFolding>true</EnableCOMDATFolding>
       <OptimizeReferences>true</OptimizeReferences>
       <OptimizeReferences>true</OptimizeReferences>
-      <AdditionalDependencies>D3DCompiler.lib;CamelotRenderer.lib;CamelotUtility.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <AdditionalDependencies>dxguid.lib;D3DCompiler.lib;CamelotRenderer.lib;CamelotUtility.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
       <AdditionalLibraryDirectories>C:\Program Files %28x86%29\Microsoft DirectX SDK %28June 2010%29\Lib\x64;..\lib\$(Platform)\$(Configuration);..\Dependencies\lib\x64\Release;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
       <AdditionalLibraryDirectories>C:\Program Files %28x86%29\Microsoft DirectX SDK %28June 2010%29\Lib\x64;..\lib\$(Platform)\$(Configuration);..\Dependencies\lib\x64\Release;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
       <ImportLibrary>..\lib\$(Platform)\$(Configuration)\$(TargetName).lib</ImportLibrary>
       <ImportLibrary>..\lib\$(Platform)\$(Configuration)\$(TargetName).lib</ImportLibrary>
     </Link>
     </Link>
@@ -159,6 +159,7 @@
     <ClInclude Include="Include\CmD3D11Mappings.h" />
     <ClInclude Include="Include\CmD3D11Mappings.h" />
     <ClInclude Include="Include\CmD3D11Prerequisites.h" />
     <ClInclude Include="Include\CmD3D11Prerequisites.h" />
     <ClInclude Include="Include\CmD3D11HardwareVertexBuffer.h" />
     <ClInclude Include="Include\CmD3D11HardwareVertexBuffer.h" />
+    <ClInclude Include="Include\CmD3D11RenderSystem.h" />
     <ClInclude Include="Include\CmD3D11VertexDeclaration.h" />
     <ClInclude Include="Include\CmD3D11VertexDeclaration.h" />
     <ClInclude Include="Include\CmD3D11VideoMode.h" />
     <ClInclude Include="Include\CmD3D11VideoMode.h" />
     <ClInclude Include="Include\CmD3D11VideoModeList.h" />
     <ClInclude Include="Include\CmD3D11VideoModeList.h" />
@@ -176,6 +177,7 @@
     <ClCompile Include="Source\CmD3D11HardwareIndexBuffer.cpp" />
     <ClCompile Include="Source\CmD3D11HardwareIndexBuffer.cpp" />
     <ClCompile Include="Source\CmD3D11Mappings.cpp" />
     <ClCompile Include="Source\CmD3D11Mappings.cpp" />
     <ClCompile Include="Source\CmD3D11HardwareVertexBuffer.cpp" />
     <ClCompile Include="Source\CmD3D11HardwareVertexBuffer.cpp" />
+    <ClCompile Include="Source\CmD3D11RenderSystem.cpp" />
     <ClCompile Include="Source\CmD3D11VertexDeclaration.cpp" />
     <ClCompile Include="Source\CmD3D11VertexDeclaration.cpp" />
     <ClCompile Include="Source\CmD3D11VideoMode.cpp" />
     <ClCompile Include="Source\CmD3D11VideoMode.cpp" />
     <ClCompile Include="Source\CmD3D11VideoModeList.cpp" />
     <ClCompile Include="Source\CmD3D11VideoModeList.cpp" />

+ 6 - 0
CamelotD3D11RenderSystem/CamelotD3D11RenderSystem.vcxproj.filters

@@ -63,6 +63,9 @@
     <ClInclude Include="Include\CmD3D11VertexDeclaration.h">
     <ClInclude Include="Include\CmD3D11VertexDeclaration.h">
       <Filter>Header Files</Filter>
       <Filter>Header Files</Filter>
     </ClInclude>
     </ClInclude>
+    <ClInclude Include="Include\CmD3D11RenderSystem.h">
+      <Filter>Header Files</Filter>
+    </ClInclude>
   </ItemGroup>
   </ItemGroup>
   <ItemGroup>
   <ItemGroup>
     <ClCompile Include="Source\CmD3D11GpuProgram.cpp">
     <ClCompile Include="Source\CmD3D11GpuProgram.cpp">
@@ -110,5 +113,8 @@
     <ClCompile Include="Source\CmD3D11VertexDeclaration.cpp">
     <ClCompile Include="Source\CmD3D11VertexDeclaration.cpp">
       <Filter>Source Files</Filter>
       <Filter>Source Files</Filter>
     </ClCompile>
     </ClCompile>
+    <ClCompile Include="Source\CmD3D11RenderSystem.cpp">
+      <Filter>Source Files</Filter>
+    </ClCompile>
   </ItemGroup>
   </ItemGroup>
 </Project>
 </Project>

+ 5 - 5
CamelotD3D11RenderSystem/Include/CmD3D11GpuProgram.h

@@ -34,9 +34,9 @@ namespace CamelotEngine
 		~D3D11GpuVertexProgram();
 		~D3D11GpuVertexProgram();
 
 
 		ID3D11VertexShader* getVertexShader(void) const;
 		ID3D11VertexShader* getVertexShader(void) const;
+		void loadFromMicrocode(D3D11Device& device, ID3D10Blob* microcode);
 	protected:
 	protected:
 		void unloadImpl(void);
 		void unloadImpl(void);
-		void loadFromMicrocode(D3D11Device& device, ID3D10Blob* microcode);
 	};
 	};
 
 
 	class CM_D3D11_EXPORT D3D11GpuFragmentProgram : public D3D11GpuProgram
 	class CM_D3D11_EXPORT D3D11GpuFragmentProgram : public D3D11GpuProgram
@@ -48,9 +48,9 @@ namespace CamelotEngine
 		~D3D11GpuFragmentProgram();
 		~D3D11GpuFragmentProgram();
 
 
 		ID3D11PixelShader* getPixelShader(void) const;
 		ID3D11PixelShader* getPixelShader(void) const;
+		void loadFromMicrocode(D3D11Device& device, ID3D10Blob* microcode);
 	protected:
 	protected:
 		void unloadImpl(void);
 		void unloadImpl(void);
-		void loadFromMicrocode(D3D11Device& device, ID3D10Blob* microcode);
 	};
 	};
 
 
 	class D3D11GpuDomainProgram : public D3D11GpuProgram
 	class D3D11GpuDomainProgram : public D3D11GpuProgram
@@ -62,9 +62,9 @@ namespace CamelotEngine
 		~D3D11GpuDomainProgram();
 		~D3D11GpuDomainProgram();
 
 
 		ID3D11DomainShader* getDomainShader(void) const;
 		ID3D11DomainShader* getDomainShader(void) const;
+		void loadFromMicrocode(D3D11Device& device, ID3D10Blob* microcode);
 	protected:
 	protected:
 		void unloadImpl(void);
 		void unloadImpl(void);
-		void loadFromMicrocode(D3D11Device& device, ID3D10Blob* microcode);
 	};
 	};
 
 
 	class D3D11GpuHullProgram : public D3D11GpuProgram
 	class D3D11GpuHullProgram : public D3D11GpuProgram
@@ -76,9 +76,9 @@ namespace CamelotEngine
 		~D3D11GpuHullProgram();
 		~D3D11GpuHullProgram();
 
 
 		ID3D11HullShader* getHullShader() const;
 		ID3D11HullShader* getHullShader() const;
+		void loadFromMicrocode(D3D11Device& device, ID3D10Blob* microcode);
 	protected:
 	protected:
 		void unloadImpl(void);
 		void unloadImpl(void);
-		void loadFromMicrocode(D3D11Device& device, ID3D10Blob* microcode);
 	};
 	};
 
 
 	class D3D11GpuGeometryProgram : public D3D11GpuProgram
 	class D3D11GpuGeometryProgram : public D3D11GpuProgram
@@ -90,8 +90,8 @@ namespace CamelotEngine
 		~D3D11GpuGeometryProgram();
 		~D3D11GpuGeometryProgram();
 
 
 		ID3D11GeometryShader* getGeometryShader(void) const;
 		ID3D11GeometryShader* getGeometryShader(void) const;
+		void loadFromMicrocode(D3D11Device& device, ID3D10Blob* microcode);
 	protected:
 	protected:
 		void unloadImpl(void);
 		void unloadImpl(void);
-		void loadFromMicrocode(D3D11Device& device, ID3D10Blob* microcode);
 	};
 	};
 }
 }

+ 77 - 0
CamelotD3D11RenderSystem/Include/CmD3D11RenderSystem.h

@@ -0,0 +1,77 @@
+#pragma once
+
+#include "CmD3D11Prerequisites.h"
+#include "CmRenderSystem.h"
+
+namespace CamelotEngine
+{
+	class CM_D3D11_EXPORT D3D11RenderSystem : public RenderSystem
+	{
+	public:
+		//D3D11RenderSystem();
+		//~D3D11RenderSystem();
+
+		//const String& getName() const;
+		//void startUp_internal();
+		//void shutdown();
+
+		//void setStencilCheckEnabled_internal(bool enabled);
+		//void setStencilBufferParams_internal(CompareFunction func = CMPF_ALWAYS_PASS, 
+		//	UINT32 refValue = 0, UINT32 mask = 0xFFFFFFFF, 
+		//	StencilOperation stencilFailOp = SOP_KEEP, 
+		//	StencilOperation depthFailOp = SOP_KEEP,
+		//	StencilOperation passOp = SOP_KEEP, 
+		//	bool twoSidedOperation = false);
+
+		//void createRenderWindow_internal(const String &name, unsigned int width, unsigned int height, bool fullScreen, const NameValuePairList& miscParams, AsyncOp& asyncOp);
+		//void destroyRenderTarget_internal(RenderTarget* renderTarget);
+		//void setRenderTarget_internal(RenderTarget *target);
+
+		//void bindGpuProgram_internal(GpuProgramHandle prg);
+		//void unbindGpuProgram_internal(GpuProgramType gptype);
+		//void bindGpuProgramParameters_internal(GpuProgramType gptype, GpuProgramParametersSharedPtr params, UINT16 variabilityMask);
+
+		//void setPointParameters_internal(float size, bool attenuationEnabled, float constant, float linear, float quadratic, float minSize, float maxSize);
+		//void setTexture_internal(UINT16 unit, bool enabled, const TexturePtr &texPtr);
+		//void setVertexTexture_internal(UINT16 unit, const TexturePtr& tex);
+		//void disableTextureUnit_internal(UINT16 texUnit);
+		//void setTextureAddressingMode_internal(UINT16 stage, const SamplerState::UVWAddressingMode& uvw);
+		//void setTextureBorderColor_internal(UINT16 stage, const Color& colour);
+		//void setTextureMipmapBias_internal(UINT16 unit, float bias);
+		//void setSceneBlending_internal( SceneBlendFactor sourceFactor, SceneBlendFactor destFactor, SceneBlendOperation op );
+		//void setSeparateSceneBlending_internal( SceneBlendFactor sourceFactor, SceneBlendFactor destFactor, SceneBlendFactor sourceFactorAlpha, SceneBlendFactor destFactorAlpha, SceneBlendOperation op, SceneBlendOperation alphaOp );
+		//void setAlphaRejectSettings_internal( CompareFunction func, unsigned char value, bool alphaToCoverage );
+		//void setViewport_internal(const Viewport& vp);				
+		//void setCullingMode_internal(CullingMode mode);
+		//void setDepthBufferParams_internal( bool depthTest = true, bool depthWrite = true, CompareFunction depthFunction = CMPF_LESS_EQUAL );
+		//void setDepthBufferCheckEnabled_internal( bool enabled = true );
+		//void setColorBufferWriteEnabled_internal(bool red, bool green, bool blue, bool alpha);
+		//void setDepthBufferWriteEnabled_internal(bool enabled = true);
+		//void setDepthBufferFunction_internal( CompareFunction func = CMPF_LESS_EQUAL );
+		//void setDepthBias_internal(float constantBias, float slopeScaleBias);
+		//void setPolygonMode_internal(PolygonMode level);
+		//void setTextureFiltering_internal(UINT16 unit, FilterType ftype, FilterOptions filter);
+		//void setTextureAnisotropy_internal(UINT16 unit, unsigned int maxAnisotropy);
+		//void setVertexDeclaration_internal(VertexDeclarationPtr decl);
+		//void setVertexBufferBinding_internal(VertexBufferBinding* binding);
+
+		//void render_internal(const RenderOperation& op);
+		//void beginFrame_internal();
+		//void endFrame_internal();
+
+		//void setScissorTest_internal(bool enabled, UINT32 left = 0, UINT32 top = 0, UINT32 right = 800, UINT32 bottom = 600);
+		//void clearFrameBuffer_internal(unsigned int buffers, const Color& colour = Color::Black, float depth = 1.0f, unsigned short stencil = 0);
+
+		//float getHorizontalTexelOffset();
+		//float getVerticalTexelOffset();
+		//float getMinimumDepthInputValue();
+		//float getMaximumDepthInputValue();
+		//VertexElementType getColorVertexElementType() const;
+		//void convertProjectionMatrix(const Matrix4& matrix, Matrix4& dest, bool forGpuProgram = false);
+
+		static D3D11Device& getPrimaryDevice();
+	protected:
+
+	private:
+	};
+}

+ 1 - 1
CamelotD3D11RenderSystem/Source/CmD3D11GpuProgram.cpp

@@ -34,7 +34,7 @@ namespace CamelotEngine
 		unload_internal(); 
 		unload_internal(); 
 	}
 	}
 
 
-	void D3D11GpuVertexProgram::loadFromMicrocode(D3D11Device& device, ID3D10Blob *  microcode)
+	void D3D11GpuVertexProgram::loadFromMicrocode(D3D11Device& device, ID3D10Blob*  microcode)
 	{
 	{
 		if (isSupported())
 		if (isSupported())
 		{
 		{

+ 24 - 13
CamelotD3D11RenderSystem/Source/CmD3D11HLSLProgram.cpp

@@ -5,6 +5,7 @@
 #include "CmD3D11GpuProgram.h"
 #include "CmD3D11GpuProgram.h"
 #include "CmHardwareBufferManager.h"
 #include "CmHardwareBufferManager.h"
 #include "CmHardwareConstantBuffer.h"
 #include "CmHardwareConstantBuffer.h"
+#include "CmD3D11RenderSystem.h"
 #include "CmException.h"
 #include "CmException.h"
 #include "CmDebug.h"
 #include "CmDebug.h"
 
 
@@ -38,24 +39,34 @@ namespace CamelotEngine
 		switch(mType)
 		switch(mType)
 		{
 		{
 		case GPT_VERTEX_PROGRAM:
 		case GPT_VERTEX_PROGRAM:
-			D3D11GpuVertexProgramPtr vertProgram = std::static_pointer_cast<D3D11GpuVertexProgram>(mAssemblerProgram);
-			vertProgram->loadFromMicrocode(D3D11RenderSystem::getPrimaryDevice(), microcode);
+			{
+				D3D11GpuVertexProgramPtr vertProgram = std::static_pointer_cast<D3D11GpuVertexProgram>(mAssemblerProgram);
+				vertProgram->loadFromMicrocode(D3D11RenderSystem::getPrimaryDevice(), microcode);
+			}
 			break;
 			break;
 		case GPT_FRAGMENT_PROGRAM:
 		case GPT_FRAGMENT_PROGRAM:
-			D3D11GpuFragmentProgramPtr fragProgram = std::static_pointer_cast<D3D11GpuFragmentProgram>(mAssemblerProgram);
-			fragProgram->loadFromMicrocode(D3D11RenderSystem::getPrimaryDevice(), microcode);
+			{
+				D3D11GpuFragmentProgramPtr fragProgram = std::static_pointer_cast<D3D11GpuFragmentProgram>(mAssemblerProgram);
+				fragProgram->loadFromMicrocode(D3D11RenderSystem::getPrimaryDevice(), microcode);
+			}
 			break;
 			break;
 		case GPT_GEOMETRY_PROGRAM:
 		case GPT_GEOMETRY_PROGRAM:
-			D3D11GpuGeometryProgramPtr geomProgram = std::static_pointer_cast<D3D11GpuGeometryProgram>(mAssemblerProgram);
-			geomProgram->loadFromMicrocode(D3D11RenderSystem::getPrimaryDevice(), microcode);
+			{
+				D3D11GpuGeometryProgramPtr geomProgram = std::static_pointer_cast<D3D11GpuGeometryProgram>(mAssemblerProgram);
+				geomProgram->loadFromMicrocode(D3D11RenderSystem::getPrimaryDevice(), microcode);
+			}
 			break;
 			break;
 		case GPT_HULL_PROGRAM:
 		case GPT_HULL_PROGRAM:
-			D3D11GpuHullProgramPtr hullProgram = std::static_pointer_cast<D3D11GpuHullProgram>(mAssemblerProgram);
-			hullProgram->loadFromMicrocode(D3D11RenderSystem::getPrimaryDevice(), microcode);
+			{
+				D3D11GpuHullProgramPtr hullProgram = std::static_pointer_cast<D3D11GpuHullProgram>(mAssemblerProgram);
+				hullProgram->loadFromMicrocode(D3D11RenderSystem::getPrimaryDevice(), microcode);
+			}
 			break;
 			break;
 		case GPT_DOMAIN_PROGRAM:
 		case GPT_DOMAIN_PROGRAM:
-			D3D11GpuDomainProgramPtr domainProgram = std::static_pointer_cast<D3D11GpuDomainProgram>(mAssemblerProgram);
-			domainProgram->loadFromMicrocode(D3D11RenderSystem::getPrimaryDevice(), microcode);
+			{
+				D3D11GpuDomainProgramPtr domainProgram = std::static_pointer_cast<D3D11GpuDomainProgram>(mAssemblerProgram);
+				domainProgram->loadFromMicrocode(D3D11RenderSystem::getPrimaryDevice(), microcode);
+			}
 			break;
 			break;
 		}
 		}
 
 
@@ -156,7 +167,7 @@ namespace CamelotEngine
 			CM_EXCEPT(RenderingAPIException, "Unable to disassemble shader.");
 			CM_EXCEPT(RenderingAPIException, "Unable to disassemble shader.");
 
 
 		ID3D11ShaderReflection* shaderReflection;
 		ID3D11ShaderReflection* shaderReflection;
-		HRESULT hr = D3DReflect((void*)microcode->GetBufferPointer(), microcode->GetBufferSize(),
+		hr = D3DReflect((void*)microcode->GetBufferPointer(), microcode->GetBufferSize(),
 			IID_ID3D11ShaderReflection, (void**)&shaderReflection);
 			IID_ID3D11ShaderReflection, (void**)&shaderReflection);
 
 
 		if (FAILED(hr))
 		if (FAILED(hr))
@@ -192,7 +203,7 @@ namespace CamelotEngine
 	{
 	{
 		createParameterMappingStructures(true);
 		createParameterMappingStructures(true);
 
 
-		for(auto shaderBufferIter = mShaderBuffers.begin(); shaderBufferIter != mShaderBuffers.end; ++shaderBufferIter)
+		for(auto shaderBufferIter = mShaderBuffers.begin(); shaderBufferIter != mShaderBuffers.end(); ++shaderBufferIter)
 		{
 		{
 			for(size_t i = 0; i < shaderBufferIter->variables.size(); i++)
 			for(size_t i = 0; i < shaderBufferIter->variables.size(); i++)
 			{
 			{
@@ -442,7 +453,7 @@ namespace CamelotEngine
 	{
 	{
 		mConstantBuffers.clear();
 		mConstantBuffers.clear();
 
 
-		for(auto shaderBufferIter = mShaderBuffers.begin(); shaderBufferIter != mShaderBuffers.end; ++shaderBufferIter)
+		for(auto shaderBufferIter = mShaderBuffers.begin(); shaderBufferIter != mShaderBuffers.end(); ++shaderBufferIter)
 		{
 		{
 			HardwareConstantBufferPtr constantBuffer = HardwareBufferManager::instance().createConstantBuffer(shaderBufferIter->desc.Size, HardwareBuffer::HBU_DYNAMIC_WRITE_ONLY);
 			HardwareConstantBufferPtr constantBuffer = HardwareBufferManager::instance().createConstantBuffer(shaderBufferIter->desc.Size, HardwareBuffer::HBU_DYNAMIC_WRITE_ONLY);
 			mConstantBuffers.push_back(constantBuffer);
 			mConstantBuffers.push_back(constantBuffer);

+ 11 - 0
CamelotD3D11RenderSystem/Source/CmD3D11RenderSystem.cpp

@@ -0,0 +1,11 @@
+#include "CmD3D11RenderSystem.h"
+#include "CmRenderSystem.h"
+#include "CmException.h"
+
+namespace CamelotEngine
+{
+	D3D11Device& D3D11RenderSystem::getPrimaryDevice() 
+	{ 
+		CM_EXCEPT(NotImplementedException, "Not implemented"); 
+	}
+}

+ 1 - 1
CamelotRenderer/Source/CmRenderSystemContext.cpp

@@ -164,7 +164,7 @@ namespace CamelotEngine
 	}
 	}
 
 
 	/************************************************************************/
 	/************************************************************************/
-	/* 							IMMEDIATE CONTEXT						*/
+	/* 							IMMEDIATE CONTEXT							*/
 	/************************************************************************/
 	/************************************************************************/
 
 
 	RenderSystemImmediateContext::RenderSystemImmediateContext(CM_THREAD_ID_TYPE threadId)
 	RenderSystemImmediateContext::RenderSystemImmediateContext(CM_THREAD_ID_TYPE threadId)

+ 48 - 0
CamelotRenderer/TODO.txt

@@ -12,6 +12,28 @@
 
 
 -----------------------IMMEDIATE TODO---------------------------------------------------------------
 -----------------------IMMEDIATE TODO---------------------------------------------------------------
 
 
+
+
+
+
+/////
+First port (and test!) existing render systems so it is capable of dealing with DX11 stuff(samplerState, depthStencilState, rasterizerState objects primarily. Also split pass into Texture/sampler) 
+Also create immediate & deferred render context we can call render system methods on directly (immediate just calls render system using inline methods)
+ - How to async call non-rendersystem methods? Like GpuProgram?? They either have to have contexts of their own (clumsy) or keep the like it is (separate method pairs, which is not the same interface
+   as the render system)
+Doublecheck the validity of resource and non-resource contexts
+ - Calling a non-async resource method will block until the render thread is completely finished with its current task! (Is there a way to avoid that though?)
+ - I need to define proper order of resource and render calls. What if a resource tries to get changed in the middle of a render call? It should only queue itself after
+   all previous command buffers are done executing.
+    - Whenever user does DeferredContext::submitCommands, all resource commands before that should get processed and only then should that command buffer be executed
+ - Mutexes are slow as shit. Find a way to avoid them? (Primarily for resources, but check if we extensively used them elsewhere too)
+/////
+
+
+
+
+
+
 RenderSystem needed modifications
 RenderSystem needed modifications
  - HLSL specifies Texture & Sampler separately
  - HLSL specifies Texture & Sampler separately
    - Will probably need a rendersystem specific sampler object implementation
    - Will probably need a rendersystem specific sampler object implementation
@@ -41,6 +63,31 @@ RenderSystem needed modifications
 	- HLSL11 shader equivalents (domain/hull/compute shaders), and advanced shader parameters
 	- HLSL11 shader equivalents (domain/hull/compute shaders), and advanced shader parameters
  - HLSL9/HLSL11/GLSL/Cg shaders need preprocessor defines & includes
  - HLSL9/HLSL11/GLSL/Cg shaders need preprocessor defines & includes
 
 
+ RenderSystem modifications, yet another list:
+   - SamplerState - separate object. Multiple objects per pass
+   - RasterizerState - separate object containing all the DX9 and GL variables that were so far solo (fill mode, cull mode, etc). One per pass
+   - DepthStencilState - also separate object, one per pass
+
+   - Edit RenderSystem so it only accepts those objects (in bulk), and not individual commands? (Since DX11 can't accept individual commands)
+
+   - DepthStencilView & RenderTargetView are automatically created for any RenderTarget (no special mechanism for setting them needed)
+
+   - Extend pass with "struct" (void*) parameters to that they can be assigned to constant buffers, and also expand it so it accepts separate textures & samplers. 
+   - Extend pass so it accepts "GenericBuffers"
+
+   - Add support for "GenericBuffers" (normal/structured/raw/append/consume/indirect)
+   - Add support for texture buffer
+
+   - Ability to set vertex buffer as a stream output buffer (also added to Pass)
+
+   - Set viewport & scissor rect to rasterizer (should probably be part of RenderTarget. If so, modify DX9 and GL so they act the same)
+
+   - Ability to create & assign unordered access views to OM and CS stages. (Extend pass and HardwareBufferManager)
+
+   - Extend render system with DrawInstanced (Also with DrawIndirect?)
+
+   - (Separate Pass parameters so that they are accepted per GpuProgramType, instead of using a global name?)
+
 Command buffer TODO:
 Command buffer TODO:
  - When importing a resource, and registering it with Resources I don't think it properly gets added to the loaded resources array? For some reason shaders get created twice.
  - When importing a resource, and registering it with Resources I don't think it properly gets added to the loaded resources array? For some reason shaders get created twice.
  - My current approach doesn't allow multiple threads to use the RenderSystem (contexts should be handled differently)
  - My current approach doesn't allow multiple threads to use the RenderSystem (contexts should be handled differently)
@@ -126,6 +173,7 @@ Optional TODO:
  -----------------------------------------------------------------------------------------------
  -----------------------------------------------------------------------------------------------
 
 
 After everything is polished
 After everything is polished
+ - Each view (i.e. camera) of the scene should be put into its own thread
  - How do I handle multiple mesh formats? Some files need animation, other don't. Some would mabye like to use QTangent, others the proper tangent frame.
  - How do I handle multiple mesh formats? Some files need animation, other don't. Some would mabye like to use QTangent, others the proper tangent frame.
  - Load texture mips separately so we can unload HQ textures from far away objects (like UE3)
  - Load texture mips separately so we can unload HQ textures from far away objects (like UE3)
  - Add Unified shader so I can easily switch between HLSL and GLSL shaders (they need same parameters usually, just different code)
  - Add Unified shader so I can easily switch between HLSL and GLSL shaders (they need same parameters usually, just different code)