1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2024-11-30 22:24:15 +01:00

[dxbc] Implemented SampleB instruction

This commit is contained in:
Philip Rebohle 2018-01-20 10:21:27 +01:00
parent f88adc4e82
commit d522e19bab
No known key found for this signature in database
GPG Key ID: C8CC613427A31C99
2 changed files with 22 additions and 7 deletions

View File

@ -2564,8 +2564,6 @@ namespace dxvk {
void DxbcCompiler::emitTextureSample(const DxbcShaderInstruction& ins) {
// TODO support remaining sample ops
// All sample instructions have at least these operands:
// (dst0) The destination register
// (src0) Texture coordinates
@ -2622,10 +2620,11 @@ namespace dxvk {
? emitRegisterLoad(ins.src[4], coordLayerMask)
: DxbcRegisterValue();
// Explicit LOD value for certain sample operations
const bool hasExplicitLod = ins.op == DxbcOpcode::SampleL;
// LOD for certain sample operations
const bool hasLod = ins.op == DxbcOpcode::SampleL
|| ins.op == DxbcOpcode::SampleB;
const DxbcRegisterValue explicitLod = hasExplicitLod
const DxbcRegisterValue lod = hasLod
? emitRegisterLoad(ins.src[3], DxbcRegMask(true, false, false, false))
: DxbcRegisterValue();
@ -2716,13 +2715,23 @@ namespace dxvk {
// Sample operation with explicit LOD
case DxbcOpcode::SampleL: {
imageOperands.flags |= spv::ImageOperandsLodMask;
imageOperands.sLod = explicitLod.id;
imageOperands.sLod = lod.id;
result.id = m_module.opImageSampleExplicitLod(
getVectorTypeId(result.type), sampledImageId, coord.id,
imageOperands);
} break;
// Sample operation with LOD bias
case DxbcOpcode::SampleB: {
imageOperands.flags |= spv::ImageOperandsBiasMask;
imageOperands.sLodBias = lod.id;
result.id = m_module.opImageSampleImplicitLod(
getVectorTypeId(result.type), sampledImageId, coord.id,
imageOperands);
} break;
default:
Logger::warn(str::format(
"DxbcCompiler: Unhandled instruction: ",

View File

@ -372,7 +372,13 @@ namespace dxvk {
{ DxbcOperandKind::SrcReg, DxbcScalarType::Float32 },
} },
/* SampleB */
{ },
{ 5, DxbcInstClass::TextureSample, {
{ DxbcOperandKind::DstReg, DxbcScalarType::Float32 },
{ DxbcOperandKind::SrcReg, DxbcScalarType::Float32 },
{ DxbcOperandKind::SrcReg, DxbcScalarType::Float32 },
{ DxbcOperandKind::SrcReg, DxbcScalarType::Float32 },
{ DxbcOperandKind::SrcReg, DxbcScalarType::Float32 },
} },
/* Sqrt */
{ 2, DxbcInstClass::VectorAlu, {
{ DxbcOperandKind::DstReg, DxbcScalarType::Float32 },