mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-05 22:41:25 +12:00
rsx methods constants moved to rsx namespace
minor fix
This commit is contained in:
parent
2e58f312d5
commit
19ce0cdc09
16 changed files with 520 additions and 518 deletions
|
@ -50,12 +50,12 @@ void write_vertex_array_data_to_buffer(void *buffer, u32 first, u32 count, size_
|
|||
|
||||
switch (vertex_array_desc.type)
|
||||
{
|
||||
case vertex_base_type::ub:
|
||||
case rsx::vertex_base_type::ub:
|
||||
memcpy(dst, src, vertex_array_desc.size);
|
||||
break;
|
||||
|
||||
case vertex_base_type::s1:
|
||||
case vertex_base_type::sf:
|
||||
case rsx::vertex_base_type::s1:
|
||||
case rsx::vertex_base_type::sf:
|
||||
{
|
||||
auto* c_src = (const be_t<u16>*)src;
|
||||
u16* c_dst = (u16*)dst;
|
||||
|
@ -69,9 +69,9 @@ void write_vertex_array_data_to_buffer(void *buffer, u32 first, u32 count, size_
|
|||
break;
|
||||
}
|
||||
|
||||
case vertex_base_type::f:
|
||||
case vertex_base_type::s32k:
|
||||
case vertex_base_type::ub256:
|
||||
case rsx::vertex_base_type::f:
|
||||
case rsx::vertex_base_type::s32k:
|
||||
case rsx::vertex_base_type::ub256:
|
||||
{
|
||||
auto* c_src = (const be_t<u32>*)src;
|
||||
u32* c_dst = (u32*)dst;
|
||||
|
@ -82,7 +82,7 @@ void write_vertex_array_data_to_buffer(void *buffer, u32 first, u32 count, size_
|
|||
}
|
||||
break;
|
||||
}
|
||||
case vertex_base_type::cmp:
|
||||
case rsx::vertex_base_type::cmp:
|
||||
{
|
||||
auto* c_src = (const be_t<u32>*)src;
|
||||
const auto& decoded_vector = decode_cmp_vector(*c_src);
|
||||
|
@ -244,21 +244,21 @@ std::tuple<T, T> expand_indexed_quads(gsl::span<to_be_t<const T>> src, gsl::span
|
|||
}
|
||||
|
||||
// Only handle quads and triangle fan now
|
||||
bool is_primitive_native(primitive_type draw_mode)
|
||||
bool is_primitive_native(rsx::primitive_type draw_mode)
|
||||
{
|
||||
switch (draw_mode)
|
||||
{
|
||||
case primitive_type::points:
|
||||
case primitive_type::lines:
|
||||
case primitive_type::line_loop:
|
||||
case primitive_type::line_strip:
|
||||
case primitive_type::triangles:
|
||||
case primitive_type::triangle_strip:
|
||||
case primitive_type::quad_strip:
|
||||
case rsx::primitive_type::points:
|
||||
case rsx::primitive_type::lines:
|
||||
case rsx::primitive_type::line_loop:
|
||||
case rsx::primitive_type::line_strip:
|
||||
case rsx::primitive_type::triangles:
|
||||
case rsx::primitive_type::triangle_strip:
|
||||
case rsx::primitive_type::quad_strip:
|
||||
return true;
|
||||
case primitive_type::polygon:
|
||||
case primitive_type::triangle_fan:
|
||||
case primitive_type::quads:
|
||||
case rsx::primitive_type::polygon:
|
||||
case rsx::primitive_type::triangle_fan:
|
||||
case rsx::primitive_type::quads:
|
||||
return false;
|
||||
}
|
||||
throw new EXCEPTION("Wrong primitive type");
|
||||
|
@ -269,7 +269,7 @@ bool is_primitive_native(primitive_type draw_mode)
|
|||
* see http://www.gamedev.net/page/resources/_/technical/graphics-programming-and-theory/polygon-triangulation-r3334
|
||||
*/
|
||||
|
||||
size_t get_index_count(primitive_type draw_mode, unsigned initial_index_count)
|
||||
size_t get_index_count(rsx::primitive_type draw_mode, unsigned initial_index_count)
|
||||
{
|
||||
// Index count
|
||||
if (is_primitive_native(draw_mode))
|
||||
|
@ -277,33 +277,33 @@ size_t get_index_count(primitive_type draw_mode, unsigned initial_index_count)
|
|||
|
||||
switch (draw_mode)
|
||||
{
|
||||
case primitive_type::polygon:
|
||||
case primitive_type::triangle_fan:
|
||||
case rsx::primitive_type::polygon:
|
||||
case rsx::primitive_type::triangle_fan:
|
||||
return (initial_index_count - 2) * 3;
|
||||
case primitive_type::quads:
|
||||
case rsx::primitive_type::quads:
|
||||
return (6 * initial_index_count) / 4;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
size_t get_index_type_size(index_array_type type)
|
||||
size_t get_index_type_size(rsx::index_array_type type)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case index_array_type::unsigned_16b: return 2;
|
||||
case index_array_type::unsigned_32b: return 4;
|
||||
case rsx::index_array_type::u16: return sizeof(u16);
|
||||
case rsx::index_array_type::u32: return sizeof(u32);
|
||||
}
|
||||
throw new EXCEPTION("Wrong index type");
|
||||
}
|
||||
|
||||
void write_index_array_for_non_indexed_non_native_primitive_to_buffer(char* dst, primitive_type draw_mode, unsigned first, unsigned count)
|
||||
void write_index_array_for_non_indexed_non_native_primitive_to_buffer(char* dst, rsx::primitive_type draw_mode, unsigned first, unsigned count)
|
||||
{
|
||||
unsigned short *typedDst = (unsigned short *)(dst);
|
||||
switch (draw_mode)
|
||||
{
|
||||
case primitive_type::triangle_fan:
|
||||
case primitive_type::polygon:
|
||||
case rsx::primitive_type::triangle_fan:
|
||||
case rsx::primitive_type::polygon:
|
||||
for (unsigned i = 0; i < (count - 2); i++)
|
||||
{
|
||||
typedDst[3 * i] = first;
|
||||
|
@ -311,7 +311,7 @@ void write_index_array_for_non_indexed_non_native_primitive_to_buffer(char* dst,
|
|||
typedDst[3 * i + 2] = i + 2;
|
||||
}
|
||||
return;
|
||||
case primitive_type::quads:
|
||||
case rsx::primitive_type::quads:
|
||||
for (unsigned i = 0; i < count / 4; i++)
|
||||
{
|
||||
// First triangle
|
||||
|
@ -324,13 +324,13 @@ void write_index_array_for_non_indexed_non_native_primitive_to_buffer(char* dst,
|
|||
typedDst[6 * i + 5] = 4 * i + first;
|
||||
}
|
||||
return;
|
||||
case primitive_type::points:
|
||||
case primitive_type::lines:
|
||||
case primitive_type::line_loop:
|
||||
case primitive_type::line_strip:
|
||||
case primitive_type::triangles:
|
||||
case primitive_type::triangle_strip:
|
||||
case primitive_type::quad_strip:
|
||||
case rsx::primitive_type::points:
|
||||
case rsx::primitive_type::lines:
|
||||
case rsx::primitive_type::line_loop:
|
||||
case rsx::primitive_type::line_strip:
|
||||
case rsx::primitive_type::triangles:
|
||||
case rsx::primitive_type::triangle_strip:
|
||||
case rsx::primitive_type::quad_strip:
|
||||
throw new EXCEPTION("Native primitive type doesn't require expansion");
|
||||
}
|
||||
}
|
||||
|
@ -338,10 +338,10 @@ void write_index_array_for_non_indexed_non_native_primitive_to_buffer(char* dst,
|
|||
// TODO: Unify indexed and non indexed primitive expansion ?
|
||||
|
||||
template<typename T>
|
||||
std::tuple<T, T> write_index_array_data_to_buffer_impl(gsl::span<T, gsl::dynamic_range> dst, primitive_type draw_mode, const std::vector<std::pair<u32, u32> > &first_count_arguments)
|
||||
std::tuple<T, T> write_index_array_data_to_buffer_impl(gsl::span<T, gsl::dynamic_range> dst, rsx::primitive_type draw_mode, const std::vector<std::pair<u32, u32> > &first_count_arguments)
|
||||
{
|
||||
u32 address = rsx::get_address(rsx::method_registers[NV4097_SET_INDEX_ARRAY_ADDRESS], rsx::method_registers[NV4097_SET_INDEX_ARRAY_DMA] & 0xf);
|
||||
index_array_type type = to_index_array_type(rsx::method_registers[NV4097_SET_INDEX_ARRAY_DMA] >> 4);
|
||||
rsx::index_array_type type = rsx::to_index_array_type(rsx::method_registers[NV4097_SET_INDEX_ARRAY_DMA] >> 4);
|
||||
|
||||
u32 type_size = gsl::narrow<u32>(get_index_type_size(type));
|
||||
|
||||
|
@ -364,30 +364,30 @@ std::tuple<T, T> write_index_array_data_to_buffer_impl(gsl::span<T, gsl::dynamic
|
|||
|
||||
switch (draw_mode)
|
||||
{
|
||||
case primitive_type::points:
|
||||
case primitive_type::lines:
|
||||
case primitive_type::line_loop:
|
||||
case primitive_type::line_strip:
|
||||
case primitive_type::triangles:
|
||||
case primitive_type::triangle_strip:
|
||||
case primitive_type::quad_strip:
|
||||
case rsx::primitive_type::points:
|
||||
case rsx::primitive_type::lines:
|
||||
case rsx::primitive_type::line_loop:
|
||||
case rsx::primitive_type::line_strip:
|
||||
case rsx::primitive_type::triangles:
|
||||
case rsx::primitive_type::triangle_strip:
|
||||
case rsx::primitive_type::quad_strip:
|
||||
return upload_untouched<T>({ ptr, count }, dst, is_primitive_restart_enabled, primitive_restart_index);
|
||||
case primitive_type::polygon:
|
||||
case primitive_type::triangle_fan:
|
||||
case rsx::primitive_type::polygon:
|
||||
case rsx::primitive_type::triangle_fan:
|
||||
return expand_indexed_triangle_fan<T>({ ptr, count }, dst, is_primitive_restart_enabled, primitive_restart_index);
|
||||
case primitive_type::quads:
|
||||
case rsx::primitive_type::quads:
|
||||
return expand_indexed_quads<T>({ ptr, count }, dst, is_primitive_restart_enabled, primitive_restart_index);
|
||||
}
|
||||
|
||||
throw new EXCEPTION("Unknow draw mode");
|
||||
}
|
||||
|
||||
std::tuple<u32, u32> write_index_array_data_to_buffer(gsl::span<u32, gsl::dynamic_range> dst, primitive_type draw_mode, const std::vector<std::pair<u32, u32> > &first_count_arguments)
|
||||
std::tuple<u32, u32> write_index_array_data_to_buffer(gsl::span<u32, gsl::dynamic_range> dst, rsx::primitive_type draw_mode, const std::vector<std::pair<u32, u32> > &first_count_arguments)
|
||||
{
|
||||
return write_index_array_data_to_buffer_impl(dst, draw_mode, first_count_arguments);
|
||||
}
|
||||
|
||||
std::tuple<u16, u16> write_index_array_data_to_buffer(gsl::span<u16, gsl::dynamic_range> dst, primitive_type draw_mode, const std::vector<std::pair<u32, u32> > &first_count_arguments)
|
||||
std::tuple<u16, u16> write_index_array_data_to_buffer(gsl::span<u16, gsl::dynamic_range> dst, rsx::primitive_type draw_mode, const std::vector<std::pair<u32, u32> > &first_count_arguments)
|
||||
{
|
||||
return write_index_array_data_to_buffer_impl(dst, draw_mode, first_count_arguments);
|
||||
}
|
||||
|
@ -395,7 +395,7 @@ std::tuple<u16, u16> write_index_array_data_to_buffer(gsl::span<u16, gsl::dynami
|
|||
std::tuple<u32, u32> write_index_array_data_to_buffer_untouched(gsl::span<u32, gsl::dynamic_range> dst, const std::vector<std::pair<u32, u32> > &first_count_arguments)
|
||||
{
|
||||
u32 address = rsx::get_address(rsx::method_registers[NV4097_SET_INDEX_ARRAY_ADDRESS], rsx::method_registers[NV4097_SET_INDEX_ARRAY_DMA] & 0xf);
|
||||
index_array_type type = to_index_array_type(rsx::method_registers[NV4097_SET_INDEX_ARRAY_DMA] >> 4);
|
||||
rsx::index_array_type type = rsx::to_index_array_type(rsx::method_registers[NV4097_SET_INDEX_ARRAY_DMA] >> 4);
|
||||
|
||||
u32 type_size = gsl::narrow<u32>(get_index_type_size(type));
|
||||
bool is_primitive_restart_enabled = !!rsx::method_registers[NV4097_SET_RESTART_INDEX_ENABLE];
|
||||
|
@ -418,7 +418,7 @@ std::tuple<u32, u32> write_index_array_data_to_buffer_untouched(gsl::span<u32, g
|
|||
std::tuple<u16, u16> write_index_array_data_to_buffer_untouched(gsl::span<u16, gsl::dynamic_range> dst, const std::vector<std::pair<u32, u32> > &first_count_arguments)
|
||||
{
|
||||
u32 address = rsx::get_address(rsx::method_registers[NV4097_SET_INDEX_ARRAY_ADDRESS], rsx::method_registers[NV4097_SET_INDEX_ARRAY_DMA] & 0xf);
|
||||
index_array_type type = to_index_array_type(rsx::method_registers[NV4097_SET_INDEX_ARRAY_DMA] >> 4);
|
||||
rsx::index_array_type type = rsx::to_index_array_type(rsx::method_registers[NV4097_SET_INDEX_ARRAY_DMA] >> 4);
|
||||
|
||||
u32 type_size = gsl::narrow<u32>(get_index_type_size(type));
|
||||
bool is_primitive_restart_enabled = !!rsx::method_registers[NV4097_SET_RESTART_INDEX_ENABLE];
|
||||
|
|
|
@ -11,25 +11,25 @@ void write_vertex_array_data_to_buffer(void *buffer, u32 first, u32 count, size_
|
|||
/*
|
||||
* If primitive mode is not supported and need to be emulated (using an index buffer) returns false.
|
||||
*/
|
||||
bool is_primitive_native(primitive_type m_draw_mode);
|
||||
bool is_primitive_native(rsx::primitive_type m_draw_mode);
|
||||
|
||||
/**
|
||||
* Returns a fixed index count for emulated primitive, otherwise returns initial_index_count
|
||||
*/
|
||||
size_t get_index_count(primitive_type m_draw_mode, unsigned initial_index_count);
|
||||
size_t get_index_count(rsx::primitive_type m_draw_mode, unsigned initial_index_count);
|
||||
|
||||
/**
|
||||
* Returns index type size in byte
|
||||
*/
|
||||
size_t get_index_type_size(index_array_type type);
|
||||
size_t get_index_type_size(rsx::index_array_type type);
|
||||
|
||||
/**
|
||||
* Write count indexes using (first, first + count) ranges.
|
||||
* Returns min/max index found during the process.
|
||||
* The function expands index buffer for non native primitive type.
|
||||
*/
|
||||
std::tuple<u32, u32> write_index_array_data_to_buffer(gsl::span<u32, gsl::dynamic_range> dst, primitive_type draw_mode, const std::vector<std::pair<u32, u32> > &first_count_arguments);
|
||||
std::tuple<u16, u16> write_index_array_data_to_buffer(gsl::span<u16, gsl::dynamic_range> dst, primitive_type draw_mode, const std::vector<std::pair<u32, u32> > &first_count_arguments);
|
||||
std::tuple<u32, u32> write_index_array_data_to_buffer(gsl::span<u32, gsl::dynamic_range> dst, rsx::primitive_type draw_mode, const std::vector<std::pair<u32, u32> > &first_count_arguments);
|
||||
std::tuple<u16, u16> write_index_array_data_to_buffer(gsl::span<u16, gsl::dynamic_range> dst, rsx::primitive_type draw_mode, const std::vector<std::pair<u32, u32> > &first_count_arguments);
|
||||
|
||||
/**
|
||||
* Doesn't expand index
|
||||
|
@ -40,7 +40,7 @@ std::tuple<u16, u16> write_index_array_data_to_buffer_untouched(gsl::span<u16, g
|
|||
/**
|
||||
* Write index data needed to emulate non indexed non native primitive mode.
|
||||
*/
|
||||
void write_index_array_for_non_indexed_non_native_primitive_to_buffer(char* dst, primitive_type draw_mode, unsigned first, unsigned count);
|
||||
void write_index_array_for_non_indexed_non_native_primitive_to_buffer(char* dst, rsx::primitive_type draw_mode, unsigned first, unsigned count);
|
||||
|
||||
/**
|
||||
* Stream a 128 bits vector to dst.
|
||||
|
|
|
@ -306,7 +306,7 @@ std::tuple<bool, size_t> D3D12GSRender::upload_and_set_vertex_index_data(ID3D12G
|
|||
index_count += pair.second;
|
||||
index_count = get_index_count(draw_mode, gsl::narrow<int>(index_count));
|
||||
|
||||
index_array_type indexed_type = to_index_array_type(rsx::method_registers[NV4097_SET_INDEX_ARRAY_DMA] >> 4);
|
||||
rsx::index_array_type indexed_type = rsx::to_index_array_type(rsx::method_registers[NV4097_SET_INDEX_ARRAY_DMA] >> 4);
|
||||
size_t index_size = get_index_type_size(indexed_type);
|
||||
|
||||
// Alloc
|
||||
|
@ -316,13 +316,13 @@ std::tuple<bool, size_t> D3D12GSRender::upload_and_set_vertex_index_data(ID3D12G
|
|||
void *mapped_buffer = m_buffer_data.map<void>(CD3DX12_RANGE(heap_offset, heap_offset + buffer_size));
|
||||
u32 min_index, max_index;
|
||||
|
||||
if (indexed_type == index_array_type::unsigned_16b)
|
||||
if (indexed_type == rsx::index_array_type::u16)
|
||||
{
|
||||
gsl::span<u16> dst = { (u16*)mapped_buffer, gsl::narrow<int>(buffer_size / index_size) };
|
||||
std::tie(min_index, max_index) = write_index_array_data_to_buffer(dst, draw_mode, first_count_commands);
|
||||
}
|
||||
|
||||
if (indexed_type == index_array_type::unsigned_32b)
|
||||
if (indexed_type == rsx::index_array_type::u32)
|
||||
{
|
||||
gsl::span<u32> dst = { (u32*)mapped_buffer, gsl::narrow<int>(buffer_size / index_size) };
|
||||
std::tie(min_index, max_index) = write_index_array_data_to_buffer(dst, draw_mode, first_count_commands);
|
||||
|
|
|
@ -262,99 +262,99 @@ D3D12_FILTER get_texture_filter(u8 min_filter, u8 mag_filter)
|
|||
return D3D12_ENCODE_BASIC_FILTER(min, mag, mip, D3D12_FILTER_REDUCTION_TYPE_STANDARD);
|
||||
}
|
||||
|
||||
D3D12_PRIMITIVE_TOPOLOGY get_primitive_topology(primitive_type draw_mode)
|
||||
D3D12_PRIMITIVE_TOPOLOGY get_primitive_topology(rsx::primitive_type draw_mode)
|
||||
{
|
||||
switch (draw_mode)
|
||||
{
|
||||
case primitive_type::points: return D3D_PRIMITIVE_TOPOLOGY_POINTLIST;
|
||||
case primitive_type::lines: return D3D_PRIMITIVE_TOPOLOGY_LINELIST;
|
||||
case primitive_type::line_loop: return D3D_PRIMITIVE_TOPOLOGY_LINELIST_ADJ;
|
||||
case primitive_type::line_strip: return D3D_PRIMITIVE_TOPOLOGY_LINESTRIP;
|
||||
case primitive_type::triangles: return D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST;
|
||||
case primitive_type::triangle_strip: return D3D_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP;
|
||||
case primitive_type::triangle_fan: return D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST;
|
||||
case primitive_type::quads: return D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST;
|
||||
case primitive_type::quad_strip: return D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST;
|
||||
case primitive_type::polygon: return D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST;
|
||||
case rsx::primitive_type::points: return D3D_PRIMITIVE_TOPOLOGY_POINTLIST;
|
||||
case rsx::primitive_type::lines: return D3D_PRIMITIVE_TOPOLOGY_LINELIST;
|
||||
case rsx::primitive_type::line_loop: return D3D_PRIMITIVE_TOPOLOGY_LINELIST_ADJ;
|
||||
case rsx::primitive_type::line_strip: return D3D_PRIMITIVE_TOPOLOGY_LINESTRIP;
|
||||
case rsx::primitive_type::triangles: return D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST;
|
||||
case rsx::primitive_type::triangle_strip: return D3D_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP;
|
||||
case rsx::primitive_type::triangle_fan: return D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST;
|
||||
case rsx::primitive_type::quads: return D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST;
|
||||
case rsx::primitive_type::quad_strip: return D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST;
|
||||
case rsx::primitive_type::polygon: return D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST;
|
||||
}
|
||||
throw EXCEPTION("Invalid draw mode (0x%x)", draw_mode);
|
||||
}
|
||||
|
||||
D3D12_PRIMITIVE_TOPOLOGY_TYPE get_primitive_topology_type(primitive_type draw_mode)
|
||||
D3D12_PRIMITIVE_TOPOLOGY_TYPE get_primitive_topology_type(rsx::primitive_type draw_mode)
|
||||
{
|
||||
switch (draw_mode)
|
||||
{
|
||||
case primitive_type::points: return D3D12_PRIMITIVE_TOPOLOGY_TYPE_POINT;
|
||||
case primitive_type::lines: return D3D12_PRIMITIVE_TOPOLOGY_TYPE_LINE;
|
||||
case primitive_type::line_strip: return D3D12_PRIMITIVE_TOPOLOGY_TYPE_LINE;
|
||||
case primitive_type::triangles: return D3D12_PRIMITIVE_TOPOLOGY_TYPE_TRIANGLE;
|
||||
case primitive_type::triangle_strip: return D3D12_PRIMITIVE_TOPOLOGY_TYPE_TRIANGLE;
|
||||
case primitive_type::triangle_fan: return D3D12_PRIMITIVE_TOPOLOGY_TYPE_TRIANGLE;
|
||||
case primitive_type::quads: return D3D12_PRIMITIVE_TOPOLOGY_TYPE_TRIANGLE;
|
||||
case primitive_type::quad_strip: return D3D12_PRIMITIVE_TOPOLOGY_TYPE_TRIANGLE;
|
||||
case primitive_type::polygon: return D3D12_PRIMITIVE_TOPOLOGY_TYPE_TRIANGLE;
|
||||
case primitive_type::line_loop: return D3D12_PRIMITIVE_TOPOLOGY_TYPE_LINE;
|
||||
case rsx::primitive_type::points: return D3D12_PRIMITIVE_TOPOLOGY_TYPE_POINT;
|
||||
case rsx::primitive_type::lines: return D3D12_PRIMITIVE_TOPOLOGY_TYPE_LINE;
|
||||
case rsx::primitive_type::line_strip: return D3D12_PRIMITIVE_TOPOLOGY_TYPE_LINE;
|
||||
case rsx::primitive_type::triangles: return D3D12_PRIMITIVE_TOPOLOGY_TYPE_TRIANGLE;
|
||||
case rsx::primitive_type::triangle_strip: return D3D12_PRIMITIVE_TOPOLOGY_TYPE_TRIANGLE;
|
||||
case rsx::primitive_type::triangle_fan: return D3D12_PRIMITIVE_TOPOLOGY_TYPE_TRIANGLE;
|
||||
case rsx::primitive_type::quads: return D3D12_PRIMITIVE_TOPOLOGY_TYPE_TRIANGLE;
|
||||
case rsx::primitive_type::quad_strip: return D3D12_PRIMITIVE_TOPOLOGY_TYPE_TRIANGLE;
|
||||
case rsx::primitive_type::polygon: return D3D12_PRIMITIVE_TOPOLOGY_TYPE_TRIANGLE;
|
||||
case rsx::primitive_type::line_loop: return D3D12_PRIMITIVE_TOPOLOGY_TYPE_LINE;
|
||||
}
|
||||
throw EXCEPTION("Invalid or unsupported draw mode (0x%x)", draw_mode);
|
||||
}
|
||||
|
||||
DXGI_FORMAT get_color_surface_format(surface_color_format format)
|
||||
DXGI_FORMAT get_color_surface_format(rsx::surface_color_format format)
|
||||
{
|
||||
switch (format)
|
||||
{
|
||||
case surface_color_format::r5g6b5: return DXGI_FORMAT_B5G6R5_UNORM;
|
||||
case surface_color_format::x8r8g8b8_o8r8g8b8:
|
||||
case surface_color_format::x8r8g8b8_z8r8g8b8:
|
||||
case surface_color_format::x8b8g8r8_o8b8g8r8:
|
||||
case surface_color_format::x8b8g8r8_z8b8g8r8:
|
||||
case rsx::surface_color_format::r5g6b5: return DXGI_FORMAT_B5G6R5_UNORM;
|
||||
case rsx::surface_color_format::x8r8g8b8_o8r8g8b8:
|
||||
case rsx::surface_color_format::x8r8g8b8_z8r8g8b8:
|
||||
case rsx::surface_color_format::x8b8g8r8_o8b8g8r8:
|
||||
case rsx::surface_color_format::x8b8g8r8_z8b8g8r8:
|
||||
return DXGI_FORMAT_B8G8R8X8_UNORM; //BIT.TRIP Runner2 use this
|
||||
case surface_color_format::a8b8g8r8:
|
||||
case surface_color_format::a8r8g8b8: return DXGI_FORMAT_R8G8B8A8_UNORM;
|
||||
case surface_color_format::b8: return DXGI_FORMAT_R8_UNORM;
|
||||
case surface_color_format::g8b8: return DXGI_FORMAT_R8G8_UNORM;
|
||||
case surface_color_format::w16z16y16x16: return DXGI_FORMAT_R16G16B16A16_FLOAT;
|
||||
case surface_color_format::w32z32y32x32: return DXGI_FORMAT_R32G32B32A32_FLOAT;
|
||||
case surface_color_format::x32: return DXGI_FORMAT_R32_FLOAT;
|
||||
case rsx::surface_color_format::a8b8g8r8:
|
||||
case rsx::surface_color_format::a8r8g8b8: return DXGI_FORMAT_R8G8B8A8_UNORM;
|
||||
case rsx::surface_color_format::b8: return DXGI_FORMAT_R8_UNORM;
|
||||
case rsx::surface_color_format::g8b8: return DXGI_FORMAT_R8G8_UNORM;
|
||||
case rsx::surface_color_format::w16z16y16x16: return DXGI_FORMAT_R16G16B16A16_FLOAT;
|
||||
case rsx::surface_color_format::w32z32y32x32: return DXGI_FORMAT_R32G32B32A32_FLOAT;
|
||||
case rsx::surface_color_format::x32: return DXGI_FORMAT_R32_FLOAT;
|
||||
}
|
||||
throw EXCEPTION("Invalid format (0x%x)", format);
|
||||
}
|
||||
|
||||
DXGI_FORMAT get_depth_stencil_surface_format(surface_depth_format format)
|
||||
DXGI_FORMAT get_depth_stencil_surface_format(rsx::surface_depth_format format)
|
||||
{
|
||||
switch (format)
|
||||
{
|
||||
case surface_depth_format::z16: return DXGI_FORMAT_D16_UNORM;
|
||||
case surface_depth_format::z24s8: return DXGI_FORMAT_D24_UNORM_S8_UINT;
|
||||
case rsx::surface_depth_format::z16: return DXGI_FORMAT_D16_UNORM;
|
||||
case rsx::surface_depth_format::z24s8: return DXGI_FORMAT_D24_UNORM_S8_UINT;
|
||||
}
|
||||
throw EXCEPTION("Invalid format (0x%x)", format);
|
||||
}
|
||||
|
||||
DXGI_FORMAT get_depth_stencil_surface_clear_format(surface_depth_format format)
|
||||
DXGI_FORMAT get_depth_stencil_surface_clear_format(rsx::surface_depth_format format)
|
||||
{
|
||||
switch (format)
|
||||
{
|
||||
case surface_depth_format::z16: return DXGI_FORMAT_D16_UNORM;
|
||||
case surface_depth_format::z24s8: return DXGI_FORMAT_D24_UNORM_S8_UINT;
|
||||
case rsx::surface_depth_format::z16: return DXGI_FORMAT_D16_UNORM;
|
||||
case rsx::surface_depth_format::z24s8: return DXGI_FORMAT_D24_UNORM_S8_UINT;
|
||||
}
|
||||
throw EXCEPTION("Invalid format (0x%x)", format);
|
||||
}
|
||||
|
||||
DXGI_FORMAT get_depth_stencil_typeless_surface_format(surface_depth_format format)
|
||||
DXGI_FORMAT get_depth_stencil_typeless_surface_format(rsx::surface_depth_format format)
|
||||
{
|
||||
switch (format)
|
||||
{
|
||||
case surface_depth_format::z16: return DXGI_FORMAT_R16_TYPELESS;
|
||||
case surface_depth_format::z24s8: return DXGI_FORMAT_R24G8_TYPELESS;
|
||||
case rsx::surface_depth_format::z16: return DXGI_FORMAT_R16_TYPELESS;
|
||||
case rsx::surface_depth_format::z24s8: return DXGI_FORMAT_R24G8_TYPELESS;
|
||||
}
|
||||
throw EXCEPTION("Invalid format (0x%x)", format);
|
||||
}
|
||||
|
||||
DXGI_FORMAT get_depth_samplable_surface_format(surface_depth_format format)
|
||||
DXGI_FORMAT get_depth_samplable_surface_format(rsx::surface_depth_format format)
|
||||
{
|
||||
switch (format)
|
||||
{
|
||||
case surface_depth_format::z16: return DXGI_FORMAT_R16_UNORM;
|
||||
case surface_depth_format::z24s8: return DXGI_FORMAT_R24_UNORM_X8_TYPELESS;
|
||||
case rsx::surface_depth_format::z16: return DXGI_FORMAT_R16_UNORM;
|
||||
case rsx::surface_depth_format::z24s8: return DXGI_FORMAT_R24_UNORM_X8_TYPELESS;
|
||||
}
|
||||
throw EXCEPTION("Invalid format (0x%x)", format);
|
||||
}
|
||||
|
@ -370,21 +370,21 @@ BOOL get_front_face_ccw(u32 ffv)
|
|||
throw EXCEPTION("Invalid front face value (0x%x)", ffv);
|
||||
}
|
||||
|
||||
DXGI_FORMAT get_index_type(index_array_type index_type)
|
||||
DXGI_FORMAT get_index_type(rsx::index_array_type index_type)
|
||||
{
|
||||
switch (index_type)
|
||||
{
|
||||
case index_array_type::unsigned_16b: return DXGI_FORMAT_R16_UINT;
|
||||
case index_array_type::unsigned_32b: return DXGI_FORMAT_R32_UINT;
|
||||
case rsx::index_array_type::u16: return DXGI_FORMAT_R16_UINT;
|
||||
case rsx::index_array_type::u32: return DXGI_FORMAT_R32_UINT;
|
||||
}
|
||||
throw EXCEPTION("Invalid index_type (0x%x)", index_type);
|
||||
}
|
||||
|
||||
DXGI_FORMAT get_vertex_attribute_format(vertex_base_type type, u8 size)
|
||||
DXGI_FORMAT get_vertex_attribute_format(rsx::vertex_base_type type, u8 size)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case vertex_base_type::s1:
|
||||
case rsx::vertex_base_type::s1:
|
||||
{
|
||||
switch (size)
|
||||
{
|
||||
|
@ -395,7 +395,7 @@ DXGI_FORMAT get_vertex_attribute_format(vertex_base_type type, u8 size)
|
|||
}
|
||||
break;
|
||||
}
|
||||
case vertex_base_type::f:
|
||||
case rsx::vertex_base_type::f:
|
||||
{
|
||||
switch (size)
|
||||
{
|
||||
|
@ -406,7 +406,7 @@ DXGI_FORMAT get_vertex_attribute_format(vertex_base_type type, u8 size)
|
|||
}
|
||||
break;
|
||||
}
|
||||
case vertex_base_type::sf:
|
||||
case rsx::vertex_base_type::sf:
|
||||
{
|
||||
switch (size)
|
||||
{
|
||||
|
@ -417,7 +417,7 @@ DXGI_FORMAT get_vertex_attribute_format(vertex_base_type type, u8 size)
|
|||
}
|
||||
break;
|
||||
}
|
||||
case vertex_base_type::ub:
|
||||
case rsx::vertex_base_type::ub:
|
||||
{
|
||||
switch (size)
|
||||
{
|
||||
|
@ -428,7 +428,7 @@ DXGI_FORMAT get_vertex_attribute_format(vertex_base_type type, u8 size)
|
|||
}
|
||||
break;
|
||||
}
|
||||
case vertex_base_type::s32k:
|
||||
case rsx::vertex_base_type::s32k:
|
||||
{
|
||||
switch (size)
|
||||
{
|
||||
|
@ -439,7 +439,7 @@ DXGI_FORMAT get_vertex_attribute_format(vertex_base_type type, u8 size)
|
|||
}
|
||||
break;
|
||||
}
|
||||
case vertex_base_type::cmp:
|
||||
case rsx::vertex_base_type::cmp:
|
||||
{
|
||||
switch (size)
|
||||
{
|
||||
|
@ -450,7 +450,7 @@ DXGI_FORMAT get_vertex_attribute_format(vertex_base_type type, u8 size)
|
|||
}
|
||||
break;
|
||||
}
|
||||
case vertex_base_type::ub256:
|
||||
case rsx::vertex_base_type::ub256:
|
||||
{
|
||||
switch (size)
|
||||
{
|
||||
|
|
|
@ -56,37 +56,37 @@ D3D12_FILTER get_texture_filter(u8 min_filter, u8 mag_filter);
|
|||
/**
|
||||
* Convert draw mode to D3D12_PRIMITIVE_TOPOLOGY
|
||||
*/
|
||||
D3D12_PRIMITIVE_TOPOLOGY get_primitive_topology(primitive_type draw_mode);
|
||||
D3D12_PRIMITIVE_TOPOLOGY get_primitive_topology(rsx::primitive_type draw_mode);
|
||||
|
||||
/**
|
||||
* Convert draw mode to D3D12_PRIMITIVE_TOPOLOGY_TYPE
|
||||
*/
|
||||
D3D12_PRIMITIVE_TOPOLOGY_TYPE get_primitive_topology_type(primitive_type draw_mode);
|
||||
D3D12_PRIMITIVE_TOPOLOGY_TYPE get_primitive_topology_type(rsx::primitive_type draw_mode);
|
||||
|
||||
/**
|
||||
* Convert color surface format to DXGI_FORMAT
|
||||
*/
|
||||
DXGI_FORMAT get_color_surface_format(surface_color_format format);
|
||||
DXGI_FORMAT get_color_surface_format(rsx::surface_color_format format);
|
||||
|
||||
/**
|
||||
* Convert depth stencil surface format to DXGI_FORMAT
|
||||
*/
|
||||
DXGI_FORMAT get_depth_stencil_surface_format(surface_depth_format format);
|
||||
DXGI_FORMAT get_depth_stencil_surface_format(rsx::surface_depth_format format);
|
||||
|
||||
/**
|
||||
*Convert depth stencil surface format to DXGI_FORMAT suited for clear value
|
||||
*/
|
||||
DXGI_FORMAT get_depth_stencil_surface_clear_format(surface_depth_format format);
|
||||
DXGI_FORMAT get_depth_stencil_surface_clear_format(rsx::surface_depth_format format);
|
||||
|
||||
/**
|
||||
* Convert depth surface format to a typeless DXGI_FORMAT
|
||||
*/
|
||||
DXGI_FORMAT get_depth_stencil_typeless_surface_format(surface_depth_format format);
|
||||
DXGI_FORMAT get_depth_stencil_typeless_surface_format(rsx::surface_depth_format format);
|
||||
|
||||
/**
|
||||
* Convert depth surface format to a DXGI_FORMAT that can be depth sampled
|
||||
*/
|
||||
DXGI_FORMAT get_depth_samplable_surface_format(surface_depth_format format);
|
||||
DXGI_FORMAT get_depth_samplable_surface_format(rsx::surface_depth_format format);
|
||||
|
||||
/**
|
||||
* Convert front face value to bool value telling wheter front face is counterclockwise or not
|
||||
|
@ -96,12 +96,12 @@ BOOL get_front_face_ccw(u32 set_front_face_value);
|
|||
/**
|
||||
* Convert index type to DXGI_FORMAT
|
||||
*/
|
||||
DXGI_FORMAT get_index_type(index_array_type index_type);
|
||||
DXGI_FORMAT get_index_type(rsx::index_array_type index_type);
|
||||
|
||||
/**
|
||||
* Convert vertex attribute format and size to DXGI_FORMAT
|
||||
*/
|
||||
DXGI_FORMAT get_vertex_attribute_format(vertex_base_type type, u8 size);
|
||||
DXGI_FORMAT get_vertex_attribute_format(rsx::vertex_base_type type, u8 size);
|
||||
|
||||
/**
|
||||
* Convert scissor register value to D3D12_RECT
|
||||
|
|
|
@ -339,17 +339,17 @@ void D3D12GSRender::end()
|
|||
|
||||
namespace
|
||||
{
|
||||
bool is_flip_surface_in_global_memory(surface_target color_target)
|
||||
bool is_flip_surface_in_global_memory(rsx::surface_target color_target)
|
||||
{
|
||||
switch (color_target)
|
||||
{
|
||||
case surface_target::surface_a:
|
||||
case surface_target::surface_b:
|
||||
case surface_target::surfaces_a_b:
|
||||
case surface_target::surfaces_a_b_c:
|
||||
case surface_target::surfaces_a_b_c_d:
|
||||
case rsx::surface_target::surface_a:
|
||||
case rsx::surface_target::surface_b:
|
||||
case rsx::surface_target::surfaces_a_b:
|
||||
case rsx::surface_target::surfaces_a_b_c:
|
||||
case rsx::surface_target::surfaces_a_b_c_d:
|
||||
return true;
|
||||
case surface_target::none:
|
||||
case rsx::surface_target::none:
|
||||
return false;
|
||||
}
|
||||
throw EXCEPTION("Wrong color_target");
|
||||
|
@ -361,7 +361,7 @@ void D3D12GSRender::flip(int buffer)
|
|||
ID3D12Resource *resource_to_flip;
|
||||
float viewport_w, viewport_h;
|
||||
|
||||
if (!is_flip_surface_in_global_memory(to_surface_target(rsx::method_registers[NV4097_SET_SURFACE_COLOR_TARGET])))
|
||||
if (!is_flip_surface_in_global_memory(rsx::to_surface_target(rsx::method_registers[NV4097_SET_SURFACE_COLOR_TARGET])))
|
||||
{
|
||||
resource_storage &storage = get_current_resource_storage();
|
||||
assert(storage.ram_framebuffer == nullptr);
|
||||
|
@ -450,7 +450,7 @@ void D3D12GSRender::flip(int buffer)
|
|||
shader_resource_view_desc.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
|
||||
shader_resource_view_desc.ViewDimension = D3D12_SRV_DIMENSION_TEXTURE2D;
|
||||
shader_resource_view_desc.Texture2D.MipLevels = 1;
|
||||
if (is_flip_surface_in_global_memory(to_surface_target(rsx::method_registers[NV4097_SET_SURFACE_COLOR_TARGET])))
|
||||
if (is_flip_surface_in_global_memory(rsx::to_surface_target(rsx::method_registers[NV4097_SET_SURFACE_COLOR_TARGET])))
|
||||
shader_resource_view_desc.Shader4ComponentMapping = D3D12_DEFAULT_SHADER_4_COMPONENT_MAPPING;
|
||||
else
|
||||
shader_resource_view_desc.Shader4ComponentMapping = D3D12_ENCODE_SHADER_4_COMPONENT_MAPPING(
|
||||
|
@ -495,7 +495,7 @@ void D3D12GSRender::flip(int buffer)
|
|||
|
||||
if (!rpcs3::config.rsx.d3d12.overlay.value())
|
||||
get_current_resource_storage().command_list->ResourceBarrier(1, &CD3DX12_RESOURCE_BARRIER::Transition(m_backbuffer[m_swap_chain->GetCurrentBackBufferIndex()].Get(), D3D12_RESOURCE_STATE_RENDER_TARGET, D3D12_RESOURCE_STATE_PRESENT));
|
||||
if (is_flip_surface_in_global_memory(to_surface_target(rsx::method_registers[NV4097_SET_SURFACE_COLOR_TARGET])) && resource_to_flip != nullptr)
|
||||
if (is_flip_surface_in_global_memory(rsx::to_surface_target(rsx::method_registers[NV4097_SET_SURFACE_COLOR_TARGET])) && resource_to_flip != nullptr)
|
||||
get_current_resource_storage().command_list->ResourceBarrier(1, &CD3DX12_RESOURCE_BARRIER::Transition(resource_to_flip, D3D12_RESOURCE_STATE_GENERIC_READ, D3D12_RESOURCE_STATE_RENDER_TARGET));
|
||||
CHECK_HRESULT(get_current_resource_storage().command_list->Close());
|
||||
m_command_queue->ExecuteCommandLists(1, (ID3D12CommandList**)get_current_resource_storage().command_list.GetAddressOf());
|
||||
|
|
|
@ -162,19 +162,19 @@ void D3D12GSRender::load_program()
|
|||
prop.DepthStencilFormat = get_depth_stencil_surface_format(m_surface.depth_format);
|
||||
prop.RenderTargetsFormat = get_color_surface_format(m_surface.color_format);
|
||||
|
||||
switch (to_surface_target(rsx::method_registers[NV4097_SET_SURFACE_COLOR_TARGET]))
|
||||
switch (rsx::to_surface_target(rsx::method_registers[NV4097_SET_SURFACE_COLOR_TARGET]))
|
||||
{
|
||||
case surface_target::surface_a:
|
||||
case surface_target::surface_b:
|
||||
case rsx::surface_target::surface_a:
|
||||
case rsx::surface_target::surface_b:
|
||||
prop.numMRT = 1;
|
||||
break;
|
||||
case surface_target::surfaces_a_b:
|
||||
case rsx::surface_target::surfaces_a_b:
|
||||
prop.numMRT = 2;
|
||||
break;
|
||||
case surface_target::surfaces_a_b_c:
|
||||
case rsx::surface_target::surfaces_a_b_c:
|
||||
prop.numMRT = 3;
|
||||
break;
|
||||
case surface_target::surfaces_a_b_c_d:
|
||||
case rsx::surface_target::surfaces_a_b_c_d:
|
||||
prop.numMRT = 4;
|
||||
break;
|
||||
default:
|
||||
|
@ -254,12 +254,12 @@ void D3D12GSRender::load_program()
|
|||
prop.IASet = m_ia_set;
|
||||
if (!!rsx::method_registers[NV4097_SET_RESTART_INDEX_ENABLE])
|
||||
{
|
||||
index_array_type index_type = to_index_array_type(rsx::method_registers[NV4097_SET_INDEX_ARRAY_DMA] >> 4);
|
||||
if (index_type == index_array_type::unsigned_32b)
|
||||
rsx::index_array_type index_type = rsx::to_index_array_type(rsx::method_registers[NV4097_SET_INDEX_ARRAY_DMA] >> 4);
|
||||
if (index_type == rsx::index_array_type::u32)
|
||||
{
|
||||
prop.CutValue = D3D12_INDEX_BUFFER_STRIP_CUT_VALUE_0xFFFFFFFF;
|
||||
}
|
||||
if (index_type == index_array_type::unsigned_16b)
|
||||
if (index_type == rsx::index_array_type::u16)
|
||||
{
|
||||
prop.CutValue = D3D12_INDEX_BUFFER_STRIP_CUT_VALUE_0xFFFF;
|
||||
}
|
||||
|
|
|
@ -15,40 +15,40 @@
|
|||
|
||||
namespace
|
||||
{
|
||||
u32 get_max_depth_value(surface_depth_format format)
|
||||
u32 get_max_depth_value(rsx::surface_depth_format format)
|
||||
{
|
||||
switch (format)
|
||||
{
|
||||
case surface_depth_format::z16: return 0xFFFF;
|
||||
case surface_depth_format::z24s8: return 0xFFFFFF;
|
||||
case rsx::surface_depth_format::z16: return 0xFFFF;
|
||||
case rsx::surface_depth_format::z24s8: return 0xFFFFFF;
|
||||
}
|
||||
throw EXCEPTION("Unknow depth format");
|
||||
}
|
||||
|
||||
UINT get_num_rtt(surface_target color_target)
|
||||
UINT get_num_rtt(rsx::surface_target color_target)
|
||||
{
|
||||
switch (color_target)
|
||||
{
|
||||
case surface_target::none: return 0;
|
||||
case surface_target::surface_a:
|
||||
case surface_target::surface_b: return 1;
|
||||
case surface_target::surfaces_a_b: return 2;
|
||||
case surface_target::surfaces_a_b_c: return 3;
|
||||
case surface_target::surfaces_a_b_c_d: return 4;
|
||||
case rsx::surface_target::none: return 0;
|
||||
case rsx::surface_target::surface_a:
|
||||
case rsx::surface_target::surface_b: return 1;
|
||||
case rsx::surface_target::surfaces_a_b: return 2;
|
||||
case rsx::surface_target::surfaces_a_b_c: return 3;
|
||||
case rsx::surface_target::surfaces_a_b_c_d: return 4;
|
||||
}
|
||||
throw EXCEPTION("Wrong color_target (%d)", color_target);
|
||||
}
|
||||
|
||||
std::vector<u8> get_rtt_indexes(surface_target color_target)
|
||||
std::vector<u8> get_rtt_indexes(rsx::surface_target color_target)
|
||||
{
|
||||
switch (color_target)
|
||||
{
|
||||
case surface_target::none: return{};
|
||||
case surface_target::surface_a: return{ 0 };
|
||||
case surface_target::surface_b: return{ 1 };
|
||||
case surface_target::surfaces_a_b: return{ 0, 1 };
|
||||
case surface_target::surfaces_a_b_c: return{ 0, 1, 2 };
|
||||
case surface_target::surfaces_a_b_c_d: return{ 0, 1, 2, 3 };
|
||||
case rsx::surface_target::none: return{};
|
||||
case rsx::surface_target::surface_a: return{ 0 };
|
||||
case rsx::surface_target::surface_b: return{ 1 };
|
||||
case rsx::surface_target::surfaces_a_b: return{ 0, 1 };
|
||||
case rsx::surface_target::surfaces_a_b_c: return{ 0, 1, 2 };
|
||||
case rsx::surface_target::surfaces_a_b_c_d: return{ 0, 1, 2, 3 };
|
||||
}
|
||||
throw EXCEPTION("Wrong color_target (%d)", color_target);
|
||||
}
|
||||
|
@ -73,46 +73,46 @@ namespace
|
|||
return register_value & 0xff;
|
||||
}
|
||||
|
||||
size_t get_aligned_pitch(surface_color_format format, u32 width)
|
||||
size_t get_aligned_pitch(rsx::surface_color_format format, u32 width)
|
||||
{
|
||||
switch (format)
|
||||
{
|
||||
case surface_color_format::b8: return align(width, 256);
|
||||
case surface_color_format::g8b8:
|
||||
case surface_color_format::x1r5g5b5_o1r5g5b5:
|
||||
case surface_color_format::x1r5g5b5_z1r5g5b5:
|
||||
case surface_color_format::r5g6b5: return align(width * 2, 256);
|
||||
case surface_color_format::a8b8g8r8:
|
||||
case surface_color_format::x8b8g8r8_o8b8g8r8:
|
||||
case surface_color_format::x8b8g8r8_z8b8g8r8:
|
||||
case surface_color_format::x8r8g8b8_o8r8g8b8:
|
||||
case surface_color_format::x8r8g8b8_z8r8g8b8:
|
||||
case surface_color_format::x32:
|
||||
case surface_color_format::a8r8g8b8: return align(width * 4, 256);
|
||||
case surface_color_format::w16z16y16x16: return align(width * 8, 256);
|
||||
case surface_color_format::w32z32y32x32: return align(width * 16, 256);
|
||||
case rsx::surface_color_format::b8: return align(width, 256);
|
||||
case rsx::surface_color_format::g8b8:
|
||||
case rsx::surface_color_format::x1r5g5b5_o1r5g5b5:
|
||||
case rsx::surface_color_format::x1r5g5b5_z1r5g5b5:
|
||||
case rsx::surface_color_format::r5g6b5: return align(width * 2, 256);
|
||||
case rsx::surface_color_format::a8b8g8r8:
|
||||
case rsx::surface_color_format::x8b8g8r8_o8b8g8r8:
|
||||
case rsx::surface_color_format::x8b8g8r8_z8b8g8r8:
|
||||
case rsx::surface_color_format::x8r8g8b8_o8r8g8b8:
|
||||
case rsx::surface_color_format::x8r8g8b8_z8r8g8b8:
|
||||
case rsx::surface_color_format::x32:
|
||||
case rsx::surface_color_format::a8r8g8b8: return align(width * 4, 256);
|
||||
case rsx::surface_color_format::w16z16y16x16: return align(width * 8, 256);
|
||||
case rsx::surface_color_format::w32z32y32x32: return align(width * 16, 256);
|
||||
}
|
||||
throw EXCEPTION("Unknow color surface format");
|
||||
}
|
||||
|
||||
size_t get_packed_pitch(surface_color_format format, u32 width)
|
||||
size_t get_packed_pitch(rsx::surface_color_format format, u32 width)
|
||||
{
|
||||
switch (format)
|
||||
{
|
||||
case surface_color_format::b8: return width;
|
||||
case surface_color_format::g8b8:
|
||||
case surface_color_format::x1r5g5b5_o1r5g5b5:
|
||||
case surface_color_format::x1r5g5b5_z1r5g5b5:
|
||||
case surface_color_format::r5g6b5: return width * 2;
|
||||
case surface_color_format::a8b8g8r8:
|
||||
case surface_color_format::x8b8g8r8_o8b8g8r8:
|
||||
case surface_color_format::x8b8g8r8_z8b8g8r8:
|
||||
case surface_color_format::x8r8g8b8_o8r8g8b8:
|
||||
case surface_color_format::x8r8g8b8_z8r8g8b8:
|
||||
case surface_color_format::x32:
|
||||
case surface_color_format::a8r8g8b8: return width * 4;
|
||||
case surface_color_format::w16z16y16x16: return width * 8;
|
||||
case surface_color_format::w32z32y32x32: return width * 16;
|
||||
case rsx::surface_color_format::b8: return width;
|
||||
case rsx::surface_color_format::g8b8:
|
||||
case rsx::surface_color_format::x1r5g5b5_o1r5g5b5:
|
||||
case rsx::surface_color_format::x1r5g5b5_z1r5g5b5:
|
||||
case rsx::surface_color_format::r5g6b5: return width * 2;
|
||||
case rsx::surface_color_format::a8b8g8r8:
|
||||
case rsx::surface_color_format::x8b8g8r8_o8b8g8r8:
|
||||
case rsx::surface_color_format::x8b8g8r8_z8b8g8r8:
|
||||
case rsx::surface_color_format::x8r8g8b8_o8r8g8b8:
|
||||
case rsx::surface_color_format::x8r8g8b8_z8r8g8b8:
|
||||
case rsx::surface_color_format::x32:
|
||||
case rsx::surface_color_format::a8r8g8b8: return width * 4;
|
||||
case rsx::surface_color_format::w16z16y16x16: return width * 8;
|
||||
case rsx::surface_color_format::w32z32y32x32: return width * 16;
|
||||
}
|
||||
throw EXCEPTION("Unknow color surface format");
|
||||
}
|
||||
|
@ -148,7 +148,7 @@ void D3D12GSRender::clear_surface(u32 arg)
|
|||
if (arg & 0xF0)
|
||||
{
|
||||
CD3DX12_CPU_DESCRIPTOR_HANDLE handle = CD3DX12_CPU_DESCRIPTOR_HANDLE(m_rtts.current_rtts_handle);
|
||||
size_t rtt_index = get_num_rtt(to_surface_target(rsx::method_registers[NV4097_SET_SURFACE_COLOR_TARGET]));
|
||||
size_t rtt_index = get_num_rtt(rsx::to_surface_target(rsx::method_registers[NV4097_SET_SURFACE_COLOR_TARGET]));
|
||||
get_current_resource_storage().render_targets_descriptors_heap_index += rtt_index;
|
||||
for (unsigned i = 0; i < rtt_index; i++)
|
||||
get_current_resource_storage().command_list->ClearRenderTargetView(handle.Offset(i, m_descriptor_stride_rtv), get_clear_color(rsx::method_registers[NV4097_SET_COLOR_CLEAR_VALUE]).data(),
|
||||
|
@ -185,7 +185,7 @@ void D3D12GSRender::prepare_render_targets(ID3D12GraphicsCommandList *copycmdlis
|
|||
m_rtts.prepare_render_target(copycmdlist,
|
||||
rsx::method_registers[NV4097_SET_SURFACE_FORMAT],
|
||||
rsx::method_registers[NV4097_SET_SURFACE_CLIP_HORIZONTAL], rsx::method_registers[NV4097_SET_SURFACE_CLIP_VERTICAL],
|
||||
to_surface_target(rsx::method_registers[NV4097_SET_SURFACE_COLOR_TARGET]),
|
||||
rsx::to_surface_target(rsx::method_registers[NV4097_SET_SURFACE_COLOR_TARGET]),
|
||||
get_color_surface_addresses(), get_zeta_surface_address(),
|
||||
m_device.Get(), clear_color, 1.f, 0);
|
||||
|
||||
|
@ -198,7 +198,7 @@ void D3D12GSRender::prepare_render_targets(ID3D12GraphicsCommandList *copycmdlis
|
|||
m_rtts.current_rtts_handle = CD3DX12_CPU_DESCRIPTOR_HANDLE(get_current_resource_storage().render_targets_descriptors_heap->GetCPUDescriptorHandleForHeapStart())
|
||||
.Offset((INT)get_current_resource_storage().render_targets_descriptors_heap_index * m_descriptor_stride_rtv);
|
||||
size_t rtt_index = 0;
|
||||
for (u8 i : get_rtt_indexes(to_surface_target(rsx::method_registers[NV4097_SET_SURFACE_COLOR_TARGET])))
|
||||
for (u8 i : get_rtt_indexes(rsx::to_surface_target(rsx::method_registers[NV4097_SET_SURFACE_COLOR_TARGET])))
|
||||
{
|
||||
if (std::get<1>(m_rtts.m_bound_render_targets[i]) == nullptr)
|
||||
continue;
|
||||
|
@ -221,7 +221,7 @@ void D3D12GSRender::prepare_render_targets(ID3D12GraphicsCommandList *copycmdlis
|
|||
|
||||
void D3D12GSRender::set_rtt_and_ds(ID3D12GraphicsCommandList *command_list)
|
||||
{
|
||||
UINT num_rtt = get_num_rtt(to_surface_target(rsx::method_registers[NV4097_SET_SURFACE_COLOR_TARGET]));
|
||||
UINT num_rtt = get_num_rtt(rsx::to_surface_target(rsx::method_registers[NV4097_SET_SURFACE_COLOR_TARGET]));
|
||||
D3D12_CPU_DESCRIPTOR_HANDLE* ds_handle = (std::get<1>(m_rtts.m_bound_depth_stencil) != nullptr) ? &m_rtts.current_ds_handle : nullptr;
|
||||
command_list->OMSetRenderTargets((UINT)num_rtt, &m_rtts.current_rtts_handle, true, ds_handle);
|
||||
}
|
||||
|
@ -242,7 +242,7 @@ namespace
|
|||
ID3D12GraphicsCommandList * command_list,
|
||||
data_heap &readback_heap,
|
||||
ID3D12Resource * color_surface,
|
||||
surface_color_format color_surface_format
|
||||
rsx::surface_color_format color_surface_format
|
||||
)
|
||||
{
|
||||
int clip_w = rsx::method_registers[NV4097_SET_SURFACE_CLIP_HORIZONTAL] >> 16;
|
||||
|
@ -391,7 +391,7 @@ void D3D12GSRender::copy_render_target_to_dma_location()
|
|||
size_t color_buffer_offset_in_heap[4];
|
||||
if (rpcs3::state.config.rsx.opengl.write_color_buffers)
|
||||
{
|
||||
for (u8 i : get_rtt_indexes(to_surface_target(rsx::method_registers[NV4097_SET_SURFACE_COLOR_TARGET])))
|
||||
for (u8 i : get_rtt_indexes(rsx::to_surface_target(rsx::method_registers[NV4097_SET_SURFACE_COLOR_TARGET])))
|
||||
{
|
||||
if (!address_color[i])
|
||||
continue;
|
||||
|
@ -443,7 +443,7 @@ void D3D12GSRender::copy_render_target_to_dma_location()
|
|||
vm::base(address_color[3]),
|
||||
};
|
||||
|
||||
for (u8 i : get_rtt_indexes(to_surface_target(rsx::method_registers[NV4097_SET_SURFACE_COLOR_TARGET])))
|
||||
for (u8 i : get_rtt_indexes(rsx::to_surface_target(rsx::method_registers[NV4097_SET_SURFACE_COLOR_TARGET])))
|
||||
{
|
||||
if (!address_color[i])
|
||||
continue;
|
||||
|
|
|
@ -719,45 +719,45 @@ namespace
|
|||
};
|
||||
}
|
||||
|
||||
vertex_base_type to_vertex_base_type(u8 in)
|
||||
rsx::vertex_base_type rsx::to_vertex_base_type(u8 in)
|
||||
{
|
||||
switch (in)
|
||||
{
|
||||
case 1: return vertex_base_type::s1;
|
||||
case 2: return vertex_base_type::f;
|
||||
case 3: return vertex_base_type::sf;
|
||||
case 4: return vertex_base_type::ub;
|
||||
case 5: return vertex_base_type::s32k;
|
||||
case 6: return vertex_base_type::cmp;
|
||||
case 7: return vertex_base_type::ub256;
|
||||
case 1: return rsx::vertex_base_type::s1;
|
||||
case 2: return rsx::vertex_base_type::f;
|
||||
case 3: return rsx::vertex_base_type::sf;
|
||||
case 4: return rsx::vertex_base_type::ub;
|
||||
case 5: return rsx::vertex_base_type::s32k;
|
||||
case 6: return rsx::vertex_base_type::cmp;
|
||||
case 7: return rsx::vertex_base_type::ub256;
|
||||
}
|
||||
throw new EXCEPTION("Unknow vertex base type %d", in);
|
||||
}
|
||||
|
||||
index_array_type to_index_array_type(u8 in)
|
||||
rsx::index_array_type rsx::to_index_array_type(u8 in)
|
||||
{
|
||||
switch (in)
|
||||
{
|
||||
case 0: return index_array_type::unsigned_32b;
|
||||
case 1: return index_array_type::unsigned_16b;
|
||||
case 0: return rsx::index_array_type::u32;
|
||||
case 1: return rsx::index_array_type::u16;
|
||||
}
|
||||
throw new EXCEPTION("Unknown index array type %d", in);
|
||||
}
|
||||
|
||||
primitive_type to_primitive_type(u8 in)
|
||||
rsx::primitive_type rsx::to_primitive_type(u8 in)
|
||||
{
|
||||
switch (in)
|
||||
{
|
||||
case 1: return primitive_type::points;
|
||||
case 2: return primitive_type::lines;
|
||||
case 3: return primitive_type::line_loop;
|
||||
case 4: return primitive_type::line_strip;
|
||||
case 5: return primitive_type::triangles;
|
||||
case 6: return primitive_type::triangle_strip;
|
||||
case 7: return primitive_type::triangle_fan;
|
||||
case 8: return primitive_type::quads;
|
||||
case 9: return primitive_type::quad_strip;
|
||||
case 10: return primitive_type::polygon;
|
||||
case 1: return rsx::primitive_type::points;
|
||||
case 2: return rsx::primitive_type::lines;
|
||||
case 3: return rsx::primitive_type::line_loop;
|
||||
case 4: return rsx::primitive_type::line_strip;
|
||||
case 5: return rsx::primitive_type::triangles;
|
||||
case 6: return rsx::primitive_type::triangle_strip;
|
||||
case 7: return rsx::primitive_type::triangle_fan;
|
||||
case 8: return rsx::primitive_type::quads;
|
||||
case 9: return rsx::primitive_type::quad_strip;
|
||||
case 10: return rsx::primitive_type::polygon;
|
||||
}
|
||||
throw new EXCEPTION("Unknow primitive type %d", in);
|
||||
}
|
||||
|
@ -801,26 +801,26 @@ enum
|
|||
|
||||
};
|
||||
|
||||
surface_target to_surface_target(u8 in)
|
||||
rsx::surface_target rsx::to_surface_target(u8 in)
|
||||
{
|
||||
switch (in)
|
||||
{
|
||||
case CELL_GCM_SURFACE_TARGET_NONE: return surface_target::none;
|
||||
case CELL_GCM_SURFACE_TARGET_0: return surface_target::surface_a;
|
||||
case CELL_GCM_SURFACE_TARGET_1: return surface_target::surface_b;
|
||||
case CELL_GCM_SURFACE_TARGET_MRT1: return surface_target::surfaces_a_b;
|
||||
case CELL_GCM_SURFACE_TARGET_MRT2: return surface_target::surfaces_a_b_c;
|
||||
case CELL_GCM_SURFACE_TARGET_MRT3: return surface_target::surfaces_a_b_c_d;
|
||||
case CELL_GCM_SURFACE_TARGET_NONE: return rsx::surface_target::none;
|
||||
case CELL_GCM_SURFACE_TARGET_0: return rsx::surface_target::surface_a;
|
||||
case CELL_GCM_SURFACE_TARGET_1: return rsx::surface_target::surface_b;
|
||||
case CELL_GCM_SURFACE_TARGET_MRT1: return rsx::surface_target::surfaces_a_b;
|
||||
case CELL_GCM_SURFACE_TARGET_MRT2: return rsx::surface_target::surfaces_a_b_c;
|
||||
case CELL_GCM_SURFACE_TARGET_MRT3: return rsx::surface_target::surfaces_a_b_c_d;
|
||||
}
|
||||
throw EXCEPTION("Unknow surface target %x", in);
|
||||
}
|
||||
|
||||
surface_depth_format to_surface_depth_format(u8 in)
|
||||
rsx::surface_depth_format rsx::to_surface_depth_format(u8 in)
|
||||
{
|
||||
switch (in)
|
||||
{
|
||||
case CELL_GCM_SURFACE_Z16: return surface_depth_format::z16;
|
||||
case CELL_GCM_SURFACE_Z24S8: return surface_depth_format::z24s8;
|
||||
case CELL_GCM_SURFACE_Z16: return rsx::surface_depth_format::z16;
|
||||
case CELL_GCM_SURFACE_Z24S8: return rsx::surface_depth_format::z24s8;
|
||||
}
|
||||
throw EXCEPTION("Unknow surface depth format %x", in);
|
||||
}
|
||||
|
@ -836,36 +836,36 @@ std::string rsx::get_method_name(const u32 id)
|
|||
return fmt::format("unknown/illegal method [0x%08x]", id);
|
||||
}
|
||||
|
||||
surface_antialiasing to_surface_antialiasing(u8 in)
|
||||
rsx::surface_antialiasing rsx::to_surface_antialiasing(u8 in)
|
||||
{
|
||||
switch (in)
|
||||
{
|
||||
case CELL_GCM_SURFACE_CENTER_1: return surface_antialiasing::center_1_sample;
|
||||
case CELL_GCM_SURFACE_DIAGONAL_CENTERED_2: return surface_antialiasing::diagonal_centered_2_samples;
|
||||
case CELL_GCM_SURFACE_SQUARE_CENTERED_4: return surface_antialiasing::square_centered_4_samples;
|
||||
case CELL_GCM_SURFACE_SQUARE_ROTATED_4: return surface_antialiasing::square_rotated_4_samples;
|
||||
case CELL_GCM_SURFACE_CENTER_1: return rsx::surface_antialiasing::center_1_sample;
|
||||
case CELL_GCM_SURFACE_DIAGONAL_CENTERED_2: return rsx::surface_antialiasing::diagonal_centered_2_samples;
|
||||
case CELL_GCM_SURFACE_SQUARE_CENTERED_4: return rsx::surface_antialiasing::square_centered_4_samples;
|
||||
case CELL_GCM_SURFACE_SQUARE_ROTATED_4: return rsx::surface_antialiasing::square_rotated_4_samples;
|
||||
}
|
||||
throw EXCEPTION("unknow surface antialiasing format %x", in);
|
||||
}
|
||||
|
||||
surface_color_format to_surface_color_format(u8 in)
|
||||
rsx::surface_color_format rsx::to_surface_color_format(u8 in)
|
||||
{
|
||||
switch (in)
|
||||
{
|
||||
case CELL_GCM_SURFACE_X1R5G5B5_Z1R5G5B5: return surface_color_format::x1r5g5b5_z1r5g5b5;
|
||||
case CELL_GCM_SURFACE_X1R5G5B5_O1R5G5B5: return surface_color_format::x1r5g5b5_o1r5g5b5;
|
||||
case CELL_GCM_SURFACE_R5G6B5: return surface_color_format::r5g6b5;
|
||||
case CELL_GCM_SURFACE_X8R8G8B8_Z8R8G8B8: return surface_color_format::x8r8g8b8_z8r8g8b8;
|
||||
case CELL_GCM_SURFACE_X8R8G8B8_O8R8G8B8: return surface_color_format::x8r8g8b8_o8r8g8b8;
|
||||
case CELL_GCM_SURFACE_A8R8G8B8: return surface_color_format::a8r8g8b8;
|
||||
case CELL_GCM_SURFACE_B8: return surface_color_format::b8;
|
||||
case CELL_GCM_SURFACE_G8B8: return surface_color_format::g8b8;
|
||||
case CELL_GCM_SURFACE_F_W16Z16Y16X16: return surface_color_format::w16z16y16x16;
|
||||
case CELL_GCM_SURFACE_F_W32Z32Y32X32: return surface_color_format::w32z32y32x32;
|
||||
case CELL_GCM_SURFACE_F_X32: return surface_color_format::x32;
|
||||
case CELL_GCM_SURFACE_X8B8G8R8_Z8B8G8R8: return surface_color_format::x8b8g8r8_z8b8g8r8;
|
||||
case CELL_GCM_SURFACE_X8B8G8R8_O8B8G8R8: return surface_color_format::x8b8g8r8_o8b8g8r8;
|
||||
case CELL_GCM_SURFACE_A8B8G8R8: return surface_color_format::a8b8g8r8;
|
||||
case CELL_GCM_SURFACE_X1R5G5B5_Z1R5G5B5: return rsx::surface_color_format::x1r5g5b5_z1r5g5b5;
|
||||
case CELL_GCM_SURFACE_X1R5G5B5_O1R5G5B5: return rsx::surface_color_format::x1r5g5b5_o1r5g5b5;
|
||||
case CELL_GCM_SURFACE_R5G6B5: return rsx::surface_color_format::r5g6b5;
|
||||
case CELL_GCM_SURFACE_X8R8G8B8_Z8R8G8B8: return rsx::surface_color_format::x8r8g8b8_z8r8g8b8;
|
||||
case CELL_GCM_SURFACE_X8R8G8B8_O8R8G8B8: return rsx::surface_color_format::x8r8g8b8_o8r8g8b8;
|
||||
case CELL_GCM_SURFACE_A8R8G8B8: return rsx::surface_color_format::a8r8g8b8;
|
||||
case CELL_GCM_SURFACE_B8: return rsx::surface_color_format::b8;
|
||||
case CELL_GCM_SURFACE_G8B8: return rsx::surface_color_format::g8b8;
|
||||
case CELL_GCM_SURFACE_F_W16Z16Y16X16: return rsx::surface_color_format::w16z16y16x16;
|
||||
case CELL_GCM_SURFACE_F_W32Z32Y32X32: return rsx::surface_color_format::w32z32y32x32;
|
||||
case CELL_GCM_SURFACE_F_X32: return rsx::surface_color_format::x32;
|
||||
case CELL_GCM_SURFACE_X8B8G8R8_Z8B8G8R8: return rsx::surface_color_format::x8b8g8r8_z8b8g8r8;
|
||||
case CELL_GCM_SURFACE_X8B8G8R8_O8B8G8R8: return rsx::surface_color_format::x8b8g8r8_o8b8g8r8;
|
||||
case CELL_GCM_SURFACE_A8B8G8R8: return rsx::surface_color_format::a8b8g8r8;
|
||||
}
|
||||
throw EXCEPTION("unknow surface color format %x", in);
|
||||
}
|
||||
|
@ -953,18 +953,18 @@ namespace
|
|||
|
||||
std::string get_primitive_mode(u8 draw_mode)
|
||||
{
|
||||
switch (to_primitive_type(draw_mode))
|
||||
switch (rsx::to_primitive_type(draw_mode))
|
||||
{
|
||||
case primitive_type::points: return "Points";
|
||||
case primitive_type::lines: return "Lines";
|
||||
case primitive_type::line_loop: return "Line_loop";
|
||||
case primitive_type::line_strip: return "Line_strip";
|
||||
case primitive_type::triangles: return "Triangles";
|
||||
case primitive_type::triangle_strip: return "Triangle_strip";
|
||||
case primitive_type::triangle_fan: return "Triangle_fan";
|
||||
case primitive_type::quads: return "Quads";
|
||||
case primitive_type::quad_strip: return "Quad_strip";
|
||||
case primitive_type::polygon: return "Polygon";
|
||||
case rsx::primitive_type::points: return "Points";
|
||||
case rsx::primitive_type::lines: return "Lines";
|
||||
case rsx::primitive_type::line_loop: return "Line_loop";
|
||||
case rsx::primitive_type::line_strip: return "Line_strip";
|
||||
case rsx::primitive_type::triangles: return "Triangles";
|
||||
case rsx::primitive_type::triangle_strip: return "Triangle_strip";
|
||||
case rsx::primitive_type::triangle_fan: return "Triangle_fan";
|
||||
case rsx::primitive_type::quads: return "Quads";
|
||||
case rsx::primitive_type::quad_strip: return "Quad_strip";
|
||||
case rsx::primitive_type::polygon: return "Polygon";
|
||||
}
|
||||
return "Error";
|
||||
}
|
||||
|
@ -989,58 +989,58 @@ namespace
|
|||
|
||||
std::string depth_stencil_surface_format(u32 format)
|
||||
{
|
||||
switch (to_surface_depth_format(format))
|
||||
switch (rsx::to_surface_depth_format(format))
|
||||
{
|
||||
case surface_depth_format::z16: return "CELL_GCM_SURFACE_Z16";
|
||||
case surface_depth_format::z24s8: return "CELL_GCM_SURFACE_Z24S8";
|
||||
case rsx::surface_depth_format::z16: return "CELL_GCM_SURFACE_Z16";
|
||||
case rsx::surface_depth_format::z24s8: return "CELL_GCM_SURFACE_Z24S8";
|
||||
}
|
||||
return "Error";
|
||||
}
|
||||
|
||||
std::string surface_antialiasing(u8 format)
|
||||
{
|
||||
switch (to_surface_antialiasing(format))
|
||||
switch (rsx::to_surface_antialiasing(format))
|
||||
{
|
||||
case surface_antialiasing::center_1_sample: "1 sample centered";
|
||||
case surface_antialiasing::diagonal_centered_2_samples: return "2 samples diagonal centered";
|
||||
case surface_antialiasing::square_centered_4_samples: return "4 samples square centered";
|
||||
case surface_antialiasing::square_rotated_4_samples: return "4 samples diagonal rotated";
|
||||
case rsx::surface_antialiasing::center_1_sample: return "1 sample centered";
|
||||
case rsx::surface_antialiasing::diagonal_centered_2_samples: return "2 samples diagonal centered";
|
||||
case rsx::surface_antialiasing::square_centered_4_samples: return "4 samples square centered";
|
||||
case rsx::surface_antialiasing::square_rotated_4_samples: return "4 samples diagonal rotated";
|
||||
}
|
||||
return "Error";
|
||||
}
|
||||
|
||||
std::string color_surface_format(u32 format)
|
||||
std::string surface_color_format(u32 format)
|
||||
{
|
||||
switch (to_surface_color_format(format))
|
||||
switch (rsx::to_surface_color_format(format))
|
||||
{
|
||||
case surface_color_format::x1r5g5b5_z1r5g5b5: return "CELL_GCM_SURFACE_X1R5G5B5_Z1R5G5B5";
|
||||
case surface_color_format::x1r5g5b5_o1r5g5b5: return "CELL_GCM_SURFACE_X1R5G5B5_O1R5G5B5";
|
||||
case surface_color_format::r5g6b5 : return "CELL_GCM_SURFACE_R5G6B5";
|
||||
case surface_color_format::x8r8g8b8_z8r8g8b8: return "CELL_GCM_SURFACE_X8R8G8B8_Z8R8G8B8";
|
||||
case surface_color_format::x8r8g8b8_o8r8g8b8: return "CELL_GCM_SURFACE_X8R8G8B8_O8R8G8B8";
|
||||
case surface_color_format::a8r8g8b8: return "CELL_GCM_SURFACE_A8R8G8B8";
|
||||
case surface_color_format::b8: return "CELL_GCM_SURFACE_B8";
|
||||
case surface_color_format::g8b8: return "CELL_GCM_SURFACE_G8B8";
|
||||
case surface_color_format::w16z16y16x16: return "CELL_GCM_SURFACE_F_W16Z16Y16X16";
|
||||
case surface_color_format::w32z32y32x32: return "CELL_GCM_SURFACE_F_W32Z32Y32X32";
|
||||
case surface_color_format::x32: return "CELL_GCM_SURFACE_F_X32";
|
||||
case surface_color_format::x8b8g8r8_z8b8g8r8: return "CELL_GCM_SURFACE_X8B8G8R8_Z8B8G8R8";
|
||||
case surface_color_format::x8b8g8r8_o8b8g8r8: return "CELL_GCM_SURFACE_X8B8G8R8_O8B8G8R8";
|
||||
case surface_color_format::a8b8g8r8: return "CELL_GCM_SURFACE_A8B8G8R8";
|
||||
case rsx::surface_color_format::x1r5g5b5_z1r5g5b5: return "CELL_GCM_SURFACE_X1R5G5B5_Z1R5G5B5";
|
||||
case rsx::surface_color_format::x1r5g5b5_o1r5g5b5: return "CELL_GCM_SURFACE_X1R5G5B5_O1R5G5B5";
|
||||
case rsx::surface_color_format::r5g6b5 : return "CELL_GCM_SURFACE_R5G6B5";
|
||||
case rsx::surface_color_format::x8r8g8b8_z8r8g8b8: return "CELL_GCM_SURFACE_X8R8G8B8_Z8R8G8B8";
|
||||
case rsx::surface_color_format::x8r8g8b8_o8r8g8b8: return "CELL_GCM_SURFACE_X8R8G8B8_O8R8G8B8";
|
||||
case rsx::surface_color_format::a8r8g8b8: return "CELL_GCM_SURFACE_A8R8G8B8";
|
||||
case rsx::surface_color_format::b8: return "CELL_GCM_SURFACE_B8";
|
||||
case rsx::surface_color_format::g8b8: return "CELL_GCM_SURFACE_G8B8";
|
||||
case rsx::surface_color_format::w16z16y16x16: return "CELL_GCM_SURFACE_F_W16Z16Y16X16";
|
||||
case rsx::surface_color_format::w32z32y32x32: return "CELL_GCM_SURFACE_F_W32Z32Y32X32";
|
||||
case rsx::surface_color_format::x32: return "CELL_GCM_SURFACE_F_X32";
|
||||
case rsx::surface_color_format::x8b8g8r8_z8b8g8r8: return "CELL_GCM_SURFACE_X8B8G8R8_Z8B8G8R8";
|
||||
case rsx::surface_color_format::x8b8g8r8_o8b8g8r8: return "CELL_GCM_SURFACE_X8B8G8R8_O8B8G8R8";
|
||||
case rsx::surface_color_format::a8b8g8r8: return "CELL_GCM_SURFACE_A8B8G8R8";
|
||||
}
|
||||
return "Error";
|
||||
}
|
||||
|
||||
std::string surface_target(u32 target)
|
||||
{
|
||||
switch (to_surface_target(target))
|
||||
switch (rsx::to_surface_target(target))
|
||||
{
|
||||
case surface_target::none: return "none";
|
||||
case surface_target::surface_a: return "surface A";
|
||||
case surface_target::surface_b: return "surface B";
|
||||
case surface_target::surfaces_a_b: return "surfaces A and B";
|
||||
case surface_target::surfaces_a_b_c: return "surfaces A, B and C";
|
||||
case surface_target::surfaces_a_b_c_d: return "surfaces A,B, C and D";
|
||||
case rsx::surface_target::none: return "none";
|
||||
case rsx::surface_target::surface_a: return "surface A";
|
||||
case rsx::surface_target::surface_b: return "surface B";
|
||||
case rsx::surface_target::surfaces_a_b: return "surfaces A and B";
|
||||
case rsx::surface_target::surfaces_a_b_c: return "surfaces A, B and C";
|
||||
case rsx::surface_target::surfaces_a_b_c_d: return "surfaces A,B, C and D";
|
||||
}
|
||||
return "Error";
|
||||
}
|
||||
|
@ -1078,15 +1078,15 @@ namespace
|
|||
|
||||
std::string get_vertex_attribute_format(u8 type)
|
||||
{
|
||||
switch (to_vertex_base_type(type))
|
||||
switch (rsx::to_vertex_base_type(type))
|
||||
{
|
||||
case vertex_base_type::s1: return "Short";
|
||||
case vertex_base_type::f: return "Float";
|
||||
case vertex_base_type::sf: return "Half float";
|
||||
case vertex_base_type::ub: return "Unsigned byte";
|
||||
case vertex_base_type::s32k: return "Signed int";
|
||||
case vertex_base_type::cmp: return "CMP";
|
||||
case vertex_base_type::ub256: return "UB256";
|
||||
case rsx::vertex_base_type::s1: return "Short";
|
||||
case rsx::vertex_base_type::f: return "Float";
|
||||
case rsx::vertex_base_type::sf: return "Half float";
|
||||
case rsx::vertex_base_type::ub: return "Unsigned byte";
|
||||
case rsx::vertex_base_type::s32k: return "Signed int";
|
||||
case rsx::vertex_base_type::cmp: return "CMP";
|
||||
case rsx::vertex_base_type::ub256: return "UB256";
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1104,10 +1104,10 @@ namespace
|
|||
|
||||
std::string index_type(u16 arg)
|
||||
{
|
||||
switch (to_index_array_type(arg))
|
||||
switch (rsx::to_index_array_type(arg))
|
||||
{
|
||||
case index_array_type::unsigned_16b: return "unsigned short";
|
||||
case index_array_type::unsigned_32b: return "unsigned int";
|
||||
case rsx::index_array_type::u16: return "unsigned short";
|
||||
case rsx::index_array_type::u32: return "unsigned int";
|
||||
}
|
||||
return "Error";
|
||||
}
|
||||
|
@ -1443,7 +1443,7 @@ namespace
|
|||
{ NV4097_SET_SURFACE_PITCH_Z, [](u32 arg) -> std::string { return "Surface Zeta: Pitch = " + std::to_string(arg); } },
|
||||
{ NV4097_SET_SURFACE_ZETA_OFFSET, [](u32 arg) -> std::string { return "Surface Zeta: Offset = " + ptr_to_string(arg); } },
|
||||
{ NV4097_SET_CONTEXT_DMA_ZETA, [](u32 arg) -> std::string { return "Surface Zeta: DMA mode = " + dma_mode(arg);} },
|
||||
{ NV4097_SET_SURFACE_FORMAT, [](u32 arg) -> std::string { return "Surface: Color format = " + color_surface_format(arg & 0x1F) + " DepthStencil format = " + depth_stencil_surface_format((arg >> 5) & 0x7) + " Anti aliasing =" + surface_antialiasing((arg >> 12) & 0x7); } },
|
||||
{ NV4097_SET_SURFACE_FORMAT, [](u32 arg) -> std::string { return "Surface: Color format = " + surface_color_format(arg & 0x1F) + " DepthStencil format = " + depth_stencil_surface_format((arg >> 5) & 0x7) + " Anti aliasing =" + surface_antialiasing((arg >> 12) & 0x7); } },
|
||||
{ NV4097_SET_SURFACE_CLIP_HORIZONTAL, [](u32 arg) -> std::string { return "Surface: clip x = " + std::to_string(arg & 0xFFFF) + " width = " + std::to_string(arg >> 16); } },
|
||||
{ NV4097_SET_SURFACE_CLIP_VERTICAL, [](u32 arg) -> std::string { return "Surface: clip y = " + std::to_string(arg & 0xFFFF) + " height = " + std::to_string(arg >> 16); } },
|
||||
{ NV4097_SET_SURFACE_COLOR_TARGET, [](u32 arg) -> std::string { return "Surface: Targets " + surface_target(arg); } },
|
||||
|
|
|
@ -23,92 +23,95 @@ enum
|
|||
CELL_GCM_DISPLAY_FREQUENCY_DISABLE = 3,
|
||||
};
|
||||
|
||||
enum class vertex_base_type : u8
|
||||
namespace rsx
|
||||
{
|
||||
s1, ///< signed byte
|
||||
f, ///< float
|
||||
sf, ///< half float
|
||||
ub, ///< unsigned byte
|
||||
s32k, ///< signed 32bits int
|
||||
cmp, ///< compressed aka X11G11Z10 and always 1. W.
|
||||
ub256,
|
||||
};
|
||||
enum class vertex_base_type : u8
|
||||
{
|
||||
s1, ///< signed byte
|
||||
f, ///< float
|
||||
sf, ///< half float
|
||||
ub, ///< unsigned byte
|
||||
s32k, ///< signed 32bits int
|
||||
cmp, ///< compressed aka X11G11Z10 and always 1. W.
|
||||
ub256,
|
||||
};
|
||||
|
||||
vertex_base_type to_vertex_base_type(u8 in);
|
||||
vertex_base_type to_vertex_base_type(u8 in);
|
||||
|
||||
enum class index_array_type : u8
|
||||
{
|
||||
unsigned_32b,
|
||||
unsigned_16b,
|
||||
};
|
||||
enum class index_array_type : u8
|
||||
{
|
||||
u32,
|
||||
u16,
|
||||
};
|
||||
|
||||
index_array_type to_index_array_type(u8 in);
|
||||
index_array_type to_index_array_type(u8 in);
|
||||
|
||||
enum class primitive_type : u8
|
||||
{
|
||||
points,
|
||||
lines,
|
||||
line_loop, // line strip with last end being joined with first end.
|
||||
line_strip,
|
||||
triangles,
|
||||
triangle_strip,
|
||||
triangle_fan, // like strip except that every triangle share the first vertex and one instead of 2 from previous triangle.
|
||||
quads,
|
||||
quad_strip,
|
||||
polygon, // convex polygon
|
||||
};
|
||||
enum class primitive_type : u8
|
||||
{
|
||||
points,
|
||||
lines,
|
||||
line_loop, // line strip with last end being joined with first end.
|
||||
line_strip,
|
||||
triangles,
|
||||
triangle_strip,
|
||||
triangle_fan, // like strip except that every triangle share the first vertex and one instead of 2 from previous triangle.
|
||||
quads,
|
||||
quad_strip,
|
||||
polygon, // convex polygon
|
||||
};
|
||||
|
||||
primitive_type to_primitive_type(u8 in);
|
||||
primitive_type to_primitive_type(u8 in);
|
||||
|
||||
enum class surface_target : u8
|
||||
{
|
||||
none,
|
||||
surface_a,
|
||||
surface_b,
|
||||
surfaces_a_b,
|
||||
surfaces_a_b_c,
|
||||
surfaces_a_b_c_d,
|
||||
};
|
||||
enum class surface_target : u8
|
||||
{
|
||||
none,
|
||||
surface_a,
|
||||
surface_b,
|
||||
surfaces_a_b,
|
||||
surfaces_a_b_c,
|
||||
surfaces_a_b_c_d,
|
||||
};
|
||||
|
||||
surface_target to_surface_target(u8 in);
|
||||
surface_target to_surface_target(u8 in);
|
||||
|
||||
enum class surface_depth_format : u8
|
||||
{
|
||||
z16, // unsigned 16 bits depth
|
||||
z24s8, // unsigned 24 bits depth + 8 bits stencil
|
||||
};
|
||||
enum class surface_depth_format : u8
|
||||
{
|
||||
z16, // unsigned 16 bits depth
|
||||
z24s8, // unsigned 24 bits depth + 8 bits stencil
|
||||
};
|
||||
|
||||
surface_depth_format to_surface_depth_format(u8 in);
|
||||
surface_depth_format to_surface_depth_format(u8 in);
|
||||
|
||||
enum class surface_antialiasing : u8
|
||||
{
|
||||
center_1_sample,
|
||||
diagonal_centered_2_samples,
|
||||
square_centered_4_samples,
|
||||
square_rotated_4_samples,
|
||||
};
|
||||
enum class surface_antialiasing : u8
|
||||
{
|
||||
center_1_sample,
|
||||
diagonal_centered_2_samples,
|
||||
square_centered_4_samples,
|
||||
square_rotated_4_samples,
|
||||
};
|
||||
|
||||
surface_antialiasing to_surface_antialiasing(u8 in);
|
||||
surface_antialiasing to_surface_antialiasing(u8 in);
|
||||
|
||||
enum class surface_color_format : u8
|
||||
{
|
||||
x1r5g5b5_z1r5g5b5,
|
||||
x1r5g5b5_o1r5g5b5,
|
||||
r5g6b5,
|
||||
x8r8g8b8_z8r8g8b8,
|
||||
x8r8g8b8_o8r8g8b8,
|
||||
a8r8g8b8,
|
||||
b8,
|
||||
g8b8,
|
||||
w16z16y16x16,
|
||||
w32z32y32x32,
|
||||
x32,
|
||||
x8b8g8r8_z8b8g8r8,
|
||||
x8b8g8r8_o8b8g8r8,
|
||||
a8b8g8r8,
|
||||
};
|
||||
enum class surface_color_format : u8
|
||||
{
|
||||
x1r5g5b5_z1r5g5b5,
|
||||
x1r5g5b5_o1r5g5b5,
|
||||
r5g6b5,
|
||||
x8r8g8b8_z8r8g8b8,
|
||||
x8r8g8b8_o8r8g8b8,
|
||||
a8r8g8b8,
|
||||
b8,
|
||||
g8b8,
|
||||
w16z16y16x16,
|
||||
w32z32y32x32,
|
||||
x32,
|
||||
x8b8g8r8_z8b8g8r8,
|
||||
x8b8g8r8_o8b8g8r8,
|
||||
a8b8g8r8,
|
||||
};
|
||||
|
||||
surface_color_format to_surface_color_format(u8 in);
|
||||
surface_color_format to_surface_color_format(u8 in);
|
||||
}
|
||||
|
||||
enum
|
||||
{
|
||||
|
|
|
@ -11,22 +11,22 @@
|
|||
|
||||
namespace
|
||||
{
|
||||
u32 get_max_depth_value(surface_depth_format format)
|
||||
u32 get_max_depth_value(rsx::surface_depth_format format)
|
||||
{
|
||||
switch (format)
|
||||
{
|
||||
case surface_depth_format::z16: return 0xFFFF;
|
||||
case surface_depth_format::z24s8: return 0xFFFFFF;
|
||||
case rsx::surface_depth_format::z16: return 0xFFFF;
|
||||
case rsx::surface_depth_format::z24s8: return 0xFFFFFF;
|
||||
}
|
||||
throw EXCEPTION("Unknow depth format");
|
||||
}
|
||||
|
||||
u8 get_pixel_size(surface_depth_format format)
|
||||
u8 get_pixel_size(rsx::surface_depth_format format)
|
||||
{
|
||||
switch (format)
|
||||
{
|
||||
case surface_depth_format::z16: return 2;
|
||||
case surface_depth_format::z24s8: return 4;
|
||||
case rsx::surface_depth_format::z16: return 2;
|
||||
case rsx::surface_depth_format::z24s8: return 4;
|
||||
}
|
||||
throw EXCEPTION("Unknow depth format");
|
||||
}
|
||||
|
@ -120,7 +120,7 @@ void GLGSRender::begin()
|
|||
|
||||
__glcheck glBlendFuncSeparate(sfactor_rgb, dfactor_rgb, sfactor_a, dfactor_a);
|
||||
|
||||
if (m_surface.color_format == surface_color_format::w16z16y16x16) //TODO: check another color formats
|
||||
if (m_surface.color_format == rsx::surface_color_format::w16z16y16x16) //TODO: check another color formats
|
||||
{
|
||||
u32 blend_color = rsx::method_registers[NV4097_SET_BLEND_COLOR];
|
||||
u32 blend_color2 = rsx::method_registers[NV4097_SET_BLEND_COLOR2];
|
||||
|
@ -318,33 +318,33 @@ void apply_attrib_array(gl::glsl::program& program, int location, const std::vec
|
|||
|
||||
namespace
|
||||
{
|
||||
gl::buffer_pointer::type gl_types(vertex_base_type type)
|
||||
gl::buffer_pointer::type gl_types(rsx::vertex_base_type type)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case vertex_base_type::s1: return gl::buffer_pointer::type::s16;
|
||||
case vertex_base_type::f: return gl::buffer_pointer::type::f32;
|
||||
case vertex_base_type::sf: return gl::buffer_pointer::type::f16;
|
||||
case vertex_base_type::ub: return gl::buffer_pointer::type::u8;
|
||||
case vertex_base_type::s32k: return gl::buffer_pointer::type::s32;
|
||||
case vertex_base_type::cmp: return gl::buffer_pointer::type::s16; // Needs conversion
|
||||
case vertex_base_type::ub256: gl::buffer_pointer::type::u8;
|
||||
case rsx::vertex_base_type::s1: return gl::buffer_pointer::type::s16;
|
||||
case rsx::vertex_base_type::f: return gl::buffer_pointer::type::f32;
|
||||
case rsx::vertex_base_type::sf: return gl::buffer_pointer::type::f16;
|
||||
case rsx::vertex_base_type::ub: return gl::buffer_pointer::type::u8;
|
||||
case rsx::vertex_base_type::s32k: return gl::buffer_pointer::type::s32;
|
||||
case rsx::vertex_base_type::cmp: return gl::buffer_pointer::type::s16; // Needs conversion
|
||||
case rsx::vertex_base_type::ub256: gl::buffer_pointer::type::u8;
|
||||
}
|
||||
throw EXCEPTION("unknow vertex type");
|
||||
}
|
||||
|
||||
bool gl_normalized(vertex_base_type type)
|
||||
bool gl_normalized(rsx::vertex_base_type type)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case vertex_base_type::s1:
|
||||
case vertex_base_type::ub:
|
||||
case vertex_base_type::cmp:
|
||||
case rsx::vertex_base_type::s1:
|
||||
case rsx::vertex_base_type::ub:
|
||||
case rsx::vertex_base_type::cmp:
|
||||
return true;
|
||||
case vertex_base_type::f:
|
||||
case vertex_base_type::sf:
|
||||
case vertex_base_type::ub256:
|
||||
case vertex_base_type::s32k:
|
||||
case rsx::vertex_base_type::f:
|
||||
case rsx::vertex_base_type::sf:
|
||||
case rsx::vertex_base_type::ub256:
|
||||
case rsx::vertex_base_type::s32k:
|
||||
return false;
|
||||
}
|
||||
throw EXCEPTION("unknow vertex type");
|
||||
|
@ -404,7 +404,7 @@ void GLGSRender::end()
|
|||
u32 min_index, max_index;
|
||||
if (draw_command == rsx::draw_command::indexed)
|
||||
{
|
||||
index_array_type type = to_index_array_type(rsx::method_registers[NV4097_SET_INDEX_ARRAY_DMA] >> 4);
|
||||
rsx::index_array_type type = rsx::to_index_array_type(rsx::method_registers[NV4097_SET_INDEX_ARRAY_DMA] >> 4);
|
||||
u32 type_size = gsl::narrow<u32>(get_index_type_size(type));
|
||||
for (const auto& first_count : first_count_commands)
|
||||
{
|
||||
|
@ -415,10 +415,10 @@ void GLGSRender::end()
|
|||
|
||||
switch (type)
|
||||
{
|
||||
case index_array_type::unsigned_32b:
|
||||
case rsx::index_array_type::u32:
|
||||
std::tie(min_index, max_index) = write_index_array_data_to_buffer_untouched(gsl::span<u32>((u32*)vertex_index_array.data(), vertex_draw_count), first_count_commands);
|
||||
break;
|
||||
case index_array_type::unsigned_16b:
|
||||
case rsx::index_array_type::u16:
|
||||
std::tie(min_index, max_index) = write_index_array_data_to_buffer_untouched(gsl::span<u16>((u16*)vertex_index_array.data(), vertex_draw_count), first_count_commands);
|
||||
break;
|
||||
}
|
||||
|
@ -508,7 +508,7 @@ void GLGSRender::end()
|
|||
|
||||
switch (vertex_info.type)
|
||||
{
|
||||
case vertex_base_type::f:
|
||||
case rsx::vertex_base_type::f:
|
||||
switch (register_vertex_info[index].size)
|
||||
{
|
||||
case 1: apply_attrib_array<f32, 1>(*m_program, location, vertex_data); break;
|
||||
|
@ -531,11 +531,11 @@ void GLGSRender::end()
|
|||
{
|
||||
m_ebo.data(vertex_index_array.size(), vertex_index_array.data());
|
||||
|
||||
index_array_type indexed_type = to_index_array_type(rsx::method_registers[NV4097_SET_INDEX_ARRAY_DMA] >> 4);
|
||||
rsx::index_array_type indexed_type = rsx::to_index_array_type(rsx::method_registers[NV4097_SET_INDEX_ARRAY_DMA] >> 4);
|
||||
|
||||
if (indexed_type == index_array_type::unsigned_32b)
|
||||
if (indexed_type == rsx::index_array_type::u32)
|
||||
__glcheck glDrawElements(gl::draw_mode(draw_mode), vertex_draw_count, GL_UNSIGNED_INT, nullptr);
|
||||
if (indexed_type == index_array_type::unsigned_16b)
|
||||
if (indexed_type == rsx::index_array_type::u16)
|
||||
__glcheck glDrawElements(gl::draw_mode(draw_mode), vertex_draw_count, GL_UNSIGNED_SHORT, nullptr);
|
||||
}
|
||||
else
|
||||
|
@ -677,7 +677,7 @@ void nv4097_clear_surface(u32 arg, GLGSRender* renderer)
|
|||
|
||||
if (arg & 0x1)
|
||||
{
|
||||
surface_depth_format surface_depth_format = to_surface_depth_format((rsx::method_registers[NV4097_SET_SURFACE_FORMAT] >> 5) & 0x7);
|
||||
rsx::surface_depth_format surface_depth_format = rsx::to_surface_depth_format((rsx::method_registers[NV4097_SET_SURFACE_FORMAT] >> 5) & 0x7);
|
||||
u32 max_depth_value = get_max_depth_value(surface_depth_format);
|
||||
|
||||
u32 clear_depth = rsx::method_registers[NV4097_SET_ZSTENCIL_CLEAR_VALUE] >> 8;
|
||||
|
@ -855,52 +855,52 @@ struct color_format
|
|||
color_swizzle swizzle;
|
||||
};
|
||||
|
||||
color_format surface_color_format_to_gl(surface_color_format color_format)
|
||||
color_format surface_color_format_to_gl(rsx::surface_color_format color_format)
|
||||
{
|
||||
//color format
|
||||
switch (color_format)
|
||||
{
|
||||
case surface_color_format::r5g6b5:
|
||||
case rsx::surface_color_format::r5g6b5:
|
||||
return{ gl::texture::type::ushort_5_6_5, gl::texture::format::bgr, false, 3, 2 };
|
||||
|
||||
case surface_color_format::a8r8g8b8:
|
||||
case rsx::surface_color_format::a8r8g8b8:
|
||||
return{ gl::texture::type::uint_8_8_8_8, gl::texture::format::bgra, false, 4, 1 };
|
||||
|
||||
case surface_color_format::x8r8g8b8_o8r8g8b8:
|
||||
case rsx::surface_color_format::x8r8g8b8_o8r8g8b8:
|
||||
return{ gl::texture::type::uint_8_8_8_8, gl::texture::format::bgra, false, 4, 1,
|
||||
{ gl::texture::channel::one, gl::texture::channel::r, gl::texture::channel::g, gl::texture::channel::b } };
|
||||
|
||||
case surface_color_format::w16z16y16x16:
|
||||
case rsx::surface_color_format::w16z16y16x16:
|
||||
return{ gl::texture::type::f16, gl::texture::format::rgba, true, 4, 2 };
|
||||
|
||||
case surface_color_format::w32z32y32x32:
|
||||
case rsx::surface_color_format::w32z32y32x32:
|
||||
return{ gl::texture::type::f32, gl::texture::format::rgba, true, 4, 4 };
|
||||
|
||||
case surface_color_format::b8:
|
||||
case surface_color_format::x1r5g5b5_o1r5g5b5:
|
||||
case surface_color_format::x1r5g5b5_z1r5g5b5:
|
||||
case surface_color_format::x8r8g8b8_z8r8g8b8:
|
||||
case surface_color_format::g8b8:
|
||||
case surface_color_format::x32:
|
||||
case surface_color_format::x8b8g8r8_o8b8g8r8:
|
||||
case surface_color_format::x8b8g8r8_z8b8g8r8:
|
||||
case surface_color_format::a8b8g8r8:
|
||||
case rsx::surface_color_format::b8:
|
||||
case rsx::surface_color_format::x1r5g5b5_o1r5g5b5:
|
||||
case rsx::surface_color_format::x1r5g5b5_z1r5g5b5:
|
||||
case rsx::surface_color_format::x8r8g8b8_z8r8g8b8:
|
||||
case rsx::surface_color_format::g8b8:
|
||||
case rsx::surface_color_format::x32:
|
||||
case rsx::surface_color_format::x8b8g8r8_o8b8g8r8:
|
||||
case rsx::surface_color_format::x8b8g8r8_z8b8g8r8:
|
||||
case rsx::surface_color_format::a8b8g8r8:
|
||||
default:
|
||||
LOG_ERROR(RSX, "Surface color buffer: Unsupported surface color format (0x%x)", color_format);
|
||||
return{ gl::texture::type::uint_8_8_8_8, gl::texture::format::bgra, false, 4, 1 };
|
||||
}
|
||||
}
|
||||
|
||||
std::pair<gl::texture::type, gl::texture::format> surface_depth_format_to_gl(surface_depth_format depth_format)
|
||||
std::pair<gl::texture::type, gl::texture::format> surface_depth_format_to_gl(rsx::surface_depth_format depth_format)
|
||||
{
|
||||
switch (depth_format)
|
||||
{
|
||||
case surface_depth_format::z16:
|
||||
case rsx::surface_depth_format::z16:
|
||||
return std::make_pair(gl::texture::type::ushort, gl::texture::format::depth);
|
||||
|
||||
default:
|
||||
LOG_ERROR(RSX, "Surface depth buffer: Unsupported surface depth format (0x%x)", depth_format);
|
||||
case surface_depth_format::z24s8:
|
||||
case rsx::surface_depth_format::z24s8:
|
||||
return std::make_pair(gl::texture::type::uint_24_8, gl::texture::format::depth_stencil);
|
||||
//return std::make_pair(gl::texture::type::f32, gl::texture::format::depth);
|
||||
}
|
||||
|
@ -949,7 +949,7 @@ void GLGSRender::init_buffers(bool skip_reading)
|
|||
|
||||
switch (m_surface.depth_format)
|
||||
{
|
||||
case surface_depth_format::z16:
|
||||
case rsx::surface_depth_format::z16:
|
||||
{
|
||||
__glcheck m_draw_tex_depth_stencil.config()
|
||||
.size({ (int)m_surface.width, (int)m_surface.height })
|
||||
|
@ -961,7 +961,7 @@ void GLGSRender::init_buffers(bool skip_reading)
|
|||
break;
|
||||
}
|
||||
|
||||
case surface_depth_format::z24s8:
|
||||
case rsx::surface_depth_format::z24s8:
|
||||
{
|
||||
__glcheck m_draw_tex_depth_stencil.config()
|
||||
.size({ (int)m_surface.width, (int)m_surface.height })
|
||||
|
@ -992,27 +992,27 @@ void GLGSRender::init_buffers(bool skip_reading)
|
|||
|
||||
set_viewport();
|
||||
|
||||
switch (to_surface_target(rsx::method_registers[NV4097_SET_SURFACE_COLOR_TARGET]))
|
||||
switch (rsx::to_surface_target(rsx::method_registers[NV4097_SET_SURFACE_COLOR_TARGET]))
|
||||
{
|
||||
case surface_target::none: break;
|
||||
case rsx::surface_target::none: break;
|
||||
|
||||
case surface_target::surface_a:
|
||||
case rsx::surface_target::surface_a:
|
||||
__glcheck draw_fbo.draw_buffer(draw_fbo.color[0]);
|
||||
break;
|
||||
|
||||
case surface_target::surface_b:
|
||||
case rsx::surface_target::surface_b:
|
||||
__glcheck draw_fbo.draw_buffer(draw_fbo.color[1] );
|
||||
break;
|
||||
|
||||
case surface_target::surfaces_a_b:
|
||||
case rsx::surface_target::surfaces_a_b:
|
||||
__glcheck draw_fbo.draw_buffers({ draw_fbo.color[0], draw_fbo.color[1] });
|
||||
break;
|
||||
|
||||
case surface_target::surfaces_a_b_c:
|
||||
case rsx::surface_target::surfaces_a_b_c:
|
||||
__glcheck draw_fbo.draw_buffers({ draw_fbo.color[0], draw_fbo.color[1], draw_fbo.color[2] });
|
||||
break;
|
||||
|
||||
case surface_target::surfaces_a_b_c_d:
|
||||
case rsx::surface_target::surfaces_a_b_c_d:
|
||||
__glcheck draw_fbo.draw_buffers({ draw_fbo.color[0], draw_fbo.color[1], draw_fbo.color[2], draw_fbo.color[3] });
|
||||
break;
|
||||
|
||||
|
@ -1090,28 +1090,28 @@ void GLGSRender::read_buffers()
|
|||
}
|
||||
};
|
||||
|
||||
switch (to_surface_target(rsx::method_registers[NV4097_SET_SURFACE_COLOR_TARGET]))
|
||||
switch (rsx::to_surface_target(rsx::method_registers[NV4097_SET_SURFACE_COLOR_TARGET]))
|
||||
{
|
||||
case surface_target::none:
|
||||
case rsx::surface_target::none:
|
||||
break;
|
||||
|
||||
case surface_target::surface_a:
|
||||
case rsx::surface_target::surface_a:
|
||||
read_color_buffers(0, 1);
|
||||
break;
|
||||
|
||||
case surface_target::surface_b:
|
||||
case rsx::surface_target::surface_b:
|
||||
read_color_buffers(1, 1);
|
||||
break;
|
||||
|
||||
case surface_target::surfaces_a_b:
|
||||
case rsx::surface_target::surfaces_a_b:
|
||||
read_color_buffers(0, 2);
|
||||
break;
|
||||
|
||||
case surface_target::surfaces_a_b_c:
|
||||
case rsx::surface_target::surfaces_a_b_c:
|
||||
read_color_buffers(0, 3);
|
||||
break;
|
||||
|
||||
case surface_target::surfaces_a_b_c_d:
|
||||
case rsx::surface_target::surfaces_a_b_c_d:
|
||||
read_color_buffers(0, 4);
|
||||
break;
|
||||
}
|
||||
|
@ -1135,7 +1135,7 @@ void GLGSRender::read_buffers()
|
|||
{
|
||||
u32 depth_address = rsx::get_address(rsx::method_registers[NV4097_SET_SURFACE_ZETA_OFFSET], rsx::method_registers[NV4097_SET_CONTEXT_DMA_ZETA]);
|
||||
|
||||
if (m_surface.depth_format == surface_depth_format::z16)
|
||||
if (m_surface.depth_format == rsx::surface_depth_format::z16)
|
||||
{
|
||||
u16 *dst = (u16*)pixels;
|
||||
const be_t<u16>* src = vm::ps3::_ptr<u16>(depth_address);
|
||||
|
@ -1221,28 +1221,28 @@ void GLGSRender::write_buffers()
|
|||
}
|
||||
};
|
||||
|
||||
switch (to_surface_target(rsx::method_registers[NV4097_SET_SURFACE_COLOR_TARGET]))
|
||||
switch (rsx::to_surface_target(rsx::method_registers[NV4097_SET_SURFACE_COLOR_TARGET]))
|
||||
{
|
||||
case surface_target::none:
|
||||
case rsx::surface_target::none:
|
||||
break;
|
||||
|
||||
case surface_target::surface_a:
|
||||
case rsx::surface_target::surface_a:
|
||||
write_color_buffers(0, 1);
|
||||
break;
|
||||
|
||||
case surface_target::surface_b:
|
||||
case rsx::surface_target::surface_b:
|
||||
write_color_buffers(1, 1);
|
||||
break;
|
||||
|
||||
case surface_target::surfaces_a_b:
|
||||
case rsx::surface_target::surfaces_a_b:
|
||||
write_color_buffers(0, 2);
|
||||
break;
|
||||
|
||||
case surface_target::surfaces_a_b_c:
|
||||
case rsx::surface_target::surfaces_a_b_c:
|
||||
write_color_buffers(0, 3);
|
||||
break;
|
||||
|
||||
case surface_target::surfaces_a_b_c_d:
|
||||
case rsx::surface_target::surfaces_a_b_c_d:
|
||||
write_color_buffers(0, 4);
|
||||
break;
|
||||
}
|
||||
|
@ -1269,7 +1269,7 @@ void GLGSRender::write_buffers()
|
|||
{
|
||||
u32 depth_address = rsx::get_address(rsx::method_registers[NV4097_SET_SURFACE_ZETA_OFFSET], rsx::method_registers[NV4097_SET_CONTEXT_DMA_ZETA]);
|
||||
|
||||
if (m_surface.depth_format == surface_depth_format::z16)
|
||||
if (m_surface.depth_format == rsx::surface_depth_format::z16)
|
||||
{
|
||||
const u16 *src = (const u16*)pixels;
|
||||
be_t<u16>* dst = vm::ps3::_ptr<u16>(depth_address);
|
||||
|
|
|
@ -5,20 +5,20 @@ namespace gl
|
|||
{
|
||||
const fbo screen{};
|
||||
|
||||
GLenum draw_mode(primitive_type in)
|
||||
GLenum draw_mode(rsx::primitive_type in)
|
||||
{
|
||||
switch (in)
|
||||
{
|
||||
case primitive_type::points: return GL_POINTS;
|
||||
case primitive_type::lines: return GL_LINES;
|
||||
case primitive_type::line_loop: return GL_LINE_LOOP;
|
||||
case primitive_type::line_strip: return GL_LINE_STRIP;
|
||||
case primitive_type::triangles: return GL_TRIANGLES;
|
||||
case primitive_type::triangle_strip: return GL_TRIANGLE_STRIP;
|
||||
case primitive_type::triangle_fan: return GL_TRIANGLE_FAN;
|
||||
case primitive_type::quads: return GL_QUADS;
|
||||
case primitive_type::quad_strip: return GL_QUAD_STRIP;
|
||||
case primitive_type::polygon: return GL_POLYGON;
|
||||
case rsx::primitive_type::points: return GL_POINTS;
|
||||
case rsx::primitive_type::lines: return GL_LINES;
|
||||
case rsx::primitive_type::line_loop: return GL_LINE_LOOP;
|
||||
case rsx::primitive_type::line_strip: return GL_LINE_STRIP;
|
||||
case rsx::primitive_type::triangles: return GL_TRIANGLES;
|
||||
case rsx::primitive_type::triangle_strip: return GL_TRIANGLE_STRIP;
|
||||
case rsx::primitive_type::triangle_fan: return GL_TRIANGLE_FAN;
|
||||
case rsx::primitive_type::quads: return GL_QUADS;
|
||||
case rsx::primitive_type::quad_strip: return GL_QUAD_STRIP;
|
||||
case rsx::primitive_type::polygon: return GL_POLYGON;
|
||||
}
|
||||
throw new EXCEPTION("unknow primitive type");
|
||||
}
|
||||
|
@ -97,74 +97,74 @@ namespace gl
|
|||
__glcheck glDrawBuffers((GLsizei)ids.size(), ids.data());
|
||||
}
|
||||
|
||||
void fbo::draw_arrays(primitive_type mode, GLsizei count, GLint first) const
|
||||
void fbo::draw_arrays(rsx::primitive_type mode, GLsizei count, GLint first) const
|
||||
{
|
||||
save_binding_state save(*this);
|
||||
__glcheck glDrawArrays(draw_mode(mode), first, count);
|
||||
}
|
||||
|
||||
void fbo::draw_arrays(const buffer& buffer, primitive_type mode, GLsizei count, GLint first) const
|
||||
void fbo::draw_arrays(const buffer& buffer, rsx::primitive_type mode, GLsizei count, GLint first) const
|
||||
{
|
||||
buffer.bind(buffer::target::array);
|
||||
draw_arrays(mode, count, first);
|
||||
}
|
||||
|
||||
void fbo::draw_arrays(const vao& buffer, primitive_type mode, GLsizei count, GLint first) const
|
||||
void fbo::draw_arrays(const vao& buffer, rsx::primitive_type mode, GLsizei count, GLint first) const
|
||||
{
|
||||
buffer.bind();
|
||||
draw_arrays(mode, count, first);
|
||||
}
|
||||
|
||||
void fbo::draw_elements(primitive_type mode, GLsizei count, indices_type type, const GLvoid *indices) const
|
||||
void fbo::draw_elements(rsx::primitive_type mode, GLsizei count, indices_type type, const GLvoid *indices) const
|
||||
{
|
||||
save_binding_state save(*this);
|
||||
__glcheck glDrawElements(draw_mode(mode), count, (GLenum)type, indices);
|
||||
}
|
||||
|
||||
void fbo::draw_elements(const buffer& buffer, primitive_type mode, GLsizei count, indices_type type, const GLvoid *indices) const
|
||||
void fbo::draw_elements(const buffer& buffer, rsx::primitive_type mode, GLsizei count, indices_type type, const GLvoid *indices) const
|
||||
{
|
||||
buffer.bind(buffer::target::array);
|
||||
__glcheck glDrawElements(draw_mode(mode), count, (GLenum)type, indices);
|
||||
}
|
||||
|
||||
void fbo::draw_elements(primitive_type mode, GLsizei count, indices_type type, const buffer& indices, size_t indices_buffer_offset) const
|
||||
void fbo::draw_elements(rsx::primitive_type mode, GLsizei count, indices_type type, const buffer& indices, size_t indices_buffer_offset) const
|
||||
{
|
||||
indices.bind(buffer::target::element_array);
|
||||
__glcheck glDrawElements(draw_mode(mode), count, (GLenum)type, (GLvoid*)indices_buffer_offset);
|
||||
}
|
||||
|
||||
void fbo::draw_elements(const buffer& buffer_, primitive_type mode, GLsizei count, indices_type type, const buffer& indices, size_t indices_buffer_offset) const
|
||||
void fbo::draw_elements(const buffer& buffer_, rsx::primitive_type mode, GLsizei count, indices_type type, const buffer& indices, size_t indices_buffer_offset) const
|
||||
{
|
||||
buffer_.bind(buffer::target::array);
|
||||
draw_elements(mode, count, type, indices, indices_buffer_offset);
|
||||
}
|
||||
|
||||
void fbo::draw_elements(primitive_type mode, GLsizei count, const GLubyte *indices) const
|
||||
void fbo::draw_elements(rsx::primitive_type mode, GLsizei count, const GLubyte *indices) const
|
||||
{
|
||||
draw_elements(mode, count, indices_type::ubyte, indices);
|
||||
}
|
||||
|
||||
void fbo::draw_elements(const buffer& buffer, primitive_type mode, GLsizei count, const GLubyte *indices) const
|
||||
void fbo::draw_elements(const buffer& buffer, rsx::primitive_type mode, GLsizei count, const GLubyte *indices) const
|
||||
{
|
||||
draw_elements(buffer, mode, count, indices_type::ubyte, indices);
|
||||
}
|
||||
|
||||
void fbo::draw_elements(primitive_type mode, GLsizei count, const GLushort *indices) const
|
||||
void fbo::draw_elements(rsx::primitive_type mode, GLsizei count, const GLushort *indices) const
|
||||
{
|
||||
draw_elements(mode, count, indices_type::ushort, indices);
|
||||
}
|
||||
|
||||
void fbo::draw_elements(const buffer& buffer, primitive_type mode, GLsizei count, const GLushort *indices) const
|
||||
void fbo::draw_elements(const buffer& buffer, rsx::primitive_type mode, GLsizei count, const GLushort *indices) const
|
||||
{
|
||||
draw_elements(buffer, mode, count, indices_type::ushort, indices);
|
||||
}
|
||||
|
||||
void fbo::draw_elements(primitive_type mode, GLsizei count, const GLuint *indices) const
|
||||
void fbo::draw_elements(rsx::primitive_type mode, GLsizei count, const GLuint *indices) const
|
||||
{
|
||||
draw_elements(mode, count, indices_type::uint, indices);
|
||||
}
|
||||
|
||||
void fbo::draw_elements(const buffer& buffer, primitive_type mode, GLsizei count, const GLuint *indices) const
|
||||
void fbo::draw_elements(const buffer& buffer, rsx::primitive_type mode, GLsizei count, const GLuint *indices) const
|
||||
{
|
||||
draw_elements(buffer, mode, count, indices_type::uint, indices);
|
||||
}
|
||||
|
|
|
@ -1380,7 +1380,7 @@ namespace gl
|
|||
settings& border_color(color4f value);
|
||||
};
|
||||
|
||||
GLenum draw_mode(primitive_type in);
|
||||
GLenum draw_mode(rsx::primitive_type in);
|
||||
|
||||
enum class indices_type
|
||||
{
|
||||
|
@ -1523,20 +1523,20 @@ namespace gl
|
|||
void draw_buffer(const attachment& buffer) const;
|
||||
void draw_buffers(const std::initializer_list<attachment>& indexes) const;
|
||||
|
||||
void draw_arrays(primitive_type mode, GLsizei count, GLint first = 0) const;
|
||||
void draw_arrays(const buffer& buffer, primitive_type mode, GLsizei count, GLint first = 0) const;
|
||||
void draw_arrays(const vao& buffer, primitive_type mode, GLsizei count, GLint first = 0) const;
|
||||
void draw_arrays(rsx::primitive_type mode, GLsizei count, GLint first = 0) const;
|
||||
void draw_arrays(const buffer& buffer, rsx::primitive_type mode, GLsizei count, GLint first = 0) const;
|
||||
void draw_arrays(const vao& buffer, rsx::primitive_type mode, GLsizei count, GLint first = 0) const;
|
||||
|
||||
void draw_elements(primitive_type mode, GLsizei count, indices_type type, const GLvoid *indices) const;
|
||||
void draw_elements(const buffer& buffer, primitive_type mode, GLsizei count, indices_type type, const GLvoid *indices) const;
|
||||
void draw_elements(primitive_type mode, GLsizei count, indices_type type, const buffer& indices, size_t indices_buffer_offset = 0) const;
|
||||
void draw_elements(const buffer& buffer_, primitive_type mode, GLsizei count, indices_type type, const buffer& indices, size_t indices_buffer_offset = 0) const;
|
||||
void draw_elements(primitive_type mode, GLsizei count, const GLubyte *indices) const;
|
||||
void draw_elements(const buffer& buffer, primitive_type mode, GLsizei count, const GLubyte *indices) const;
|
||||
void draw_elements(primitive_type mode, GLsizei count, const GLushort *indices) const;
|
||||
void draw_elements(const buffer& buffer, primitive_type mode, GLsizei count, const GLushort *indices) const;
|
||||
void draw_elements(primitive_type mode, GLsizei count, const GLuint *indices) const;
|
||||
void draw_elements(const buffer& buffer, primitive_type mode, GLsizei count, const GLuint *indices) const;
|
||||
void draw_elements(rsx::primitive_type mode, GLsizei count, indices_type type, const GLvoid *indices) const;
|
||||
void draw_elements(const buffer& buffer, rsx::primitive_type mode, GLsizei count, indices_type type, const GLvoid *indices) const;
|
||||
void draw_elements(rsx::primitive_type mode, GLsizei count, indices_type type, const buffer& indices, size_t indices_buffer_offset = 0) const;
|
||||
void draw_elements(const buffer& buffer_, rsx::primitive_type mode, GLsizei count, indices_type type, const buffer& indices, size_t indices_buffer_offset = 0) const;
|
||||
void draw_elements(rsx::primitive_type mode, GLsizei count, const GLubyte *indices) const;
|
||||
void draw_elements(const buffer& buffer, rsx::primitive_type mode, GLsizei count, const GLubyte *indices) const;
|
||||
void draw_elements(rsx::primitive_type mode, GLsizei count, const GLushort *indices) const;
|
||||
void draw_elements(const buffer& buffer, rsx::primitive_type mode, GLsizei count, const GLushort *indices) const;
|
||||
void draw_elements(rsx::primitive_type mode, GLsizei count, const GLuint *indices) const;
|
||||
void draw_elements(const buffer& buffer, rsx::primitive_type mode, GLsizei count, const GLuint *indices) const;
|
||||
|
||||
void clear(buffers buffers_) const;
|
||||
void clear(buffers buffers_, color4f color_value, double depth_value, u8 stencil_value) const;
|
||||
|
|
|
@ -15,15 +15,14 @@ extern u64 get_system_time();
|
|||
|
||||
struct frame_capture_data
|
||||
{
|
||||
|
||||
struct draw_state
|
||||
{
|
||||
std::string name;
|
||||
std::pair<std::string, std::string> programs;
|
||||
size_t width = 0, height = 0;
|
||||
surface_color_format color_format;
|
||||
rsx::surface_color_format color_format;
|
||||
std::array<std::vector<gsl::byte>, 4> color_buffer;
|
||||
surface_depth_format depth_format;
|
||||
rsx::surface_depth_format depth_format;
|
||||
std::array<std::vector<gsl::byte>, 2> depth_stencil;
|
||||
};
|
||||
std::vector<std::pair<u32, u32> > command_queue;
|
||||
|
|
|
@ -267,12 +267,12 @@ u8 GcmSurfaceFormat2GcmTextureFormat(u8 surfaceFormat, u8 surfaceType)
|
|||
{
|
||||
u8 result = 0;
|
||||
|
||||
switch (to_surface_color_format(surfaceFormat))
|
||||
switch (rsx::to_surface_color_format(surfaceFormat))
|
||||
{
|
||||
case surface_color_format::a8r8g8b8:
|
||||
case rsx::surface_color_format::a8r8g8b8:
|
||||
result = CELL_GCM_TEXTURE_A8R8G8B8;
|
||||
break;
|
||||
case surface_color_format::w16z16y16x16:
|
||||
case rsx::surface_color_format::w16z16y16x16:
|
||||
result = CELL_GCM_TEXTURE_W16_Z16_Y16_X16_FLOAT;
|
||||
break;
|
||||
default:
|
||||
|
@ -933,15 +933,15 @@ s32 cellRescGcmSurface2RescSrc(vm::ptr<CellGcmSurface> gcmSurface, vm::ptr<CellR
|
|||
u8 textureFormat = GcmSurfaceFormat2GcmTextureFormat(gcmSurface->colorFormat, gcmSurface->type);
|
||||
s32 xW = 1, xH = 1;
|
||||
|
||||
switch(to_surface_antialiasing(gcmSurface->antialias))
|
||||
switch(rsx::to_surface_antialiasing(gcmSurface->antialias))
|
||||
{
|
||||
case surface_antialiasing::square_rotated_4_samples:
|
||||
case rsx::surface_antialiasing::square_rotated_4_samples:
|
||||
xW=xH=2;
|
||||
break;
|
||||
case surface_antialiasing::square_centered_4_samples:
|
||||
case rsx::surface_antialiasing::square_centered_4_samples:
|
||||
xW=xH=2;
|
||||
break;
|
||||
case surface_antialiasing::diagonal_centered_2_samples:
|
||||
case rsx::surface_antialiasing::diagonal_centered_2_samples:
|
||||
xW=2;
|
||||
break;
|
||||
default:
|
||||
|
|
|
@ -382,16 +382,16 @@ void RSXDebugger::OnClickBuffer(wxMouseEvent& event)
|
|||
|
||||
namespace
|
||||
{
|
||||
std::array<u8, 3> get_value(gsl::span<const gsl::byte> orig_buffer, surface_color_format format, size_t idx)
|
||||
std::array<u8, 3> get_value(gsl::span<const gsl::byte> orig_buffer, rsx::surface_color_format format, size_t idx)
|
||||
{
|
||||
switch (format)
|
||||
{
|
||||
case surface_color_format::b8:
|
||||
case rsx::surface_color_format::b8:
|
||||
{
|
||||
u8 value = gsl::as_span<const u8>(orig_buffer)[idx];
|
||||
return{ value, value, value };
|
||||
}
|
||||
case surface_color_format::x32:
|
||||
case rsx::surface_color_format::x32:
|
||||
{
|
||||
be_t<u32> stored_val = gsl::as_span<const be_t<u32>>(orig_buffer)[idx];
|
||||
u32 swapped_val = stored_val;
|
||||
|
@ -399,21 +399,21 @@ namespace
|
|||
u8 val = float_val * 255.f;
|
||||
return{ val, val, val };
|
||||
}
|
||||
case surface_color_format::a8b8g8r8:
|
||||
case surface_color_format::x8b8g8r8_o8b8g8r8:
|
||||
case surface_color_format::x8b8g8r8_z8b8g8r8:
|
||||
case rsx::surface_color_format::a8b8g8r8:
|
||||
case rsx::surface_color_format::x8b8g8r8_o8b8g8r8:
|
||||
case rsx::surface_color_format::x8b8g8r8_z8b8g8r8:
|
||||
{
|
||||
auto ptr = gsl::as_span<const u8>(orig_buffer);
|
||||
return{ ptr[1 + idx * 4], ptr[2 + idx * 4], ptr[3 + idx * 4] };
|
||||
}
|
||||
case surface_color_format::a8r8g8b8:
|
||||
case surface_color_format::x8r8g8b8_o8r8g8b8:
|
||||
case surface_color_format::x8r8g8b8_z8r8g8b8:
|
||||
case rsx::surface_color_format::a8r8g8b8:
|
||||
case rsx::surface_color_format::x8r8g8b8_o8r8g8b8:
|
||||
case rsx::surface_color_format::x8r8g8b8_z8r8g8b8:
|
||||
{
|
||||
auto ptr = gsl::as_span<const u8>(orig_buffer);
|
||||
return{ ptr[3 + idx * 4], ptr[2 + idx * 4], ptr[1 + idx * 4] };
|
||||
}
|
||||
case surface_color_format::w16z16y16x16:
|
||||
case rsx::surface_color_format::w16z16y16x16:
|
||||
{
|
||||
auto ptr = gsl::as_span<const u16>(orig_buffer);
|
||||
f16 h0 = f16(ptr[4 * idx]);
|
||||
|
@ -428,11 +428,11 @@ namespace
|
|||
u8 val2 = f2 * 255.;
|
||||
return{ val0, val1, val2 };
|
||||
}
|
||||
case surface_color_format::g8b8:
|
||||
case surface_color_format::r5g6b5:
|
||||
case surface_color_format::x1r5g5b5_o1r5g5b5:
|
||||
case surface_color_format::x1r5g5b5_z1r5g5b5:
|
||||
case surface_color_format::w32z32y32x32:
|
||||
case rsx::surface_color_format::g8b8:
|
||||
case rsx::surface_color_format::r5g6b5:
|
||||
case rsx::surface_color_format::x1r5g5b5_o1r5g5b5:
|
||||
case rsx::surface_color_format::x1r5g5b5_z1r5g5b5:
|
||||
case rsx::surface_color_format::w32z32y32x32:
|
||||
throw EXCEPTION("Unsupported format for display");
|
||||
}
|
||||
}
|
||||
|
@ -441,7 +441,7 @@ namespace
|
|||
* Return a new buffer that can be passed to wxImage ctor.
|
||||
* The pointer seems to be freed by wxImage.
|
||||
*/
|
||||
u8* convert_to_wximage_buffer(surface_color_format format, gsl::span<const gsl::byte> orig_buffer, size_t width, size_t height) noexcept
|
||||
u8* convert_to_wximage_buffer(rsx::surface_color_format format, gsl::span<const gsl::byte> orig_buffer, size_t width, size_t height) noexcept
|
||||
{
|
||||
unsigned char* buffer = (unsigned char*)malloc(width * height * 3);
|
||||
for (u32 i = 0; i < width * height; i++)
|
||||
|
@ -491,7 +491,7 @@ void RSXDebugger::OnClickDrawCalls(wxMouseEvent& event)
|
|||
gsl::span<const gsl::byte> orig_buffer = draw_call.depth_stencil[0];
|
||||
unsigned char *buffer = (unsigned char *)malloc(width * height * 3);
|
||||
|
||||
if (draw_call.depth_format == surface_depth_format::z24s8)
|
||||
if (draw_call.depth_format == rsx::surface_depth_format::z24s8)
|
||||
{
|
||||
for (u32 row = 0; row < height; row++)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue