mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-22 22:00:39 -06:00
PixelShaderGen: Split bbox into seperate variables
The Metal shader compiler fails to compile the atomic instructions when operating on individual components of a vector. Spltting it into four variables shouldn't make any difference for other platforms, as they are accessed independently.
This commit is contained in:
@ -1239,17 +1239,23 @@ ShaderCode GenPixelShader(APIType ApiType, const ShaderHostConfig& host_config,
|
||||
|
||||
if (bounding_box)
|
||||
{
|
||||
const char* atomic_op =
|
||||
(ApiType == APIType::OpenGL || ApiType == APIType::Vulkan) ? "atomic" : "Interlocked";
|
||||
out.Write(" if (bpmem_bounding_box) {\n");
|
||||
out.Write(" if(bbox_data[0] > int(rawpos.x)) %sMin(bbox_data[0], int(rawpos.x));\n",
|
||||
atomic_op);
|
||||
out.Write(" if(bbox_data[1] < int(rawpos.x)) %sMax(bbox_data[1], int(rawpos.x));\n",
|
||||
atomic_op);
|
||||
out.Write(" if(bbox_data[2] > int(rawpos.y)) %sMin(bbox_data[2], int(rawpos.y));\n",
|
||||
atomic_op);
|
||||
out.Write(" if(bbox_data[3] < int(rawpos.y)) %sMax(bbox_data[3], int(rawpos.y));\n",
|
||||
atomic_op);
|
||||
if (ApiType == APIType::D3D)
|
||||
{
|
||||
out.Write(
|
||||
" if(bbox_data[0] > int(rawpos.x)) InterlockedMin(bbox_data[0], int(rawpos.x));\n"
|
||||
" if(bbox_data[1] < int(rawpos.x)) InterlockedMax(bbox_data[1], int(rawpos.x));\n"
|
||||
" if(bbox_data[2] > int(rawpos.y)) InterlockedMin(bbox_data[2], int(rawpos.y));\n"
|
||||
" if(bbox_data[3] < int(rawpos.y)) InterlockedMax(bbox_data[3], int(rawpos.y));\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
out.Write("\tif(bbox_left > int(rawpos.x)) atomicMin(bbox_left, int(rawpos.x));\n"
|
||||
"\tif(bbox_right < int(rawpos.x)) atomicMax(bbox_right, int(rawpos.x));\n"
|
||||
"\tif(bbox_top > int(rawpos.y)) atomicMin(bbox_top, int(rawpos.y));\n"
|
||||
"\tif(bbox_bottom < int(rawpos.y)) atomicMax(bbox_bottom, int(rawpos.y));\n");
|
||||
}
|
||||
|
||||
out.Write(" }\n");
|
||||
}
|
||||
|
||||
@ -1414,4 +1420,4 @@ void EnumeratePixelShaderUids(const std::function<void(const PixelShaderUid&)>&
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} // namespace UberShader
|
||||
|
Reference in New Issue
Block a user