mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-02-21 13:54:18 +01:00
[dxvk] Remove old shader creation code
This commit is contained in:
parent
a731f5daae
commit
35e8f4676b
@ -158,19 +158,6 @@ namespace dxvk {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Rc<DxvkShader> DxvkDevice::createShader(
|
|
||||||
VkShaderStageFlagBits stage,
|
|
||||||
uint32_t slotCount,
|
|
||||||
const DxvkResourceSlot* slotInfos,
|
|
||||||
const DxvkInterfaceSlots& iface,
|
|
||||||
const SpirvCodeBuffer& code) {
|
|
||||||
return new DxvkShader(stage,
|
|
||||||
slotCount, slotInfos, iface, code,
|
|
||||||
DxvkShaderOptions(),
|
|
||||||
DxvkShaderConstData());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
DxvkStatCounters DxvkDevice::getStatCounters() {
|
DxvkStatCounters DxvkDevice::getStatCounters() {
|
||||||
DxvkPipelineCount pipe = m_objects.pipelineManager().getPipelineCount();
|
DxvkPipelineCount pipe = m_objects.pipelineManager().getPipelineCount();
|
||||||
|
|
||||||
|
@ -340,23 +340,6 @@ namespace dxvk {
|
|||||||
Rc<DxvkSampler> createSampler(
|
Rc<DxvkSampler> createSampler(
|
||||||
const DxvkSamplerCreateInfo& createInfo);
|
const DxvkSamplerCreateInfo& createInfo);
|
||||||
|
|
||||||
/**
|
|
||||||
* \brief Creates a shader module
|
|
||||||
*
|
|
||||||
* \param [in] stage Shader stage
|
|
||||||
* \param [in] slotCount Resource slot count
|
|
||||||
* \param [in] slotInfos Resource slot descriptions
|
|
||||||
* \param [in] iface Inter-stage interface slots
|
|
||||||
* \param [in] code Shader code
|
|
||||||
* \returns New shader module
|
|
||||||
*/
|
|
||||||
Rc<DxvkShader> createShader(
|
|
||||||
VkShaderStageFlagBits stage,
|
|
||||||
uint32_t slotCount,
|
|
||||||
const DxvkResourceSlot* slotInfos,
|
|
||||||
const DxvkInterfaceSlots& iface,
|
|
||||||
const SpirvCodeBuffer& code);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Retrieves stat counters
|
* \brief Retrieves stat counters
|
||||||
*
|
*
|
||||||
|
@ -6,43 +6,6 @@
|
|||||||
|
|
||||||
namespace dxvk {
|
namespace dxvk {
|
||||||
|
|
||||||
DxvkShaderConstData::DxvkShaderConstData()
|
|
||||||
: m_size(0), m_data(nullptr) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
DxvkShaderConstData::DxvkShaderConstData(
|
|
||||||
size_t dwordCount,
|
|
||||||
const uint32_t* dwordArray)
|
|
||||||
: m_size(dwordCount), m_data(new uint32_t[dwordCount]) {
|
|
||||||
for (size_t i = 0; i < dwordCount; i++)
|
|
||||||
m_data[i] = dwordArray[i];
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
DxvkShaderConstData::DxvkShaderConstData(DxvkShaderConstData&& other)
|
|
||||||
: m_size(other.m_size), m_data(other.m_data) {
|
|
||||||
other.m_size = 0;
|
|
||||||
other.m_data = nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
DxvkShaderConstData& DxvkShaderConstData::operator = (DxvkShaderConstData&& other) {
|
|
||||||
delete[] m_data;
|
|
||||||
this->m_size = other.m_size;
|
|
||||||
this->m_data = other.m_data;
|
|
||||||
other.m_size = 0;
|
|
||||||
other.m_data = nullptr;
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
DxvkShaderConstData::~DxvkShaderConstData() {
|
|
||||||
delete[] m_data;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
DxvkShaderModule::DxvkShaderModule()
|
DxvkShaderModule::DxvkShaderModule()
|
||||||
: m_vkd(nullptr), m_stage() {
|
: m_vkd(nullptr), m_stage() {
|
||||||
|
|
||||||
@ -97,27 +60,6 @@ namespace dxvk {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
DxvkShader::DxvkShader(
|
|
||||||
VkShaderStageFlagBits stage,
|
|
||||||
uint32_t slotCount,
|
|
||||||
const DxvkResourceSlot* slotInfos,
|
|
||||||
const DxvkInterfaceSlots& iface,
|
|
||||||
SpirvCodeBuffer code,
|
|
||||||
const DxvkShaderOptions& options,
|
|
||||||
DxvkShaderConstData&& constData)
|
|
||||||
: DxvkShader(DxvkShaderCreateInfo {
|
|
||||||
stage, slotCount, slotInfos,
|
|
||||||
iface.inputSlots, iface.outputSlots,
|
|
||||||
iface.pushConstOffset, iface.pushConstSize,
|
|
||||||
uint32_t(constData.sizeInBytes()),
|
|
||||||
reinterpret_cast<const char*>(constData.data()),
|
|
||||||
options.rasterizedStream,
|
|
||||||
{ options.xfbStrides[0], options.xfbStrides[1],
|
|
||||||
options.xfbStrides[2], options.xfbStrides[3] }
|
|
||||||
}, std::move(code)) {
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
DxvkShader::DxvkShader(
|
DxvkShader::DxvkShader(
|
||||||
const DxvkShaderCreateInfo& info,
|
const DxvkShaderCreateInfo& info,
|
||||||
SpirvCodeBuffer&& spirv)
|
SpirvCodeBuffer&& spirv)
|
||||||
|
@ -49,74 +49,6 @@ namespace dxvk {
|
|||||||
|
|
||||||
using DxvkShaderFlags = Flags<DxvkShaderFlag>;
|
using DxvkShaderFlags = Flags<DxvkShaderFlag>;
|
||||||
|
|
||||||
/**
|
|
||||||
* \brief Shader interface slots
|
|
||||||
*
|
|
||||||
* Stores a bit mask of which shader
|
|
||||||
* interface slots are defined. Used
|
|
||||||
* purely for validation purposes.
|
|
||||||
*/
|
|
||||||
struct DxvkInterfaceSlots {
|
|
||||||
uint32_t inputSlots = 0;
|
|
||||||
uint32_t outputSlots = 0;
|
|
||||||
uint32_t pushConstOffset = 0;
|
|
||||||
uint32_t pushConstSize = 0;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \brief Additional shader options
|
|
||||||
*
|
|
||||||
* Contains additional properties that should be
|
|
||||||
* taken into account when creating pipelines.
|
|
||||||
*/
|
|
||||||
struct DxvkShaderOptions {
|
|
||||||
/// Rasterized stream, or -1
|
|
||||||
int32_t rasterizedStream;
|
|
||||||
/// Xfb vertex strides
|
|
||||||
uint32_t xfbStrides[MaxNumXfbBuffers];
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \brief Shader constants
|
|
||||||
*
|
|
||||||
* Each shader can have constant data associated
|
|
||||||
* with it, which needs to be copied to a uniform
|
|
||||||
* buffer. The client API must then bind that buffer
|
|
||||||
* to an API-specific buffer binding when using the
|
|
||||||
* shader for rendering.
|
|
||||||
*/
|
|
||||||
class DxvkShaderConstData {
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
DxvkShaderConstData();
|
|
||||||
DxvkShaderConstData(
|
|
||||||
size_t dwordCount,
|
|
||||||
const uint32_t* dwordArray);
|
|
||||||
|
|
||||||
DxvkShaderConstData (DxvkShaderConstData&& other);
|
|
||||||
DxvkShaderConstData& operator = (DxvkShaderConstData&& other);
|
|
||||||
|
|
||||||
~DxvkShaderConstData();
|
|
||||||
|
|
||||||
const uint32_t* data() const {
|
|
||||||
return m_data;
|
|
||||||
}
|
|
||||||
|
|
||||||
size_t sizeInBytes() const {
|
|
||||||
return m_size * sizeof(uint32_t);
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
|
||||||
|
|
||||||
size_t m_size = 0;
|
|
||||||
uint32_t* m_data = nullptr;
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Shader info
|
* \brief Shader info
|
||||||
*/
|
*/
|
||||||
@ -163,15 +95,6 @@ namespace dxvk {
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
DxvkShader(
|
|
||||||
VkShaderStageFlagBits stage,
|
|
||||||
uint32_t slotCount,
|
|
||||||
const DxvkResourceSlot* slotInfos,
|
|
||||||
const DxvkInterfaceSlots& iface,
|
|
||||||
SpirvCodeBuffer code,
|
|
||||||
const DxvkShaderOptions& options,
|
|
||||||
DxvkShaderConstData&& constData);
|
|
||||||
|
|
||||||
DxvkShader(
|
DxvkShader(
|
||||||
const DxvkShaderCreateInfo& info,
|
const DxvkShaderCreateInfo& info,
|
||||||
SpirvCodeBuffer&& spirv);
|
SpirvCodeBuffer&& spirv);
|
||||||
@ -186,14 +109,6 @@ namespace dxvk {
|
|||||||
return m_info;
|
return m_info;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* \brief Shader stage
|
|
||||||
* \returns Shader stage
|
|
||||||
*/
|
|
||||||
VkShaderStageFlagBits stage() const {
|
|
||||||
return m_info.stage;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Retrieves shader flags
|
* \brief Retrieves shader flags
|
||||||
* \returns Shader flags
|
* \returns Shader flags
|
||||||
@ -226,49 +141,6 @@ namespace dxvk {
|
|||||||
const DxvkDescriptorSlotMapping& mapping,
|
const DxvkDescriptorSlotMapping& mapping,
|
||||||
const DxvkShaderModuleCreateInfo& info);
|
const DxvkShaderModuleCreateInfo& info);
|
||||||
|
|
||||||
/**
|
|
||||||
* \brief Inter-stage interface slots
|
|
||||||
*
|
|
||||||
* Retrieves the input and output
|
|
||||||
* registers used by the shader.
|
|
||||||
* \returns Shader interface slots
|
|
||||||
*/
|
|
||||||
DxvkInterfaceSlots interfaceSlots() const {
|
|
||||||
DxvkInterfaceSlots iface = { };
|
|
||||||
iface.inputSlots = m_info.inputMask;
|
|
||||||
iface.outputSlots = m_info.outputMask;
|
|
||||||
iface.pushConstOffset = m_info.pushConstOffset;
|
|
||||||
iface.pushConstSize = m_info.pushConstSize;
|
|
||||||
return iface;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \brief Shader options
|
|
||||||
* \returns Shader options
|
|
||||||
*/
|
|
||||||
DxvkShaderOptions shaderOptions() const {
|
|
||||||
DxvkShaderOptions options = { };
|
|
||||||
options.rasterizedStream = m_info.xfbRasterizedStream;
|
|
||||||
for (uint32_t i = 0; i < MaxNumXfbBuffers; i++)
|
|
||||||
options.xfbStrides[i] = m_info.xfbStrides[i];
|
|
||||||
return options;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \brief Shader constant data
|
|
||||||
*
|
|
||||||
* Returns a read-only reference to the
|
|
||||||
* constant data associated with this
|
|
||||||
* shader object.
|
|
||||||
* \returns Shader constant data
|
|
||||||
*/
|
|
||||||
DxvkShaderConstData shaderConstants() const {
|
|
||||||
return m_info.uniformSize
|
|
||||||
? DxvkShaderConstData(m_info.uniformSize / sizeof(uint32_t),
|
|
||||||
reinterpret_cast<const uint32_t*>(m_info.uniformData))
|
|
||||||
: DxvkShaderConstData();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Dumps SPIR-V shader
|
* \brief Dumps SPIR-V shader
|
||||||
*
|
*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user