Permalink
Browse files

Many fixes to get evas textures to render correctly. Not there yet.

  • Loading branch information...
1 parent c38600c commit 99882fd79a6c308ae7a815977f67e1d8037fa6eb @gzorin committed Aug 10, 2012
View
@@ -132,11 +132,13 @@ rsxgl_memory_transfer(gcmContextData * context,
const memory_t & src,const int32_t srcpitch,const uint8_t srcbytes,
const uint32_t linelength,const uint32_t linecount)
{
+#if 0
rsxgl_debug_printf("%s: dst:%u (%u) %u %u src:%u (%u) %u %u; %ux%u\n",
__PRETTY_FUNCTION__,
dst.offset,dst.location,dstpitch,dstbytes,
src.offset,src.location,srcpitch,srcbytes,
linelength,linecount);
+#endif
uint32_t * buffer = gcm_reserve(context,12);
@@ -907,6 +907,16 @@ rsxgl_attribs_validate(rsxgl_context_t * ctx,const bit_set< RSXGL_MAX_VERTEX_ATT
const memory_t memory = vbo.memory + attribs.offset[i];
+#if 0
+ rsxgl_debug_printf("\t%u m:%u %u o:%u stride:%u size:%u t:%x\n",
+ (unsigned int)i,
+ memory.location,memory.offset,
+ attribs.offset[i],
+ (uint32_t)attribs.stride[i],
+ (uint32_t)attribs.size[i],
+ (uint32_t)attribs.type[i]);
+#endif
+
gcm_emit_method_at(buffer,nbuffer + 0,NV30_3D_VTXBUF(i),1);
gcm_emit_at(buffer,nbuffer + 1,memory.offset | ((uint32_t)memory.location << 31));
gcm_emit_method_at(buffer,nbuffer + 2,NV30_3D_VTXFMT(i),1);
@@ -1733,6 +1733,8 @@ rsxgl_program_validate(rsxgl_context_t * ctx,const uint32_t timestamp)
// Texcoord control:
#define NV40TCL_TEX_COORD_CONTROL(x) (0x00000b40+((x)*4))
+
+#if 0
bit_set< RSXGL_MAX_TEXTURE_COORDS >::const_iterator it = program.fp_texcoords.begin(),
it2D = program.fp_texcoord2D.begin(),
it3D = program.fp_texcoord3D.begin();
@@ -1746,14 +1748,9 @@ rsxgl_program_validate(rsxgl_context_t * ctx,const uint32_t timestamp)
((it3D.test() ? (1 << 4) : 0) | (it2D.test() ? 1 : 0)) :
(0)
};
+#endif
- rsxgl_debug_printf("%u %u, %u %u %u: %x %x\n",
- j,i,
- (uint32_t)it.test(),
- (uint32_t)it2D.test(),
- (uint32_t)it3D.test(),
- cmds[0],cmds[1]);
-
+#if 0
gcm_emit_method_at(buffer,i,cmds[0],1);
gcm_emit_at(buffer,i + 1,cmds[1]);
#endif
@@ -1769,7 +1766,17 @@ rsxgl_program_validate(rsxgl_context_t * ctx,const uint32_t timestamp)
it3D.next(program.fp_texcoord3D);
reg += 4;
}
-
+#endif
+
+ uint32_t fp_texcoord_mask = program.vp_output_mask >> 14;
+ for(size_t j = 0;j < RSXGL_MAX_TEXTURE_COORDS;++j,fp_texcoord_mask >>= 1,i += 2) {
+ gcm_emit_method_at(buffer,i,NV40TCL_TEX_COORD_CONTROL(j),1);
+ //gcm_emit_at(buffer,i + 1,(fp_texcoord_mask & 0x1) ? ((1)) : 0);
+ //gcm_emit_at(buffer,i + 1,(fp_texcoord_mask & 0x1) ? ((1) | (1 << 4)) : 0);
+ //gcm_emit_at(buffer,i + 1,(((uint32_t)1) | ((uint32_t)1 << 4)));
+ gcm_emit_at(buffer,i + 1,0);
+ }
+
gcm_emit_method_at(buffer,i++,NV30_3D_FP_CONTROL,1);
gcm_emit_at(buffer,i++,program.fp_control);
@@ -1943,13 +1950,6 @@ rsxgl_feedback_program_validate(rsxgl_context_t * ctx,const uint32_t timestamp)
(0)
};
- rsxgl_debug_printf("%u %u, %u %u %u: %x %x\n",
- j,i,
- (uint32_t)it.test(),
- (uint32_t)it2D.test(),
- (uint32_t)it3D.test(),
- cmds[0],cmds[1]);
-
gcm_emit_method_at(buffer,i,cmds[0],1);
gcm_emit_at(buffer,i + 1,cmds[1]);
#endif
@@ -1644,12 +1644,14 @@ rsxgl_choose_format(struct pipe_screen *screen, GLenum internalFormat,
}
#endif
+#if 0
/* search for exact matches */
pf = find_exact_format(internalFormat, format, type);
if (pf != PIPE_FORMAT_NONE &&
screen->is_format_supported(screen, pf,
target, sample_count, bindings))
return pf;
+#endif
/* search table for internalFormat */
for (i = 0; i < Elements(format_map); i++) {
@@ -1791,8 +1793,7 @@ rsxgl_choose_source_format(GLenum format,GLenum type)
else if(format == GL_BGR) {
if(type == GL_UNSIGNED_BYTE) {
return PIPE_FORMAT_X8R8G8B8_UNORM;
- }
-
+ }
}
else if(format == GL_RGBA) {
if(type == GL_UNSIGNED_BYTE) {
@@ -1822,6 +1823,22 @@ rsxgl_choose_source_format(GLenum format,GLenum type)
return PIPE_FORMAT_A8R8G8B8_UNORM;
}
}
+ else if(format == GL_ALPHA) {
+ if(type == GL_UNSIGNED_BYTE) {
+ return PIPE_FORMAT_A8_UNORM;
+ }
+ else if(type == GL_BYTE) {
+ return PIPE_FORMAT_A8_SNORM;
+ }
+ }
+ else if(format == GL_LUMINANCE) {
+ if(type == GL_UNSIGNED_BYTE) {
+ return PIPE_FORMAT_L8_UNORM;
+ }
+ else if(type == GL_BYTE) {
+ return PIPE_FORMAT_L8_SNORM;
+ }
+ }
return PIPE_FORMAT_NONE;
}
@@ -1332,7 +1332,8 @@ rsxgl_texture_validate_storage(rsxgl_context_t * ctx,texture_t & texture)
rsxgl_assert(pfmt != 0);
const uint32_t fmt = pfmt -> fmt[4] | NV40_3D_TEX_FORMAT_LINEAR | (texture.rect ? NV40_3D_TEX_FORMAT_RECT : 0) | 0x8000;
-
+
+#if 0
rsxgl_debug_printf("%s: dims:%u pformat:%u size:%ux%ux%u pitch:%u levels:%u bytes:%u fmt:%x\n",__PRETTY_FUNCTION__,
(unsigned int)texture.dims,
(unsigned int)texture.pformat,
@@ -1341,6 +1342,7 @@ rsxgl_texture_validate_storage(rsxgl_context_t * ctx,texture_t & texture)
(unsigned int)texture.num_levels,
(unsigned int)nbytes,(unsigned int)fmt);
rsxgl_debug_printf("\toffset:%u\n",texture.memory.offset);
+#endif
texture.format =
((texture.memory.location == 0) ? NV30_3D_TEX_FORMAT_DMA0 : NV30_3D_TEX_FORMAT_DMA1) |
@@ -2335,6 +2337,16 @@ rsxgl_textures_validate(rsxgl_context_t * ctx,program_t & program,uint32_t times
rsxgl_texture_validate(ctx,texture,timestamp);
if(texture.memory) {
+#if 0
+ rsxgl_debug_printf("texture: %u (%u) memory: %u %u pformat: %u format:%x size:%ux%u pitch:%u remap:%x\n",
+ index,api_index,
+ texture.memory.location,texture.memory.offset,
+ texture.pformat,
+ texture.format,
+ (uint32_t)texture.size[0],(uint32_t)texture.size[1],
+ (uint32_t)texture.pitch,(uint32_t)texture.remap);
+#endif
+
// activate the texture:
uint32_t * buffer = gcm_reserve(context,11);
@@ -68,10 +68,10 @@ struct sampler_t {
};
enum rsxgl_texture_swizzle_inputs {
- RSXGL_TEXTURE_SWIZZLE_FROM_R = 1,
- RSXGL_TEXTURE_SWIZZLE_FROM_G = 2,
- RSXGL_TEXTURE_SWIZZLE_FROM_B = 3,
- RSXGL_TEXTURE_SWIZZLE_FROM_A = 0,
+ RSXGL_TEXTURE_SWIZZLE_FROM_R = 0,
+ RSXGL_TEXTURE_SWIZZLE_FROM_G = 1,
+ RSXGL_TEXTURE_SWIZZLE_FROM_B = 2,
+ RSXGL_TEXTURE_SWIZZLE_FROM_A = 3,
RSXGL_TEXTURE_SWIZZLE_ZERO = 4,
RSXGL_TEXTURE_SWIZZLE_ONE = 5
};
@@ -2,6 +2,8 @@
#include "nvfx_resource.h"
#include "nvfx_tex.h"
+extern void rsxgl_debug_printf(const char * fmt,...);
+
static void *
nvfx_sampler_state_create(struct pipe_context *pipe,
const struct pipe_sampler_state *cso)
@@ -367,13 +369,24 @@ nvfx_get_texture_format(enum pipe_format format)
uint32_t
nvfx_get_texture_remap(const struct nvfx_texture_format * tf,uint8_t r,uint8_t g,uint8_t b,uint8_t a)
{
+#if 0
+ rsxgl_debug_printf("%s: src:%u %u %u %u comp:%u %u %u %u\n",__PRETTY_FUNCTION__,
+ tf->src[0],tf->src[1],tf->src[2],tf->src[3],
+ tf->comp[0],tf->comp[1],tf->comp[2],tf->comp[3]);
+
+ rsxgl_debug_printf("\tsrc:%u %u %u %u comp:%u %u %u %u\n",
+ tf->src[r],tf->src[g],tf->src[b],tf->src[a],
+ tf->comp[r],tf->comp[g],tf->comp[b],tf->comp[a]);
+#endif
+
+ // Works for evas icons:
return 0
- | (tf->src[r] << NV30_3D_TEX_SWIZZLE_S0_Z__SHIFT)
- | (tf->src[g] << NV30_3D_TEX_SWIZZLE_S0_Y__SHIFT)
- | (tf->src[b] << NV30_3D_TEX_SWIZZLE_S0_X__SHIFT)
- | (tf->src[a] << NV30_3D_TEX_SWIZZLE_S0_W__SHIFT)
- | (tf->comp[r] << NV30_3D_TEX_SWIZZLE_S1_Z__SHIFT)
- | (tf->comp[g] << NV30_3D_TEX_SWIZZLE_S1_Y__SHIFT)
- | (tf->comp[b] << NV30_3D_TEX_SWIZZLE_S1_X__SHIFT)
- | (tf->comp[a] << NV30_3D_TEX_SWIZZLE_S1_W__SHIFT);
+ | ((uint32_t)tf->src[b] << NV30_3D_TEX_SWIZZLE_S0_X__SHIFT)
+ | ((uint32_t)tf->src[g] << NV30_3D_TEX_SWIZZLE_S0_Y__SHIFT)
+ | ((uint32_t)tf->src[r] << NV30_3D_TEX_SWIZZLE_S0_Z__SHIFT)
+ | ((uint32_t)tf->src[a] << NV30_3D_TEX_SWIZZLE_S0_W__SHIFT)
+ | ((uint32_t)tf->comp[b] << NV30_3D_TEX_SWIZZLE_S1_X__SHIFT)
+ | ((uint32_t)tf->comp[g] << NV30_3D_TEX_SWIZZLE_S1_Y__SHIFT)
+ | ((uint32_t)tf->comp[r] << NV30_3D_TEX_SWIZZLE_S1_Z__SHIFT)
+ | ((uint32_t)tf->comp[a] << NV30_3D_TEX_SWIZZLE_S1_W__SHIFT);
}
@@ -74,8 +74,8 @@ copyteximage_sources = copyteximage.cc texture.c fbo_inner.vert fbo_inner.frag n
feedback1_objects =
feedback1_sources = feedback1.cc points.vert feedback1.frag
-objects = $(feedback1_objects)
-sources = $(feedback1_sources)
+objects = $(texcube_objects)
+sources = $(texcube_sources)
rsxgltest_elf_DEPENDENCIES = $(top_builddir)/src/library/libEGL.a $(top_builddir)/src/library/libGL.a \
$(objects)
@@ -269,9 +269,9 @@ rsxgltest_init(int argc,const char ** argv)
// Set up us the vertex data:
glGenBuffers(2,buffers);
- glBindBuffer(GL_ARRAY_BUFFER,buffers[0]);
+ //glBindBuffer(GL_ARRAY_BUFFER,buffers[0]);
+ //glBufferData(GL_ARRAY_BUFFER,sizeof(float) * 6 * 4 * 5,geometry,GL_STATIC_DRAW);
- glBufferData(GL_ARRAY_BUFFER,sizeof(float) * 6 * 4 * 5,geometry,GL_STATIC_DRAW);
glEnableVertexAttribArray(vertex_location);
glEnableVertexAttribArray(tc_location);
glVertexAttribPointer(vertex_location,3,GL_FLOAT,GL_FALSE,sizeof(float) * 5,0);

0 comments on commit 99882fd

Please sign in to comment.