mirror of
https://github.com/xemu-project/xemu.git
synced 2024-12-02 16:46:59 +00:00
nv2a: Fix EXP and LOG
According to the NV_vertex_program specification, our implementations of these functions were wrong. spec: https://www.khronos.org/registry/OpenGL/extensions/NV/NV_vertex_program.txt
This commit is contained in:
parent
667fe8536d
commit
c01c27d968
@ -674,13 +674,25 @@ static const char* vsh_header =
|
||||
"#define EXP(dest, mask, src) dest.mask = _EXP(_in(src).x).mask\n"
|
||||
"vec4 _EXP(float src)\n"
|
||||
"{\n"
|
||||
" return vec4(exp2(src));\n"
|
||||
" vec4 result;\n"
|
||||
" result.x = exp2(floor(src));\n"
|
||||
" result.y = src - floor(src);\n"
|
||||
" result.z = exp2(src);\n"
|
||||
" result.w = 1.0;\n"
|
||||
" return result;\n"
|
||||
"}\n"
|
||||
"\n"
|
||||
"#define LOG(dest, mask, src) dest.mask = _LOG(_in(src).x).mask\n"
|
||||
"vec4 _LOG(float src)\n"
|
||||
"{\n"
|
||||
" return vec4(log2(src));\n"
|
||||
" float tmp = abs(src);\n"
|
||||
" if (tmp == 0.0) { return vec4(-INFINITY, 1.0f, -INFINITY, 1.0f); }\n"
|
||||
" vec4 result;\n"
|
||||
" result.x = floor(log2(tmp));\n"
|
||||
" result.y = tmp / exp2(floor(log2(tmp)));\n"
|
||||
" result.z = log2(tmp);\n"
|
||||
" result.w = 1.0;\n"
|
||||
" return result;\n"
|
||||
"}\n"
|
||||
"\n"
|
||||
"#define LIT(dest, mask, src) dest.mask = _LIT(_in(src)).mask\n"
|
||||
|
Loading…
Reference in New Issue
Block a user