mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-02-14 07:43:14 +00:00
Removed TEXTURETYPE_PALETTE_PIXELART
This doesn't make any sense since the pixel art algorithm uses a box filter to get an average pixel value which isn't possible with indexed textures.
This commit is contained in:
@@ -71,10 +71,9 @@ static const float TEXTURETYPE_RGB_PIXELART = 2;
|
||||
static const float TEXTURETYPE_RGBA = 3;
|
||||
static const float TEXTURETYPE_RGBA_PIXELART = 4;
|
||||
static const float TEXTURETYPE_PALETTE = 5;
|
||||
static const float TEXTURETYPE_PALETTE_PIXELART = 6;
|
||||
static const float TEXTURETYPE_NV12 = 7;
|
||||
static const float TEXTURETYPE_NV21 = 8;
|
||||
static const float TEXTURETYPE_YUV = 9;
|
||||
static const float TEXTURETYPE_NV12 = 6;
|
||||
static const float TEXTURETYPE_NV21 = 7;
|
||||
static const float TEXTURETYPE_YUV = 8;
|
||||
|
||||
static const float INPUTTYPE_UNSPECIFIED = 0;
|
||||
static const float INPUTTYPE_SRGB = 1;
|
||||
@@ -831,11 +830,7 @@ static void CalculateAdvancedShaderConstants(SDL_Renderer *renderer, const SDL_R
|
||||
default:
|
||||
switch (texture->format) {
|
||||
case SDL_PIXELFORMAT_INDEX8:
|
||||
if (cmd->data.draw.texture_scale_mode == SDL_SCALEMODE_PIXELART) {
|
||||
constants->texture_type = TEXTURETYPE_PALETTE_PIXELART;
|
||||
} else {
|
||||
constants->texture_type = TEXTURETYPE_PALETTE;
|
||||
}
|
||||
constants->texture_type = TEXTURETYPE_PALETTE;
|
||||
break;
|
||||
case SDL_PIXELFORMAT_BGRX32:
|
||||
case SDL_PIXELFORMAT_RGBX32:
|
||||
@@ -851,6 +846,10 @@ static void CalculateAdvancedShaderConstants(SDL_Renderer *renderer, const SDL_R
|
||||
case SDL_PIXELFORMAT_RGBA64_FLOAT:
|
||||
if (cmd->data.draw.texture_scale_mode == SDL_SCALEMODE_PIXELART) {
|
||||
constants->texture_type = TEXTURETYPE_RGBA_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_RGBA;
|
||||
}
|
||||
@@ -870,13 +869,6 @@ static void CalculateAdvancedShaderConstants(SDL_Renderer *renderer, const SDL_R
|
||||
break;
|
||||
}
|
||||
|
||||
if (cmd->data.draw.texture_scale_mode == SDL_SCALEMODE_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;
|
||||
}
|
||||
|
||||
constants->sdr_white_point = texture->SDR_white_point;
|
||||
|
||||
if (renderer->target) {
|
||||
|
||||
@@ -44,10 +44,9 @@ static const float TEXTURETYPE_RGB_PIXELART = 2;
|
||||
static const float TEXTURETYPE_RGBA = 3;
|
||||
static const float TEXTURETYPE_RGBA_PIXELART = 4;
|
||||
static const float TEXTURETYPE_PALETTE = 5;
|
||||
static const float TEXTURETYPE_PALETTE_PIXELART = 6;
|
||||
static const float TEXTURETYPE_NV12 = 7;
|
||||
static const float TEXTURETYPE_NV21 = 8;
|
||||
static const float TEXTURETYPE_YUV = 9;
|
||||
static const float TEXTURETYPE_NV12 = 6;
|
||||
static const float TEXTURETYPE_NV21 = 7;
|
||||
static const float TEXTURETYPE_YUV = 8;
|
||||
|
||||
static const float INPUTTYPE_UNSPECIFIED = 0;
|
||||
static const float INPUTTYPE_SRGB = 1;
|
||||
@@ -159,10 +158,6 @@ float4 GetInputColor(PSInput input)
|
||||
} else if (texture_type == TEXTURETYPE_PALETTE) {
|
||||
float index = texture0.Sample(sampler0, input.v_uv).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.SampleGrad(sampler0, uv, ddx(input.v_uv), ddy(input.v_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.v_uv).r;
|
||||
|
||||
Reference in New Issue
Block a user