mirror of
https://github.com/86Box/86Box.git
synced 2026-02-23 09:58:19 -07:00
much less idiotic...
This commit is contained in:
@@ -22,6 +22,7 @@ void nv3_render_write_pixel(nv3_position_16_t position, uint32_t color, nv3_grob
|
||||
uint8_t nv3_render_read_pixel_8(nv3_position_16_t position, nv3_grobj_t grobj, bool use_destination);
|
||||
uint16_t nv3_render_read_pixel_16(nv3_position_16_t position, nv3_grobj_t grobj, bool use_destination);
|
||||
uint32_t nv3_render_read_pixel_32(nv3_position_16_t position, nv3_grobj_t grobj, bool use_destination);
|
||||
uint32_t nv3_render_get_vram_address(nv3_position_16_t position, nv3_grobj_t grobj, bool use_destination);
|
||||
|
||||
uint32_t nv3_render_to_chroma(nv3_color_expanded_t expanded);
|
||||
nv3_color_expanded_t nv3_render_expand_color(uint32_t color, nv3_grobj_t grobj); // Convert a colour to full RGB10 format from the current working format.
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
* Also check the doc folder for some more notres
|
||||
*
|
||||
* vid_nv3.h: NV3 Architecture Hardware Reference (open-source)
|
||||
* Last updated: 2 April 2025 (STILL WORKING ON IT!!!)
|
||||
* Last updated: 6 April 2025 (STILL WORKING ON IT!!!)
|
||||
*
|
||||
* Authors: Connor Hyde <mario64crashed@gmail.com>
|
||||
*
|
||||
|
||||
@@ -278,7 +278,7 @@ void nv3_class_00c_method(uint32_t param, uint32_t method_id, nv3_ramin_context_
|
||||
return;
|
||||
}
|
||||
|
||||
nv_log("%s: Invalid or unimplemented method 0x%04x\n", nv3_class_names[context.class_id & 0x1F], method_id);
|
||||
warning("%s: Invalid or unimplemented method 0x%04x\n", nv3_class_names[context.class_id & 0x1F], method_id);
|
||||
nv3_pgraph_interrupt_invalid(NV3_PGRAPH_INTR_1_SOFTWARE_METHOD_PENDING);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -54,6 +54,11 @@ void nv3_class_010_method(uint32_t param, uint32_t method_id, nv3_ramin_context_
|
||||
&& nv3->pgraph.blit.point_in.y == nv3->pgraph.blit.point_out.y)
|
||||
return;
|
||||
|
||||
/* Some of these seem to have sizes of 0, so skip */
|
||||
if (nv3->pgraph.blit.size.h == 0
|
||||
&& nv3->pgraph.blit.size.w == 0)
|
||||
return;
|
||||
|
||||
nv3_render_blit_screen2screen(grobj);
|
||||
|
||||
break;
|
||||
|
||||
@@ -138,51 +138,38 @@ void nv3_render_blit_screen2screen(nv3_grobj_t grobj)
|
||||
|
||||
uint32_t pixel_to_copy = 0x00;
|
||||
|
||||
/* Prevents overwriting pixels we've already modified*/
|
||||
uint32_t xdiff = 0, ydiff = 0;
|
||||
/* Coordinates for copying an entire line at a time */
|
||||
uint32_t buf_position = 0, vram_position = 0, size_x = nv3->pgraph.blit.size.w;
|
||||
|
||||
/* Read the old pixel into the line buffer
|
||||
Assumption: All data is sent in an unpacked format. In the case of an NVIDIA GPU this means that all data is sent 32 bits at a time regardless of if
|
||||
the actual source data is 32 bits in size or not. For pixel data, the upper bits are left as 0 in 8bpp/16bpp mode. For 86box purposes, the data is written
|
||||
8/16 bits at a time.
|
||||
|
||||
TODO: CHECK FOR PACKED FORMAT!!!!!
|
||||
*/
|
||||
|
||||
if (nv3->nvbase.svga.bpp == 15
|
||||
|| nv3->nvbase.svga.bpp == 16)
|
||||
size_x <<= 1;
|
||||
else if (nv3->nvbase.svga.bpp == 32)
|
||||
size_x <<= 2;
|
||||
|
||||
/* Read the old pixel into the line buffer */
|
||||
for (int32_t y = 0; y < nv3->pgraph.blit.size.h; y++)
|
||||
{
|
||||
old_position.y = nv3->pgraph.blit.point_in.y + y;
|
||||
/* 32bit buffer */
|
||||
buf_position = (nv3->pgraph.blit.size.w * y);
|
||||
vram_position = nv3_render_get_vram_address(old_position, grobj, false);
|
||||
|
||||
for (int32_t x = 0; x < nv3->pgraph.blit.size.w; x++)
|
||||
{
|
||||
old_position.x = nv3->pgraph.blit.point_in.x + x;
|
||||
|
||||
switch (nv3->nvbase.svga.bpp)
|
||||
{
|
||||
case 8:
|
||||
pixel_to_copy = nv3_render_read_pixel_8(old_position, grobj, false) & 0xFF;
|
||||
break;
|
||||
case 15 ... 16: //15bpp and 16bpp modes are considered as identical
|
||||
pixel_to_copy = nv3_render_read_pixel_16(old_position, grobj, false) & 0xFFFF;
|
||||
break;
|
||||
case 32:
|
||||
pixel_to_copy = nv3_render_read_pixel_32(old_position, grobj, false);
|
||||
break;
|
||||
}
|
||||
|
||||
uint32_t buf_position = (y * nv3->pgraph.blit.size.w) + x;
|
||||
nv3_s2sb_line_buffer[buf_position] = pixel_to_copy;
|
||||
}
|
||||
|
||||
|
||||
memcpy(&nv3_s2sb_line_buffer[buf_position], &nv3->nvbase.svga.vram[vram_position], size_x);
|
||||
}
|
||||
/* simply write it all back to vram */
|
||||
for (int32_t y = 0; y < nv3->pgraph.blit.size.h; y++)
|
||||
{
|
||||
{
|
||||
buf_position = (nv3->pgraph.blit.size.w * y);
|
||||
new_position.y = nv3->pgraph.blit.point_out.y + y;
|
||||
|
||||
for (int32_t x = 0; x < nv3->pgraph.blit.size.w; x++)
|
||||
{
|
||||
new_position.x = nv3->pgraph.blit.point_out.x + x;
|
||||
|
||||
uint32_t buf_position = (y * nv3->pgraph.blit.size.w) + x;
|
||||
|
||||
nv3_render_write_pixel(new_position, nv3_s2sb_line_buffer[buf_position], grobj);
|
||||
}
|
||||
vram_position = nv3_render_get_vram_address(new_position, grobj, false);
|
||||
memcpy(&nv3->nvbase.svga.vram[vram_position], &nv3_s2sb_line_buffer[buf_position], size_x);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -212,7 +212,7 @@ uint32_t nv3_render_set_pattern_color(nv3_color_expanded_t pattern_colour, bool
|
||||
|
||||
}
|
||||
|
||||
/* /* Combine the current buffer with the pitch to get the address in the framebuffer to draw from for a given position. */
|
||||
/* Combine the current buffer with the pitch to get the address in the framebuffer to draw from for a given position. */
|
||||
uint32_t nv3_render_get_vram_address(nv3_position_16_t position, nv3_grobj_t grobj, bool use_destination)
|
||||
{
|
||||
uint32_t vram_x = position.x;
|
||||
@@ -309,7 +309,6 @@ void nv3_render_write_pixel(nv3_position_16_t position, uint32_t color, nv3_grob
|
||||
bool alpha_enabled = (grobj.grobj_0 >> NV3_PGRAPH_CONTEXT_SWITCH_ALPHA) & 0x01;
|
||||
|
||||
uint32_t framebuffer_bpp = nv3->nvbase.svga.bpp; // maybe y16 too?z
|
||||
uint32_t current_buffer = (nv3->pgraph.context_switch >> NV3_PGRAPH_CONTEXT_SWITCH_SRC_BUFFER) & 0x03;
|
||||
|
||||
/* doesn't seem*/
|
||||
nv3_color_argb_t color_data = *(nv3_color_argb_t*)&color;
|
||||
|
||||
Reference in New Issue
Block a user