Fixes bad resource usage in rendering

D3D11 is quite strict about how resources are supposed to be used - read/write & CPU access.
This changes Tex2DKind and BufferKind into one uniform ResourceKind (because it's the same thing really).

And it is more strict about usage:
1) Static is not allowed to update, resource is immutable, data provided at creation
2) Dynamic allows CPU to update GPU resource occasionally via UpdateSubresource
3) Stream allows CPU to update GPU resource often via Map/Unmap (currently unused)
This commit is contained in:
Martins Mozeiko
2024-05-24 14:04:42 -07:00
committed by Ryan Fleury
parent 7e0611e7f1
commit fd982d38fc
11 changed files with 80 additions and 87 deletions
+16 -16
View File
@@ -19,10 +19,23 @@ R_Tex2DFormatTable:
}
@table(name, display_string)
R_Tex2DKindTable:
R_ResourceKindTable:
{
// static resource is immutable
// initial data must be provided at creation time
// GPU can read the resource
// CPU is not allowed to read or write
{Static "Static" }
// dynamic resource allows resource to be modified
// GPU can read & write to it
// CPU can write to it using UpdateSubresource
{Dynamic "Dynamic"}
// stream resource will be often updated fully overwriting previous data
// GPU can only read it
// CPU can update via Map (with WRITE_DISCARD flag) + Unmap
{Stream "Stream "}
}
@table(name, display_string)
@@ -41,13 +54,6 @@ R_GeoTopologyKindTable:
{TriangleStrip "Triangle Strip" }
}
@table(name, display_string)
R_BufferKindTable:
{
{Static "Static" }
{Dynamic "Dynamic"}
}
@table(name, batch, display_string)
R_PassKindTable:
{
@@ -65,9 +71,9 @@ R_PassKindTable:
COUNT,
}
@enum R_Tex2DKind:
@enum R_ResourceKind:
{
@expand(R_Tex2DKindTable a) `$(a.name)`,
@expand(R_ResourceKindTable a) `$(a.name)`,
COUNT,
}
@@ -83,12 +89,6 @@ R_PassKindTable:
COUNT,
}
@enum R_BufferKind:
{
@expand(R_BufferKindTable a) `$(a.name)`,
COUNT,
}
@enum R_PassKind:
{
@expand(R_PassKindTable a) `$(a.name)`,