1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2024-12-04 07:24:15 +01:00

[spirv] Emit image types only once

Fixes SPIR-V validation errors.
This commit is contained in:
Philip Rebohle 2018-03-23 01:10:12 +01:00
parent abb90086d5
commit e6d93d6cfb
No known key found for this signature in database
GPG Key ID: C8CC613427A31C99
2 changed files with 12 additions and 28 deletions

View File

@ -576,10 +576,10 @@ namespace dxvk {
uint32_t SpirvModule::defPointerType( uint32_t SpirvModule::defPointerType(
uint32_t variableType, uint32_t variableType,
spv::StorageClass storageClass) { spv::StorageClass storageClass) {
std::array<uint32_t, 2> args = { std::array<uint32_t, 2> args = {{
storageClass, storageClass,
variableType, variableType,
}; }};
return this->defType(spv::OpTypePointer, return this->defType(spv::OpTypePointer,
args.size(), args.data()); args.size(), args.data());
@ -599,18 +599,17 @@ namespace dxvk {
uint32_t multisample, uint32_t multisample,
uint32_t sampled, uint32_t sampled,
spv::ImageFormat format) { spv::ImageFormat format) {
uint32_t resultId = this->allocateId(); std::array<uint32_t, 7> args = {{
sampledType,
dimensionality,
depth, arrayed,
multisample,
sampled,
format
}};
m_typeConstDefs.putIns (spv::OpTypeImage, 9); return this->defType(spv::OpTypeImage,
m_typeConstDefs.putWord(resultId); args.size(), args.data());
m_typeConstDefs.putWord(sampledType);
m_typeConstDefs.putWord(dimensionality);
m_typeConstDefs.putWord(depth);
m_typeConstDefs.putWord(arrayed);
m_typeConstDefs.putWord(multisample);
m_typeConstDefs.putWord(sampled);
m_typeConstDefs.putWord(format);
return resultId;
} }
@ -620,17 +619,6 @@ namespace dxvk {
} }
void SpirvModule::setImageTypeFormat(
uint32_t imageType,
spv::ImageFormat format) {
for (auto ins : m_typeConstDefs) {
if (ins.arg(1) == imageType
&& ins.arg(8) == spv::ImageFormatUnknown)
ins.setArg(8, format);
}
}
uint32_t SpirvModule::newVar( uint32_t SpirvModule::newVar(
uint32_t pointerType, uint32_t pointerType,
spv::StorageClass storageClass) { spv::StorageClass storageClass) {

View File

@ -254,10 +254,6 @@ namespace dxvk {
uint32_t defSampledImageType( uint32_t defSampledImageType(
uint32_t imageType); uint32_t imageType);
void setImageTypeFormat(
uint32_t imageType,
spv::ImageFormat format);
uint32_t newVar( uint32_t newVar(
uint32_t pointerType, uint32_t pointerType,
spv::StorageClass storageClass); spv::StorageClass storageClass);