void BuilderGnuMakeOneStep::CreateLinkTargets(
    const wxString& type, BuildConfigPtr bldConf, wxString& text, wxString& targetName)
{
    // specify outfile dependency directly on source files (only)
    text << wxT("all: $(OutputFile)\n\n");
    text << wxT("$(OutputFile): makeDirStep $(Srcs)\n");
    targetName = wxT("makeDirStep");
    CreateTargets(type, bldConf, text); // overridden CreateTargets

    // if (bldConf->IsLinkerRequired()) {
    //	CreateTargets(type, bldConf, text);
    //}
}
Example #2
0
	void Graphics::ResizeBuffers(unsigned int width, unsigned int height)
	{
		DXGI_SWAP_CHAIN_DESC swapChainDesc;

		if(m_swapChain != NULL)
		{
			if(width == m_screenSize.cx && height == m_screenSize.cy)
			{
				m_deviceContext->OMSetRenderTargets(0, 0, 0);
				SAFE_RELEASE(m_renderTargetView);

				m_swapChain->ResizeBuffers(0, 0, 0, DXGI_FORMAT_UNKNOWN, DXGI_SWAP_CHAIN_FLAG_ALLOW_MODE_SWITCH );

				CreateTargets();
			}
		}
	}
Example #3
0
int main(int argc, char ** argv)
{
    int result = 1;
    struct gengetopt_args_info ai;
    AwaServerSession * session = NULL;
    AwaServerWriteOperation * operation = NULL;
    char address[128];
    unsigned int port;
    if (cmdline_parser(argc, argv, &ai) != 0)
    {
        result = 1;
        goto cleanup;
    }

    g_logLevel = ai.debug_given ? 2 : (ai.verbose_given ? 1 : 0);
    AwaLog_SetLevel(ai.debug_given ? AwaLogLevel_Debug : (ai.verbose_given ? AwaLogLevel_Verbose : AwaLogLevel_Warning));

    if (ai.inputs_num == 0 && ai.create_given == 0)
    {
        Error("Specify one or more resource paths.\n");
        result = 1;
        goto cleanup;
    }

    port = ai.ipcPort_arg;
    strncpy(address, ai.ipcAddress_arg, strlen(ai.ipcAddress_arg)+1);

    // Establish Awa Session with the daemon
    session = Server_EstablishSession(address, port);
    if (session == NULL)
    {
        Error("Failed to establish Awa Session\n");
        result = 1;
        goto cleanup;
    }

    AwaWriteMode mode = AwaWriteMode_Update;
    if (ai.replace_given)
        mode = AwaWriteMode_Replace;
    operation = AwaServerWriteOperation_New(session, mode);
    if (operation == NULL)
    {
        Error("AwaServerWriteOperation_New failed\n");
        Server_ReleaseSession(&session);
        result = 1;
        goto cleanup;
    }

    // Add create directives first
    int count = 0;
    count = CreateTargets(session, operation, ai.clientID_arg, ai.create_arg, ai.create_given);

    // Add target paths and values from the command line
    int i = 0;
    for (i = 0; i < ai.inputs_num; ++i)
    {
        Target * target = CreateTarget(ai.inputs[i]);
        if (target != NULL)
        {
            char * value = Server_GetValue(session, target, ai.inputs[i]);
            if (value != NULL)
            {
                if (AddTargetWithValue(session, operation, target, value) == 0)
                {
                    ++count;
                }

                free(value);
                value = NULL;
            }
            FreeTarget(&target);
        }
    }
    if (count > 0)
    {
        result = ProcessWriteOperation(operation, ai.clientID_arg);
    }

cleanup:
    if (operation)
    {
        AwaServerWriteOperation_Free(&operation);
    }
    if (session)
    {
        Server_ReleaseSession(&session);
    }
    cmdline_parser_free(&ai);
    return result;
}
Example #4
0
	bool Graphics::Initialize()
	{
		IDXGIFactory					*factory;
		IDXGIAdapter					*adapter;
		IDXGIOutput						*adapterOutput;
		DXGI_MODE_DESC					*displayModeList;
		DXGI_ADAPTER_DESC				adapterDesc;
		DXGI_SWAP_CHAIN_DESC			swapChainDesc;
		D3D_FEATURE_LEVEL				featureLevel;
		D3D11_BLEND_DESC				blendDesc;
		D3D11_DEPTH_STENCIL_DESC		depthStencilDesc;
		D3D11_SAMPLER_DESC				samplerDesc;
		unsigned int numModes, i, numerator, denominator, stringLength;
		int error;

		m_screenSize.cx = m_window->GetSize().cx;
		m_screenSize.cy = m_window->GetSize().cy;

		RETURN_FAIL( CreateDXGIFactory(__uuidof(IDXGIFactory), (void**)&factory) );
		RETURN_FAIL( factory->EnumAdapters(0, &adapter) );
		RETURN_FAIL( adapter->EnumOutputs(0, &adapterOutput) );
		RETURN_FAIL( adapterOutput->GetDisplayModeList(DXGI_FORMAT_R8G8B8A8_UNORM, DXGI_ENUM_MODES_INTERLACED, &numModes, NULL) );

		displayModeList = new DXGI_MODE_DESC[numModes];

		RETURN_FAIL( adapterOutput->GetDisplayModeList(DXGI_FORMAT_R8G8B8A8_UNORM, DXGI_ENUM_MODES_INTERLACED, &numModes, displayModeList) );

		for(i = 0; i < numModes; ++i)
		{
			if(displayModeList[i].Width == m_screenSize.cx)
			{
				if(displayModeList[i].Height == m_screenSize.cy)
				{
					numerator = displayModeList[i].RefreshRate.Numerator;
					denominator = displayModeList[i].RefreshRate.Denominator;
				}
			}
		}

		RETURN_FAIL( adapter->GetDesc(&adapterDesc) );

		m_videoCardMemory = (int)(adapterDesc.DedicatedVideoMemory / 1024 / 1024);

		RETURN_ERROR( wcstombs_s(&stringLength, m_videoCardDescription, 128, adapterDesc.Description, 128) );

		SAFE_DELETE_ARRAY( displayModeList );
		SAFE_RELEASE(adapterOutput);
		SAFE_RELEASE(adapter);
		SAFE_RELEASE(factory);

		ZeroMemory(&swapChainDesc, sizeof(swapChainDesc));
		swapChainDesc.BufferCount = 2;
		swapChainDesc.Windowed = true;
		swapChainDesc.BufferDesc.Width = m_screenSize.cx;
		swapChainDesc.BufferDesc.Height = m_screenSize.cy;
		swapChainDesc.BufferDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
		if(m_vsync_enabled)
		{
			swapChainDesc.BufferDesc.RefreshRate.Numerator = numerator;
			swapChainDesc.BufferDesc.RefreshRate.Denominator = denominator;
		}
		else
		{
			swapChainDesc.BufferDesc.RefreshRate.Numerator = 0;
			swapChainDesc.BufferDesc.RefreshRate.Denominator = 1;
		}
		swapChainDesc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT;
		swapChainDesc.OutputWindow = m_window->GetHWnd();
		swapChainDesc.SampleDesc.Count = 1;
		swapChainDesc.SampleDesc.Quality = 0;
		swapChainDesc.BufferDesc.ScanlineOrdering = DXGI_MODE_SCANLINE_ORDER_UNSPECIFIED;
		swapChainDesc.BufferDesc.Scaling = DXGI_MODE_SCALING_UNSPECIFIED;
		swapChainDesc.SwapEffect = DXGI_SWAP_EFFECT_DISCARD;
		swapChainDesc.Flags = DXGI_SWAP_CHAIN_FLAG_ALLOW_MODE_SWITCH;

		featureLevel = D3D_FEATURE_LEVEL_11_0;
		RETURN_FAIL( D3D11CreateDeviceAndSwapChain(NULL, D3D_DRIVER_TYPE_HARDWARE, NULL, D3D11_CREATE_DEVICE_DEBUG, &featureLevel, 1, D3D11_SDK_VERSION, &swapChainDesc, &m_swapChain, &m_device, NULL, &m_deviceContext) );
		RETURN_FAIL( m_swapChain->GetParent(__uuidof(IDXGIFactory), (LPVOID*)&factory) );
		RETURN_FAIL( factory->MakeWindowAssociation(m_window->GetHWnd(), DXGI_MWA_NO_WINDOW_CHANGES) );

		ZeroMemory( &blendDesc, sizeof( blendDesc ) );
		blendDesc.AlphaToCoverageEnable = true;
		blendDesc.RenderTarget[0].BlendEnable = TRUE;
		blendDesc.RenderTarget[0].SrcBlend = D3D11_BLEND_ONE;
		blendDesc.RenderTarget[0].DestBlend = D3D11_BLEND_INV_SRC_ALPHA;
		blendDesc.RenderTarget[0].BlendOp = D3D11_BLEND_OP_ADD;
		blendDesc.RenderTarget[0].SrcBlendAlpha = D3D11_BLEND_ONE;
		blendDesc.RenderTarget[0].DestBlendAlpha = D3D11_BLEND_INV_SRC_ALPHA;
		blendDesc.RenderTarget[0].BlendOpAlpha = D3D11_BLEND_OP_ADD;
		blendDesc.RenderTarget[0].RenderTargetWriteMask = D3D11_COLOR_WRITE_ENABLE_ALL;
		RETURN_FAIL( m_device->CreateBlendState( &blendDesc, &m_blendAlpha ) );

		m_deviceContext->OMSetBlendState( m_blendAlpha, NULL, 0xFFFFFF );

		ZeroMemory(&depthStencilDesc, sizeof(depthStencilDesc));
		depthStencilDesc.DepthEnable = true;
		depthStencilDesc.DepthWriteMask = D3D11_DEPTH_WRITE_MASK_ALL;
		depthStencilDesc.DepthFunc = D3D11_COMPARISON_LESS;
		depthStencilDesc.StencilEnable = true;
		depthStencilDesc.StencilReadMask = 0xFF;
		depthStencilDesc.StencilWriteMask = 0xFF;
		depthStencilDesc.FrontFace.StencilFailOp = D3D11_STENCIL_OP_KEEP;
		depthStencilDesc.FrontFace.StencilDepthFailOp = D3D11_STENCIL_OP_INCR;
		depthStencilDesc.FrontFace.StencilPassOp = D3D11_STENCIL_OP_KEEP;
		depthStencilDesc.FrontFace.StencilFunc = D3D11_COMPARISON_ALWAYS;
		depthStencilDesc.BackFace.StencilFailOp = D3D11_STENCIL_OP_KEEP;
		depthStencilDesc.BackFace.StencilDepthFailOp = D3D11_STENCIL_OP_DECR;
		depthStencilDesc.BackFace.StencilPassOp = D3D11_STENCIL_OP_KEEP;
		depthStencilDesc.BackFace.StencilFunc = D3D11_COMPARISON_ALWAYS;
		RETURN_FAIL( m_device->CreateDepthStencilState(&depthStencilDesc, &m_depthStencilState) );

		m_deviceContext->OMSetDepthStencilState(m_depthStencilState, 1);

		ZeroMemory( &samplerDesc, sizeof( samplerDesc ) );
		samplerDesc.AddressU        = D3D11_TEXTURE_ADDRESS_CLAMP;
		samplerDesc.AddressV        = D3D11_TEXTURE_ADDRESS_CLAMP;
		samplerDesc.AddressW        = D3D11_TEXTURE_ADDRESS_CLAMP;
		samplerDesc.ComparisonFunc  = D3D11_COMPARISON_NEVER;
		samplerDesc.Filter          = D3D11_FILTER_MIN_MAG_MIP_LINEAR;
		samplerDesc.MaxLOD          = D3D11_FLOAT32_MAX;
		RETURN_FAIL( m_device->CreateSamplerState( &samplerDesc, &m_samplerLinear ) );

		return CreateTargets();
	}
int main(int argc, char ** argv)
{
    int result = 0;
    struct gengetopt_args_info ai; 
    AwaClientSession * session = NULL;
    AwaClientSetOperation * operation = NULL;

    if (cmdline_parser(argc, argv, &ai) != 0)
    {
        exit(1);
    }

    g_logLevel = ai.debug_given ? 2 : (ai.verbose_given ? 1 : 0);
    AwaLog_SetLevel(ai.debug_given ? AwaLogLevel_Debug : (ai.verbose_given ? AwaLogLevel_Verbose : AwaLogLevel_Warning));

    if ((ai.inputs_num == 0) && (ai.create_given == 0))
    {
        Error("Specify one or more resource paths.\n");
        result = 1;
        goto cleanup;
    }

    session = Client_EstablishSession(ai.ipcAddress_arg, ai.ipcPort_arg);
    if (session != NULL)
    {
        // Create Set operation
        operation = AwaClientSetOperation_New(session);
        if (operation != NULL)
        {
            // Add create directives first
            int count = 0;
            count = CreateTargets(session, operation, ai.create_arg, ai.create_given);

            // Add target paths and values from the command line
            int i = 0;
            for (i = 0; i < ai.inputs_num; ++i)
            {
                Target * target = CreateTarget(ai.inputs[i]);
                if (target != NULL)
                {
                    char * value = Client_GetValue(session, target, ai.inputs[i]);
                    if (value != NULL)
                    {
                        if (AddTargetWithValue(session, operation, target, value) == 0)
                        {
                            ++count;
                        }
                        free(value);
                        value = NULL;
                    }
                    FreeTarget(&target);
                }
            }

            if (count > 0)
            {
                // Process Set operation
                result = ProcessSetOperation(operation);
            }
        }
        else
        {
            Error("Failed to create Set operation\n");
            result = 1;
        }
    }
    else
    {
        Error("Failed to establish Awa Session\n");
        result = 1;
    }

cleanup:
    if (operation)
    {
        AwaClientSetOperation_Free(&operation);
    }
    if (session)
    {
        Client_ReleaseSession(&session);
    }
    cmdline_parser_free(&ai);
    return result;
}