mirror of
https://github.com/RPCS3/rpcs3.git
synced 2024-11-22 02:32:36 +01:00
rsx/common: Fix handling of UB256
This commit is contained in:
parent
09fc492257
commit
5ef7f8bf3e
15
rpcs3-tests/ps3-rsx-common.cpp
Normal file
15
rpcs3-tests/ps3-rsx-common.cpp
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
#include "stdafx.h"
|
||||||
|
#include "Emu\RSX\Common\BufferUtils.h"
|
||||||
|
|
||||||
|
|
||||||
|
TEST_CLASS(rsx_common)
|
||||||
|
{
|
||||||
|
// Check UB256 size is correctly set in write_vertex_array_data_to_buffer
|
||||||
|
TEST_METHOD(ub256_upload)
|
||||||
|
{
|
||||||
|
std::vector<gsl::byte> dest_buffer(2200);
|
||||||
|
std::vector<gsl::byte> src_buffer(100000); // Big enough
|
||||||
|
|
||||||
|
write_vertex_array_data_to_buffer(gsl::span<gsl::byte>(dest_buffer), src_buffer.data(), 0, 550, rsx::vertex_base_type::ub256, 4, 20);
|
||||||
|
}
|
||||||
|
};
|
@ -56,7 +56,7 @@
|
|||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<AdditionalLibraryDirectories>$(VCInstallDir)UnitTest\lib;..\OpenAL\libs\Win64;..\ffmpeg\Windows\x86_64\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
<AdditionalLibraryDirectories>$(VCInstallDir)UnitTest\lib;..\OpenAL\libs\Win64;..\ffmpeg\Windows\x86_64\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||||
</Link>
|
</Link>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||||
<ClCompile>
|
<ClCompile>
|
||||||
@ -76,6 +76,7 @@
|
|||||||
<ClInclude Include="stdafx.h" />
|
<ClInclude Include="stdafx.h" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<ClCompile Include="ps3-rsx-common.cpp" />
|
||||||
<ClCompile Include="ps3_ppu_llvm.cpp" />
|
<ClCompile Include="ps3_ppu_llvm.cpp" />
|
||||||
<ClCompile Include="stdafx.cpp">
|
<ClCompile Include="stdafx.cpp">
|
||||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
|
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
|
||||||
|
@ -17,6 +17,9 @@
|
|||||||
<ClCompile Include="ps3_ppu_llvm.cpp">
|
<ClCompile Include="ps3_ppu_llvm.cpp">
|
||||||
<Filter>Source Files</Filter>
|
<Filter>Source Files</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="ps3-rsx-common.cpp">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClInclude Include="stdafx.h">
|
<ClInclude Include="stdafx.h">
|
||||||
|
@ -58,6 +58,7 @@ void write_vertex_array_data_to_buffer(gsl::span<gsl::byte> raw_dst_span, const
|
|||||||
switch (type)
|
switch (type)
|
||||||
{
|
{
|
||||||
case rsx::vertex_base_type::ub:
|
case rsx::vertex_base_type::ub:
|
||||||
|
case rsx::vertex_base_type::ub256:
|
||||||
{
|
{
|
||||||
gsl::span<u8> dst_span = as_span_workaround<u8>(raw_dst_span);
|
gsl::span<u8> dst_span = as_span_workaround<u8>(raw_dst_span);
|
||||||
copy_whole_attribute_array<u8>(dst_span, src_ptr, vector_element_count, element_size, attribute_src_stride, first, count);
|
copy_whole_attribute_array<u8>(dst_span, src_ptr, vector_element_count, element_size, attribute_src_stride, first, count);
|
||||||
@ -72,7 +73,6 @@ void write_vertex_array_data_to_buffer(gsl::span<gsl::byte> raw_dst_span, const
|
|||||||
}
|
}
|
||||||
case rsx::vertex_base_type::f:
|
case rsx::vertex_base_type::f:
|
||||||
case rsx::vertex_base_type::s32k:
|
case rsx::vertex_base_type::s32k:
|
||||||
case rsx::vertex_base_type::ub256:
|
|
||||||
{
|
{
|
||||||
gsl::span<u32> dst_span = as_span_workaround<u32>(raw_dst_span);
|
gsl::span<u32> dst_span = as_span_workaround<u32>(raw_dst_span);
|
||||||
copy_whole_attribute_array<be_t<u32>>(dst_span, src_ptr, vector_element_count, element_size, attribute_src_stride, first, count);
|
copy_whole_attribute_array<be_t<u32>>(dst_span, src_ptr, vector_element_count, element_size, attribute_src_stride, first, count);
|
||||||
|
@ -1127,10 +1127,10 @@ namespace
|
|||||||
case rsx::vertex_base_type::s1: return "Short";
|
case rsx::vertex_base_type::s1: return "Short";
|
||||||
case rsx::vertex_base_type::f: return "Float";
|
case rsx::vertex_base_type::f: return "Float";
|
||||||
case rsx::vertex_base_type::sf: return "Half float";
|
case rsx::vertex_base_type::sf: return "Half float";
|
||||||
case rsx::vertex_base_type::ub: return "Unsigned byte";
|
case rsx::vertex_base_type::ub: return "Unsigned byte normalized";
|
||||||
case rsx::vertex_base_type::s32k: return "Signed int";
|
case rsx::vertex_base_type::s32k: return "Signed int";
|
||||||
case rsx::vertex_base_type::cmp: return "CMP";
|
case rsx::vertex_base_type::cmp: return "CMP";
|
||||||
case rsx::vertex_base_type::ub256: return "UB256";
|
case rsx::vertex_base_type::ub256: return "Unsigned byte unormalized";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -30,10 +30,10 @@ namespace rsx
|
|||||||
s1, ///< signed byte
|
s1, ///< signed byte
|
||||||
f, ///< float
|
f, ///< float
|
||||||
sf, ///< half float
|
sf, ///< half float
|
||||||
ub, ///< unsigned byte
|
ub, ///< unsigned byte interpreted as 0.f and 1.f
|
||||||
s32k, ///< signed 32bits int
|
s32k, ///< signed 32bits int
|
||||||
cmp, ///< compressed aka X11G11Z10 and always 1. W.
|
cmp, ///< compressed aka X11G11Z10 and always 1. W.
|
||||||
ub256,
|
ub256, ///< unsigned byte interpreted as between 0 and 255.
|
||||||
};
|
};
|
||||||
|
|
||||||
vertex_base_type to_vertex_base_type(u8 in);
|
vertex_base_type to_vertex_base_type(u8 in);
|
||||||
|
@ -136,8 +136,8 @@ namespace rsx
|
|||||||
case 3:
|
case 3:
|
||||||
return sizeof(u16) * 4;
|
return sizeof(u16) * 4;
|
||||||
}
|
}
|
||||||
throw new EXCEPTION("Wrong vector size");
|
throw EXCEPTION("Wrong vector size");
|
||||||
case vertex_base_type::f: return sizeof(f32) * size;
|
case vertex_base_type::f: return sizeof(f32) * size;
|
||||||
case vertex_base_type::sf:
|
case vertex_base_type::sf:
|
||||||
switch (size)
|
switch (size)
|
||||||
{
|
{
|
||||||
@ -148,7 +148,7 @@ namespace rsx
|
|||||||
case 3:
|
case 3:
|
||||||
return sizeof(f16) * 4;
|
return sizeof(f16) * 4;
|
||||||
}
|
}
|
||||||
throw new EXCEPTION("Wrong vector size");
|
throw EXCEPTION("Wrong vector size");
|
||||||
case vertex_base_type::ub:
|
case vertex_base_type::ub:
|
||||||
switch (size)
|
switch (size)
|
||||||
{
|
{
|
||||||
@ -159,15 +159,12 @@ namespace rsx
|
|||||||
case 3:
|
case 3:
|
||||||
return sizeof(u8) * 4;
|
return sizeof(u8) * 4;
|
||||||
}
|
}
|
||||||
throw new EXCEPTION("Wrong vector size");
|
throw EXCEPTION("Wrong vector size");
|
||||||
case vertex_base_type::s32k: return sizeof(u32) * size;
|
case vertex_base_type::s32k: return sizeof(u32) * size;
|
||||||
case vertex_base_type::cmp: return sizeof(u16) * 4;
|
case vertex_base_type::cmp: return sizeof(u16) * 4;
|
||||||
case vertex_base_type::ub256: return sizeof(u8) * 4;
|
case vertex_base_type::ub256: Expects(size == 4); return sizeof(u8) * 4;
|
||||||
|
|
||||||
default:
|
|
||||||
throw new EXCEPTION("RSXVertexData::GetTypeSize: Bad vertex data type (%d)!", type);
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
throw EXCEPTION("RSXVertexData::GetTypeSize: Bad vertex data type (%d)!", type);
|
||||||
}
|
}
|
||||||
|
|
||||||
void tiled_region::write(const void *src, u32 width, u32 height, u32 pitch)
|
void tiled_region::write(const void *src, u32 width, u32 height, u32 pitch)
|
||||||
|
Loading…
Reference in New Issue
Block a user