Forráskód Böngészése

fix crash when botom level aceleration structure per updated during model loading

Kolja Strohm 2 hete
szülő
commit
ce541bccb6
3 módosított fájl, 31 hozzáadás és 0 törlés
  1. 5 0
      DX12BLASModel.cpp
  2. 24 0
      Framework.vcxproj
  3. 2 0
      Model3D.cpp

+ 5 - 0
DX12BLASModel.cpp

@@ -49,6 +49,11 @@ void Framework::DX12BLASModel::calculateBuffers()
         return;
     }
     zModelData->lock();
+    if (!zModelData->getPolygonCount())
+    {
+        zModelData->unlock();
+        return;
+    }
     Skeleton* skeleton = zModelData->zSkeleton();
     const Vertex3D* vertexBuffer = zModelData->zVertexBuffer();
     const int* indexBuffer = zModelData->getIndexBuffer();

+ 24 - 0
Framework.vcxproj

@@ -440,6 +440,12 @@ copy "x64\Release\Framework.dll" "..\..\Spiele Platform\SMP\Fertig\x64\framework
       <VariableName Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">DX12Default%(Filename)ShaderBytes</VariableName>
       <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">DX12Default%(Filename)Shader.h</HeaderFileOutput>
       <AdditionalOptions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">-Fd "x64\Debug\DX12Default%(Filename)Shader.pdb" %(AdditionalOptions)</AdditionalOptions>
+      <ShaderType Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Library</ShaderType>
+      <ShaderModel Condition="'$(Configuration)|$(Platform)'=='Release|x64'">6.8</ShaderModel>
+      <VariableName Condition="'$(Configuration)|$(Platform)'=='Release|x64'">DX12Default%(Filename)ShaderBytes</VariableName>
+      <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='Release|x64'">DX12Default%(Filename)Shader.h</HeaderFileOutput>
+      <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+      </ObjectFileOutput>
     </FxCompile>
     <FxCompile Include="DX11PixelShader.hlsl">
       <ShaderType Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Pixel</ShaderType>
@@ -499,6 +505,12 @@ copy "x64\Release\Framework.dll" "..\..\Spiele Platform\SMP\Fertig\x64\framework
       <AdditionalOptions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">-Fd "x64\Debug\DX12Default%(Filename)Shader.pdb" %(AdditionalOptions)</AdditionalOptions>
       <ShaderType Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Library</ShaderType>
       <VariableName Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">DX12Default%(Filename)ShaderBytes</VariableName>
+      <ShaderModel Condition="'$(Configuration)|$(Platform)'=='Release|x64'">6.8</ShaderModel>
+      <VariableName Condition="'$(Configuration)|$(Platform)'=='Release|x64'">DX12Default%(Filename)ShaderBytes</VariableName>
+      <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='Release|x64'">DX12Default%(Filename)Shader.h</HeaderFileOutput>
+      <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+      </ObjectFileOutput>
+      <ShaderType Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Library</ShaderType>
     </FxCompile>
     <FxCompile Include="Miss.hlsl">
       <EntryPointName Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
@@ -514,6 +526,12 @@ copy "x64\Release\Framework.dll" "..\..\Spiele Platform\SMP\Fertig\x64\framework
       <AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Common.hlsl</AdditionalInputs>
       <ShaderType Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Library</ShaderType>
       <VariableName Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">DX12Default%(Filename)ShaderBytes</VariableName>
+      <ShaderType Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Library</ShaderType>
+      <ShaderModel Condition="'$(Configuration)|$(Platform)'=='Release|x64'">6.8</ShaderModel>
+      <VariableName Condition="'$(Configuration)|$(Platform)'=='Release|x64'">DX12Default%(Filename)ShaderBytes</VariableName>
+      <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='Release|x64'">DX12Default%(Filename)Shader.h</HeaderFileOutput>
+      <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+      </ObjectFileOutput>
     </FxCompile>
     <FxCompile Include="RayGen.hlsl">
       <EntryPointName Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
@@ -529,6 +547,12 @@ copy "x64\Release\Framework.dll" "..\..\Spiele Platform\SMP\Fertig\x64\framework
       <AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Common.hlsl</AdditionalInputs>
       <ShaderType Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Library</ShaderType>
       <VariableName Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">DX12Default%(Filename)ShaderBytes</VariableName>
+      <ShaderType Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Library</ShaderType>
+      <ShaderModel Condition="'$(Configuration)|$(Platform)'=='Release|x64'">6.8</ShaderModel>
+      <VariableName Condition="'$(Configuration)|$(Platform)'=='Release|x64'">DX12Default%(Filename)ShaderBytes</VariableName>
+      <HeaderFileOutput Condition="'$(Configuration)|$(Platform)'=='Release|x64'">DX12Default%(Filename)Shader.h</HeaderFileOutput>
+      <ObjectFileOutput Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+      </ObjectFileOutput>
     </FxCompile>
   </ItemGroup>
   <ItemGroup>

+ 2 - 0
Model3D.cpp

@@ -450,8 +450,10 @@ void Model3DData::setVertecies(Vertex3D* vertexList, int anz)
 //  polygon: The polygon to be added
 void Model3DData::addPolygon(Polygon3D* polygon)
 {
+    cs.lock();
     polygons->add(polygon);
     buildIndexBuffer();
+    cs.unlock();
 }
 
 // Sets the factor by which the ambient light (texture color) is multiplied