Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
尘离序散
obs-studio
提交
caf8ca9b
O
obs-studio
项目概览
尘离序散
/
obs-studio
与 Fork 源项目一致
从无法访问的项目Fork
通知
30
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
O
obs-studio
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
caf8ca9b
编写于
6月 25, 2014
作者:
J
jp9000
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Remove 'shader' param from shader param functions
上级
27010a2f
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
155 addition
and
215 deletion
+155
-215
libobs-d3d11/d3d11-shader.cpp
libobs-d3d11/d3d11-shader.cpp
+34
-38
libobs-d3d11/d3d11-subsystem.cpp
libobs-d3d11/d3d11-subsystem.cpp
+1
-1
libobs-opengl/gl-shader.c
libobs-opengl/gl-shader.c
+49
-84
libobs-opengl/gl-subsystem.c
libobs-opengl/gl-subsystem.c
+1
-1
libobs/graphics/effect.c
libobs/graphics/effect.c
+3
-3
libobs/graphics/graphics-imports.c
libobs/graphics/graphics-imports.c
+1
-1
libobs/graphics/graphics-internal.h
libobs/graphics/graphics-internal.h
+13
-20
libobs/graphics/graphics.c
libobs/graphics/graphics.c
+41
-48
libobs/graphics/graphics.h
libobs/graphics/graphics.h
+12
-19
未找到文件。
libobs-d3d11/d3d11-shader.cpp
浏览文件 @
caf8ca9b
...
@@ -168,7 +168,7 @@ void gs_shader::BuildConstantBuffer()
...
@@ -168,7 +168,7 @@ void gs_shader::BuildConstantBuffer()
}
}
for
(
size_t
i
=
0
;
i
<
params
.
size
();
i
++
)
for
(
size_t
i
=
0
;
i
<
params
.
size
();
i
++
)
shader_setdefault
(
this
,
&
params
[
i
]);
shader_setdefault
(
&
params
[
i
]);
}
}
void
gs_shader
::
Compile
(
const
char
*
shaderString
,
const
char
*
file
,
void
gs_shader
::
Compile
(
const
char
*
shaderString
,
const
char
*
file
,
...
@@ -276,16 +276,6 @@ sparam_t shader_getparambyname(shader_t shader, const char *name)
...
@@ -276,16 +276,6 @@ sparam_t shader_getparambyname(shader_t shader, const char *name)
return
NULL
;
return
NULL
;
}
}
void
shader_getparaminfo
(
shader_t
shader
,
sparam_t
param
,
struct
shader_param_info
*
info
)
{
if
(
!
param
||
!
shader
)
return
;
info
->
name
=
param
->
name
.
c_str
();
info
->
type
=
param
->
type
;
}
sparam_t
shader_getviewprojmatrix
(
shader_t
shader
)
sparam_t
shader_getviewprojmatrix
(
shader_t
shader
)
{
{
if
(
shader
->
type
!=
SHADER_VERTEX
)
if
(
shader
->
type
!=
SHADER_VERTEX
)
...
@@ -302,8 +292,17 @@ sparam_t shader_getworldmatrix(shader_t shader)
...
@@ -302,8 +292,17 @@ sparam_t shader_getworldmatrix(shader_t shader)
return
static_cast
<
gs_vertex_shader
*>
(
shader
)
->
world
;
return
static_cast
<
gs_vertex_shader
*>
(
shader
)
->
world
;
}
}
static
inline
void
shader_setval_inline
(
gs_shader
*
shader
,
shader_param
*
param
,
void
shader_getparaminfo
(
sparam_t
param
,
struct
shader_param_info
*
info
)
const
void
*
data
,
size_t
size
)
{
if
(
!
param
)
return
;
info
->
name
=
param
->
name
.
c_str
();
info
->
type
=
param
->
type
;
}
static
inline
void
shader_setval_inline
(
shader_param
*
param
,
const
void
*
data
,
size_t
size
)
{
{
assert
(
param
);
assert
(
param
);
if
(
!
param
)
if
(
!
param
)
...
@@ -319,64 +318,61 @@ static inline void shader_setval_inline(gs_shader *shader, shader_param *param,
...
@@ -319,64 +318,61 @@ static inline void shader_setval_inline(gs_shader *shader, shader_param *param,
}
}
}
}
void
shader_setbool
(
s
hader_t
shader
,
s
param_t
param
,
bool
val
)
void
shader_setbool
(
sparam_t
param
,
bool
val
)
{
{
shader_setval_inline
(
shader
,
param
,
&
val
,
sizeof
(
bool
));
shader_setval_inline
(
param
,
&
val
,
sizeof
(
bool
));
}
}
void
shader_setfloat
(
s
hader_t
shader
,
s
param_t
param
,
float
val
)
void
shader_setfloat
(
sparam_t
param
,
float
val
)
{
{
shader_setval_inline
(
shader
,
param
,
&
val
,
sizeof
(
float
));
shader_setval_inline
(
param
,
&
val
,
sizeof
(
float
));
}
}
void
shader_setint
(
s
hader_t
shader
,
s
param_t
param
,
int
val
)
void
shader_setint
(
sparam_t
param
,
int
val
)
{
{
shader_setval_inline
(
shader
,
param
,
&
val
,
sizeof
(
int
));
shader_setval_inline
(
param
,
&
val
,
sizeof
(
int
));
}
}
void
shader_setmatrix3
(
shader_t
shader
,
sparam_t
param
,
void
shader_setmatrix3
(
sparam_t
param
,
const
struct
matrix3
*
val
)
const
struct
matrix3
*
val
)
{
{
struct
matrix4
mat
;
struct
matrix4
mat
;
matrix4_from_matrix3
(
&
mat
,
val
);
matrix4_from_matrix3
(
&
mat
,
val
);
shader_setval_inline
(
shader
,
param
,
&
mat
,
sizeof
(
matrix4
));
shader_setval_inline
(
param
,
&
mat
,
sizeof
(
matrix4
));
}
}
void
shader_setmatrix4
(
shader_t
shader
,
sparam_t
param
,
void
shader_setmatrix4
(
sparam_t
param
,
const
struct
matrix4
*
val
)
const
struct
matrix4
*
val
)
{
{
shader_setval_inline
(
shader
,
param
,
val
,
sizeof
(
matrix4
));
shader_setval_inline
(
param
,
val
,
sizeof
(
matrix4
));
}
}
void
shader_setvec2
(
s
hader_t
shader
,
s
param_t
param
,
const
struct
vec2
*
val
)
void
shader_setvec2
(
sparam_t
param
,
const
struct
vec2
*
val
)
{
{
shader_setval_inline
(
shader
,
param
,
val
,
sizeof
(
vec2
));
shader_setval_inline
(
param
,
val
,
sizeof
(
vec2
));
}
}
void
shader_setvec3
(
s
hader_t
shader
,
s
param_t
param
,
const
struct
vec3
*
val
)
void
shader_setvec3
(
sparam_t
param
,
const
struct
vec3
*
val
)
{
{
shader_setval_inline
(
shader
,
param
,
val
,
sizeof
(
float
)
*
3
);
shader_setval_inline
(
param
,
val
,
sizeof
(
float
)
*
3
);
}
}
void
shader_setvec4
(
s
hader_t
shader
,
s
param_t
param
,
const
struct
vec4
*
val
)
void
shader_setvec4
(
sparam_t
param
,
const
struct
vec4
*
val
)
{
{
shader_setval_inline
(
shader
,
param
,
val
,
sizeof
(
vec4
));
shader_setval_inline
(
param
,
val
,
sizeof
(
vec4
));
}
}
void
shader_settexture
(
s
hader_t
shader
,
s
param_t
param
,
texture_t
val
)
void
shader_settexture
(
sparam_t
param
,
texture_t
val
)
{
{
shader_setval_inline
(
shader
,
param
,
&
val
,
sizeof
(
texture_t
));
shader_setval_inline
(
param
,
&
val
,
sizeof
(
texture_t
));
}
}
void
shader_setval
(
shader_t
shader
,
sparam_t
param
,
const
void
*
val
,
void
shader_setval
(
sparam_t
param
,
const
void
*
val
,
size_t
size
)
size_t
size
)
{
{
shader_setval_inline
(
shader
,
param
,
val
,
size
);
shader_setval_inline
(
param
,
val
,
size
);
}
}
void
shader_setdefault
(
s
hader_t
shader
,
s
param_t
param
)
void
shader_setdefault
(
sparam_t
param
)
{
{
if
(
param
->
defaultValue
.
size
())
if
(
param
->
defaultValue
.
size
())
shader_setval_inline
(
shader
,
param
,
param
->
defaultValue
.
data
(),
shader_setval_inline
(
param
,
param
->
defaultValue
.
data
(),
param
->
defaultValue
.
size
());
param
->
defaultValue
.
size
());
}
}
libobs-d3d11/d3d11-subsystem.cpp
浏览文件 @
caf8ca9b
...
@@ -379,7 +379,7 @@ void gs_device::UpdateViewProjMatrix()
...
@@ -379,7 +379,7 @@ void gs_device::UpdateViewProjMatrix()
matrix4_transpose
(
&
curViewProjMatrix
,
&
curViewProjMatrix
);
matrix4_transpose
(
&
curViewProjMatrix
,
&
curViewProjMatrix
);
if
(
curVertexShader
->
viewProj
)
if
(
curVertexShader
->
viewProj
)
shader_setmatrix4
(
curVertexShader
,
curVertexShader
->
viewProj
,
shader_setmatrix4
(
curVertexShader
->
viewProj
,
&
curViewProjMatrix
);
&
curViewProjMatrix
);
}
}
...
...
libobs-opengl/gl-shader.c
浏览文件 @
caf8ca9b
...
@@ -338,26 +338,6 @@ sparam_t shader_getparambyname(shader_t shader, const char *name)
...
@@ -338,26 +338,6 @@ sparam_t shader_getparambyname(shader_t shader, const char *name)
return
NULL
;
return
NULL
;
}
}
static
inline
bool
matching_shader
(
shader_t
shader
,
sparam_t
sparam
)
{
if
(
shader
!=
sparam
->
shader
)
{
blog
(
LOG_ERROR
,
"Shader and shader parameter do not match"
);
return
false
;
}
return
true
;
}
void
shader_getparaminfo
(
shader_t
shader
,
sparam_t
param
,
struct
shader_param_info
*
info
)
{
if
(
!
matching_shader
(
shader
,
param
))
return
;
info
->
type
=
param
->
type
;
info
->
name
=
param
->
name
;
}
sparam_t
shader_getviewprojmatrix
(
shader_t
shader
)
sparam_t
shader_getviewprojmatrix
(
shader_t
shader
)
{
{
return
shader
->
viewproj
;
return
shader
->
viewproj
;
...
@@ -368,91 +348,81 @@ sparam_t shader_getworldmatrix(shader_t shader)
...
@@ -368,91 +348,81 @@ sparam_t shader_getworldmatrix(shader_t shader)
return
shader
->
world
;
return
shader
->
world
;
}
}
void
shader_
setbool
(
shader_t
shader
,
sparam_t
param
,
bool
val
)
void
shader_
getparaminfo
(
sparam_t
param
,
struct
shader_param_info
*
info
)
{
{
if
(
matching_shader
(
shader
,
param
))
{
info
->
type
=
param
->
type
;
glProgramUniform1i
(
shader
->
program
,
param
->
param
,
(
GLint
)
val
);
info
->
name
=
param
->
name
;
gl_success
(
"glProgramUniform1i"
);
}
}
}
void
shader_set
float
(
shader_t
shader
,
sparam_t
param
,
float
val
)
void
shader_set
bool
(
sparam_t
param
,
bool
val
)
{
{
if
(
matching_shader
(
shader
,
param
))
{
struct
gs_shader
*
shader
=
param
->
shader
;
glProgramUniform1f
(
shader
->
program
,
param
->
param
,
val
);
glProgramUniform1i
(
shader
->
program
,
param
->
param
,
(
GLint
)
val
);
gl_success
(
"glProgramUniform1f"
);
gl_success
(
"glProgramUniform1i"
);
}
}
}
void
shader_set
int
(
shader_t
shader
,
sparam_t
param
,
in
t
val
)
void
shader_set
float
(
sparam_t
param
,
floa
t
val
)
{
{
if
(
matching_shader
(
shader
,
param
))
{
struct
gs_shader
*
shader
=
param
->
shader
;
glProgramUniform1i
(
shader
->
program
,
param
->
param
,
val
);
glProgramUniform1f
(
shader
->
program
,
param
->
param
,
val
);
gl_success
(
"glProgramUniform1i"
);
gl_success
(
"glProgramUniform1f"
);
}
}
}
void
shader_setmatrix3
(
shader_t
shader
,
sparam_t
param
,
void
shader_setint
(
sparam_t
param
,
int
val
)
const
struct
matrix3
*
val
)
{
{
struct
gs_shader
*
shader
=
param
->
shader
;
glProgramUniform1i
(
shader
->
program
,
param
->
param
,
val
);
gl_success
(
"glProgramUniform1i"
);
}
void
shader_setmatrix3
(
sparam_t
param
,
const
struct
matrix3
*
val
)
{
struct
gs_shader
*
shader
=
param
->
shader
;
struct
matrix4
mat
;
struct
matrix4
mat
;
matrix4_from_matrix3
(
&
mat
,
val
);
matrix4_from_matrix3
(
&
mat
,
val
);
if
(
matching_shader
(
shader
,
param
))
{
glProgramUniformMatrix4fv
(
shader
->
program
,
param
->
param
,
1
,
glProgramUniformMatrix4fv
(
shader
->
program
,
param
->
param
,
1
,
false
,
mat
.
x
.
ptr
);
false
,
mat
.
x
.
ptr
);
gl_success
(
"glProgramUniformMatrix4fv"
);
gl_success
(
"glProgramUniformMatrix4fv"
);
}
}
}
void
shader_setmatrix4
(
shader_t
shader
,
sparam_t
param
,
void
shader_setmatrix4
(
sparam_t
param
,
const
struct
matrix4
*
val
)
const
struct
matrix4
*
val
)
{
{
if
(
matching_shader
(
shader
,
param
))
{
struct
gs_shader
*
shader
=
param
->
shader
;
glProgramUniformMatrix4fv
(
shader
->
program
,
param
->
param
,
1
,
glProgramUniformMatrix4fv
(
shader
->
program
,
param
->
param
,
1
,
false
,
val
->
x
.
ptr
);
false
,
val
->
x
.
ptr
);
gl_success
(
"glProgramUniformMatrix4fv"
);
gl_success
(
"glProgramUniformMatrix4fv"
);
}
}
}
void
shader_setvec2
(
shader_t
shader
,
sparam_t
param
,
void
shader_setvec2
(
sparam_t
param
,
const
struct
vec2
*
val
)
const
struct
vec2
*
val
)
{
{
if
(
matching_shader
(
shader
,
param
))
{
struct
gs_shader
*
shader
=
param
->
shader
;
glProgramUniform2fv
(
shader
->
program
,
param
->
param
,
1
,
val
->
ptr
);
glProgramUniform2fv
(
shader
->
program
,
param
->
param
,
1
,
val
->
ptr
);
gl_success
(
"glProgramUniform2fv"
);
gl_success
(
"glProgramUniform2fv"
);
}
}
}
void
shader_setvec3
(
shader_t
shader
,
sparam_t
param
,
void
shader_setvec3
(
sparam_t
param
,
const
struct
vec3
*
val
)
const
struct
vec3
*
val
)
{
{
if
(
matching_shader
(
shader
,
param
))
{
struct
gs_shader
*
shader
=
param
->
shader
;
glProgramUniform3fv
(
shader
->
program
,
param
->
param
,
1
,
val
->
ptr
);
glProgramUniform3fv
(
shader
->
program
,
param
->
param
,
1
,
val
->
ptr
);
gl_success
(
"glProgramUniform3fv"
);
gl_success
(
"glProgramUniform3fv"
);
}
}
}
void
shader_setvec4
(
shader_t
shader
,
sparam_t
param
,
void
shader_setvec4
(
sparam_t
param
,
const
struct
vec4
*
val
)
const
struct
vec4
*
val
)
{
{
if
(
matching_shader
(
shader
,
param
))
{
struct
gs_shader
*
shader
=
param
->
shader
;
glProgramUniform4fv
(
shader
->
program
,
param
->
param
,
1
,
val
->
ptr
);
glProgramUniform4fv
(
shader
->
program
,
param
->
param
,
1
,
val
->
ptr
);
gl_success
(
"glProgramUniform4fv"
);
gl_success
(
"glProgramUniform4fv"
);
}
}
}
void
shader_settexture
(
s
hader_t
shader
,
s
param_t
param
,
texture_t
val
)
void
shader_settexture
(
sparam_t
param
,
texture_t
val
)
{
{
if
(
matching_shader
(
shader
,
param
))
param
->
texture
=
val
;
param
->
texture
=
val
;
}
}
static
void
shader_setval_data
(
shader_t
shader
,
sparam_t
param
,
static
void
shader_setval_data
(
sparam_t
param
,
const
void
*
val
,
int
count
)
const
void
*
val
,
int
count
)
{
{
if
(
!
matching_shader
(
shader
,
param
))
struct
gs_shader
*
shader
=
param
->
shader
;
return
;
if
(
param
->
type
==
SHADER_PARAM_BOOL
||
if
(
param
->
type
==
SHADER_PARAM_BOOL
||
param
->
type
==
SHADER_PARAM_INT
)
{
param
->
type
==
SHADER_PARAM_INT
)
{
...
@@ -494,17 +464,13 @@ void shader_update_textures(struct gs_shader *shader)
...
@@ -494,17 +464,13 @@ void shader_update_textures(struct gs_shader *shader)
}
}
}
}
void
shader_setval
(
shader_t
shader
,
sparam_t
param
,
const
void
*
val
,
void
shader_setval
(
sparam_t
param
,
const
void
*
val
,
size_t
size
)
size_t
size
)
{
{
int
count
=
param
->
array_count
;
int
count
=
param
->
array_count
;
size_t
expected_size
=
0
;
size_t
expected_size
=
0
;
if
(
!
count
)
if
(
!
count
)
count
=
1
;
count
=
1
;
if
(
!
matching_shader
(
shader
,
param
))
return
;
switch
((
uint32_t
)
param
->
type
)
{
switch
((
uint32_t
)
param
->
type
)
{
case
SHADER_PARAM_FLOAT
:
expected_size
=
sizeof
(
float
);
break
;
case
SHADER_PARAM_FLOAT
:
expected_size
=
sizeof
(
float
);
break
;
case
SHADER_PARAM_BOOL
:
case
SHADER_PARAM_BOOL
:
...
@@ -528,13 +494,12 @@ void shader_setval(shader_t shader, sparam_t param, const void *val,
...
@@ -528,13 +494,12 @@ void shader_setval(shader_t shader, sparam_t param, const void *val,
}
}
if
(
param
->
type
==
SHADER_PARAM_TEXTURE
)
if
(
param
->
type
==
SHADER_PARAM_TEXTURE
)
shader_settexture
(
shader
,
param
,
*
(
texture_t
*
)
val
);
shader_settexture
(
param
,
*
(
texture_t
*
)
val
);
else
else
shader_setval_data
(
shader
,
param
,
val
,
count
);
shader_setval_data
(
param
,
val
,
count
);
}
}
void
shader_setdefault
(
s
hader_t
shader
,
s
param_t
param
)
void
shader_setdefault
(
sparam_t
param
)
{
{
shader_setval
(
shader
,
param
,
param
->
def_value
.
array
,
shader_setval
(
param
,
param
->
def_value
.
array
,
param
->
def_value
.
num
);
param
->
def_value
.
num
);
}
}
libobs-opengl/gl-subsystem.c
浏览文件 @
caf8ca9b
...
@@ -873,7 +873,7 @@ static void update_viewproj_matrix(struct gs_device *device)
...
@@ -873,7 +873,7 @@ static void update_viewproj_matrix(struct gs_device *device)
matrix4_transpose
(
&
device
->
cur_viewproj
,
&
device
->
cur_viewproj
);
matrix4_transpose
(
&
device
->
cur_viewproj
,
&
device
->
cur_viewproj
);
if
(
vs
->
viewproj
)
if
(
vs
->
viewproj
)
shader_setmatrix4
(
vs
,
vs
->
viewproj
,
&
device
->
cur_viewproj
);
shader_setmatrix4
(
vs
->
viewproj
,
&
device
->
cur_viewproj
);
}
}
static
inline
bool
check_shader_pipeline_validity
(
device_t
device
)
static
inline
bool
check_shader_pipeline_validity
(
device_t
device
)
...
...
libobs/graphics/effect.c
浏览文件 @
caf8ca9b
...
@@ -104,7 +104,7 @@ static void upload_shader_params(shader_t shader, struct darray *pass_params,
...
@@ -104,7 +104,7 @@ static void upload_shader_params(shader_t shader, struct darray *pass_params,
continue
;
continue
;
}
}
shader_setval
(
s
hader
,
s
param
,
eparam
->
cur_val
.
array
,
shader_setval
(
sparam
,
eparam
->
cur_val
.
array
,
eparam
->
cur_val
.
num
);
eparam
->
cur_val
.
num
);
}
}
}
}
...
@@ -178,9 +178,9 @@ static inline void clear_tex_params(shader_t shader, struct darray *in_params)
...
@@ -178,9 +178,9 @@ static inline void clear_tex_params(shader_t shader, struct darray *in_params)
struct
pass_shaderparam
*
param
=
params
+
i
;
struct
pass_shaderparam
*
param
=
params
+
i
;
struct
shader_param_info
info
;
struct
shader_param_info
info
;
shader_getparaminfo
(
shader
,
param
->
sparam
,
&
info
);
shader_getparaminfo
(
param
->
sparam
,
&
info
);
if
(
info
.
type
==
SHADER_PARAM_TEXTURE
)
if
(
info
.
type
==
SHADER_PARAM_TEXTURE
)
shader_settexture
(
shader
,
param
->
sparam
,
NULL
);
shader_settexture
(
param
->
sparam
,
NULL
);
}
}
}
}
...
...
libobs/graphics/graphics-imports.c
浏览文件 @
caf8ca9b
...
@@ -149,9 +149,9 @@ bool load_graphics_imports(struct gs_exports *exports, void *module,
...
@@ -149,9 +149,9 @@ bool load_graphics_imports(struct gs_exports *exports, void *module,
GRAPHICS_IMPORT
(
shader_numparams
);
GRAPHICS_IMPORT
(
shader_numparams
);
GRAPHICS_IMPORT
(
shader_getparambyidx
);
GRAPHICS_IMPORT
(
shader_getparambyidx
);
GRAPHICS_IMPORT
(
shader_getparambyname
);
GRAPHICS_IMPORT
(
shader_getparambyname
);
GRAPHICS_IMPORT
(
shader_getparaminfo
);
GRAPHICS_IMPORT
(
shader_getviewprojmatrix
);
GRAPHICS_IMPORT
(
shader_getviewprojmatrix
);
GRAPHICS_IMPORT
(
shader_getworldmatrix
);
GRAPHICS_IMPORT
(
shader_getworldmatrix
);
GRAPHICS_IMPORT
(
shader_getparaminfo
);
GRAPHICS_IMPORT
(
shader_setbool
);
GRAPHICS_IMPORT
(
shader_setbool
);
GRAPHICS_IMPORT
(
shader_setfloat
);
GRAPHICS_IMPORT
(
shader_setfloat
);
GRAPHICS_IMPORT
(
shader_setint
);
GRAPHICS_IMPORT
(
shader_setint
);
...
...
libobs/graphics/graphics-internal.h
浏览文件 @
caf8ca9b
...
@@ -177,28 +177,21 @@ struct gs_exports {
...
@@ -177,28 +177,21 @@ struct gs_exports {
int
(
*
shader_numparams
)(
shader_t
shader
);
int
(
*
shader_numparams
)(
shader_t
shader
);
sparam_t
(
*
shader_getparambyidx
)(
shader_t
shader
,
uint32_t
param
);
sparam_t
(
*
shader_getparambyidx
)(
shader_t
shader
,
uint32_t
param
);
sparam_t
(
*
shader_getparambyname
)(
shader_t
shader
,
const
char
*
name
);
sparam_t
(
*
shader_getparambyname
)(
shader_t
shader
,
const
char
*
name
);
void
(
*
shader_getparaminfo
)(
shader_t
shader
,
sparam_t
param
,
struct
shader_param_info
*
info
);
sparam_t
(
*
shader_getviewprojmatrix
)(
shader_t
shader
);
sparam_t
(
*
shader_getviewprojmatrix
)(
shader_t
shader
);
sparam_t
(
*
shader_getworldmatrix
)(
shader_t
shader
);
sparam_t
(
*
shader_getworldmatrix
)(
shader_t
shader
);
void
(
*
shader_setbool
)(
shader_t
shader
,
sparam_t
param
,
bool
val
);
void
(
*
shader_getparaminfo
)(
sparam_t
param
,
void
(
*
shader_setfloat
)(
shader_t
shader
,
sparam_t
param
,
float
val
);
struct
shader_param_info
*
info
);
void
(
*
shader_setint
)(
shader_t
shader
,
sparam_t
param
,
int
val
);
void
(
*
shader_setbool
)(
sparam_t
param
,
bool
val
);
void
(
*
shader_setmatrix3
)(
shader_t
shader
,
sparam_t
param
,
void
(
*
shader_setfloat
)(
sparam_t
param
,
float
val
);
const
struct
matrix3
*
val
);
void
(
*
shader_setint
)(
sparam_t
param
,
int
val
);
void
(
*
shader_setmatrix4
)(
shader_t
shader
,
sparam_t
param
,
void
(
*
shader_setmatrix3
)(
sparam_t
param
,
const
struct
matrix3
*
val
);
const
struct
matrix4
*
val
);
void
(
*
shader_setmatrix4
)(
sparam_t
param
,
const
struct
matrix4
*
val
);
void
(
*
shader_setvec2
)(
shader_t
shader
,
sparam_t
param
,
void
(
*
shader_setvec2
)(
sparam_t
param
,
const
struct
vec2
*
val
);
const
struct
vec2
*
val
);
void
(
*
shader_setvec3
)(
sparam_t
param
,
const
struct
vec3
*
val
);
void
(
*
shader_setvec3
)(
shader_t
shader
,
sparam_t
param
,
void
(
*
shader_setvec4
)(
sparam_t
param
,
const
struct
vec4
*
val
);
const
struct
vec3
*
val
);
void
(
*
shader_settexture
)(
sparam_t
param
,
texture_t
val
);
void
(
*
shader_setvec4
)(
shader_t
shader
,
sparam_t
param
,
void
(
*
shader_setval
)(
sparam_t
param
,
const
void
*
val
,
size_t
size
);
const
struct
vec4
*
val
);
void
(
*
shader_setdefault
)(
sparam_t
param
);
void
(
*
shader_settexture
)(
shader_t
shader
,
sparam_t
param
,
texture_t
val
);
void
(
*
shader_setval
)(
shader_t
shader
,
sparam_t
param
,
const
void
*
val
,
size_t
size
);
void
(
*
shader_setdefault
)(
shader_t
shader
,
sparam_t
param
);
#ifdef __APPLE__
#ifdef __APPLE__
/* OSX/Cocoa specific functions */
/* OSX/Cocoa specific functions */
...
...
libobs/graphics/graphics.c
浏览文件 @
caf8ca9b
...
@@ -1509,15 +1509,6 @@ sparam_t shader_getparambyname(shader_t shader, const char *name)
...
@@ -1509,15 +1509,6 @@ sparam_t shader_getparambyname(shader_t shader, const char *name)
return
graphics
->
exports
.
shader_getparambyname
(
shader
,
name
);
return
graphics
->
exports
.
shader_getparambyname
(
shader
,
name
);
}
}
void
shader_getparaminfo
(
shader_t
shader
,
sparam_t
param
,
struct
shader_param_info
*
info
)
{
graphics_t
graphics
=
thread_graphics
;
if
(
!
graphics
||
!
shader
||
!
param
)
return
;
graphics
->
exports
.
shader_getparaminfo
(
shader
,
param
,
info
);
}
sparam_t
shader_getviewprojmatrix
(
shader_t
shader
)
sparam_t
shader_getviewprojmatrix
(
shader_t
shader
)
{
{
graphics_t
graphics
=
thread_graphics
;
graphics_t
graphics
=
thread_graphics
;
...
@@ -1534,98 +1525,100 @@ sparam_t shader_getworldmatrix(shader_t shader)
...
@@ -1534,98 +1525,100 @@ sparam_t shader_getworldmatrix(shader_t shader)
return
graphics
->
exports
.
shader_getworldmatrix
(
shader
);
return
graphics
->
exports
.
shader_getworldmatrix
(
shader
);
}
}
void
shader_setbool
(
shader_t
shader
,
sparam_t
param
,
bool
val
)
void
shader_getparaminfo
(
sparam_t
param
,
struct
shader_param_info
*
info
)
{
graphics_t
graphics
=
thread_graphics
;
if
(
!
graphics
||
!
param
)
return
;
graphics
->
exports
.
shader_getparaminfo
(
param
,
info
);
}
void
shader_setbool
(
sparam_t
param
,
bool
val
)
{
{
graphics_t
graphics
=
thread_graphics
;
graphics_t
graphics
=
thread_graphics
;
if
(
!
graphics
||
!
shader
||
!
param
)
return
;
if
(
!
graphics
||
!
param
)
return
;
graphics
->
exports
.
shader_setbool
(
shader
,
param
,
val
);
graphics
->
exports
.
shader_setbool
(
param
,
val
);
}
}
void
shader_setfloat
(
s
hader_t
shader
,
s
param_t
param
,
float
val
)
void
shader_setfloat
(
sparam_t
param
,
float
val
)
{
{
graphics_t
graphics
=
thread_graphics
;
graphics_t
graphics
=
thread_graphics
;
if
(
!
graphics
||
!
shader
||
!
param
)
return
;
if
(
!
graphics
||
!
param
)
return
;
graphics
->
exports
.
shader_setfloat
(
shader
,
param
,
val
);
graphics
->
exports
.
shader_setfloat
(
param
,
val
);
}
}
void
shader_setint
(
s
hader_t
shader
,
s
param_t
param
,
int
val
)
void
shader_setint
(
sparam_t
param
,
int
val
)
{
{
graphics_t
graphics
=
thread_graphics
;
graphics_t
graphics
=
thread_graphics
;
if
(
!
graphics
||
!
shader
||
!
param
)
return
;
if
(
!
graphics
||
!
param
)
return
;
graphics
->
exports
.
shader_setint
(
shader
,
param
,
val
);
graphics
->
exports
.
shader_setint
(
param
,
val
);
}
}
void
shader_setmatrix3
(
shader_t
shader
,
sparam_t
param
,
void
shader_setmatrix3
(
sparam_t
param
,
const
struct
matrix3
*
val
)
const
struct
matrix3
*
val
)
{
{
graphics_t
graphics
=
thread_graphics
;
graphics_t
graphics
=
thread_graphics
;
if
(
!
graphics
||
!
shader
||
!
param
)
return
;
if
(
!
graphics
||
!
param
)
return
;
graphics
->
exports
.
shader_setmatrix3
(
shader
,
param
,
val
);
graphics
->
exports
.
shader_setmatrix3
(
param
,
val
);
}
}
void
shader_setmatrix4
(
shader_t
shader
,
sparam_t
param
,
void
shader_setmatrix4
(
sparam_t
param
,
const
struct
matrix4
*
val
)
const
struct
matrix4
*
val
)
{
{
graphics_t
graphics
=
thread_graphics
;
graphics_t
graphics
=
thread_graphics
;
if
(
!
graphics
||
!
shader
||
!
param
)
return
;
if
(
!
graphics
||
!
param
)
return
;
graphics
->
exports
.
shader_setmatrix4
(
shader
,
param
,
val
);
graphics
->
exports
.
shader_setmatrix4
(
param
,
val
);
}
}
void
shader_setvec2
(
shader_t
shader
,
sparam_t
param
,
void
shader_setvec2
(
sparam_t
param
,
const
struct
vec2
*
val
)
const
struct
vec2
*
val
)
{
{
graphics_t
graphics
=
thread_graphics
;
graphics_t
graphics
=
thread_graphics
;
if
(
!
graphics
||
!
shader
||
!
param
)
return
;
if
(
!
graphics
||
!
param
)
return
;
graphics
->
exports
.
shader_setvec2
(
shader
,
param
,
val
);
graphics
->
exports
.
shader_setvec2
(
param
,
val
);
}
}
void
shader_setvec3
(
shader_t
shader
,
sparam_t
param
,
void
shader_setvec3
(
sparam_t
param
,
const
struct
vec3
*
val
)
const
struct
vec3
*
val
)
{
{
graphics_t
graphics
=
thread_graphics
;
graphics_t
graphics
=
thread_graphics
;
if
(
!
graphics
||
!
shader
||
!
param
)
return
;
if
(
!
graphics
||
!
param
)
return
;
graphics
->
exports
.
shader_setvec3
(
shader
,
param
,
val
);
graphics
->
exports
.
shader_setvec3
(
param
,
val
);
}
}
void
shader_setvec4
(
shader_t
shader
,
sparam_t
param
,
void
shader_setvec4
(
sparam_t
param
,
const
struct
vec4
*
val
)
const
struct
vec4
*
val
)
{
{
graphics_t
graphics
=
thread_graphics
;
graphics_t
graphics
=
thread_graphics
;
if
(
!
graphics
||
!
shader
||
!
param
)
return
;
if
(
!
graphics
||
!
param
)
return
;
graphics
->
exports
.
shader_setvec4
(
shader
,
param
,
val
);
graphics
->
exports
.
shader_setvec4
(
param
,
val
);
}
}
void
shader_settexture
(
s
hader_t
shader
,
s
param_t
param
,
texture_t
val
)
void
shader_settexture
(
sparam_t
param
,
texture_t
val
)
{
{
graphics_t
graphics
=
thread_graphics
;
graphics_t
graphics
=
thread_graphics
;
if
(
!
graphics
||
!
shader
||
!
param
)
return
;
if
(
!
graphics
||
!
param
)
return
;
graphics
->
exports
.
shader_settexture
(
shader
,
param
,
val
);
graphics
->
exports
.
shader_settexture
(
param
,
val
);
}
}
void
shader_setval
(
shader_t
shader
,
sparam_t
param
,
const
void
*
val
,
void
shader_setval
(
sparam_t
param
,
const
void
*
val
,
size_t
size
)
size_t
size
)
{
{
graphics_t
graphics
=
thread_graphics
;
graphics_t
graphics
=
thread_graphics
;
if
(
!
graphics
||
!
shader
||
!
param
)
return
;
if
(
!
graphics
||
!
param
)
return
;
graphics
->
exports
.
shader_setval
(
shader
,
param
,
val
,
size
);
graphics
->
exports
.
shader_setval
(
param
,
val
,
size
);
}
}
void
shader_setdefault
(
s
hader_t
shader
,
s
param_t
param
)
void
shader_setdefault
(
sparam_t
param
)
{
{
graphics_t
graphics
=
thread_graphics
;
graphics_t
graphics
=
thread_graphics
;
if
(
!
graphics
||
!
shader
||
!
param
)
return
;
if
(
!
graphics
||
!
param
)
return
;
graphics
->
exports
.
shader_setdefault
(
shader
,
param
);
graphics
->
exports
.
shader_setdefault
(
param
);
}
}
void
texture_destroy
(
texture_t
tex
)
void
texture_destroy
(
texture_t
tex
)
...
...
libobs/graphics/graphics.h
浏览文件 @
caf8ca9b
...
@@ -295,29 +295,22 @@ EXPORT void shader_destroy(shader_t shader);
...
@@ -295,29 +295,22 @@ EXPORT void shader_destroy(shader_t shader);
EXPORT
int
shader_numparams
(
shader_t
shader
);
EXPORT
int
shader_numparams
(
shader_t
shader
);
EXPORT
sparam_t
shader_getparambyidx
(
shader_t
shader
,
uint32_t
param
);
EXPORT
sparam_t
shader_getparambyidx
(
shader_t
shader
,
uint32_t
param
);
EXPORT
sparam_t
shader_getparambyname
(
shader_t
shader
,
const
char
*
name
);
EXPORT
sparam_t
shader_getparambyname
(
shader_t
shader
,
const
char
*
name
);
EXPORT
void
shader_getparaminfo
(
shader_t
shader
,
sparam_t
param
,
struct
shader_param_info
*
info
);
EXPORT
sparam_t
shader_getviewprojmatrix
(
shader_t
shader
);
EXPORT
sparam_t
shader_getviewprojmatrix
(
shader_t
shader
);
EXPORT
sparam_t
shader_getworldmatrix
(
shader_t
shader
);
EXPORT
sparam_t
shader_getworldmatrix
(
shader_t
shader
);
EXPORT
void
shader_setbool
(
shader_t
shader
,
sparam_t
param
,
bool
val
);
EXPORT
void
shader_getparaminfo
(
sparam_t
param
,
struct
shader_param_info
*
info
);
EXPORT
void
shader_setfloat
(
shader_t
shader
,
sparam_t
param
,
float
val
);
EXPORT
void
shader_setbool
(
sparam_t
param
,
bool
val
);
EXPORT
void
shader_setint
(
shader_t
shader
,
sparam_t
param
,
int
val
);
EXPORT
void
shader_setfloat
(
sparam_t
param
,
float
val
);
EXPORT
void
shader_setmatrix3
(
shader_t
shader
,
sparam_t
param
,
EXPORT
void
shader_setint
(
sparam_t
param
,
int
val
);
const
struct
matrix3
*
val
);
EXPORT
void
shader_setmatrix3
(
sparam_t
param
,
const
struct
matrix3
*
val
);
EXPORT
void
shader_setmatrix4
(
shader_t
shader
,
sparam_t
param
,
EXPORT
void
shader_setmatrix4
(
sparam_t
param
,
const
struct
matrix4
*
val
);
const
struct
matrix4
*
val
);
EXPORT
void
shader_setvec2
(
sparam_t
param
,
const
struct
vec2
*
val
);
EXPORT
void
shader_setvec2
(
shader_t
shader
,
sparam_t
param
,
EXPORT
void
shader_setvec3
(
sparam_t
param
,
const
struct
vec3
*
val
);
const
struct
vec2
*
val
);
EXPORT
void
shader_setvec4
(
sparam_t
param
,
const
struct
vec4
*
val
);
EXPORT
void
shader_setvec3
(
shader_t
shader
,
sparam_t
param
,
EXPORT
void
shader_settexture
(
sparam_t
param
,
texture_t
val
);
const
struct
vec3
*
val
);
EXPORT
void
shader_setval
(
sparam_t
param
,
const
void
*
val
,
size_t
size
);
EXPORT
void
shader_setvec4
(
shader_t
shader
,
sparam_t
param
,
EXPORT
void
shader_setdefault
(
sparam_t
param
);
const
struct
vec4
*
val
);
EXPORT
void
shader_settexture
(
shader_t
shader
,
sparam_t
param
,
texture_t
val
);
EXPORT
void
shader_setval
(
shader_t
shader
,
sparam_t
param
,
const
void
*
val
,
size_t
size
);
EXPORT
void
shader_setdefault
(
shader_t
shader
,
sparam_t
param
);
/* ---------------------------------------------------
/* ---------------------------------------------------
* effect functions
* effect functions
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录