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:
parent
f88adc4e82
commit
d522e19bab
@ -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: ",
|
||||
|
@ -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 },
|
||||
|
Loading…
Reference in New Issue
Block a user