Metal: Address some mixed integer type warnings

This commit is contained in:
Clément Foucault
2023-07-14 11:09:39 +02:00
parent 32fb40fa76
commit a1faf4d678
8 changed files with 13 additions and 11 deletions

View File

@@ -74,7 +74,7 @@ void Film::init_aovs()
for (ViewLayerAOV *aov : aovs) {
bool is_value = (aov->type == AOV_TYPE_VALUE);
uint &index = is_value ? aovs_info.value_len : aovs_info.color_len;
int &index = is_value ? aovs_info.value_len : aovs_info.color_len;
uint &hash = is_value ? aovs_info.hash_value[index].x : aovs_info.hash_color[index].x;
hash = BLI_hash_string(aov->name);
index++;

View File

@@ -326,8 +326,8 @@ struct AOVsInfoData {
uint4 hash_value[AOV_MAX];
uint4 hash_color[AOV_MAX];
/* Length of used data. */
uint color_len;
uint value_len;
int color_len;
int value_len;
/** Id of the AOV to be displayed (from the start of the AOV array). -1 for combined. */
int display_id;
/** True if the AOV to be displayed is from the value accumulation buffer. */

View File

@@ -48,6 +48,8 @@ void main()
sphere.center = light._position;
sphere.radius = light.influence_radius_max;
break;
default:
break;
}
/* TODO(fclem): HiZ culling? Could be quite beneficial given the nature of the 2.5D culling. */

View File

@@ -292,13 +292,13 @@ void clear_aovs()
void output_aov(vec4 color, float value, uint hash)
{
#if defined(MAT_RENDER_PASS_SUPPORT) && defined(GPU_FRAGMENT_SHADER)
for (uint i = 0; i < AOV_MAX && i < rp_buf.aovs.color_len; i++) {
for (int i = 0; i < AOV_MAX && i < rp_buf.aovs.color_len; i++) {
if (rp_buf.aovs.hash_color[i].x == hash) {
imageStore(rp_color_img, ivec3(ivec2(gl_FragCoord.xy), rp_buf.color_len + i), color);
return;
}
}
for (uint i = 0; i < AOV_MAX && i < rp_buf.aovs.value_len; i++) {
for (int i = 0; i < AOV_MAX && i < rp_buf.aovs.value_len; i++) {
if (rp_buf.aovs.hash_value[i].x == hash) {
imageStore(rp_value_img, ivec3(ivec2(gl_FragCoord.xy), rp_buf.value_len + i), vec4(value));
return;

View File

@@ -69,7 +69,7 @@ bool intersects_near_plane(IsectBox box)
void main()
{
if (gl_GlobalInvocationID.x >= resource_len) {
if (int(gl_GlobalInvocationID.x) >= resource_len) {
return;
}

View File

@@ -81,7 +81,7 @@ typedef enum eObjectInfoFlag eObjectInfoFlag;
/** This should be already defined at shaderCreateInfo level. */
// # define DRW_VIEW_LEN 64
/** Global that needs to be set correctly in each shader stage. */
uint drw_view_id = 0;
int drw_view_id = 0;
/**
* In order to reduce the memory requirements, the view id is merged with resource id to avoid
* doubling the memory required only for view indexing.

View File

@@ -45,7 +45,7 @@ void write_draw_call(DrawGroup group, uint group_id)
void main()
{
uint proto_id = gl_GlobalInvocationID.x;
int proto_id = int(gl_GlobalInvocationID.x);
if (proto_id >= prototype_len) {
return;
}
@@ -59,7 +59,7 @@ void main()
uint visible_instance_len = 0;
if (visibility_word_per_draw > 0) {
uint visibility_word = resource_index * visibility_word_per_draw;
for (uint i = 0; i < visibility_word_per_draw; i++, visibility_word++) {
for (int i = 0; i < visibility_word_per_draw; i++, visibility_word++) {
/* NOTE: This assumes `proto.instance_len` is 1. */
/* TODO: Assert. */
visible_instance_len += bitCount(visibility_buf[visibility_word]);
@@ -103,7 +103,7 @@ void main()
/* Fill resource_id buffer for each instance of this draw. */
if (visibility_word_per_draw > 0) {
uint visibility_word = resource_index * visibility_word_per_draw;
for (uint i = 0; i < visibility_word_per_draw; i++, visibility_word++) {
for (int i = 0; i < visibility_word_per_draw; i++, visibility_word++) {
uint word = visibility_buf[visibility_word];
uint view_index = i * 32u;
while (word != 0u) {

View File

@@ -23,7 +23,7 @@ void mask_visibility_bit(uint view_id)
void main()
{
if (gl_GlobalInvocationID.x >= resource_len) {
if (int(gl_GlobalInvocationID.x) >= resource_len) {
return;
}