New upstream version 0.15.4+dfsg1
This commit is contained in:
parent
55d5047af0
commit
67704ac59c
359 changed files with 8423 additions and 1050 deletions
|
|
@ -125,6 +125,8 @@ void gs_technique_end(gs_technique_t *tech)
|
|||
|
||||
da_free(param->cur_val);
|
||||
param->changed = false;
|
||||
if (param->next_sampler)
|
||||
param->next_sampler = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -147,6 +149,9 @@ static void upload_shader_params(struct darray *pass_params, bool changed_only)
|
|||
struct gs_effect_param *eparam = param->eparam;
|
||||
gs_sparam_t *sparam = param->sparam;
|
||||
|
||||
if (eparam->next_sampler)
|
||||
gs_shader_set_next_sampler(sparam, eparam->next_sampler);
|
||||
|
||||
if (changed_only && !eparam->changed)
|
||||
continue;
|
||||
|
||||
|
|
@ -378,3 +383,14 @@ void gs_effect_set_default(gs_eparam_t *param)
|
|||
effect_setval_inline(param, param->default_val.array,
|
||||
param->default_val.num);
|
||||
}
|
||||
|
||||
void gs_effect_set_next_sampler(gs_eparam_t *param, gs_samplerstate_t *sampler)
|
||||
{
|
||||
if (!param) {
|
||||
blog(LOG_ERROR, "gs_effect_set_next_sampler: invalid param");
|
||||
return;
|
||||
}
|
||||
|
||||
if (param->type == GS_SHADER_PARAM_TEXTURE)
|
||||
param->next_sampler = sampler;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -57,6 +57,7 @@ struct gs_effect_param {
|
|||
DARRAY(uint8_t) default_val;
|
||||
|
||||
gs_effect_t *effect;
|
||||
gs_samplerstate_t *next_sampler;
|
||||
|
||||
/*char *full_name;
|
||||
float scroller_min, scroller_max, scroller_inc, scroller_mul;*/
|
||||
|
|
|
|||
|
|
@ -167,6 +167,7 @@ bool load_graphics_imports(struct gs_exports *exports, void *module,
|
|||
GRAPHICS_IMPORT(gs_shader_set_texture);
|
||||
GRAPHICS_IMPORT(gs_shader_set_val);
|
||||
GRAPHICS_IMPORT(gs_shader_set_default);
|
||||
GRAPHICS_IMPORT(gs_shader_set_next_sampler);
|
||||
|
||||
/* OSX/Cocoa specific functions */
|
||||
#ifdef __APPLE__
|
||||
|
|
|
|||
|
|
@ -225,6 +225,8 @@ struct gs_exports {
|
|||
void (*gs_shader_set_val)(gs_sparam_t *param, const void *val,
|
||||
size_t size);
|
||||
void (*gs_shader_set_default)(gs_sparam_t *param);
|
||||
void (*gs_shader_set_next_sampler)(gs_sparam_t *param,
|
||||
gs_samplerstate_t *sampler);
|
||||
|
||||
#ifdef __APPLE__
|
||||
/* OSX/Cocoa specific functions */
|
||||
|
|
|
|||
|
|
@ -2089,6 +2089,16 @@ void gs_shader_set_default(gs_sparam_t *param)
|
|||
graphics->exports.gs_shader_set_default(param);
|
||||
}
|
||||
|
||||
void gs_shader_set_next_sampler(gs_sparam_t *param, gs_samplerstate_t *sampler)
|
||||
{
|
||||
graphics_t *graphics = thread_graphics;
|
||||
|
||||
if (!gs_valid_p("gs_shader_set_next_sampler", param))
|
||||
return;
|
||||
|
||||
graphics->exports.gs_shader_set_next_sampler(param, sampler);
|
||||
}
|
||||
|
||||
void gs_texture_destroy(gs_texture_t *tex)
|
||||
{
|
||||
graphics_t *graphics = thread_graphics;
|
||||
|
|
|
|||
|
|
@ -325,6 +325,8 @@ EXPORT void gs_shader_set_vec4(gs_sparam_t *param, const struct vec4 *val);
|
|||
EXPORT void gs_shader_set_texture(gs_sparam_t *param, gs_texture_t *val);
|
||||
EXPORT void gs_shader_set_val(gs_sparam_t *param, const void *val, size_t size);
|
||||
EXPORT void gs_shader_set_default(gs_sparam_t *param);
|
||||
EXPORT void gs_shader_set_next_sampler(gs_sparam_t *param,
|
||||
gs_samplerstate_t *sampler);
|
||||
|
||||
/* ---------------------------------------------------
|
||||
* effect functions
|
||||
|
|
@ -393,6 +395,8 @@ EXPORT void gs_effect_set_vec4(gs_eparam_t *param, const struct vec4 *val);
|
|||
EXPORT void gs_effect_set_texture(gs_eparam_t *param, gs_texture_t *val);
|
||||
EXPORT void gs_effect_set_val(gs_eparam_t *param, const void *val, size_t size);
|
||||
EXPORT void gs_effect_set_default(gs_eparam_t *param);
|
||||
EXPORT void gs_effect_set_next_sampler(gs_eparam_t *param,
|
||||
gs_samplerstate_t *sampler);
|
||||
|
||||
/* ---------------------------------------------------
|
||||
* texture render helper functions
|
||||
|
|
|
|||
|
|
@ -318,9 +318,10 @@ void gs_image_file_update_texture(gs_image_file_t *image)
|
|||
if (!image->is_animated_gif || !image->loaded)
|
||||
return;
|
||||
|
||||
if (image->animation_frame_cache[image->cur_frame]) {
|
||||
gs_texture_set_image(image->texture,
|
||||
image->animation_frame_cache[image->cur_frame],
|
||||
image->gif.width * 4, false);
|
||||
}
|
||||
if (!image->animation_frame_cache[image->cur_frame])
|
||||
decode_new_frame(image, image->cur_frame);
|
||||
|
||||
gs_texture_set_image(image->texture,
|
||||
image->animation_frame_cache[image->cur_frame],
|
||||
image->gif.width * 4, false);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -231,7 +231,7 @@ void matrix4_scale_i(struct matrix4 *dst, const struct vec3 *v,
|
|||
|
||||
bool matrix4_inv(struct matrix4 *dst, const struct matrix4 *m)
|
||||
{
|
||||
struct vec4 *dstv = (struct vec4 *)dst;
|
||||
struct vec4 *dstv;
|
||||
float det;
|
||||
float m3x3[9];
|
||||
int i, j, sign;
|
||||
|
|
@ -261,25 +261,38 @@ bool matrix4_inv(struct matrix4 *dst, const struct matrix4 *m)
|
|||
|
||||
void matrix4_transpose(struct matrix4 *dst, const struct matrix4 *m)
|
||||
{
|
||||
struct matrix4 temp;
|
||||
if (dst == m) {
|
||||
struct matrix4 temp = *m;
|
||||
matrix4_transpose(dst, &temp);
|
||||
return;
|
||||
}
|
||||
|
||||
/* TODO: Add SSE */
|
||||
temp.x.x = m->x.x;
|
||||
temp.x.y = m->y.x;
|
||||
temp.x.z = m->z.x;
|
||||
temp.x.w = m->t.x;
|
||||
temp.y.x = m->x.y;
|
||||
temp.y.y = m->y.y;
|
||||
temp.y.z = m->z.y;
|
||||
temp.y.w = m->t.y;
|
||||
temp.z.x = m->x.z;
|
||||
temp.z.y = m->y.z;
|
||||
temp.z.z = m->z.z;
|
||||
temp.z.w = m->t.z;
|
||||
temp.t.x = m->x.w;
|
||||
temp.t.y = m->y.w;
|
||||
temp.t.z = m->z.w;
|
||||
temp.t.w = m->t.w;
|
||||
#ifdef NO_INTRINSICS
|
||||
dst->x.x = m->x.x;
|
||||
dst->x.y = m->y.x;
|
||||
dst->x.z = m->z.x;
|
||||
dst->x.w = m->t.x;
|
||||
dst->y.x = m->x.y;
|
||||
dst->y.y = m->y.y;
|
||||
dst->y.z = m->z.y;
|
||||
dst->y.w = m->t.y;
|
||||
dst->z.x = m->x.z;
|
||||
dst->z.y = m->y.z;
|
||||
dst->z.z = m->z.z;
|
||||
dst->z.w = m->t.z;
|
||||
dst->t.x = m->x.w;
|
||||
dst->t.y = m->y.w;
|
||||
dst->t.z = m->z.w;
|
||||
dst->t.w = m->t.w;
|
||||
#else
|
||||
__m128 a0 = _mm_unpacklo_ps(m->x.m, m->z.m);
|
||||
__m128 a1 = _mm_unpacklo_ps(m->y.m, m->t.m);
|
||||
__m128 a2 = _mm_unpackhi_ps(m->x.m, m->z.m);
|
||||
__m128 a3 = _mm_unpackhi_ps(m->y.m, m->t.m);
|
||||
|
||||
matrix4_copy(dst, &temp);
|
||||
dst->x.m = _mm_unpacklo_ps(a0, a1);
|
||||
dst->y.m = _mm_unpackhi_ps(a0, a1);
|
||||
dst->z.m = _mm_unpacklo_ps(a2, a3);
|
||||
dst->t.m = _mm_unpackhi_ps(a2, a3);
|
||||
#endif
|
||||
}
|
||||
|
|
|
|||
|
|
@ -119,8 +119,7 @@ void shader_sampler_convert(struct shader_sampler *ss,
|
|||
else if (astrcmpi(state, "MaxAnisotropy") == 0)
|
||||
info->max_anisotropy = (int)strtol(value, NULL, 10);
|
||||
else if (astrcmpi(state, "BorderColor") == 0)
|
||||
info->border_color = (*value == '#') ?
|
||||
strtol(value + 1, NULL, 16) : 0;
|
||||
info->border_color = strtol(value + 1, NULL, 16);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -138,7 +137,7 @@ static int sp_parse_sampler_state_item(struct shader_parser *sp,
|
|||
ret = cf_next_token_should_be(&sp->cfp, "=", ";", NULL);
|
||||
if (ret != PARSE_SUCCESS) goto fail;
|
||||
|
||||
ret = cf_next_name(&sp->cfp, &value, "value name", ";");
|
||||
ret = cf_next_token_copy(&sp->cfp, &value);
|
||||
if (ret != PARSE_SUCCESS) goto fail;
|
||||
|
||||
ret = cf_next_token_should_be(&sp->cfp, ";", ";", NULL);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue