Jump to content

Ultra Engine testing


Josh
 Share

Recommended Posts

@SpiderPigI added the required DLLs to the client app. Download is at the beginning of this thread.

SDK Update:

HOOKID_TRANSFER has been added. This hook gets called once per frame rendered, and the recorded command buffer is executed only once. HOOKID_RENDER gets called once per culling set, so although the recorded Vulkan commands will be executed each frame, the hook might only get called once every 3-4 frames.

AddHook() now accepts an additional repeat parameter, set to true by default. If you want to record Vulkan commands that operate only once, use HOOKID_TRANSFER with repeat set to false. (If you use HOOKID_RENDER with repeat set to false, your callback will only be called once, but the recorded Vulkan command buffer may be executed several times.)

The syntax for the hook function has changed a bit but it should be easy to figure out.

Terrain now working with navmeshes.

 

  • Like 1
  • Thanks 1

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

I get this error in debug mode: 

Fehler    LNK2019    Verweis auf nicht aufgelöstes externes Symbol "__std_find_trivial_4" in Funktion ""int * __cdecl __std_find_trivial<int,int>(int *,int *,int)" (??$__std_find_trivial@HH@@YAPEAHPEAH0H@Z)".    Environment    C:\Users\Shadow\Documents\Ultra Engine\Environment\UltraEngine_d.lib(Skeleton.obj)    1    

  • Windows 10 Pro 64-Bit-Version
  • NVIDIA Geforce 1080 TI
Link to comment
Share on other sites

Now i have another problem:

i have this exception in the rendering loop once i start using hooks:

 

File: C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.33.31629\include\vector
Line: 1587

Expression: vector erase iterator outside range

stacktrace.thumb.PNG.86f7c6d6e68a3266614b93b0e88b39cf.PNG

 

  • Windows 10 Pro 64-Bit-Version
  • NVIDIA Geforce 1080 TI
Link to comment
Share on other sites

repeated = true, works, but for one time hooks i get this:

>    Environment_d.exe!std::_Vector_const_iterator<class std::_Vector_val<struct std::_Simple_types<struct UltraEngine::Object::Hook> > >::_Compat(class std::_Vector_const_iterator<class std::_Vector_val<struct std::_Simple_types<struct UltraEngine::Object::Hook> > > const &)    Unbekannt

File: C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.33.31629\include\vector
Line: 186

Expression: vector iterators incompatible

Also is it correct: in HOO_RENDER the cmdbuffer is in recording state, but in RENDER_TRANSFER it is not. So i need to handle that by myself?

 

  • Windows 10 Pro 64-Bit-Version
  • NVIDIA Geforce 1080 TI
Link to comment
Share on other sites

This is the code that calls it. Do you see anything wrong?

				auto& hooks = world->hooks[HOOKID_TRANSFER];
				auto it = hooks.begin();
				while (it != hooks.end())
				{
					auto hook = *it;
					auto o = hook.extra.lock();
					if (o == NULL and hook.useextra == true) continue;
					commandbuffers[currentFrame]->BindResource(o);
					auto func = (void(*)(const VkRenderer&, shared_ptr<Object>))hook.func;
					VkRenderer r;
					r.device = device->device;
					r.instance = device->instance;
					r.commandbuffer = commandbuffers[currentFrame]->commandbuffer;
					func(r, o);
					if (!hook.repeat)
					{
						hooks.erase(it++);
						continue;
					}
					++it;
				}

 

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

Okay, I uploaded another build. Previously, the transer hook was passing in the wrong command buffer, which is why it was not in the recording state. I don't know about the hook removal because I don't see anything wrong in my code above, so...

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

I tried my own hook, and I am getting the same error as you. I can't see why it would cause an error.

Maybe my code should be like this:

if (!hook.repeat)
{
	it = hooks.erase(it);
	continue;
}

The previous code is a common pattern I use in many places. If that is wrong, a little alarming.

Untitled.thumb.jpg.0d72682be115f2c74053614248e1aef9.jpg

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

I think I knew this, because some of my code does this:

it = list.erase(++it);

Of course that makes no sense and is the same thing as this:

it = list.erase(it);

And probably vectors are the only container I use where removing an iterator invalidates subsequent iterators.

So I am changing all instances of this type of logic now...

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

I got a new project running but am getting this very long error then crash a few seconds in.  I installed about 5 min ago...

Validation Error: [ VUID-VkDeviceCreateInfo-pNext-pNext ] Object 0: VK_NULL_HANDLE, type = VK_OBJECT_TYPE_DEVICE; | MessageID = 0x901f59ec | vkCreateDevice: pCreateInfo->pNext chain includes a structure with unknown VkStructureType (1000314007); Allowed structures are [VkDeviceDiagnosticsConfigCreateInfoNV, VkDeviceGroupDeviceCreateInfo, VkDeviceMemoryOverallocationCreateInfoAMD, VkDevicePrivateDataCreateInfoEXT, VkPhysicalDevice16BitStorageFeatures, VkPhysicalDevice4444FormatsFeaturesEXT, VkPhysicalDevice8BitStorageFeatures, VkPhysicalDeviceASTCDecodeFeaturesEXT, VkPhysicalDeviceBlendOperationAdvancedFeaturesEXT, VkPhysicalDeviceBufferDeviceAddressFeatures, VkPhysicalDeviceBufferDeviceAddressFeaturesEXT, VkPhysicalDeviceCoherentMemoryFeaturesAMD, VkPhysicalDeviceComputeShaderDerivativesFeaturesNV, VkPhysicalDeviceConditionalRenderingFeaturesEXT, VkPhysicalDeviceCooperativeMatrixFeaturesNV, VkPhysicalDeviceCornerSampledImageFeaturesNV, VkPhysicalDeviceCoverageReductionModeFeaturesNV, VkPhysicalDeviceCustomBorderColorFeaturesEXT, VkPhysicalDeviceDedicatedAllocationImageAliasingFeaturesNV, VkPhysicalDeviceDepthClipEnableFeaturesEXT, VkPhysicalDeviceDescriptorIndexingFeatures, VkPhysicalDeviceDeviceGeneratedCommandsFeaturesNV, VkPhysicalDeviceDiagnosticsConfigFeaturesNV, VkPhysicalDeviceExclusiveScissorFeaturesNV, VkPhysicalDeviceExtendedDynamicStateFeaturesEXT, VkPhysicalDeviceFeatures2, VkPhysicalDeviceFragmentDensityMap2FeaturesEXT, VkPhysicalDeviceFragmentDensityMapFeaturesEXT, VkPhysicalDeviceFragmentShaderBarycentricFeaturesNV, VkPhysicalDeviceFragmentShaderInterlockFeaturesEXT, VkPhysicalDeviceHostQueryResetFeatures, VkPhysicalDeviceImageRobustnessFeaturesEXT, VkPhysicalDeviceImagelessFramebufferFeatures, VkPhysicalDeviceIndexTypeUint8FeaturesEXT, VkPhysicalDeviceInlineUniformBlockFeaturesEXT, VkPhysicalDeviceLineRasterizationFeaturesEXT, VkPhysicalDeviceMemoryPriorityFeaturesEXT, VkPhysicalDeviceMeshShaderFeaturesNV, VkPhysicalDeviceMultiviewFeatures, VkPhysicalDevicePerformanceQueryFeaturesKHR, VkPhysicalDevicePipelineCreationCacheControlFeaturesEXT, VkPhysicalDevicePipelineExecutablePropertiesFeaturesKHR, VkPhysicalDevicePortabilitySubsetFeaturesKHR, VkPhysicalDevicePrivateDataFeaturesEXT, VkPhysicalDeviceProtectedMemoryFeatures, VkPhysicalDeviceRayTracingFeaturesKHR, VkPhysicalDeviceRepresentativeFragmentTestFeaturesNV, VkPhysicalDeviceRobustness2FeaturesEXT, VkPhysicalDeviceSamplerYcbcrConversionFeatures, VkPhysicalDeviceScalarBlockLayoutFeatures, VkPhysicalDeviceSeparateDepthStencilLayoutsFeatures, VkPhysicalDeviceShaderAtomicFloatFeaturesEXT, VkPhysicalDeviceShaderAtomicInt64Features, VkPhysicalDeviceShaderClockFeaturesKHR, VkPhysicalDeviceShaderDemoteToHelperInvocationFeaturesEXT, VkPhysicalDeviceShaderDrawParametersFeatures, VkPhysicalDeviceShaderFloat16Int8Features, VkPhysicalDeviceShaderImageFootprintFeaturesNV, VkPhysicalDeviceShaderIntegerFunctions2FeaturesINTEL, VkPhysicalDeviceShaderSMBuiltinsFeaturesNV, VkPhysicalDeviceShaderSubgroupExtendedTypesFeatures, VkPhysicalDeviceShadingRateImageFeaturesNV, VkPhysicalDeviceSubgroupSizeControlFeaturesEXT, VkPhysicalDeviceTexelBufferAlignmentFeaturesEXT, VkPhysicalDeviceTextureCompressionASTCHDRFeaturesEXT, VkPhysicalDeviceTimelineSemaphoreFeatures, VkPhysicalDeviceTransformFeedbackFeaturesEXT, VkPhysicalDeviceUniformBufferStandardLayoutFeatures, VkPhysicalDeviceVariablePointersFeatures, VkPhysicalDeviceVertexAttributeDivisorFeaturesEXT, VkPhysicalDeviceVulkan11Features, VkPhysicalDeviceVulkan12Features, VkPhysicalDeviceVulkanMemoryModelFeatures, VkPhysicalDeviceYcbcrImageArraysFeaturesEXT]. This error is based on the Valid Usage documentation for version 154 of the Vulkan header.  It is possible that you are using a struct from a private extension or an extension that was added to a later version of the Vulkan header, in which case the use of pCreateInfo->pNext is undefined and may not work correctly with validation enabled The Vulkan spec states: Each pNext member of any structure (including this one) in the pNext chain must be either NULL or a pointer to a valid instance of VkDeviceDiagnosticsConfigCreateInfoNV, VkDeviceGroupDeviceCreateInfo, VkDeviceMemoryOverallocationCreateInfoAMD, VkDevicePrivateDataCreateInfoEXT, VkPhysicalDevice16BitStorageFeatures, VkPhysicalDevice4444FormatsFeaturesEXT, VkPhysicalDevice8BitStorageFeatures, VkPhysicalDeviceASTCDecodeFeaturesEXT, VkPhysicalDeviceBlendOperationAdvancedFeaturesEXT, VkPhysicalDeviceBufferDeviceAddressFeatures, VkPhysicalDeviceBufferDeviceAddressFeaturesEXT, VkPhysicalDeviceCoherentMemoryFeaturesAMD, VkPhysicalDeviceComputeShaderDerivativesFeaturesNV, VkPhysicalDeviceConditionalRenderingFeaturesEXT, VkPhysicalDeviceCooperativeMatrixFeaturesNV, VkPhysicalDeviceCornerSampledImageFeaturesNV, VkPhysicalDeviceCoverageReductionModeFeaturesNV, VkPhysicalDeviceCustomBorderColorFeaturesEXT, VkPhysicalDeviceDedicatedAllocationImageAliasingFeaturesNV, VkPhysicalDeviceDepthClipEnableFeaturesEXT, VkPhysicalDeviceDescriptorIndexingFeatures, VkPhysicalDeviceDeviceGeneratedCommandsFeaturesNV, VkPhysicalDeviceDiagnosticsConfigFeaturesNV, VkPhysicalDeviceExclusiveScissorFeaturesNV, VkPhysicalDeviceExtendedDynamicStateFeaturesEXT, VkPhysicalDeviceFeatures2, VkPhysicalDeviceFragmentDensityMap2FeaturesEXT, VkPhysicalDeviceFragmentDensityMapFeaturesEXT, VkPhysicalDeviceFragmentShaderBarycentricFeaturesNV, VkPhysicalDeviceFragmentShaderInterlockFeaturesEXT, VkPhysicalDeviceHostQueryResetFeatures, VkPhysicalDeviceImageRobustnessFeaturesEXT, VkPhysicalDeviceImagelessFramebufferFeatures, VkPhysicalDeviceIndexTypeUint8FeaturesEXT, VkPhysicalDeviceInlineUniformBlockFeaturesEXT, VkPhysicalDeviceLineRasterizationFeaturesEXT, VkPhysicalDeviceMemoryPriorityFeaturesEXT, VkPhysicalDeviceMeshShaderFeaturesNV, VkPhysicalDeviceMultiviewFeatures, VkPhysicalDevicePerformanceQueryFeaturesKHR, VkPhysicalDevicePipelineCreationCacheControlFeaturesEXT, VkPhysicalDevicePipelineExecutablePropertiesFeaturesKHR, VkPhysicalDevicePortabilitySubsetFeaturesKHR, VkPhysicalDevicePrivateDataFeaturesEXT, VkPhysicalDeviceProtectedMemoryFeatures, VkPhysicalDeviceRayTracingFeaturesKHR, VkPhysicalDeviceRepresentativeFragmentTestFeaturesNV, VkPhysicalDeviceRobustness2FeaturesEXT, VkPhysicalDeviceSamplerYcbcrConversionFeatures, VkPhysicalDeviceScalarBlockLayoutFeatures, VkPhysicalDeviceSeparateDepthStencilLayoutsFeatures, VkPhysicalDeviceShaderAtomicFloatFeaturesEXT, VkPhysicalDeviceShaderAtomicInt64Features, VkPhysicalDeviceShaderClockFeaturesKHR, VkPhysicalDeviceShaderDemoteToHelperInvocationFeaturesEXT, VkPhysicalDeviceShaderDrawParametersFeatures, VkPhysicalDeviceShaderFloat16Int8Features, VkPhysicalDeviceShaderImageFootprintFeaturesNV, VkPhysicalDeviceShaderIntegerFunctions2FeaturesINTEL, VkPhysicalDeviceShaderSMBuiltinsFeaturesNV, VkPhysicalDeviceShaderSubgroupExtendedTypesFeatures, VkPhysicalDeviceShadingRateImageFeaturesNV, VkPhysicalDeviceSubgroupSizeControlFeaturesEXT, VkPhysicalDeviceTexelBufferAlignmentFeaturesEXT, VkPhysicalDeviceTextureCompressionASTCHDRFeaturesEXT, VkPhysicalDeviceTimelineSemaphoreFeatures, VkPhysicalDeviceTransformFeedbackFeaturesEXT, VkPhysicalDeviceUniformBufferStandardLayoutFeatures, VkPhysicalDeviceVariablePointersFeatures, VkPhysicalDeviceVertexAttributeDivisorFeaturesEXT, VkPhysicalDeviceVulkan11Features, VkPhysicalDeviceVulkan12Features, VkPhysicalDeviceVulkanMemoryModelFeatures, or VkPhysicalDeviceYcbcrImageArraysFeaturesEXT (https://vulkan.lunarg.com/doc/view/1.2.154.1/windows/1.2-extensions/vkspec.html#VUID-VkDeviceCreateInfo-pNext-pNext)

EDIT Only in Debug mode is seems.

Link to comment
Share on other sites

Looks like that feature is core in Vulkan 1.3 but I am initializing  with version 1.2...

Great job! You are finding so many issues!

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

New Progress on the compute_front :) thx Jsoh for the fast updates :)

 

ultra_compute_update.thumb.gif.07fcb62a6325b7e6ccb1416a0860bad2.gif

 

struct ComputeTestData
{
	float size;
	float padding1;
	float padding2;
	float padding3;
	Vec4 color;
};

int main(int argc, const char* argv[])
{
	//Get the displays
	auto displays = GetDisplays();

	//Create a window
	auto window = CreateWindow("Ultra Engine", 0, 0, 1280, 720, displays[0], WINDOW_CENTER | WINDOW_TITLEBAR);

	//Create a world
	auto world = CreateWorld();

	//Create a framebuffer
	auto framebuffer = CreateFramebuffer(window);

	//Create a camera
	auto camera = CreateCamera(world);
	camera->SetClearColor(0.125);
	camera->SetPosition(0, 0.1, -1);

	auto plg = LoadPlugin("Plugins/KTX2TextureLoader");

	auto ball = CreateSphere(world, 0.5, 32);

	auto specmap = LoadTexture("Materials/Environment/Storm/specular.dds");
	auto diffmap = LoadTexture("Materials/Environment/Storm/diffuse.dds");

	world->SetEnvironmentMap(specmap, ENVIRONMENTMAP_BACKGROUND);
	world->SetEnvironmentMap(specmap, ENVIRONMENTMAP_SPECULAR);
	world->SetEnvironmentMap(diffmap, ENVIRONMENTMAP_DIFFUSE);

	camera->Point(ball);

	//auto environment = initalize_atmosphere(world);

	auto targetTexture = CreateTexture(TextureType::TEXTURE_2D, 256, 256, TextureFormat::TEXTURE_RGBA32, {},1,TEXTURE_STORAGE);
	auto cshader = ComputeShader::Create("Shaders\\Environment\\simple_test.comp.spv");

	ComputeTestData data;
	data.size = 50.0;
	data.color = Vec4(1.0, 1.0, 1.0, 1.0);
	
	int targetIndex = cshader->AddTargetImage(targetTexture);
	int bufferIndex = cshader->AddUniformBuffer(&data, sizeof(data), false);
	cshader->BeginDispatch(world, 16, 16, 1, true);

	auto mtl = CreateMaterial();
	mtl->SetRoughness(0.25);
	mtl->SetMetalness(0.5);
	mtl->SetTexture(targetTexture, 0);

	ball->SetMaterial(mtl);

	//Main loop
	while (window->Closed() == false and window->KeyDown(KEY_ESCAPE) == false)
	{
		
		if (window->KeyHit(KEY_A))
		{
			data.size = 5.0;
			data.color = Vec4(1.0, 0.0,0.0, 1.0);
			cshader->Update(bufferIndex);
			cshader->BeginDispatch(world, 16, 16, 1, true);
		}
		
		if (window->KeyHit(KEY_S))
		{
			data.size = 50.0;
			data.color = Vec4(0.0, 1.0, 0.0, 1.0);
			cshader->Update(bufferIndex);
			cshader->BeginDispatch(world, 16, 16, 1, true);
		}

		//camera->UpdateControls(window);
		world->Update();
		world->Render(framebuffer);
	}
	return 0;
}

I can now add ImageTargets, Samplers and UniformBuffers and even update the uniforms on demand. 

The technique is that ad first just a barebone description of the layout is saved. The Dispatch command adds a Transfer Hook to the rendering pipeline and at the first time the concrete layout and shader descriptors are setup, also the writedescriptros are setup.  Then if a buffer needs an update, this buffer is updated in the hook before the dispatch is send to the command buffer.

  • Like 1
  • Windows 10 Pro 64-Bit-Version
  • NVIDIA Geforce 1080 TI
Link to comment
Share on other sites

Another update:

  • Initializes using Vulkan 1.3
  • TextArea now working in 3D graphics
  • CreateInterface() overload added a font parameter

Example:

#include "UltraEngine.h"

using namespace UltraEngine;

int main(int argc, const char* argv[])
{
    //Get the displays
    auto displays = GetDisplays();

    //Create a window
    auto window = CreateWindow("Ultra Engine", 0, 0, 1280, 720, displays[0], WINDOW_CENTER | WINDOW_TITLEBAR);

    //Create a world
    auto world = CreateWorld();

    //Create a framebuffer
    auto framebuffer = CreateFramebuffer(window);

    //Create a camera
    auto camera = CreateCamera(world);
    camera->SetClearColor(0.125);
    camera->SetRotation(45, 0, 0);
    camera->Move(0, 0, -10);
    camera->SetFOV(70);

    auto uicam = CreateCamera(world, PROJECTION_ORTHOGRAPHIC);
    uicam->SetRenderLayers(RENDERLAYER_1);
    uicam->SetPosition(framebuffer->size.x / 2, framebuffer->size.y / 2);
    auto ui = CreateInterface(world, LoadFont("Fonts/arial.ttf"), framebuffer->size);
    ui->SetRenderLayers(RENDERLAYER_1);

    auto sz = ui->root->ClientSize();
    auto textarea = CreateTextArea(10, 10, sz.x - 20, sz.y - 20, ui->root, TEXTAREA_WORDWRAP);

    WString s = L"Night was falling now, and as I recalled what Akeley had written me about those earlier nights \
I shuddered to think there would be no moon. Nor did I like the way the farmhouse nestled in the lee of that \
colossal forested slope leading up to the Dark Mountains unvisited crest. With Akeleys permission I lighted a small oil lamp,\
 turned it low, and set it on a distant bookcase beside the ghostly bust of Milton; but afterward I was sorry I had done so, for \
it made my hosts strained, immobile face and listless hands look damnably abnormal and corpselike. He seemed half-incapable of motion, \
though I saw him nod stiffly once in a while.";

    textarea->SetLayout(1, 1, 1, 1);

    ui->SetScale(displays[0]->scale);
    textarea->SetText(s);

    //Main loop
    while (window->Closed() == false and window->KeyDown(KEY_ESCAPE) == false)
    {
        world->Update();
        world->Render(framebuffer);
    }
    return 0;
}

 

  • Like 1

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

  • Josh changed the title to Ultra Engine testing
  • Josh locked this topic
Guest
This topic is now closed to further replies.
 Share

×
×
  • Create New...