2013-09-30 19:37:13 -07:00
|
|
|
/******************************************************************************
|
2014-03-29 17:19:31 -07:00
|
|
|
Copyright (C) 2013-2014 by Hugh Bailey <obs.jim@gmail.com>
|
2013-09-30 19:37:13 -07:00
|
|
|
|
|
|
|
This program is free software: you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
2013-12-02 21:24:38 -08:00
|
|
|
the Free Software Foundation, either version 2 of the License, or
|
2013-09-30 19:37:13 -07:00
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
******************************************************************************/
|
|
|
|
|
2013-10-14 04:21:15 -07:00
|
|
|
#pragma once
|
2013-09-30 19:37:13 -07:00
|
|
|
|
2013-11-26 22:07:27 -08:00
|
|
|
#include <util/c99defs.h>
|
2013-09-30 19:37:13 -07:00
|
|
|
|
2014-04-07 01:31:13 -07:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2014-08-07 23:42:07 -07:00
|
|
|
EXPORT const char *device_get_name(void);
|
|
|
|
EXPORT int device_get_type(void);
|
2014-02-16 18:28:21 -08:00
|
|
|
EXPORT const char *device_preprocessor_name(void);
|
2014-09-26 15:25:59 -07:00
|
|
|
EXPORT int device_create(gs_device_t **device, const struct gs_init_data *data);
|
2014-09-25 17:44:05 -07:00
|
|
|
EXPORT void device_destroy(gs_device_t *device);
|
|
|
|
EXPORT void device_enter_context(gs_device_t *device);
|
|
|
|
EXPORT void device_leave_context(gs_device_t *device);
|
|
|
|
EXPORT gs_swapchain_t *device_swapchain_create(gs_device_t *device,
|
2014-09-26 15:25:59 -07:00
|
|
|
const struct gs_init_data *data);
|
2014-09-25 17:44:05 -07:00
|
|
|
EXPORT void device_resize(gs_device_t *device, uint32_t x, uint32_t y);
|
2014-09-26 15:25:59 -07:00
|
|
|
EXPORT void device_get_size(const gs_device_t *device, uint32_t *x, uint32_t *y);
|
|
|
|
EXPORT uint32_t device_get_width(const gs_device_t *device);
|
|
|
|
EXPORT uint32_t device_get_height(const gs_device_t *device);
|
2014-09-25 17:44:05 -07:00
|
|
|
EXPORT gs_texture_t *device_texture_create(gs_device_t *device, uint32_t width,
|
2013-10-04 08:55:33 -07:00
|
|
|
uint32_t height, enum gs_color_format color_format,
|
2014-06-27 21:29:06 -07:00
|
|
|
uint32_t levels, const uint8_t **data, uint32_t flags);
|
2014-09-25 17:44:05 -07:00
|
|
|
EXPORT gs_texture_t *device_cubetexture_create(gs_device_t *device,
|
|
|
|
uint32_t size, enum gs_color_format color_format,
|
|
|
|
uint32_t levels, const uint8_t **data, uint32_t flags);
|
|
|
|
EXPORT gs_texture_t *device_voltexture_create(gs_device_t *device,
|
|
|
|
uint32_t width, uint32_t height, uint32_t depth,
|
2013-10-16 23:31:18 -07:00
|
|
|
enum gs_color_format color_format, uint32_t levels,
|
2014-06-27 21:29:06 -07:00
|
|
|
const uint8_t **data, uint32_t flags);
|
2014-09-25 17:44:05 -07:00
|
|
|
EXPORT gs_zstencil_t *device_zstencil_create(gs_device_t *device,
|
|
|
|
uint32_t width, uint32_t height,
|
|
|
|
enum gs_zstencil_format format);
|
|
|
|
EXPORT gs_stagesurf_t *device_stagesurface_create(gs_device_t *device,
|
2014-08-07 23:42:07 -07:00
|
|
|
uint32_t width, uint32_t height,
|
|
|
|
enum gs_color_format color_format);
|
2014-09-25 17:44:05 -07:00
|
|
|
EXPORT gs_samplerstate_t *device_samplerstate_create(gs_device_t *device,
|
2014-09-26 15:25:59 -07:00
|
|
|
const struct gs_sampler_info *info);
|
2014-09-25 17:44:05 -07:00
|
|
|
EXPORT gs_shader_t *device_vertexshader_create(gs_device_t *device,
|
2013-09-30 19:37:13 -07:00
|
|
|
const char *shader, const char *file,
|
|
|
|
char **error_string);
|
2014-09-25 17:44:05 -07:00
|
|
|
EXPORT gs_shader_t *device_pixelshader_create(gs_device_t *device,
|
2013-09-30 19:37:13 -07:00
|
|
|
const char *shader, const char *file,
|
|
|
|
char **error_string);
|
2014-09-25 17:44:05 -07:00
|
|
|
EXPORT gs_vertbuffer_t *device_vertexbuffer_create(gs_device_t *device,
|
2014-08-07 23:42:07 -07:00
|
|
|
struct gs_vb_data *data, uint32_t flags);
|
2014-09-25 17:44:05 -07:00
|
|
|
EXPORT gs_indexbuffer_t *device_indexbuffer_create(gs_device_t *device,
|
2013-09-30 19:37:13 -07:00
|
|
|
enum gs_index_type type, void *indices, size_t num,
|
|
|
|
uint32_t flags);
|
2014-09-26 15:25:59 -07:00
|
|
|
EXPORT enum gs_texture_type device_get_texture_type(
|
|
|
|
const gs_texture_t *texture);
|
2014-09-25 17:44:05 -07:00
|
|
|
EXPORT void device_load_vertexbuffer(gs_device_t *device,
|
|
|
|
gs_vertbuffer_t *vertbuffer);
|
|
|
|
EXPORT void device_load_indexbuffer(gs_device_t *device,
|
|
|
|
gs_indexbuffer_t *indexbuffer);
|
|
|
|
EXPORT void device_load_texture(gs_device_t *device, gs_texture_t *tex,
|
|
|
|
int unit);
|
|
|
|
EXPORT void device_load_samplerstate(gs_device_t *device,
|
|
|
|
gs_samplerstate_t *samplerstate, int unit);
|
|
|
|
EXPORT void device_load_vertexshader(gs_device_t *device,
|
|
|
|
gs_shader_t *vertshader);
|
|
|
|
EXPORT void device_load_pixelshader(gs_device_t *device,
|
|
|
|
gs_shader_t *pixelshader);
|
|
|
|
EXPORT void device_load_default_samplerstate(gs_device_t *device, bool b_3d,
|
2013-09-30 19:37:13 -07:00
|
|
|
int unit);
|
2014-09-26 15:25:59 -07:00
|
|
|
EXPORT gs_shader_t *device_get_vertex_shader(const gs_device_t *device);
|
|
|
|
EXPORT gs_shader_t *device_get_pixel_shader(const gs_device_t *device);
|
|
|
|
EXPORT gs_texture_t *device_get_render_target(const gs_device_t *device);
|
|
|
|
EXPORT gs_zstencil_t *device_get_zstencil_target(const gs_device_t *device);
|
2014-09-25 17:44:05 -07:00
|
|
|
EXPORT void device_set_render_target(gs_device_t *device, gs_texture_t *tex,
|
|
|
|
gs_zstencil_t *zstencil);
|
|
|
|
EXPORT void device_set_cube_render_target(gs_device_t *device,
|
|
|
|
gs_texture_t *cubetex,
|
|
|
|
int side, gs_zstencil_t *zstencil);
|
|
|
|
EXPORT void device_copy_texture(gs_device_t *device, gs_texture_t *dst,
|
|
|
|
gs_texture_t *src);
|
|
|
|
EXPORT void device_copy_texture_region(gs_device_t *device,
|
|
|
|
gs_texture_t *dst, uint32_t dst_x, uint32_t dst_y,
|
|
|
|
gs_texture_t *src, uint32_t src_x, uint32_t src_y,
|
2014-06-25 18:45:27 -07:00
|
|
|
uint32_t src_w, uint32_t src_h);
|
2014-09-25 17:44:05 -07:00
|
|
|
EXPORT void device_stage_texture(gs_device_t *device, gs_stagesurf_t *dst,
|
|
|
|
gs_texture_t *src);
|
|
|
|
EXPORT void device_begin_scene(gs_device_t *device);
|
|
|
|
EXPORT void device_draw(gs_device_t *device, enum gs_draw_mode draw_mode,
|
2013-09-30 19:37:13 -07:00
|
|
|
uint32_t start_vert, uint32_t num_verts);
|
2014-09-25 17:44:05 -07:00
|
|
|
EXPORT void device_end_scene(gs_device_t *device);
|
|
|
|
EXPORT void device_load_swapchain(gs_device_t *device,
|
|
|
|
gs_swapchain_t *swapchain);
|
|
|
|
EXPORT void device_clear(gs_device_t *device, uint32_t clear_flags,
|
2014-09-26 15:25:59 -07:00
|
|
|
const struct vec4 *color, float depth, uint8_t stencil);
|
2014-09-25 17:44:05 -07:00
|
|
|
EXPORT void device_present(gs_device_t *device);
|
|
|
|
EXPORT void device_flush(gs_device_t *device);
|
|
|
|
EXPORT void device_set_cull_mode(gs_device_t *device, enum gs_cull_mode mode);
|
2014-09-26 15:25:59 -07:00
|
|
|
EXPORT enum gs_cull_mode device_get_cull_mode(const gs_device_t *device);
|
2014-09-25 17:44:05 -07:00
|
|
|
EXPORT void device_enable_blending(gs_device_t *device, bool enable);
|
|
|
|
EXPORT void device_enable_depth_test(gs_device_t *device, bool enable);
|
|
|
|
EXPORT void device_enable_stencil_test(gs_device_t *device, bool enable);
|
|
|
|
EXPORT void device_enable_stencil_write(gs_device_t *device, bool enable);
|
|
|
|
EXPORT void device_enable_color(gs_device_t *device, bool red, bool green,
|
2013-10-12 20:18:05 -07:00
|
|
|
bool blue, bool alpha);
|
2014-09-25 17:44:05 -07:00
|
|
|
EXPORT void device_blend_function(gs_device_t *device, enum gs_blend_type src,
|
2013-09-30 19:37:13 -07:00
|
|
|
enum gs_blend_type dest);
|
2014-09-25 17:44:05 -07:00
|
|
|
EXPORT void device_depth_function(gs_device_t *device, enum gs_depth_test test);
|
|
|
|
EXPORT void device_stencil_function(gs_device_t *device,
|
2014-08-07 23:42:07 -07:00
|
|
|
enum gs_stencil_side side, enum gs_depth_test test);
|
2014-09-25 17:44:05 -07:00
|
|
|
EXPORT void device_stencil_op(gs_device_t *device, enum gs_stencil_side side,
|
2014-08-07 23:42:07 -07:00
|
|
|
enum gs_stencil_op_type fail, enum gs_stencil_op_type zfail,
|
|
|
|
enum gs_stencil_op_type zpass);
|
2014-09-25 17:44:05 -07:00
|
|
|
EXPORT void device_set_viewport(gs_device_t *device, int x, int y, int width,
|
2013-09-30 19:37:13 -07:00
|
|
|
int height);
|
2014-09-26 15:25:59 -07:00
|
|
|
EXPORT void device_get_viewport(const gs_device_t *device,
|
|
|
|
struct gs_rect *rect);
|
|
|
|
EXPORT void device_set_scissor_rect(gs_device_t *device,
|
|
|
|
const struct gs_rect *rect);
|
2014-09-25 17:44:05 -07:00
|
|
|
EXPORT void device_ortho(gs_device_t *device, float left, float right,
|
2013-09-30 19:37:13 -07:00
|
|
|
float top, float bottom, float znear, float zfar);
|
2014-09-25 17:44:05 -07:00
|
|
|
EXPORT void device_frustum(gs_device_t *device, float left, float right,
|
2013-09-30 19:37:13 -07:00
|
|
|
float top, float bottom, float znear, float zfar);
|
2014-09-25 17:44:05 -07:00
|
|
|
EXPORT void device_projection_push(gs_device_t *device);
|
|
|
|
EXPORT void device_projection_pop(gs_device_t *device);
|
2014-04-07 01:31:13 -07:00
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|