mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-01-18 02:52:10 +01:00
[dxvk] Added limit constants
This commit is contained in:
parent
764220db98
commit
921abce1b3
@ -2,27 +2,11 @@
|
||||
|
||||
#include "dxvk_compute.h"
|
||||
#include "dxvk_framebuffer.h"
|
||||
#include "dxvk_limits.h"
|
||||
#include "dxvk_shader.h"
|
||||
|
||||
namespace dxvk {
|
||||
|
||||
/**
|
||||
* \brief Limits of the DXVK API
|
||||
*
|
||||
* Stores the number of binding slots
|
||||
* available for all resource types.
|
||||
*/
|
||||
enum DxvkLimits : size_t {
|
||||
MaxNumRenderTargets = 8,
|
||||
MaxNumUniformBuffers = 16,
|
||||
MaxNumSampledImages = 16,
|
||||
MaxNumStorageBuffers = 128,
|
||||
MaxNumStorageImages = 128,
|
||||
MaxNumVertexBuffers = 32,
|
||||
MaxNumOutputStreams = 4,
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* \brief Graphics pipeline state flags
|
||||
*
|
||||
|
@ -9,7 +9,7 @@ namespace dxvk {
|
||||
DxvkRenderPassFormat DxvkRenderTargets::renderPassFormat() const {
|
||||
DxvkRenderPassFormat result;
|
||||
|
||||
for (uint32_t i = 0; i < MaxNumColorTargets; i++) {
|
||||
for (uint32_t i = 0; i < MaxNumRenderTargets; i++) {
|
||||
if (m_colorTargets.at(i) != nullptr) {
|
||||
result.setColorFormat(i, m_colorTargets.at(i)->info().format);
|
||||
result.setSampleCount(m_colorTargets.at(i)->imageInfo().sampleCount);
|
||||
@ -31,7 +31,7 @@ namespace dxvk {
|
||||
if (m_depthTarget != nullptr)
|
||||
result.push_back(m_depthTarget->handle());
|
||||
|
||||
for (uint32_t i = 0; i < MaxNumColorTargets; i++) {
|
||||
for (uint32_t i = 0; i < MaxNumRenderTargets; i++) {
|
||||
if (m_colorTargets.at(i) != nullptr)
|
||||
result.push_back(m_colorTargets.at(i)->handle());
|
||||
}
|
||||
@ -44,7 +44,7 @@ namespace dxvk {
|
||||
if (m_depthTarget != nullptr)
|
||||
return this->renderTargetSize(m_depthTarget);
|
||||
|
||||
for (uint32_t i = 0; i < MaxNumColorTargets; i++) {
|
||||
for (uint32_t i = 0; i < MaxNumRenderTargets; i++) {
|
||||
if (m_colorTargets.at(i) != nullptr)
|
||||
return this->renderTargetSize(m_colorTargets.at(i));
|
||||
}
|
||||
|
@ -96,8 +96,8 @@ namespace dxvk {
|
||||
|
||||
private:
|
||||
|
||||
std::array<Rc<DxvkImageView>, MaxNumColorTargets> m_colorTargets;
|
||||
Rc<DxvkImageView> m_depthTarget;
|
||||
std::array<Rc<DxvkImageView>, MaxNumRenderTargets> m_colorTargets;
|
||||
Rc<DxvkImageView> m_depthTarget;
|
||||
|
||||
DxvkFramebufferSize renderTargetSize(
|
||||
const Rc<DxvkImageView>& renderTarget) const;
|
||||
|
15
src/dxvk/dxvk_limits.h
Normal file
15
src/dxvk/dxvk_limits.h
Normal file
@ -0,0 +1,15 @@
|
||||
#pragma once
|
||||
|
||||
namespace dxvk {
|
||||
|
||||
enum DxvkLimits : size_t {
|
||||
MaxNumRenderTargets = 8,
|
||||
MaxNumUniformBuffers = 16,
|
||||
MaxNumSampledImages = 16,
|
||||
MaxNumStorageBuffers = 128,
|
||||
MaxNumStorageImages = 128,
|
||||
MaxNumVertexBuffers = 32,
|
||||
MaxNumOutputStreams = 4,
|
||||
};
|
||||
|
||||
}
|
@ -3,7 +3,7 @@
|
||||
namespace dxvk {
|
||||
|
||||
DxvkRenderPassFormat::DxvkRenderPassFormat() {
|
||||
for (uint32_t i = 0; i < MaxNumColorTargets; i++)
|
||||
for (uint32_t i = 0; i < MaxNumRenderTargets; i++)
|
||||
m_color.at(i) = VK_FORMAT_UNDEFINED;
|
||||
m_depth = VK_FORMAT_UNDEFINED;
|
||||
m_samples = VK_SAMPLE_COUNT_1_BIT;
|
||||
@ -15,7 +15,7 @@ namespace dxvk {
|
||||
std::hash<VkFormat> fhash;
|
||||
std::hash<VkSampleCountFlagBits> shash;
|
||||
|
||||
for (uint32_t i = 0; i < MaxNumColorTargets; i++)
|
||||
for (uint32_t i = 0; i < MaxNumRenderTargets; i++)
|
||||
result.add(fhash(m_color.at(i)));
|
||||
|
||||
result.add(fhash(m_depth));
|
||||
@ -27,7 +27,7 @@ namespace dxvk {
|
||||
bool DxvkRenderPassFormat::operator == (const DxvkRenderPassFormat& other) const {
|
||||
bool equal = m_depth == other.m_depth
|
||||
&& m_samples == other.m_samples;
|
||||
for (uint32_t i = 0; i < MaxNumColorTargets && !equal; i++)
|
||||
for (uint32_t i = 0; i < MaxNumRenderTargets && !equal; i++)
|
||||
equal = m_color.at(i) == other.m_color.at(i);
|
||||
return equal;
|
||||
}
|
||||
@ -48,7 +48,7 @@ namespace dxvk {
|
||||
std::vector<VkAttachmentDescription> attachments;
|
||||
|
||||
VkAttachmentReference depthRef;
|
||||
std::array<VkAttachmentReference, MaxNumColorTargets> colorRef;
|
||||
std::array<VkAttachmentReference, MaxNumRenderTargets> colorRef;
|
||||
|
||||
// Render passes may not require the previous
|
||||
// contents of the attachments to be preserved.
|
||||
@ -76,7 +76,7 @@ namespace dxvk {
|
||||
attachments.push_back(desc);
|
||||
}
|
||||
|
||||
for (uint32_t i = 0; i < MaxNumColorTargets; i++) {
|
||||
for (uint32_t i = 0; i < MaxNumRenderTargets; i++) {
|
||||
colorRef.at(i).attachment = VK_ATTACHMENT_UNUSED;
|
||||
colorRef.at(i).layout = VK_IMAGE_LAYOUT_UNDEFINED;
|
||||
|
||||
|
@ -5,11 +5,10 @@
|
||||
|
||||
#include "dxvk_hash.h"
|
||||
#include "dxvk_include.h"
|
||||
#include "dxvk_limits.h"
|
||||
|
||||
namespace dxvk {
|
||||
|
||||
constexpr uint32_t MaxNumColorTargets = 8;
|
||||
|
||||
/**
|
||||
* \brief Render pass format
|
||||
*
|
||||
@ -92,9 +91,9 @@ namespace dxvk {
|
||||
|
||||
private:
|
||||
|
||||
std::array<VkFormat, MaxNumColorTargets> m_color;
|
||||
VkFormat m_depth;
|
||||
VkSampleCountFlagBits m_samples;
|
||||
std::array<VkFormat, MaxNumRenderTargets> m_color;
|
||||
VkFormat m_depth;
|
||||
VkSampleCountFlagBits m_samples;
|
||||
|
||||
};
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user