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 12:17:29 -07:00
committed by Ryan Fleury
parent 7e0611e7f1
commit fd982d38fc
11 changed files with 80 additions and 87 deletions
+2 -3
View File
@@ -30,10 +30,9 @@ U8 r_tex2d_format_bytes_per_pixel_table[9] =
16,
};
String8 r_tex2d_kind_display_string_table[2] =
String8 r_tex2d_kind_display_string_table[1] =
{
str8_lit_comp("Static"),
str8_lit_comp("Dynamic"),
str8_lit_comp("$(a.display_string)"),
};
String8 r_tex2d_sample_kind_display_string_table[2] =
+7 -13
View File
@@ -20,12 +20,13 @@ R_Tex2DFormat_RGBA32,
R_Tex2DFormat_COUNT,
} R_Tex2DFormat;
typedef enum R_Tex2DKind
typedef enum R_ResourceKind
{
R_Tex2DKind_Static,
R_Tex2DKind_Dynamic,
R_Tex2DKind_COUNT,
} R_Tex2DKind;
R_ResourceKind_Static,
R_ResourceKind_Dynamic,
R_ResourceKind_Stream,
R_ResourceKind_COUNT,
} R_ResourceKind;
typedef enum R_Tex2DSampleKind
{
@@ -43,13 +44,6 @@ R_GeoTopologyKind_TriangleStrip,
R_GeoTopologyKind_COUNT,
} R_GeoTopologyKind;
typedef enum R_BufferKind
{
R_BufferKind_Static,
R_BufferKind_Dynamic,
R_BufferKind_COUNT,
} R_BufferKind;
typedef enum R_PassKind
{
R_PassKind_UI,
@@ -61,7 +55,7 @@ R_PassKind_COUNT,
C_LINKAGE_BEGIN
extern String8 r_tex2d_format_display_string_table[9];
extern U8 r_tex2d_format_bytes_per_pixel_table[9];
extern String8 r_tex2d_kind_display_string_table[2];
extern String8 r_tex2d_kind_display_string_table[1];
extern String8 r_tex2d_sample_kind_display_string_table[2];
extern String8 r_pass_kind_display_string_table[3];
extern U8 r_pass_kind_batch_table[3];