Beispiel #1
0
bool load_graphics_imports(struct gs_exports *exports, void *module,
		const char *module_name)
{
	bool success = true;

	GRAPHICS_IMPORT(device_preprocessor_name);
	GRAPHICS_IMPORT(device_create);
	GRAPHICS_IMPORT(device_destroy);
	GRAPHICS_IMPORT(device_entercontext);
	GRAPHICS_IMPORT(device_leavecontext);
	GRAPHICS_IMPORT(device_create_swapchain);
	GRAPHICS_IMPORT(device_resize);
	GRAPHICS_IMPORT(device_getsize);
	GRAPHICS_IMPORT(device_getwidth);
	GRAPHICS_IMPORT(device_getheight);
	GRAPHICS_IMPORT(device_create_texture);
	GRAPHICS_IMPORT(device_create_cubetexture);
	GRAPHICS_IMPORT(device_create_volumetexture);
	GRAPHICS_IMPORT(device_create_zstencil);
	GRAPHICS_IMPORT(device_create_stagesurface);
	GRAPHICS_IMPORT(device_create_samplerstate);
	GRAPHICS_IMPORT(device_create_vertexshader);
	GRAPHICS_IMPORT(device_create_pixelshader);
	GRAPHICS_IMPORT(device_create_vertexbuffer);
	GRAPHICS_IMPORT(device_create_indexbuffer);
	GRAPHICS_IMPORT(device_gettexturetype);
	GRAPHICS_IMPORT(device_load_vertexbuffer);
	GRAPHICS_IMPORT(device_load_indexbuffer);
	GRAPHICS_IMPORT(device_load_texture);
	GRAPHICS_IMPORT(device_load_samplerstate);
	GRAPHICS_IMPORT(device_load_vertexshader);
	GRAPHICS_IMPORT(device_load_pixelshader);
	GRAPHICS_IMPORT(device_load_defaultsamplerstate);
	GRAPHICS_IMPORT(device_getvertexshader);
	GRAPHICS_IMPORT(device_getpixelshader);
	GRAPHICS_IMPORT(device_getrendertarget);
	GRAPHICS_IMPORT(device_getzstenciltarget);
	GRAPHICS_IMPORT(device_setrendertarget);
	GRAPHICS_IMPORT(device_setcuberendertarget);
	GRAPHICS_IMPORT(device_copy_texture_region);
	GRAPHICS_IMPORT(device_copy_texture);
	GRAPHICS_IMPORT(device_stage_texture);
	GRAPHICS_IMPORT(device_beginscene);
	GRAPHICS_IMPORT(device_draw);
	GRAPHICS_IMPORT(device_load_swapchain);
	GRAPHICS_IMPORT(device_endscene);
	GRAPHICS_IMPORT(device_clear);
	GRAPHICS_IMPORT(device_present);
	GRAPHICS_IMPORT(device_setcullmode);
	GRAPHICS_IMPORT(device_getcullmode);
	GRAPHICS_IMPORT(device_enable_blending);
	GRAPHICS_IMPORT(device_enable_depthtest);
	GRAPHICS_IMPORT(device_enable_stenciltest);
	GRAPHICS_IMPORT(device_enable_stencilwrite);
	GRAPHICS_IMPORT(device_enable_color);
	GRAPHICS_IMPORT(device_blendfunction);
	GRAPHICS_IMPORT(device_depthfunction);
	GRAPHICS_IMPORT(device_stencilfunction);
	GRAPHICS_IMPORT(device_stencilop);
	GRAPHICS_IMPORT(device_enable_fullscreen);
	GRAPHICS_IMPORT(device_fullscreen_enabled);
	GRAPHICS_IMPORT(device_setdisplaymode);
	GRAPHICS_IMPORT(device_getdisplaymode);
	GRAPHICS_IMPORT(device_setcolorramp);
	GRAPHICS_IMPORT(device_setviewport);
	GRAPHICS_IMPORT(device_getviewport);
	GRAPHICS_IMPORT(device_setscissorrect);
	GRAPHICS_IMPORT(device_ortho);
	GRAPHICS_IMPORT(device_frustum);
	GRAPHICS_IMPORT(device_projection_push);
	GRAPHICS_IMPORT(device_projection_pop);

	GRAPHICS_IMPORT(swapchain_destroy);

	GRAPHICS_IMPORT(texture_destroy);
	GRAPHICS_IMPORT(texture_getwidth);
	GRAPHICS_IMPORT(texture_getheight);
	GRAPHICS_IMPORT(texture_getcolorformat);
	GRAPHICS_IMPORT(texture_map);
	GRAPHICS_IMPORT(texture_unmap);
	GRAPHICS_IMPORT_OPTIONAL(texture_isrect);
	GRAPHICS_IMPORT(texture_getobj);

	GRAPHICS_IMPORT(cubetexture_destroy);
	GRAPHICS_IMPORT(cubetexture_getsize);
	GRAPHICS_IMPORT(cubetexture_getcolorformat);

	GRAPHICS_IMPORT(volumetexture_destroy);
	GRAPHICS_IMPORT(volumetexture_getwidth);
	GRAPHICS_IMPORT(volumetexture_getheight);
	GRAPHICS_IMPORT(volumetexture_getdepth);
	GRAPHICS_IMPORT(volumetexture_getcolorformat);

	GRAPHICS_IMPORT(stagesurface_destroy);
	GRAPHICS_IMPORT(stagesurface_getwidth);
	GRAPHICS_IMPORT(stagesurface_getheight);
	GRAPHICS_IMPORT(stagesurface_getcolorformat);
	GRAPHICS_IMPORT(stagesurface_map);
	GRAPHICS_IMPORT(stagesurface_unmap);

	GRAPHICS_IMPORT(zstencil_destroy);

	GRAPHICS_IMPORT(samplerstate_destroy);

	GRAPHICS_IMPORT(vertexbuffer_destroy);
	GRAPHICS_IMPORT(vertexbuffer_flush);
	GRAPHICS_IMPORT(vertexbuffer_getdata);

	GRAPHICS_IMPORT(indexbuffer_destroy);
	GRAPHICS_IMPORT(indexbuffer_flush);
	GRAPHICS_IMPORT(indexbuffer_getdata);
	GRAPHICS_IMPORT(indexbuffer_numindices);
	GRAPHICS_IMPORT(indexbuffer_gettype);

	GRAPHICS_IMPORT(shader_destroy);
	GRAPHICS_IMPORT(shader_numparams);
	GRAPHICS_IMPORT(shader_getparambyidx);
	GRAPHICS_IMPORT(shader_getparambyname);
	GRAPHICS_IMPORT(shader_getparaminfo);
	GRAPHICS_IMPORT(shader_getviewprojmatrix);
	GRAPHICS_IMPORT(shader_getworldmatrix);
	GRAPHICS_IMPORT(shader_setbool);
	GRAPHICS_IMPORT(shader_setfloat);
	GRAPHICS_IMPORT(shader_setint);
	GRAPHICS_IMPORT(shader_setmatrix3);
	GRAPHICS_IMPORT(shader_setmatrix4);
	GRAPHICS_IMPORT(shader_setvec2);
	GRAPHICS_IMPORT(shader_setvec3);
	GRAPHICS_IMPORT(shader_setvec4);
	GRAPHICS_IMPORT(shader_settexture);
	GRAPHICS_IMPORT(shader_setval);
	GRAPHICS_IMPORT(shader_setdefault);

	/* OSX/Cocoa specific functions */
#ifdef __APPLE__
	GRAPHICS_IMPORT_OPTIONAL(texture_create_from_iosurface);
	GRAPHICS_IMPORT_OPTIONAL(texture_rebind_iosurface);

	/* win32 specific functions */
#elif _WIN32
	GRAPHICS_IMPORT(gdi_texture_available);
	GRAPHICS_IMPORT_OPTIONAL(device_create_gdi_texture);
	GRAPHICS_IMPORT_OPTIONAL(texture_get_dc);
	GRAPHICS_IMPORT_OPTIONAL(texture_release_dc);
#endif

	return success;
}
bool load_graphics_imports(struct gs_exports *exports, void *module,
		const char *module_name)
{
	bool success = true;

	GRAPHICS_IMPORT(device_get_name);
	GRAPHICS_IMPORT(device_get_type);
	GRAPHICS_IMPORT_OPTIONAL(device_enum_adapters);
	GRAPHICS_IMPORT(device_preprocessor_name);
	GRAPHICS_IMPORT(device_create);
	GRAPHICS_IMPORT(device_destroy);
	GRAPHICS_IMPORT(device_enter_context);
	GRAPHICS_IMPORT(device_leave_context);
	GRAPHICS_IMPORT(device_swapchain_create);
	GRAPHICS_IMPORT(device_resize);
	GRAPHICS_IMPORT(device_get_size);
	GRAPHICS_IMPORT(device_get_width);
	GRAPHICS_IMPORT(device_get_height);
	GRAPHICS_IMPORT(device_texture_create);
	GRAPHICS_IMPORT(device_cubetexture_create);
	GRAPHICS_IMPORT(device_voltexture_create);
	GRAPHICS_IMPORT(device_zstencil_create);
	GRAPHICS_IMPORT(device_stagesurface_create);
	GRAPHICS_IMPORT(device_samplerstate_create);
	GRAPHICS_IMPORT(device_vertexshader_create);
	GRAPHICS_IMPORT(device_pixelshader_create);
	GRAPHICS_IMPORT(device_vertexbuffer_create);
	GRAPHICS_IMPORT(device_indexbuffer_create);
	GRAPHICS_IMPORT(device_get_texture_type);
	GRAPHICS_IMPORT(device_load_vertexbuffer);
	GRAPHICS_IMPORT(device_load_indexbuffer);
	GRAPHICS_IMPORT(device_load_texture);
	GRAPHICS_IMPORT(device_load_samplerstate);
	GRAPHICS_IMPORT(device_load_vertexshader);
	GRAPHICS_IMPORT(device_load_pixelshader);
	GRAPHICS_IMPORT(device_load_default_samplerstate);
	GRAPHICS_IMPORT(device_get_vertex_shader);
	GRAPHICS_IMPORT(device_get_pixel_shader);
	GRAPHICS_IMPORT(device_get_render_target);
	GRAPHICS_IMPORT(device_get_zstencil_target);
	GRAPHICS_IMPORT(device_set_render_target);
	GRAPHICS_IMPORT(device_set_cube_render_target);
	GRAPHICS_IMPORT(device_copy_texture_region);
	GRAPHICS_IMPORT(device_copy_texture);
	GRAPHICS_IMPORT(device_stage_texture);
	GRAPHICS_IMPORT(device_begin_scene);
	GRAPHICS_IMPORT(device_draw);
	GRAPHICS_IMPORT(device_load_swapchain);
	GRAPHICS_IMPORT(device_end_scene);
	GRAPHICS_IMPORT(device_clear);
	GRAPHICS_IMPORT(device_present);
	GRAPHICS_IMPORT(device_flush);
	GRAPHICS_IMPORT(device_set_cull_mode);
	GRAPHICS_IMPORT(device_get_cull_mode);
	GRAPHICS_IMPORT(device_enable_blending);
	GRAPHICS_IMPORT(device_enable_depth_test);
	GRAPHICS_IMPORT(device_enable_stencil_test);
	GRAPHICS_IMPORT(device_enable_stencil_write);
	GRAPHICS_IMPORT(device_enable_color);
	GRAPHICS_IMPORT(device_blend_function);
	GRAPHICS_IMPORT(device_blend_function_separate);
	GRAPHICS_IMPORT(device_depth_function);
	GRAPHICS_IMPORT(device_stencil_function);
	GRAPHICS_IMPORT(device_stencil_op);
	GRAPHICS_IMPORT(device_set_viewport);
	GRAPHICS_IMPORT(device_get_viewport);
	GRAPHICS_IMPORT(device_set_scissor_rect);
	GRAPHICS_IMPORT(device_ortho);
	GRAPHICS_IMPORT(device_frustum);
	GRAPHICS_IMPORT(device_projection_push);
	GRAPHICS_IMPORT(device_projection_pop);

	GRAPHICS_IMPORT(gs_swapchain_destroy);

	GRAPHICS_IMPORT(gs_texture_destroy);
	GRAPHICS_IMPORT(gs_texture_get_width);
	GRAPHICS_IMPORT(gs_texture_get_height);
	GRAPHICS_IMPORT(gs_texture_get_color_format);
	GRAPHICS_IMPORT(gs_texture_map);
	GRAPHICS_IMPORT(gs_texture_unmap);
	GRAPHICS_IMPORT_OPTIONAL(gs_texture_is_rect);
	GRAPHICS_IMPORT(gs_texture_get_obj);

	GRAPHICS_IMPORT(gs_cubetexture_destroy);
	GRAPHICS_IMPORT(gs_cubetexture_get_size);
	GRAPHICS_IMPORT(gs_cubetexture_get_color_format);

	GRAPHICS_IMPORT(gs_voltexture_destroy);
	GRAPHICS_IMPORT(gs_voltexture_get_width);
	GRAPHICS_IMPORT(gs_voltexture_get_height);
	GRAPHICS_IMPORT(gs_voltexture_get_depth);
	GRAPHICS_IMPORT(gs_voltexture_get_color_format);

	GRAPHICS_IMPORT(gs_stagesurface_destroy);
	GRAPHICS_IMPORT(gs_stagesurface_get_width);
	GRAPHICS_IMPORT(gs_stagesurface_get_height);
	GRAPHICS_IMPORT(gs_stagesurface_get_color_format);
	GRAPHICS_IMPORT(gs_stagesurface_map);
	GRAPHICS_IMPORT(gs_stagesurface_unmap);

	GRAPHICS_IMPORT(gs_zstencil_destroy);

	GRAPHICS_IMPORT(gs_samplerstate_destroy);

	GRAPHICS_IMPORT(gs_vertexbuffer_destroy);
	GRAPHICS_IMPORT(gs_vertexbuffer_flush);
	GRAPHICS_IMPORT(gs_vertexbuffer_get_data);

	GRAPHICS_IMPORT(gs_indexbuffer_destroy);
	GRAPHICS_IMPORT(gs_indexbuffer_flush);
	GRAPHICS_IMPORT(gs_indexbuffer_get_data);
	GRAPHICS_IMPORT(gs_indexbuffer_get_num_indices);
	GRAPHICS_IMPORT(gs_indexbuffer_get_type);

	GRAPHICS_IMPORT(gs_shader_destroy);
	GRAPHICS_IMPORT(gs_shader_get_num_params);
	GRAPHICS_IMPORT(gs_shader_get_param_by_idx);
	GRAPHICS_IMPORT(gs_shader_get_param_by_name);
	GRAPHICS_IMPORT(gs_shader_get_viewproj_matrix);
	GRAPHICS_IMPORT(gs_shader_get_world_matrix);
	GRAPHICS_IMPORT(gs_shader_get_param_info);
	GRAPHICS_IMPORT(gs_shader_set_bool);
	GRAPHICS_IMPORT(gs_shader_set_float);
	GRAPHICS_IMPORT(gs_shader_set_int);
	GRAPHICS_IMPORT(gs_shader_set_matrix3);
	GRAPHICS_IMPORT(gs_shader_set_matrix4);
	GRAPHICS_IMPORT(gs_shader_set_vec2);
	GRAPHICS_IMPORT(gs_shader_set_vec3);
	GRAPHICS_IMPORT(gs_shader_set_vec4);
	GRAPHICS_IMPORT(gs_shader_set_texture);
	GRAPHICS_IMPORT(gs_shader_set_val);
	GRAPHICS_IMPORT(gs_shader_set_default);

	/* OSX/Cocoa specific functions */
#ifdef __APPLE__
	GRAPHICS_IMPORT_OPTIONAL(device_texture_create_from_iosurface);
	GRAPHICS_IMPORT_OPTIONAL(gs_texture_rebind_iosurface);

	/* win32 specific functions */
#elif _WIN32
	GRAPHICS_IMPORT(device_gdi_texture_available);
	GRAPHICS_IMPORT(device_shared_texture_available);
	GRAPHICS_IMPORT_OPTIONAL(device_get_duplicator_monitor_info);
	GRAPHICS_IMPORT_OPTIONAL(device_duplicator_create);
	GRAPHICS_IMPORT_OPTIONAL(gs_duplicator_destroy);
	GRAPHICS_IMPORT_OPTIONAL(gs_duplicator_update_frame);
	GRAPHICS_IMPORT_OPTIONAL(gs_duplicator_get_texture);
	GRAPHICS_IMPORT_OPTIONAL(device_texture_create_gdi);
	GRAPHICS_IMPORT_OPTIONAL(gs_texture_get_dc);
	GRAPHICS_IMPORT_OPTIONAL(gs_texture_release_dc);
	GRAPHICS_IMPORT_OPTIONAL(device_texture_open_shared);
#endif

	return success;
}