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:
		@@ -27,6 +27,9 @@
 | 
				
			|||||||
#include "device.h"
 | 
					#include "device.h"
 | 
				
			||||||
#include "device_intern.h"
 | 
					#include "device_intern.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/* Texture limits and slot info */
 | 
				
			||||||
 | 
					#include "util_texture.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "kernel.h"
 | 
					#include "kernel.h"
 | 
				
			||||||
#include "kernel_compat_cpu.h"
 | 
					#include "kernel_compat_cpu.h"
 | 
				
			||||||
#include "kernel_types.h"
 | 
					#include "kernel_types.h"
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -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_ssef(tex, index) (kg->tex.fetch_ssef(index))
 | 
				
			||||||
#define kernel_tex_fetch_ssei(tex, index) (kg->tex.fetch_ssei(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_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(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 < 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(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 < 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_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)
 | 
					#define kernel_data (kg->__data)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -31,12 +31,9 @@ struct OSLThreadData;
 | 
				
			|||||||
struct OSLShadingSystem;
 | 
					struct OSLShadingSystem;
 | 
				
			||||||
#  endif
 | 
					#  endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#  define MAX_BYTE_IMAGES   1024
 | 
					 | 
				
			||||||
#  define MAX_FLOAT4_IMAGES  1024
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
typedef struct KernelGlobals {
 | 
					typedef struct KernelGlobals {
 | 
				
			||||||
	texture_image_uchar4 texture_byte_images[MAX_BYTE_IMAGES];
 | 
						texture_image_uchar4 texture_byte4_images[TEX_NUM_BYTE4_IMAGES_CPU];
 | 
				
			||||||
	texture_image_float4 texture_float4_images[MAX_FLOAT4_IMAGES];
 | 
						texture_image_float4 texture_float4_images[TEX_NUM_FLOAT4_IMAGES_CPU];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#  define KERNEL_TEX(type, ttype, name) ttype name;
 | 
					#  define KERNEL_TEX(type, ttype, name) ttype name;
 | 
				
			||||||
#  define KERNEL_IMAGE_TEX(type, ttype, name)
 | 
					#  define KERNEL_IMAGE_TEX(type, ttype, name)
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -95,7 +95,7 @@ void kernel_tex_copy(KernelGlobals *kg,
 | 
				
			|||||||
		int id = atoi(name + strlen("__tex_image_float4_"));
 | 
							int id = atoi(name + strlen("__tex_image_float4_"));
 | 
				
			||||||
		int array_index = id;
 | 
							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];
 | 
								tex = &kg->texture_float4_images[array_index];
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -109,10 +109,10 @@ void kernel_tex_copy(KernelGlobals *kg,
 | 
				
			|||||||
	else if(strstr(name, "__tex_image_byte4")) {
 | 
						else if(strstr(name, "__tex_image_byte4")) {
 | 
				
			||||||
		texture_image_uchar4 *tex = NULL;
 | 
							texture_image_uchar4 *tex = NULL;
 | 
				
			||||||
		int id = atoi(name + strlen("__tex_image_byte4_"));
 | 
							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) {
 | 
							if(array_index >= 0 && array_index < TEX_NUM_BYTE4_IMAGES_CPU) {
 | 
				
			||||||
			tex = &kg->texture_byte_images[array_index];
 | 
								tex = &kg->texture_byte4_images[array_index];
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if(tex) {
 | 
							if(tex) {
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user