예제 #1
0
    void CreateComputePipeline()
    {
        // Create compute shader
        if (Supported(LLGL::ShadingLanguage::GLSL))
        {
            computeShader = LoadShaderProgram(
                {
                    { LLGL::ShaderType::Compute, "Example.comp" }
                }
            );
        }
        else if (Supported(LLGL::ShadingLanguage::SPIRV))
        {
            computeShader = LoadShaderProgram(
                {
                    { LLGL::ShaderType::Compute, "Example.comp.spv" }
                }
            );
        }
        else if (Supported(LLGL::ShadingLanguage::HLSL))
        {
            computeShader = LoadShaderProgram(
                {
                    { LLGL::ShaderType::Compute, "Example.hlsl", "CS", "cs_5_0" },
                }
            );
        }
        else if (Supported(LLGL::ShadingLanguage::Metal))
        {
            computeShader = LoadShaderProgram(
                {
                    { LLGL::ShaderType::Compute, "Example.metal", "CS", "1.1" },
                }
            );
        }
        else
            throw std::runtime_error("shaders not available for selected renderer in this example");

        // Create compute pipeline layout
        computeLayout = renderer->CreatePipelineLayout(
            LLGL::PipelineLayoutDesc("cbuffer(2):comp, rwbuffer(3):comp, rwbuffer(4):comp")
        );

        // Create compute pipeline
        LLGL::ComputePipelineDescriptor pipelineDesc;
        {
            pipelineDesc.shaderProgram  = computeShader;
            pipelineDesc.pipelineLayout = computeLayout;
        }
        computePipeline = renderer->CreateComputePipeline(pipelineDesc);

        // Create resource heap for compute pipeline
        LLGL::ResourceHeapDescriptor resourceHeapDesc;
        {
            resourceHeapDesc.pipelineLayout = computeLayout;
            resourceHeapDesc.resourceViews  = { inputBuffer, instanceBuffer, indirectArgBuffer };
        }
        computeResourceHeap = renderer->CreateResourceHeap(resourceHeapDesc);
    }
예제 #2
0
    void CreateGraphicsPipeline()
    {
        // Create graphics shader
        if (Supported(LLGL::ShadingLanguage::GLSL))
        {
            graphicsShader = LoadShaderProgram(
                {
                    { LLGL::ShaderType::Vertex,   "Example.vert" },
                    { LLGL::ShaderType::Fragment, "Example.frag" }
                },
                { vertexFormat[0], vertexFormat[1] }
            );
        }
        else if (Supported(LLGL::ShadingLanguage::SPIRV))
        {
            graphicsShader = LoadShaderProgram(
                {
                    { LLGL::ShaderType::Vertex,   "Example.vert.spv" },
                    { LLGL::ShaderType::Fragment, "Example.frag.spv" }
                },
                { vertexFormat[0], vertexFormat[1] }
            );
        }
        else if (Supported(LLGL::ShadingLanguage::HLSL))
        {
            graphicsShader = LoadShaderProgram(
                {
                    { LLGL::ShaderType::Vertex,   "Example.hlsl", "VS", "vs_5_0" },
                    { LLGL::ShaderType::Fragment, "Example.hlsl", "PS", "ps_5_0" }
                },
                { vertexFormat[0], vertexFormat[1] }
            );
        }
        else if (Supported(LLGL::ShadingLanguage::Metal))
        {
            graphicsShader = LoadShaderProgram(
                {
                    { LLGL::ShaderType::Vertex,   "Example.metal", "VS", "1.1" },
                    { LLGL::ShaderType::Fragment, "Example.metal", "PS", "1.1" }
                },
                { vertexFormat[0], vertexFormat[1] }
            );
        }
        else
            throw std::runtime_error("shaders not available for selected renderer in this example");

        // Create graphics pipeline
        LLGL::GraphicsPipelineDescriptor pipelineDesc;
        {
            pipelineDesc.shaderProgram              = graphicsShader;
            pipelineDesc.primitiveTopology          = LLGL::PrimitiveTopology::TriangleStrip;
            pipelineDesc.rasterizer.multiSampling   = GetMultiSampleDesc();
        }
        graphicsPipeline = renderer->CreateGraphicsPipeline(pipelineDesc);
    }
예제 #3
0
int main()
{
	ULONG Status = 0;
	SLOpen pSLOpen = NULL;
	SLClose pSLClose = NULL;
	SLInstallLicense pSLInstallLicense = NULL;
	SLInstallProofOfPurchase pSLInstallProofOfPurchase = NULL;
	SLFireEvent pSLFireEvent = NULL;
	HMODULE hSlc = NULL;
	HANDLE hSl = NULL;
	HRSRC hResource = NULL;
	HGLOBAL hgResource = NULL;
	ULONG CertSize = NULL;
	GUID pKeyId = GUID_NULL;
	GUID WindowsSlid = WINDOWS_SLID;
	UCHAR* Cert = NULL;
	wchar_t* PKeyIn;
	switch(Supported()) {
	case 0:
		break;
	case 1:
		printf("unsupported OS");
		return 1;
	case 2:
		printf("unsupported product");
		return 1;
	default:
		return 1;
	}
	hResource = FindResource(NULL, MAKEINTRESOURCE(101), "RAW");
	if(hResource) {
		CertSize = SizeofResource(NULL, hResource);
		hgResource = LoadResource(NULL, hResource);
	}
	else {
		printf("%s", eloadresource);
		return 1;
	}
	if(hgResource) {
		Cert = (UCHAR*)LockResource(hgResource);
	}
	else {
		printf("%s", eloadresource);
		return 1;
	}
	hSlc = LoadLibrary("slc.dll");
	if (hSlc) {
		// get pointers
		pSLOpen = (SLOpen) GetProcAddress(hSlc, "SLOpen");
		pSLClose = (SLClose) GetProcAddress(hSlc, "SLClose");
		pSLInstallLicense = (SLInstallLicense) GetProcAddress(hSlc, "SLInstallLicense");
		pSLInstallProofOfPurchase = (SLInstallProofOfPurchase) GetProcAddress(hSlc, "SLInstallProofOfPurchase");
		pSLFireEvent = (SLFireEvent) GetProcAddress(hSlc, "SLFireEvent");
		//
		if(pSLOpen(&hSl) == ERROR_SUCCESS) {
			printf("installing certificate: ");
			if(pSLInstallLicense(hSl, CertSize, Cert, &pKeyId) == ERROR_SUCCESS) {
				printf("%s\n", success);
			}
			else {
				printf("%s\n", fail);
				Status++;
			}
			if(GetKey(&PKeyIn)) {
				printf("installing key: ");
				if(pSLInstallProofOfPurchase(hSl, PKeyType, PKeyIn, 0, 0 , &pKeyId) == ERROR_SUCCESS) {
					printf("%s\n", success);
				}
				else {
					printf("%s\n", fail);
					Status++;
				}
			}
			else {
				printf("couldn't find product key");
				Status++;
			}
			Status = pSLFireEvent(hSl, SlEvent, &WindowsSlid);
			pSLOpen = NULL;
			pSLInstallLicense = NULL;
			pSLInstallProofOfPurchase = NULL;
			pSLFireEvent = NULL;
			Status = pSLClose(hSl);
			pSLClose = NULL;
			hSl = NULL;
		}
		FreeLibrary(hSlc);
		hSlc = NULL;
	}
	else {
		printf("failed to load slc.dll");
		Status = 1;
	}
	ExitProcess(Status);
}
예제 #4
0
void
eavlXGCImporter::Initialize()
{
    variables.clear();
    for (int i = 0; i < fp->nvars; i++)
    {
	ADIOS_VARINFO *avi = adios_inq_var_byid(fp, i);
	string varNm(&fp->var_namelist[i][1]);
	if (Supported(avi))
	    variables[varNm] = avi;
	else
	{
	    //check for scalars....
	    if (avi->ndim == 0)
	    {
		if (varNm == "nnode")
		    nNodes = (int)(*(int *)avi->value);
		if (varNm == "nphi")
		    nPlanes = (int)(*(int *)avi->value);
	    }
	    adios_free_varinfo(avi);
	}
    }

    //Read mesh info.
    for (int i = 0; i < mesh_fp->nvars; i++)
    {
	ADIOS_VARINFO *avi = adios_inq_var_byid(mesh_fp, i);
	string varNm(&mesh_fp->var_namelist[i][1]);

	bool freeAVI = true;
	if (avi->ndim == 0)
	{
	    if (varNm == "n_t")
		nElems = (int)(*(int *)avi->value);
	    else if (varNm == "n_n")
	    {
		int n = (int)(*(int *)avi->value);
		if (n != nNodes)
		    THROW(eavlException, "Node count mismatch between mesh and variable file.");
	    }
	}
	else if (avi->ndim == 1 && varNm == "nextnode")
	{
	    nextNode = avi;
	    freeAVI = false;
	}
	else if (avi->ndim == 2 && varNm == "coordinates/values")
	{
	    points = avi;
	    freeAVI = false;
	}
	else if (avi->ndim == 2 && varNm == "cell_set[0]/node_connect_list")
	{
	    cells = avi;
	    freeAVI = false;
	}
	
	if (freeAVI)
	    adios_free_varinfo(avi);
    }
}