mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-03-13 19:29:14 +01:00
[dxvk] Remove old code to process specialization constants
We barely use spec constants anymore, so a much simpler solution will do.
This commit is contained in:
parent
b2969f628f
commit
db786cda6c
@ -5,7 +5,6 @@
|
||||
#include "d3d9_spec_constants.h"
|
||||
|
||||
#include "../dxvk/dxvk_hash.h"
|
||||
#include "../dxvk/dxvk_spec_const.h"
|
||||
|
||||
#include "../spirv/spirv_module.h"
|
||||
|
||||
|
@ -9,8 +9,6 @@
|
||||
#include "../d3d9/d3d9_fixed_function.h"
|
||||
#include "dxso_util.h"
|
||||
|
||||
#include "../dxvk/dxvk_spec_const.h"
|
||||
|
||||
#include <cfloat>
|
||||
|
||||
namespace dxvk {
|
||||
|
@ -6,7 +6,6 @@
|
||||
#include "dxvk_device.h"
|
||||
#include "dxvk_graphics.h"
|
||||
#include "dxvk_pipemanager.h"
|
||||
#include "dxvk_spec_const.h"
|
||||
#include "dxvk_state_cache.h"
|
||||
|
||||
namespace dxvk {
|
||||
|
@ -5,7 +5,6 @@
|
||||
#include "dxvk_device.h"
|
||||
#include "dxvk_graphics.h"
|
||||
#include "dxvk_pipemanager.h"
|
||||
#include "dxvk_spec_const.h"
|
||||
#include "dxvk_state_cache.h"
|
||||
|
||||
namespace dxvk {
|
||||
|
@ -1,36 +0,0 @@
|
||||
#include "dxvk_spec_const.h"
|
||||
|
||||
namespace dxvk {
|
||||
|
||||
DxvkSpecConstants::DxvkSpecConstants() {
|
||||
|
||||
}
|
||||
|
||||
|
||||
DxvkSpecConstants::~DxvkSpecConstants() {
|
||||
|
||||
}
|
||||
|
||||
|
||||
VkSpecializationInfo DxvkSpecConstants::getSpecInfo() const {
|
||||
VkSpecializationInfo specInfo;
|
||||
specInfo.mapEntryCount = m_map.size();
|
||||
specInfo.pMapEntries = m_map.data();
|
||||
specInfo.dataSize = m_data.size() * sizeof(uint32_t);
|
||||
specInfo.pData = m_data.data();
|
||||
return specInfo;
|
||||
}
|
||||
|
||||
|
||||
void DxvkSpecConstants::setAsUint32(uint32_t specId, uint32_t value) {
|
||||
uint32_t index = m_data.size();
|
||||
m_data.push_back(value);
|
||||
|
||||
VkSpecializationMapEntry mapEntry;
|
||||
mapEntry.constantID = specId;
|
||||
mapEntry.offset = sizeof(uint32_t) * index;
|
||||
mapEntry.size = sizeof(uint32_t);
|
||||
m_map.push_back(mapEntry);
|
||||
}
|
||||
|
||||
}
|
@ -1,78 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include "dxvk_limits.h"
|
||||
#include "dxvk_shader.h"
|
||||
|
||||
namespace dxvk {
|
||||
|
||||
/**
|
||||
* \briefS Specialization constant entry
|
||||
*
|
||||
* Used to pass a list of user-defined
|
||||
* specialization constants to shaders.
|
||||
*/
|
||||
struct DxvkSpecConstant {
|
||||
uint32_t specId;
|
||||
uint32_t value;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* \brief Specialization constant info
|
||||
*
|
||||
* Accumulates specialization constant data for
|
||||
* constants that use non-default values.
|
||||
*/
|
||||
class DxvkSpecConstants {
|
||||
|
||||
public:
|
||||
|
||||
DxvkSpecConstants();
|
||||
|
||||
~DxvkSpecConstants();
|
||||
|
||||
/**
|
||||
* \brief Sets specialization constant value
|
||||
*
|
||||
* If the given value is different from the constant's
|
||||
* default value, this will store the new value and add
|
||||
* a map entry so that it gets applied properly. Each
|
||||
* constant may only be set once.
|
||||
* \param [in] specId Specialization constant ID
|
||||
* \param [in] value Specialization constant value
|
||||
* \param [in] defaultValue Default value
|
||||
*/
|
||||
template<typename T>
|
||||
void set(uint32_t specId, T value, T defaultValue) {
|
||||
if (value != defaultValue)
|
||||
setAsUint32(specId, uint32_t(value));
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Sets specialization constant value
|
||||
*
|
||||
* Always passes the constant value to the driver.
|
||||
* \param [in] specId Specialization constant ID
|
||||
* \param [in] value Specialization constant value
|
||||
*/
|
||||
template<typename T>
|
||||
void set(uint32_t specId, T value) {
|
||||
setAsUint32(specId, uint32_t(value));
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Generates specialization info structure
|
||||
* \returns Specialization info for shader module
|
||||
*/
|
||||
VkSpecializationInfo getSpecInfo() const;
|
||||
|
||||
private:
|
||||
|
||||
std::vector<uint32_t> m_data = { };
|
||||
std::vector<VkSpecializationMapEntry> m_map = { };
|
||||
|
||||
void setAsUint32(uint32_t specId, uint32_t value);
|
||||
|
||||
};
|
||||
|
||||
}
|
@ -100,7 +100,6 @@ dxvk_src = files([
|
||||
'dxvk_shader.cpp',
|
||||
'dxvk_shader_key.cpp',
|
||||
'dxvk_signal.cpp',
|
||||
'dxvk_spec_const.cpp',
|
||||
'dxvk_staging.cpp',
|
||||
'dxvk_state_cache.cpp',
|
||||
'dxvk_stats.cpp',
|
||||
|
Loading…
x
Reference in New Issue
Block a user