New upstream version 25.0.3+dfsg1
This commit is contained in:
parent
04fe0efc67
commit
8b2e5f2130
569 changed files with 62491 additions and 5875 deletions
|
|
@ -52,7 +52,8 @@ device_cubetexture_create(gs_device_t *device, uint32_t size,
|
|||
EXPORT gs_texture_t *
|
||||
device_voltexture_create(gs_device_t *device, uint32_t width, uint32_t height,
|
||||
uint32_t depth, enum gs_color_format color_format,
|
||||
uint32_t levels, const uint8_t **data, uint32_t flags);
|
||||
uint32_t levels, const uint8_t *const *data,
|
||||
uint32_t flags);
|
||||
EXPORT gs_zstencil_t *device_zstencil_create(gs_device_t *device,
|
||||
uint32_t width, uint32_t height,
|
||||
enum gs_zstencil_format format);
|
||||
|
|
@ -113,6 +114,7 @@ EXPORT void device_copy_texture_region(gs_device_t *device, gs_texture_t *dst,
|
|||
uint32_t src_h);
|
||||
EXPORT void device_stage_texture(gs_device_t *device, gs_stagesurf_t *dst,
|
||||
gs_texture_t *src);
|
||||
EXPORT void device_begin_frame(gs_device_t *device);
|
||||
EXPORT void device_begin_scene(gs_device_t *device);
|
||||
EXPORT void device_draw(gs_device_t *device, enum gs_draw_mode draw_mode,
|
||||
uint32_t start_vert, uint32_t num_verts);
|
||||
|
|
|
|||
|
|
@ -85,6 +85,7 @@ bool load_graphics_imports(struct gs_exports *exports, void *module,
|
|||
GRAPHICS_IMPORT(device_copy_texture_region);
|
||||
GRAPHICS_IMPORT(device_copy_texture);
|
||||
GRAPHICS_IMPORT(device_stage_texture);
|
||||
GRAPHICS_IMPORT(device_begin_frame);
|
||||
GRAPHICS_IMPORT(device_begin_scene);
|
||||
GRAPHICS_IMPORT(device_draw);
|
||||
GRAPHICS_IMPORT(device_load_swapchain);
|
||||
|
|
@ -213,6 +214,8 @@ bool load_graphics_imports(struct gs_exports *exports, void *module,
|
|||
GRAPHICS_IMPORT_OPTIONAL(device_texture_release_sync);
|
||||
GRAPHICS_IMPORT_OPTIONAL(device_texture_create_nv12);
|
||||
GRAPHICS_IMPORT_OPTIONAL(device_stagesurface_create_nv12);
|
||||
GRAPHICS_IMPORT_OPTIONAL(device_register_loss_callbacks);
|
||||
GRAPHICS_IMPORT_OPTIONAL(device_unregister_loss_callbacks);
|
||||
#endif
|
||||
|
||||
return success;
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ struct gs_exports {
|
|||
gs_texture_t *(*device_voltexture_create)(
|
||||
gs_device_t *device, uint32_t width, uint32_t height,
|
||||
uint32_t depth, enum gs_color_format color_format,
|
||||
uint32_t levels, const uint8_t **data, uint32_t flags);
|
||||
uint32_t levels, const uint8_t *const *data, uint32_t flags);
|
||||
gs_zstencil_t *(*device_zstencil_create)(
|
||||
gs_device_t *device, uint32_t width, uint32_t height,
|
||||
enum gs_zstencil_format format);
|
||||
|
|
@ -115,6 +115,7 @@ struct gs_exports {
|
|||
uint32_t src_w, uint32_t src_h);
|
||||
void (*device_stage_texture)(gs_device_t *device, gs_stagesurf_t *dst,
|
||||
gs_texture_t *src);
|
||||
void (*device_begin_frame)(gs_device_t *device);
|
||||
void (*device_begin_scene)(gs_device_t *device);
|
||||
void (*device_draw)(gs_device_t *device, enum gs_draw_mode draw_mode,
|
||||
uint32_t start_vert, uint32_t num_verts);
|
||||
|
|
@ -310,6 +311,10 @@ struct gs_exports {
|
|||
gs_stagesurf_t *(*device_stagesurface_create_nv12)(gs_device_t *device,
|
||||
uint32_t width,
|
||||
uint32_t height);
|
||||
void (*device_register_loss_callbacks)(
|
||||
gs_device_t *device, const struct gs_device_loss *callbacks);
|
||||
void (*device_unregister_loss_callbacks)(gs_device_t *device,
|
||||
void *data);
|
||||
#endif
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -1737,6 +1737,16 @@ void gs_stage_texture(gs_stagesurf_t *dst, gs_texture_t *src)
|
|||
graphics->exports.device_stage_texture(graphics->device, dst, src);
|
||||
}
|
||||
|
||||
void gs_begin_frame(void)
|
||||
{
|
||||
graphics_t *graphics = thread_graphics;
|
||||
|
||||
if (!gs_valid("gs_begin_frame"))
|
||||
return;
|
||||
|
||||
graphics->exports.device_begin_frame(graphics->device);
|
||||
}
|
||||
|
||||
void gs_begin_scene(void)
|
||||
{
|
||||
graphics_t *graphics = thread_graphics;
|
||||
|
|
@ -2952,4 +2962,28 @@ gs_stagesurf_t *gs_stagesurface_create_nv12(uint32_t width, uint32_t height)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
void gs_register_loss_callbacks(const struct gs_device_loss *callbacks)
|
||||
{
|
||||
graphics_t *graphics = thread_graphics;
|
||||
|
||||
if (!gs_valid("gs_register_loss_callbacks"))
|
||||
return;
|
||||
|
||||
if (graphics->exports.device_register_loss_callbacks)
|
||||
graphics->exports.device_register_loss_callbacks(
|
||||
graphics->device, callbacks);
|
||||
}
|
||||
|
||||
void gs_unregister_loss_callbacks(void *data)
|
||||
{
|
||||
graphics_t *graphics = thread_graphics;
|
||||
|
||||
if (!gs_valid("gs_unregister_loss_callbacks"))
|
||||
return;
|
||||
|
||||
if (graphics->exports.device_unregister_loss_callbacks)
|
||||
graphics->exports.device_unregister_loss_callbacks(
|
||||
graphics->device, data);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -169,6 +169,12 @@ enum gs_texture_type {
|
|||
GS_TEXTURE_CUBE,
|
||||
};
|
||||
|
||||
struct gs_device_loss {
|
||||
void (*device_loss_release)(void *data);
|
||||
void (*device_loss_rebuild)(void *device, void *data);
|
||||
void *data;
|
||||
};
|
||||
|
||||
struct gs_monitor_info {
|
||||
int rotation_degrees;
|
||||
long x;
|
||||
|
|
@ -668,6 +674,7 @@ EXPORT void gs_copy_texture_region(gs_texture_t *dst, uint32_t dst_x,
|
|||
uint32_t src_w, uint32_t src_h);
|
||||
EXPORT void gs_stage_texture(gs_stagesurf_t *dst, gs_texture_t *src);
|
||||
|
||||
EXPORT void gs_begin_frame(void);
|
||||
EXPORT void gs_begin_scene(void);
|
||||
EXPORT void gs_draw(enum gs_draw_mode draw_mode, uint32_t start_vert,
|
||||
uint32_t num_verts);
|
||||
|
|
@ -882,6 +889,9 @@ EXPORT bool gs_texture_create_nv12(gs_texture_t **tex_y, gs_texture_t **tex_uv,
|
|||
EXPORT gs_stagesurf_t *gs_stagesurface_create_nv12(uint32_t width,
|
||||
uint32_t height);
|
||||
|
||||
EXPORT void gs_register_loss_callbacks(const struct gs_device_loss *callbacks);
|
||||
EXPORT void gs_unregister_loss_callbacks(void *data);
|
||||
|
||||
#endif
|
||||
|
||||
/* inline functions used by modules */
|
||||
|
|
@ -937,10 +947,12 @@ static inline bool gs_is_compressed_format(enum gs_color_format format)
|
|||
return (format == GS_DXT1 || format == GS_DXT3 || format == GS_DXT5);
|
||||
}
|
||||
|
||||
static inline uint32_t gs_get_total_levels(uint32_t width, uint32_t height)
|
||||
static inline uint32_t gs_get_total_levels(uint32_t width, uint32_t height,
|
||||
uint32_t depth)
|
||||
{
|
||||
uint32_t size = width > height ? width : height;
|
||||
uint32_t num_levels = 0;
|
||||
size = size > depth ? size : depth;
|
||||
uint32_t num_levels = 1;
|
||||
|
||||
while (size > 1) {
|
||||
size /= 2;
|
||||
|
|
|
|||
102
libobs/graphics/half.h
Normal file
102
libobs/graphics/half.h
Normal file
|
|
@ -0,0 +1,102 @@
|
|||
/******************************************************************************
|
||||
Copyright (C) 2020 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
|
||||
the Free Software Foundation, either version 2 of the License, or
|
||||
(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/>.
|
||||
******************************************************************************/
|
||||
|
||||
/******************************************************************************
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2011-2019 Microsoft Corp
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this
|
||||
software and associated documentation files (the "Software"), to deal in the Software
|
||||
without restriction, including without limitation the rights to use, copy, modify,
|
||||
merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to the following
|
||||
conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies
|
||||
or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
|
||||
PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
|
||||
CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
|
||||
OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
******************************************************************************/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "math-defs.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct half {
|
||||
uint16_t u;
|
||||
};
|
||||
|
||||
/* adapted from DirectXMath XMConvertFloatToHalf */
|
||||
static struct half half_from_float(float f)
|
||||
{
|
||||
uint32_t Result;
|
||||
|
||||
uint32_t IValue;
|
||||
memcpy(&IValue, &f, sizeof(IValue));
|
||||
uint32_t Sign = (IValue & 0x80000000U) >> 16U;
|
||||
IValue = IValue & 0x7FFFFFFFU; // Hack off the sign
|
||||
|
||||
if (IValue > 0x477FE000U) {
|
||||
// The number is too large to be represented as a half. Saturate to infinity.
|
||||
if (((IValue & 0x7F800000) == 0x7F800000) &&
|
||||
((IValue & 0x7FFFFF) != 0)) {
|
||||
Result = 0x7FFF; // NAN
|
||||
} else {
|
||||
Result = 0x7C00U; // INF
|
||||
}
|
||||
} else if (!IValue) {
|
||||
Result = 0;
|
||||
} else {
|
||||
if (IValue < 0x38800000U) {
|
||||
// The number is too small to be represented as a normalized half.
|
||||
// Convert it to a denormalized value.
|
||||
uint32_t Shift = 113U - (IValue >> 23U);
|
||||
IValue = (0x800000U | (IValue & 0x7FFFFFU)) >> Shift;
|
||||
} else {
|
||||
// Rebias the exponent to represent the value as a normalized half.
|
||||
IValue += 0xC8000000U;
|
||||
}
|
||||
|
||||
Result = ((IValue + 0x0FFFU + ((IValue >> 13U) & 1U)) >> 13U) &
|
||||
0x7FFFU;
|
||||
}
|
||||
|
||||
struct half h;
|
||||
h.u = (uint16_t)(Result | Sign);
|
||||
return h;
|
||||
}
|
||||
|
||||
static struct half half_from_bits(uint16_t u)
|
||||
{
|
||||
struct half h;
|
||||
h.u = u;
|
||||
return h;
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
@ -41,7 +41,7 @@
|
|||
'buffer_position' should initially be 0, and will be internally updated
|
||||
as the decoding commences. The caller should then repeatedly call
|
||||
gif_initialise() with the structure until the function returns 1, or
|
||||
no more data is avaliable.
|
||||
no more data is available.
|
||||
|
||||
Once the initialisation has begun, the decoder completes the variables
|
||||
'frame_count' and 'frame_count_partial'. The former being the total
|
||||
|
|
@ -54,7 +54,7 @@
|
|||
the current 'frame_image' to reflect the desired frame. The required
|
||||
'disposal_method' is also updated to reflect how the frame should be
|
||||
plotted. The caller must not assume that the current 'frame_image' will
|
||||
be valid between calls if initialisation is still occuring, and should
|
||||
be valid between calls if initialisation is still occurring, and should
|
||||
either always request that the frame is decoded (no processing will
|
||||
occur if the 'decoded_frame' has not been invalidated by initialisation)
|
||||
or perform the check itself.
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ typedef struct gif_frame {
|
|||
bool opaque; /**< whether the frame is totally opaque */
|
||||
bool redraw_required; /**< whether a forcable screen redraw is required */
|
||||
unsigned char disposal_method; /**< how the previous frame should be disposed; affects plotting */
|
||||
bool transparency; /**< whether we acknoledge transparency */
|
||||
bool transparency; /**< whether we acknowledge transparency */
|
||||
unsigned char transparency_index; /**< the index designating a transparent pixel */
|
||||
unsigned int redraw_x; /**< x co-ordinate of redraw rectangle */
|
||||
unsigned int redraw_y; /**< y co-ordinate of redraw rectangle */
|
||||
|
|
@ -78,7 +78,7 @@ typedef struct gif_bitmap_callback_vt {
|
|||
*/
|
||||
gif_bitmap_cb_set_opaque bitmap_set_opaque; /**< Sets whether a bitmap should be plotted opaque. */
|
||||
gif_bitmap_cb_test_opaque bitmap_test_opaque; /**< Tests whether a bitmap has an opaque alpha channel. */
|
||||
gif_bitmap_cb_modified bitmap_modified; /**< The bitmap image has changed, so flush any persistant cache. */
|
||||
gif_bitmap_cb_modified bitmap_modified; /**< The bitmap image has changed, so flush any persistent cache. */
|
||||
} gif_bitmap_callback_vt;
|
||||
|
||||
/* The GIF animation data
|
||||
|
|
@ -87,7 +87,7 @@ typedef struct gif_animation {
|
|||
gif_bitmap_callback_vt bitmap_callbacks; /**< callbacks for bitmap functions */
|
||||
unsigned char *gif_data; /**< pointer to GIF data */
|
||||
unsigned int width; /**< width of GIF (may increase during decoding) */
|
||||
unsigned int height; /**< heigth of GIF (may increase during decoding) */
|
||||
unsigned int height; /**< height of GIF (may increase during decoding) */
|
||||
unsigned int frame_count; /**< number of frames decoded */
|
||||
unsigned int frame_count_partial; /**< number of frames partially decoded */
|
||||
gif_frame *frames; /**< decoded frames */
|
||||
|
|
|
|||
|
|
@ -20,7 +20,8 @@
|
|||
#include "../util/c99defs.h"
|
||||
#include "math-defs.h"
|
||||
#include "vec3.h"
|
||||
#include <xmmintrin.h>
|
||||
|
||||
#include "../util/sse-intrin.h"
|
||||
|
||||
/*
|
||||
* Quaternion math
|
||||
|
|
|
|||
|
|
@ -19,7 +19,8 @@
|
|||
|
||||
#include "math-defs.h"
|
||||
#include "vec4.h"
|
||||
#include <xmmintrin.h>
|
||||
|
||||
#include "../util/sse-intrin.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
|
|
|||
|
|
@ -18,7 +18,8 @@
|
|||
#pragma once
|
||||
|
||||
#include "math-defs.h"
|
||||
#include <xmmintrin.h>
|
||||
|
||||
#include "../util/sse-intrin.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue