Commit 47464252 authored by Joshua Ashton's avatar Joshua Ashton 🐸

[d3d9, dxso] Move shared fs/dxso constant defs to fixed function code

parent d36cffb8
......@@ -358,6 +358,53 @@ namespace dxvk {
}
uint32_t GetSharedConstants(SpirvModule& spvModule) {
uint32_t float_t = spvModule.defFloatType(32);
uint32_t vec2_t = spvModule.defVectorType(float_t, 2);
std::array<uint32_t, 4> stageMembers = {
vec2_t,
vec2_t,
float_t,
float_t,
};
std::array<decltype(stageMembers), caps::TextureStageCount> members;
for (auto& member : members)
member = stageMembers;
const uint32_t structType =
spvModule.defStructType(members.size() * stageMembers.size(), members[0].data());
spvModule.decorateBlock(structType);
uint32_t offset = 0;
for (uint32_t stage = 0; stage < caps::TextureStageCount; stage++) {
spvModule.memberDecorateOffset(structType, stage + 0, offset);
offset += sizeof(float) * 2;
spvModule.memberDecorateOffset(structType, stage + 1, offset);
offset += sizeof(float) * 2;
spvModule.memberDecorateOffset(structType, stage + 2, offset);
offset += sizeof(float);
spvModule.memberDecorateOffset(structType, stage + 3, offset);
offset += sizeof(float);
}
uint32_t sharedState = spvModule.newVar(
spvModule.defPointerType(structType, spv::StorageClassUniform),
spv::StorageClassUniform);
spvModule.setDebugName(sharedState, "D3D9SharedPS");
return sharedState;
}
enum FFConstantMembersVS {
VSConstWorldViewMatrix = 0,
VSConstNormalMatrix = 1,
......
......@@ -61,6 +61,8 @@ namespace dxvk {
uint32_t GetPointCoord(SpirvModule& spvModule, std::vector<uint32_t>& entryPointInterfaces);
uint32_t GetSharedConstants(SpirvModule& spvModule);
constexpr uint32_t TCIOffset = 16;
constexpr uint32_t TCIMask = 0b111 << TCIOffset;
......
......@@ -398,44 +398,7 @@ namespace dxvk {
void DxsoCompiler::emitPsSharedConstants() {
std::array<uint32_t, 4> stageMembers = {
getVectorTypeId({DxsoScalarType::Float32, 2}),
getVectorTypeId({DxsoScalarType::Float32, 2}),
getScalarTypeId(DxsoScalarType::Float32),
getScalarTypeId(DxsoScalarType::Float32),
};
std::array<decltype(stageMembers), caps::TextureStageCount> members;
for (auto& member : members)
member = stageMembers;
const uint32_t structType =
m_module.defStructType(members.size() * stageMembers.size(), members[0].data());
m_module.decorateBlock(structType);
uint32_t offset = 0;
for (uint32_t stage = 0; stage < caps::TextureStageCount; stage++) {
m_module.memberDecorateOffset(structType, stage + 0, offset);
offset += sizeof(float) * 2;
m_module.memberDecorateOffset(structType, stage + 1, offset);
offset += sizeof(float) * 2;
m_module.memberDecorateOffset(structType, stage + 2, offset);
offset += sizeof(float);
m_module.memberDecorateOffset(structType, stage + 3, offset);
offset += sizeof(float);
}
m_ps.sharedState = m_module.newVar(
m_module.defPointerType(structType, spv::StorageClassUniform),
spv::StorageClassUniform);
m_module.setDebugName(m_ps.sharedState, "D3D9SharedPS");
m_ps.sharedState = GetSharedConstants(m_module);
const uint32_t bindingId = computeResourceSlotId(
m_programInfo.type(), DxsoBindingType::ConstantBuffer,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment