mirror of
https://github.com/doitsujin/dxvk.git
synced 2024-12-01 07:24:12 +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) {
|
void DxbcCompiler::emitTextureSample(const DxbcShaderInstruction& ins) {
|
||||||
// TODO support remaining sample ops
|
|
||||||
|
|
||||||
// All sample instructions have at least these operands:
|
// All sample instructions have at least these operands:
|
||||||
// (dst0) The destination register
|
// (dst0) The destination register
|
||||||
// (src0) Texture coordinates
|
// (src0) Texture coordinates
|
||||||
@ -2622,10 +2620,11 @@ namespace dxvk {
|
|||||||
? emitRegisterLoad(ins.src[4], coordLayerMask)
|
? emitRegisterLoad(ins.src[4], coordLayerMask)
|
||||||
: DxbcRegisterValue();
|
: DxbcRegisterValue();
|
||||||
|
|
||||||
// Explicit LOD value for certain sample operations
|
// LOD for certain sample operations
|
||||||
const bool hasExplicitLod = ins.op == DxbcOpcode::SampleL;
|
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))
|
? emitRegisterLoad(ins.src[3], DxbcRegMask(true, false, false, false))
|
||||||
: DxbcRegisterValue();
|
: DxbcRegisterValue();
|
||||||
|
|
||||||
@ -2716,13 +2715,23 @@ namespace dxvk {
|
|||||||
// Sample operation with explicit LOD
|
// Sample operation with explicit LOD
|
||||||
case DxbcOpcode::SampleL: {
|
case DxbcOpcode::SampleL: {
|
||||||
imageOperands.flags |= spv::ImageOperandsLodMask;
|
imageOperands.flags |= spv::ImageOperandsLodMask;
|
||||||
imageOperands.sLod = explicitLod.id;
|
imageOperands.sLod = lod.id;
|
||||||
|
|
||||||
result.id = m_module.opImageSampleExplicitLod(
|
result.id = m_module.opImageSampleExplicitLod(
|
||||||
getVectorTypeId(result.type), sampledImageId, coord.id,
|
getVectorTypeId(result.type), sampledImageId, coord.id,
|
||||||
imageOperands);
|
imageOperands);
|
||||||
} break;
|
} 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:
|
default:
|
||||||
Logger::warn(str::format(
|
Logger::warn(str::format(
|
||||||
"DxbcCompiler: Unhandled instruction: ",
|
"DxbcCompiler: Unhandled instruction: ",
|
||||||
|
@ -372,7 +372,13 @@ namespace dxvk {
|
|||||||
{ DxbcOperandKind::SrcReg, DxbcScalarType::Float32 },
|
{ DxbcOperandKind::SrcReg, DxbcScalarType::Float32 },
|
||||||
} },
|
} },
|
||||||
/* SampleB */
|
/* 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 */
|
/* Sqrt */
|
||||||
{ 2, DxbcInstClass::VectorAlu, {
|
{ 2, DxbcInstClass::VectorAlu, {
|
||||||
{ DxbcOperandKind::DstReg, DxbcScalarType::Float32 },
|
{ DxbcOperandKind::DstReg, DxbcScalarType::Float32 },
|
||||||
|
Loading…
Reference in New Issue
Block a user