mirror of
https://github.com/libretro/RetroArch.git
synced 2024-11-25 00:49:47 +00:00
(360) Convert texture first to some color format suitable for
GPU/sampling - this fixes most of the problems with the shaders such as Lanzcos, Bead and Blinky.
This commit is contained in:
parent
1f10d2d18a
commit
8e950ba5be
@ -38,6 +38,74 @@ void *g_d3d;
|
||||
|
||||
/* Xbox 360 specific code */
|
||||
|
||||
const DWORD g_MapLinearToSrgbGpuFormat[] =
|
||||
{
|
||||
GPUTEXTUREFORMAT_1_REVERSE,
|
||||
GPUTEXTUREFORMAT_1,
|
||||
GPUTEXTUREFORMAT_8,
|
||||
GPUTEXTUREFORMAT_1_5_5_5,
|
||||
GPUTEXTUREFORMAT_5_6_5,
|
||||
GPUTEXTUREFORMAT_6_5_5,
|
||||
GPUTEXTUREFORMAT_8_8_8_8_AS_16_16_16_16,
|
||||
GPUTEXTUREFORMAT_2_10_10_10_AS_16_16_16_16,
|
||||
GPUTEXTUREFORMAT_8_A,
|
||||
GPUTEXTUREFORMAT_8_B,
|
||||
GPUTEXTUREFORMAT_8_8,
|
||||
GPUTEXTUREFORMAT_Cr_Y1_Cb_Y0_REP,
|
||||
GPUTEXTUREFORMAT_Y1_Cr_Y0_Cb_REP,
|
||||
GPUTEXTUREFORMAT_16_16_EDRAM,
|
||||
GPUTEXTUREFORMAT_8_8_8_8_A,
|
||||
GPUTEXTUREFORMAT_4_4_4_4,
|
||||
GPUTEXTUREFORMAT_10_11_11_AS_16_16_16_16,
|
||||
GPUTEXTUREFORMAT_11_11_10_AS_16_16_16_16,
|
||||
GPUTEXTUREFORMAT_DXT1_AS_16_16_16_16,
|
||||
GPUTEXTUREFORMAT_DXT2_3_AS_16_16_16_16,
|
||||
GPUTEXTUREFORMAT_DXT4_5_AS_16_16_16_16,
|
||||
GPUTEXTUREFORMAT_16_16_16_16_EDRAM,
|
||||
GPUTEXTUREFORMAT_24_8,
|
||||
GPUTEXTUREFORMAT_24_8_FLOAT,
|
||||
GPUTEXTUREFORMAT_16,
|
||||
GPUTEXTUREFORMAT_16_16,
|
||||
GPUTEXTUREFORMAT_16_16_16_16,
|
||||
GPUTEXTUREFORMAT_16_EXPAND,
|
||||
GPUTEXTUREFORMAT_16_16_EXPAND,
|
||||
GPUTEXTUREFORMAT_16_16_16_16_EXPAND,
|
||||
GPUTEXTUREFORMAT_16_FLOAT,
|
||||
GPUTEXTUREFORMAT_16_16_FLOAT,
|
||||
GPUTEXTUREFORMAT_16_16_16_16_FLOAT,
|
||||
GPUTEXTUREFORMAT_32,
|
||||
GPUTEXTUREFORMAT_32_32,
|
||||
GPUTEXTUREFORMAT_32_32_32_32,
|
||||
GPUTEXTUREFORMAT_32_FLOAT,
|
||||
GPUTEXTUREFORMAT_32_32_FLOAT,
|
||||
GPUTEXTUREFORMAT_32_32_32_32_FLOAT,
|
||||
GPUTEXTUREFORMAT_32_AS_8,
|
||||
GPUTEXTUREFORMAT_32_AS_8_8,
|
||||
GPUTEXTUREFORMAT_16_MPEG,
|
||||
GPUTEXTUREFORMAT_16_16_MPEG,
|
||||
GPUTEXTUREFORMAT_8_INTERLACED,
|
||||
GPUTEXTUREFORMAT_32_AS_8_INTERLACED,
|
||||
GPUTEXTUREFORMAT_32_AS_8_8_INTERLACED,
|
||||
GPUTEXTUREFORMAT_16_INTERLACED,
|
||||
GPUTEXTUREFORMAT_16_MPEG_INTERLACED,
|
||||
GPUTEXTUREFORMAT_16_16_MPEG_INTERLACED,
|
||||
GPUTEXTUREFORMAT_DXN,
|
||||
GPUTEXTUREFORMAT_8_8_8_8_AS_16_16_16_16,
|
||||
GPUTEXTUREFORMAT_DXT1_AS_16_16_16_16,
|
||||
GPUTEXTUREFORMAT_DXT2_3_AS_16_16_16_16,
|
||||
GPUTEXTUREFORMAT_DXT4_5_AS_16_16_16_16,
|
||||
GPUTEXTUREFORMAT_2_10_10_10_AS_16_16_16_16,
|
||||
GPUTEXTUREFORMAT_10_11_11_AS_16_16_16_16,
|
||||
GPUTEXTUREFORMAT_11_11_10_AS_16_16_16_16,
|
||||
GPUTEXTUREFORMAT_32_32_32_FLOAT,
|
||||
GPUTEXTUREFORMAT_DXT3A,
|
||||
GPUTEXTUREFORMAT_DXT5A,
|
||||
GPUTEXTUREFORMAT_CTX1,
|
||||
GPUTEXTUREFORMAT_DXT3A_AS_1_1_1_1,
|
||||
GPUTEXTUREFORMAT_8_8_8_8_GAMMA_EDRAM,
|
||||
GPUTEXTUREFORMAT_2_10_10_10_FLOAT_EDRAM,
|
||||
};
|
||||
|
||||
struct XPR_HEADER
|
||||
{
|
||||
unsigned long dwMagic;
|
||||
@ -303,6 +371,19 @@ static void xdk360_set_aspect_ratio(void * data, uint32_t aspectratio_index)
|
||||
set_viewport(false);
|
||||
}
|
||||
|
||||
static void xdk360_convert_texture_to_as16_srgb( D3DTexture *pTexture )
|
||||
{
|
||||
pTexture->Format.SignX = GPUSIGN_GAMMA;
|
||||
pTexture->Format.SignY = GPUSIGN_GAMMA;
|
||||
pTexture->Format.SignZ = GPUSIGN_GAMMA;
|
||||
|
||||
XGTEXTURE_DESC desc;
|
||||
XGGetTextureDesc( pTexture, 0, &desc );
|
||||
|
||||
//convert to AS_16_16_16_16 format
|
||||
pTexture->Format.DataFormat = g_MapLinearToSrgbGpuFormat[ (desc.Format & D3DFORMAT_TEXTUREFORMAT_MASK) >> D3DFORMAT_TEXTUREFORMAT_SHIFT ];
|
||||
}
|
||||
|
||||
static void *xdk360_gfx_init(const video_info_t *video, const input_driver_t **input, void **input_data)
|
||||
{
|
||||
if (g_d3d)
|
||||
@ -352,6 +433,8 @@ static void *xdk360_gfx_init(const video_info_t *video, const input_driver_t **i
|
||||
vid->d3d_render_device->CreateTexture(512, 512, 1, 0, D3DFMT_LIN_X1R5G5B5,
|
||||
0, &vid->lpTexture, NULL);
|
||||
|
||||
xdk360_convert_texture_to_as16_srgb(vid->lpTexture);
|
||||
|
||||
D3DLOCKED_RECT d3dlr;
|
||||
vid->lpTexture->LockRect(0, &d3dlr, NULL, D3DLOCK_NOSYSLOCK);
|
||||
memset(d3dlr.pBits, 0, 512 * d3dlr.Pitch);
|
||||
|
@ -87,7 +87,7 @@ void hlsl_set_proj_matrix(XMMATRIX rotation_value)
|
||||
#define set_param_2f(param, xy, constanttable) \
|
||||
if (param) constanttable->SetFloatArray(d3d_device_ptr, param, xy, 2)
|
||||
#define set_param_1f(param, x, constanttable) \
|
||||
constanttable->SetFloat(d3d_device_ptr, param, x)
|
||||
if (param) constanttable->SetFloat(d3d_device_ptr, param, x)
|
||||
|
||||
void hlsl_set_params(unsigned width, unsigned height,
|
||||
unsigned tex_width, unsigned tex_height,
|
||||
@ -237,27 +237,16 @@ static bool load_preset(const char *path)
|
||||
|
||||
static void set_program_attributes(unsigned i)
|
||||
{
|
||||
SSNES_LOG("Fragment: IN.video_size.\n");
|
||||
prg[i].vid_size_f = prg[i].f_ctable->GetConstantByName(NULL, "$IN.video_size");
|
||||
SSNES_LOG("Fragment: IN.texture_size.\n");
|
||||
prg[i].tex_size_f = prg[i].f_ctable->GetConstantByName(NULL, "$IN.texture_size");
|
||||
SSNES_LOG("Fragment: IN.output_size.\n");
|
||||
prg[i].out_size_f = prg[i].f_ctable->GetConstantByName(NULL, "$IN.output_size");
|
||||
SSNES_LOG("Fragment: IN.frame_count.\n");
|
||||
prg[i].frame_cnt_f = prg[i].f_ctable->GetConstantByName(NULL, "$IN.frame_count");
|
||||
SSNES_LOG("Fragment: IN.frame_direction.\n");
|
||||
prg[i].frame_dir_f = prg[i].f_ctable->GetConstantByName(NULL, "$IN.frame_direction");
|
||||
SSNES_LOG("Vertex: IN.video_size.\n");
|
||||
prg[i].vid_size_v = prg[i].v_ctable->GetConstantByName(NULL, "$IN.video_size");
|
||||
SSNES_LOG("Vertex: IN.texture_size.\n");
|
||||
prg[i].tex_size_v = prg[i].v_ctable->GetConstantByName(NULL, "$IN.texture_size");
|
||||
SSNES_LOG("Vertex: IN.output_size.\n");
|
||||
prg[i].out_size_v = prg[i].v_ctable->GetConstantByName(NULL, "$IN.output_size");
|
||||
SSNES_LOG("Vertex: IN.frame_count.\n");
|
||||
prg[i].frame_cnt_v = prg[i].v_ctable->GetConstantByName(NULL, "$IN.frame_count");
|
||||
SSNES_LOG("Vertex: IN.frame_direction.\n");
|
||||
prg[i].frame_dir_v = prg[i].v_ctable->GetConstantByName(NULL, "$IN.frame_direction");
|
||||
SSNES_LOG("Vertex: modelViewProj.\n");
|
||||
prg[i].mvp = prg[i].v_ctable->GetConstantByName(NULL, "$modelViewProj");
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user