diff --git a/rpcs3/D3D12GSRender.vcxproj b/rpcs3/D3D12GSRender.vcxproj
index 62f6c8b182..48495a1812 100644
--- a/rpcs3/D3D12GSRender.vcxproj
+++ b/rpcs3/D3D12GSRender.vcxproj
@@ -86,7 +86,6 @@
-
diff --git a/rpcs3/D3D12GSRender.vcxproj.filters b/rpcs3/D3D12GSRender.vcxproj.filters
index 81dbb92bb2..41b370fefa 100644
--- a/rpcs3/D3D12GSRender.vcxproj.filters
+++ b/rpcs3/D3D12GSRender.vcxproj.filters
@@ -26,9 +26,6 @@
Source Files
-
- Source Files
-
Source Files
diff --git a/rpcs3/Emu/RSX/Common/TextureUtils.cpp b/rpcs3/Emu/RSX/Common/TextureUtils.cpp
index 8d8edb1b14..f901b7aea2 100644
--- a/rpcs3/Emu/RSX/Common/TextureUtils.cpp
+++ b/rpcs3/Emu/RSX/Common/TextureUtils.cpp
@@ -6,11 +6,12 @@
#define MAX2(a, b) ((a) > (b)) ? (a) : (b)
-
+namespace
+{
/**
* Write data, assume src pixels are packed but not mipmaplevel
*/
-inline std::vector
+std::vector
writeTexelsGeneric(const char *src, char *dst, size_t widthInBlock, size_t heightInBlock, size_t blockSize, size_t mipmapCount)
{
std::vector Result;
@@ -42,7 +43,7 @@ writeTexelsGeneric(const char *src, char *dst, size_t widthInBlock, size_t heigh
/**
* Write data, assume src pixels are swizzled and but not mipmaplevel
*/
-inline std::vector
+std::vector
writeTexelsSwizzled(const char *src, char *dst, size_t widthInBlock, size_t heightInBlock, size_t blockSize, size_t mipmapCount)
{
std::vector Result;
@@ -84,7 +85,7 @@ writeTexelsSwizzled(const char *src, char *dst, size_t widthInBlock, size_t heig
/**
* Write data, assume compressed (DXTCn) format
*/
-inline std::vector
+std::vector
writeCompressedTexel(const char *src, char *dst, size_t widthInBlock, size_t blockWidth, size_t heightInBlock, size_t blockHeight, size_t blockSize, size_t mipmapCount)
{
std::vector Result;
@@ -117,7 +118,7 @@ writeCompressedTexel(const char *src, char *dst, size_t widthInBlock, size_t blo
/**
* Write 16 bytes pixel textures, assume src pixels are swizzled and but not mipmaplevel
*/
-inline std::vector
+std::vector
write16bTexelsSwizzled(const char *src, char *dst, size_t widthInBlock, size_t heightInBlock, size_t blockSize, size_t mipmapCount)
{
std::vector Result;
@@ -158,7 +159,7 @@ write16bTexelsSwizzled(const char *src, char *dst, size_t widthInBlock, size_t h
/**
* Write 16 bytes pixel textures, assume src pixels are packed but not mipmaplevel
*/
-inline std::vector
+std::vector
write16bTexelsGeneric(const char *src, char *dst, size_t widthInBlock, size_t heightInBlock, size_t blockSize, size_t mipmapCount)
{
std::vector Result;
@@ -196,7 +197,7 @@ write16bTexelsGeneric(const char *src, char *dst, size_t widthInBlock, size_t he
/**
* Write 16 bytes pixel textures, assume src pixels are packed but not mipmaplevel
*/
-inline std::vector
+std::vector
write16bX4TexelsGeneric(const char *src, char *dst, size_t widthInBlock, size_t heightInBlock, size_t blockSize, size_t mipmapCount)
{
std::vector Result;
@@ -231,255 +232,117 @@ write16bX4TexelsGeneric(const char *src, char *dst, size_t widthInBlock, size_t
return Result;
}
-
-size_t getPlacedTextureStorageSpace(const rsx::texture &texture, size_t rowPitchAlignement)
+/**
+ * A texture is stored as an array of blocks, where a block is a pixel for standard texture
+ * but is a structure containing several pixels for compressed format
+ */
+size_t get_texture_block_size(u32 format) noexcept
{
- size_t w = texture.width(), h = texture.height();
-
- size_t blockSizeInByte, blockWidthInPixel, blockHeightInPixel;
- int format = texture.format() & ~(CELL_GCM_TEXTURE_LN | CELL_GCM_TEXTURE_UN);
-
switch (format)
{
+ case CELL_GCM_TEXTURE_B8: return 1;
+ case CELL_GCM_TEXTURE_A1R5G5B5:
+ case CELL_GCM_TEXTURE_A4R4G4B4:
+ case CELL_GCM_TEXTURE_R5G6B5: return 2;
+ case CELL_GCM_TEXTURE_A8R8G8B8: return 4;
+ case CELL_GCM_TEXTURE_COMPRESSED_DXT1: return 8;
+ case CELL_GCM_TEXTURE_COMPRESSED_DXT23: return 16;
+ case CELL_GCM_TEXTURE_COMPRESSED_DXT45: return 16;
+ case CELL_GCM_TEXTURE_G8B8: return 2;
+ case CELL_GCM_TEXTURE_R6G5B5:
+ case CELL_GCM_TEXTURE_DEPTH24_D8:
+ case CELL_GCM_TEXTURE_DEPTH24_D8_FLOAT: return 4;
+ case CELL_GCM_TEXTURE_DEPTH16:
+ case CELL_GCM_TEXTURE_DEPTH16_FLOAT:
+ case CELL_GCM_TEXTURE_X16: return 2;
+ case CELL_GCM_TEXTURE_Y16_X16: return 4;
+ case CELL_GCM_TEXTURE_R5G5B5A1: return 2;
+ case CELL_GCM_TEXTURE_W16_Z16_Y16_X16_FLOAT: return 8;
+ case CELL_GCM_TEXTURE_W32_Z32_Y32_X32_FLOAT: return 16;
+ case CELL_GCM_TEXTURE_X32_FLOAT: return 4;
+ case CELL_GCM_TEXTURE_D1R5G5B5: return 2;
+ case CELL_GCM_TEXTURE_Y16_X16_FLOAT:
+ case CELL_GCM_TEXTURE_D8R8G8B8:
+ case CELL_GCM_TEXTURE_COMPRESSED_B8R8_G8R8:
+ case CELL_GCM_TEXTURE_COMPRESSED_R8B8_R8G8: return 4;
case CELL_GCM_TEXTURE_COMPRESSED_HILO8:
case CELL_GCM_TEXTURE_COMPRESSED_HILO_S8:
case ~(CELL_GCM_TEXTURE_LN | CELL_GCM_TEXTURE_UN) & CELL_GCM_TEXTURE_COMPRESSED_B8R8_G8R8:
case ~(CELL_GCM_TEXTURE_LN | CELL_GCM_TEXTURE_UN) & CELL_GCM_TEXTURE_COMPRESSED_R8B8_R8G8:
default:
LOG_ERROR(RSX, "Unimplemented Texture format : %x", format);
- break;
- case CELL_GCM_TEXTURE_B8:
- blockSizeInByte = 1;
- blockWidthInPixel = 1, blockHeightInPixel = 1;
- break;
- case CELL_GCM_TEXTURE_A1R5G5B5:
- blockSizeInByte = 2;
- blockHeightInPixel = 1, blockWidthInPixel = 1;
- break;
- case CELL_GCM_TEXTURE_A4R4G4B4:
- blockSizeInByte = 2;
- blockWidthInPixel = 1, blockHeightInPixel = 1;
- break;
- case CELL_GCM_TEXTURE_R5G6B5:
- blockSizeInByte = 2;
- blockWidthInPixel = 1, blockHeightInPixel = 1;
- break;
- case CELL_GCM_TEXTURE_A8R8G8B8:
- blockSizeInByte = 4;
- blockWidthInPixel = 1, blockHeightInPixel = 1;
- break;
- case CELL_GCM_TEXTURE_COMPRESSED_DXT1:
- blockSizeInByte = 8;
- blockWidthInPixel = 4, blockHeightInPixel = 4;
- break;
- case CELL_GCM_TEXTURE_COMPRESSED_DXT23:
- blockSizeInByte = 16;
- blockWidthInPixel = 4, blockHeightInPixel = 4;
- break;
- case CELL_GCM_TEXTURE_COMPRESSED_DXT45:
- blockSizeInByte = 16;
- blockWidthInPixel = 4, blockHeightInPixel = 4;
- break;
- case CELL_GCM_TEXTURE_G8B8:
- blockSizeInByte = 2;
- blockWidthInPixel = 1, blockHeightInPixel = 1;
- break;
- case CELL_GCM_TEXTURE_R6G5B5:
- // Not native
- blockSizeInByte = 4;
- blockWidthInPixel = 1, blockHeightInPixel = 1;
- break;
- case CELL_GCM_TEXTURE_DEPTH24_D8:
- blockSizeInByte = 4;
- blockWidthInPixel = 1, blockHeightInPixel = 1;
- break;
- case CELL_GCM_TEXTURE_DEPTH24_D8_FLOAT:
- blockSizeInByte = 4;
- blockWidthInPixel = 1, blockHeightInPixel = 1;
- break;
- case CELL_GCM_TEXTURE_DEPTH16:
- blockSizeInByte = 2;
- blockWidthInPixel = 1, blockHeightInPixel = 1;
- break;
- case CELL_GCM_TEXTURE_DEPTH16_FLOAT:
- blockSizeInByte = 2;
- blockWidthInPixel = 1, blockHeightInPixel = 1;
- break;
- case CELL_GCM_TEXTURE_X16:
- blockSizeInByte = 2;
- blockWidthInPixel = 1, blockHeightInPixel = 1;
- break;
- case CELL_GCM_TEXTURE_Y16_X16:
- blockSizeInByte = 4;
- blockWidthInPixel = 1, blockHeightInPixel = 1;
- break;
- case CELL_GCM_TEXTURE_R5G5B5A1:
- blockSizeInByte = 2;
- blockWidthInPixel = 1, blockHeightInPixel = 1;
- break;
- case CELL_GCM_TEXTURE_W16_Z16_Y16_X16_FLOAT:
- blockSizeInByte = 8;
- blockWidthInPixel = 1, blockHeightInPixel = 1;
- break;
- case CELL_GCM_TEXTURE_W32_Z32_Y32_X32_FLOAT:
- blockSizeInByte = 16;
- blockWidthInPixel = 1, blockHeightInPixel = 1;
- break;
- case CELL_GCM_TEXTURE_X32_FLOAT:
- blockSizeInByte = 4;
- blockWidthInPixel = 1, blockHeightInPixel = 1;
- break;
- case CELL_GCM_TEXTURE_D1R5G5B5:
- blockSizeInByte = 2;
- blockWidthInPixel = 1, blockHeightInPixel = 1;
- break;
- case CELL_GCM_TEXTURE_Y16_X16_FLOAT:
- blockSizeInByte = 4;
- blockWidthInPixel = 1, blockHeightInPixel = 1;
- break;
- case CELL_GCM_TEXTURE_D8R8G8B8:
- blockSizeInByte = 4;
- blockWidthInPixel = 1, blockHeightInPixel = 1;
- break;
- case CELL_GCM_TEXTURE_COMPRESSED_B8R8_G8R8:
- blockSizeInByte = 4;
- blockWidthInPixel = 2, blockHeightInPixel = 2;
- break;
- case CELL_GCM_TEXTURE_COMPRESSED_R8B8_R8G8:
- blockSizeInByte = 4;
- blockWidthInPixel = 2, blockHeightInPixel = 2;
- break;
+ return 0;
}
+}
- size_t heightInBlocks = (h + blockHeightInPixel - 1) / blockHeightInPixel;
- size_t widthInBlocks = (w + blockWidthInPixel - 1) / blockWidthInPixel;
+size_t get_texture_block_edge(u32 format) noexcept
+{
+ switch (format)
+ {
+ case CELL_GCM_TEXTURE_B8:
+ case CELL_GCM_TEXTURE_A1R5G5B5:
+ case CELL_GCM_TEXTURE_A4R4G4B4:
+ case CELL_GCM_TEXTURE_R5G6B5:
+ case CELL_GCM_TEXTURE_A8R8G8B8: return 1;
+ case CELL_GCM_TEXTURE_COMPRESSED_DXT1:
+ case CELL_GCM_TEXTURE_COMPRESSED_DXT23:
+ case CELL_GCM_TEXTURE_COMPRESSED_DXT45: return 4;
+ case CELL_GCM_TEXTURE_G8B8:
+ case CELL_GCM_TEXTURE_R6G5B5:
+ case CELL_GCM_TEXTURE_DEPTH24_D8:
+ case CELL_GCM_TEXTURE_DEPTH24_D8_FLOAT:
+ case CELL_GCM_TEXTURE_DEPTH16:
+ case CELL_GCM_TEXTURE_DEPTH16_FLOAT:
+ case CELL_GCM_TEXTURE_X16:
+ case CELL_GCM_TEXTURE_Y16_X16:
+ case CELL_GCM_TEXTURE_R5G5B5A1:
+ case CELL_GCM_TEXTURE_W16_Z16_Y16_X16_FLOAT:
+ case CELL_GCM_TEXTURE_W32_Z32_Y32_X32_FLOAT:
+ case CELL_GCM_TEXTURE_X32_FLOAT:
+ case CELL_GCM_TEXTURE_D1R5G5B5:
+ case CELL_GCM_TEXTURE_Y16_X16_FLOAT:
+ case CELL_GCM_TEXTURE_D8R8G8B8: return 1;
+ case CELL_GCM_TEXTURE_COMPRESSED_B8R8_G8R8:
+ case CELL_GCM_TEXTURE_COMPRESSED_R8B8_R8G8: return 2;
+ case CELL_GCM_TEXTURE_COMPRESSED_HILO8:
+ case CELL_GCM_TEXTURE_COMPRESSED_HILO_S8:
+ case ~(CELL_GCM_TEXTURE_LN | CELL_GCM_TEXTURE_UN) & CELL_GCM_TEXTURE_COMPRESSED_B8R8_G8R8:
+ case ~(CELL_GCM_TEXTURE_LN | CELL_GCM_TEXTURE_UN) & CELL_GCM_TEXTURE_COMPRESSED_R8B8_R8G8:
+ default:
+ LOG_ERROR(RSX, "Unimplemented Texture format : %x", format);
+ return 0;
+ }
+}
+}
+
+
+size_t get_placed_texture_storage_size(const rsx::texture &texture, size_t rowPitchAlignement) noexcept
+{
+ size_t w = texture.width(), h = texture.height();
+
+ int format = texture.format() & ~(CELL_GCM_TEXTURE_LN | CELL_GCM_TEXTURE_UN);
+ size_t blockEdge = get_texture_block_edge(format);
+ size_t blockSizeInByte = get_texture_block_size(format);
+
+ size_t heightInBlocks = (h + blockEdge - 1) / blockEdge;
+ size_t widthInBlocks = (w + blockEdge - 1) / blockEdge;
size_t rowPitch = align(blockSizeInByte * widthInBlocks, rowPitchAlignement);
return rowPitch * heightInBlocks * 2; // * 2 for mipmap levels
}
-std::vector uploadPlacedTexture(const rsx::texture &texture, size_t rowPitchAlignement, void* textureData)
+std::vector upload_placed_texture(const rsx::texture &texture, size_t rowPitchAlignement, void* textureData) noexcept
{
size_t w = texture.width(), h = texture.height();
int format = texture.format() & ~(CELL_GCM_TEXTURE_LN | CELL_GCM_TEXTURE_UN);
- size_t blockSizeInByte, blockWidthInPixel, blockHeightInPixel;
- switch (format)
- {
- case CELL_GCM_TEXTURE_COMPRESSED_HILO8:
- case CELL_GCM_TEXTURE_COMPRESSED_HILO_S8:
- case ~(CELL_GCM_TEXTURE_LN | CELL_GCM_TEXTURE_UN) & CELL_GCM_TEXTURE_COMPRESSED_B8R8_G8R8:
- case ~(CELL_GCM_TEXTURE_LN | CELL_GCM_TEXTURE_UN) & CELL_GCM_TEXTURE_COMPRESSED_R8B8_R8G8:
- default:
- LOG_ERROR(RSX, "Unimplemented Texture format : %x", format);
- break;
- case CELL_GCM_TEXTURE_B8:
- blockSizeInByte = 1;
- blockWidthInPixel = 1, blockHeightInPixel = 1;
- break;
- case CELL_GCM_TEXTURE_A1R5G5B5:
- blockSizeInByte = 2;
- blockHeightInPixel = 1, blockWidthInPixel = 1;
- break;
- case CELL_GCM_TEXTURE_A4R4G4B4:
- blockSizeInByte = 2;
- blockWidthInPixel = 1, blockHeightInPixel = 1;
- break;
- case CELL_GCM_TEXTURE_R5G6B5:
- blockSizeInByte = 2;
- blockWidthInPixel = 1, blockHeightInPixel = 1;
- break;
- case CELL_GCM_TEXTURE_A8R8G8B8:
- blockSizeInByte = 4;
- blockWidthInPixel = 1, blockHeightInPixel = 1;
- break;
- case CELL_GCM_TEXTURE_COMPRESSED_DXT1:
- blockSizeInByte = 8;
- blockWidthInPixel = 4, blockHeightInPixel = 4;
- break;
- case CELL_GCM_TEXTURE_COMPRESSED_DXT23:
- blockSizeInByte = 16;
- blockWidthInPixel = 4, blockHeightInPixel = 4;
- break;
- case CELL_GCM_TEXTURE_COMPRESSED_DXT45:
- blockSizeInByte = 16;
- blockWidthInPixel = 4, blockHeightInPixel = 4;
- break;
- case CELL_GCM_TEXTURE_G8B8:
- blockSizeInByte = 2;
- blockWidthInPixel = 1, blockHeightInPixel = 1;
- break;
- case CELL_GCM_TEXTURE_R6G5B5:
- // Not native
- blockSizeInByte = 4;
- blockWidthInPixel = 1, blockHeightInPixel = 1;
- break;
- case CELL_GCM_TEXTURE_DEPTH24_D8:
- blockSizeInByte = 4;
- blockWidthInPixel = 1, blockHeightInPixel = 1;
- break;
- case CELL_GCM_TEXTURE_DEPTH24_D8_FLOAT:
- blockSizeInByte = 4;
- blockWidthInPixel = 1, blockHeightInPixel = 1;
- break;
- case CELL_GCM_TEXTURE_DEPTH16:
- blockSizeInByte = 2;
- blockWidthInPixel = 1, blockHeightInPixel = 1;
- break;
- case CELL_GCM_TEXTURE_DEPTH16_FLOAT:
- blockSizeInByte = 2;
- blockWidthInPixel = 1, blockHeightInPixel = 1;
- break;
- case CELL_GCM_TEXTURE_X16:
- blockSizeInByte = 2;
- blockWidthInPixel = 1, blockHeightInPixel = 1;
- break;
- case CELL_GCM_TEXTURE_Y16_X16:
- blockSizeInByte = 4;
- blockWidthInPixel = 1, blockHeightInPixel = 1;
- break;
- case CELL_GCM_TEXTURE_R5G5B5A1:
- blockSizeInByte = 2;
- blockWidthInPixel = 1, blockHeightInPixel = 1;
- break;
- case CELL_GCM_TEXTURE_W16_Z16_Y16_X16_FLOAT:
- blockSizeInByte = 8;
- blockWidthInPixel = 1, blockHeightInPixel = 1;
- break;
- case CELL_GCM_TEXTURE_W32_Z32_Y32_X32_FLOAT:
- blockSizeInByte = 16;
- blockWidthInPixel = 1, blockHeightInPixel = 1;
- break;
- case CELL_GCM_TEXTURE_X32_FLOAT:
- blockSizeInByte = 4;
- blockWidthInPixel = 1, blockHeightInPixel = 1;
- break;
- case CELL_GCM_TEXTURE_D1R5G5B5:
- blockSizeInByte = 2;
- blockWidthInPixel = 1, blockHeightInPixel = 1;
- break;
- case CELL_GCM_TEXTURE_Y16_X16_FLOAT:
- blockSizeInByte = 4;
- blockWidthInPixel = 1, blockHeightInPixel = 1;
- break;
- case CELL_GCM_TEXTURE_D8R8G8B8:
- blockSizeInByte = 4;
- blockWidthInPixel = 1, blockHeightInPixel = 1;
- break;
- case CELL_GCM_TEXTURE_COMPRESSED_B8R8_G8R8:
- blockSizeInByte = 4;
- blockWidthInPixel = 2, blockHeightInPixel = 2;
- break;
- case CELL_GCM_TEXTURE_COMPRESSED_R8B8_R8G8:
- blockSizeInByte = 4;
- blockWidthInPixel = 2, blockHeightInPixel = 2;
- break;
- }
+ size_t blockSizeInByte = get_texture_block_size(format);
+ size_t blockEdge = get_texture_block_edge(format);
- size_t heightInBlocks = (h + blockHeightInPixel - 1) / blockHeightInPixel;
- size_t widthInBlocks = (w + blockWidthInPixel - 1) / blockWidthInPixel;
+ size_t heightInBlocks = (h + blockEdge - 1) / blockEdge;
+ size_t widthInBlocks = (w + blockEdge - 1) / blockEdge;
std::vector mipInfos;
@@ -505,8 +368,76 @@ std::vector uploadPlacedTexture(const rsx::texture &texture, si
case CELL_GCM_TEXTURE_COMPRESSED_DXT1:
case CELL_GCM_TEXTURE_COMPRESSED_DXT23:
case CELL_GCM_TEXTURE_COMPRESSED_DXT45:
- return writeCompressedTexel((char*)pixels, (char*)textureData, widthInBlocks, blockWidthInPixel, heightInBlocks, blockHeightInPixel, blockSizeInByte, texture.mipmap());
+ return writeCompressedTexel((char*)pixels, (char*)textureData, widthInBlocks, blockEdge, heightInBlocks, blockEdge, blockSizeInByte, texture.mipmap());
default:
return writeTexelsGeneric((char*)pixels, (char*)textureData, w, h, blockSizeInByte, texture.mipmap());
}
}
+
+size_t get_texture_size(const rsx::texture &texture) noexcept
+{
+ size_t w = texture.width(), h = texture.height();
+
+ int format = texture.format() & ~(CELL_GCM_TEXTURE_LN | CELL_GCM_TEXTURE_UN);
+ // TODO: Take mipmaps into account
+ switch (format)
+ {
+ case CELL_GCM_TEXTURE_COMPRESSED_HILO8:
+ case CELL_GCM_TEXTURE_COMPRESSED_HILO_S8:
+ case ~(CELL_GCM_TEXTURE_LN | CELL_GCM_TEXTURE_UN) & CELL_GCM_TEXTURE_COMPRESSED_B8R8_G8R8:
+ case ~(CELL_GCM_TEXTURE_LN | CELL_GCM_TEXTURE_UN) & CELL_GCM_TEXTURE_COMPRESSED_R8B8_R8G8:
+ default:
+ LOG_ERROR(RSX, "Unimplemented Texture format : %x", format);
+ return 0;
+ case CELL_GCM_TEXTURE_B8:
+ return w * h;
+ case CELL_GCM_TEXTURE_A1R5G5B5:
+ return w * h * 2;
+ case CELL_GCM_TEXTURE_A4R4G4B4:
+ return w * h * 2;
+ case CELL_GCM_TEXTURE_R5G6B5:
+ return w * h * 2;
+ case CELL_GCM_TEXTURE_A8R8G8B8:
+ return w * h * 4;
+ case CELL_GCM_TEXTURE_COMPRESSED_DXT1:
+ return w * h / 6;
+ case CELL_GCM_TEXTURE_COMPRESSED_DXT23:
+ return w * h / 4;
+ case CELL_GCM_TEXTURE_COMPRESSED_DXT45:
+ return w * h / 4;
+ case CELL_GCM_TEXTURE_G8B8:
+ return w * h * 2;
+ case CELL_GCM_TEXTURE_R6G5B5:
+ return w * h * 2;
+ case CELL_GCM_TEXTURE_DEPTH24_D8:
+ return w * h * 4;
+ case CELL_GCM_TEXTURE_DEPTH24_D8_FLOAT:
+ return w * h * 4;
+ case CELL_GCM_TEXTURE_DEPTH16:
+ return w * h * 2;
+ case CELL_GCM_TEXTURE_DEPTH16_FLOAT:
+ return w * h * 2;
+ case CELL_GCM_TEXTURE_X16:
+ return w * h * 2;
+ case CELL_GCM_TEXTURE_Y16_X16:
+ return w * h * 4;
+ case CELL_GCM_TEXTURE_R5G5B5A1:
+ return w * h * 2;
+ case CELL_GCM_TEXTURE_W16_Z16_Y16_X16_FLOAT:
+ return w * h * 8;
+ case CELL_GCM_TEXTURE_W32_Z32_Y32_X32_FLOAT:
+ return w * h * 16;
+ case CELL_GCM_TEXTURE_X32_FLOAT:
+ return w * h * 4;
+ case CELL_GCM_TEXTURE_D1R5G5B5:
+ return w * h * 2;
+ case CELL_GCM_TEXTURE_Y16_X16_FLOAT:
+ return w * h * 4;
+ case CELL_GCM_TEXTURE_D8R8G8B8:
+ return w * h * 4;
+ case CELL_GCM_TEXTURE_COMPRESSED_B8R8_G8R8:
+ return w * h * 4;
+ case CELL_GCM_TEXTURE_COMPRESSED_R8B8_R8G8:
+ return w * h * 4;
+ }
+}
\ No newline at end of file
diff --git a/rpcs3/Emu/RSX/Common/TextureUtils.h b/rpcs3/Emu/RSX/Common/TextureUtils.h
index 4ed2981bfd..a4fc2240a1 100644
--- a/rpcs3/Emu/RSX/Common/TextureUtils.h
+++ b/rpcs3/Emu/RSX/Common/TextureUtils.h
@@ -14,11 +14,16 @@ struct MipmapLevelInfo
* Get size to store texture in a linear fashion.
* Storage is assumed to use a rowPitchAlignement boundary for every row of texture.
*/
-size_t getPlacedTextureStorageSpace(const rsx::texture &texture, size_t rowPitchAlignement);
+size_t get_placed_texture_storage_size(const rsx::texture &texture, size_t rowPitchAlignement) noexcept;
/**
* Write texture data to textureData.
* Data are not packed, they are stored per rows using rowPitchAlignement.
* Similarly, offset for every mipmaplevel is aligned to rowPitchAlignement boundary.
*/
-std::vector uploadPlacedTexture(const rsx::texture &texture, size_t rowPitchAlignement, void* textureData);
\ No newline at end of file
+std::vector upload_placed_texture(const rsx::texture &texture, size_t rowPitchAlignement, void* textureData) noexcept;
+
+/**
+* Get number of bytes occupied by texture in RSX mem
+*/
+size_t get_texture_size(const rsx::texture &texture) noexcept;
\ No newline at end of file
diff --git a/rpcs3/Emu/RSX/D3D12/D3D12Texture.cpp b/rpcs3/Emu/RSX/D3D12/D3D12Texture.cpp
index 84147cc59d..6d55e9135e 100644
--- a/rpcs3/Emu/RSX/D3D12/D3D12Texture.cpp
+++ b/rpcs3/Emu/RSX/D3D12/D3D12Texture.cpp
@@ -6,8 +6,9 @@
// For clarity this code deals with texture but belongs to D3D12GSRender class
#include "D3D12Formats.h"
-static
-D3D12_COMPARISON_FUNC getSamplerCompFunc[] =
+namespace
+{
+D3D12_COMPARISON_FUNC get_sampler_compare_func[] =
{
D3D12_COMPARISON_FUNC_NEVER,
D3D12_COMPARISON_FUNC_LESS,
@@ -19,15 +20,14 @@ D3D12_COMPARISON_FUNC getSamplerCompFunc[] =
D3D12_COMPARISON_FUNC_ALWAYS
};
-static
-D3D12_SAMPLER_DESC getSamplerDesc(const rsx::texture &texture)
+D3D12_SAMPLER_DESC get_sampler_desc(const rsx::texture &texture) noexcept
{
D3D12_SAMPLER_DESC samplerDesc = {};
samplerDesc.Filter = get_texture_filter(texture.min_filter(), texture.mag_filter());
samplerDesc.AddressU = get_texture_wrap_mode(texture.wrap_s());
samplerDesc.AddressV = get_texture_wrap_mode(texture.wrap_t());
samplerDesc.AddressW = get_texture_wrap_mode(texture.wrap_r());
- samplerDesc.ComparisonFunc = getSamplerCompFunc[texture.zfunc()];
+ samplerDesc.ComparisonFunc = get_sampler_compare_func[texture.zfunc()];
samplerDesc.MaxAnisotropy = get_texture_max_aniso(texture.max_aniso());
samplerDesc.MipLODBias = texture.bias();
samplerDesc.BorderColor[0] = (FLOAT)texture.border_color();
@@ -44,168 +44,89 @@ D3D12_SAMPLER_DESC getSamplerDesc(const rsx::texture &texture)
* Create a texture residing in default heap and generate uploads commands in commandList,
* using a temporary texture buffer.
*/
-static
-ComPtr uploadSingleTexture(
+ComPtr upload_single_texture(
const rsx::texture &texture,
ID3D12Device *device,
- ID3D12GraphicsCommandList *commandList,
- DataHeap &textureBuffersHeap)
+ ID3D12GraphicsCommandList *command_list,
+ DataHeap &texture_buffer_heap)
{
- ComPtr vramTexture;
size_t w = texture.width(), h = texture.height();
int format = texture.format() & ~(CELL_GCM_TEXTURE_LN | CELL_GCM_TEXTURE_UN);
- DXGI_FORMAT dxgiFormat = get_texture_format(format);
+ DXGI_FORMAT dxgi_format = get_texture_format(format);
- size_t textureSize = getPlacedTextureStorageSpace(texture, 256);
- assert(textureBuffersHeap.canAlloc(textureSize));
- size_t heapOffset = textureBuffersHeap.alloc(textureSize);
+ size_t buffer_size = get_placed_texture_storage_size(texture, 256);
+ assert(texture_buffer_heap.canAlloc(buffer_size));
+ size_t heap_offset = texture_buffer_heap.alloc(buffer_size);
void *buffer;
- ThrowIfFailed(textureBuffersHeap.m_heap->Map(0, &CD3DX12_RANGE(heapOffset, heapOffset + textureSize), &buffer));
- void *textureData = (char*)buffer + heapOffset;
- std::vector mipInfos = uploadPlacedTexture(texture, 256, textureData);
- textureBuffersHeap.m_heap->Unmap(0, &CD3DX12_RANGE(heapOffset, heapOffset + textureSize));
-
- D3D12_RESOURCE_DESC texturedesc = CD3DX12_RESOURCE_DESC::Tex2D(dxgiFormat, (UINT)w, (UINT)h, 1, texture.mipmap());
- textureSize = device->GetResourceAllocationInfo(0, 1, &texturedesc).SizeInBytes;
+ ThrowIfFailed(texture_buffer_heap.m_heap->Map(0, &CD3DX12_RANGE(heap_offset, heap_offset + buffer_size), &buffer));
+ void *mapped_buffer = (char*)buffer + heap_offset;
+ std::vector mipInfos = upload_placed_texture(texture, 256, mapped_buffer);
+ texture_buffer_heap.m_heap->Unmap(0, &CD3DX12_RANGE(heap_offset, heap_offset + buffer_size));
+ ComPtr result;
ThrowIfFailed(device->CreateCommittedResource(
&CD3DX12_HEAP_PROPERTIES(D3D12_HEAP_TYPE_DEFAULT),
D3D12_HEAP_FLAG_NONE,
- &texturedesc,
+ &CD3DX12_RESOURCE_DESC::Tex2D(dxgi_format, (UINT)w, (UINT)h, 1, texture.mipmap()),
D3D12_RESOURCE_STATE_COPY_DEST,
nullptr,
- IID_PPV_ARGS(vramTexture.GetAddressOf())
+ IID_PPV_ARGS(result.GetAddressOf())
));
- size_t miplevel = 0;
+ size_t mip_level = 0;
for (const MipmapLevelInfo mli : mipInfos)
{
- commandList->CopyTextureRegion(&CD3DX12_TEXTURE_COPY_LOCATION(vramTexture.Get(), (UINT)miplevel), 0, 0, 0,
- &CD3DX12_TEXTURE_COPY_LOCATION(textureBuffersHeap.m_heap, { heapOffset + mli.offset, { dxgiFormat, (UINT)mli.width, (UINT)mli.height, 1, (UINT)mli.rowPitch } }), nullptr);
- miplevel++;
+ command_list->CopyTextureRegion(&CD3DX12_TEXTURE_COPY_LOCATION(result.Get(), (UINT)mip_level), 0, 0, 0,
+ &CD3DX12_TEXTURE_COPY_LOCATION(texture_buffer_heap.m_heap, { heap_offset + mli.offset, { dxgi_format, (UINT)mli.width, (UINT)mli.height, 1, (UINT)mli.rowPitch } }), nullptr);
+ mip_level++;
}
- commandList->ResourceBarrier(1, &CD3DX12_RESOURCE_BARRIER::Transition(vramTexture.Get(), D3D12_RESOURCE_STATE_COPY_DEST, D3D12_RESOURCE_STATE_GENERIC_READ));
- return vramTexture;
+ command_list->ResourceBarrier(1, &CD3DX12_RESOURCE_BARRIER::Transition(result.Get(), D3D12_RESOURCE_STATE_COPY_DEST, D3D12_RESOURCE_STATE_GENERIC_READ));
+ return result;
}
-
-
/**
*
*/
-static
-void updateExistingTexture(
+void update_existing_texture(
const rsx::texture &texture,
- ID3D12GraphicsCommandList *commandList,
- DataHeap &textureBuffersHeap,
- ID3D12Resource *existingTexture)
+ ID3D12GraphicsCommandList *command_list,
+ DataHeap &texture_buffer_heap,
+ ID3D12Resource *existing_texture)
{
size_t w = texture.width(), h = texture.height();
int format = texture.format() & ~(CELL_GCM_TEXTURE_LN | CELL_GCM_TEXTURE_UN);
- DXGI_FORMAT dxgiFormat = get_texture_format(format);
+ DXGI_FORMAT dxgi_format = get_texture_format(format);
- size_t textureSize = getPlacedTextureStorageSpace(texture, 256);
- assert(textureBuffersHeap.canAlloc(textureSize));
- size_t heapOffset = textureBuffersHeap.alloc(textureSize);
+ size_t buffer_size = get_placed_texture_storage_size(texture, 256);
+ assert(texture_buffer_heap.canAlloc(buffer_size));
+ size_t heap_offset = texture_buffer_heap.alloc(buffer_size);
void *buffer;
- ThrowIfFailed(textureBuffersHeap.m_heap->Map(0, &CD3DX12_RANGE(heapOffset, heapOffset + textureSize), &buffer));
- void *textureData = (char*)buffer + heapOffset;
- std::vector mipInfos = uploadPlacedTexture(texture, 256, textureData);
- textureBuffersHeap.m_heap->Unmap(0, &CD3DX12_RANGE(heapOffset, heapOffset + textureSize));
+ ThrowIfFailed(texture_buffer_heap.m_heap->Map(0, &CD3DX12_RANGE(heap_offset, heap_offset + buffer_size), &buffer));
+ void *mapped_buffer = (char*)buffer + heap_offset;
+ std::vector mipInfos = upload_placed_texture(texture, 256, mapped_buffer);
+ texture_buffer_heap.m_heap->Unmap(0, &CD3DX12_RANGE(heap_offset, heap_offset + buffer_size));
- commandList->ResourceBarrier(1, &CD3DX12_RESOURCE_BARRIER::Transition(existingTexture, D3D12_RESOURCE_STATE_GENERIC_READ, D3D12_RESOURCE_STATE_COPY_DEST));
+ command_list->ResourceBarrier(1, &CD3DX12_RESOURCE_BARRIER::Transition(existing_texture, D3D12_RESOURCE_STATE_GENERIC_READ, D3D12_RESOURCE_STATE_COPY_DEST));
size_t miplevel = 0;
for (const MipmapLevelInfo mli : mipInfos)
{
- commandList->CopyTextureRegion(&CD3DX12_TEXTURE_COPY_LOCATION(existingTexture, (UINT)miplevel), 0, 0, 0,
- &CD3DX12_TEXTURE_COPY_LOCATION(textureBuffersHeap.m_heap, { heapOffset + mli.offset,{ dxgiFormat, (UINT)mli.width, (UINT)mli.height, 1, (UINT)mli.rowPitch } }), nullptr);
+ command_list->CopyTextureRegion(&CD3DX12_TEXTURE_COPY_LOCATION(existing_texture, (UINT)miplevel), 0, 0, 0,
+ &CD3DX12_TEXTURE_COPY_LOCATION(texture_buffer_heap.m_heap, { heap_offset + mli.offset,{ dxgi_format, (UINT)mli.width, (UINT)mli.height, 1, (UINT)mli.rowPitch } }), nullptr);
miplevel++;
}
- commandList->ResourceBarrier(1, &CD3DX12_RESOURCE_BARRIER::Transition(existingTexture, D3D12_RESOURCE_STATE_COPY_DEST, D3D12_RESOURCE_STATE_GENERIC_READ));
+ command_list->ResourceBarrier(1, &CD3DX12_RESOURCE_BARRIER::Transition(existing_texture, D3D12_RESOURCE_STATE_COPY_DEST, D3D12_RESOURCE_STATE_GENERIC_READ));
+}
}
-
-/**
- * Get number of bytes occupied by texture in RSX mem
- */
-static
-size_t getTextureSize(const rsx::texture &texture)
+size_t D3D12GSRender::UploadTextures(ID3D12GraphicsCommandList *cmdlist, size_t descriptor_index)
{
- size_t w = texture.width(), h = texture.height();
-
- int format = texture.format() & ~(CELL_GCM_TEXTURE_LN | CELL_GCM_TEXTURE_UN);
- // TODO: Take mipmaps into account
- switch (format)
- {
- case CELL_GCM_TEXTURE_COMPRESSED_HILO8:
- case CELL_GCM_TEXTURE_COMPRESSED_HILO_S8:
- case ~(CELL_GCM_TEXTURE_LN | CELL_GCM_TEXTURE_UN) & CELL_GCM_TEXTURE_COMPRESSED_B8R8_G8R8:
- case ~(CELL_GCM_TEXTURE_LN | CELL_GCM_TEXTURE_UN) & CELL_GCM_TEXTURE_COMPRESSED_R8B8_R8G8:
- default:
- LOG_ERROR(RSX, "Unimplemented Texture format : %x", format);
- return 0;
- case CELL_GCM_TEXTURE_B8:
- return w * h;
- case CELL_GCM_TEXTURE_A1R5G5B5:
- return w * h * 2;
- case CELL_GCM_TEXTURE_A4R4G4B4:
- return w * h * 2;
- case CELL_GCM_TEXTURE_R5G6B5:
- return w * h * 2;
- case CELL_GCM_TEXTURE_A8R8G8B8:
- return w * h * 4;
- case CELL_GCM_TEXTURE_COMPRESSED_DXT1:
- return w * h / 6;
- case CELL_GCM_TEXTURE_COMPRESSED_DXT23:
- return w * h / 4;
- case CELL_GCM_TEXTURE_COMPRESSED_DXT45:
- return w * h / 4;
- case CELL_GCM_TEXTURE_G8B8:
- return w * h * 2;
- case CELL_GCM_TEXTURE_R6G5B5:
- return w * h * 2;
- case CELL_GCM_TEXTURE_DEPTH24_D8:
- return w * h * 4;
- case CELL_GCM_TEXTURE_DEPTH24_D8_FLOAT:
- return w * h * 4;
- case CELL_GCM_TEXTURE_DEPTH16:
- return w * h * 2;
- case CELL_GCM_TEXTURE_DEPTH16_FLOAT:
- return w * h * 2;
- case CELL_GCM_TEXTURE_X16:
- return w * h * 2;
- case CELL_GCM_TEXTURE_Y16_X16:
- return w * h * 4;
- case CELL_GCM_TEXTURE_R5G5B5A1:
- return w * h * 2;
- case CELL_GCM_TEXTURE_W16_Z16_Y16_X16_FLOAT:
- return w * h * 8;
- case CELL_GCM_TEXTURE_W32_Z32_Y32_X32_FLOAT:
- return w * h * 16;
- case CELL_GCM_TEXTURE_X32_FLOAT:
- return w * h * 4;
- case CELL_GCM_TEXTURE_D1R5G5B5:
- return w * h * 2;
- case CELL_GCM_TEXTURE_Y16_X16_FLOAT:
- return w * h * 4;
- case CELL_GCM_TEXTURE_D8R8G8B8:
- return w * h * 4;
- case CELL_GCM_TEXTURE_COMPRESSED_B8R8_G8R8:
- return w * h * 4;
- case CELL_GCM_TEXTURE_COMPRESSED_R8B8_R8G8:
- return w * h * 4;
- }
-}
-
-size_t D3D12GSRender::UploadTextures(ID3D12GraphicsCommandList *cmdlist, size_t descriptorIndex)
-{
- size_t usedTexture = 0;
+ size_t used_texture = 0;
for (u32 i = 0; i < rsx::limits::textures_count; ++i)
{
@@ -216,40 +137,39 @@ size_t D3D12GSRender::UploadTextures(ID3D12GraphicsCommandList *cmdlist, size_t
const u32 texaddr = rsx::get_address(textures[i].offset(), textures[i].location());
int format = textures[i].format() & ~(CELL_GCM_TEXTURE_LN | CELL_GCM_TEXTURE_UN);
- DXGI_FORMAT dxgiFormat = get_texture_format(format);
bool is_swizzled = !(textures[i].format() & CELL_GCM_TEXTURE_LN);
- ID3D12Resource *vramTexture;
+ ID3D12Resource *vram_texture;
std::unordered_map::const_iterator ItRTT = m_rtts.m_renderTargets.find(texaddr);
- std::pair > *cachedTex = m_textureCache.findDataIfAvailable(texaddr);
+ std::pair > *cached_texture = m_textureCache.findDataIfAvailable(texaddr);
bool isRenderTarget = false;
if (ItRTT != m_rtts.m_renderTargets.end())
{
- vramTexture = ItRTT->second;
+ vram_texture = ItRTT->second;
isRenderTarget = true;
}
- else if (cachedTex != nullptr && (cachedTex->first == TextureEntry(format, w, h, textures[i].mipmap())))
+ else if (cached_texture != nullptr && (cached_texture->first == TextureEntry(format, w, h, textures[i].mipmap())))
{
- if (cachedTex->first.m_isDirty)
+ if (cached_texture->first.m_isDirty)
{
- updateExistingTexture(textures[i], cmdlist, m_textureUploadData, cachedTex->second.Get());
- m_textureCache.protectData(texaddr, texaddr, getTextureSize(textures[i]));
+ update_existing_texture(textures[i], cmdlist, m_textureUploadData, cached_texture->second.Get());
+ m_textureCache.protectData(texaddr, texaddr, get_texture_size(textures[i]));
}
- vramTexture = cachedTex->second.Get();
+ vram_texture = cached_texture->second.Get();
}
else
{
- if (cachedTex != nullptr)
+ if (cached_texture != nullptr)
getCurrentResourceStorage().m_dirtyTextures.push_back(m_textureCache.removeFromCache(texaddr));
- ComPtr tex = uploadSingleTexture(textures[i], m_device.Get(), cmdlist, m_textureUploadData);
- vramTexture = tex.Get();
- m_textureCache.storeAndProtectData(texaddr, texaddr, getTextureSize(textures[i]), format, w, h, textures[i].mipmap(), tex);
+ ComPtr tex = upload_single_texture(textures[i], m_device.Get(), cmdlist, m_textureUploadData);
+ vram_texture = tex.Get();
+ m_textureCache.storeAndProtectData(texaddr, texaddr, get_texture_size(textures[i]), format, w, h, textures[i].mipmap(), tex);
}
- D3D12_SHADER_RESOURCE_VIEW_DESC srvDesc = {};
- srvDesc.ViewDimension = D3D12_SRV_DIMENSION_TEXTURE2D;
- srvDesc.Format = dxgiFormat;
- srvDesc.Texture2D.MipLevels = textures[i].mipmap();
+ D3D12_SHADER_RESOURCE_VIEW_DESC shared_resource_view_desc = {};
+ shared_resource_view_desc.ViewDimension = D3D12_SRV_DIMENSION_TEXTURE2D;
+ shared_resource_view_desc.Format = get_texture_format(format);
+ shared_resource_view_desc.Texture2D.MipLevels = textures[i].mipmap();
switch (format)
{
@@ -261,7 +181,7 @@ size_t D3D12GSRender::UploadTextures(ID3D12GraphicsCommandList *cmdlist, size_t
LOG_ERROR(RSX, "Unimplemented Texture format : %x", format);
break;
case CELL_GCM_TEXTURE_B8:
- srvDesc.Shader4ComponentMapping = D3D12_ENCODE_SHADER_4_COMPONENT_MAPPING(
+ shared_resource_view_desc.Shader4ComponentMapping = D3D12_ENCODE_SHADER_4_COMPONENT_MAPPING(
D3D12_SHADER_COMPONENT_MAPPING_FROM_MEMORY_COMPONENT_0,
D3D12_SHADER_COMPONENT_MAPPING_FROM_MEMORY_COMPONENT_0,
D3D12_SHADER_COMPONENT_MAPPING_FROM_MEMORY_COMPONENT_0,
@@ -270,7 +190,7 @@ size_t D3D12GSRender::UploadTextures(ID3D12GraphicsCommandList *cmdlist, size_t
case CELL_GCM_TEXTURE_A1R5G5B5:
case CELL_GCM_TEXTURE_A4R4G4B4:
case CELL_GCM_TEXTURE_R5G6B5:
- srvDesc.Shader4ComponentMapping = D3D12_DEFAULT_SHADER_4_COMPONENT_MAPPING;
+ shared_resource_view_desc.Shader4ComponentMapping = D3D12_DEFAULT_SHADER_4_COMPONENT_MAPPING;
break;
case CELL_GCM_TEXTURE_A8R8G8B8:
{
@@ -292,7 +212,7 @@ size_t D3D12GSRender::UploadTextures(ID3D12GraphicsCommandList *cmdlist, size_t
D3D12_SHADER_COMPONENT_MAPPING_FROM_MEMORY_COMPONENT_2
};
- srvDesc.Shader4ComponentMapping = D3D12_ENCODE_SHADER_4_COMPONENT_MAPPING(
+ shared_resource_view_desc.Shader4ComponentMapping = D3D12_ENCODE_SHADER_4_COMPONENT_MAPPING(
RemapValue[remap_r],
RemapValue[remap_g],
RemapValue[remap_b],
@@ -310,7 +230,7 @@ size_t D3D12GSRender::UploadTextures(ID3D12GraphicsCommandList *cmdlist, size_t
D3D12_SHADER_COMPONENT_MAPPING_FROM_MEMORY_COMPONENT_3
};
- srvDesc.Shader4ComponentMapping = D3D12_ENCODE_SHADER_4_COMPONENT_MAPPING(
+ shared_resource_view_desc.Shader4ComponentMapping = D3D12_ENCODE_SHADER_4_COMPONENT_MAPPING(
RemapValue[remap_r],
RemapValue[remap_g],
RemapValue[remap_b],
@@ -335,7 +255,7 @@ size_t D3D12GSRender::UploadTextures(ID3D12GraphicsCommandList *cmdlist, size_t
case CELL_GCM_TEXTURE_W32_Z32_Y32_X32_FLOAT:
case CELL_GCM_TEXTURE_X32_FLOAT:
case CELL_GCM_TEXTURE_D1R5G5B5:
- srvDesc.Shader4ComponentMapping = D3D12_DEFAULT_SHADER_4_COMPONENT_MAPPING;
+ shared_resource_view_desc.Shader4ComponentMapping = D3D12_DEFAULT_SHADER_4_COMPONENT_MAPPING;
break;
case CELL_GCM_TEXTURE_D8R8G8B8:
{
@@ -352,7 +272,7 @@ size_t D3D12GSRender::UploadTextures(ID3D12GraphicsCommandList *cmdlist, size_t
u8 remap_g = (textures[i].remap() >> 4) & 0x3;
u8 remap_b = (textures[i].remap() >> 6) & 0x3;
- srvDesc.Shader4ComponentMapping = D3D12_ENCODE_SHADER_4_COMPONENT_MAPPING(
+ shared_resource_view_desc.Shader4ComponentMapping = D3D12_ENCODE_SHADER_4_COMPONENT_MAPPING(
RemapValue[remap_a],
RemapValue[remap_r],
RemapValue[remap_g],
@@ -360,32 +280,32 @@ size_t D3D12GSRender::UploadTextures(ID3D12GraphicsCommandList *cmdlist, size_t
break;
}
case CELL_GCM_TEXTURE_Y16_X16_FLOAT:
- srvDesc.Shader4ComponentMapping = D3D12_DEFAULT_SHADER_4_COMPONENT_MAPPING;
+ shared_resource_view_desc.Shader4ComponentMapping = D3D12_DEFAULT_SHADER_4_COMPONENT_MAPPING;
break;
case CELL_GCM_TEXTURE_COMPRESSED_B8R8_G8R8:
- srvDesc.Shader4ComponentMapping = D3D12_DEFAULT_SHADER_4_COMPONENT_MAPPING;
+ shared_resource_view_desc.Shader4ComponentMapping = D3D12_DEFAULT_SHADER_4_COMPONENT_MAPPING;
break;
case CELL_GCM_TEXTURE_COMPRESSED_R8B8_R8G8:
- srvDesc.Shader4ComponentMapping = D3D12_DEFAULT_SHADER_4_COMPONENT_MAPPING;
+ shared_resource_view_desc.Shader4ComponentMapping = D3D12_DEFAULT_SHADER_4_COMPONENT_MAPPING;
break;
}
- m_device->CreateShaderResourceView(vramTexture, &srvDesc,
+ m_device->CreateShaderResourceView(vram_texture, &shared_resource_view_desc,
CD3DX12_CPU_DESCRIPTOR_HANDLE(getCurrentResourceStorage().m_descriptorsHeap->GetCPUDescriptorHandleForHeapStart())
- .Offset((UINT)descriptorIndex + (UINT)usedTexture, g_descriptorStrideSRVCBVUAV));
+ .Offset((UINT)descriptor_index + (UINT)used_texture, g_descriptorStrideSRVCBVUAV));
if (getCurrentResourceStorage().m_currentSamplerIndex + 16 > 2048)
{
getCurrentResourceStorage().m_samplerDescriptorHeapIndex = 1;
getCurrentResourceStorage().m_currentSamplerIndex = 0;
}
- m_device->CreateSampler(&getSamplerDesc(textures[i]),
+ m_device->CreateSampler(&get_sampler_desc(textures[i]),
CD3DX12_CPU_DESCRIPTOR_HANDLE(getCurrentResourceStorage().m_samplerDescriptorHeap[getCurrentResourceStorage().m_samplerDescriptorHeapIndex]->GetCPUDescriptorHandleForHeapStart())
- .Offset((UINT)getCurrentResourceStorage().m_currentSamplerIndex + (UINT)usedTexture, g_descriptorStrideSamplers));
+ .Offset((UINT)getCurrentResourceStorage().m_currentSamplerIndex + (UINT)used_texture, g_descriptorStrideSamplers));
- usedTexture++;
+ used_texture++;
}
- return usedTexture;
+ return used_texture;
}
#endif
diff --git a/rpcs3/Emu/RSX/D3D12/D3D12Texture.h b/rpcs3/Emu/RSX/D3D12/D3D12Texture.h
deleted file mode 100644
index 6f70f09bee..0000000000
--- a/rpcs3/Emu/RSX/D3D12/D3D12Texture.h
+++ /dev/null
@@ -1 +0,0 @@
-#pragma once