Mantle programming guide and white paper released

Started by
11 comments, last by tesla707 7 years, 11 months ago

Somebody started reverse engineering the api :

https://github.com/Overv/MantleHelloTriangle

Hopefully he'll succeed.

Advertisement

Too bad AMD didn't release the header files too sad.png

EDIT: Actually, it looks like all of the enums and structs are described at the end of the API guide! If someone were to go through and put them into a single file...


Was thinking the same. However it looks like shaders use amdil and not hlsl byte code input. I don't know if there is a tool available out there to generate amdil from either glsl or hlsl

I've been looking into this today, along with that MantleHelloTriangle repo.

So there is an older tool that was released pre gcn that will give AMD IL output from GLSL, HLSL, and several other formats including AMD IL. Its called GPU ShaderAnalyzer:

http://developer.amd.com/tools-and-sdks/graphics-development/gpu-shaderanalyzer/

If you want to look into AMD IL there is also the documentation on it.

http://developer.amd.com/wordpress/media/2012/10/AMD_Intermediate_Language_%28IL%29_Specification_v2.pdf

One thing that that i am worried about though is this wording in the mantle docs: "At present, an IL is based on a subset of AMD IL."

So some trial and error may be required to figure out what parts of AMD IL will work with mantle.

I have what seems like it should work as a super basic shader.

Vertex shader: copy vertex position to output

Fragment/Pixel shader: Change output color to red


il_ps_2_0
dcl_output_generic o0
dcl_literal l0, 1.0, 0.0, 0.0, 1.0
mov o0, l0
end

il_vs_2_0
dcl_input_generic v0
dcl_output_position o0
mov o0, v0
ret_dyn
end

Hello everybody!
I apologize that I lift an old topic, but I want to share with you my experience at Mantle SDK.
This SDK build by analogy Vulkan SDK - some defines, principle of operation taken from Vulkan API.

The archive is:

- static lib files (mantle32.lib, mantleaxl32.lib, mantle64.lib and mantleaxl64.lib), generate from API version 9.1.10.109;

- headers files (mantlePlatform.h, mantle.h, mantleExt.h, mantleWsiWinExt.h, mantleDbg.h, and NULL mantleExtDbg.h mantleWsiWinExtDbg.h).

Because of Mantle Guide don't update since march 2015, mantleExt.h does't contain a complete list of function prototypes.

And finally a small example of usage :cool:


#include "mantle.h"
#include <iostream>

#pragma comment (lib, "mantle64.lib")

int main()
{
	GR_RESULT result;

	GR_APPLICATION_INFO AppInfo = {};
	AppInfo.apiVersion = GR_API_VERSION;

	GR_UINT GpuCount = 0;
	GR_PHYSICAL_GPU gpus[GR_MAX_PHYSICAL_GPUS] = {};
	result = grInitAndEnumerateGpus(&AppInfo, GR_NULL_HANDLE, &GpuCount, gpus);

	GR_DEVICE_QUEUE_CREATE_INFO QueueInfo = {};
	QueueInfo.queueType = GR_QUEUE_UNIVERSAL;
	QueueInfo.queueCount = 1;

	static const GR_CHAR* const pNames[] = { "GR_WSI_WINDOWS" };

	GR_DEVICE_CREATE_INFO DeviceInfo = {};
	DeviceInfo.queueRecordCount = 1;
	DeviceInfo.pRequestedQueues = &QueueInfo;
	DeviceInfo.extensionCount = 1;
	DeviceInfo.ppEnabledExtensionNames = pNames;
#if defined(_DEBUG)
	DeviceInfo.maxValidationLevel = GR_VALIDATION_LEVEL_4;
	DeviceInfo.flags |= GR_DEVICE_CREATE_VALIDATION;
#else
	DeviceInfo.maxValidationLevel = GR_VALIDATION_LEVEL_0;
#endif

	GR_DEVICE device = GR_NULL_HANDLE;
	result = grCreateDevice(gpus[0], &DeviceInfo, &device);

	GR_PHYSICAL_GPU_PROPERTIES prop = {};
	GR_SIZE size = sizeof(GR_PHYSICAL_GPU_PROPERTIES);
	result = grGetGpuInfo(gpus[0], GR_INFO_TYPE_PHYSICAL_GPU_PROPERTIES, &size, &prop);

	std::cout << "VendorID: 0x" << std::hex << prop.vendorId << std::endl;
	std::cout << "DeviceID: 0x" << std::hex << prop.deviceId << std::endl;
	std::cout << "GPU Name: " << prop.gpuName << std::endl;

	grDestroyDevice(device);
	std::cin.get();
	return 0;
}

This topic is closed to new replies.

Advertisement