diff --git a/res/shaders/DepthCullingTask.slang b/res/shaders/DepthCullingTask.slang index 0aa964a..e98a2ac 100644 --- a/res/shaders/DepthCullingTask.slang +++ b/res/shaders/DepthCullingTask.slang @@ -103,8 +103,10 @@ void taskMain( viewFrustum.sides[1] = computePlane(origin, corners[1], corners[3]); viewFrustum.sides[2] = computePlane(origin, corners[0], corners[1]); viewFrustum.sides[3] = computePlane(origin, corners[3], corners[2]); + meshVisible = true; +#ifdef DEPTH_CULLING meshVisible = mesh.bounding.insideFrustum(viewFrustum) && isBoxVisible(mesh.bounding); - //meshVisible = true; +#endif } GroupMemoryBarrierWithGroupSync(); if(!meshVisible) diff --git a/res/shaders/lib/LightEnv.slang b/res/shaders/lib/LightEnv.slang index a8c9217..b3e87f9 100644 --- a/res/shaders/lib/LightEnv.slang +++ b/res/shaders/lib/LightEnv.slang @@ -14,7 +14,7 @@ struct DirectionalLight : ILightEnv float3 illuminate(LightingParameter params, B brdf) { - float3 dir_TS = mul(params.tbn, -normalize(direction.xyz)); + float3 dir_TS = mul(params.worldToTangent, -normalize(direction.xyz)); return brdf.evaluate(params.viewDir_TS, dir_TS, color.xyz); } }; @@ -26,7 +26,7 @@ struct PointLight : ILightEnv float3 illuminate(LightingParameter params, B brdf) { - float3 pos_TS = mul(params.tbn, position_WS.xyz); + float3 pos_TS = mul(params.worldToTangent, position_WS.xyz); float3 lightDir_TS = pos_TS.xyz - params.position_TS; float d = length(lightDir_TS); float illuminance = max(1 - d / colorRange.w, 0); diff --git a/res/shaders/lib/MaterialParameter.slang b/res/shaders/lib/MaterialParameter.slang index 1783769..a60bb3f 100644 --- a/res/shaders/lib/MaterialParameter.slang +++ b/res/shaders/lib/MaterialParameter.slang @@ -7,34 +7,40 @@ struct MaterialParameter float3 vertexColor; }; -// data used by light environment struct LightingParameter { - float3x3 tbn; - float3 normal_TS; - float3 position_TS; - float3 viewDir_TS; -}; + float3x3 worldToTangent; + float3 viewDir_TS; + float3 position_TS; +} + +// Constructs a TBN matrix from a unpacked qtangent for example for after vertex interpolation in the fragment shader +float3x3 constructTBNFromQTangent(float4 q){ + q = normalize(q); // Ensure that the quaternion is normalized in case it is not, for example after interpolation and so on + float3 t2 = q.xyz * 2.0, tx = q.xxx * t2.xyz, ty = q.yyy * t2.xyz, tz = q.www * t2.xyz; + float3 tangent = float3(1.0 - (ty.y + (q.z * t2.z)), tx.y + tz.z, tx.z - tz.y); + float3 normal = float3(tx.z + tz.y, ty.z - tz.x, 1.0 - (tx.x + ty.y)); + return float3x3(tangent, cross(tangent, normal) * ((q.w < 0.0) ? -1.0 : 1.0), normal); +} // data passed to fragment shader struct FragmentParameter { float4 position_CS : SV_Position; #ifndef POS_ONLY - float3 normal_WS : NORMALWS; - float3 tangent_WS : TANGENTWS; - float3 biTangent_WS : BITANGENTWS; + float4 qTangent : QTANGENT; float3 position_WS : POSITIONWS; + float3 position_TS : POSITIONTS; + float3 viewDir_TS : VIEWDIRTS; float3 vertexColor : COLOR; float4 texCoords0 : TEXCOORDS0; float4 texCoords1 : TEXCOORDS1; float4 texCoords2 : TEXCOORDS2; float4 texCoords3 : TEXCOORDS3; - MaterialParameter getMaterialParameter() - { - MaterialParameter result; - result.position_WS = position_WS; - result.vertexColor = vertexColor; + MaterialParameter getMaterialParameter() + { + MaterialParameter result; + result.position_WS = position_WS; result.texCoords[0] = texCoords0.xy; result.texCoords[1] = texCoords0.zw; result.texCoords[2] = texCoords1.xy; @@ -43,22 +49,18 @@ struct FragmentParameter result.texCoords[5] = texCoords2.zw; result.texCoords[6] = texCoords3.xy; result.texCoords[7] = texCoords3.zw; - return result; - } - LightingParameter getLightingParameter() - { - LightingParameter result; - float3x3 tbn = float3x3(normalize(tangent_WS), normalize(biTangent_WS), normalize(normal_WS)); - result.tbn = tbn; - result.position_TS = mul(tbn, position_WS); - result.viewDir_TS = mul(tbn, normalize(pViewParams.cameraPosition_WS.xyz - position_WS)); - result.normal_TS = mul(tbn, normal_WS); - return result; - } - float3x3 getTangentToWorld() + result.vertexColor = vertexColor; + return result; + } + + LightingParameter getLightingParameter() { - float3x3 tbn = float3x3(normalize(tangent_WS), normalize(biTangent_WS), normalize(normal_WS)); - return transpose(tbn); + float3x3 worldToTangent = transpose(constructTBNFromQTangent(qTangent)); + LightingParameter result; + result.worldToTangent = worldToTangent; + result.viewDir_TS = viewDir_TS; + result.position_TS = position_TS; + return result; } #endif static FragmentParameter interpolate(FragmentParameter f0, FragmentParameter f1, FragmentParameter f2, float3 barycentricCoords) @@ -66,9 +68,7 @@ struct FragmentParameter FragmentParameter result; result.position_CS = f0.position_CS * barycentricCoords.x + f1.position_CS * barycentricCoords.y + f2.position_CS * barycentricCoords.z; #ifndef POS_ONLY - result.normal_WS = f0.normal_WS * barycentricCoords.x + f1.normal_WS * barycentricCoords.y + f2.normal_WS * barycentricCoords.z; - result.tangent_WS = f0.tangent_WS * barycentricCoords.x + f1.tangent_WS * barycentricCoords.y + f2.tangent_WS * barycentricCoords.z; - result.biTangent_WS = f0.biTangent_WS * barycentricCoords.x + f1.biTangent_WS * barycentricCoords.y + f2.biTangent_WS * barycentricCoords.z; + result.qTangent = f0.qTangent * barycentricCoords.x + f1.qTangent * barycentricCoords.y + f2.qTangent * barycentricCoords.z; result.position_WS = f0.position_WS * barycentricCoords.x + f1.position_WS * barycentricCoords.y + f2.position_WS * barycentricCoords.z; result.vertexColor = f0.vertexColor * barycentricCoords.x + f1.vertexColor * barycentricCoords.y + f2.vertexColor * barycentricCoords.z; //for(uint i = 0; i < MAX_TEXCOORDS; ++i) @@ -85,9 +85,7 @@ struct VertexAttributes { float3 position_MS; #ifndef POS_ONLY - float3 normal_MS; - float3 tangent_MS; - float3 biTangent_MS; + float4 qTangent; float3 vertexColor; float2 texCoords[MAX_TEXCOORDS]; #endif @@ -100,15 +98,12 @@ struct VertexAttributes FragmentParameter result; result.position_CS = clipPos; #ifndef POS_ONLY - float3x3 normalMatrix = float3x3(transformMatrix); - float3 T = mul(normalMatrix, tangent_MS); - float3 N = mul(normalMatrix, normal_MS); - float3 B = mul(normalMatrix, biTangent_MS); - result.normal_WS = N; - result.tangent_WS = T; - result.biTangent_WS = B; - result.position_WS = worldPos.xyz; + result.qTangent = qTangent; + float3x3 tbn = transpose(constructTBNFromQTangent(qTangent)); + result.position_TS = mul(tbn, worldPos.xyz); result.vertexColor = vertexColor; + result.position_WS = worldPos.xyz; + result.viewDir_TS = mul(tbn, pViewParams.cameraPosition_WS.xyz - worldPos.xyz); result.texCoords0 = float4(texCoords[0], texCoords[1]); result.texCoords1 = float4(texCoords[2], texCoords[3]); result.texCoords2 = float4(texCoords[4], texCoords[5]); diff --git a/res/shaders/lib/StaticMeshVertexData.slang b/res/shaders/lib/StaticMeshVertexData.slang index e515e05..5c6a1c2 100644 --- a/res/shaders/lib/StaticMeshVertexData.slang +++ b/res/shaders/lib/StaticMeshVertexData.slang @@ -8,33 +8,22 @@ struct StaticMeshVertexData { return value / 65535.0f; } - float3 xAxis( float4 qQuat ) - { - float fTy = 2.0 * qQuat.y; - float fTz = 2.0 * qQuat.z; - float fTwy = fTy * qQuat.w; - float fTwz = fTz * qQuat.w; - float fTxy = fTy * qQuat.x; - float fTxz = fTz * qQuat.x; - float fTyy = fTy * qQuat.y; - float fTzz = fTz * qQuat.z; - - return float3( 1.0-(fTyy+fTzz), fTxy+fTwz, fTxz-fTwy ); + + float3x3 decodeQTangentUI32(uint v){ + float4 q = float4(((float3(int3(uint3((uint3(v) >> uint3(0u, 10u, 20u)) & uint2(0x3ffu, 0x1ffu).xxy)) - int2(512, 256).xxy)) / float2(511.0, 255.0).xxy) * 0.7071067811865475, 0.0); + q.w = sqrt(1.0 - clamp(dot(q.xyz, q.xyz), 0.0, 1.0)); + q = normalize(float4[4](q.wxyz, q.xwyz, q.xywz, q.xyzw)[uint((v >> 30u) & 0x3u)]); + float3 t2 = q.xyz * 2.0, tx = q.xxx * t2.xyz, ty = q.yyy * t2.xyz, tz = q.www * t2.xyz; + float3 tangent = float3(1.0 - (ty.y + (q.z * t2.z)), tx.y + tz.z, tx.z - tz.y); + float3 normal = float3(tx.z + tz.y, ty.z - tz.x, 1.0 - (tx.x + ty.y)); + return float3x3(tangent, cross(tangent, normal) * (((v & (1u << 29u)) != 0u) ? -1.0 : 1.0), normal); } - - float3 yAxis( float4 qQuat ) - { - float fTx = 2.0 * qQuat.x; - float fTy = 2.0 * qQuat.y; - float fTz = 2.0 * qQuat.z; - float fTwx = fTx * qQuat.w; - float fTwz = fTz * qQuat.w; - float fTxx = fTx * qQuat.x; - float fTxy = fTy * qQuat.x; - float fTyz = fTz * qQuat.y; - float fTzz = fTz * qQuat.z; - - return float3( fTxy-fTwz, 1.0-(fTxx+fTzz), fTyz+fTwx ); + + // Decodes the UI32 encoded qtangent into a unpacked qtangent for further processing like vertex interpolation and so on + float4 decodeQTangentUI32Raw(uint v){ + float4 q = float4(((float3(int3(uint3((uint3(v) >> uint3(0u, 10u, 20u)) & uint2(0x3ffu, 0x1ffu).xxy)) - int2(512, 256).xxy)) / float2(511.0, 255.0).xxy) * 0.7071067811865475, 0.0); + q.w = sqrt(1.0 - clamp(dot(q.xyz, q.xyz), 0.0, 1.0)); + return normalize(float4[4](q.wxyz, q.xwyz, q.xywz, q.xyzw)[uint((v >> 30u) & 0x3u)]) * (((v & (1u << 29u)) != 0u) ? -1.0 : 1.0); } VertexAttributes getAttributes(uint index) @@ -42,11 +31,7 @@ struct StaticMeshVertexData VertexAttributes attributes; attributes.position_MS = float3(positions[index * 3 + 0], positions[index * 3 + 1], positions[index * 3 + 2]); #ifndef POS_ONLY - float4 qtangent = normalize(qtangents[index]); - attributes.normal_MS = xAxis(qtangent); - attributes.tangent_MS = yAxis(qtangent); - float biNormalReflection = sign(qtangents[index].w); - attributes.biTangent_MS = cross(attributes.normal_MS, attributes.tangent_MS) * biNormalReflection; + attributes.qTangent = decodeQTangentUI32Raw(qtangents[index]); for(uint i = 0; i < MAX_TEXCOORDS; ++i) { attributes.texCoords[i] = float2(uint16ToFloat(texCoords[i][index * 2 + 0]), uint16ToFloat(texCoords[i][index * 2 + 1])); @@ -56,7 +41,7 @@ struct StaticMeshVertexData return attributes; } StructuredBuffer positions; - StructuredBuffer qtangents; + StructuredBuffer qtangents; StructuredBuffer color; StructuredBuffer texCoords[MAX_TEXCOORDS]; }; diff --git a/src/Editor/Asset/MeshLoader.cpp b/src/Editor/Asset/MeshLoader.cpp index 6028a06..3cbd956 100644 --- a/src/Editor/Asset/MeshLoader.cpp +++ b/src/Editor/Asset/MeshLoader.cpp @@ -452,7 +452,7 @@ void MeshLoader::loadMaterials(const aiScene* scene, const Array& } } -void findMeshRoots(aiNode* node, List& meshNodes) { +void MeshLoader::findMeshRoots(aiNode* node, List& meshNodes) { if (node->mNumMeshes > 0) { meshNodes.add(node); return; @@ -462,6 +462,40 @@ void findMeshRoots(aiNode* node, List& meshNodes) { } } +uint32 MeshLoader::encodeQTangent(Matrix3 m) { + float r = (glm::determinant(m) ? -1.0 : 1.0); + m[2] *= r; + float t = m[0][0] + (m[1][1] + m[2][2]); + Vector4 q; + if (t > 2.9999999) { + q = Vector4(0.0, 0.0, 0.0, 1.0); + } else if (t > 0.0000001) { + float s = sqrt(1.0 + t) * 2.0; + q = Vector4(Vector(m[1][2] - m[2][1], m[2][0] - m[0][2], m[0][1] - m[1][0]) / s, s * 0.25); + } else if ((m[0][0] > m[1][1]) && (m[0][0] > m[2][2])) { + float s = sqrt(1.0 + (m[0][0] - (m[1][1] + m[2][2]))) * 2.0; + q = Vector4(s * 0.25, Vector(m[1][0] + m[0][1], m[2][0] + m[0][2], m[1][2] - m[2][1]) / s); + } else if (m[1][1] > m[2][2]) { + float s = sqrt(1.0 + (m[1][1] - (m[0][0] + m[2][2]))) * 2.0; + q = Vector4(Vector(m[1][0] + m[0][1], m[2][1] + m[1][2], m[2][0] - m[0][2]) / s, s * 0.25); + q = Vector4(q.x, q.w, q.y, q.z); + } else { + float s = sqrt(1.0 + (m[2][2] - (m[0][0] + m[1][1]))) * 2.0; + q = Vector4(Vector(m[2][0] + m[0][2], m[2][1] + m[1][2], m[0][1] - m[1][0]) / s, s * 0.25); + q = Vector4(q.x, q.y, q.w, q.z); + } + Vector4 qAbs = abs(q = glm::normalize(q)); + int maxComponentIndex = (qAbs.x > qAbs.y) ? ((qAbs.x > qAbs.z) ? ((qAbs.x > qAbs.w) ? 0 : 3) : ((qAbs.z > qAbs.w) ? 2 : 3)) + : ((qAbs.y > qAbs.z) ? ((qAbs.y > qAbs.w) ? 1 : 3) : ((qAbs.z > qAbs.w) ? 2 : 3)); + Vector components[4] = {Vector(q.y, q.z, q.w), Vector(q.x, q.z, q.w), Vector(q.x, q.y, q.w), Vector(q.x, q.y, q.z)}; + + q = Vector4(components[maxComponentIndex] * float(((q[maxComponentIndex] < 0.0) ? -1.0 : 1.0) * 1.4142135623730951), q.w); + return ((uint32(round(glm::clamp(q.x * 511.0, -511.0, 511.0) + 512.0)) & 0x3ffu) << 0u) | + ((uint32(round(glm::clamp(q.y * 511.0, -511.0, 511.0) + 512.0)) & 0x3ffu) << 10u) | + ((uint32(round(glm::clamp(q.z * 255.0, -255.0, 255.0) + 256.0)) & 0x1ffu) << 20u) | + ((uint32(((dot(cross(m[0], m[2]), m[1]) * r) < 0.0) ? 1u : 0u) & 0x1u) << 29u) | ((uint32(maxComponentIndex) & 0x3u) << 30u); +} + void MeshLoader::loadGlobalMeshes(const aiScene* scene, const Array& materials, Array& globalMeshes, Component::Collider& collider) { List> work; @@ -483,7 +517,7 @@ void MeshLoader::loadGlobalMeshes(const aiScene* scene, const ArraymNumVertices); } - Array normals(mesh->mNumVertices); + Array normals(mesh->mNumVertices); Array colors(mesh->mNumVertices); for (int32 i = 0; i < mesh->mNumVertices; ++i) { @@ -504,25 +538,7 @@ void MeshLoader::loadGlobalMeshes(const aiScene* scene, const ArrayHasVertexColors(0)) { colors[i] = U16Vector(mesh->mColors[0][i].r * 65535, mesh->mColors[0][i].g * 65535, mesh->mColors[0][i].b * 65535); @@ -559,7 +575,7 @@ void MeshLoader::loadGlobalMeshes(const aiScene* scene, const Arrayblas = graphics->createBottomLevelAccelerationStructure(Gfx::BottomLevelASCreateInfo{ .mesh = globalMeshes[meshIndex], }); - //vertexData->registerBottomLevelAccelerationStructure(globalMeshes[meshIndex]->blas); + // vertexData->registerBottomLevelAccelerationStructure(globalMeshes[meshIndex]->blas); }); } getThreadPool().runAndWait(std::move(work)); diff --git a/src/Editor/Asset/MeshLoader.h b/src/Editor/Asset/MeshLoader.h index c7bc5b7..f50780b 100644 --- a/src/Editor/Asset/MeshLoader.h +++ b/src/Editor/Asset/MeshLoader.h @@ -5,7 +5,6 @@ #include "MinimalEngine.h" #include - struct aiScene; struct aiTexel; struct aiNode; @@ -26,6 +25,9 @@ class MeshLoader { void importAsset(MeshImportArgs args); private: + void findMeshRoots(aiNode* node, List& meshNodes); + uint32 encodeQTangent(Matrix3 m); + void loadTextures(const aiScene* scene, const std::filesystem::path& meshDirectory, const std::string& importPath, Array& textures); void loadMaterials(const aiScene* scene, const Array& textures, const std::string& baseName, diff --git a/src/Editor/Asset/TextureLoader.cpp b/src/Editor/Asset/TextureLoader.cpp index 0b94053..c92cc28 100644 --- a/src/Editor/Asset/TextureLoader.cpp +++ b/src/Editor/Asset/TextureLoader.cpp @@ -42,7 +42,7 @@ void TextureLoader::importAsset(TextureImportArgs args) { PTextureAsset ref = asset; asset->setStatus(Asset::Status::Loading); AssetRegistry::get().registerTexture(std::move(asset)); - getThreadPool().runAsync([=](){import(args, ref);}); + import(args, ref); } PTextureAsset TextureLoader::getPlaceholderTexture() { return placeholderAsset; } @@ -112,11 +112,11 @@ void TextureLoader::import(TextureImportArgs args, PTextureAsset textureAsset) { .structSize = sizeof(ktxBasisParams), .uastc = true, .threadCount = 14, - .uastcFlags = KTX_PACK_UASTC_LEVEL_FASTER, + .uastcFlags = KTX_PACK_UASTC_LEVEL_FASTEST, .uastcRDO = true, }; - KTX_ASSERT(ktxTexture2_CompressBasisEx(kTexture, &basisParams)); - KTX_ASSERT(ktxTexture2_DeflateZstd(kTexture, 20)); + //KTX_ASSERT(ktxTexture2_CompressBasisEx(kTexture, &basisParams)); + //KTX_ASSERT(ktxTexture2_DeflateZstd(kTexture, 20)); char writer[100]; snprintf(writer, sizeof(writer), "%s version %s", "SeeleEngine", "0.0.1"); diff --git a/src/Editor/main.cpp b/src/Editor/main.cpp index ae09a82..e957624 100644 --- a/src/Editor/main.cpp +++ b/src/Editor/main.cpp @@ -109,10 +109,10 @@ int main() { //AssetImporter::importTexture(TextureImportArgs{ // .filePath = sourcePath / "import/textures/wgen.png", //}); - //AssetImporter::importMesh(MeshImportArgs{ - // .filePath = sourcePath / "import/models/after-the-rain-vr-sound/source/Whitechapel.glb", - // .importPath = "Whitechapel", - //}); + AssetImporter::importMesh(MeshImportArgs{ + .filePath = sourcePath / "import/models/after-the-rain-vr-sound/source/Whitechapel.glb", + .importPath = "Whitechapel", + }); // AssetImporter::importMesh(MeshImportArgs{521 // .filePath = sourcePath / "import/models/city-suburbs/source/city-suburbs.obj", // .importPath = "suburbs", diff --git a/src/Engine/Graphics/RenderPass/DepthCullingPass.cpp b/src/Engine/Graphics/RenderPass/DepthCullingPass.cpp index 199b769..0794df0 100644 --- a/src/Engine/Graphics/RenderPass/DepthCullingPass.cpp +++ b/src/Engine/Graphics/RenderPass/DepthCullingPass.cpp @@ -178,9 +178,9 @@ void DepthCullingPass::render() { command->bindDescriptor({viewParamsSet, vertexData->getVertexDataSet(), vertexData->getInstanceDataSet(), set}); VertexData::DrawCallOffsets offsets = { .instanceOffset = 0, - .floatOffset = 0, - .samplerOffset = 0, .textureOffset = 0, + .samplerOffset = 0, + .floatOffset = 0, }; command->pushConstants(Gfx::SE_SHADER_STAGE_TASK_BIT_EXT | Gfx::SE_SHADER_STAGE_VERTEX_BIT, 0, sizeof(VertexData::DrawCallOffsets), &offsets); diff --git a/src/Engine/Graphics/StaticMeshVertexData.cpp b/src/Engine/Graphics/StaticMeshVertexData.cpp index 9d59e42..8c875ce 100644 --- a/src/Engine/Graphics/StaticMeshVertexData.cpp +++ b/src/Engine/Graphics/StaticMeshVertexData.cpp @@ -32,9 +32,9 @@ void StaticMeshVertexData::loadTexCoords(uint64 offset, uint64 index, const Arra dirty = true; } -void StaticMeshVertexData::loadNormals(uint64 offset, const Array& data) { +void StaticMeshVertexData::loadNormals(uint64 offset, const Array& data) { assert(offset + data.size() <= head); - std::memcpy(norData.data() + offset, data.data(), data.size() * sizeof(Quaternion)); + std::memcpy(norData.data() + offset, data.data(), data.size() * sizeof(uint32)); // normals->updateContents(offset * sizeof(Vector4), data.size() * sizeof(Vector4), data.data()); dirty = true; } @@ -60,10 +60,10 @@ void StaticMeshVertexData::serializeMesh(MeshId id, uint64 numVertices, ArchiveB Serialization::save(buffer, tex[i]); } Array pos(numVertices); - Array nor(numVertices); + Array nor(numVertices); Array col(numVertices); std::memcpy(pos.data(), posData.data() + offset, numVertices * sizeof(Vector)); - std::memcpy(nor.data(), norData.data() + offset, numVertices * sizeof(Quaternion)); + std::memcpy(nor.data(), norData.data() + offset, numVertices * sizeof(uint32)); std::memcpy(col.data(), colData.data() + offset, numVertices * sizeof(U16Vector)); Serialization::save(buffer, pos); Serialization::save(buffer, nor); @@ -84,7 +84,7 @@ uint64 StaticMeshVertexData::deserializeMesh(MeshId id, ArchiveBuffer& buffer) { result += tex[i].size() * sizeof(U16Vector2); } Array pos; - Array nor; + Array nor; Array col; Serialization::load(buffer, pos); Serialization::load(buffer, nor); @@ -93,7 +93,7 @@ uint64 StaticMeshVertexData::deserializeMesh(MeshId id, ArchiveBuffer& buffer) { loadNormals(offset, nor); loadColors(offset, col); result += pos.size() * sizeof(Vector); - result += nor.size() * sizeof(Quaternion); + result += nor.size() * sizeof(uint32); result += col.size() * sizeof(U16Vector); return result; } @@ -154,7 +154,7 @@ void StaticMeshVertexData::updateBuffers() { normals = graphics->createShaderBuffer(ShaderBufferCreateInfo{ .sourceData = { - .size = verticesAllocated * sizeof(Quaternion), + .size = verticesAllocated * sizeof(uint32), .data = (uint8*)norData.data(), }, .name = "Normals", diff --git a/src/Engine/Graphics/StaticMeshVertexData.h b/src/Engine/Graphics/StaticMeshVertexData.h index 54da60d..5c1e7d6 100644 --- a/src/Engine/Graphics/StaticMeshVertexData.h +++ b/src/Engine/Graphics/StaticMeshVertexData.h @@ -14,7 +14,7 @@ class StaticMeshVertexData : public VertexData { static StaticMeshVertexData* getInstance(); void loadPositions(uint64 offset, const Array& data); void loadTexCoords(uint64 offset, uint64 index, const Array& data); - void loadNormals(uint64 offset, const Array& data); + void loadNormals(uint64 offset, const Array& data); void loadColors(uint64 offset, const Array& data); virtual void serializeMesh(MeshId id, uint64 numVertices, ArchiveBuffer& buffer) override; virtual uint64 deserializeMesh(MeshId id, ArchiveBuffer& buffer) override; diff --git a/src/Engine/Graphics/Vulkan/Graphics.cpp b/src/Engine/Graphics/Vulkan/Graphics.cpp index 20ab30c..57565fe 100644 --- a/src/Engine/Graphics/Vulkan/Graphics.cpp +++ b/src/Engine/Graphics/Vulkan/Graphics.cpp @@ -298,12 +298,6 @@ Gfx::OSampler Graphics::createSampler(const SamplerCreateInfo& createInfo) { return new Sampler(this, vkInfo); } -Gfx::OComputeShader Graphics::createComputeShaderFromBinary(std::string_view binaryName) { - OComputeShader shader = new ComputeShader(this); - shader->create(binaryName); - return shader; -} - Gfx::ODescriptorLayout Graphics::createDescriptorLayout(const std::string& name) { return new DescriptorLayout(this, name); } Gfx::OPipelineLayout Graphics::createPipelineLayout(const std::string& name, Gfx::PPipelineLayout baseLayout) { diff --git a/src/Engine/Graphics/Vulkan/Graphics.h b/src/Engine/Graphics/Vulkan/Graphics.h index fc27c83..d47ad24 100644 --- a/src/Engine/Graphics/Vulkan/Graphics.h +++ b/src/Engine/Graphics/Vulkan/Graphics.h @@ -67,8 +67,6 @@ class Graphics : public Gfx::Graphics { virtual Gfx::PComputePipeline createComputePipeline(Gfx::ComputePipelineCreateInfo createInfo) override; virtual Gfx::OSampler createSampler(const SamplerCreateInfo& createInfo) override; - virtual Gfx::OComputeShader createComputeShaderFromBinary(std::string_view binaryName) override; - virtual Gfx::ODescriptorLayout createDescriptorLayout(const std::string& name = "") override; virtual Gfx::OPipelineLayout createPipelineLayout(const std::string& name = "", Gfx::PPipelineLayout baseLayout = nullptr) override; diff --git a/src/Engine/Graphics/slang-compile.cpp b/src/Engine/Graphics/slang-compile.cpp index 6bfb5bd..974d1a4 100644 --- a/src/Engine/Graphics/slang-compile.cpp +++ b/src/Engine/Graphics/slang-compile.cpp @@ -142,7 +142,7 @@ void Seele::beginCompilation(const ShaderCompilationInfo& info, SlangCompileTarg for (size_t i = 0; i < signature->getParameterCount(); ++i) { auto param = signature->getParameterByIndex(i); layout->addMapping(param->getName(), param->getBindingIndex()); - std::cout << param->getName() << ": " << param->getBindingIndex() << std::endl; + //std::cout << param->getName() << ": " << param->getBindingIndex() << std::endl; } // workaround diff --git a/src/Engine/ThreadPool.h b/src/Engine/ThreadPool.h index 7905745..4d3d0e3 100644 --- a/src/Engine/ThreadPool.h +++ b/src/Engine/ThreadPool.h @@ -7,7 +7,7 @@ namespace Seele { class ThreadPool { public: - ThreadPool(uint32 numWorkers = 1); + ThreadPool(uint32 numWorkers = 14); ~ThreadPool(); void runAndWait(List> functions); void runAsync(std::function func);