Cleanup: Avoid duplicative defines for CPU textures, use the ones from util_texture.h

Also includes some further byte -> byte4 renaming, missed that in last commit.
This commit is contained in:
2016-05-09 09:16:41 +02:00
parent e0e7d94f79
commit d6555d936c
4 changed files with 12 additions and 12 deletions

View File

@@ -27,6 +27,9 @@
#include "device.h"
#include "device_intern.h"
/* Texture limits and slot info */
#include "util_texture.h"
#include "kernel.h"
#include "kernel_compat_cpu.h"
#include "kernel_types.h"

View File

@@ -479,9 +479,9 @@ typedef texture_image<uchar4> texture_image_uchar4;
#define kernel_tex_fetch_ssef(tex, index) (kg->tex.fetch_ssef(index))
#define kernel_tex_fetch_ssei(tex, index) (kg->tex.fetch_ssei(index))
#define kernel_tex_lookup(tex, t, offset, size) (kg->tex.lookup(t, offset, size))
#define kernel_tex_image_interp(tex, x, y) ((tex < MAX_FLOAT4_IMAGES) ? kg->texture_float4_images[tex].interp(x, y) : kg->texture_byte_images[tex - MAX_FLOAT4_IMAGES].interp(x, y))
#define kernel_tex_image_interp_3d(tex, x, y, z) ((tex < MAX_FLOAT4_IMAGES) ? kg->texture_float4_images[tex].interp_3d(x, y, z) : kg->texture_byte_images[tex - MAX_FLOAT4_IMAGES].interp_3d(x, y, z))
#define kernel_tex_image_interp_3d_ex(tex, x, y, z, interpolation) ((tex < MAX_FLOAT4_IMAGES) ? kg->texture_float4_images[tex].interp_3d_ex(x, y, z, interpolation) : kg->texture_byte_images[tex - MAX_FLOAT4_IMAGES].interp_3d_ex(x, y, z, interpolation))
#define kernel_tex_image_interp(tex, x, y) ((tex < TEX_NUM_FLOAT4_IMAGES_CPU) ? kg->texture_float4_images[tex].interp(x, y) : kg->texture_byte4_images[tex - TEX_NUM_FLOAT4_IMAGES_CPU].interp(x, y))
#define kernel_tex_image_interp_3d(tex, x, y, z) ((tex < TEX_NUM_FLOAT4_IMAGES_CPU) ? kg->texture_float4_images[tex].interp_3d(x, y, z) : kg->texture_byte4_images[tex - TEX_NUM_FLOAT4_IMAGES_CPU].interp_3d(x, y, z))
#define kernel_tex_image_interp_3d_ex(tex, x, y, z, interpolation) ((tex < TEX_NUM_FLOAT4_IMAGES_CPU) ? kg->texture_float4_images[tex].interp_3d_ex(x, y, z, interpolation) : kg->texture_byte4_images[tex - TEX_NUM_FLOAT4_IMAGES_CPU].interp_3d_ex(x, y, z, interpolation))
#define kernel_data (kg->__data)

View File

@@ -31,12 +31,9 @@ struct OSLThreadData;
struct OSLShadingSystem;
# endif
# define MAX_BYTE_IMAGES 1024
# define MAX_FLOAT4_IMAGES 1024
typedef struct KernelGlobals {
texture_image_uchar4 texture_byte_images[MAX_BYTE_IMAGES];
texture_image_float4 texture_float4_images[MAX_FLOAT4_IMAGES];
texture_image_uchar4 texture_byte4_images[TEX_NUM_BYTE4_IMAGES_CPU];
texture_image_float4 texture_float4_images[TEX_NUM_FLOAT4_IMAGES_CPU];
# define KERNEL_TEX(type, ttype, name) ttype name;
# define KERNEL_IMAGE_TEX(type, ttype, name)

View File

@@ -95,7 +95,7 @@ void kernel_tex_copy(KernelGlobals *kg,
int id = atoi(name + strlen("__tex_image_float4_"));
int array_index = id;
if(array_index >= 0 && array_index < MAX_FLOAT4_IMAGES) {
if(array_index >= 0 && array_index < TEX_NUM_FLOAT4_IMAGES_CPU) {
tex = &kg->texture_float4_images[array_index];
}
@@ -109,10 +109,10 @@ void kernel_tex_copy(KernelGlobals *kg,
else if(strstr(name, "__tex_image_byte4")) {
texture_image_uchar4 *tex = NULL;
int id = atoi(name + strlen("__tex_image_byte4_"));
int array_index = id - MAX_FLOAT4_IMAGES;
int array_index = id - TEX_NUM_FLOAT4_IMAGES_CPU;
if(array_index >= 0 && array_index < MAX_BYTE_IMAGES) {
tex = &kg->texture_byte_images[array_index];
if(array_index >= 0 && array_index < TEX_NUM_BYTE4_IMAGES_CPU) {
tex = &kg->texture_byte4_images[array_index];
}
if(tex) {