mirror of
https://bitbucket.org/CPMADevs/cnq3
synced 2024-11-22 20:11:43 +00:00
moved some RHI constants to the header file
This commit is contained in:
parent
13c14ee2f2
commit
7ad28bf32f
2 changed files with 25 additions and 33 deletions
|
@ -190,15 +190,6 @@ namespace RHI
|
|||
// - 64 UAVs
|
||||
// - 2048 samplers
|
||||
static const D3D_FEATURE_LEVEL FeatureLevel = D3D_FEATURE_LEVEL_12_0;
|
||||
static const uint32_t MaxCPUGenericDescriptors = RHI_MAX_TEXTURES_2D * 4;
|
||||
static const uint32_t MaxCPUSamplerDescriptors = RHI_MAX_SAMPLERS;
|
||||
static const uint32_t MaxCPURTVDescriptors = 64;
|
||||
static const uint32_t MaxCPUDSVDescriptors = 64;
|
||||
static const uint32_t MaxCPUDescriptors =
|
||||
MaxCPUGenericDescriptors +
|
||||
MaxCPUSamplerDescriptors +
|
||||
MaxCPURTVDescriptors +
|
||||
MaxCPUDSVDescriptors;
|
||||
|
||||
struct ResourceType
|
||||
{
|
||||
|
@ -3663,7 +3654,7 @@ namespace RHI
|
|||
desc.SampleMask = UINT_MAX;
|
||||
|
||||
UINT semanticIndices[ShaderSemantic::Count] = { 0 };
|
||||
D3D12_INPUT_ELEMENT_DESC inputElementDescs[MaxVertexAttributeCount];
|
||||
D3D12_INPUT_ELEMENT_DESC inputElementDescs[MaxVertexAttributes];
|
||||
for(int a = 0; a < rhiDesc.vertexLayout.attributeCount; ++a)
|
||||
{
|
||||
const VertexAttribute& va = rhiDesc.vertexLayout.attributes[a];
|
||||
|
@ -3896,7 +3887,7 @@ namespace RHI
|
|||
Q_assert(CanWriteCommands());
|
||||
Q_assert(colorCount > 0 || colorTargets == NULL);
|
||||
|
||||
D3D12_CPU_DESCRIPTOR_HANDLE rtvHandles[MaxRenderTargetCount] = {};
|
||||
D3D12_CPU_DESCRIPTOR_HANDLE rtvHandles[MaxRenderTargets] = {};
|
||||
for(uint32_t t = 0; t < colorCount; ++t)
|
||||
{
|
||||
const uint32_t rtvIndex = rhi.textures.Get(colorTargets[t]).rtvIndex;
|
||||
|
@ -3985,11 +3976,11 @@ namespace RHI
|
|||
void CmdBindVertexBuffers(uint32_t count, const HBuffer* vertexBuffers, const uint32_t* byteStrides, const uint32_t* startByteOffsets)
|
||||
{
|
||||
Q_assert(CanWriteCommands());
|
||||
Q_assert(count <= MaxVertexBufferCount);
|
||||
Q_assert(count <= MaxVertexBuffers);
|
||||
|
||||
count = min(count, MaxVertexBufferCount);
|
||||
count = min(count, MaxVertexBuffers);
|
||||
|
||||
D3D12_VERTEX_BUFFER_VIEW views[MaxVertexBufferCount];
|
||||
D3D12_VERTEX_BUFFER_VIEW views[MaxVertexBuffers];
|
||||
for(uint32_t v = 0; v < count; ++v)
|
||||
{
|
||||
const Buffer& buffer = rhi.buffers.Get(vertexBuffers[v]);
|
||||
|
|
|
@ -29,20 +29,25 @@ along with Challenge Quake 3. If not, see <https://www.gnu.org/licenses/>.
|
|||
|
||||
namespace RHI
|
||||
{
|
||||
// @TODO: turn into uint32_t constants too
|
||||
#define RHI_MAX_TEXTURES_2D 4096 // real max: unlimited
|
||||
#define RHI_MAX_SAMPLERS 128 // real max: 2048
|
||||
|
||||
// this has 2 meanings:
|
||||
// FrameCount has 2 meanings:
|
||||
// 1. maximum number of frames queued
|
||||
// 2. number of frames in the back buffer
|
||||
const uint32_t FrameCount = 2;
|
||||
const uint32_t MaxVertexBufferCount = 16;
|
||||
const uint32_t MaxVertexAttributeCount = 32;
|
||||
const uint32_t MaxRenderTargetCount = 8;
|
||||
const uint32_t MaxVertexBuffers = 16;
|
||||
const uint32_t MaxVertexAttributes = 32;
|
||||
const uint32_t MaxRenderTargets = 8;
|
||||
const uint32_t MaxDurationQueries = 64;
|
||||
const uint32_t MaxTextureMips = 16;
|
||||
const uint32_t InvalidDescriptorIndex = UINT16_MAX;
|
||||
const uint32_t MaxCPUGenericDescriptors = 16384; // real max: unlimited
|
||||
const uint32_t MaxCPUSamplerDescriptors = 128; // real max: 2048
|
||||
const uint32_t MaxCPURTVDescriptors = 64;
|
||||
const uint32_t MaxCPUDSVDescriptors = 64;
|
||||
const uint32_t MaxCPUDescriptors =
|
||||
MaxCPUGenericDescriptors +
|
||||
MaxCPUSamplerDescriptors +
|
||||
MaxCPURTVDescriptors +
|
||||
MaxCPUDSVDescriptors;
|
||||
|
||||
#define RHI_ENUM_OPERATORS(EnumType) \
|
||||
inline EnumType operator|(EnumType a, EnumType b) { return (EnumType)((uint32_t)(a) | (uint32_t)(b)); } \
|
||||
|
@ -355,9 +360,9 @@ namespace RHI
|
|||
ShaderByteCode pixelShader;
|
||||
struct VertexLayout
|
||||
{
|
||||
VertexAttribute attributes[MaxVertexAttributeCount];
|
||||
VertexAttribute attributes[MaxVertexAttributes];
|
||||
uint32_t attributeCount = 0;
|
||||
uint32_t bindingStrides[MaxVertexBufferCount] = { 0 }; // total byte size of a vertex for each buffer
|
||||
uint32_t bindingStrides[MaxVertexBuffers] = { 0 }; // total byte size of a vertex for each buffer
|
||||
|
||||
void AddAttribute(
|
||||
uint32_t vertexBufferIndex,
|
||||
|
@ -366,7 +371,7 @@ namespace RHI
|
|||
uint32_t vectorLength,
|
||||
uint32_t structByteOffset)
|
||||
{
|
||||
Q_assert(attributeCount < MaxVertexAttributeCount);
|
||||
Q_assert(attributeCount < MaxVertexAttributes);
|
||||
VertexAttribute& va = attributes[attributeCount++];
|
||||
va.dataType = dataType;
|
||||
va.semantic = semantic;
|
||||
|
@ -405,17 +410,15 @@ namespace RHI
|
|||
rasterizer;
|
||||
struct RenderTarget
|
||||
{
|
||||
// @TODO:
|
||||
//uint32_t q3BlendMode = GLS_SRCBLEND_SRC_ALPHA | GLS_DSTBLEND_ONE_MINUS_SRC_ALPHA;
|
||||
uint32_t q3BlendMode = 0x00000005 | 0x00000060;
|
||||
uint32_t q3BlendMode = GLS_SRCBLEND_SRC_ALPHA | GLS_DSTBLEND_ONE_MINUS_SRC_ALPHA;
|
||||
TextureFormat::Id format = TextureFormat::RGBA32_UNorm;
|
||||
}
|
||||
renderTargets[MaxRenderTargetCount];
|
||||
renderTargets[MaxRenderTargets];
|
||||
uint32_t renderTargetCount = 0;
|
||||
|
||||
void AddRenderTarget(uint32_t q3BlendMode, TextureFormat::Id format)
|
||||
{
|
||||
Q_assert(renderTargetCount < MaxRenderTargetCount);
|
||||
Q_assert(renderTargetCount < MaxRenderTargets);
|
||||
RenderTarget& rt = renderTargets[renderTargetCount++];
|
||||
rt.q3BlendMode = q3BlendMode;
|
||||
rt.format = format;
|
||||
|
@ -516,9 +519,7 @@ namespace RHI
|
|||
mipLODBias = mipLODBias_;
|
||||
}
|
||||
|
||||
// @TODO:
|
||||
//textureWrap_t wrapMode = TW_REPEAT;
|
||||
textureWrap_t wrapMode = (textureWrap_t)0;
|
||||
textureWrap_t wrapMode = TW_REPEAT;
|
||||
TextureFilter::Id filterMode = TextureFilter::Linear;
|
||||
float minLOD = 0.0f;
|
||||
float mipLODBias = 0.0f;
|
||||
|
|
Loading…
Reference in a new issue