2013-09-30 19:37:13 -07:00
|
|
|
/******************************************************************************
|
|
|
|
Copyright (C) 2013 by Hugh Bailey <obs.jim@gmail.com>
|
|
|
|
|
|
|
|
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-10-14 12:37:52 -07:00
|
|
|
#include "../util/threading.h"
|
2013-09-30 19:37:13 -07:00
|
|
|
#include "../util/darray.h"
|
|
|
|
#include "graphics.h"
|
|
|
|
#include "matrix3.h"
|
|
|
|
#include "matrix4.h"
|
|
|
|
|
|
|
|
struct gs_exports {
|
2014-08-07 23:42:07 -07:00
|
|
|
const char *(*device_get_name)(void);
|
|
|
|
int (*device_get_type)(void);
|
2015-01-14 21:08:33 -08:00
|
|
|
bool (*device_enum_adapters)(
|
|
|
|
bool (*callback)(void*, const char*, uint32_t),
|
|
|
|
void*);
|
2014-02-16 18:28:21 -08:00
|
|
|
const char *(*device_preprocessor_name)(void);
|
2014-09-26 15:25:59 -07:00
|
|
|
int (*device_create)(gs_device_t **device,
|
|
|
|
const struct gs_init_data *data);
|
2014-09-25 17:44:05 -07:00
|
|
|
void (*device_destroy)(gs_device_t *device);
|
|
|
|
void (*device_enter_context)(gs_device_t *device);
|
|
|
|
void (*device_leave_context)(gs_device_t *device);
|
|
|
|
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
|
|
|
void (*device_resize)(gs_device_t *device, uint32_t x, uint32_t y);
|
2014-09-26 15:25:59 -07:00
|
|
|
void (*device_get_size)(const gs_device_t *device,
|
|
|
|
uint32_t *x, uint32_t *y);
|
|
|
|
uint32_t (*device_get_width)(const gs_device_t *device);
|
|
|
|
uint32_t (*device_get_height)(const gs_device_t *device);
|
2014-09-25 17:44:05 -07:00
|
|
|
gs_texture_t *(*device_texture_create)(gs_device_t *device,
|
2014-08-07 23:42:07 -07:00
|
|
|
uint32_t width, uint32_t height,
|
2013-10-04 08:55:33 -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
|
|
|
gs_texture_t *(*device_cubetexture_create)(gs_device_t *device,
|
2014-08-07 23:42:07 -07:00
|
|
|
uint32_t size, enum gs_color_format color_format,
|
|
|
|
uint32_t levels, const uint8_t **data, uint32_t flags);
|
2014-09-25 17:44:05 -07:00
|
|
|
gs_texture_t *(*device_voltexture_create)(gs_device_t *device,
|
2013-09-30 19:37:13 -07:00
|
|
|
uint32_t width, uint32_t height, uint32_t depth,
|
2013-10-04 08:55:33 -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
|
|
|
gs_zstencil_t *(*device_zstencil_create)(gs_device_t *device,
|
2013-09-30 19:37:13 -07:00
|
|
|
uint32_t width, uint32_t height,
|
|
|
|
enum gs_zstencil_format format);
|
2014-09-25 17:44:05 -07:00
|
|
|
gs_stagesurf_t *(*device_stagesurface_create)(gs_device_t *device,
|
2013-09-30 19:37:13 -07:00
|
|
|
uint32_t width, uint32_t height,
|
|
|
|
enum gs_color_format color_format);
|
2014-09-25 17:44:05 -07:00
|
|
|
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
|
|
|
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
|
|
|
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
|
|
|
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
|
|
|
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
|
|
|
enum gs_texture_type (*device_get_texture_type)(
|
|
|
|
const gs_texture_t *texture);
|
2014-09-25 17:44:05 -07:00
|
|
|
void (*device_load_vertexbuffer)(gs_device_t *device,
|
|
|
|
gs_vertbuffer_t *vertbuffer);
|
|
|
|
void (*device_load_indexbuffer)(gs_device_t *device,
|
|
|
|
gs_indexbuffer_t *indexbuffer);
|
|
|
|
void (*device_load_texture)(gs_device_t *device, gs_texture_t *tex,
|
2013-09-30 19:37:13 -07:00
|
|
|
int unit);
|
2014-09-25 17:44:05 -07:00
|
|
|
void (*device_load_samplerstate)(gs_device_t *device,
|
|
|
|
gs_samplerstate_t *samplerstate, int unit);
|
|
|
|
void (*device_load_vertexshader)(gs_device_t *device,
|
|
|
|
gs_shader_t *vertshader);
|
|
|
|
void (*device_load_pixelshader)(gs_device_t *device,
|
|
|
|
gs_shader_t *pixelshader);
|
|
|
|
void (*device_load_default_samplerstate)(gs_device_t *device,
|
2014-08-07 23:42:07 -07:00
|
|
|
bool b_3d, int unit);
|
2014-09-26 15:25:59 -07:00
|
|
|
gs_shader_t *(*device_get_vertex_shader)(const gs_device_t *device);
|
|
|
|
gs_shader_t *(*device_get_pixel_shader)(const gs_device_t *device);
|
|
|
|
gs_texture_t *(*device_get_render_target)(const gs_device_t *device);
|
|
|
|
gs_zstencil_t *(*device_get_zstencil_target)(const gs_device_t *device);
|
2014-09-25 17:44:05 -07:00
|
|
|
void (*device_set_render_target)(gs_device_t *device, gs_texture_t *tex,
|
|
|
|
gs_zstencil_t *zstencil);
|
|
|
|
void (*device_set_cube_render_target)(gs_device_t *device,
|
|
|
|
gs_texture_t *cubetex, int side, gs_zstencil_t *zstencil);
|
|
|
|
void (*device_copy_texture)(gs_device_t *device, gs_texture_t *dst,
|
|
|
|
gs_texture_t *src);
|
|
|
|
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-04-09 11:04:58 -07:00
|
|
|
uint32_t src_w, uint32_t src_h);
|
2014-09-25 17:44:05 -07:00
|
|
|
void (*device_stage_texture)(gs_device_t *device, gs_stagesurf_t *dst,
|
|
|
|
gs_texture_t *src);
|
|
|
|
void (*device_begin_scene)(gs_device_t *device);
|
|
|
|
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
|
|
|
void (*device_end_scene)(gs_device_t *device);
|
|
|
|
void (*device_load_swapchain)(gs_device_t *device,
|
|
|
|
gs_swapchain_t *swaphchain);
|
|
|
|
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
|
|
|
void (*device_present)(gs_device_t *device);
|
|
|
|
void (*device_flush)(gs_device_t *device);
|
|
|
|
void (*device_set_cull_mode)(gs_device_t *device,
|
2014-08-07 23:42:07 -07:00
|
|
|
enum gs_cull_mode mode);
|
2014-09-26 15:25:59 -07:00
|
|
|
enum gs_cull_mode (*device_get_cull_mode)(const gs_device_t *device);
|
2014-09-25 17:44:05 -07:00
|
|
|
void (*device_enable_blending)(gs_device_t *device, bool enable);
|
|
|
|
void (*device_enable_depth_test)(gs_device_t *device, bool enable);
|
|
|
|
void (*device_enable_stencil_test)(gs_device_t *device, bool enable);
|
|
|
|
void (*device_enable_stencil_write)(gs_device_t *device, bool enable);
|
|
|
|
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
|
|
|
void (*device_blend_function)(gs_device_t *device,
|
2014-08-07 23:42:07 -07:00
|
|
|
enum gs_blend_type src, enum gs_blend_type dest);
|
2015-03-27 11:18:02 -07:00
|
|
|
void (*device_blend_function_separate)(gs_device_t *device,
|
|
|
|
enum gs_blend_type src_c, enum gs_blend_type dest_c,
|
|
|
|
enum gs_blend_type src_a, enum gs_blend_type dest_a);
|
2014-09-25 17:44:05 -07:00
|
|
|
void (*device_depth_function)(gs_device_t *device,
|
2014-08-07 23:42:07 -07:00
|
|
|
enum gs_depth_test test);
|
2014-09-25 17:44:05 -07:00
|
|
|
void (*device_stencil_function)(gs_device_t *device,
|
2013-09-30 19:37:13 -07:00
|
|
|
enum gs_stencil_side side, enum gs_depth_test test);
|
2014-09-25 17:44:05 -07:00
|
|
|
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
|
|
|
void (*device_set_viewport)(gs_device_t *device, int x, int y,
|
|
|
|
int width, int height);
|
2014-09-26 15:25:59 -07:00
|
|
|
void (*device_get_viewport)(const gs_device_t *device,
|
2014-08-07 23:42:07 -07:00
|
|
|
struct gs_rect *rect);
|
2014-09-26 15:25:59 -07:00
|
|
|
void (*device_set_scissor_rect)(gs_device_t *device,
|
|
|
|
const struct gs_rect *rect);
|
2014-09-25 17:44:05 -07:00
|
|
|
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
|
|
|
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
|
|
|
void (*device_projection_push)(gs_device_t *device);
|
|
|
|
void (*device_projection_pop)(gs_device_t *device);
|
2013-09-30 19:37:13 -07:00
|
|
|
|
2014-09-25 17:44:05 -07:00
|
|
|
void (*gs_swapchain_destroy)(gs_swapchain_t *swapchain);
|
2013-09-30 19:37:13 -07:00
|
|
|
|
2014-09-25 17:44:05 -07:00
|
|
|
void (*gs_texture_destroy)(gs_texture_t *tex);
|
2014-09-26 15:25:59 -07:00
|
|
|
uint32_t (*gs_texture_get_width)(const gs_texture_t *tex);
|
|
|
|
uint32_t (*gs_texture_get_height)(const gs_texture_t *tex);
|
|
|
|
enum gs_color_format (*gs_texture_get_color_format)(
|
|
|
|
const gs_texture_t *tex);
|
2014-09-25 17:44:05 -07:00
|
|
|
bool (*gs_texture_map)(gs_texture_t *tex, uint8_t **ptr,
|
2014-02-09 04:51:06 -08:00
|
|
|
uint32_t *linesize);
|
2014-09-25 17:44:05 -07:00
|
|
|
void (*gs_texture_unmap)(gs_texture_t *tex);
|
2014-09-26 15:25:59 -07:00
|
|
|
bool (*gs_texture_is_rect)(const gs_texture_t *tex);
|
|
|
|
void *(*gs_texture_get_obj)(const gs_texture_t *tex);
|
2014-08-07 23:42:07 -07:00
|
|
|
|
2014-09-25 17:44:05 -07:00
|
|
|
void (*gs_cubetexture_destroy)(gs_texture_t *cubetex);
|
2014-09-26 15:25:59 -07:00
|
|
|
uint32_t (*gs_cubetexture_get_size)(const gs_texture_t *cubetex);
|
2014-08-07 23:42:07 -07:00
|
|
|
enum gs_color_format (*gs_cubetexture_get_color_format)(
|
2014-09-26 15:25:59 -07:00
|
|
|
const gs_texture_t *cubetex);
|
2014-08-07 23:42:07 -07:00
|
|
|
|
2014-09-25 17:44:05 -07:00
|
|
|
void (*gs_voltexture_destroy)(gs_texture_t *voltex);
|
2014-09-26 15:25:59 -07:00
|
|
|
uint32_t (*gs_voltexture_get_width)(const gs_texture_t *voltex);
|
|
|
|
uint32_t (*gs_voltexture_get_height)(const gs_texture_t *voltex);
|
|
|
|
uint32_t (*gs_voltexture_getdepth)(const gs_texture_t *voltex);
|
2014-08-07 23:42:07 -07:00
|
|
|
enum gs_color_format (*gs_voltexture_get_color_format)(
|
2014-09-26 15:25:59 -07:00
|
|
|
const gs_texture_t *voltex);
|
2014-08-07 23:42:07 -07:00
|
|
|
|
2014-09-25 17:44:05 -07:00
|
|
|
void (*gs_stagesurface_destroy)(gs_stagesurf_t *stagesurf);
|
2014-09-26 15:25:59 -07:00
|
|
|
uint32_t (*gs_stagesurface_get_width)(const gs_stagesurf_t *stagesurf);
|
|
|
|
uint32_t (*gs_stagesurface_get_height)(const gs_stagesurf_t *stagesurf);
|
2014-08-07 23:42:07 -07:00
|
|
|
enum gs_color_format (*gs_stagesurface_get_color_format)(
|
2014-09-26 15:25:59 -07:00
|
|
|
const gs_stagesurf_t *stagesurf);
|
2014-09-25 17:44:05 -07:00
|
|
|
bool (*gs_stagesurface_map)(gs_stagesurf_t *stagesurf,
|
Implement encoder interface (still preliminary)
- Implement OBS encoder interface. It was previously incomplete, but
now is reaching some level of completion, though probably should
still be considered preliminary.
I had originally implemented it so that encoders only have a 'reset'
function to reset their parameters, but I felt that having both a
'start' and 'stop' function would be useful.
Encoders are now assigned to a specific video/audio media output each
rather than implicitely assigned to the main obs video/audio
contexts. This allows separate encoder contexts that aren't
necessarily assigned to the main video/audio context (which is useful
for things such as recording specific sources). Will probably have
to do this for regular obs outputs as well.
When creating an encoder, you must now explicitely state whether that
encoder is an audio or video encoder.
Audio and video can optionally be automatically converted depending
on what the encoder specifies.
When something 'attaches' to an encoder, the first attachment starts
the encoder, and the encoder automatically attaches to the media
output context associated with it. Subsequent attachments won't have
the same effect, they will just start receiving the same encoder data
when the next keyframe plays (along with SEI if any). When detaching
from the encoder, the last detachment will fully stop the encoder and
detach the encoder from the media output context associated with the
encoder.
SEI must actually be exported separately; because new encoder
attachments may not always be at the beginning of the stream, the
first keyframe they get must have that SEI data in it. If the
encoder has SEI data, it needs only add one small function to simply
query that SEI data, and then that data will be handled automatically
by libobs for all subsequent encoder attachments.
- Implement x264 encoder plugin, move x264 files to separate plugin to
separate necessary dependencies.
- Change video/audio frame output structures to not use const
qualifiers to prevent issues with non-const function usage elsewhere.
This was an issue when writing the x264 encoder, as the x264 encoder
expects non-const frame data.
Change stagesurf_map to return a non-const data type to prevent this
as well.
- Change full range parameter of video scaler to be an enum rather than
boolean
2014-03-16 16:21:34 -07:00
|
|
|
uint8_t **data, uint32_t *linesize);
|
2014-09-25 17:44:05 -07:00
|
|
|
void (*gs_stagesurface_unmap)(gs_stagesurf_t *stagesurf);
|
2014-08-07 23:42:07 -07:00
|
|
|
|
2014-09-25 17:44:05 -07:00
|
|
|
void (*gs_zstencil_destroy)(gs_zstencil_t *zstencil);
|
2014-08-07 23:42:07 -07:00
|
|
|
|
2014-09-25 17:44:05 -07:00
|
|
|
void (*gs_samplerstate_destroy)(gs_samplerstate_t *samplerstate);
|
2014-08-07 23:42:07 -07:00
|
|
|
|
2014-09-25 17:44:05 -07:00
|
|
|
void (*gs_vertexbuffer_destroy)(gs_vertbuffer_t *vertbuffer);
|
|
|
|
void (*gs_vertexbuffer_flush)(gs_vertbuffer_t *vertbuffer);
|
2014-08-07 23:42:07 -07:00
|
|
|
struct gs_vb_data *(*gs_vertexbuffer_get_data)(
|
2014-09-26 15:25:59 -07:00
|
|
|
const gs_vertbuffer_t *vertbuffer);
|
2014-08-07 23:42:07 -07:00
|
|
|
|
2014-09-25 17:44:05 -07:00
|
|
|
void (*gs_indexbuffer_destroy)(gs_indexbuffer_t *indexbuffer);
|
|
|
|
void (*gs_indexbuffer_flush)(gs_indexbuffer_t *indexbuffer);
|
2014-09-26 15:25:59 -07:00
|
|
|
void *(*gs_indexbuffer_get_data)(const gs_indexbuffer_t *indexbuffer);
|
|
|
|
size_t (*gs_indexbuffer_get_num_indices)(
|
|
|
|
const gs_indexbuffer_t *indexbuffer);
|
2014-08-07 23:42:07 -07:00
|
|
|
enum gs_index_type (*gs_indexbuffer_get_type)(
|
2014-09-26 15:25:59 -07:00
|
|
|
const gs_indexbuffer_t *indexbuffer);
|
2014-08-07 23:42:07 -07:00
|
|
|
|
2014-09-25 17:44:05 -07:00
|
|
|
void (*gs_shader_destroy)(gs_shader_t *shader);
|
2014-09-26 15:25:59 -07:00
|
|
|
int (*gs_shader_get_num_params)(const gs_shader_t *shader);
|
2014-09-25 17:44:05 -07:00
|
|
|
gs_sparam_t *(*gs_shader_get_param_by_idx)(gs_shader_t *shader,
|
2014-08-07 23:42:07 -07:00
|
|
|
uint32_t param);
|
2014-09-25 17:44:05 -07:00
|
|
|
gs_sparam_t *(*gs_shader_get_param_by_name)(gs_shader_t *shader,
|
2014-08-07 23:42:07 -07:00
|
|
|
const char *name);
|
2014-09-26 15:25:59 -07:00
|
|
|
gs_sparam_t *(*gs_shader_get_viewproj_matrix)(
|
|
|
|
const gs_shader_t *shader);
|
|
|
|
gs_sparam_t *(*gs_shader_get_world_matrix)(const gs_shader_t *shader);
|
|
|
|
void (*gs_shader_get_param_info)(const gs_sparam_t *param,
|
2014-08-07 23:42:07 -07:00
|
|
|
struct gs_shader_param_info *info);
|
2014-09-25 17:44:05 -07:00
|
|
|
void (*gs_shader_set_bool)(gs_sparam_t *param, bool val);
|
|
|
|
void (*gs_shader_set_float)(gs_sparam_t *param, float val);
|
|
|
|
void (*gs_shader_set_int)(gs_sparam_t *param, int val);
|
|
|
|
void (*gs_shader_setmatrix3)(gs_sparam_t *param,
|
2014-08-07 23:42:07 -07:00
|
|
|
const struct matrix3 *val);
|
2014-09-25 17:44:05 -07:00
|
|
|
void (*gs_shader_set_matrix4)(gs_sparam_t *param,
|
2014-08-07 23:42:07 -07:00
|
|
|
const struct matrix4 *val);
|
2014-09-25 17:44:05 -07:00
|
|
|
void (*gs_shader_set_vec2)(gs_sparam_t *param, const struct vec2 *val);
|
|
|
|
void (*gs_shader_set_vec3)(gs_sparam_t *param, const struct vec3 *val);
|
|
|
|
void (*gs_shader_set_vec4)(gs_sparam_t *param, const struct vec4 *val);
|
|
|
|
void (*gs_shader_set_texture)(gs_sparam_t *param, gs_texture_t *val);
|
|
|
|
void (*gs_shader_set_val)(gs_sparam_t *param, const void *val,
|
2014-08-07 23:42:07 -07:00
|
|
|
size_t size);
|
2014-09-25 17:44:05 -07:00
|
|
|
void (*gs_shader_set_default)(gs_sparam_t *param);
|
2013-12-23 07:34:56 -08:00
|
|
|
|
2014-03-05 09:43:14 -08:00
|
|
|
#ifdef __APPLE__
|
2013-12-23 07:34:56 -08:00
|
|
|
/* OSX/Cocoa specific functions */
|
2014-09-25 17:44:05 -07:00
|
|
|
gs_texture_t *(*device_texture_create_from_iosurface)(gs_device_t *dev,
|
|
|
|
void *iosurf);
|
|
|
|
bool (*gs_texture_rebind_iosurface)(gs_texture_t *texture,
|
2014-08-07 23:42:07 -07:00
|
|
|
void *iosurf);
|
2014-03-05 09:43:14 -08:00
|
|
|
|
|
|
|
#elif _WIN32
|
2014-08-07 23:42:07 -07:00
|
|
|
bool (*device_gdi_texture_available)(void);
|
2014-10-13 21:41:09 -07:00
|
|
|
bool (*device_shared_texture_available)(void);
|
|
|
|
|
2014-12-29 00:29:55 -08:00
|
|
|
bool (*device_get_duplicator_monitor_info)(gs_device_t *device,
|
|
|
|
int monitor_idx, struct gs_monitor_info *monitor_info);
|
|
|
|
|
|
|
|
gs_duplicator_t *(*device_duplicator_create)(gs_device_t *device,
|
|
|
|
int monitor_idx);
|
|
|
|
void (*gs_duplicator_destroy)(gs_duplicator_t *duplicator);
|
|
|
|
|
|
|
|
bool (*gs_duplicator_update_frame)(gs_duplicator_t *duplicator);
|
|
|
|
gs_texture_t *(*gs_duplicator_get_texture)(gs_duplicator_t *duplicator);
|
|
|
|
|
2014-09-25 17:44:05 -07:00
|
|
|
gs_texture_t *(*device_texture_create_gdi)(gs_device_t *device,
|
2014-03-05 09:43:14 -08:00
|
|
|
uint32_t width, uint32_t height);
|
|
|
|
|
2014-09-25 17:44:05 -07:00
|
|
|
void *(*gs_texture_get_dc)(gs_texture_t *gdi_tex);
|
|
|
|
void (*gs_texture_release_dc)(gs_texture_t *gdi_tex);
|
2014-10-13 21:41:09 -07:00
|
|
|
|
|
|
|
gs_texture_t *(*device_texture_open_shared)(gs_device_t *device,
|
|
|
|
uint32_t handle);
|
2014-03-05 09:43:14 -08:00
|
|
|
#endif
|
2013-09-30 19:37:13 -07:00
|
|
|
};
|
|
|
|
|
2014-07-03 13:57:40 -07:00
|
|
|
struct blend_state {
|
|
|
|
bool enabled;
|
2015-03-27 11:18:02 -07:00
|
|
|
enum gs_blend_type src_c;
|
|
|
|
enum gs_blend_type dest_c;
|
|
|
|
enum gs_blend_type src_a;
|
|
|
|
enum gs_blend_type dest_a;
|
2014-07-03 13:57:40 -07:00
|
|
|
};
|
|
|
|
|
2013-09-30 19:37:13 -07:00
|
|
|
struct graphics_subsystem {
|
|
|
|
void *module;
|
2014-09-25 17:44:05 -07:00
|
|
|
gs_device_t *device;
|
2013-09-30 19:37:13 -07:00
|
|
|
struct gs_exports exports;
|
|
|
|
|
|
|
|
DARRAY(struct gs_rect) viewport_stack;
|
|
|
|
|
2014-06-14 23:09:13 -07:00
|
|
|
DARRAY(struct matrix4) matrix_stack;
|
2013-09-30 19:37:13 -07:00
|
|
|
size_t cur_matrix;
|
|
|
|
|
|
|
|
struct matrix4 projection;
|
|
|
|
struct gs_effect *cur_effect;
|
|
|
|
|
2014-09-25 17:44:05 -07:00
|
|
|
gs_vertbuffer_t *sprite_buffer;
|
2013-09-30 19:37:13 -07:00
|
|
|
|
|
|
|
bool using_immediate;
|
2014-08-07 23:42:07 -07:00
|
|
|
struct gs_vb_data *vbd;
|
2014-09-25 17:44:05 -07:00
|
|
|
gs_vertbuffer_t *immediate_vertbuffer;
|
2013-09-30 19:37:13 -07:00
|
|
|
DARRAY(struct vec3) verts;
|
|
|
|
DARRAY(struct vec3) norms;
|
|
|
|
DARRAY(uint32_t) colors;
|
|
|
|
DARRAY(struct vec2) texverts[16];
|
2013-10-14 12:37:52 -07:00
|
|
|
|
2015-03-08 06:55:15 -07:00
|
|
|
pthread_mutex_t effect_mutex;
|
|
|
|
struct gs_effect *first_effect;
|
|
|
|
|
2013-10-14 12:37:52 -07:00
|
|
|
pthread_mutex_t mutex;
|
2014-03-16 18:26:46 -07:00
|
|
|
volatile long ref;
|
2014-07-03 13:57:40 -07:00
|
|
|
|
|
|
|
struct blend_state cur_blend_state;
|
2015-03-14 00:23:09 -07:00
|
|
|
DARRAY(struct blend_state) blend_state_stack;
|
2013-09-30 19:37:13 -07:00
|
|
|
};
|