Something changed !

This commit is contained in:
Dynamitos
2024-07-13 09:25:42 +02:00
parent b756f17a09
commit 3463ecd7b9
8 changed files with 9 additions and 8 deletions
+1 -1
View File
@@ -24,5 +24,5 @@ void callable(inout CallablePayload payload)
// gamma correction // gamma correction
result = result / (result + float3(1.0)); result = result / (result + float3(1.0));
result = pow(result, float3(1.0/2.2)); result = pow(result, float3(1.0/2.2));
payload.color = float3(0, 0, 1); payload.color = result;
} }
+2 -2
View File
@@ -37,7 +37,7 @@ void closestHit(inout RayPayload hitValue, in BuiltInTriangleIntersectionAttribu
CallablePayload callable; CallablePayload callable;
callable.params = params; callable.params = params;
CallShader(0, callable); CallShader(InstanceID(), callable);
hitValue.color = float3(0, 1, 1) + callable.color; hitValue.color = float3(1, 0, 0);
} }
@@ -111,6 +111,8 @@ void RayTracingPass::render() {
StaticMeshVertexData::getInstance()->getVertexDataSet(), Material::getDescriptorSet(), StaticMeshVertexData::getInstance()->getVertexDataSet(), Material::getDescriptorSet(),
scene->getLightEnvironment()->getDescriptorSet(), desc}); scene->getLightEnvironment()->getDescriptorSet(), desc});
command->traceRays(texture->getWidth(), texture->getHeight(), 1); command->traceRays(texture->getWidth(), texture->getHeight(), 1);
texture->pipelineBarrier(Gfx::SE_ACCESS_SHADER_WRITE_BIT, Gfx::SE_PIPELINE_STAGE_RAY_TRACING_SHADER_BIT_KHR,
Gfx::SE_ACCESS_TRANSFER_READ_BIT, Gfx::SE_PIPELINE_STAGE_TRANSFER_BIT);
Array<Gfx::ORenderCommand> commands; Array<Gfx::ORenderCommand> commands;
commands.add(std::move(command)); commands.add(std::move(command));
graphics->executeCommands(std::move(commands)); graphics->executeCommands(std::move(commands));
+1
View File
@@ -13,6 +13,7 @@
std::this_thread::sleep_for(std::chrono::seconds(3)); \ std::this_thread::sleep_for(std::chrono::seconds(3)); \
} \ } \
std::cout << "Fatal : VkResult is " << res << " in " << __FILE__ << " at line " << __LINE__ << std::endl; \ std::cout << "Fatal : VkResult is " << res << " in " << __FILE__ << " at line " << __LINE__ << std::endl; \
std::cin.get(); \
abort(); \ abort(); \
} \ } \
} }
-2
View File
@@ -866,9 +866,7 @@ void Graphics::createDevice(GraphicsInitializer initializer) {
.ppEnabledExtensionNames = initializer.deviceExtensions.data(), .ppEnabledExtensionNames = initializer.deviceExtensions.data(),
.pEnabledFeatures = nullptr, .pEnabledFeatures = nullptr,
}; };
VK_CHECK(vkCreateDevice(physicalDevice, &deviceInfo, nullptr, &handle)); VK_CHECK(vkCreateDevice(physicalDevice, &deviceInfo, nullptr, &handle));
// std::cout << "Vulkan handle: " << handle << std::endl;
graphicsQueue = 0; graphicsQueue = 0;
computeQueue = 0; computeQueue = 0;
transferQueue = 0; transferQueue = 0;
+1 -1
View File
@@ -596,7 +596,7 @@ PRayTracingPipeline PipelineCache::createPipeline(Gfx::RayTracingPipelineCreateI
VK_CHECK(vkCreateRayTracingPipelinesKHR(graphics->getDevice(), VK_NULL_HANDLE, cache, 1, &pipelineInfo, nullptr, &pipelineHandle)); VK_CHECK(vkCreateRayTracingPipelinesKHR(graphics->getDevice(), VK_NULL_HANDLE, cache, 1, &pipelineInfo, nullptr, &pipelineHandle));
const uint32_t handleSize = graphics->getRayTracingProperties().shaderGroupHandleSize; const uint32_t handleSize = graphics->getRayTracingProperties().shaderGroupHandleSize;
const uint32_t handleAlignment = graphics->getRayTracingProperties().shaderGroupHandleAlignment; const uint32_t handleAlignment = graphics->getRayTracingProperties().shaderGroupBaseAlignment;
const uint32_t handleSizeAligned = align(handleSize, handleAlignment); const uint32_t handleSizeAligned = align(handleSize, handleAlignment);
const uint32_t groupCount = static_cast<uint32_t>(shaderGroups.size()); const uint32_t groupCount = static_cast<uint32_t>(shaderGroups.size());
const uint32_t sbtSize = handleSizeAligned * groupCount; const uint32_t sbtSize = handleSizeAligned * groupCount;
+1 -1
View File
@@ -53,7 +53,7 @@ TopLevelAS::TopLevelAS(PGraphics graphics, const Gfx::TopLevelASCreateInfo& crea
createInfo.instances[i].transformMatrix[2][2], createInfo.instances[i].transformMatrix[2][2],
createInfo.instances[i].transformMatrix[3][2], createInfo.instances[i].transformMatrix[3][2],
}, },
.instanceCustomIndex = 0, .instanceCustomIndex = i,
.mask = 0xff, .mask = 0xff,
.instanceShaderBindingTableRecordOffset = 0, .instanceShaderBindingTableRecordOffset = 0,
.flags = VK_GEOMETRY_INSTANCE_TRIANGLE_FACING_CULL_DISABLE_BIT_KHR, .flags = VK_GEOMETRY_INSTANCE_TRIANGLE_FACING_CULL_DISABLE_BIT_KHR,
+1 -1
View File
@@ -48,7 +48,7 @@ void Seele::beginCompilation(const ShaderCompilationInfo& info, SlangCompileTarg
option[3].value.intValue0 = SLANG_DEBUG_INFO_FORMAT_PDB; option[3].value.intValue0 = SLANG_DEBUG_INFO_FORMAT_PDB;
option[4].name = slang::CompilerOptionName::DumpIntermediates; option[4].name = slang::CompilerOptionName::DumpIntermediates;
option[4].value.kind = slang::CompilerOptionValueKind::Int; option[4].value.kind = slang::CompilerOptionValueKind::Int;
option[4].value.intValue0 = 1; option[4].value.intValue0 = 0;
sessionDesc.compilerOptionEntries = option.data(); sessionDesc.compilerOptionEntries = option.data();
sessionDesc.compilerOptionEntryCount = option.size(); sessionDesc.compilerOptionEntryCount = option.size();