mirror of
https://github.com/EduApps-CDG/OpenDX
synced 2024-12-30 09:45:37 +01:00
[dxbc] Implemented SampleInfo instruction
This commit is contained in:
parent
76d48fcdf5
commit
54108726d5
@ -88,6 +88,9 @@ namespace dxvk {
|
|||||||
case DxbcInstClass::TextureQuery:
|
case DxbcInstClass::TextureQuery:
|
||||||
return this->emitTextureQuery(ins);
|
return this->emitTextureQuery(ins);
|
||||||
|
|
||||||
|
case DxbcInstClass::TextureQueryMs:
|
||||||
|
return this->emitTextureQueryMs(ins);
|
||||||
|
|
||||||
case DxbcInstClass::TextureFetch:
|
case DxbcInstClass::TextureFetch:
|
||||||
return this->emitTextureFetch(ins);
|
return this->emitTextureFetch(ins);
|
||||||
|
|
||||||
@ -2280,6 +2283,25 @@ namespace dxvk {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void DxbcCompiler::emitTextureQueryMs(const DxbcShaderInstruction& ins) {
|
||||||
|
// sampleinfo has two operands:
|
||||||
|
// (dst0) The destination register
|
||||||
|
// (src0) Resource to query
|
||||||
|
// TODO Check if resource is bound
|
||||||
|
DxbcRegisterValue sampleCount = emitQueryTextureSamples(ins.src[0]);
|
||||||
|
|
||||||
|
if (ins.controls.resinfoType != DxbcResinfoType::Uint) {
|
||||||
|
sampleCount.type.ctype = DxbcScalarType::Float32;
|
||||||
|
sampleCount.type.ccount = 1;
|
||||||
|
sampleCount.id = m_module.opConvertUtoF(
|
||||||
|
getVectorTypeId(sampleCount.type),
|
||||||
|
sampleCount.id);
|
||||||
|
}
|
||||||
|
|
||||||
|
emitRegisterStore(ins.dst[0], sampleCount);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void DxbcCompiler::emitTextureFetch(const DxbcShaderInstruction& ins) {
|
void DxbcCompiler::emitTextureFetch(const DxbcShaderInstruction& ins) {
|
||||||
// ld has three operands:
|
// ld has three operands:
|
||||||
// (dst0) The destination register
|
// (dst0) The destination register
|
||||||
@ -2502,9 +2524,11 @@ namespace dxvk {
|
|||||||
DxbcRegisterValue result;
|
DxbcRegisterValue result;
|
||||||
result.type.ctype = m_textures.at(textureId).sampledType;
|
result.type.ctype = m_textures.at(textureId).sampledType;
|
||||||
result.type.ccount = 4;
|
result.type.ccount = 4;
|
||||||
|
|
||||||
switch (ins.op) {
|
switch (ins.op) {
|
||||||
// Simple image gather operation
|
// Simple image gather operation
|
||||||
case DxbcOpcode::Gather4: {
|
case DxbcOpcode::Gather4:
|
||||||
|
case DxbcOpcode::Gather4Po: {
|
||||||
result.id = m_module.opImageGather(
|
result.id = m_module.opImageGather(
|
||||||
getVectorTypeId(result.type), sampledImageId, coord.id,
|
getVectorTypeId(result.type), sampledImageId, coord.id,
|
||||||
m_module.constu32(samplerReg.swizzle[0]),
|
m_module.constu32(samplerReg.swizzle[0]),
|
||||||
@ -2512,7 +2536,8 @@ namespace dxvk {
|
|||||||
} break;
|
} break;
|
||||||
|
|
||||||
// Depth-compare operation
|
// Depth-compare operation
|
||||||
case DxbcOpcode::Gather4C: {
|
case DxbcOpcode::Gather4C:
|
||||||
|
case DxbcOpcode::Gather4PoC: {
|
||||||
result.id = m_module.opImageDrefGather(
|
result.id = m_module.opImageDrefGather(
|
||||||
getVectorTypeId(result.type), sampledImageId, coord.id,
|
getVectorTypeId(result.type), sampledImageId, coord.id,
|
||||||
referenceValue.id, imageOperands);
|
referenceValue.id, imageOperands);
|
||||||
@ -3924,6 +3949,20 @@ namespace dxvk {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
DxbcRegisterValue DxbcCompiler::emitQueryTextureSamples(
|
||||||
|
const DxbcRegister& resource) {
|
||||||
|
const DxbcBufferInfo info = getBufferInfo(resource);
|
||||||
|
|
||||||
|
DxbcRegisterValue result;
|
||||||
|
result.type.ctype = DxbcScalarType::Uint32;
|
||||||
|
result.type.ccount = 1;
|
||||||
|
result.id = m_module.opImageQuerySamples(
|
||||||
|
getVectorTypeId(result.type),
|
||||||
|
m_module.opLoad(info.typeId, info.varId));
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
DxbcRegisterValue DxbcCompiler::emitQueryTextureSize(
|
DxbcRegisterValue DxbcCompiler::emitQueryTextureSize(
|
||||||
const DxbcRegister& resource,
|
const DxbcRegister& resource,
|
||||||
DxbcRegisterValue lod) {
|
DxbcRegisterValue lod) {
|
||||||
|
@ -524,6 +524,9 @@ namespace dxvk {
|
|||||||
void emitTextureQuery(
|
void emitTextureQuery(
|
||||||
const DxbcShaderInstruction& ins);
|
const DxbcShaderInstruction& ins);
|
||||||
|
|
||||||
|
void emitTextureQueryMs(
|
||||||
|
const DxbcShaderInstruction& ins);
|
||||||
|
|
||||||
void emitTextureFetch(
|
void emitTextureFetch(
|
||||||
const DxbcShaderInstruction& ins);
|
const DxbcShaderInstruction& ins);
|
||||||
|
|
||||||
@ -703,6 +706,9 @@ namespace dxvk {
|
|||||||
DxbcRegisterValue emitQueryTextureLods(
|
DxbcRegisterValue emitQueryTextureLods(
|
||||||
const DxbcRegister& resource);
|
const DxbcRegister& resource);
|
||||||
|
|
||||||
|
DxbcRegisterValue emitQueryTextureSamples(
|
||||||
|
const DxbcRegister& resource);
|
||||||
|
|
||||||
DxbcRegisterValue emitQueryTextureSize(
|
DxbcRegisterValue emitQueryTextureSize(
|
||||||
const DxbcRegister& resource,
|
const DxbcRegister& resource,
|
||||||
DxbcRegisterValue lod);
|
DxbcRegisterValue lod);
|
||||||
|
@ -547,7 +547,10 @@ namespace dxvk {
|
|||||||
/* SamplePos */
|
/* SamplePos */
|
||||||
{ },
|
{ },
|
||||||
/* SampleInfo */
|
/* SampleInfo */
|
||||||
{ },
|
{ 2, DxbcInstClass::TextureQueryMs, {
|
||||||
|
{ DxbcOperandKind::DstReg, DxbcScalarType::Uint32 },
|
||||||
|
{ DxbcOperandKind::SrcReg, DxbcScalarType::Float32 },
|
||||||
|
} },
|
||||||
/* Reserved1 */
|
/* Reserved1 */
|
||||||
{ },
|
{ },
|
||||||
/* HsDecls */
|
/* HsDecls */
|
||||||
|
@ -42,6 +42,7 @@ namespace dxvk {
|
|||||||
BufferStore, ///< Structured or raw buffer store
|
BufferStore, ///< Structured or raw buffer store
|
||||||
ConvertFloat16, ///< 16-bit float packing/unpacking
|
ConvertFloat16, ///< 16-bit float packing/unpacking
|
||||||
TextureQuery, ///< Texture query instruction
|
TextureQuery, ///< Texture query instruction
|
||||||
|
TextureQueryMs, ///< Multisample texture query
|
||||||
TextureFetch, ///< Texture fetch instruction
|
TextureFetch, ///< Texture fetch instruction
|
||||||
TextureGather, ///< Texture gather instruction
|
TextureGather, ///< Texture gather instruction
|
||||||
TextureSample, ///< Texture sampling instruction
|
TextureSample, ///< Texture sampling instruction
|
||||||
|
@ -2400,6 +2400,19 @@ namespace dxvk {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
uint32_t SpirvModule::opImageQuerySamples(
|
||||||
|
uint32_t resultType,
|
||||||
|
uint32_t image) {
|
||||||
|
uint32_t resultId = this->allocateId();
|
||||||
|
|
||||||
|
m_code.putIns (spv::OpImageQuerySamples, 4);
|
||||||
|
m_code.putWord(resultType);
|
||||||
|
m_code.putWord(resultId);
|
||||||
|
m_code.putWord(image);
|
||||||
|
return resultId;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
uint32_t SpirvModule::opImageFetch(
|
uint32_t SpirvModule::opImageFetch(
|
||||||
uint32_t resultType,
|
uint32_t resultType,
|
||||||
uint32_t image,
|
uint32_t image,
|
||||||
|
@ -840,6 +840,10 @@ namespace dxvk {
|
|||||||
uint32_t resultType,
|
uint32_t resultType,
|
||||||
uint32_t image);
|
uint32_t image);
|
||||||
|
|
||||||
|
uint32_t opImageQuerySamples(
|
||||||
|
uint32_t resultType,
|
||||||
|
uint32_t image);
|
||||||
|
|
||||||
uint32_t opImageFetch(
|
uint32_t opImageFetch(
|
||||||
uint32_t resultType,
|
uint32_t resultType,
|
||||||
uint32_t image,
|
uint32_t image,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user