mirror of
https://github.com/RPCSX/rpcsx.git
synced 2025-03-03 16:18:12 +00:00
Fragment: fix sin/cos
This commit is contained in:
parent
ad52614233
commit
df7f52b673
@ -10,6 +10,7 @@
|
||||
#include <util/unreachable.hpp>
|
||||
|
||||
#include <bit>
|
||||
#include <cmath>
|
||||
|
||||
using namespace amdgpu::shader;
|
||||
|
||||
@ -3831,6 +3832,9 @@ void convertVop1(Fragment &fragment, Vop1 inst) {
|
||||
auto src = spirv::cast<spirv::FloatValue>(
|
||||
fragment.getScalarOperand(inst.src0, TypeId::Float32).value);
|
||||
auto floatT = fragment.context->getFloat32Type();
|
||||
auto constant = spirv::cast<spirv::FloatValue>(
|
||||
fragment.getScalarOperand(248, TypeId::Float32).value); // 2pi
|
||||
src = fragment.builder.createFMul(floatT, src, constant);
|
||||
|
||||
auto glslStd450 = fragment.context->getGlslStd450();
|
||||
auto result = fragment.builder.createExtInst(floatT, glslStd450,
|
||||
@ -3843,6 +3847,9 @@ void convertVop1(Fragment &fragment, Vop1 inst) {
|
||||
auto src = spirv::cast<spirv::FloatValue>(
|
||||
fragment.getScalarOperand(inst.src0, TypeId::Float32).value);
|
||||
auto floatT = fragment.context->getFloat32Type();
|
||||
auto constant = spirv::cast<spirv::FloatValue>(
|
||||
fragment.getScalarOperand(248, TypeId::Float32).value); // 2pi
|
||||
src = fragment.builder.createFMul(floatT, src, constant);
|
||||
|
||||
auto glslStd450 = fragment.context->getGlslStd450();
|
||||
auto result = fragment.builder.createExtInst(floatT, glslStd450,
|
||||
@ -5620,6 +5627,8 @@ Value amdgpu::shader::Fragment::getRegister(RegisterId id) {
|
||||
return {context->getFloat32Type(), context->getFloat32(4.0f)};
|
||||
case 247:
|
||||
return {context->getFloat32Type(), context->getFloat32(-4.0f)};
|
||||
case 248:
|
||||
return {context->getFloat32Type(), context->getFloat32(M_PI * 2)};
|
||||
case 255: {
|
||||
context->dependencies->map(registers->pc,
|
||||
registers->pc + sizeof(std::uint32_t));
|
||||
|
Loading…
x
Reference in New Issue
Block a user