mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-11 01:08:39 +12:00
d3d12: Use openMP to upload texture
Does not really increase performance so far
This commit is contained in:
parent
cfe058dc82
commit
459ab17d74
4 changed files with 10 additions and 6 deletions
|
@ -29,9 +29,9 @@ size_t powerOf2Align(size_t unalignedVal, size_t powerOf2)
|
||||||
inline
|
inline
|
||||||
void streamToBuffer(void* dst, void* src, size_t sizeInBytes)
|
void streamToBuffer(void* dst, void* src, size_t sizeInBytes)
|
||||||
{
|
{
|
||||||
for (unsigned i = 0; i < sizeInBytes / 16; i++)
|
#pragma omp parallel for
|
||||||
|
for (int i = 0; i < sizeInBytes / 16; i++)
|
||||||
{
|
{
|
||||||
|
|
||||||
const __m128i &srcPtr = _mm_loadu_si128((__m128i*) ((char*)src + i * 16));
|
const __m128i &srcPtr = _mm_loadu_si128((__m128i*) ((char*)src + i * 16));
|
||||||
_mm_stream_si128((__m128i*)((char*)dst + i * 16), srcPtr);
|
_mm_stream_si128((__m128i*)((char*)dst + i * 16), srcPtr);
|
||||||
}
|
}
|
||||||
|
@ -45,9 +45,10 @@ inline
|
||||||
void streamBuffer(void* dst, void* src, size_t sizeInBytes)
|
void streamBuffer(void* dst, void* src, size_t sizeInBytes)
|
||||||
{
|
{
|
||||||
// Assume 64 bytes cache line
|
// Assume 64 bytes cache line
|
||||||
unsigned offset = 0;
|
int offset = 0;
|
||||||
bool isAligned = !((size_t)src & 15);
|
bool isAligned = !((size_t)src & 15);
|
||||||
for (; (offset + 64) < sizeInBytes; offset += 64)
|
#pragma omp parallel for
|
||||||
|
for (offset = 0; offset < sizeInBytes - 64; offset += 64)
|
||||||
{
|
{
|
||||||
char *line = (char*)src + offset;
|
char *line = (char*)src + offset;
|
||||||
char *dstline = (char*)dst + offset;
|
char *dstline = (char*)dst + offset;
|
||||||
|
|
|
@ -222,10 +222,9 @@ ID3D12Resource *uploadSingleTexture(
|
||||||
log2width = (u32)(logf(w) / logf(2.f));
|
log2width = (u32)(logf(w) / logf(2.f));
|
||||||
log2height = (u32)(logf(h) / logf(2.f));
|
log2height = (u32)(logf(h) / logf(2.f));
|
||||||
|
|
||||||
|
#pragma omp parallel for
|
||||||
for (int j = 0; j < w; j++)
|
for (int j = 0; j < w; j++)
|
||||||
{
|
|
||||||
dst[(row * rowPitch / 4) + j] = src[LinearToSwizzleAddress(j, row, 0, log2width, log2height, 0)];
|
dst[(row * rowPitch / 4) + j] = src[LinearToSwizzleAddress(j, row, 0, log2width, log2height, 0)];
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
streamBuffer((char*)textureData + row * rowPitch, (char*)pixels + row * m_texture_pitch, m_texture_pitch);
|
streamBuffer((char*)textureData + row * rowPitch, (char*)pixels + row * m_texture_pitch, m_texture_pitch);
|
||||||
|
|
|
@ -758,6 +758,7 @@
|
||||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||||
<AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>
|
||||||
</AdditionalIncludeDirectories>
|
</AdditionalIncludeDirectories>
|
||||||
|
<OpenMPSupport>true</OpenMPSupport>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
|
|
@ -84,6 +84,7 @@
|
||||||
<PrecompiledHeaderFile>stdafx_gui.h</PrecompiledHeaderFile>
|
<PrecompiledHeaderFile>stdafx_gui.h</PrecompiledHeaderFile>
|
||||||
<PrecompiledHeaderOutputFile>$(IntDir)$(TargetName)_gui.pch</PrecompiledHeaderOutputFile>
|
<PrecompiledHeaderOutputFile>$(IntDir)$(TargetName)_gui.pch</PrecompiledHeaderOutputFile>
|
||||||
<PreprocessorDefinitions>_UNICODE;UNICODE;%(PreprocessorDefinitions);DX12_SUPPORT</PreprocessorDefinitions>
|
<PreprocessorDefinitions>_UNICODE;UNICODE;%(PreprocessorDefinitions);DX12_SUPPORT</PreprocessorDefinitions>
|
||||||
|
<OpenMPSupport>true</OpenMPSupport>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
@ -114,6 +115,7 @@
|
||||||
<ExceptionHandling>Async</ExceptionHandling>
|
<ExceptionHandling>Async</ExceptionHandling>
|
||||||
<PrecompiledHeaderFile>stdafx_gui.h</PrecompiledHeaderFile>
|
<PrecompiledHeaderFile>stdafx_gui.h</PrecompiledHeaderFile>
|
||||||
<PrecompiledHeaderOutputFile>$(IntDir)$(TargetName)_gui.pch</PrecompiledHeaderOutputFile>
|
<PrecompiledHeaderOutputFile>$(IntDir)$(TargetName)_gui.pch</PrecompiledHeaderOutputFile>
|
||||||
|
<OpenMPSupport>true</OpenMPSupport>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
@ -150,6 +152,7 @@
|
||||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||||
<PrecompiledHeaderFile>stdafx_gui.h</PrecompiledHeaderFile>
|
<PrecompiledHeaderFile>stdafx_gui.h</PrecompiledHeaderFile>
|
||||||
<PrecompiledHeaderOutputFile>$(IntDir)$(TargetName)_gui.pch</PrecompiledHeaderOutputFile>
|
<PrecompiledHeaderOutputFile>$(IntDir)$(TargetName)_gui.pch</PrecompiledHeaderOutputFile>
|
||||||
|
<OpenMPSupport>true</OpenMPSupport>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<SubSystem>Windows</SubSystem>
|
<SubSystem>Windows</SubSystem>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue