mirror of https://github.com/xemu-project/xemu.git
nv2a: Handle SET_SPECULAR_ENABLE
This commit is contained in:
parent
48d1195c27
commit
672e9cd553
|
@ -314,6 +314,7 @@
|
|||
# define NV_PGRAPH_CSV0_D_SKIN_4 6
|
||||
#define NV_PGRAPH_CSV0_C 0x00000FB8
|
||||
# define NV_PGRAPH_CSV0_C_CHEOPS_PROGRAM_START 0x0000FF00
|
||||
# define NV_PGRAPH_CSV0_C_SPECULAR_ENABLE (1 << 16)
|
||||
# define NV_PGRAPH_CSV0_C_SPECULAR (3 << 19)
|
||||
# define NV_PGRAPH_CSV0_C_DIFFUSE (3 << 21)
|
||||
# define NV_PGRAPH_CSV0_C_AMBIENT (3 << 23)
|
||||
|
@ -1015,6 +1016,7 @@
|
|||
# define NV097_SET_NORMALIZATION_ENABLE 0x000003A4
|
||||
# define NV097_SET_MATERIAL_EMISSION 0x000003A8
|
||||
# define NV097_SET_MATERIAL_ALPHA 0x000003B4
|
||||
# define NV097_SET_SPECULAR_ENABLE 0x000003B8
|
||||
# define NV097_SET_LIGHT_ENABLE_MASK 0x000003BC
|
||||
# define NV097_SET_LIGHT_ENABLE_MASK_LIGHT0_OFF 0
|
||||
# define NV097_SET_LIGHT_ENABLE_MASK_LIGHT0_INFINITE 1
|
||||
|
|
|
@ -383,6 +383,11 @@ GLSL_DEFINE(materialEmissionColor, GLSL_LTCTXA(NV_IGRAPH_XF_LTCTXA_CM_COL) ".xyz
|
|||
mstring_append(body, " oD0 = diffuse;\n");
|
||||
mstring_append(body, " oD1 = specular;\n");
|
||||
}
|
||||
|
||||
if (!state->specular_enable) {
|
||||
mstring_append(body, " oD1 = vec4(0.0, 0.0, 0.0, 1.0);\n");
|
||||
}
|
||||
|
||||
mstring_append(body, " oB0 = backDiffuse;\n");
|
||||
mstring_append(body, " oB1 = backSpecular;\n");
|
||||
|
||||
|
|
|
@ -34,7 +34,6 @@ MString *pgraph_gen_vsh_glsl(const ShaderState *state, bool prefix_outputs)
|
|||
mstring_append_fmt(output, "#version %d\n\n", state->vulkan ? 450 : 400);
|
||||
|
||||
MString *header = mstring_from_str("");
|
||||
|
||||
MString *uniforms = mstring_from_str("");
|
||||
|
||||
const char *u = state->vulkan ? "" : "uniform "; // FIXME: Remove
|
||||
|
@ -243,9 +242,7 @@ MString *pgraph_gen_vsh_glsl(const ShaderState *state, bool prefix_outputs)
|
|||
/* Set outputs */
|
||||
mstring_append(body, "\n"
|
||||
" vtxD0 = clamp(oD0, 0.0, 1.0);\n"
|
||||
" vtxD1 = clamp(oD1, 0.0, 1.0);\n"
|
||||
" vtxB0 = clamp(oB0, 0.0, 1.0);\n"
|
||||
" vtxB1 = clamp(oB1, 0.0, 1.0);\n"
|
||||
" vtxFog = oFog.x;\n"
|
||||
" vtxT0 = oT0;\n"
|
||||
" vtxT1 = oT1;\n"
|
||||
|
@ -254,6 +251,18 @@ MString *pgraph_gen_vsh_glsl(const ShaderState *state, bool prefix_outputs)
|
|||
" gl_PointSize = oPts.x;\n"
|
||||
);
|
||||
|
||||
if (state->specular_enable) {
|
||||
mstring_append(body,
|
||||
" vtxD1 = clamp(oD1, 0.0, 1.0);\n"
|
||||
" vtxB1 = clamp(oB1, 0.0, 1.0);\n"
|
||||
);
|
||||
} else {
|
||||
mstring_append(body,
|
||||
" vtxD1 = vec4(0.0, 0.0, 0.0, 1.0);\n"
|
||||
" vtxB1 = vec4(0.0, 0.0, 0.0, 1.0);\n"
|
||||
);
|
||||
}
|
||||
|
||||
if (state->vulkan) {
|
||||
mstring_append(body,
|
||||
" gl_Position = oPos;\n"
|
||||
|
|
|
@ -78,6 +78,7 @@ DEF_METHOD(NV097, SET_FRONT_FACE)
|
|||
DEF_METHOD(NV097, SET_NORMALIZATION_ENABLE)
|
||||
DEF_METHOD_RANGE(NV097, SET_MATERIAL_EMISSION, 3)
|
||||
DEF_METHOD(NV097, SET_MATERIAL_ALPHA)
|
||||
DEF_METHOD(NV097, SET_SPECULAR_ENABLE)
|
||||
DEF_METHOD(NV097, SET_LIGHT_ENABLE_MASK)
|
||||
DEF_METHOD_CASE_4(NV097, SET_TEXGEN_S, 16)
|
||||
DEF_METHOD_CASE_4(NV097, SET_TEXGEN_T, 16)
|
||||
|
|
|
@ -1619,6 +1619,11 @@ DEF_METHOD(NV097, SET_MATERIAL_ALPHA)
|
|||
pg->material_alpha = *(float*)¶meter;
|
||||
}
|
||||
|
||||
DEF_METHOD(NV097, SET_SPECULAR_ENABLE)
|
||||
{
|
||||
PG_SET_MASK(NV_PGRAPH_CSV0_C, NV_PGRAPH_CSV0_C_SPECULAR_ENABLE, parameter);
|
||||
}
|
||||
|
||||
DEF_METHOD(NV097, SET_LIGHT_ENABLE_MASK)
|
||||
{
|
||||
PG_SET_MASK(NV_PGRAPH_CSV0_D, NV_PGRAPH_CSV0_D_LIGHTS, parameter);
|
||||
|
@ -3022,4 +3027,3 @@ void pgraph_pre_shutdown_wait(NV2AState *d)
|
|||
PGRAPHState *pg = &d->pgraph;
|
||||
pg->renderer->ops.pre_shutdown_wait(d);
|
||||
}
|
||||
|
||||
|
|
|
@ -69,6 +69,8 @@ ShaderState pgraph_get_shader_state(PGRAPHState *pg)
|
|||
pgraph_reg_r(pg, NV_PGRAPH_SHADOWCTL), NV_PGRAPH_SHADOWCTL_SHADOW_ZFUNC);
|
||||
|
||||
state.fixed_function = fixed_function;
|
||||
state.specular_enable = GET_MASK(pgraph_reg_r(pg, NV_PGRAPH_CSV0_C),
|
||||
NV_PGRAPH_CSV0_C_SPECULAR_ENABLE);
|
||||
|
||||
/* fixed function stuff */
|
||||
if (fixed_function) {
|
||||
|
|
|
@ -83,6 +83,7 @@ typedef struct ShaderState {
|
|||
enum VshLight light[NV2A_MAX_LIGHTS];
|
||||
|
||||
bool fixed_function;
|
||||
bool specular_enable;
|
||||
|
||||
/* vertex program */
|
||||
bool vertex_program;
|
||||
|
|
Loading…
Reference in New Issue