diff --git a/src/render/direct3d/D3D9_PixelShader_Palette.h b/src/render/direct3d/D3D9_PixelShader_Palette.h new file mode 100755 index 0000000000..9bc727ee50 --- /dev/null +++ b/src/render/direct3d/D3D9_PixelShader_Palette.h @@ -0,0 +1,92 @@ +#if 0 +// +// Generated by Microsoft (R) HLSL Shader Compiler 10.1 +// +// Parameters: +// +// sampler2D image; +// sampler1D palette; +// +// +// Registers: +// +// Name Reg Size +// ------------ ----- ---- +// image s0 1 +// palette s1 1 +// + + ps_2_0 + def c0, 0.99609375, 0.001953125, 0, 0 + dcl t0.xy + dcl v0 + dcl_2d s0 + dcl_2d s1 + texld r0, t0, s0 + mad r0.xy, r0.x, c0.x, c0.y + texld r0, r0, s1 + mul r0, r0, v0 + mov oC0, r0 + +// approximately 5 instruction slots used (2 texture, 3 arithmetic) +#endif + +const BYTE g_ps20_main[] = +{ + 0, 2, 255, 255, 254, 255, + 42, 0, 67, 84, 65, 66, + 28, 0, 0, 0, 123, 0, + 0, 0, 0, 2, 255, 255, + 2, 0, 0, 0, 28, 0, + 0, 0, 0, 1, 0, 0, + 116, 0, 0, 0, 68, 0, + 0, 0, 3, 0, 0, 0, + 1, 0, 0, 0, 76, 0, + 0, 0, 0, 0, 0, 0, + 92, 0, 0, 0, 3, 0, + 1, 0, 1, 0, 0, 0, + 100, 0, 0, 0, 0, 0, + 0, 0, 105, 109, 97, 103, + 101, 0, 171, 171, 4, 0, + 12, 0, 1, 0, 1, 0, + 1, 0, 0, 0, 0, 0, + 0, 0, 112, 97, 108, 101, + 116, 116, 101, 0, 4, 0, + 11, 0, 1, 0, 1, 0, + 1, 0, 0, 0, 0, 0, + 0, 0, 112, 115, 95, 50, + 95, 48, 0, 77, 105, 99, + 114, 111, 115, 111, 102, 116, + 32, 40, 82, 41, 32, 72, + 76, 83, 76, 32, 83, 104, + 97, 100, 101, 114, 32, 67, + 111, 109, 112, 105, 108, 101, + 114, 32, 49, 48, 46, 49, + 0, 171, 81, 0, 0, 5, + 0, 0, 15, 160, 0, 0, + 127, 63, 0, 0, 0, 59, + 0, 0, 0, 0, 0, 0, + 0, 0, 31, 0, 0, 2, + 0, 0, 0, 128, 0, 0, + 3, 176, 31, 0, 0, 2, + 0, 0, 0, 128, 0, 0, + 15, 144, 31, 0, 0, 2, + 0, 0, 0, 144, 0, 8, + 15, 160, 31, 0, 0, 2, + 0, 0, 0, 144, 1, 8, + 15, 160, 66, 0, 0, 3, + 0, 0, 15, 128, 0, 0, + 228, 176, 0, 8, 228, 160, + 4, 0, 0, 4, 0, 0, + 3, 128, 0, 0, 0, 128, + 0, 0, 0, 160, 0, 0, + 85, 160, 66, 0, 0, 3, + 0, 0, 15, 128, 0, 0, + 228, 128, 1, 8, 228, 160, + 5, 0, 0, 3, 0, 0, + 15, 128, 0, 0, 228, 128, + 0, 0, 228, 144, 1, 0, + 0, 2, 0, 8, 15, 128, + 0, 0, 228, 128, 255, 255, + 0, 0 +}; diff --git a/src/render/direct3d/D3D9_PixelShader_Palette.hlsl b/src/render/direct3d/D3D9_PixelShader_Palette.hlsl new file mode 100644 index 0000000000..99dd4798d0 --- /dev/null +++ b/src/render/direct3d/D3D9_PixelShader_Palette.hlsl @@ -0,0 +1,19 @@ + +uniform sampler2D image; +uniform sampler1D palette; + +struct PixelShaderInput +{ + float4 pos : SV_POSITION; + float2 tex : TEXCOORD0; + float4 color : COLOR0; +}; + +float4 main(PixelShaderInput input) : SV_TARGET +{ + float4 Output; + float index; + index = tex2D(image, input.tex).r; + Output = tex1D(palette, index * (255. / 256) + (0.5 / 256)); + return Output * input.color; +} diff --git a/src/render/direct3d/D3D9_PixelShader_YUV.h b/src/render/direct3d/D3D9_PixelShader_YUV.h index e6d913009b..57a0a775e0 100644 --- a/src/render/direct3d/D3D9_PixelShader_YUV.h +++ b/src/render/direct3d/D3D9_PixelShader_YUV.h @@ -51,114 +51,114 @@ const BYTE g_ps20_main[] = { - 0, 2, 255, 255, 254, 255, - 97, 0, 67, 84, 65, 66, - 28, 0, 0, 0, 87, 1, - 0, 0, 0, 2, 255, 255, - 7, 0, 0, 0, 28, 0, - 0, 0, 0, 1, 0, 0, - 80, 1, 0, 0, 168, 0, - 0, 0, 2, 0, 3, 0, - 1, 0, 0, 0, 176, 0, - 0, 0, 0, 0, 0, 0, - 192, 0, 0, 0, 2, 0, - 2, 0, 1, 0, 0, 0, - 176, 0, 0, 0, 0, 0, - 0, 0, 199, 0, 0, 0, - 2, 0, 1, 0, 1, 0, - 0, 0, 176, 0, 0, 0, - 0, 0, 0, 0, 206, 0, - 0, 0, 2, 0, 0, 0, - 1, 0, 0, 0, 176, 0, - 0, 0, 0, 0, 0, 0, - 214, 0, 0, 0, 3, 0, - 1, 0, 1, 0, 0, 0, - 240, 0, 0, 0, 0, 0, - 0, 0, 0, 1, 0, 0, - 3, 0, 2, 0, 1, 0, - 0, 0, 24, 1, 0, 0, - 0, 0, 0, 0, 40, 1, - 0, 0, 3, 0, 0, 0, - 1, 0, 0, 0, 64, 1, - 0, 0, 0, 0, 0, 0, - 66, 99, 111, 101, 102, 102, - 0, 171, 1, 0, 3, 0, - 1, 0, 4, 0, 1, 0, - 0, 0, 0, 0, 0, 0, - 71, 99, 111, 101, 102, 102, - 0, 82, 99, 111, 101, 102, - 102, 0, 89, 111, 102, 102, - 115, 101, 116, 0, 116, 104, - 101, 83, 97, 109, 112, 108, - 101, 114, 43, 116, 104, 101, - 84, 101, 120, 116, 117, 114, - 101, 85, 0, 171, 171, 171, - 4, 0, 7, 0, 1, 0, - 4, 0, 1, 0, 0, 0, - 0, 0, 0, 0, 116, 104, - 101, 83, 97, 109, 112, 108, - 101, 114, 43, 116, 104, 101, - 84, 101, 120, 116, 117, 114, - 101, 86, 0, 171, 4, 0, - 7, 0, 1, 0, 4, 0, - 1, 0, 0, 0, 0, 0, - 0, 0, 116, 104, 101, 83, - 97, 109, 112, 108, 101, 114, - 43, 116, 104, 101, 84, 101, - 120, 116, 117, 114, 101, 89, - 0, 171, 4, 0, 7, 0, - 1, 0, 4, 0, 1, 0, - 0, 0, 0, 0, 0, 0, - 112, 115, 95, 50, 95, 48, - 0, 77, 105, 99, 114, 111, - 115, 111, 102, 116, 32, 40, - 82, 41, 32, 72, 76, 83, - 76, 32, 83, 104, 97, 100, - 101, 114, 32, 67, 111, 109, - 112, 105, 108, 101, 114, 32, - 49, 48, 46, 49, 0, 171, - 81, 0, 0, 5, 4, 0, - 15, 160, 0, 0, 128, 63, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 31, 0, 0, 2, 0, 0, - 0, 128, 0, 0, 3, 176, - 31, 0, 0, 2, 0, 0, - 0, 128, 0, 0, 15, 144, - 31, 0, 0, 2, 0, 0, - 0, 144, 0, 8, 15, 160, - 31, 0, 0, 2, 0, 0, - 0, 144, 1, 8, 15, 160, - 31, 0, 0, 2, 0, 0, - 0, 144, 2, 8, 15, 160, - 66, 0, 0, 3, 0, 0, - 15, 128, 0, 0, 228, 176, - 0, 8, 228, 160, 66, 0, - 0, 3, 1, 0, 15, 128, - 0, 0, 228, 176, 1, 8, - 228, 160, 66, 0, 0, 3, - 2, 0, 15, 128, 0, 0, - 228, 176, 2, 8, 228, 160, - 1, 0, 0, 2, 0, 0, - 2, 128, 1, 0, 0, 128, - 1, 0, 0, 2, 0, 0, - 4, 128, 2, 0, 0, 128, - 2, 0, 0, 3, 0, 0, - 7, 128, 0, 0, 228, 128, - 0, 0, 228, 160, 8, 0, - 0, 3, 1, 0, 1, 128, - 0, 0, 228, 128, 1, 0, - 228, 160, 8, 0, 0, 3, - 1, 0, 2, 128, 0, 0, - 228, 128, 2, 0, 228, 160, - 8, 0, 0, 3, 1, 0, - 4, 128, 0, 0, 228, 128, - 3, 0, 228, 160, 1, 0, - 0, 2, 1, 0, 8, 128, - 4, 0, 0, 160, 5, 0, - 0, 3, 0, 0, 15, 128, - 1, 0, 228, 128, 0, 0, - 228, 144, 1, 0, 0, 2, - 0, 8, 15, 128, 0, 0, + 0, 2, 255, 255, 254, 255, + 97, 0, 67, 84, 65, 66, + 28, 0, 0, 0, 87, 1, + 0, 0, 0, 2, 255, 255, + 7, 0, 0, 0, 28, 0, + 0, 0, 0, 1, 0, 0, + 80, 1, 0, 0, 168, 0, + 0, 0, 2, 0, 3, 0, + 1, 0, 0, 0, 176, 0, + 0, 0, 0, 0, 0, 0, + 192, 0, 0, 0, 2, 0, + 2, 0, 1, 0, 0, 0, + 176, 0, 0, 0, 0, 0, + 0, 0, 199, 0, 0, 0, + 2, 0, 1, 0, 1, 0, + 0, 0, 176, 0, 0, 0, + 0, 0, 0, 0, 206, 0, + 0, 0, 2, 0, 0, 0, + 1, 0, 0, 0, 176, 0, + 0, 0, 0, 0, 0, 0, + 214, 0, 0, 0, 3, 0, + 1, 0, 1, 0, 0, 0, + 240, 0, 0, 0, 0, 0, + 0, 0, 0, 1, 0, 0, + 3, 0, 2, 0, 1, 0, + 0, 0, 24, 1, 0, 0, + 0, 0, 0, 0, 40, 1, + 0, 0, 3, 0, 0, 0, + 1, 0, 0, 0, 64, 1, + 0, 0, 0, 0, 0, 0, + 66, 99, 111, 101, 102, 102, + 0, 171, 1, 0, 3, 0, + 1, 0, 4, 0, 1, 0, + 0, 0, 0, 0, 0, 0, + 71, 99, 111, 101, 102, 102, + 0, 82, 99, 111, 101, 102, + 102, 0, 89, 111, 102, 102, + 115, 101, 116, 0, 116, 104, + 101, 83, 97, 109, 112, 108, + 101, 114, 43, 116, 104, 101, + 84, 101, 120, 116, 117, 114, + 101, 85, 0, 171, 171, 171, + 4, 0, 7, 0, 1, 0, + 4, 0, 1, 0, 0, 0, + 0, 0, 0, 0, 116, 104, + 101, 83, 97, 109, 112, 108, + 101, 114, 43, 116, 104, 101, + 84, 101, 120, 116, 117, 114, + 101, 86, 0, 171, 4, 0, + 7, 0, 1, 0, 4, 0, + 1, 0, 0, 0, 0, 0, + 0, 0, 116, 104, 101, 83, + 97, 109, 112, 108, 101, 114, + 43, 116, 104, 101, 84, 101, + 120, 116, 117, 114, 101, 89, + 0, 171, 4, 0, 7, 0, + 1, 0, 4, 0, 1, 0, + 0, 0, 0, 0, 0, 0, + 112, 115, 95, 50, 95, 48, + 0, 77, 105, 99, 114, 111, + 115, 111, 102, 116, 32, 40, + 82, 41, 32, 72, 76, 83, + 76, 32, 83, 104, 97, 100, + 101, 114, 32, 67, 111, 109, + 112, 105, 108, 101, 114, 32, + 49, 48, 46, 49, 0, 171, + 81, 0, 0, 5, 4, 0, + 15, 160, 0, 0, 128, 63, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 31, 0, 0, 2, 0, 0, + 0, 128, 0, 0, 3, 176, + 31, 0, 0, 2, 0, 0, + 0, 128, 0, 0, 15, 144, + 31, 0, 0, 2, 0, 0, + 0, 144, 0, 8, 15, 160, + 31, 0, 0, 2, 0, 0, + 0, 144, 1, 8, 15, 160, + 31, 0, 0, 2, 0, 0, + 0, 144, 2, 8, 15, 160, + 66, 0, 0, 3, 0, 0, + 15, 128, 0, 0, 228, 176, + 0, 8, 228, 160, 66, 0, + 0, 3, 1, 0, 15, 128, + 0, 0, 228, 176, 1, 8, + 228, 160, 66, 0, 0, 3, + 2, 0, 15, 128, 0, 0, + 228, 176, 2, 8, 228, 160, + 1, 0, 0, 2, 0, 0, + 2, 128, 1, 0, 0, 128, + 1, 0, 0, 2, 0, 0, + 4, 128, 2, 0, 0, 128, + 2, 0, 0, 3, 0, 0, + 7, 128, 0, 0, 228, 128, + 0, 0, 228, 160, 8, 0, + 0, 3, 1, 0, 1, 128, + 0, 0, 228, 128, 1, 0, + 228, 160, 8, 0, 0, 3, + 1, 0, 2, 128, 0, 0, + 228, 128, 2, 0, 228, 160, + 8, 0, 0, 3, 1, 0, + 4, 128, 0, 0, 228, 128, + 3, 0, 228, 160, 1, 0, + 0, 2, 1, 0, 8, 128, + 4, 0, 0, 160, 5, 0, + 0, 3, 0, 0, 15, 128, + 1, 0, 228, 128, 0, 0, + 228, 144, 1, 0, 0, 2, + 0, 8, 15, 128, 0, 0, 228, 128, 255, 255, 0, 0 }; diff --git a/src/render/direct3d/SDL_render_d3d.c b/src/render/direct3d/SDL_render_d3d.c index 5132a23226..9131a59df0 100644 --- a/src/render/direct3d/SDL_render_d3d.c +++ b/src/render/direct3d/SDL_render_d3d.c @@ -90,6 +90,7 @@ typedef struct typedef struct { D3D_TextureRep texture; + D3D_TextureRep palette; D3D9_Shader shader; const float *shader_params; @@ -198,6 +199,7 @@ static D3DFORMAT PixelFormatToD3DFMT(Uint32 format) return D3DFMT_X8R8G8B8; case SDL_PIXELFORMAT_ARGB8888: return D3DFMT_A8R8G8B8; + case SDL_PIXELFORMAT_INDEX8: case SDL_PIXELFORMAT_YV12: case SDL_PIXELFORMAT_IYUV: case SDL_PIXELFORMAT_NV12: @@ -552,6 +554,13 @@ static bool D3D_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture, SDL_ if (!D3D_CreateTextureRep(data->device, &texturedata->texture, usage, texture->format, PixelFormatToD3DFMT(texture->format), texture->w, texture->h)) { return false; } + if (texture->format == SDL_PIXELFORMAT_INDEX8) { + if (!D3D_CreateTextureRep(data->device, &texturedata->palette, usage, SDL_PIXELFORMAT_ARGB8888, D3DFMT_A8R8G8B8, 256, 1)) { + return false; + } + + texturedata->shader = SHADER_PALETTE; + } #ifdef SDL_HAVE_YUV if (texture->format == SDL_PIXELFORMAT_YV12 || texture->format == SDL_PIXELFORMAT_IYUV) { @@ -587,6 +596,12 @@ static bool D3D_RecreateTexture(SDL_Renderer *renderer, SDL_Texture *texture) if (!D3D_RecreateTextureRep(data->device, &texturedata->texture)) { return false; } + if (texture->format == SDL_PIXELFORMAT_INDEX8) { + if (!D3D_RecreateTextureRep(data->device, &texturedata->palette)) { + return false; + } + texture->palette_version = 0; + } #ifdef SDL_HAVE_YUV if (texturedata->yuv) { if (!D3D_RecreateTextureRep(data->device, &texturedata->utexture)) { @@ -601,6 +616,24 @@ static bool D3D_RecreateTexture(SDL_Renderer *renderer, SDL_Texture *texture) return true; } +static bool D3D_UpdateTexturePalette(SDL_Renderer *renderer, SDL_Texture *texture) +{ + D3D_RenderData *data = (D3D_RenderData *)renderer->internal; + D3D_TextureData *texturedata = (D3D_TextureData *)texture->internal; + const int ncolors = texture->palette->ncolors; + const SDL_Color *colors = texture->palette->colors; + Uint32 palette[256]; + + if (!texturedata) { + return SDL_SetError("Texture is not currently available"); + } + + for (int i = 0; i < ncolors; ++i) { + palette[i] = (colors[i].a << 24) | (colors[i].r << 16) | (colors[i].g << 8) | colors[i].b; + } + return D3D_UpdateTextureRep(data->device, &texturedata->palette, 0, 0, 256, 1, palette, sizeof(palette)); +} + static bool D3D_UpdateTexture(SDL_Renderer *renderer, SDL_Texture *texture, const SDL_Rect *rect, const void *pixels, int pitch) { @@ -980,6 +1013,11 @@ static bool SetupTextureState(D3D_RenderData *data, SDL_Texture *texture, D3D9_S if (!BindTextureRep(data->device, &texturedata->texture, 0)) { return false; } + if (texture->format == SDL_PIXELFORMAT_INDEX8) { + if (!BindTextureRep(data->device, &texturedata->palette, 1)) { + return false; + } + } #ifdef SDL_HAVE_YUV if (texturedata->yuv) { if (!BindTextureRep(data->device, &texturedata->utexture, 1)) { @@ -999,10 +1037,8 @@ static bool SetDrawState(D3D_RenderData *data, const SDL_RenderCommand *cmd) const SDL_BlendMode blend = cmd->data.draw.blend; if (texture != data->drawstate.texture) { -#ifdef SDL_HAVE_YUV D3D_TextureData *oldtexturedata = data->drawstate.texture ? (D3D_TextureData *)data->drawstate.texture->internal : NULL; D3D_TextureData *newtexturedata = texture ? (D3D_TextureData *)texture->internal : NULL; -#endif D3D9_Shader shader = SHADER_NONE; const float *shader_params = NULL; @@ -1010,6 +1046,10 @@ static bool SetDrawState(D3D_RenderData *data, const SDL_RenderCommand *cmd) if (!texture) { IDirect3DDevice9_SetTexture(data->device, 0, NULL); } + if ((!newtexturedata || (texture->format != SDL_PIXELFORMAT_INDEX8)) && + (oldtexturedata && (data->drawstate.texture->format == SDL_PIXELFORMAT_INDEX8))) { + IDirect3DDevice9_SetTexture(data->device, 1, NULL); + } #ifdef SDL_HAVE_YUV if ((!newtexturedata || !newtexturedata->yuv) && (oldtexturedata && oldtexturedata->yuv)) { IDirect3DDevice9_SetTexture(data->device, 1, NULL); @@ -1046,6 +1086,9 @@ static bool SetDrawState(D3D_RenderData *data, const SDL_RenderCommand *cmd) D3D_TextureData *texturedata = (D3D_TextureData *)texture->internal; if (texturedata) { UpdateDirtyTexture(data->device, &texturedata->texture); + if (texture->format == SDL_PIXELFORMAT_INDEX8) { + UpdateDirtyTexture(data->device, &texturedata->palette); + } #ifdef SDL_HAVE_YUV if (texturedata->yuv) { UpdateDirtyTexture(data->device, &texturedata->utexture); @@ -1445,8 +1488,11 @@ static void D3D_DestroyTexture(SDL_Renderer *renderer, SDL_Texture *texture) renderdata->drawstate.shader_params = NULL; IDirect3DDevice9_SetPixelShader(renderdata->device, NULL); IDirect3DDevice9_SetTexture(renderdata->device, 0, NULL); + if (texture->format == SDL_PIXELFORMAT_INDEX8) { + IDirect3DDevice9_SetTexture(renderdata->device, 1, NULL); + } #ifdef SDL_HAVE_YUV - if (data->yuv) { + if (data && data->yuv) { IDirect3DDevice9_SetTexture(renderdata->device, 1, NULL); IDirect3DDevice9_SetTexture(renderdata->device, 2, NULL); } @@ -1483,14 +1529,12 @@ static void D3D_DestroyRenderer(SDL_Renderer *renderer) IDirect3DSurface9_Release(data->currentRenderTarget); data->currentRenderTarget = NULL; } -#ifdef SDL_HAVE_YUV for (i = 0; i < SDL_arraysize(data->shaders); ++i) { if (data->shaders[i]) { IDirect3DPixelShader9_Release(data->shaders[i]); data->shaders[i] = NULL; } } -#endif // Release all vertex buffers for (i = 0; i < SDL_arraysize(data->vertexBuffers); ++i) { if (data->vertexBuffers[i]) { @@ -1668,6 +1712,7 @@ static bool D3D_CreateRenderer(SDL_Renderer *renderer, SDL_Window *window, SDL_P renderer->WindowEvent = D3D_WindowEvent; renderer->SupportsBlendMode = D3D_SupportsBlendMode; renderer->CreateTexture = D3D_CreateTexture; + renderer->UpdateTexturePalette = D3D_UpdateTexturePalette; renderer->UpdateTexture = D3D_UpdateTexture; #ifdef SDL_HAVE_YUV renderer->UpdateTextureYUV = D3D_UpdateTextureYUV; @@ -1771,19 +1816,19 @@ static bool D3D_CreateRenderer(SDL_Renderer *renderer, SDL_Window *window, SDL_P // Set up parameters for rendering D3D_InitRenderState(data); + for (int i = SHADER_NONE + 1; i < SDL_arraysize(data->shaders); ++i) { + result = D3D9_CreatePixelShader(data->device, (D3D9_Shader)i, &data->shaders[i]); + if (FAILED(result)) { + D3D_SetError("CreatePixelShader()", result); + } + } + if (caps.MaxSimultaneousTextures >= 2 && data->shaders[SHADER_PALETTE]) { + SDL_AddSupportedTextureFormat(renderer, SDL_PIXELFORMAT_INDEX8); + } #ifdef SDL_HAVE_YUV - if (caps.MaxSimultaneousTextures >= 3) { - int i; - for (i = SHADER_NONE + 1; i < SDL_arraysize(data->shaders); ++i) { - result = D3D9_CreatePixelShader(data->device, (D3D9_Shader)i, &data->shaders[i]); - if (FAILED(result)) { - D3D_SetError("CreatePixelShader()", result); - } - } - if (data->shaders[SHADER_YUV]) { - SDL_AddSupportedTextureFormat(renderer, SDL_PIXELFORMAT_YV12); - SDL_AddSupportedTextureFormat(renderer, SDL_PIXELFORMAT_IYUV); - } + if (caps.MaxSimultaneousTextures >= 3 && data->shaders[SHADER_YUV]) { + SDL_AddSupportedTextureFormat(renderer, SDL_PIXELFORMAT_YV12); + SDL_AddSupportedTextureFormat(renderer, SDL_PIXELFORMAT_IYUV); } #endif diff --git a/src/render/direct3d/SDL_shaders_d3d.c b/src/render/direct3d/SDL_shaders_d3d.c index 9b1b4b5124..ffbf4df915 100644 --- a/src/render/direct3d/SDL_shaders_d3d.c +++ b/src/render/direct3d/SDL_shaders_d3d.c @@ -30,12 +30,17 @@ // The shaders here were compiled with compile_shaders.bat +#define g_ps20_main D3D9_PixelShader_Palette +#include "D3D9_PixelShader_Palette.h" +#undef g_ps20_main + #define g_ps20_main D3D9_PixelShader_YUV #include "D3D9_PixelShader_YUV.h" #undef g_ps20_main static const BYTE *D3D9_shaders[] = { NULL, + D3D9_PixelShader_Palette, D3D9_PixelShader_YUV }; SDL_COMPILE_TIME_ASSERT(D3D9_shaders, SDL_arraysize(D3D9_shaders) == NUM_SHADERS); diff --git a/src/render/direct3d/SDL_shaders_d3d.h b/src/render/direct3d/SDL_shaders_d3d.h index 90ef7a9b10..491b24a5d1 100644 --- a/src/render/direct3d/SDL_shaders_d3d.h +++ b/src/render/direct3d/SDL_shaders_d3d.h @@ -25,6 +25,7 @@ typedef enum { SHADER_NONE, + SHADER_PALETTE, SHADER_YUV, NUM_SHADERS } D3D9_Shader; diff --git a/src/render/direct3d/compile_shaders.bat b/src/render/direct3d/compile_shaders.bat index 81d513e2cc..c8b8e183a3 100644 --- a/src/render/direct3d/compile_shaders.bat +++ b/src/render/direct3d/compile_shaders.bat @@ -1 +1,2 @@ +fxc /T ps_2_0 /Fh D3D9_PixelShader_Palette.h D3D9_PixelShader_Palette.hlsl fxc /T ps_2_0 /Fh D3D9_PixelShader_YUV.h D3D9_PixelShader_YUV.hlsl diff --git a/src/render/direct3d11/D3D11_PixelShader_Advanced.h b/src/render/direct3d11/D3D11_PixelShader_Advanced.h index 59c90ae6e5..fd341709d3 100644 --- a/src/render/direct3d11/D3D11_PixelShader_Advanced.h +++ b/src/render/direct3d11/D3D11_PixelShader_Advanced.h @@ -30,6 +30,7 @@ // Name Type Format Dim HLSL Bind Count // ------------------------------ ---------- ------- ----------- -------------- ------ // sampler0 sampler NA NA s0 1 +// sampler1 sampler NA NA s1 1 // texture0 texture float4 2d t0 1 // texture1 texture float4 2d t1 1 // texture2 texture float4 2d t2 1 @@ -56,6 +57,7 @@ ps_5_0 dcl_globalFlags refactoringAllowed dcl_constantbuffer CB0[7], immediateIndexed dcl_sampler s0, mode_default +dcl_sampler s1, mode_default dcl_resource_texture2d (float,float,float,float) t0 dcl_resource_texture2d (float,float,float,float) t1 dcl_resource_texture2d (float,float,float,float) t2 @@ -97,37 +99,75 @@ else else eq r0.x, cb0[0].y, l(3.000000) if_nz r0.x - sample_indexable(texture2d)(float,float,float,float) r2.x, v1.xyxx, t0.xyzw, s0 - sample_indexable(texture2d)(float,float,float,float) r2.yz, v1.xyxx, t1.zxyw, s0 - add r2.xyz, r2.xyzx, cb0[3].xyzx - dp3 r1.x, r2.xyzx, cb0[4].xyzx - dp3 r1.y, r2.xyzx, cb0[5].xyzx - dp3 r1.z, r2.xyzx, cb0[6].xyzx + sample_indexable(texture2d)(float,float,float,float) r0.x, v1.xyxx, t0.xyzw, s0 + mad r0.x, r0.x, l(255.000000), l(0.500000) + mul r2.x, r0.x, l(0.003906) + mov r2.y, l(0.500000) + sample_indexable(texture2d)(float,float,float,float) r1.xyzw, r2.xyxx, t1.xyzw, s1 else eq r0.x, cb0[0].y, l(4.000000) if_nz r0.x - sample_indexable(texture2d)(float,float,float,float) r2.x, v1.xyxx, t0.xyzw, s0 - sample_indexable(texture2d)(float,float,float,float) r2.yz, v1.xyxx, t1.zyxw, s0 - add r2.xyz, r2.xyzx, cb0[3].xyzx - dp3 r1.x, r2.xyzx, cb0[4].xyzx - dp3 r1.y, r2.xyzx, cb0[5].xyzx - dp3 r1.z, r2.xyzx, cb0[6].xyzx + deriv_rtx_coarse r2.xy, v1.xyxx + deriv_rty_coarse r2.zw, v1.xxxy + add r2.xy, |r2.zwzz|, |r2.xyxx| + mul r2.xy, r2.xyxx, cb0[1].zwzz + max r2.xy, r2.xyxx, l(0.000010, 0.000010, 0.000000, 0.000000) + min r2.xy, r2.xyxx, l(1.000000, 1.000000, 0.000000, 0.000000) + mul r2.zw, r2.xxxy, l(0.000000, 0.000000, 0.500000, 0.500000) + mad r2.zw, v1.xxxy, cb0[1].zzzw, -r2.zzzw + add r2.xy, -r2.xyxx, l(1.000000, 1.000000, 0.000000, 0.000000) + frc r3.xy, r2.zwzz + add r3.zw, -r2.xxxy, l(0.000000, 0.000000, 1.000000, 1.000000) + add r2.xy, -r2.xyxx, r3.xyxx + div r3.xy, l(1.000000, 1.000000, 1.000000, 1.000000), r3.zwzz + mul_sat r2.xy, r2.xyxx, r3.xyxx + mad r3.xy, r2.xyxx, l(-2.000000, -2.000000, 0.000000, 0.000000), l(3.000000, 3.000000, 0.000000, 0.000000) + mul r2.xy, r2.xyxx, r2.xyxx + round_ni r2.zw, r2.zzzw + mad r2.xy, r3.xyxx, r2.xyxx, r2.zwzz + add r2.xy, r2.xyxx, l(0.500000, 0.500000, 0.000000, 0.000000) + mul r2.xy, r2.xyxx, cb0[1].xyxx + sample_indexable(texture2d)(float,float,float,float) r0.x, r2.xyxx, t0.xyzw, s0 + mad r0.x, r0.x, l(255.000000), l(0.500000) + mul r2.x, r0.x, l(0.003906) + mov r2.y, l(0.500000) + sample_indexable(texture2d)(float,float,float,float) r1.xyzw, r2.xyxx, t1.xyzw, s1 else eq r0.x, cb0[0].y, l(5.000000) if_nz r0.x sample_indexable(texture2d)(float,float,float,float) r2.x, v1.xyxx, t0.xyzw, s0 - sample_indexable(texture2d)(float,float,float,float) r2.y, v1.xyxx, t1.yxzw, s0 - sample_indexable(texture2d)(float,float,float,float) r2.z, v1.xyxx, t2.yzxw, s0 + sample_indexable(texture2d)(float,float,float,float) r2.yz, v1.xyxx, t1.zxyw, s0 add r2.xyz, r2.xyzx, cb0[3].xyzx dp3 r1.x, r2.xyzx, cb0[4].xyzx dp3 r1.y, r2.xyzx, cb0[5].xyzx dp3 r1.z, r2.xyzx, cb0[6].xyzx else - mov r1.xyz, l(1.000000,0,0,0) + eq r0.x, cb0[0].y, l(6.000000) + if_nz r0.x + sample_indexable(texture2d)(float,float,float,float) r2.x, v1.xyxx, t0.xyzw, s0 + sample_indexable(texture2d)(float,float,float,float) r2.yz, v1.xyxx, t1.zyxw, s0 + add r2.xyz, r2.xyzx, cb0[3].xyzx + dp3 r1.x, r2.xyzx, cb0[4].xyzx + dp3 r1.y, r2.xyzx, cb0[5].xyzx + dp3 r1.z, r2.xyzx, cb0[6].xyzx + else + eq r0.x, cb0[0].y, l(7.000000) + if_nz r0.x + sample_indexable(texture2d)(float,float,float,float) r2.x, v1.xyxx, t0.xyzw, s0 + sample_indexable(texture2d)(float,float,float,float) r2.y, v1.xyxx, t1.yxzw, s0 + sample_indexable(texture2d)(float,float,float,float) r2.z, v1.xyxx, t2.yzxw, s0 + add r2.xyz, r2.xyzx, cb0[3].xyzx + dp3 r1.x, r2.xyzx, cb0[4].xyzx + dp3 r1.y, r2.xyzx, cb0[5].xyzx + dp3 r1.z, r2.xyzx, cb0[6].xyzx + else + mov r1.xyz, l(1.000000,0,0,0) + endif + endif endif + mov r1.w, l(1.000000) endif endif - mov r1.w, l(1.000000) endif endif endif @@ -214,425 +254,623 @@ else endif mul o0.xyzw, r1.xyzw, v2.xyzw ret -// Approximately 151 instruction slots used +// Approximately 189 instruction slots used #endif const BYTE g_main[] = { - 68, 88, 66, 67, 211, 185, - 112, 94, 11, 90, 193, 206, - 105, 12, 109, 71, 22, 113, - 149, 88, 1, 0, 0, 0, - 152, 23, 0, 0, 5, 0, + 68, 88, 66, 67, 88, 116, + 7, 122, 42, 169, 234, 130, + 66, 194, 60, 135, 128, 124, + 142, 123, 1, 0, 0, 0, + 68, 28, 0, 0, 5, 0, 0, 0, 52, 0, 0, 0, - 128, 4, 0, 0, 244, 4, - 0, 0, 40, 5, 0, 0, - 252, 22, 0, 0, 82, 68, - 69, 70, 68, 4, 0, 0, - 1, 0, 0, 0, 12, 1, - 0, 0, 5, 0, 0, 0, + 168, 4, 0, 0, 28, 5, + 0, 0, 80, 5, 0, 0, + 168, 27, 0, 0, 82, 68, + 69, 70, 108, 4, 0, 0, + 1, 0, 0, 0, 52, 1, + 0, 0, 6, 0, 0, 0, 60, 0, 0, 0, 0, 5, 255, 255, 0, 1, 0, 0, - 28, 4, 0, 0, 82, 68, + 68, 4, 0, 0, 82, 68, 49, 49, 60, 0, 0, 0, 24, 0, 0, 0, 32, 0, 0, 0, 40, 0, 0, 0, 36, 0, 0, 0, 12, 0, 0, 0, 0, 0, 0, 0, - 220, 0, 0, 0, 3, 0, + 252, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, - 0, 0, 229, 0, 0, 0, - 2, 0, 0, 0, 5, 0, - 0, 0, 4, 0, 0, 0, - 255, 255, 255, 255, 0, 0, + 0, 0, 5, 1, 0, 0, + 3, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, - 13, 0, 0, 0, 238, 0, + 1, 0, 0, 0, 14, 1, 0, 0, 2, 0, 0, 0, 5, 0, 0, 0, 4, 0, 0, 0, 255, 255, 255, 255, - 1, 0, 0, 0, 1, 0, + 0, 0, 0, 0, 1, 0, 0, 0, 13, 0, 0, 0, - 247, 0, 0, 0, 2, 0, + 23, 1, 0, 0, 2, 0, 0, 0, 5, 0, 0, 0, 4, 0, 0, 0, 255, 255, - 255, 255, 2, 0, 0, 0, + 255, 255, 1, 0, 0, 0, 1, 0, 0, 0, 13, 0, - 0, 0, 0, 1, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, + 0, 0, 32, 1, 0, 0, + 2, 0, 0, 0, 5, 0, + 0, 0, 4, 0, 0, 0, + 255, 255, 255, 255, 2, 0, 0, 0, 1, 0, 0, 0, - 1, 0, 0, 0, 115, 97, - 109, 112, 108, 101, 114, 48, - 0, 116, 101, 120, 116, 117, - 114, 101, 48, 0, 116, 101, - 120, 116, 117, 114, 101, 49, - 0, 116, 101, 120, 116, 117, - 114, 101, 50, 0, 67, 111, - 110, 115, 116, 97, 110, 116, - 115, 0, 171, 171, 0, 1, - 0, 0, 13, 0, 0, 0, - 36, 1, 0, 0, 112, 0, + 13, 0, 0, 0, 41, 1, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 44, 3, 0, 0, 0, 0, 0, 0, - 4, 0, 0, 0, 2, 0, - 0, 0, 64, 3, 0, 0, - 0, 0, 0, 0, 255, 255, - 255, 255, 0, 0, 0, 0, - 255, 255, 255, 255, 0, 0, - 0, 0, 100, 3, 0, 0, - 4, 0, 0, 0, 4, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 1, 0, + 0, 0, 1, 0, 0, 0, + 115, 97, 109, 112, 108, 101, + 114, 48, 0, 115, 97, 109, + 112, 108, 101, 114, 49, 0, + 116, 101, 120, 116, 117, 114, + 101, 48, 0, 116, 101, 120, + 116, 117, 114, 101, 49, 0, + 116, 101, 120, 116, 117, 114, + 101, 50, 0, 67, 111, 110, + 115, 116, 97, 110, 116, 115, + 0, 171, 41, 1, 0, 0, + 13, 0, 0, 0, 76, 1, + 0, 0, 112, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 84, 3, 0, 0, + 0, 0, 0, 0, 4, 0, 0, 0, 2, 0, 0, 0, - 64, 3, 0, 0, 0, 0, + 104, 3, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 0, 0, 0, 0, 255, 255, 255, 255, 0, 0, 0, 0, - 113, 3, 0, 0, 8, 0, + 140, 3, 0, 0, 4, 0, 0, 0, 4, 0, 0, 0, - 2, 0, 0, 0, 64, 3, + 2, 0, 0, 0, 104, 3, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 0, 0, 0, 0, 255, 255, 255, 255, - 0, 0, 0, 0, 124, 3, - 0, 0, 12, 0, 0, 0, + 0, 0, 0, 0, 153, 3, + 0, 0, 8, 0, 0, 0, 4, 0, 0, 0, 2, 0, - 0, 0, 64, 3, 0, 0, + 0, 0, 104, 3, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 0, 0, 0, 0, 255, 255, 255, 255, 0, 0, - 0, 0, 136, 3, 0, 0, - 16, 0, 0, 0, 16, 0, + 0, 0, 164, 3, 0, 0, + 12, 0, 0, 0, 4, 0, 0, 0, 2, 0, 0, 0, - 156, 3, 0, 0, 0, 0, + 104, 3, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 0, 0, 0, 0, 255, 255, 255, 255, 0, 0, 0, 0, - 192, 3, 0, 0, 32, 0, - 0, 0, 4, 0, 0, 0, - 2, 0, 0, 0, 64, 3, - 0, 0, 0, 0, 0, 0, - 255, 255, 255, 255, 0, 0, - 0, 0, 255, 255, 255, 255, - 0, 0, 0, 0, 207, 3, - 0, 0, 36, 0, 0, 0, - 4, 0, 0, 0, 2, 0, - 0, 0, 64, 3, 0, 0, - 0, 0, 0, 0, 255, 255, - 255, 255, 0, 0, 0, 0, - 255, 255, 255, 255, 0, 0, - 0, 0, 223, 3, 0, 0, - 40, 0, 0, 0, 4, 0, - 0, 0, 2, 0, 0, 0, - 64, 3, 0, 0, 0, 0, - 0, 0, 255, 255, 255, 255, - 0, 0, 0, 0, 255, 255, - 255, 255, 0, 0, 0, 0, - 239, 3, 0, 0, 44, 0, - 0, 0, 4, 0, 0, 0, - 2, 0, 0, 0, 64, 3, - 0, 0, 0, 0, 0, 0, - 255, 255, 255, 255, 0, 0, - 0, 0, 255, 255, 255, 255, - 0, 0, 0, 0, 255, 3, - 0, 0, 48, 0, 0, 0, - 16, 0, 0, 0, 2, 0, - 0, 0, 156, 3, 0, 0, - 0, 0, 0, 0, 255, 255, - 255, 255, 0, 0, 0, 0, - 255, 255, 255, 255, 0, 0, - 0, 0, 7, 4, 0, 0, - 64, 0, 0, 0, 16, 0, - 0, 0, 2, 0, 0, 0, - 156, 3, 0, 0, 0, 0, - 0, 0, 255, 255, 255, 255, - 0, 0, 0, 0, 255, 255, - 255, 255, 0, 0, 0, 0, - 14, 4, 0, 0, 80, 0, + 176, 3, 0, 0, 16, 0, 0, 0, 16, 0, 0, 0, - 2, 0, 0, 0, 156, 3, + 2, 0, 0, 0, 196, 3, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 0, 0, 0, 0, 255, 255, 255, 255, - 0, 0, 0, 0, 21, 4, - 0, 0, 96, 0, 0, 0, - 16, 0, 0, 0, 2, 0, - 0, 0, 156, 3, 0, 0, + 0, 0, 0, 0, 232, 3, + 0, 0, 32, 0, 0, 0, + 4, 0, 0, 0, 2, 0, + 0, 0, 104, 3, 0, 0, 0, 0, 0, 0, 255, 255, 255, 255, 0, 0, 0, 0, 255, 255, 255, 255, 0, 0, - 0, 0, 115, 99, 82, 71, - 66, 95, 111, 117, 116, 112, - 117, 116, 0, 102, 108, 111, - 97, 116, 0, 171, 0, 0, - 3, 0, 1, 0, 1, 0, + 0, 0, 247, 3, 0, 0, + 36, 0, 0, 0, 4, 0, + 0, 0, 2, 0, 0, 0, + 104, 3, 0, 0, 0, 0, + 0, 0, 255, 255, 255, 255, + 0, 0, 0, 0, 255, 255, + 255, 255, 0, 0, 0, 0, + 7, 4, 0, 0, 40, 0, + 0, 0, 4, 0, 0, 0, + 2, 0, 0, 0, 104, 3, + 0, 0, 0, 0, 0, 0, + 255, 255, 255, 255, 0, 0, + 0, 0, 255, 255, 255, 255, + 0, 0, 0, 0, 23, 4, + 0, 0, 44, 0, 0, 0, + 4, 0, 0, 0, 2, 0, + 0, 0, 104, 3, 0, 0, + 0, 0, 0, 0, 255, 255, + 255, 255, 0, 0, 0, 0, + 255, 255, 255, 255, 0, 0, + 0, 0, 39, 4, 0, 0, + 48, 0, 0, 0, 16, 0, + 0, 0, 2, 0, 0, 0, + 196, 3, 0, 0, 0, 0, + 0, 0, 255, 255, 255, 255, + 0, 0, 0, 0, 255, 255, + 255, 255, 0, 0, 0, 0, + 47, 4, 0, 0, 64, 0, + 0, 0, 16, 0, 0, 0, + 2, 0, 0, 0, 196, 3, + 0, 0, 0, 0, 0, 0, + 255, 255, 255, 255, 0, 0, + 0, 0, 255, 255, 255, 255, + 0, 0, 0, 0, 54, 4, + 0, 0, 80, 0, 0, 0, + 16, 0, 0, 0, 2, 0, + 0, 0, 196, 3, 0, 0, + 0, 0, 0, 0, 255, 255, + 255, 255, 0, 0, 0, 0, + 255, 255, 255, 255, 0, 0, + 0, 0, 61, 4, 0, 0, + 96, 0, 0, 0, 16, 0, + 0, 0, 2, 0, 0, 0, + 196, 3, 0, 0, 0, 0, + 0, 0, 255, 255, 255, 255, + 0, 0, 0, 0, 255, 255, + 255, 255, 0, 0, 0, 0, + 115, 99, 82, 71, 66, 95, + 111, 117, 116, 112, 117, 116, + 0, 102, 108, 111, 97, 116, + 0, 171, 0, 0, 3, 0, + 1, 0, 1, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 97, 3, + 0, 0, 116, 101, 120, 116, + 117, 114, 101, 95, 116, 121, + 112, 101, 0, 105, 110, 112, + 117, 116, 95, 116, 121, 112, + 101, 0, 99, 111, 108, 111, + 114, 95, 115, 99, 97, 108, + 101, 0, 116, 101, 120, 101, + 108, 95, 115, 105, 122, 101, + 0, 102, 108, 111, 97, 116, + 52, 0, 171, 171, 1, 0, + 3, 0, 1, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 57, 3, 0, 0, 116, 101, - 120, 116, 117, 114, 101, 95, - 116, 121, 112, 101, 0, 105, - 110, 112, 117, 116, 95, 116, - 121, 112, 101, 0, 99, 111, - 108, 111, 114, 95, 115, 99, - 97, 108, 101, 0, 116, 101, - 120, 101, 108, 95, 115, 105, - 122, 101, 0, 102, 108, 111, - 97, 116, 52, 0, 171, 171, - 1, 0, 3, 0, 1, 0, - 4, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 147, 3, 0, 0, - 116, 111, 110, 101, 109, 97, - 112, 95, 109, 101, 116, 104, - 111, 100, 0, 116, 111, 110, - 101, 109, 97, 112, 95, 102, - 97, 99, 116, 111, 114, 49, + 187, 3, 0, 0, 116, 111, + 110, 101, 109, 97, 112, 95, + 109, 101, 116, 104, 111, 100, 0, 116, 111, 110, 101, 109, 97, 112, 95, 102, 97, 99, - 116, 111, 114, 50, 0, 115, - 100, 114, 95, 119, 104, 105, - 116, 101, 95, 112, 111, 105, - 110, 116, 0, 89, 111, 102, - 102, 115, 101, 116, 0, 82, + 116, 111, 114, 49, 0, 116, + 111, 110, 101, 109, 97, 112, + 95, 102, 97, 99, 116, 111, + 114, 50, 0, 115, 100, 114, + 95, 119, 104, 105, 116, 101, + 95, 112, 111, 105, 110, 116, + 0, 89, 111, 102, 102, 115, + 101, 116, 0, 82, 99, 111, + 101, 102, 102, 0, 71, 99, + 111, 101, 102, 102, 0, 66, 99, 111, 101, 102, 102, 0, - 71, 99, 111, 101, 102, 102, - 0, 66, 99, 111, 101, 102, - 102, 0, 77, 105, 99, 114, - 111, 115, 111, 102, 116, 32, - 40, 82, 41, 32, 72, 76, - 83, 76, 32, 83, 104, 97, - 100, 101, 114, 32, 67, 111, - 109, 112, 105, 108, 101, 114, - 32, 49, 48, 46, 49, 0, - 73, 83, 71, 78, 108, 0, - 0, 0, 3, 0, 0, 0, - 8, 0, 0, 0, 80, 0, - 0, 0, 0, 0, 0, 0, - 1, 0, 0, 0, 3, 0, - 0, 0, 0, 0, 0, 0, - 15, 0, 0, 0, 92, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 3, 0, - 0, 0, 1, 0, 0, 0, - 3, 3, 0, 0, 101, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 3, 0, - 0, 0, 2, 0, 0, 0, - 15, 15, 0, 0, 83, 86, - 95, 80, 79, 83, 73, 84, - 73, 79, 78, 0, 84, 69, - 88, 67, 79, 79, 82, 68, - 0, 67, 79, 76, 79, 82, - 0, 171, 79, 83, 71, 78, - 44, 0, 0, 0, 1, 0, - 0, 0, 8, 0, 0, 0, - 32, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 3, 0, 0, 0, 0, 0, - 0, 0, 15, 0, 0, 0, - 83, 86, 95, 84, 65, 82, - 71, 69, 84, 0, 171, 171, - 83, 72, 69, 88, 204, 17, + 77, 105, 99, 114, 111, 115, + 111, 102, 116, 32, 40, 82, + 41, 32, 72, 76, 83, 76, + 32, 83, 104, 97, 100, 101, + 114, 32, 67, 111, 109, 112, + 105, 108, 101, 114, 32, 49, + 48, 46, 49, 0, 73, 83, + 71, 78, 108, 0, 0, 0, + 3, 0, 0, 0, 8, 0, 0, 0, 80, 0, 0, 0, - 115, 4, 0, 0, 106, 8, - 0, 1, 89, 0, 0, 4, - 70, 142, 32, 0, 0, 0, - 0, 0, 7, 0, 0, 0, - 90, 0, 0, 3, 0, 96, - 16, 0, 0, 0, 0, 0, - 88, 24, 0, 4, 0, 112, - 16, 0, 0, 0, 0, 0, - 85, 85, 0, 0, 88, 24, + 0, 0, 0, 0, 1, 0, + 0, 0, 3, 0, 0, 0, + 0, 0, 0, 0, 15, 0, + 0, 0, 92, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 3, 0, 0, 0, + 1, 0, 0, 0, 3, 3, + 0, 0, 101, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 3, 0, 0, 0, + 2, 0, 0, 0, 15, 15, + 0, 0, 83, 86, 95, 80, + 79, 83, 73, 84, 73, 79, + 78, 0, 84, 69, 88, 67, + 79, 79, 82, 68, 0, 67, + 79, 76, 79, 82, 0, 171, + 79, 83, 71, 78, 44, 0, + 0, 0, 1, 0, 0, 0, + 8, 0, 0, 0, 32, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 3, 0, + 0, 0, 0, 0, 0, 0, + 15, 0, 0, 0, 83, 86, + 95, 84, 65, 82, 71, 69, + 84, 0, 171, 171, 83, 72, + 69, 88, 80, 22, 0, 0, + 80, 0, 0, 0, 148, 5, + 0, 0, 106, 8, 0, 1, + 89, 0, 0, 4, 70, 142, + 32, 0, 0, 0, 0, 0, + 7, 0, 0, 0, 90, 0, + 0, 3, 0, 96, 16, 0, + 0, 0, 0, 0, 90, 0, + 0, 3, 0, 96, 16, 0, + 1, 0, 0, 0, 88, 24, 0, 4, 0, 112, 16, 0, - 1, 0, 0, 0, 85, 85, + 0, 0, 0, 0, 85, 85, 0, 0, 88, 24, 0, 4, - 0, 112, 16, 0, 2, 0, + 0, 112, 16, 0, 1, 0, 0, 0, 85, 85, 0, 0, - 98, 16, 0, 3, 50, 16, - 16, 0, 1, 0, 0, 0, - 98, 16, 0, 3, 242, 16, + 88, 24, 0, 4, 0, 112, 16, 0, 2, 0, 0, 0, - 101, 0, 0, 3, 242, 32, + 85, 85, 0, 0, 98, 16, + 0, 3, 50, 16, 16, 0, + 1, 0, 0, 0, 98, 16, + 0, 3, 242, 16, 16, 0, + 2, 0, 0, 0, 101, 0, + 0, 3, 242, 32, 16, 0, + 0, 0, 0, 0, 104, 0, + 0, 2, 7, 0, 0, 0, + 24, 0, 0, 11, 242, 0, 16, 0, 0, 0, 0, 0, - 104, 0, 0, 2, 7, 0, - 0, 0, 24, 0, 0, 11, - 242, 0, 16, 0, 0, 0, - 0, 0, 150, 138, 32, 0, + 150, 138, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 2, 64, 0, 0, 0, 0, + 0, 0, 0, 0, 64, 64, + 0, 0, 0, 64, 0, 0, + 128, 63, 31, 0, 4, 3, + 10, 0, 16, 0, 0, 0, + 0, 0, 54, 0, 0, 8, + 242, 0, 16, 0, 1, 0, 0, 0, 2, 64, 0, 0, - 0, 0, 0, 0, 0, 0, - 64, 64, 0, 0, 0, 64, - 0, 0, 128, 63, 31, 0, - 4, 3, 10, 0, 16, 0, - 0, 0, 0, 0, 54, 0, - 0, 8, 242, 0, 16, 0, - 1, 0, 0, 0, 2, 64, - 0, 0, 0, 0, 128, 63, 0, 0, 128, 63, 0, 0, 128, 63, 0, 0, 128, 63, + 0, 0, 128, 63, 18, 0, + 0, 1, 24, 0, 0, 8, + 18, 0, 16, 0, 0, 0, + 0, 0, 26, 128, 32, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 1, 64, 0, 0, + 0, 0, 128, 63, 31, 0, + 4, 3, 10, 0, 16, 0, + 0, 0, 0, 0, 69, 0, + 0, 139, 194, 0, 0, 128, + 67, 85, 21, 0, 242, 0, + 16, 0, 1, 0, 0, 0, + 70, 16, 16, 0, 1, 0, + 0, 0, 70, 126, 16, 0, + 0, 0, 0, 0, 0, 96, + 16, 0, 0, 0, 0, 0, 18, 0, 0, 1, 24, 0, 0, 8, 18, 0, 16, 0, 0, 0, 0, 0, 26, 128, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 64, + 0, 0, 0, 0, 0, 64, + 31, 0, 4, 3, 10, 0, + 16, 0, 0, 0, 0, 0, + 122, 0, 0, 5, 50, 0, + 16, 0, 2, 0, 0, 0, + 70, 16, 16, 0, 1, 0, + 0, 0, 124, 0, 0, 5, + 194, 0, 16, 0, 2, 0, + 0, 0, 6, 20, 16, 0, + 1, 0, 0, 0, 0, 0, + 0, 9, 50, 0, 16, 0, + 3, 0, 0, 0, 230, 10, + 16, 128, 129, 0, 0, 0, + 2, 0, 0, 0, 70, 0, + 16, 128, 129, 0, 0, 0, + 2, 0, 0, 0, 56, 0, + 0, 8, 50, 0, 16, 0, + 3, 0, 0, 0, 70, 0, + 16, 0, 3, 0, 0, 0, + 230, 138, 32, 0, 0, 0, + 0, 0, 1, 0, 0, 0, + 52, 0, 0, 10, 50, 0, + 16, 0, 3, 0, 0, 0, + 70, 0, 16, 0, 3, 0, + 0, 0, 2, 64, 0, 0, + 172, 197, 39, 55, 172, 197, + 39, 55, 0, 0, 0, 0, + 0, 0, 0, 0, 51, 0, + 0, 10, 50, 0, 16, 0, + 3, 0, 0, 0, 70, 0, + 16, 0, 3, 0, 0, 0, + 2, 64, 0, 0, 0, 0, + 128, 63, 0, 0, 128, 63, + 0, 0, 0, 0, 0, 0, + 0, 0, 56, 0, 0, 10, + 194, 0, 16, 0, 3, 0, + 0, 0, 6, 4, 16, 0, + 3, 0, 0, 0, 2, 64, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 63, 0, 0, 0, 63, + 50, 0, 0, 11, 194, 0, + 16, 0, 3, 0, 0, 0, + 6, 20, 16, 0, 1, 0, + 0, 0, 166, 142, 32, 0, + 0, 0, 0, 0, 1, 0, + 0, 0, 166, 14, 16, 128, + 65, 0, 0, 0, 3, 0, + 0, 0, 0, 0, 0, 11, + 50, 0, 16, 0, 3, 0, + 0, 0, 70, 0, 16, 128, + 65, 0, 0, 0, 3, 0, + 0, 0, 2, 64, 0, 0, + 0, 0, 128, 63, 0, 0, + 128, 63, 0, 0, 0, 0, + 0, 0, 0, 0, 26, 0, + 0, 5, 50, 0, 16, 0, + 4, 0, 0, 0, 230, 10, + 16, 0, 3, 0, 0, 0, + 0, 0, 0, 11, 194, 0, + 16, 0, 4, 0, 0, 0, + 6, 4, 16, 128, 65, 0, + 0, 0, 3, 0, 0, 0, + 2, 64, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 128, 63, 0, 0, + 128, 63, 0, 0, 0, 8, + 50, 0, 16, 0, 3, 0, + 0, 0, 70, 0, 16, 128, + 65, 0, 0, 0, 3, 0, + 0, 0, 70, 0, 16, 0, + 4, 0, 0, 0, 14, 0, + 0, 10, 50, 0, 16, 0, + 4, 0, 0, 0, 2, 64, 0, 0, 0, 0, 128, 63, + 0, 0, 128, 63, 0, 0, + 128, 63, 0, 0, 128, 63, + 230, 10, 16, 0, 4, 0, + 0, 0, 56, 32, 0, 7, + 50, 0, 16, 0, 3, 0, + 0, 0, 70, 0, 16, 0, + 3, 0, 0, 0, 70, 0, + 16, 0, 4, 0, 0, 0, + 50, 0, 0, 15, 50, 0, + 16, 0, 4, 0, 0, 0, + 70, 0, 16, 0, 3, 0, + 0, 0, 2, 64, 0, 0, + 0, 0, 0, 192, 0, 0, + 0, 192, 0, 0, 0, 0, + 0, 0, 0, 0, 2, 64, + 0, 0, 0, 0, 64, 64, + 0, 0, 64, 64, 0, 0, + 0, 0, 0, 0, 0, 0, + 56, 0, 0, 7, 50, 0, + 16, 0, 3, 0, 0, 0, + 70, 0, 16, 0, 3, 0, + 0, 0, 70, 0, 16, 0, + 3, 0, 0, 0, 65, 0, + 0, 5, 194, 0, 16, 0, + 3, 0, 0, 0, 166, 14, + 16, 0, 3, 0, 0, 0, + 50, 0, 0, 9, 50, 0, + 16, 0, 3, 0, 0, 0, + 70, 0, 16, 0, 4, 0, + 0, 0, 70, 0, 16, 0, + 3, 0, 0, 0, 230, 10, + 16, 0, 3, 0, 0, 0, + 0, 0, 0, 10, 50, 0, + 16, 0, 3, 0, 0, 0, + 70, 0, 16, 0, 3, 0, + 0, 0, 2, 64, 0, 0, + 0, 0, 0, 63, 0, 0, + 0, 63, 0, 0, 0, 0, + 0, 0, 0, 0, 56, 0, + 0, 8, 50, 0, 16, 0, + 3, 0, 0, 0, 70, 0, + 16, 0, 3, 0, 0, 0, + 70, 128, 32, 0, 0, 0, + 0, 0, 1, 0, 0, 0, + 73, 0, 0, 143, 194, 0, + 0, 128, 67, 85, 21, 0, + 242, 0, 16, 0, 1, 0, + 0, 0, 70, 0, 16, 0, + 3, 0, 0, 0, 70, 126, + 16, 0, 0, 0, 0, 0, + 0, 96, 16, 0, 0, 0, + 0, 0, 70, 0, 16, 0, + 2, 0, 0, 0, 230, 10, + 16, 0, 2, 0, 0, 0, + 18, 0, 0, 1, 24, 0, + 0, 8, 18, 0, 16, 0, + 0, 0, 0, 0, 26, 128, + 32, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 1, 64, + 0, 0, 0, 0, 64, 64, 31, 0, 4, 3, 10, 0, 16, 0, 0, 0, 0, 0, 69, 0, 0, 139, 194, 0, 0, 128, 67, 85, 21, 0, - 242, 0, 16, 0, 1, 0, + 18, 0, 16, 0, 0, 0, 0, 0, 70, 16, 16, 0, 1, 0, 0, 0, 70, 126, 16, 0, 0, 0, 0, 0, 0, 96, 16, 0, 0, 0, - 0, 0, 18, 0, 0, 1, - 24, 0, 0, 8, 18, 0, - 16, 0, 0, 0, 0, 0, - 26, 128, 32, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 1, 64, 0, 0, 0, 0, - 0, 64, 31, 0, 4, 3, - 10, 0, 16, 0, 0, 0, - 0, 0, 122, 0, 0, 5, - 50, 0, 16, 0, 2, 0, - 0, 0, 70, 16, 16, 0, - 1, 0, 0, 0, 124, 0, - 0, 5, 194, 0, 16, 0, - 2, 0, 0, 0, 6, 20, - 16, 0, 1, 0, 0, 0, - 0, 0, 0, 9, 50, 0, - 16, 0, 3, 0, 0, 0, - 230, 10, 16, 128, 129, 0, - 0, 0, 2, 0, 0, 0, - 70, 0, 16, 128, 129, 0, - 0, 0, 2, 0, 0, 0, - 56, 0, 0, 8, 50, 0, - 16, 0, 3, 0, 0, 0, - 70, 0, 16, 0, 3, 0, - 0, 0, 230, 138, 32, 0, - 0, 0, 0, 0, 1, 0, - 0, 0, 52, 0, 0, 10, - 50, 0, 16, 0, 3, 0, - 0, 0, 70, 0, 16, 0, - 3, 0, 0, 0, 2, 64, - 0, 0, 172, 197, 39, 55, - 172, 197, 39, 55, 0, 0, - 0, 0, 0, 0, 0, 0, - 51, 0, 0, 10, 50, 0, - 16, 0, 3, 0, 0, 0, - 70, 0, 16, 0, 3, 0, - 0, 0, 2, 64, 0, 0, - 0, 0, 128, 63, 0, 0, - 128, 63, 0, 0, 0, 0, - 0, 0, 0, 0, 56, 0, - 0, 10, 194, 0, 16, 0, - 3, 0, 0, 0, 6, 4, - 16, 0, 3, 0, 0, 0, - 2, 64, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 63, 0, 0, - 0, 63, 50, 0, 0, 11, - 194, 0, 16, 0, 3, 0, - 0, 0, 6, 20, 16, 0, - 1, 0, 0, 0, 166, 142, - 32, 0, 0, 0, 0, 0, - 1, 0, 0, 0, 166, 14, - 16, 128, 65, 0, 0, 0, - 3, 0, 0, 0, 0, 0, - 0, 11, 50, 0, 16, 0, - 3, 0, 0, 0, 70, 0, - 16, 128, 65, 0, 0, 0, - 3, 0, 0, 0, 2, 64, - 0, 0, 0, 0, 128, 63, - 0, 0, 128, 63, 0, 0, - 0, 0, 0, 0, 0, 0, - 26, 0, 0, 5, 50, 0, - 16, 0, 4, 0, 0, 0, - 230, 10, 16, 0, 3, 0, - 0, 0, 0, 0, 0, 11, - 194, 0, 16, 0, 4, 0, - 0, 0, 6, 4, 16, 128, - 65, 0, 0, 0, 3, 0, - 0, 0, 2, 64, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 128, 63, - 0, 0, 128, 63, 0, 0, - 0, 8, 50, 0, 16, 0, - 3, 0, 0, 0, 70, 0, - 16, 128, 65, 0, 0, 0, - 3, 0, 0, 0, 70, 0, - 16, 0, 4, 0, 0, 0, - 14, 0, 0, 10, 50, 0, - 16, 0, 4, 0, 0, 0, - 2, 64, 0, 0, 0, 0, - 128, 63, 0, 0, 128, 63, - 0, 0, 128, 63, 0, 0, - 128, 63, 230, 10, 16, 0, - 4, 0, 0, 0, 56, 32, - 0, 7, 50, 0, 16, 0, - 3, 0, 0, 0, 70, 0, - 16, 0, 3, 0, 0, 0, - 70, 0, 16, 0, 4, 0, - 0, 0, 50, 0, 0, 15, - 50, 0, 16, 0, 4, 0, - 0, 0, 70, 0, 16, 0, - 3, 0, 0, 0, 2, 64, - 0, 0, 0, 0, 0, 192, - 0, 0, 0, 192, 0, 0, - 0, 0, 0, 0, 0, 0, - 2, 64, 0, 0, 0, 0, - 64, 64, 0, 0, 64, 64, - 0, 0, 0, 0, 0, 0, - 0, 0, 56, 0, 0, 7, - 50, 0, 16, 0, 3, 0, - 0, 0, 70, 0, 16, 0, - 3, 0, 0, 0, 70, 0, - 16, 0, 3, 0, 0, 0, - 65, 0, 0, 5, 194, 0, - 16, 0, 3, 0, 0, 0, - 166, 14, 16, 0, 3, 0, 0, 0, 50, 0, 0, 9, - 50, 0, 16, 0, 3, 0, - 0, 0, 70, 0, 16, 0, - 4, 0, 0, 0, 70, 0, - 16, 0, 3, 0, 0, 0, - 230, 10, 16, 0, 3, 0, - 0, 0, 0, 0, 0, 10, - 50, 0, 16, 0, 3, 0, - 0, 0, 70, 0, 16, 0, - 3, 0, 0, 0, 2, 64, - 0, 0, 0, 0, 0, 63, - 0, 0, 0, 63, 0, 0, - 0, 0, 0, 0, 0, 0, - 56, 0, 0, 8, 50, 0, - 16, 0, 3, 0, 0, 0, - 70, 0, 16, 0, 3, 0, - 0, 0, 70, 128, 32, 0, - 0, 0, 0, 0, 1, 0, - 0, 0, 73, 0, 0, 143, + 18, 0, 16, 0, 0, 0, + 0, 0, 10, 0, 16, 0, + 0, 0, 0, 0, 1, 64, + 0, 0, 0, 0, 127, 67, + 1, 64, 0, 0, 0, 0, + 0, 63, 56, 0, 0, 7, + 18, 0, 16, 0, 2, 0, + 0, 0, 10, 0, 16, 0, + 0, 0, 0, 0, 1, 64, + 0, 0, 0, 0, 128, 59, + 54, 0, 0, 5, 34, 0, + 16, 0, 2, 0, 0, 0, + 1, 64, 0, 0, 0, 0, + 0, 63, 69, 0, 0, 139, 194, 0, 0, 128, 67, 85, 21, 0, 242, 0, 16, 0, 1, 0, 0, 0, 70, 0, - 16, 0, 3, 0, 0, 0, - 70, 126, 16, 0, 0, 0, - 0, 0, 0, 96, 16, 0, - 0, 0, 0, 0, 70, 0, 16, 0, 2, 0, 0, 0, - 230, 10, 16, 0, 2, 0, + 70, 126, 16, 0, 1, 0, + 0, 0, 0, 96, 16, 0, + 1, 0, 0, 0, 18, 0, + 0, 1, 24, 0, 0, 8, + 18, 0, 16, 0, 0, 0, + 0, 0, 26, 128, 32, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 1, 64, 0, 0, + 0, 0, 128, 64, 31, 0, + 4, 3, 10, 0, 16, 0, + 0, 0, 0, 0, 122, 0, + 0, 5, 50, 0, 16, 0, + 2, 0, 0, 0, 70, 16, + 16, 0, 1, 0, 0, 0, + 124, 0, 0, 5, 194, 0, + 16, 0, 2, 0, 0, 0, + 6, 20, 16, 0, 1, 0, + 0, 0, 0, 0, 0, 9, + 50, 0, 16, 0, 2, 0, + 0, 0, 230, 10, 16, 128, + 129, 0, 0, 0, 2, 0, + 0, 0, 70, 0, 16, 128, + 129, 0, 0, 0, 2, 0, + 0, 0, 56, 0, 0, 8, + 50, 0, 16, 0, 2, 0, + 0, 0, 70, 0, 16, 0, + 2, 0, 0, 0, 230, 138, + 32, 0, 0, 0, 0, 0, + 1, 0, 0, 0, 52, 0, + 0, 10, 50, 0, 16, 0, + 2, 0, 0, 0, 70, 0, + 16, 0, 2, 0, 0, 0, + 2, 64, 0, 0, 172, 197, + 39, 55, 172, 197, 39, 55, + 0, 0, 0, 0, 0, 0, + 0, 0, 51, 0, 0, 10, + 50, 0, 16, 0, 2, 0, + 0, 0, 70, 0, 16, 0, + 2, 0, 0, 0, 2, 64, + 0, 0, 0, 0, 128, 63, + 0, 0, 128, 63, 0, 0, + 0, 0, 0, 0, 0, 0, + 56, 0, 0, 10, 194, 0, + 16, 0, 2, 0, 0, 0, + 6, 4, 16, 0, 2, 0, + 0, 0, 2, 64, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 63, + 0, 0, 0, 63, 50, 0, + 0, 11, 194, 0, 16, 0, + 2, 0, 0, 0, 6, 20, + 16, 0, 1, 0, 0, 0, + 166, 142, 32, 0, 0, 0, + 0, 0, 1, 0, 0, 0, + 166, 14, 16, 128, 65, 0, + 0, 0, 2, 0, 0, 0, + 0, 0, 0, 11, 50, 0, + 16, 0, 2, 0, 0, 0, + 70, 0, 16, 128, 65, 0, + 0, 0, 2, 0, 0, 0, + 2, 64, 0, 0, 0, 0, + 128, 63, 0, 0, 128, 63, + 0, 0, 0, 0, 0, 0, + 0, 0, 26, 0, 0, 5, + 50, 0, 16, 0, 3, 0, + 0, 0, 230, 10, 16, 0, + 2, 0, 0, 0, 0, 0, + 0, 11, 194, 0, 16, 0, + 3, 0, 0, 0, 6, 4, + 16, 128, 65, 0, 0, 0, + 2, 0, 0, 0, 2, 64, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 128, 63, 0, 0, 128, 63, + 0, 0, 0, 8, 50, 0, + 16, 0, 2, 0, 0, 0, + 70, 0, 16, 128, 65, 0, + 0, 0, 2, 0, 0, 0, + 70, 0, 16, 0, 3, 0, + 0, 0, 14, 0, 0, 10, + 50, 0, 16, 0, 3, 0, + 0, 0, 2, 64, 0, 0, + 0, 0, 128, 63, 0, 0, + 128, 63, 0, 0, 128, 63, + 0, 0, 128, 63, 230, 10, + 16, 0, 3, 0, 0, 0, + 56, 32, 0, 7, 50, 0, + 16, 0, 2, 0, 0, 0, + 70, 0, 16, 0, 2, 0, + 0, 0, 70, 0, 16, 0, + 3, 0, 0, 0, 50, 0, + 0, 15, 50, 0, 16, 0, + 3, 0, 0, 0, 70, 0, + 16, 0, 2, 0, 0, 0, + 2, 64, 0, 0, 0, 0, + 0, 192, 0, 0, 0, 192, + 0, 0, 0, 0, 0, 0, + 0, 0, 2, 64, 0, 0, + 0, 0, 64, 64, 0, 0, + 64, 64, 0, 0, 0, 0, + 0, 0, 0, 0, 56, 0, + 0, 7, 50, 0, 16, 0, + 2, 0, 0, 0, 70, 0, + 16, 0, 2, 0, 0, 0, + 70, 0, 16, 0, 2, 0, + 0, 0, 65, 0, 0, 5, + 194, 0, 16, 0, 2, 0, + 0, 0, 166, 14, 16, 0, + 2, 0, 0, 0, 50, 0, + 0, 9, 50, 0, 16, 0, + 2, 0, 0, 0, 70, 0, + 16, 0, 3, 0, 0, 0, + 70, 0, 16, 0, 2, 0, + 0, 0, 230, 10, 16, 0, + 2, 0, 0, 0, 0, 0, + 0, 10, 50, 0, 16, 0, + 2, 0, 0, 0, 70, 0, + 16, 0, 2, 0, 0, 0, + 2, 64, 0, 0, 0, 0, + 0, 63, 0, 0, 0, 63, + 0, 0, 0, 0, 0, 0, + 0, 0, 56, 0, 0, 8, + 50, 0, 16, 0, 2, 0, + 0, 0, 70, 0, 16, 0, + 2, 0, 0, 0, 70, 128, + 32, 0, 0, 0, 0, 0, + 1, 0, 0, 0, 69, 0, + 0, 139, 194, 0, 0, 128, + 67, 85, 21, 0, 18, 0, + 16, 0, 0, 0, 0, 0, + 70, 0, 16, 0, 2, 0, + 0, 0, 70, 126, 16, 0, + 0, 0, 0, 0, 0, 96, + 16, 0, 0, 0, 0, 0, + 50, 0, 0, 9, 18, 0, + 16, 0, 0, 0, 0, 0, + 10, 0, 16, 0, 0, 0, + 0, 0, 1, 64, 0, 0, + 0, 0, 127, 67, 1, 64, + 0, 0, 0, 0, 0, 63, + 56, 0, 0, 7, 18, 0, + 16, 0, 2, 0, 0, 0, + 10, 0, 16, 0, 0, 0, + 0, 0, 1, 64, 0, 0, + 0, 0, 128, 59, 54, 0, + 0, 5, 34, 0, 16, 0, + 2, 0, 0, 0, 1, 64, + 0, 0, 0, 0, 0, 63, + 69, 0, 0, 139, 194, 0, + 0, 128, 67, 85, 21, 0, + 242, 0, 16, 0, 1, 0, + 0, 0, 70, 0, 16, 0, + 2, 0, 0, 0, 70, 126, + 16, 0, 1, 0, 0, 0, + 0, 96, 16, 0, 1, 0, 0, 0, 18, 0, 0, 1, 24, 0, 0, 8, 18, 0, 16, 0, 0, 0, 0, 0, 26, 128, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 64, 0, 0, 0, 0, - 64, 64, 31, 0, 4, 3, + 160, 64, 31, 0, 4, 3, 10, 0, 16, 0, 0, 0, 0, 0, 69, 0, 0, 139, 194, 0, 0, 128, 67, 85, @@ -676,7 +914,7 @@ const BYTE g_main[] = 26, 128, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 64, 0, 0, 0, 0, - 128, 64, 31, 0, 4, 3, + 192, 64, 31, 0, 4, 3, 10, 0, 16, 0, 0, 0, 0, 0, 69, 0, 0, 139, 194, 0, 0, 128, 67, 85, @@ -720,7 +958,7 @@ const BYTE g_main[] = 26, 128, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 64, 0, 0, 0, 0, - 160, 64, 31, 0, 4, 3, + 224, 64, 31, 0, 4, 3, 10, 0, 16, 0, 0, 0, 0, 0, 69, 0, 0, 139, 194, 0, 0, 128, 67, 85, @@ -779,358 +1017,278 @@ const BYTE g_main[] = 0, 0, 0, 0, 128, 63, 21, 0, 0, 1, 21, 0, 0, 1, 21, 0, 0, 1, + 21, 0, 0, 1, 21, 0, + 0, 1, 47, 0, 0, 6, + 114, 0, 16, 0, 2, 0, + 0, 0, 70, 2, 16, 128, + 129, 0, 0, 0, 1, 0, + 0, 0, 56, 0, 0, 10, + 114, 0, 16, 0, 2, 0, + 0, 0, 70, 2, 16, 0, + 2, 0, 0, 0, 2, 64, + 0, 0, 172, 205, 79, 60, + 172, 205, 79, 60, 172, 205, + 79, 60, 0, 0, 0, 0, + 25, 0, 0, 5, 114, 0, + 16, 0, 2, 0, 0, 0, + 70, 2, 16, 0, 2, 0, + 0, 0, 0, 0, 0, 10, + 114, 0, 16, 0, 3, 0, + 0, 0, 70, 2, 16, 0, + 2, 0, 0, 0, 2, 64, + 0, 0, 0, 0, 86, 191, + 0, 0, 86, 191, 0, 0, + 86, 191, 0, 0, 0, 0, + 52, 0, 0, 10, 114, 0, + 16, 0, 3, 0, 0, 0, + 70, 2, 16, 0, 3, 0, + 0, 0, 2, 64, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 50, 0, + 0, 16, 114, 0, 16, 0, + 2, 0, 0, 0, 70, 2, + 16, 128, 65, 0, 0, 0, + 2, 0, 0, 0, 2, 64, + 0, 0, 0, 128, 149, 65, + 0, 128, 149, 65, 0, 128, + 149, 65, 0, 0, 0, 0, + 2, 64, 0, 0, 0, 208, + 150, 65, 0, 208, 150, 65, + 0, 208, 150, 65, 0, 0, + 0, 0, 14, 0, 0, 7, + 114, 0, 16, 0, 2, 0, + 0, 0, 70, 2, 16, 0, + 3, 0, 0, 0, 70, 2, + 16, 0, 2, 0, 0, 0, 47, 0, 0, 6, 114, 0, 16, 0, 2, 0, 0, 0, 70, 2, 16, 128, 129, 0, - 0, 0, 1, 0, 0, 0, + 0, 0, 2, 0, 0, 0, 56, 0, 0, 10, 114, 0, 16, 0, 2, 0, 0, 0, 70, 2, 16, 0, 2, 0, 0, 0, 2, 64, 0, 0, - 172, 205, 79, 60, 172, 205, - 79, 60, 172, 205, 79, 60, + 107, 224, 200, 64, 107, 224, + 200, 64, 107, 224, 200, 64, 0, 0, 0, 0, 25, 0, 0, 5, 114, 0, 16, 0, 2, 0, 0, 0, 70, 2, 16, 0, 2, 0, 0, 0, - 0, 0, 0, 10, 114, 0, - 16, 0, 3, 0, 0, 0, + 56, 0, 0, 10, 114, 0, + 16, 0, 2, 0, 0, 0, 70, 2, 16, 0, 2, 0, 0, 0, 2, 64, 0, 0, - 0, 0, 86, 191, 0, 0, - 86, 191, 0, 0, 86, 191, - 0, 0, 0, 0, 52, 0, - 0, 10, 114, 0, 16, 0, - 3, 0, 0, 0, 70, 2, - 16, 0, 3, 0, 0, 0, - 2, 64, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 50, 0, 0, 16, - 114, 0, 16, 0, 2, 0, - 0, 0, 70, 2, 16, 128, - 65, 0, 0, 0, 2, 0, - 0, 0, 2, 64, 0, 0, - 0, 128, 149, 65, 0, 128, - 149, 65, 0, 128, 149, 65, - 0, 0, 0, 0, 2, 64, - 0, 0, 0, 208, 150, 65, - 0, 208, 150, 65, 0, 208, - 150, 65, 0, 0, 0, 0, - 14, 0, 0, 7, 114, 0, - 16, 0, 2, 0, 0, 0, - 70, 2, 16, 0, 3, 0, - 0, 0, 70, 2, 16, 0, - 2, 0, 0, 0, 47, 0, - 0, 6, 114, 0, 16, 0, - 2, 0, 0, 0, 70, 2, - 16, 128, 129, 0, 0, 0, - 2, 0, 0, 0, 56, 0, - 0, 10, 114, 0, 16, 0, - 2, 0, 0, 0, 70, 2, - 16, 0, 2, 0, 0, 0, - 2, 64, 0, 0, 107, 224, - 200, 64, 107, 224, 200, 64, - 107, 224, 200, 64, 0, 0, - 0, 0, 25, 0, 0, 5, - 114, 0, 16, 0, 2, 0, - 0, 0, 70, 2, 16, 0, - 2, 0, 0, 0, 56, 0, - 0, 10, 114, 0, 16, 0, - 2, 0, 0, 0, 70, 2, - 16, 0, 2, 0, 0, 0, - 2, 64, 0, 0, 0, 64, + 0, 64, 28, 70, 0, 64, 28, 70, 0, 64, 28, 70, - 0, 64, 28, 70, 0, 0, - 0, 0, 14, 0, 0, 8, - 114, 0, 16, 0, 2, 0, + 0, 0, 0, 0, 14, 0, + 0, 8, 114, 0, 16, 0, + 2, 0, 0, 0, 70, 2, + 16, 0, 2, 0, 0, 0, + 246, 143, 32, 0, 0, 0, + 0, 0, 2, 0, 0, 0, + 55, 0, 0, 9, 114, 0, + 16, 0, 2, 0, 0, 0, + 86, 5, 16, 0, 0, 0, 0, 0, 70, 2, 16, 0, - 2, 0, 0, 0, 246, 143, - 32, 0, 0, 0, 0, 0, - 2, 0, 0, 0, 55, 0, - 0, 9, 114, 0, 16, 0, - 2, 0, 0, 0, 86, 5, + 2, 0, 0, 0, 70, 2, + 16, 0, 1, 0, 0, 0, + 57, 0, 0, 8, 18, 0, 16, 0, 0, 0, 0, 0, - 70, 2, 16, 0, 2, 0, + 10, 128, 32, 0, 0, 0, + 0, 0, 2, 0, 0, 0, + 1, 64, 0, 0, 0, 0, + 0, 0, 56, 0, 0, 8, + 114, 0, 16, 0, 3, 0, 0, 0, 70, 2, 16, 0, - 1, 0, 0, 0, 57, 0, - 0, 8, 18, 0, 16, 0, - 0, 0, 0, 0, 10, 128, + 2, 0, 0, 0, 86, 133, 32, 0, 0, 0, 0, 0, - 2, 0, 0, 0, 1, 64, + 2, 0, 0, 0, 24, 0, + 0, 11, 50, 0, 16, 0, + 4, 0, 0, 0, 6, 128, + 32, 0, 0, 0, 0, 0, + 2, 0, 0, 0, 2, 64, + 0, 0, 0, 0, 128, 63, + 0, 0, 0, 64, 0, 0, 0, 0, 0, 0, 0, 0, - 56, 0, 0, 8, 114, 0, - 16, 0, 3, 0, 0, 0, - 70, 2, 16, 0, 2, 0, - 0, 0, 86, 133, 32, 0, - 0, 0, 0, 0, 2, 0, - 0, 0, 24, 0, 0, 11, - 50, 0, 16, 0, 4, 0, - 0, 0, 6, 128, 32, 0, - 0, 0, 0, 0, 2, 0, - 0, 0, 2, 64, 0, 0, - 0, 0, 128, 63, 0, 0, - 0, 64, 0, 0, 0, 0, - 0, 0, 0, 0, 16, 0, - 0, 10, 18, 0, 16, 0, + 16, 0, 0, 10, 18, 0, + 16, 0, 5, 0, 0, 0, + 2, 64, 0, 0, 140, 157, + 32, 63, 200, 151, 168, 62, + 249, 104, 49, 61, 0, 0, + 0, 0, 70, 2, 16, 0, + 2, 0, 0, 0, 16, 0, + 0, 10, 34, 0, 16, 0, 5, 0, 0, 0, 2, 64, - 0, 0, 140, 157, 32, 63, - 200, 151, 168, 62, 249, 104, - 49, 61, 0, 0, 0, 0, + 0, 0, 186, 130, 141, 61, + 10, 103, 107, 63, 175, 39, + 58, 60, 0, 0, 0, 0, 70, 2, 16, 0, 2, 0, 0, 0, 16, 0, 0, 10, - 34, 0, 16, 0, 5, 0, + 66, 0, 16, 0, 5, 0, 0, 0, 2, 64, 0, 0, - 186, 130, 141, 61, 10, 103, - 107, 63, 175, 39, 58, 60, + 107, 70, 134, 60, 41, 64, + 180, 61, 183, 69, 101, 63, 0, 0, 0, 0, 70, 2, 16, 0, 2, 0, 0, 0, - 16, 0, 0, 10, 66, 0, + 55, 0, 0, 9, 114, 0, 16, 0, 5, 0, 0, 0, - 2, 64, 0, 0, 107, 70, - 134, 60, 41, 64, 180, 61, - 183, 69, 101, 63, 0, 0, + 166, 10, 16, 0, 0, 0, 0, 0, 70, 2, 16, 0, - 2, 0, 0, 0, 55, 0, - 0, 9, 114, 0, 16, 0, - 5, 0, 0, 0, 166, 10, - 16, 0, 0, 0, 0, 0, - 70, 2, 16, 0, 5, 0, - 0, 0, 70, 2, 16, 0, - 2, 0, 0, 0, 52, 0, + 5, 0, 0, 0, 70, 2, + 16, 0, 2, 0, 0, 0, + 52, 0, 0, 7, 130, 0, + 16, 0, 2, 0, 0, 0, + 42, 0, 16, 0, 5, 0, + 0, 0, 26, 0, 16, 0, + 5, 0, 0, 0, 52, 0, + 0, 7, 130, 0, 16, 0, + 2, 0, 0, 0, 58, 0, + 16, 0, 2, 0, 0, 0, + 10, 0, 16, 0, 5, 0, + 0, 0, 49, 0, 0, 7, + 130, 0, 16, 0, 3, 0, + 0, 0, 1, 64, 0, 0, + 0, 0, 0, 0, 58, 0, + 16, 0, 2, 0, 0, 0, + 50, 0, 0, 13, 194, 0, + 16, 0, 4, 0, 0, 0, + 86, 137, 32, 0, 0, 0, + 0, 0, 2, 0, 0, 0, + 246, 15, 16, 0, 2, 0, + 0, 0, 2, 64, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 128, 63, + 0, 0, 128, 63, 14, 0, 0, 7, 130, 0, 16, 0, 2, 0, 0, 0, 42, 0, - 16, 0, 5, 0, 0, 0, - 26, 0, 16, 0, 5, 0, - 0, 0, 52, 0, 0, 7, - 130, 0, 16, 0, 2, 0, - 0, 0, 58, 0, 16, 0, - 2, 0, 0, 0, 10, 0, - 16, 0, 5, 0, 0, 0, - 49, 0, 0, 7, 130, 0, - 16, 0, 3, 0, 0, 0, - 1, 64, 0, 0, 0, 0, - 0, 0, 58, 0, 16, 0, - 2, 0, 0, 0, 50, 0, - 0, 13, 194, 0, 16, 0, - 4, 0, 0, 0, 86, 137, - 32, 0, 0, 0, 0, 0, - 2, 0, 0, 0, 246, 15, - 16, 0, 2, 0, 0, 0, - 2, 64, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 128, 63, 0, 0, - 128, 63, 14, 0, 0, 7, - 130, 0, 16, 0, 2, 0, - 0, 0, 42, 0, 16, 0, - 4, 0, 0, 0, 58, 0, 16, 0, 4, 0, 0, 0, - 56, 0, 0, 7, 114, 0, - 16, 0, 6, 0, 0, 0, - 246, 15, 16, 0, 2, 0, + 58, 0, 16, 0, 4, 0, + 0, 0, 56, 0, 0, 7, + 114, 0, 16, 0, 6, 0, + 0, 0, 246, 15, 16, 0, + 2, 0, 0, 0, 70, 2, + 16, 0, 5, 0, 0, 0, + 55, 0, 0, 9, 114, 0, + 16, 0, 5, 0, 0, 0, + 246, 15, 16, 0, 3, 0, 0, 0, 70, 2, 16, 0, - 5, 0, 0, 0, 55, 0, - 0, 9, 114, 0, 16, 0, - 5, 0, 0, 0, 246, 15, - 16, 0, 3, 0, 0, 0, - 70, 2, 16, 0, 6, 0, + 6, 0, 0, 0, 70, 2, + 16, 0, 5, 0, 0, 0, + 16, 0, 0, 10, 18, 0, + 16, 0, 6, 0, 0, 0, + 2, 64, 0, 0, 34, 139, + 212, 63, 160, 112, 22, 191, + 35, 45, 149, 189, 0, 0, 0, 0, 70, 2, 16, 0, 5, 0, 0, 0, 16, 0, - 0, 10, 18, 0, 16, 0, + 0, 10, 34, 0, 16, 0, 6, 0, 0, 0, 2, 64, - 0, 0, 34, 139, 212, 63, - 160, 112, 22, 191, 35, 45, - 149, 189, 0, 0, 0, 0, + 0, 0, 127, 18, 255, 189, + 180, 2, 145, 63, 13, 198, + 8, 188, 0, 0, 0, 0, 70, 2, 16, 0, 5, 0, 0, 0, 16, 0, 0, 10, - 34, 0, 16, 0, 6, 0, + 66, 0, 16, 0, 6, 0, 0, 0, 2, 64, 0, 0, - 127, 18, 255, 189, 180, 2, - 145, 63, 13, 198, 8, 188, + 179, 183, 148, 188, 205, 5, + 206, 189, 60, 51, 143, 63, 0, 0, 0, 0, 70, 2, 16, 0, 5, 0, 0, 0, - 16, 0, 0, 10, 66, 0, - 16, 0, 6, 0, 0, 0, - 2, 64, 0, 0, 179, 183, - 148, 188, 205, 5, 206, 189, - 60, 51, 143, 63, 0, 0, - 0, 0, 70, 2, 16, 0, - 5, 0, 0, 0, 55, 0, - 0, 9, 114, 0, 16, 0, - 5, 0, 0, 0, 166, 10, - 16, 0, 0, 0, 0, 0, - 70, 2, 16, 0, 6, 0, - 0, 0, 70, 2, 16, 0, - 5, 0, 0, 0, 55, 0, - 0, 9, 226, 0, 16, 0, - 4, 0, 0, 0, 86, 5, - 16, 0, 4, 0, 0, 0, - 6, 9, 16, 0, 5, 0, - 0, 0, 6, 9, 16, 0, - 2, 0, 0, 0, 55, 0, - 0, 9, 114, 0, 16, 0, - 3, 0, 0, 0, 6, 0, - 16, 0, 4, 0, 0, 0, - 70, 2, 16, 0, 3, 0, - 0, 0, 150, 7, 16, 0, - 4, 0, 0, 0, 55, 0, - 0, 9, 114, 0, 16, 0, - 2, 0, 0, 0, 6, 0, - 16, 0, 0, 0, 0, 0, - 70, 2, 16, 0, 3, 0, - 0, 0, 70, 2, 16, 0, - 2, 0, 0, 0, 31, 0, - 4, 3, 58, 0, 16, 0, - 0, 0, 0, 0, 57, 0, - 0, 11, 18, 0, 16, 0, - 0, 0, 0, 0, 2, 64, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 10, 128, 32, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 31, 0, 4, 3, 10, 0, - 16, 0, 0, 0, 0, 0, - 29, 0, 0, 10, 114, 0, - 16, 0, 3, 0, 0, 0, - 2, 64, 0, 0, 230, 174, - 37, 61, 230, 174, 37, 61, - 230, 174, 37, 61, 0, 0, - 0, 0, 70, 2, 16, 0, - 2, 0, 0, 0, 56, 0, - 0, 10, 114, 0, 16, 0, - 4, 0, 0, 0, 70, 2, - 16, 0, 2, 0, 0, 0, - 2, 64, 0, 0, 145, 131, - 158, 61, 145, 131, 158, 61, - 145, 131, 158, 61, 0, 0, - 0, 0, 0, 0, 0, 10, - 114, 0, 16, 0, 5, 0, - 0, 0, 70, 2, 16, 0, - 2, 0, 0, 0, 2, 64, - 0, 0, 174, 71, 97, 61, - 174, 71, 97, 61, 174, 71, - 97, 61, 0, 0, 0, 0, - 56, 0, 0, 11, 114, 0, + 55, 0, 0, 9, 114, 0, 16, 0, 5, 0, 0, 0, - 70, 2, 16, 128, 129, 0, - 0, 0, 5, 0, 0, 0, - 2, 64, 0, 0, 111, 167, - 114, 63, 111, 167, 114, 63, - 111, 167, 114, 63, 0, 0, - 0, 0, 47, 0, 0, 5, - 114, 0, 16, 0, 5, 0, + 166, 10, 16, 0, 0, 0, 0, 0, 70, 2, 16, 0, - 5, 0, 0, 0, 56, 0, + 6, 0, 0, 0, 70, 2, + 16, 0, 5, 0, 0, 0, + 55, 0, 0, 9, 226, 0, + 16, 0, 4, 0, 0, 0, + 86, 5, 16, 0, 4, 0, + 0, 0, 6, 9, 16, 0, + 5, 0, 0, 0, 6, 9, + 16, 0, 2, 0, 0, 0, + 55, 0, 0, 9, 114, 0, + 16, 0, 3, 0, 0, 0, + 6, 0, 16, 0, 4, 0, + 0, 0, 70, 2, 16, 0, + 3, 0, 0, 0, 150, 7, + 16, 0, 4, 0, 0, 0, + 55, 0, 0, 9, 114, 0, + 16, 0, 2, 0, 0, 0, + 6, 0, 16, 0, 0, 0, + 0, 0, 70, 2, 16, 0, + 3, 0, 0, 0, 70, 2, + 16, 0, 2, 0, 0, 0, + 31, 0, 4, 3, 58, 0, + 16, 0, 0, 0, 0, 0, + 57, 0, 0, 11, 18, 0, + 16, 0, 0, 0, 0, 0, + 2, 64, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 10, 128, 32, 0, + 0, 0, 0, 0, 0, 0, + 0, 0, 31, 0, 4, 3, + 10, 0, 16, 0, 0, 0, + 0, 0, 29, 0, 0, 10, + 114, 0, 16, 0, 3, 0, + 0, 0, 2, 64, 0, 0, + 230, 174, 37, 61, 230, 174, + 37, 61, 230, 174, 37, 61, + 0, 0, 0, 0, 70, 2, + 16, 0, 2, 0, 0, 0, + 56, 0, 0, 10, 114, 0, + 16, 0, 4, 0, 0, 0, + 70, 2, 16, 0, 2, 0, + 0, 0, 2, 64, 0, 0, + 145, 131, 158, 61, 145, 131, + 158, 61, 145, 131, 158, 61, + 0, 0, 0, 0, 0, 0, 0, 10, 114, 0, 16, 0, 5, 0, 0, 0, 70, 2, - 16, 0, 5, 0, 0, 0, - 2, 64, 0, 0, 154, 153, - 25, 64, 154, 153, 25, 64, - 154, 153, 25, 64, 0, 0, - 0, 0, 25, 0, 0, 5, - 114, 0, 16, 0, 5, 0, - 0, 0, 70, 2, 16, 0, - 5, 0, 0, 0, 55, 0, - 0, 9, 114, 0, 16, 0, - 2, 0, 0, 0, 70, 2, - 16, 0, 3, 0, 0, 0, - 70, 2, 16, 0, 4, 0, - 0, 0, 70, 2, 16, 0, - 5, 0, 0, 0, 21, 0, - 0, 1, 56, 0, 0, 8, - 114, 0, 16, 0, 1, 0, - 0, 0, 70, 2, 16, 0, - 2, 0, 0, 0, 246, 143, - 32, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 18, 0, - 0, 1, 31, 0, 4, 3, - 42, 0, 16, 0, 0, 0, - 0, 0, 56, 0, 0, 8, - 114, 0, 16, 0, 1, 0, - 0, 0, 70, 2, 16, 0, - 2, 0, 0, 0, 246, 143, - 32, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 57, 0, - 0, 11, 18, 0, 16, 0, - 0, 0, 0, 0, 2, 64, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 10, 128, 32, 0, 0, 0, - 0, 0, 0, 0, 0, 0, - 31, 0, 0, 3, 10, 0, - 16, 0, 0, 0, 0, 0, - 29, 0, 0, 10, 210, 0, - 16, 0, 0, 0, 0, 0, - 2, 64, 0, 0, 28, 46, - 77, 59, 0, 0, 0, 0, - 28, 46, 77, 59, 28, 46, - 77, 59, 6, 9, 16, 0, - 1, 0, 0, 0, 56, 0, - 0, 10, 114, 0, 16, 0, - 3, 0, 0, 0, 70, 2, - 16, 0, 1, 0, 0, 0, - 2, 64, 0, 0, 82, 184, - 78, 65, 82, 184, 78, 65, - 82, 184, 78, 65, 0, 0, - 0, 0, 47, 0, 0, 6, - 114, 0, 16, 0, 4, 0, - 0, 0, 70, 2, 16, 128, - 129, 0, 0, 0, 1, 0, - 0, 0, 56, 0, 0, 10, - 114, 0, 16, 0, 4, 0, - 0, 0, 70, 2, 16, 0, - 4, 0, 0, 0, 2, 64, - 0, 0, 85, 85, 213, 62, - 85, 85, 213, 62, 85, 85, - 213, 62, 0, 0, 0, 0, - 25, 0, 0, 5, 114, 0, - 16, 0, 4, 0, 0, 0, - 70, 2, 16, 0, 4, 0, - 0, 0, 50, 0, 0, 15, - 114, 0, 16, 0, 4, 0, - 0, 0, 70, 2, 16, 0, - 4, 0, 0, 0, 2, 64, - 0, 0, 61, 10, 135, 63, - 61, 10, 135, 63, 61, 10, - 135, 63, 0, 0, 0, 0, - 2, 64, 0, 0, 174, 71, - 97, 189, 174, 71, 97, 189, - 174, 71, 97, 189, 0, 0, - 0, 0, 55, 32, 0, 9, - 114, 0, 16, 0, 1, 0, - 0, 0, 134, 3, 16, 0, - 0, 0, 0, 0, 70, 2, - 16, 0, 3, 0, 0, 0, - 70, 2, 16, 0, 4, 0, - 0, 0, 21, 0, 0, 1, - 18, 0, 0, 1, 31, 0, - 4, 3, 26, 0, 16, 0, - 0, 0, 0, 0, 16, 0, - 0, 10, 18, 0, 16, 0, - 0, 0, 0, 0, 2, 64, - 0, 0, 34, 139, 212, 63, - 160, 112, 22, 191, 35, 45, - 149, 189, 0, 0, 0, 0, - 70, 2, 16, 0, 2, 0, - 0, 0, 16, 0, 0, 10, - 34, 0, 16, 0, 0, 0, - 0, 0, 2, 64, 0, 0, - 127, 18, 255, 189, 180, 2, - 145, 63, 13, 198, 8, 188, - 0, 0, 0, 0, 70, 2, 16, 0, 2, 0, 0, 0, - 16, 0, 0, 10, 66, 0, - 16, 0, 0, 0, 0, 0, - 2, 64, 0, 0, 179, 183, - 148, 188, 205, 5, 206, 189, - 60, 51, 143, 63, 0, 0, + 2, 64, 0, 0, 174, 71, + 97, 61, 174, 71, 97, 61, + 174, 71, 97, 61, 0, 0, + 0, 0, 56, 0, 0, 11, + 114, 0, 16, 0, 5, 0, + 0, 0, 70, 2, 16, 128, + 129, 0, 0, 0, 5, 0, + 0, 0, 2, 64, 0, 0, + 111, 167, 114, 63, 111, 167, + 114, 63, 111, 167, 114, 63, + 0, 0, 0, 0, 47, 0, + 0, 5, 114, 0, 16, 0, + 5, 0, 0, 0, 70, 2, + 16, 0, 5, 0, 0, 0, + 56, 0, 0, 10, 114, 0, + 16, 0, 5, 0, 0, 0, + 70, 2, 16, 0, 5, 0, + 0, 0, 2, 64, 0, 0, + 154, 153, 25, 64, 154, 153, + 25, 64, 154, 153, 25, 64, + 0, 0, 0, 0, 25, 0, + 0, 5, 114, 0, 16, 0, + 5, 0, 0, 0, 70, 2, + 16, 0, 5, 0, 0, 0, + 55, 0, 0, 9, 114, 0, + 16, 0, 2, 0, 0, 0, + 70, 2, 16, 0, 3, 0, 0, 0, 70, 2, 16, 0, - 2, 0, 0, 0, 56, 0, + 4, 0, 0, 0, 70, 2, + 16, 0, 5, 0, 0, 0, + 21, 0, 0, 1, 56, 0, 0, 8, 114, 0, 16, 0, 1, 0, 0, 0, 70, 2, - 16, 0, 0, 0, 0, 0, + 16, 0, 2, 0, 0, 0, + 246, 143, 32, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 18, 0, 0, 1, 31, 0, + 4, 3, 42, 0, 16, 0, + 0, 0, 0, 0, 56, 0, + 0, 8, 114, 0, 16, 0, + 1, 0, 0, 0, 70, 2, + 16, 0, 2, 0, 0, 0, 246, 143, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 57, 0, 0, 11, 18, 0, @@ -1143,11 +1301,11 @@ const BYTE g_main[] = 0, 0, 31, 0, 0, 3, 10, 0, 16, 0, 0, 0, 0, 0, 29, 0, 0, 10, - 114, 0, 16, 0, 0, 0, + 210, 0, 16, 0, 0, 0, 0, 0, 2, 64, 0, 0, - 28, 46, 77, 59, 28, 46, - 77, 59, 28, 46, 77, 59, - 0, 0, 0, 0, 70, 2, + 28, 46, 77, 59, 0, 0, + 0, 0, 28, 46, 77, 59, + 28, 46, 77, 59, 6, 9, 16, 0, 1, 0, 0, 0, 56, 0, 0, 10, 114, 0, 16, 0, 3, 0, 0, 0, @@ -1181,41 +1339,122 @@ const BYTE g_main[] = 97, 189, 174, 71, 97, 189, 0, 0, 0, 0, 55, 32, 0, 9, 114, 0, 16, 0, - 1, 0, 0, 0, 70, 2, + 1, 0, 0, 0, 134, 3, 16, 0, 0, 0, 0, 0, 70, 2, 16, 0, 3, 0, 0, 0, 70, 2, 16, 0, 4, 0, 0, 0, 21, 0, 0, 1, 18, 0, 0, 1, + 31, 0, 4, 3, 26, 0, + 16, 0, 0, 0, 0, 0, + 16, 0, 0, 10, 18, 0, + 16, 0, 0, 0, 0, 0, + 2, 64, 0, 0, 34, 139, + 212, 63, 160, 112, 22, 191, + 35, 45, 149, 189, 0, 0, + 0, 0, 70, 2, 16, 0, + 2, 0, 0, 0, 16, 0, + 0, 10, 34, 0, 16, 0, + 0, 0, 0, 0, 2, 64, + 0, 0, 127, 18, 255, 189, + 180, 2, 145, 63, 13, 198, + 8, 188, 0, 0, 0, 0, + 70, 2, 16, 0, 2, 0, + 0, 0, 16, 0, 0, 10, + 66, 0, 16, 0, 0, 0, + 0, 0, 2, 64, 0, 0, + 179, 183, 148, 188, 205, 5, + 206, 189, 60, 51, 143, 63, + 0, 0, 0, 0, 70, 2, + 16, 0, 2, 0, 0, 0, 56, 0, 0, 8, 114, 0, 16, 0, 1, 0, 0, 0, - 70, 2, 16, 0, 2, 0, + 70, 2, 16, 0, 0, 0, 0, 0, 246, 143, 32, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 21, 0, 0, 1, - 21, 0, 0, 1, 21, 0, - 0, 1, 56, 0, 0, 7, - 242, 32, 16, 0, 0, 0, - 0, 0, 70, 14, 16, 0, - 1, 0, 0, 0, 70, 30, - 16, 0, 2, 0, 0, 0, - 62, 0, 0, 1, 83, 84, - 65, 84, 148, 0, 0, 0, - 151, 0, 0, 0, 7, 0, + 0, 0, 57, 0, 0, 11, + 18, 0, 16, 0, 0, 0, + 0, 0, 2, 64, 0, 0, 0, 0, 0, 0, 0, 0, - 3, 0, 0, 0, 92, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 10, 0, - 0, 0, 12, 0, 0, 0, + 0, 0, 0, 0, 10, 128, + 32, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 31, 0, + 0, 3, 10, 0, 16, 0, + 0, 0, 0, 0, 29, 0, + 0, 10, 114, 0, 16, 0, + 0, 0, 0, 0, 2, 64, + 0, 0, 28, 46, 77, 59, + 28, 46, 77, 59, 28, 46, + 77, 59, 0, 0, 0, 0, + 70, 2, 16, 0, 1, 0, + 0, 0, 56, 0, 0, 10, + 114, 0, 16, 0, 3, 0, + 0, 0, 70, 2, 16, 0, + 1, 0, 0, 0, 2, 64, + 0, 0, 82, 184, 78, 65, + 82, 184, 78, 65, 82, 184, + 78, 65, 0, 0, 0, 0, + 47, 0, 0, 6, 114, 0, + 16, 0, 4, 0, 0, 0, + 70, 2, 16, 128, 129, 0, + 0, 0, 1, 0, 0, 0, + 56, 0, 0, 10, 114, 0, + 16, 0, 4, 0, 0, 0, + 70, 2, 16, 0, 4, 0, + 0, 0, 2, 64, 0, 0, + 85, 85, 213, 62, 85, 85, + 213, 62, 85, 85, 213, 62, + 0, 0, 0, 0, 25, 0, + 0, 5, 114, 0, 16, 0, + 4, 0, 0, 0, 70, 2, + 16, 0, 4, 0, 0, 0, + 50, 0, 0, 15, 114, 0, + 16, 0, 4, 0, 0, 0, + 70, 2, 16, 0, 4, 0, + 0, 0, 2, 64, 0, 0, + 61, 10, 135, 63, 61, 10, + 135, 63, 61, 10, 135, 63, + 0, 0, 0, 0, 2, 64, + 0, 0, 174, 71, 97, 189, + 174, 71, 97, 189, 174, 71, + 97, 189, 0, 0, 0, 0, + 55, 32, 0, 9, 114, 0, + 16, 0, 1, 0, 0, 0, + 70, 2, 16, 0, 0, 0, + 0, 0, 70, 2, 16, 0, + 3, 0, 0, 0, 70, 2, + 16, 0, 4, 0, 0, 0, + 21, 0, 0, 1, 18, 0, + 0, 1, 56, 0, 0, 8, + 114, 0, 16, 0, 1, 0, + 0, 0, 70, 2, 16, 0, + 2, 0, 0, 0, 246, 143, + 32, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 21, 0, + 0, 1, 21, 0, 0, 1, + 21, 0, 0, 1, 56, 0, + 0, 7, 242, 32, 16, 0, + 0, 0, 0, 0, 70, 14, + 16, 0, 1, 0, 0, 0, + 70, 30, 16, 0, 2, 0, + 0, 0, 62, 0, 0, 1, + 83, 84, 65, 84, 148, 0, + 0, 0, 189, 0, 0, 0, + 7, 0, 0, 0, 0, 0, + 0, 0, 3, 0, 0, 0, + 118, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, + 12, 0, 0, 0, 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 8, 0, 0, 0, + 0, 0, 0, 0, 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 1, 0, 0, 0, 3, 0, - 0, 0, 10, 0, 0, 0, - 5, 0, 0, 0, 0, 0, + 0, 0, 1, 0, 0, 0, + 5, 0, 0, 0, 10, 0, + 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -1225,5 +1464,5 @@ const BYTE g_main[] = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0 + 0, 0, 0, 0, 0, 0 }; diff --git a/src/render/direct3d11/D3D11_PixelShader_Common.hlsli b/src/render/direct3d11/D3D11_PixelShader_Common.hlsli index b47a5e12bd..c2b20f6b8f 100644 --- a/src/render/direct3d11/D3D11_PixelShader_Common.hlsli +++ b/src/render/direct3d11/D3D11_PixelShader_Common.hlsli @@ -3,6 +3,7 @@ Texture2D texture0 : register(t0); Texture2D texture1 : register(t1); Texture2D texture2 : register(t2); SamplerState sampler0 : register(s0); +SamplerState sampler1 : register(s1); struct PixelShaderInput { @@ -19,9 +20,11 @@ static const float TONEMAP_CHROME = 2; static const float TEXTURETYPE_NONE = 0; static const float TEXTURETYPE_RGB = 1; static const float TEXTURETYPE_RGB_PIXELART = 2; -static const float TEXTURETYPE_NV12 = 3; -static const float TEXTURETYPE_NV21 = 4; -static const float TEXTURETYPE_YUV = 5; +static const float TEXTURETYPE_PALETTE = 3; +static const float TEXTURETYPE_PALETTE_PIXELART = 4; +static const float TEXTURETYPE_NV12 = 5; +static const float TEXTURETYPE_NV21 = 6; +static const float TEXTURETYPE_YUV = 7; static const float INPUTTYPE_UNSPECIFIED = 0; static const float INPUTTYPE_SRGB = 1; @@ -116,6 +119,23 @@ float3 ApplyTonemap(float3 v) return v; } +float2 GetPixelArtUV(PixelShaderInput input) +{ + // box filter size in texel units + float2 boxSize = clamp(fwidth(input.tex) * texel_size.zw, 1e-5, 1); + + // scale uv by texture size to get texel coordinate + float2 tx = input.tex * texel_size.zw - 0.5 * boxSize; + + // compute offset for pixel-sized box filter + float2 txOffset = smoothstep(1 - boxSize, 1, frac(tx)); + + // compute bilinear sample uv coordinates + float2 uv = (floor(tx) + 0.5 + txOffset) * texel_size.xy; + + return uv; +} + float4 GetInputColor(PixelShaderInput input) { float4 rgba; @@ -125,20 +145,15 @@ float4 GetInputColor(PixelShaderInput input) } else if (texture_type == TEXTURETYPE_RGB) { rgba = texture0.Sample(sampler0, input.tex); } else if (texture_type == TEXTURETYPE_RGB_PIXELART) { - // box filter size in texel units - float2 boxSize = clamp(fwidth(input.tex) * texel_size.zw, 1e-5, 1); - - // scale uv by texture size to get texel coordinate - float2 tx = input.tex * texel_size.zw - 0.5 * boxSize; - - // compute offset for pixel-sized box filter - float2 txOffset = smoothstep(1 - boxSize, 1, frac(tx)); - - // compute bilinear sample uv coordinates - float2 uv = (floor(tx) + 0.5 + txOffset) * texel_size.xy; - - // sample the texture + float2 uv = GetPixelArtUV(input); rgba = texture0.SampleGrad(sampler0, uv, ddx(input.tex), ddy(input.tex)); + } else if (texture_type == TEXTURETYPE_PALETTE) { + float index = texture0.Sample(sampler0, input.tex).r * 255; + rgba = texture1.Sample(sampler1, float2((index + 0.5) / 256, 0.5)); + } else if (texture_type == TEXTURETYPE_PALETTE_PIXELART) { + float2 uv = GetPixelArtUV(input); + float index = texture0.Sample(sampler0, uv).r * 255; + rgba = texture1.Sample(sampler1, float2((index + 0.5) / 256, 0.5)); } else if (texture_type == TEXTURETYPE_NV12) { float3 yuv; yuv.x = texture0.Sample(sampler0, input.tex).r; diff --git a/src/render/direct3d11/SDL_render_d3d11.c b/src/render/direct3d11/SDL_render_d3d11.c index 9902873aed..94c7c0fdeb 100644 --- a/src/render/direct3d11/SDL_render_d3d11.c +++ b/src/render/direct3d11/SDL_render_d3d11.c @@ -69,9 +69,11 @@ static const float TONEMAP_CHROME = 2; //static const float TEXTURETYPE_NONE = 0; static const float TEXTURETYPE_RGB = 1; static const float TEXTURETYPE_RGB_PIXELART = 2; -static const float TEXTURETYPE_NV12 = 3; -static const float TEXTURETYPE_NV21 = 4; -static const float TEXTURETYPE_YUV = 5; +static const float TEXTURETYPE_PALETTE = 3; +static const float TEXTURETYPE_PALETTE_PIXELART = 4; +static const float TEXTURETYPE_NV12 = 5; +static const float TEXTURETYPE_NV21 = 6; +static const float TEXTURETYPE_YUV = 7; static const float INPUTTYPE_UNSPECIFIED = 0; static const float INPUTTYPE_SRGB = 1; @@ -119,6 +121,8 @@ typedef struct ID3D11Texture2D *mainTexture; ID3D11ShaderResourceView *mainTextureResourceView; ID3D11RenderTargetView *mainTextureRenderTargetView; + ID3D11Texture2D *paletteTexture; + ID3D11ShaderResourceView *paletteTextureResourceView; ID3D11Texture2D *stagingTexture; int lockedTexturePositionX; int lockedTexturePositionY; @@ -190,8 +194,10 @@ typedef struct ID3D11BlendState *currentBlendState; D3D11_Shader currentShader; D3D11_PixelShaderState currentShaderState[NUM_SHADERS]; + int numCurrentShaderResources; ID3D11ShaderResourceView *currentShaderResource; - ID3D11SamplerState *currentSampler; + int numCurrentShaderSamplers; + ID3D11SamplerState *currentShaderSampler; bool cliprectDirty; bool currentCliprectEnabled; SDL_Rect currentCliprect; @@ -269,6 +275,7 @@ static DXGI_FORMAT SDLPixelFormatToDXGITextureFormat(Uint32 format, Uint32 outpu return DXGI_FORMAT_B8G8R8X8_UNORM_SRGB; } return DXGI_FORMAT_B8G8R8X8_UNORM; + case SDL_PIXELFORMAT_INDEX8: case SDL_PIXELFORMAT_YV12: case SDL_PIXELFORMAT_IYUV: return DXGI_FORMAT_R8_UNORM; @@ -378,8 +385,10 @@ static void D3D11_ReleaseAll(SDL_Renderer *renderer) data->currentBlendState = NULL; data->currentShader = SHADER_NONE; SDL_zero(data->currentShaderState); + data->numCurrentShaderResources = 0; data->currentShaderResource = NULL; - data->currentSampler = NULL; + data->numCurrentShaderSamplers = 0; + data->currentShaderSampler = NULL; // Check for any leaks if in debug mode if (data->dxgiDebug) { @@ -1242,6 +1251,25 @@ static bool D3D11_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture, SD } } SDL_SetPointerProperty(SDL_GetTextureProperties(texture), SDL_PROP_TEXTURE_D3D11_TEXTURE_POINTER, textureData->mainTexture); + + if (texture->format == SDL_PIXELFORMAT_INDEX8) { + textureDesc.Width = 256; + textureDesc.Height = 1; + if (renderer->output_colorspace == SDL_COLORSPACE_SRGB_LINEAR) { + textureDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM_SRGB; + } else { + textureDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM; + } + + result = ID3D11Device_CreateTexture2D(rendererData->d3dDevice, + &textureDesc, + NULL, + &textureData->paletteTexture); + if (FAILED(result)) { + return WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device1::CreateTexture2D"), result); + } + } + #ifdef SDL_HAVE_YUV if (texture->format == SDL_PIXELFORMAT_YV12 || texture->format == SDL_PIXELFORMAT_IYUV) { @@ -1316,6 +1344,18 @@ static bool D3D11_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture, SD if (FAILED(result)) { return WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device1::CreateShaderResourceView"), result); } + + if (texture->format == SDL_PIXELFORMAT_INDEX8) { + resourceViewDesc.Format = textureDesc.Format; + result = ID3D11Device_CreateShaderResourceView(rendererData->d3dDevice, + (ID3D11Resource *)textureData->paletteTexture, + &resourceViewDesc, + &textureData->paletteTextureResourceView); + if (FAILED(result)) { + return WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device1::CreateShaderResourceView"), result); + } + } + #ifdef SDL_HAVE_YUV if (textureData->yuv) { result = ID3D11Device_CreateShaderResourceView(rendererData->d3dDevice, @@ -1384,6 +1424,8 @@ static void D3D11_DestroyTexture(SDL_Renderer *renderer, SAFE_RELEASE(data->mainTexture); SAFE_RELEASE(data->mainTextureResourceView); SAFE_RELEASE(data->mainTextureRenderTargetView); + SAFE_RELEASE(data->paletteTexture); + SAFE_RELEASE(data->paletteTextureResourceView); SAFE_RELEASE(data->stagingTexture); #ifdef SDL_HAVE_YUV SAFE_RELEASE(data->mainTextureU); @@ -1500,6 +1542,19 @@ static bool D3D11_UpdateTextureInternal(D3D11_RenderData *rendererData, ID3D11Te return true; } +static bool D3D11_UpdateTexturePalette(SDL_Renderer *renderer, SDL_Texture *texture) +{ + D3D11_RenderData *rendererData = (D3D11_RenderData *)renderer->internal; + D3D11_TextureData *textureData = (D3D11_TextureData *)texture->internal; + SDL_Palette *palette = texture->palette; + + if (!textureData) { + return SDL_SetError("Texture is not currently available"); + } + + return D3D11_UpdateTextureInternal(rendererData, textureData->paletteTexture, 4, 0, 0, palette->ncolors, 1, palette->colors, palette->ncolors * sizeof(*palette->colors)); +} + #ifdef SDL_HAVE_YUV static bool D3D11_UpdateTextureNV(SDL_Renderer *renderer, SDL_Texture *texture, const SDL_Rect *rect, @@ -2104,6 +2159,18 @@ static void D3D11_SetupShaderConstants(SDL_Renderer *renderer, const SDL_RenderC D3D11_TextureData *textureData = (D3D11_TextureData *)texture->internal; switch (texture->format) { + case SDL_PIXELFORMAT_INDEX8: + if (cmd->data.draw.texture_scale_mode == SDL_SCALEMODE_PIXELART) { + constants->texture_type = TEXTURETYPE_PALETTE_PIXELART; + constants->texture_width = texture->w; + constants->texture_height = texture->h; + constants->texel_width = 1.0f / constants->texture_width; + constants->texel_height = 1.0f / constants->texture_height; + } else { + constants->texture_type = TEXTURETYPE_PALETTE; + } + constants->input_type = INPUTTYPE_UNSPECIFIED; + break; case SDL_PIXELFORMAT_YV12: case SDL_PIXELFORMAT_IYUV: constants->texture_type = TEXTURETYPE_YUV; @@ -2179,15 +2246,14 @@ static D3D11_Shader SelectShader(const D3D11_PixelShaderConstants *shader_consta static bool D3D11_SetDrawState(SDL_Renderer *renderer, const SDL_RenderCommand *cmd, const D3D11_PixelShaderConstants *shader_constants, - const int numShaderResources, ID3D11ShaderResourceView **shaderResources, - ID3D11SamplerState *sampler, const Float4X4 *matrix) + int numShaderResources, ID3D11ShaderResourceView **shaderResources, + int numShaderSamplers, ID3D11SamplerState **shaderSamplers, const Float4X4 *matrix) { D3D11_RenderData *rendererData = (D3D11_RenderData *)renderer->internal; const Float4X4 *newmatrix = matrix ? matrix : &rendererData->identity; ID3D11RasterizerState *rasterizerState; ID3D11RenderTargetView *renderTargetView = D3D11_GetCurrentRenderTargetView(renderer); - ID3D11ShaderResourceView *shaderResource; const SDL_BlendMode blendMode = cmd->data.draw.blend; ID3D11BlendState *blendState = NULL; bool updateSubresource = false; @@ -2195,17 +2261,22 @@ static bool D3D11_SetDrawState(SDL_Renderer *renderer, const SDL_RenderCommand * D3D11_PixelShaderState *shader_state = &rendererData->currentShaderState[shader]; D3D11_PixelShaderConstants solid_constants; - if (numShaderResources > 0) { - shaderResource = shaderResources[0]; - } else { - shaderResource = NULL; + bool shaderResourcesChanged = false; + if (numShaderResources != rendererData->numCurrentShaderResources || + (numShaderResources > 0 && shaderResources[0] != rendererData->currentShaderResource)) { + shaderResourcesChanged = true; + } + + bool shaderSamplersChanged = false; + if (numShaderSamplers != rendererData->numCurrentShaderSamplers || + (numShaderSamplers > 0 && shaderSamplers[0] != rendererData->currentShaderSampler)) { + shaderSamplersChanged = true; } // Make sure the render target isn't bound to a shader - if (shaderResource != rendererData->currentShaderResource) { + if (shaderResourcesChanged) { ID3D11ShaderResourceView *pNullResource = NULL; ID3D11DeviceContext_PSSetShaderResources(rendererData->d3dContext, 0, 1, &pNullResource); - rendererData->currentShaderResource = NULL; } if (renderTargetView != rendererData->currentRenderTargetView) { @@ -2308,13 +2379,19 @@ static bool D3D11_SetDrawState(SDL_Renderer *renderer, const SDL_RenderCommand * } rendererData->currentShader = shader; } - if (shaderResource != rendererData->currentShaderResource) { + if (shaderResourcesChanged) { ID3D11DeviceContext_PSSetShaderResources(rendererData->d3dContext, 0, numShaderResources, shaderResources); - rendererData->currentShaderResource = shaderResource; + rendererData->numCurrentShaderResources = numShaderResources; + if (numShaderResources > 0) { + rendererData->currentShaderResource = shaderResources[0]; + } } - if (sampler != rendererData->currentSampler) { - ID3D11DeviceContext_PSSetSamplers(rendererData->d3dContext, 0, 1, &sampler); - rendererData->currentSampler = sampler; + if (shaderSamplersChanged) { + ID3D11DeviceContext_PSSetSamplers(rendererData->d3dContext, 0, numShaderSamplers, shaderSamplers); + rendererData->numCurrentShaderSamplers = numShaderSamplers; + if (numShaderSamplers) { + rendererData->currentShaderSampler = shaderSamplers[0]; + } } if (updateSubresource == true || SDL_memcmp(&rendererData->vertexShaderConstantsData.model, newmatrix, sizeof(*newmatrix)) != 0) { @@ -2394,7 +2471,10 @@ static bool D3D11_SetCopyState(SDL_Renderer *renderer, const SDL_RenderCommand * SDL_Texture *texture = cmd->data.draw.texture; D3D11_RenderData *rendererData = (D3D11_RenderData *)renderer->internal; D3D11_TextureData *textureData = (D3D11_TextureData *)texture->internal; - ID3D11SamplerState *textureSampler; + int numShaderResources = 0; + ID3D11ShaderResourceView *shaderResources[3]; + int numShaderSamplers = 0; + ID3D11SamplerState *shaderSamplers[2]; D3D11_PixelShaderConstants constants; if (!textureData) { @@ -2403,34 +2483,33 @@ static bool D3D11_SetCopyState(SDL_Renderer *renderer, const SDL_RenderCommand * D3D11_SetupShaderConstants(renderer, cmd, texture, &constants); - textureSampler = D3D11_GetSamplerState(rendererData, cmd->data.draw.texture_scale_mode, cmd->data.draw.texture_address_mode_u, cmd->data.draw.texture_address_mode_v); - if (!textureSampler) { + shaderResources[numShaderResources++] = textureData->mainTextureResourceView; + + shaderSamplers[numShaderSamplers] = D3D11_GetSamplerState(rendererData, cmd->data.draw.texture_scale_mode, cmd->data.draw.texture_address_mode_u, cmd->data.draw.texture_address_mode_v); + if (!shaderSamplers[numShaderSamplers]) { return false; } + ++numShaderSamplers; + + if (texture->format == SDL_PIXELFORMAT_INDEX8) { + shaderResources[numShaderResources++] = textureData->paletteTextureResourceView; + + shaderSamplers[numShaderSamplers] = D3D11_GetSamplerState(rendererData, SDL_SCALEMODE_NEAREST, SDL_TEXTURE_ADDRESS_CLAMP, SDL_TEXTURE_ADDRESS_CLAMP); + if (!shaderSamplers[numShaderSamplers]) { + return false; + } + ++numShaderSamplers; + } #ifdef SDL_HAVE_YUV if (textureData->yuv) { - ID3D11ShaderResourceView *shaderResources[3]; - - shaderResources[0] = textureData->mainTextureResourceView; - shaderResources[1] = textureData->mainTextureResourceViewU; - shaderResources[2] = textureData->mainTextureResourceViewV; - - return D3D11_SetDrawState(renderer, cmd, &constants, - SDL_arraysize(shaderResources), shaderResources, textureSampler, matrix); - + shaderResources[numShaderResources++] = textureData->mainTextureResourceViewU; + shaderResources[numShaderResources++] = textureData->mainTextureResourceViewV; } else if (textureData->nv12) { - ID3D11ShaderResourceView *shaderResources[2]; - - shaderResources[0] = textureData->mainTextureResourceView; - shaderResources[1] = textureData->mainTextureResourceViewNV; - - return D3D11_SetDrawState(renderer, cmd, &constants, - SDL_arraysize(shaderResources), shaderResources, textureSampler, matrix); + shaderResources[numShaderResources++] = textureData->mainTextureResourceViewNV; } #endif // SDL_HAVE_YUV - return D3D11_SetDrawState(renderer, cmd, &constants, - 1, &textureData->mainTextureResourceView, textureSampler, matrix); + return D3D11_SetDrawState(renderer, cmd, &constants, numShaderResources, shaderResources, numShaderSamplers, shaderSamplers, matrix); } static void D3D11_DrawPrimitives(SDL_Renderer *renderer, D3D11_PRIMITIVE_TOPOLOGY primitiveTopology, const size_t vertexStart, const size_t vertexCount) @@ -2447,8 +2526,10 @@ static void D3D11_InvalidateCachedState(SDL_Renderer *renderer) data->currentRasterizerState = NULL; data->currentBlendState = NULL; data->currentShader = SHADER_NONE; + data->numCurrentShaderResources = 0; data->currentShaderResource = NULL; - data->currentSampler = NULL; + data->numCurrentShaderSamplers = 0; + data->currentShaderSampler = NULL; data->cliprectDirty = true; data->viewportDirty = true; } @@ -2527,7 +2608,7 @@ static bool D3D11_RunCommandQueue(SDL_Renderer *renderer, SDL_RenderCommand *cmd const size_t count = cmd->data.draw.count; const size_t first = cmd->data.draw.first; const size_t start = first / sizeof(D3D11_VertexPositionColor); - D3D11_SetDrawState(renderer, cmd, NULL, 0, NULL, NULL, NULL); + D3D11_SetDrawState(renderer, cmd, NULL, 0, NULL, 0, NULL, NULL); D3D11_DrawPrimitives(renderer, D3D11_PRIMITIVE_TOPOLOGY_POINTLIST, start, count); break; } @@ -2538,7 +2619,7 @@ static bool D3D11_RunCommandQueue(SDL_Renderer *renderer, SDL_RenderCommand *cmd const size_t first = cmd->data.draw.first; const size_t start = first / sizeof(D3D11_VertexPositionColor); const D3D11_VertexPositionColor *verts = (D3D11_VertexPositionColor *)(((Uint8 *)vertices) + first); - D3D11_SetDrawState(renderer, cmd, NULL, 0, NULL, NULL, NULL); + D3D11_SetDrawState(renderer, cmd, NULL, 0, NULL, 0, NULL, NULL); D3D11_DrawPrimitives(renderer, D3D11_PRIMITIVE_TOPOLOGY_LINESTRIP, start, count); if (verts[0].pos.x != verts[count - 1].pos.x || verts[0].pos.y != verts[count - 1].pos.y) { D3D11_DrawPrimitives(renderer, D3D11_PRIMITIVE_TOPOLOGY_POINTLIST, start + (count - 1), 1); @@ -2565,7 +2646,7 @@ static bool D3D11_RunCommandQueue(SDL_Renderer *renderer, SDL_RenderCommand *cmd if (texture) { D3D11_SetCopyState(renderer, cmd, NULL); } else { - D3D11_SetDrawState(renderer, cmd, NULL, 0, NULL, NULL, NULL); + D3D11_SetDrawState(renderer, cmd, NULL, 0, NULL, 0, NULL, NULL); } D3D11_DrawPrimitives(renderer, D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST, start, count); @@ -2766,6 +2847,7 @@ static bool D3D11_CreateRenderer(SDL_Renderer *renderer, SDL_Window *window, SDL renderer->WindowEvent = D3D11_WindowEvent; renderer->SupportsBlendMode = D3D11_SupportsBlendMode; renderer->CreateTexture = D3D11_CreateTexture; + renderer->UpdateTexturePalette = D3D11_UpdateTexturePalette; renderer->UpdateTexture = D3D11_UpdateTexture; #ifdef SDL_HAVE_YUV renderer->UpdateTextureYUV = D3D11_UpdateTextureYUV; @@ -2795,6 +2877,7 @@ static bool D3D11_CreateRenderer(SDL_Renderer *renderer, SDL_Window *window, SDL SDL_AddSupportedTextureFormat(renderer, SDL_PIXELFORMAT_XRGB8888); SDL_AddSupportedTextureFormat(renderer, SDL_PIXELFORMAT_ABGR2101010); SDL_AddSupportedTextureFormat(renderer, SDL_PIXELFORMAT_RGBA64_FLOAT); + SDL_AddSupportedTextureFormat(renderer, SDL_PIXELFORMAT_INDEX8); SDL_AddSupportedTextureFormat(renderer, SDL_PIXELFORMAT_YV12); SDL_AddSupportedTextureFormat(renderer, SDL_PIXELFORMAT_IYUV); SDL_AddSupportedTextureFormat(renderer, SDL_PIXELFORMAT_NV12); diff --git a/src/render/direct3d12/D3D12_PixelShader_Advanced.h b/src/render/direct3d12/D3D12_PixelShader_Advanced.h index c3cf8470a9..615ec19523 100644 --- a/src/render/direct3d12/D3D12_PixelShader_Advanced.h +++ b/src/render/direct3d12/D3D12_PixelShader_Advanced.h @@ -15,7 +15,7 @@ ; -------------------- ----- ------ -------- -------- ------- ------ ; SV_Target 0 xyzw 0 TARGET float xyzw ; -; shader hash: d37677952ab198af41892c76b2b3f57f +; shader hash: 26e68272f5341a5f825b203d33651395 ; ; Pipeline Runtime Information: ; @@ -71,6 +71,7 @@ ; ------------------------------ ---------- ------- ----------- ------- -------------- ------ ; Constants cbuffer NA NA CB0 cb1 1 ; sampler0 sampler NA NA S0 s0 1 +; sampler1 sampler NA NA S1 s1 1 ; texture0 texture f32 2d T0 t0 1 ; texture1 texture f32 2d T1 t1 1 ; texture2 texture f32 2d T2 t2 1 @@ -101,584 +102,670 @@ define void @main() { %1 = call %dx.types.Handle @dx.op.createHandle(i32 57, i8 0, i32 2, i32 2, i1 false) ; CreateHandle(resourceClass,rangeId,index,nonUniformIndex) %2 = call %dx.types.Handle @dx.op.createHandle(i32 57, i8 0, i32 1, i32 1, i1 false) ; CreateHandle(resourceClass,rangeId,index,nonUniformIndex) %3 = call %dx.types.Handle @dx.op.createHandle(i32 57, i8 0, i32 0, i32 0, i1 false) ; CreateHandle(resourceClass,rangeId,index,nonUniformIndex) - %4 = call %dx.types.Handle @dx.op.createHandle(i32 57, i8 3, i32 0, i32 0, i1 false) ; CreateHandle(resourceClass,rangeId,index,nonUniformIndex) - %5 = call %dx.types.Handle @dx.op.createHandle(i32 57, i8 2, i32 0, i32 1, i1 false) ; CreateHandle(resourceClass,rangeId,index,nonUniformIndex) - %6 = call float @dx.op.loadInput.f32(i32 4, i32 2, i32 0, i8 0, i32 undef) ; LoadInput(inputSigId,rowIndex,colIndex,gsVertexAxis) - %7 = call float @dx.op.loadInput.f32(i32 4, i32 2, i32 0, i8 1, i32 undef) ; LoadInput(inputSigId,rowIndex,colIndex,gsVertexAxis) - %8 = call float @dx.op.loadInput.f32(i32 4, i32 2, i32 0, i8 2, i32 undef) ; LoadInput(inputSigId,rowIndex,colIndex,gsVertexAxis) - %9 = call float @dx.op.loadInput.f32(i32 4, i32 2, i32 0, i8 3, i32 undef) ; LoadInput(inputSigId,rowIndex,colIndex,gsVertexAxis) - %10 = call float @dx.op.loadInput.f32(i32 4, i32 1, i32 0, i8 0, i32 undef) ; LoadInput(inputSigId,rowIndex,colIndex,gsVertexAxis) - %11 = call float @dx.op.loadInput.f32(i32 4, i32 1, i32 0, i8 1, i32 undef) ; LoadInput(inputSigId,rowIndex,colIndex,gsVertexAxis) - %12 = call %dx.types.CBufRet.f32 @dx.op.cbufferLoadLegacy.f32(i32 59, %dx.types.Handle %5, i32 0) ; CBufferLoadLegacy(handle,regIndex) - %13 = extractvalue %dx.types.CBufRet.f32 %12, 1 - %14 = fcmp fast oeq float %13, 0.000000e+00 - br i1 %14, label %175, label %15 + %4 = call %dx.types.Handle @dx.op.createHandle(i32 57, i8 3, i32 1, i32 1, i1 false) ; CreateHandle(resourceClass,rangeId,index,nonUniformIndex) + %5 = call %dx.types.Handle @dx.op.createHandle(i32 57, i8 3, i32 0, i32 0, i1 false) ; CreateHandle(resourceClass,rangeId,index,nonUniformIndex) + %6 = call %dx.types.Handle @dx.op.createHandle(i32 57, i8 2, i32 0, i32 1, i1 false) ; CreateHandle(resourceClass,rangeId,index,nonUniformIndex) + %7 = call float @dx.op.loadInput.f32(i32 4, i32 2, i32 0, i8 0, i32 undef) ; LoadInput(inputSigId,rowIndex,colIndex,gsVertexAxis) + %8 = call float @dx.op.loadInput.f32(i32 4, i32 2, i32 0, i8 1, i32 undef) ; LoadInput(inputSigId,rowIndex,colIndex,gsVertexAxis) + %9 = call float @dx.op.loadInput.f32(i32 4, i32 2, i32 0, i8 2, i32 undef) ; LoadInput(inputSigId,rowIndex,colIndex,gsVertexAxis) + %10 = call float @dx.op.loadInput.f32(i32 4, i32 2, i32 0, i8 3, i32 undef) ; LoadInput(inputSigId,rowIndex,colIndex,gsVertexAxis) + %11 = call float @dx.op.loadInput.f32(i32 4, i32 1, i32 0, i8 0, i32 undef) ; LoadInput(inputSigId,rowIndex,colIndex,gsVertexAxis) + %12 = call float @dx.op.loadInput.f32(i32 4, i32 1, i32 0, i8 1, i32 undef) ; LoadInput(inputSigId,rowIndex,colIndex,gsVertexAxis) + %13 = call %dx.types.CBufRet.f32 @dx.op.cbufferLoadLegacy.f32(i32 59, %dx.types.Handle %6, i32 0) ; CBufferLoadLegacy(handle,regIndex) + %14 = extractvalue %dx.types.CBufRet.f32 %13, 1 + %15 = fcmp fast oeq float %14, 0.000000e+00 + br i1 %15, label %253, label %16 -;