예제 #1
0
파일: volume.c 프로젝트: kholia/wine
HRESULT wined3d_volume_init(struct wined3d_volume *volume, struct wined3d_texture *container,
        const struct wined3d_resource_desc *desc, UINT level)
{
    struct wined3d_device *device = container->resource.device;
    const struct wined3d_gl_info *gl_info = &device->adapter->gl_info;
    const struct wined3d_format *format = wined3d_get_format(gl_info, desc->format);
    HRESULT hr;
    UINT size;

    size = wined3d_format_calculate_size(format, device->surface_alignment, desc->width, desc->height, desc->depth);

    if (FAILED(hr = resource_init(&volume->resource, device, WINED3D_RTYPE_VOLUME, format,
            WINED3D_MULTISAMPLE_NONE, 0, desc->usage, desc->pool, desc->width, desc->height, desc->depth,
            size, NULL, &wined3d_null_parent_ops, &volume_resource_ops)))
    {
        WARN("Failed to initialize resource, returning %#x.\n", hr);
        return hr;
    }

    if (container->resource.map_binding == WINED3D_LOCATION_BUFFER)
        wined3d_resource_free_sysmem(&volume->resource);

    volume->texture_level = level;
    container->sub_resources[level].locations = WINED3D_LOCATION_DISCARDED;

    volume->container = container;

    return WINED3D_OK;
}
예제 #2
0
void __init setup_arch(char **cmdline_p)
{
	/* the variable later on will be used in macros as well */
	is_nlm_xlp2xx_compat = is_nlm_xlp2xx();

	cpu_probe();
	prom_init();
#ifdef CONFIG_EARLY_PRINTK
	setup_early_printk();
#endif
	cpu_report();
	check_bugs_early();

#if defined(CONFIG_VT)
#if defined(CONFIG_VGA_CONSOLE)
	conswitchp = &vga_con;
#elif defined(CONFIG_DUMMY_CONSOLE)
	conswitchp = &dummy_con;
#endif
#endif

	arch_mem_init(cmdline_p);

	resource_init();
	plat_smp_setup();
}
예제 #3
0
파일: volume.c 프로젝트: klickverbot/wine
static HRESULT volume_init(struct wined3d_volume *volume, struct wined3d_device *device, UINT width,
        UINT height, UINT depth, DWORD usage, enum wined3d_format_id format_id, enum wined3d_pool pool,
        void *parent, const struct wined3d_parent_ops *parent_ops)
{
    const struct wined3d_gl_info *gl_info = &device->adapter->gl_info;
    const struct wined3d_format *format = wined3d_get_format(gl_info, format_id);
    HRESULT hr;

    if (!gl_info->supported[EXT_TEXTURE3D])
    {
        WARN("Volume cannot be created - no volume texture support.\n");
        return WINED3DERR_INVALIDCALL;
    }

    hr = resource_init(&volume->resource, device, WINED3D_RTYPE_VOLUME, format,
            WINED3D_MULTISAMPLE_NONE, 0, usage, pool, width, height, depth,
            width * height * depth * format->byte_count, parent, parent_ops,
            &volume_resource_ops);
    if (FAILED(hr))
    {
        WARN("Failed to initialize resource, returning %#x.\n", hr);
        return hr;
    }

    volume->lockable = TRUE;
    volume->locked = FALSE;
    memset(&volume->lockedBox, 0, sizeof(volume->lockedBox));
    volume->dirty = TRUE;

    volume_add_dirty_box(volume, NULL);

    return WINED3D_OK;
}
예제 #4
0
파일: setup.c 프로젝트: cilynx/dd-wrt
void __init setup_arch(char **cmdline_p)
{
	cpu_probe();
	prom_init();

#ifdef CONFIG_EARLY_PRINTK
	{
		extern void setup_early_printk(void);

		setup_early_printk();
	}
#endif
	cpu_report();

#if defined(CONFIG_VT)
#if defined(CONFIG_VGA_CONSOLE)
	conswitchp = &vga_con;
#elif defined(CONFIG_DUMMY_CONSOLE)
	conswitchp = &dummy_con;
#endif
#endif

	arch_mem_init(cmdline_p);

	resource_init();
#ifdef CONFIG_SMP
	plat_smp_setup();
#endif
}
예제 #5
0
파일: main.c 프로젝트: jezze/fudge
void part_init(struct part *part)
{

    ctrl_setpartsettings(&part->settings, 0, 0, 0);
    resource_init(&part->resource, RESOURCE_PART, part);
    system_initnode(&part->root, SYSTEM_NODETYPE_MULTIGROUP, "part");
    system_initnode(&part->ctrl, SYSTEM_NODETYPE_NORMAL, "ctrl");
    system_initnode(&part->data, SYSTEM_NODETYPE_NORMAL, "data");

}
예제 #6
0
HRESULT basetexture_init(IWineD3DBaseTextureImpl *texture, UINT levels, WINED3DRESOURCETYPE resource_type,
        IWineD3DDeviceImpl *device, UINT size, DWORD usage, const struct wined3d_format_desc *format_desc,
        WINED3DPOOL pool, IUnknown *parent, const struct wined3d_parent_ops *parent_ops
#ifdef VBOX_WITH_WDDM
        , HANDLE *shared_handle
        , void **pavClientMem
#endif
        )
{
    HRESULT hr;

    if (levels > MAX_MIP_LEVELS)
    {
        WARN("Too many texture levels %d", levels);
        return WINED3DERR_INVALIDCALL;
    }

    hr = resource_init((IWineD3DResource *)texture, resource_type, device,
            size, usage, format_desc, pool, parent, parent_ops
#ifdef VBOX_WITH_WDDM
            , shared_handle, pavClientMem ? pavClientMem[0] : NULL /* <- @todo: should be always NULL ? */
#endif
            );
    if (FAILED(hr))
    {
        WARN("Failed to initialize resource, returning %#x\n", hr);
        return hr;
    }

    texture->baseTexture.levels = levels;
    texture->baseTexture.filterType = (usage & WINED3DUSAGE_AUTOGENMIPMAP) ? WINED3DTEXF_LINEAR : WINED3DTEXF_NONE;
    texture->baseTexture.LOD = 0;
    texture->baseTexture.texture_rgb.dirty = TRUE;
    texture->baseTexture.texture_srgb.dirty = TRUE;
    texture->baseTexture.is_srgb = FALSE;
    texture->baseTexture.pow2Matrix_identity = TRUE;
#if defined(VBOX_WITH_WDDM) && defined(DEBUG_leo)
    texture->baseTexture.t_mirror = FALSE;
#else
    texture->baseTexture.t_mirror = FALSE;
#endif

    if (texture->resource.format_desc->Flags & WINED3DFMT_FLAG_FILTERING)
    {
        texture->baseTexture.minMipLookup = minMipLookup;
        texture->baseTexture.magLookup = magLookup;
    }
    else
    {
        texture->baseTexture.minMipLookup = minMipLookup_noFilter;
        texture->baseTexture.magLookup = magLookup_noFilter;
    }

    return WINED3D_OK;
}
예제 #7
0
파일: main.c 프로젝트: jezze/fudge
void ethernet_initprotocol(struct ethernet_protocol *protocol, char *name, unsigned int type, void (*notify)(struct ethernet_header *header, void *buffer, unsigned int count))
{

    resource_init(&protocol->resource, RESOURCE_ETHERNETPROTOCOL, protocol);
    system_initnode(&protocol->root, SYSTEM_NODETYPE_GROUP, name);
    system_initnode(&protocol->data, SYSTEM_NODETYPE_NORMAL, "data");

    protocol->type = type;
    protocol->notify = notify;

}
예제 #8
0
파일: core.c 프로젝트: jezze/fudge
void core_init(struct core *core, unsigned int id, unsigned int sp, struct task *task)
{

    list_inititem(&core->item, core);
    resource_init(&core->resource, RESOURCE_CORE, core);

    core->id = id;
    core->sp = sp;
    core->task = task;

}
예제 #9
0
void __init setup_arch(char **cmdline_p)
{
	randomize_va_space = 0;
	*cmdline_p = command_line;

	cpu_cache_init();
	tlb_init();
	bootmem_init();
	paging_init();
	resource_init();
}
예제 #10
0
파일: main.c 프로젝트: jezze/fudge
void ethernet_initinterface(struct ethernet_interface *interface, unsigned int id, unsigned int (*matchaddress)(void *buffer, unsigned int count), unsigned int (*send)(void *buffer, unsigned int count))
{

    resource_init(&interface->resource, RESOURCE_ETHERNETINTERFACE, interface);
    system_initnode(&interface->root, SYSTEM_NODETYPE_MULTIGROUP, "if");
    system_initnode(&interface->ctrl, SYSTEM_NODETYPE_NORMAL, "ctrl");
    system_initnode(&interface->data, SYSTEM_NODETYPE_NORMAL, "data");
    system_initnode(&interface->addr, SYSTEM_NODETYPE_NORMAL, "addr");

    interface->id = id;
    interface->matchaddress = matchaddress;
    interface->send = send;

}
예제 #11
0
파일: basetexture.c 프로젝트: dvdhoo/wine
HRESULT basetexture_init(IWineD3DBaseTextureImpl *texture, const struct wined3d_texture_ops *texture_ops,
        UINT layer_count, UINT level_count, WINED3DRESOURCETYPE resource_type, IWineD3DDeviceImpl *device,
        DWORD usage, const struct wined3d_format *format, WINED3DPOOL pool, void *parent,
        const struct wined3d_parent_ops *parent_ops, const struct wined3d_resource_ops *resource_ops)
{
    HRESULT hr;

    hr = resource_init(&texture->resource, device, resource_type, format,
            WINED3DMULTISAMPLE_NONE, 0, usage, pool, 0, 0, 0, 0,
            parent, parent_ops, resource_ops);
    if (FAILED(hr))
    {
        WARN("Failed to initialize resource, returning %#x\n", hr);
        return hr;
    }

    texture->baseTexture.texture_ops = texture_ops;
    texture->baseTexture.sub_resources = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
            level_count * layer_count * sizeof(*texture->baseTexture.sub_resources));
    if (!texture->baseTexture.sub_resources)
    {
        ERR("Failed to allocate sub-resource array.\n");
        resource_cleanup(&texture->resource);
        return E_OUTOFMEMORY;
    }

    texture->baseTexture.layer_count = layer_count;
    texture->baseTexture.level_count = level_count;
    texture->baseTexture.filterType = (usage & WINED3DUSAGE_AUTOGENMIPMAP) ? WINED3DTEXF_LINEAR : WINED3DTEXF_NONE;
    texture->baseTexture.LOD = 0;
    texture->baseTexture.texture_rgb.dirty = TRUE;
    texture->baseTexture.texture_srgb.dirty = TRUE;
    texture->baseTexture.is_srgb = FALSE;
    texture->baseTexture.pow2Matrix_identity = TRUE;

    if (texture->resource.format->flags & WINED3DFMT_FLAG_FILTERING)
    {
        texture->baseTexture.minMipLookup = minMipLookup;
        texture->baseTexture.magLookup = magLookup;
    }
    else
    {
        texture->baseTexture.minMipLookup = minMipLookup_noFilter;
        texture->baseTexture.magLookup = magLookup_noFilter;
    }

    return WINED3D_OK;
}
예제 #12
0
파일: volume.c 프로젝트: alexwgo/wine
static HRESULT volume_init(struct wined3d_volume *volume, struct wined3d_texture *container,
        const struct wined3d_resource_desc *desc, UINT level)
{
    struct wined3d_device *device = container->resource.device;
    const struct wined3d_gl_info *gl_info = &device->adapter->gl_info;
    const struct wined3d_format *format = wined3d_get_format(gl_info, desc->format);
    HRESULT hr;
    UINT size;

    if (!gl_info->supported[EXT_TEXTURE3D])
    {
        WARN("Volume cannot be created - no volume texture support.\n");
        return WINED3DERR_INVALIDCALL;
    }
    /* TODO: Write tests for other resources and move this check
     * to resource_init, if applicable. */
    if (desc->usage & WINED3DUSAGE_DYNAMIC
            && (desc->pool == WINED3D_POOL_MANAGED || desc->pool == WINED3D_POOL_SCRATCH))
    {
        WARN("Attempted to create a DYNAMIC texture in pool %s.\n", debug_d3dpool(desc->pool));
        return WINED3DERR_INVALIDCALL;
    }

    size = wined3d_format_calculate_size(format, device->surface_alignment, desc->width, desc->height, desc->depth);

    if (FAILED(hr = resource_init(&volume->resource, device, WINED3D_RTYPE_VOLUME, format,
            WINED3D_MULTISAMPLE_NONE, 0, desc->usage, desc->pool, desc->width, desc->height, desc->depth,
            size, NULL, &wined3d_null_parent_ops, &volume_resource_ops)))
    {
        WARN("Failed to initialize resource, returning %#x.\n", hr);
        return hr;
    }

    volume->texture_level = level;
    volume->locations = WINED3D_LOCATION_DISCARDED;

    if (desc->pool == WINED3D_POOL_DEFAULT && desc->usage & WINED3DUSAGE_DYNAMIC
            && gl_info->supported[ARB_PIXEL_BUFFER_OBJECT]
            && !format->convert)
    {
        wined3d_resource_free_sysmem(&volume->resource);
        volume->flags |= WINED3D_VFLAG_PBO;
    }

    volume->container = container;

    return WINED3D_OK;
}
예제 #13
0
파일: volume.c 프로젝트: Kelimion/wine
static HRESULT volume_init(struct wined3d_volume *volume, struct wined3d_device *device, UINT width,
        UINT height, UINT depth, UINT level, DWORD usage, enum wined3d_format_id format_id,
        enum wined3d_pool pool, void *parent, const struct wined3d_parent_ops *parent_ops)
{
    const struct wined3d_gl_info *gl_info = &device->adapter->gl_info;
    const struct wined3d_format *format = wined3d_get_format(gl_info, format_id);
    HRESULT hr;
    UINT size;

    if (!gl_info->supported[EXT_TEXTURE3D])
    {
        WARN("Volume cannot be created - no volume texture support.\n");
        return WINED3DERR_INVALIDCALL;
    }
    /* TODO: Write tests for other resources and move this check
     * to resource_init, if applicable. */
    if (usage & WINED3DUSAGE_DYNAMIC
            && (pool == WINED3D_POOL_MANAGED || pool == WINED3D_POOL_SCRATCH))
    {
        WARN("Attempted to create a DYNAMIC texture in pool %u.\n", pool);
        return WINED3DERR_INVALIDCALL;
    }

    size = wined3d_format_calculate_size(format, device->surface_alignment, width, height, depth);

    hr = resource_init(&volume->resource, device, WINED3D_RTYPE_VOLUME, format,
            WINED3D_MULTISAMPLE_NONE, 0, usage, pool, width, height, depth,
            size, parent, parent_ops, &volume_resource_ops);
    if (FAILED(hr))
    {
        WARN("Failed to initialize resource, returning %#x.\n", hr);
        return hr;
    }

    volume->texture_level = level;
    volume->locations = WINED3D_LOCATION_DISCARDED;

    if (pool == WINED3D_POOL_DEFAULT && usage & WINED3DUSAGE_DYNAMIC
            && gl_info->supported[ARB_PIXEL_BUFFER_OBJECT])
    {
        wined3d_resource_free_sysmem(volume->resource.heap_memory);
        volume->resource.heap_memory = NULL;
        volume->resource.allocatedMemory = NULL;
        volume->flags |= WINED3D_VFLAG_PBO;
    }

    return WINED3D_OK;
}
예제 #14
0
파일: texture.c 프로젝트: pombredanne/wine
static HRESULT wined3d_texture_init(struct wined3d_texture *texture, const struct wined3d_texture_ops *texture_ops,
                                    UINT layer_count, UINT level_count, enum wined3d_resource_type resource_type, struct wined3d_device *device,
                                    DWORD usage, const struct wined3d_format *format, enum wined3d_pool pool, void *parent,
                                    const struct wined3d_parent_ops *parent_ops, const struct wined3d_resource_ops *resource_ops)
{
    HRESULT hr;

    hr = resource_init(&texture->resource, device, resource_type, format,
                       WINED3D_MULTISAMPLE_NONE, 0, usage, pool, 0, 0, 0, 0,
                       parent, parent_ops, resource_ops);
    if (FAILED(hr))
    {
        WARN("Failed to initialize resource, returning %#x\n", hr);
        return hr;
    }

    texture->texture_ops = texture_ops;
    texture->sub_resources = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
                                       level_count * layer_count * sizeof(*texture->sub_resources));
    if (!texture->sub_resources)
    {
        ERR("Failed to allocate sub-resource array.\n");
        resource_cleanup(&texture->resource);
        return E_OUTOFMEMORY;
    }

    texture->layer_count = layer_count;
    texture->level_count = level_count;
    texture->filter_type = (usage & WINED3DUSAGE_AUTOGENMIPMAP) ? WINED3D_TEXF_LINEAR : WINED3D_TEXF_NONE;
    texture->lod = 0;
    texture->texture_rgb.dirty = TRUE;
    texture->texture_srgb.dirty = TRUE;
    texture->flags = WINED3D_TEXTURE_POW2_MAT_IDENT;

    if (texture->resource.format->flags & WINED3DFMT_FLAG_FILTERING)
    {
        texture->min_mip_lookup = minMipLookup;
        texture->mag_lookup = magLookup;
    }
    else
    {
        texture->min_mip_lookup = minMipLookup_noFilter;
        texture->mag_lookup = magLookup_noFilter;
    }

    return WINED3D_OK;
}
예제 #15
0
int main(int argc, char* argv[])
{
	if (bl_grp_init() < 0) {
		printf("grp init error!\n");
		return 0;
	}

	bl_disable_bios_timi();
	resource_init();

	while (title())
		game_loop();

	resource_deinit();
	bl_enable_bios_timi();
	bl_grp_deinit();

	return 0;
}
예제 #16
0
파일: setup.c 프로젝트: ivucica/linux
void __init setup_arch(char **cmdline_p)
{
	cpu_probe();
	prom_init();
	cpu_report();

#if defined(CONFIG_VT)
#if defined(CONFIG_VGA_CONSOLE)
        conswitchp = &vga_con;
#elif defined(CONFIG_DUMMY_CONSOLE)
        conswitchp = &dummy_con;
#endif
#endif

	arch_mem_init(cmdline_p);

	resource_init();
#ifdef CONFIG_SMP
	plat_smp_setup();
#endif
}
예제 #17
0
HRESULT volume_init(IWineD3DVolumeImpl *volume, IWineD3DDeviceImpl *device, UINT width,
        UINT height, UINT depth, DWORD usage, enum wined3d_format_id format_id, WINED3DPOOL pool,
        void *parent, const struct wined3d_parent_ops *parent_ops)
{
    const struct wined3d_gl_info *gl_info = &device->adapter->gl_info;
    const struct wined3d_format *format = wined3d_get_format(gl_info, format_id);
    HRESULT hr;

    if (!gl_info->supported[EXT_TEXTURE3D])
    {
        WARN("Volume cannot be created - no volume texture support.\n");
        return WINED3DERR_INVALIDCALL;
    }

    volume->lpVtbl = &IWineD3DVolume_Vtbl;

    hr = resource_init((IWineD3DResource *)volume, WINED3DRTYPE_VOLUME, device,
            width * height * depth * format->byte_count, usage, format, pool, parent, parent_ops);
    if (FAILED(hr))
    {
        WARN("Failed to initialize resource, returning %#x.\n", hr);
        return hr;
    }

    volume->currentDesc.Width = width;
    volume->currentDesc.Height = height;
    volume->currentDesc.Depth = depth;
    volume->lockable = TRUE;
    volume->locked = FALSE;
    memset(&volume->lockedBox, 0, sizeof(volume->lockedBox));
    volume->dirty = TRUE;

    volume_add_dirty_box((IWineD3DVolume *)volume, NULL);

    return WINED3D_OK;
}
예제 #18
0
/**
 * @brief System Initialization and creation of the BLE task
 */
static void system_init( void *pvParameters )
{
        /* Prepare clocks. Note: cm_cpu_clk_set() and cm_sys_clk_set() can be called only from a
         * task since they will suspend the task until the XTAL16M has settled and, maybe, the PLL
         * is locked.
         */
        cm_sys_clk_init(sysclk_XTAL16M);
        cm_apb_set_clock_divider(apb_div1);
        cm_ahb_set_clock_divider(ahb_div1);
        cm_lp_clk_init();

        /*
         * Initialize platform watchdog
         */
        sys_watchdog_init();

#if dg_configUSE_WDOG
        // Register the Idle task first.
        idle_task_wdog_id = sys_watchdog_register(false);
        ASSERT_WARNING(idle_task_wdog_id != -1);
        sys_watchdog_configure_idle_id(idle_task_wdog_id);
#endif

        /* Set system clock */
        cm_sys_clk_set(sysclk_XTAL16M);

        /* Prepare the hardware to run this demo. */
        prvSetupHardware();

        /* init resources */
        resource_init();

        /* init GPADC adapter */
        GPADC_INIT();

        /* Set the desired sleep mode. */
        pm_set_wakeup_mode(true);
        pm_set_sleep_mode(pm_mode_extended_sleep);

        /* Initialize NVMS adapter - has to be done before BLE starts */
        ad_nvms_init();

        /* Initialize BLE Adapter */
        ad_ble_init();

        /* Initialize BLE Manager */
        ble_mgr_init();

        /* Start the BLE Peripheral application task. */
        OS_TASK_CREATE("BLE Peripheral",                   /* The text name assigned to the task, for
                                                              debug only; not used by the kernel. */
                       ble_att_perm_test_task,             /* The function that implements the task. */
                       NULL,                               /* The parameter passed to the task. */
                       200 * OS_STACK_WORD_SIZE,           /* The number of bytes to allocate to the
                                                              stack of the task. */
                       mainBLE_ATT_PERM_TEST_TASK_PRIORITY,/* The priority assigned to the task. */
                       handle);                            /* The task handle. */
        OS_ASSERT(handle);

        /* the work of the SysInit task is done */
        OS_TASK_DELETE(OS_GET_CURRENT_TASK());
}
예제 #19
0
int resource_setup(struct resource *r, const char *name, struct resource_ops *ops) {
    strncpy(r->name, name, 255);
    r->ops = ops;
    return resource_init(r);
}
예제 #20
0
파일: texture.c 프로젝트: alexwgo/wine
static HRESULT wined3d_texture_init(struct wined3d_texture *texture, const struct wined3d_texture_ops *texture_ops,
        UINT layer_count, UINT level_count, const struct wined3d_resource_desc *desc, struct wined3d_device *device,
        void *parent, const struct wined3d_parent_ops *parent_ops, const struct wined3d_resource_ops *resource_ops)
{
    const struct wined3d_format *format = wined3d_get_format(&device->adapter->gl_info, desc->format);
    HRESULT hr;

    TRACE("texture %p, texture_ops %p, layer_count %u, level_count %u, resource_type %s, format %s, "
            "multisample_type %#x, multisample_quality %#x, usage %s, pool %s, width %u, height %u, depth %u, "
            "device %p, parent %p, parent_ops %p, resource_ops %p.\n",
            texture, texture_ops, layer_count, level_count, debug_d3dresourcetype(desc->resource_type),
            debug_d3dformat(desc->format), desc->multisample_type, desc->multisample_quality,
            debug_d3dusage(desc->usage), debug_d3dpool(desc->pool), desc->width, desc->height, desc->depth,
            device, parent, parent_ops, resource_ops);

    if ((format->flags & (WINED3DFMT_FLAG_BLOCKS | WINED3DFMT_FLAG_BLOCKS_NO_VERIFY)) == WINED3DFMT_FLAG_BLOCKS)
    {
        UINT width_mask = format->block_width - 1;
        UINT height_mask = format->block_height - 1;
        if (desc->width & width_mask || desc->height & height_mask)
            return WINED3DERR_INVALIDCALL;
    }

    if (FAILED(hr = resource_init(&texture->resource, device, desc->resource_type, format,
            desc->multisample_type, desc->multisample_quality, desc->usage, desc->pool,
            desc->width, desc->height, desc->depth, 0, parent, parent_ops, resource_ops)))
    {
        static unsigned int once;

        if ((desc->format == WINED3DFMT_DXT1 || desc->format == WINED3DFMT_DXT2 || desc->format == WINED3DFMT_DXT3
                || desc->format == WINED3DFMT_DXT4 || desc->format == WINED3DFMT_DXT5)
                && !(format->flags & WINED3DFMT_FLAG_TEXTURE) && !once++)
            ERR_(winediag)("The application tried to create a DXTn texture, but the driver does not support them.\n");

        WARN("Failed to initialize resource, returning %#x\n", hr);
        return hr;
    }
    wined3d_resource_update_draw_binding(&texture->resource);

    texture->texture_ops = texture_ops;
    texture->sub_resources = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
            level_count * layer_count * sizeof(*texture->sub_resources));
    if (!texture->sub_resources)
    {
        ERR("Failed to allocate sub-resource array.\n");
        resource_cleanup(&texture->resource);
        return E_OUTOFMEMORY;
    }

    texture->layer_count = layer_count;
    texture->level_count = level_count;
    texture->filter_type = (desc->usage & WINED3DUSAGE_AUTOGENMIPMAP) ? WINED3D_TEXF_LINEAR : WINED3D_TEXF_NONE;
    texture->lod = 0;
    texture->flags = WINED3D_TEXTURE_POW2_MAT_IDENT;

    if (texture->resource.format->flags & WINED3DFMT_FLAG_FILTERING)
    {
        texture->min_mip_lookup = minMipLookup;
        texture->mag_lookup = magLookup;
    }
    else
    {
        texture->min_mip_lookup = minMipLookup_noFilter;
        texture->mag_lookup = magLookup_noFilter;
    }

    return WINED3D_OK;
}
예제 #21
0
파일: master.c 프로젝트: getmoon/vmsync
int main(int argc , char ** argv)
{
	int				ret;
	int				i;
	struct config_instance_t *	inst;
	char				dir_name[128];
	
	if( 	argc != 7 ||
		str_unequal(argv[1] , "-p") ||
		file_unexist(argv[2]) ||
		str_unequal(argv[3] , "-t") ||
		isnotnumber(argv[4])  ||
		str_unequal(argv[5] , "-c") 
	){
		usage();
		exit(0);
	}

	resource_init();

	sprintf(sync_work_dir , "%s" , argv[2]);
	sync_period = atoi(argv[4]);
	sprintf(config_file , "%s" , argv[6]);

	memset(dir_name, 0, 128);
	sprintf(dir_name, "%s/lock/", sync_work_dir);
	if (access(dir_name, F_OK)){
	        ret = mkdir(dir_name, 0777);
	        if (ret < 0){
	                print_error("Create directory %s error" , dir_name);
	                return ret;
	        }
	}
	
	memset(dir_name, 0, 128);
	sprintf(dir_name, "%s/send/", sync_work_dir);
	if (access(dir_name, F_OK)){
	        ret = mkdir(dir_name, 0777);
	        if (ret < 0){
	                print_error("Create directory %s error" , dir_name);
	                return ret;
	        }
	}


	ret = config_init(config_file);
	if(ret < 0){
		print_error("config file init fail\n");
		exit(0);
	}

	for(i = 0 ; i < INSTANCE_MAX_CNT ; i++){
		inst = instance_base + i;	
		if(inst->use == 0)
			continue;
		
		instance_init(inst);	
	}

	while(1){
		sleep(3600);
	}

	return(0);
}
예제 #22
0
void test5(void)
{
    unsigned int n, i, j;
    char s1[1024], s2[1024];
    manager man;
    launcher launch;
    resource res;
    bigbool bbool;
    manager_init(&man);
    launcher_init(&launch, "");

    fputs("manager inithialization\nsize=", stdout);
    fscanf(stdin, "%o", &n);
    fgetc(stdin);

    for(i=0; i<n; i++)
    {
	fgets(s1, 1024, stdin);
	s1[strlen(s1)-1] = '\0';
	
	fgets(s2, 1024, stdin);
	s2[strlen(s2)-1] = '\0';

	resource_init(&res, s1, s2);	
	
	manager_add(&man, &res);
	resource_delete(&res);
    }


    fputs("launcher inithialization\nsize=", stdout);
    fscanf(stdin, "%o", &n);
    fgetc(stdin);

    for(i=0; i<n; i++)
    {
	bigbool_init(&bbool);
	fgets(s1, 1024, stdin);
	s1[strlen(s1)-1] = '\0';

	fgets(s2, 1024, stdin);
	s2[strlen(s2)-1] = '\0';

	bigbool_create_str(&bbool, s2);
	launcher_add_resource(&launch, s1, &bbool);
	bigbool_delete(&bbool);
    }

    fputs("start settings\n", stdout);

    launcher_setting_from_manager(&launch, &man);

    fputs("end settings\n", stdout);

    for(i=0; i<launch.size; i++)
    {
	fprintf(stdout, "%s ", launch.res_names[i]);
	for(j=0; j<launch.res_bools[i] -> size_bit; j++)
	    fprintf(stdout, "%d", bigbool_get(launch.res_bools[i], j));
	fprintf(stdout, "\n");
    }
}
예제 #23
0
void __init setup_arch(char **cmdline_p)
{
	extern void atlas_setup(void);
	extern void decstation_setup(void);
	extern void ip22_setup(void);
	extern void ip27_setup(void);
	extern void malta_setup(void);
	extern void momenco_ocelot_setup(void);
	extern void momenco_ocelot_g_setup(void);
	extern void momenco_ocelot_c_setup(void);
	extern void momenco_jaguar_atx_setup(void);
	extern void sead_setup(void);
	extern void swarm_setup(void);
	extern void frame_info_init(void);

	frame_info_init();
#ifdef CONFIG_MIPS_ATLAS
	atlas_setup();
#endif
#ifdef CONFIG_DECSTATION
	decstation_setup();
#endif
#ifdef  CONFIG_PMC_YOSEMITE
	pmc_yosemite_setup();
#endif
#ifdef CONFIG_SGI_IP22
	ip22_setup();
#endif
#ifdef CONFIG_SGI_IP27
	ip27_setup();
#endif
#ifdef CONFIG_SIBYTE_BOARD
	swarm_setup();
#endif
#ifdef CONFIG_MIPS_MALTA
	malta_setup();
#endif
#ifdef CONFIG_MIPS_SEAD
	sead_setup();
#endif
#ifdef CONFIG_MOMENCO_OCELOT
	momenco_ocelot_setup();
#endif
#ifdef CONFIG_MOMENCO_OCELOT_G
	momenco_ocelot_g_setup();
#endif
#ifdef CONFIG_MOMENCO_OCELOT_C
	momenco_ocelot_c_setup();
#endif
#ifdef CONFIG_MOMENCO_JAGUAR_ATX
	momenco_jaguar_atx_setup();
#endif

	strncpy(command_line, arcs_cmdline, CL_SIZE);
	memcpy(saved_command_line, command_line, CL_SIZE);
	saved_command_line[CL_SIZE-1] = '\0';

	*cmdline_p = command_line;

	parse_mem_cmdline();

	bootmem_init();

	paging_init();

	resource_init();
}
예제 #24
0
void golgotha_app::init()
{
	sw32 i;


	for (i=0; i<(int)argc; i++)
	{
		if (argv[i] == "-max_memory")
		{
			i++;
			i4_const_str::iterator p(argv[i].begin());
			_max_memory = (w32)p.read_number();
		}
	}
	char buf[300];
#ifdef _WINDOWS
	LoadString(i4_win32_instance,IDS_INITIALISATION,buf,300);
#else
	printf("Starting initialisation sequence\n");
	strcpy(buf,"Initialisation, please wait...");
#endif
	i4_status_class * status=i4_create_status(buf,0);
	status->update(0.01f);

	r1_truncate_texture_file();
	i4_file_class * inittest=i4_open("resource.res",I4_READ|I4_NO_BUFFER);
	if (!inittest)
	{
		//i4_error("_FATAL: resource.res not found in the current directory. "
		//	  "Check that the current directory is the directory the exe-file "
		//	  "resides in.");
#ifdef _WINDOWS
		MessageBox(0,"FATAL: resource.res not found in the current directory. "
					 "Check that the current directory is the directory the exe-file "
					 "resides in.","Golgotha: Wrong startup directory",0);
#else
		printf("FATAL: resource.res not found in the current directory. \n"
			   "Check that the current directory is the directory the executable file \n"
			   "resides in.");
#endif
		exit(89);
	}
	delete inittest;
	memory_init(); //calls init__init::i4_init() to init all i4_init_classes
	status->update(0.1f);

	i4_endianesstest end;
	end.anint=0x0ff;
#pragma warning (disable:4127) // Conditional expression is constant
	if (end.chars[0]==0xff)
	{
		i4_warning("Detected architecture is little endian.");
		if (i4_litend!=1)
		{
			i4_error("FATAL: Golgotha was compiled for a big-endian system. "
					 "Please rebuild Golgotha with the correct endianness setting in arch.h");
			exit(92);
		}
	}
	else
	{
		i4_warning("Detected architecture is big endian.");
		if (i4_litend!=0)
		{
			i4_error("FATAL: Golgotha was compiled for a little-endian system. "
					 "Please rebuild Golgotha with the correct endianness setting in arch.h");
			exit(92);
		}
	}
#pragma warning(1:4127)

	i4_warning("Loading resource Manager...");
	resource_init("resource.res",0);
	strcpy(first_level, "test.level"); //Hardcoded first level
	li_add_function("set_default_level", g1_set_default_level);
	i4_warning("Executing scheme/start.scm");
	li_load("scheme/start.scm");
	i4_mkdir("savegame"); //create the savegame directory if it doesn't exist
#ifdef _WINDOWS
	CheckDXVersion();
#endif
	status->update(0.2f);
	display_init();


	status->update(0.23f);
	printf("Display initialisation ok.\n");
	i4_image_class * im=i4_load_image("bitmaps/comic1.jpg");
	printf("If this line is drawn, the jpg loader is ok.\n");

	status->update(0.25f);
#ifdef _WINDOWS
	cwnd.Attach(current_window_handle);

	g1_sound_man.poll(i4_T);           // update sound effects (play next narative sfx)
	do_poll_sound_man=i4_T;
	i4_add_thread((i4_thread_func_type)Thread_Sound_Man_Poller,1000,NULL);
	g1_sound_man.loop_current_song=i4_T;
#else
//All sound is currently disabled under linux and the thread synchronization
//code isn't complete either
	do_poll_sound_man=i4_F;
	g1_sound_man.loop_current_song=i4_F;
#endif
	//wm is the window-manager
	wm->set_background_color(0);


	if (im) //Im is the Cartoon image
	{
		loading_window=new i4_image_window_class(im, i4_T, i4_F);
		wm->add_child(wm->width()/2-loading_window->width()/2,
					  wm->height()/2-loading_window->height()/2,
					  loading_window.get());
	}
	refresh();   // show something right away

	status->update(0.3f);
	char * font_fname=li_get_string(li_get_value("font"),0);
	i4_image_class * fim=i4_load_image(font_fname);
	if (!fim)
	{
		i4_error("image load failed : %s", font_fname);
	}
	i4_current_app->get_style()->font_hint->normal_font=new i4_anti_proportional_font_class(fim);
	delete fim;
	status->update(0.4f);



	choice_first_level();
	//Attempt to initialize a rendering api suitable for the current display.
	g1_render.r_api = r1_create_api(display);
	i4_warning("Render api created successfully: %s.",g1_render.r_api->name());
	refresh();
	status->update(0.5f);
	//init the renderer!

	if (!g1_render.r_api)
	{
		/*
		   MessageBox(NULL,"Could not initialize a rendering device. \n"
		   "Possible Causes:\n-You tried to run the game in a window "
		   "with your desktop color depth not equal to 16Bit.\n"
		   "-There's not enough video memory available for this mode.\n"
		   "-Your DirectX installation is invalid.\n"
		   "-Well, err...","DirectX initialisation failed",
		   MB_OK+MB_ICONSTOP+MB_APPLMODAL);*/
#ifdef _WINDOWS
		char * s=(char *)malloc(1000);

		LoadString(AfxGetResourceHandle(),IDS_RENDERINITFAILED,s,999);
		MessageBox(NULL,s,"DirectX",MB_OK+MB_ICONSTOP+MB_APPLMODAL);
		free(s);
		FatalExit(99);
#else
		printf("FATAL ERROR: Initialisation of renderer failed. Quitting.\n");
		exit(99);
#endif

	}



	g1_input.init();

	g1_resources.load();
	li_load("scheme/preferences.scm");
	status->update(0.6f);
	i4_bool movie_time = i4_F;

	for (i=0; i<(int)argc; i++)
	{
		if (argv[i] == i4gets("movie_option"))
		{
			movie_time = i4_T;
		}
	}

	if (g1_render.r_api->get_render_device_flags() & R1_SOFTWARE)
	{
		//setup a timer and decide whether or not to do double pixel
		//default is high res mode
		int processor_speed = i4_get_clocks_per_second();

		g1_resources.render_window_expand_mode = R1_COPY_1x1;
		/*
		   if (processor_speed > 170000000)
		   	g1_resources.render_window_expand_mode = R1_COPY_1x1;
		   else
		   if (processor_speed > 140000000)
		   g1_resources.render_window_expand_mode = R1_COPY_1x1_SCANLINE_SKIP;
		   else
		   g1_resources.render_window_expand_mode = R1_COPY_2x2;

		   g1_resources.radius_mode = g1_resource_class::VIEW_LOW;
		 */

		if (movie_time)
		{
			g1_resources.radius_mode = g1_resource_class::VIEW_FAR;
		}

	}
	else
	{
		//hardware rasterizer, view distance = far by default
		g1_resources.radius_mode = g1_resource_class::VIEW_FAR;
	}

	s1_load();
	g1_load_images();

	status->update(0.7f);
	g1_player_man.init_colors(&display->get_screen()->get_pal()->source, g1_render.r_api);

	protocol=i4_get_first_protocol();

	i4_graphical_style_class * style=wm->get_style();


	/*
	   style->color_hint->button.active.bright=(135<<8)|64;
	   style->color_hint->button.active.medium=(114<<8)|49;
	   style->color_hint->button.active.dark=(88<<8)|38;

	   style->color_hint->button.passive.bright=(120<<8)|64;
	   style->color_hint->button.passive.medium=(100<<8)|49;
	   style->color_hint->button.passive.dark=(70<<8)|38;
	 */

	if (!g1_cwin_man)
	{
		g1_cwin_man=new g1_cwin_man_class;
	}
	status->update(0.8f);
	g1_cwin_man->init(wm, style, display->get_screen(), display, wm);
	if (m1_maxtool_man)
	{
		m1_maxtool_man->init(wm,style,display->get_screen(),display,wm);
	}
	li_add_function("Pause", g1_pause);
	li_add_function("ForcePause", g1_force_pause);
	li_add_function("is_paused",g1_is_paused);
	status->update(1.0f);

	hide_main_menu();
	main_menu=new g1_help_screen_class(wm->width(), wm->height(), wm->get_style(),
									   i4gets("startup_screen"), G1_PLOT_SCREEN);
	wm->add_child(0,0,main_menu);

	delete status;
	status=0;
	i4_kernel.request_events(this,
							 i4_device_class::FLAG_DO_COMMAND |
							 i4_device_class::FLAG_END_COMMAND|
							 i4_device_class::FLAG_DISPLAY_CHANGE);
	do_main_menu();

	if (start_in_editor)
	{
		g1_cwin_man->set_edit_mode(i4_T);
	}

	//start game with startup screens
	//if (!movie_time)
	//{
	//  help_screen("startup_screen", G1_START_HELP_SCREEN);
	//}
	//else
	//{
	//  start_new_game();
	//}

}
예제 #25
0
/* Must be called after clock framework is initialized */
int __init omap_pm_if_init(void)
{
	resource_init(resources_omap);
	return 0;
}