mirror of
https://github.com/mborgerson/xemu.git
synced 2025-12-01 16:10:01 +00:00
nv2a/glsl: Simplify some mstring uses in pgraph_glsl_gen_vsh
This commit is contained in:
committed by
mborgerson
parent
8a606ae37f
commit
f2c5b80951
@ -163,12 +163,7 @@ void pgraph_glsl_set_vsh_state(PGRAPHState *pg, VshState *vsh)
|
|||||||
|
|
||||||
MString *pgraph_glsl_gen_vsh(const VshState *state, GenVshGlslOptions opts)
|
MString *pgraph_glsl_gen_vsh(const VshState *state, GenVshGlslOptions opts)
|
||||||
{
|
{
|
||||||
MString *output =
|
MString *uniforms = mstring_new();
|
||||||
mstring_from_fmt("#version %d\n\n", opts.vulkan ? 450 : 400);
|
|
||||||
|
|
||||||
MString *header = mstring_from_str("");
|
|
||||||
|
|
||||||
MString *uniforms = mstring_from_str("");
|
|
||||||
const char *u = opts.vulkan ? "" : "uniform ";
|
const char *u = opts.vulkan ? "" : "uniform ";
|
||||||
for (int i = 0; i < ARRAY_SIZE(VshUniformInfo); i++) {
|
for (int i = 0; i < ARRAY_SIZE(VshUniformInfo); i++) {
|
||||||
const UniformInfo *info = &VshUniformInfo[i];
|
const UniformInfo *info = &VshUniformInfo[i];
|
||||||
@ -186,7 +181,7 @@ MString *pgraph_glsl_gen_vsh(const VshState *state, GenVshGlslOptions opts)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
mstring_append(header,
|
MString *header = mstring_from_str(
|
||||||
GLSL_DEFINE(fogPlane, GLSL_C(NV_IGRAPH_XF_XFCTX_FOG))
|
GLSL_DEFINE(fogPlane, GLSL_C(NV_IGRAPH_XF_XFCTX_FOG))
|
||||||
GLSL_DEFINE(texMat0, GLSL_C_MAT4(NV_IGRAPH_XF_XFCTX_T0MAT))
|
GLSL_DEFINE(texMat0, GLSL_C_MAT4(NV_IGRAPH_XF_XFCTX_T0MAT))
|
||||||
GLSL_DEFINE(texMat1, GLSL_C_MAT4(NV_IGRAPH_XF_XFCTX_T1MAT))
|
GLSL_DEFINE(texMat1, GLSL_C_MAT4(NV_IGRAPH_XF_XFCTX_T1MAT))
|
||||||
@ -433,6 +428,9 @@ MString *pgraph_glsl_gen_vsh(const VshState *state, GenVshGlslOptions opts)
|
|||||||
mstring_append(body, "}\n");
|
mstring_append(body, "}\n");
|
||||||
|
|
||||||
/* Return combined header + source */
|
/* Return combined header + source */
|
||||||
|
MString *output =
|
||||||
|
mstring_from_fmt("#version %d\n\n", opts.vulkan ? 450 : 400);
|
||||||
|
|
||||||
if (opts.vulkan) {
|
if (opts.vulkan) {
|
||||||
// FIXME: Optimize uniforms
|
// FIXME: Optimize uniforms
|
||||||
if (num_uniform_attrs > 0) {
|
if (num_uniform_attrs > 0) {
|
||||||
@ -462,6 +460,7 @@ MString *pgraph_glsl_gen_vsh(const VshState *state, GenVshGlslOptions opts)
|
|||||||
|
|
||||||
mstring_append(output, mstring_get_str(body));
|
mstring_append(output, mstring_get_str(body));
|
||||||
mstring_unref(body);
|
mstring_unref(body);
|
||||||
|
|
||||||
return output;
|
return output;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user